001package org.hl7.fhir.r4b.formats;
002
003// generated
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, \
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this \
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, \
015     this list of conditions and the following disclaimer in the documentation \
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
030  POSSIBILITY OF SUCH DAMAGE.
031  */
032
033// Generated on Wed, Dec 29, 2021 07:58+1100 for FHIR v4.3.0-snapshot1
034
035
036
037import org.hl7.fhir.r4b.model.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.utilities.xhtml.XhtmlNode;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
043import com.google.gson.JsonObject;
044import com.google.gson.JsonArray;
045import com.google.gson.JsonElement;
046import java.io.IOException;
047
048public class JsonParser extends JsonParserBase {
049
050  public JsonParser() {
051    super();
052  }
053
054  public JsonParser(boolean allowUnknownContent) {
055    super();
056    setAllowUnknownContent(allowUnknownContent);
057  }
058
059  public JsonParser(boolean allowUnknownContent, boolean allowComments) {
060    super();
061    setAllowUnknownContent(allowUnknownContent);
062    setAllowComments(allowComments);
063  }
064
065  protected void parseBaseProperties(JsonObject json, Base res) throws IOException, FHIRFormatError {
066    // nothing
067  }
068
069  @SuppressWarnings("unchecked")
070  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
071    Enumeration<E> res = new Enumeration<E>(e);
072    if (s != null)
073      res.setValue((E) e.fromCode(s));
074    return res;
075  }
076
077  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
078    DateType res = new DateType(v);
079    return res;
080  }
081
082  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
083    DateTimeType res = new DateTimeType(v);
084    return res;
085  }
086
087  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
088    CodeType res = new CodeType(v);
089    return res;
090  }
091
092  protected StringType parseString(String v) throws IOException, FHIRFormatError {
093    StringType res = new StringType(v);
094    return res;
095  }
096
097  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
098    IntegerType res = new IntegerType(v);
099    return res;
100  }
101
102  protected Integer64Type parseInteger64(java.lang.Long v) throws IOException, FHIRFormatError {
103    Integer64Type res = new Integer64Type(v);
104    return res;
105  }
106
107  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
108    OidType res = new OidType(v);
109    return res;
110  }
111
112  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
113    CanonicalType res = new CanonicalType(v);
114    return res;
115  }
116
117  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
118    UriType res = new UriType(v);
119    return res;
120  }
121
122  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
123    UuidType res = new UuidType(v);
124    return res;
125  }
126
127  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
128    UrlType res = new UrlType(v);
129    return res;
130  }
131
132  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
133    InstantType res = new InstantType(v);
134    return res;
135  }
136
137  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
138    BooleanType res = new BooleanType(v);
139    return res;
140  }
141
142  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
143    Base64BinaryType res = new Base64BinaryType(v);
144    return res;
145  }
146
147  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
148    UnsignedIntType res = new UnsignedIntType(v);
149    return res;
150  }
151
152  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
153    MarkdownType res = new MarkdownType(v);
154    return res;
155  }
156
157  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
158    TimeType res = new TimeType(v);
159    return res;
160  }
161
162  protected IdType parseId(String v) throws IOException, FHIRFormatError {
163    IdType res = new IdType(v);
164    return res;
165  }
166
167  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
168    PositiveIntType res = new PositiveIntType(v);
169    return res;
170  }
171
172  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
173    DecimalType res = new DecimalType(v);
174    if (v instanceof PresentedBigDecimal)
175      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
176    return res;
177  }
178
179
180
181  protected void parseElementProperties(JsonObject json, Element res) throws IOException, FHIRFormatError {
182    if (json.has("id"))
183      res.setIdElement(parseString(json.get("id").getAsString()));
184    if (json.has("_id"))
185      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
186    if (json.has("extension")) {
187      JsonArray array = getJArray(json, "extension");
188      for (int i = 0; i < array.size(); i++) {
189        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
190      }
191    };
192  }
193
194  protected void parseBackboneElementProperties(JsonObject json, BackboneElement res) throws IOException, FHIRFormatError {
195    parseDataTypeProperties(json, res);
196    if (json.has("modifierExtension")) {
197      JsonArray array = getJArray(json, "modifierExtension");
198      for (int i = 0; i < array.size(); i++) {
199        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
200      }
201    };
202  }
203
204  protected void parseDataTypeProperties(JsonObject json, DataType res) throws IOException, FHIRFormatError {
205    parseElementProperties(json, res);
206  }
207
208  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
209    Address res = new Address();
210    parseAddressProperties(json, res);
211    return res;
212  }
213
214  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
215    parseDataTypeProperties(json, res);
216    if (json.has("use"))
217      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
218    if (json.has("_use"))
219      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
220    if (json.has("type"))
221      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
222    if (json.has("_type"))
223      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
224    if (json.has("text"))
225      res.setTextElement(parseString(json.get("text").getAsString()));
226    if (json.has("_text"))
227      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
228    if (json.has("line")) {
229      JsonArray array = getJArray(json, "line");
230      for (int i = 0; i < array.size(); i++) {
231        if (array.get(i).isJsonNull()) {
232          res.getLine().add(new StringType());
233        } else {;
234          res.getLine().add(parseString(array.get(i).getAsString()));
235        }
236      }
237    };
238    if (json.has("_line")) {
239      JsonArray array = getJArray(json, "_line");
240      for (int i = 0; i < array.size(); i++) {
241        if (i == res.getLine().size())
242          res.getLine().add(parseString(null));
243        if (array.get(i) instanceof JsonObject) 
244          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
245      }
246    };
247    if (json.has("city"))
248      res.setCityElement(parseString(json.get("city").getAsString()));
249    if (json.has("_city"))
250      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
251    if (json.has("district"))
252      res.setDistrictElement(parseString(json.get("district").getAsString()));
253    if (json.has("_district"))
254      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
255    if (json.has("state"))
256      res.setStateElement(parseString(json.get("state").getAsString()));
257    if (json.has("_state"))
258      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
259    if (json.has("postalCode"))
260      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
261    if (json.has("_postalCode"))
262      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
263    if (json.has("country"))
264      res.setCountryElement(parseString(json.get("country").getAsString()));
265    if (json.has("_country"))
266      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
267    if (json.has("period"))
268      res.setPeriod(parsePeriod(getJObject(json, "period")));
269  }
270
271  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
272    Age res = new Age();
273    parseAgeProperties(json, res);
274    return res;
275  }
276
277  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
278    parseQuantityProperties(json, res);
279  }
280
281  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
282    Annotation res = new Annotation();
283    parseAnnotationProperties(json, res);
284    return res;
285  }
286
287  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
288    parseDataTypeProperties(json, res);
289    DataType author = parseType("author", json);
290    if (author != null)
291      res.setAuthor(author);
292    if (json.has("time"))
293      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
294    if (json.has("_time"))
295      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
296    if (json.has("text"))
297      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
298    if (json.has("_text"))
299      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
300  }
301
302  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
303    Attachment res = new Attachment();
304    parseAttachmentProperties(json, res);
305    return res;
306  }
307
308  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
309    parseDataTypeProperties(json, res);
310    if (json.has("contentType"))
311      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
312    if (json.has("_contentType"))
313      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
314    if (json.has("language"))
315      res.setLanguageElement(parseCode(json.get("language").getAsString()));
316    if (json.has("_language"))
317      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
318    if (json.has("data"))
319      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
320    if (json.has("_data"))
321      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
322    if (json.has("url"))
323      res.setUrlElement(parseUrl(json.get("url").getAsString()));
324    if (json.has("_url"))
325      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
326    if (json.has("size"))
327      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
328    if (json.has("_size"))
329      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
330    if (json.has("hash"))
331      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
332    if (json.has("_hash"))
333      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
334    if (json.has("title"))
335      res.setTitleElement(parseString(json.get("title").getAsString()));
336    if (json.has("_title"))
337      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
338    if (json.has("creation"))
339      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
340    if (json.has("_creation"))
341      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
342  }
343
344  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
345    CodeableConcept res = new CodeableConcept();
346    parseCodeableConceptProperties(json, res);
347    return res;
348  }
349
350  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
351    parseDataTypeProperties(json, res);
352    if (json.has("coding")) {
353      JsonArray array = getJArray(json, "coding");
354      for (int i = 0; i < array.size(); i++) {
355        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
356      }
357    };
358    if (json.has("text"))
359      res.setTextElement(parseString(json.get("text").getAsString()));
360    if (json.has("_text"))
361      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
362  }
363
364  protected CodeableReference parseCodeableReference(JsonObject json) throws IOException, FHIRFormatError {
365    CodeableReference res = new CodeableReference();
366    parseCodeableReferenceProperties(json, res);
367    return res;
368  }
369
370  protected void parseCodeableReferenceProperties(JsonObject json, CodeableReference res) throws IOException, FHIRFormatError {
371    parseDataTypeProperties(json, res);
372    if (json.has("concept"))
373      res.setConcept(parseCodeableConcept(getJObject(json, "concept")));
374    if (json.has("reference"))
375      res.setReference(parseReference(getJObject(json, "reference")));
376  }
377
378  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
379    Coding res = new Coding();
380    parseCodingProperties(json, res);
381    return res;
382  }
383
384  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
385    parseDataTypeProperties(json, res);
386    if (json.has("system"))
387      res.setSystemElement(parseUri(json.get("system").getAsString()));
388    if (json.has("_system"))
389      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
390    if (json.has("version"))
391      res.setVersionElement(parseString(json.get("version").getAsString()));
392    if (json.has("_version"))
393      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
394    if (json.has("code"))
395      res.setCodeElement(parseCode(json.get("code").getAsString()));
396    if (json.has("_code"))
397      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
398    if (json.has("display"))
399      res.setDisplayElement(parseString(json.get("display").getAsString()));
400    if (json.has("_display"))
401      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
402    if (json.has("userSelected"))
403      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
404    if (json.has("_userSelected"))
405      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
406  }
407
408  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
409    ContactDetail res = new ContactDetail();
410    parseContactDetailProperties(json, res);
411    return res;
412  }
413
414  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
415    parseDataTypeProperties(json, res);
416    if (json.has("name"))
417      res.setNameElement(parseString(json.get("name").getAsString()));
418    if (json.has("_name"))
419      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
420    if (json.has("telecom")) {
421      JsonArray array = getJArray(json, "telecom");
422      for (int i = 0; i < array.size(); i++) {
423        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
424      }
425    };
426  }
427
428  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
429    ContactPoint res = new ContactPoint();
430    parseContactPointProperties(json, res);
431    return res;
432  }
433
434  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
435    parseDataTypeProperties(json, res);
436    if (json.has("system"))
437      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
438    if (json.has("_system"))
439      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
440    if (json.has("value"))
441      res.setValueElement(parseString(json.get("value").getAsString()));
442    if (json.has("_value"))
443      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
444    if (json.has("use"))
445      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
446    if (json.has("_use"))
447      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
448    if (json.has("rank"))
449      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
450    if (json.has("_rank"))
451      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
452    if (json.has("period"))
453      res.setPeriod(parsePeriod(getJObject(json, "period")));
454  }
455
456  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
457    Contributor res = new Contributor();
458    parseContributorProperties(json, res);
459    return res;
460  }
461
462  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
463    parseDataTypeProperties(json, res);
464    if (json.has("type"))
465      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
466    if (json.has("_type"))
467      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
468    if (json.has("name"))
469      res.setNameElement(parseString(json.get("name").getAsString()));
470    if (json.has("_name"))
471      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
472    if (json.has("contact")) {
473      JsonArray array = getJArray(json, "contact");
474      for (int i = 0; i < array.size(); i++) {
475        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
476      }
477    };
478  }
479
480  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
481    Count res = new Count();
482    parseCountProperties(json, res);
483    return res;
484  }
485
486  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
487    parseQuantityProperties(json, res);
488  }
489
490  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
491    DataRequirement res = new DataRequirement();
492    parseDataRequirementProperties(json, res);
493    return res;
494  }
495
496  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
497    parseDataTypeProperties(json, res);
498    if (json.has("type"))
499      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
500    if (json.has("_type"))
501      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
502    if (json.has("profile")) {
503      JsonArray array = getJArray(json, "profile");
504      for (int i = 0; i < array.size(); i++) {
505        if (array.get(i).isJsonNull()) {
506          res.getProfile().add(new CanonicalType());
507        } else {;
508          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
509        }
510      }
511    };
512    if (json.has("_profile")) {
513      JsonArray array = getJArray(json, "_profile");
514      for (int i = 0; i < array.size(); i++) {
515        if (i == res.getProfile().size())
516          res.getProfile().add(parseCanonical(null));
517        if (array.get(i) instanceof JsonObject) 
518          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
519      }
520    };
521    DataType subject = parseType("subject", json);
522    if (subject != null)
523      res.setSubject(subject);
524    if (json.has("mustSupport")) {
525      JsonArray array = getJArray(json, "mustSupport");
526      for (int i = 0; i < array.size(); i++) {
527        if (array.get(i).isJsonNull()) {
528          res.getMustSupport().add(new StringType());
529        } else {;
530          res.getMustSupport().add(parseString(array.get(i).getAsString()));
531        }
532      }
533    };
534    if (json.has("_mustSupport")) {
535      JsonArray array = getJArray(json, "_mustSupport");
536      for (int i = 0; i < array.size(); i++) {
537        if (i == res.getMustSupport().size())
538          res.getMustSupport().add(parseString(null));
539        if (array.get(i) instanceof JsonObject) 
540          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
541      }
542    };
543    if (json.has("codeFilter")) {
544      JsonArray array = getJArray(json, "codeFilter");
545      for (int i = 0; i < array.size(); i++) {
546        res.getCodeFilter().add(parseDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject()));
547      }
548    };
549    if (json.has("dateFilter")) {
550      JsonArray array = getJArray(json, "dateFilter");
551      for (int i = 0; i < array.size(); i++) {
552        res.getDateFilter().add(parseDataRequirementDateFilterComponent(array.get(i).getAsJsonObject()));
553      }
554    };
555    if (json.has("limit"))
556      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
557    if (json.has("_limit"))
558      parseElementProperties(getJObject(json, "_limit"), res.getLimitElement());
559    if (json.has("sort")) {
560      JsonArray array = getJArray(json, "sort");
561      for (int i = 0; i < array.size(); i++) {
562        res.getSort().add(parseDataRequirementSortComponent(array.get(i).getAsJsonObject()));
563      }
564    };
565  }
566
567  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementCodeFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
568    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
569    parseDataRequirementCodeFilterComponentProperties(json, res);
570    return res;
571  }
572
573  protected void parseDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
574    parseElementProperties(json, res);
575    if (json.has("path"))
576      res.setPathElement(parseString(json.get("path").getAsString()));
577    if (json.has("_path"))
578      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
579    if (json.has("searchParam"))
580      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
581    if (json.has("_searchParam"))
582      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
583    if (json.has("valueSet"))
584      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
585    if (json.has("_valueSet"))
586      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
587    if (json.has("code")) {
588      JsonArray array = getJArray(json, "code");
589      for (int i = 0; i < array.size(); i++) {
590        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
591      }
592    };
593  }
594
595  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDateFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
596    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
597    parseDataRequirementDateFilterComponentProperties(json, res);
598    return res;
599  }
600
601  protected void parseDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
602    parseElementProperties(json, res);
603    if (json.has("path"))
604      res.setPathElement(parseString(json.get("path").getAsString()));
605    if (json.has("_path"))
606      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
607    if (json.has("searchParam"))
608      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
609    if (json.has("_searchParam"))
610      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
611    DataType value = parseType("value", json);
612    if (value != null)
613      res.setValue(value);
614  }
615
616  protected DataRequirement.DataRequirementSortComponent parseDataRequirementSortComponent(JsonObject json) throws IOException, FHIRFormatError {
617    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
618    parseDataRequirementSortComponentProperties(json, res);
619    return res;
620  }
621
622  protected void parseDataRequirementSortComponentProperties(JsonObject json, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
623    parseElementProperties(json, res);
624    if (json.has("path"))
625      res.setPathElement(parseString(json.get("path").getAsString()));
626    if (json.has("_path"))
627      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
628    if (json.has("direction"))
629      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
630    if (json.has("_direction"))
631      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
632  }
633
634  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
635    Distance res = new Distance();
636    parseDistanceProperties(json, res);
637    return res;
638  }
639
640  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
641    parseQuantityProperties(json, res);
642  }
643
644  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
645    Dosage res = new Dosage();
646    parseDosageProperties(json, res);
647    return res;
648  }
649
650  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
651    parseDataTypeProperties(json, res);
652    if (json.has("sequence"))
653      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
654    if (json.has("_sequence"))
655      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
656    if (json.has("text"))
657      res.setTextElement(parseString(json.get("text").getAsString()));
658    if (json.has("_text"))
659      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
660    if (json.has("additionalInstruction")) {
661      JsonArray array = getJArray(json, "additionalInstruction");
662      for (int i = 0; i < array.size(); i++) {
663        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
664      }
665    };
666    if (json.has("patientInstruction"))
667      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
668    if (json.has("_patientInstruction"))
669      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
670    if (json.has("timing"))
671      res.setTiming(parseTiming(getJObject(json, "timing")));
672    DataType asNeeded = parseType("asNeeded", json);
673    if (asNeeded != null)
674      res.setAsNeeded(asNeeded);
675    if (json.has("site"))
676      res.setSite(parseCodeableConcept(getJObject(json, "site")));
677    if (json.has("route"))
678      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
679    if (json.has("method"))
680      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
681    if (json.has("doseAndRate")) {
682      JsonArray array = getJArray(json, "doseAndRate");
683      for (int i = 0; i < array.size(); i++) {
684        res.getDoseAndRate().add(parseDosageDoseAndRateComponent(array.get(i).getAsJsonObject()));
685      }
686    };
687    if (json.has("maxDosePerPeriod"))
688      res.setMaxDosePerPeriod(parseRatio(getJObject(json, "maxDosePerPeriod")));
689    if (json.has("maxDosePerAdministration"))
690      res.setMaxDosePerAdministration(parseQuantity(getJObject(json, "maxDosePerAdministration")));
691    if (json.has("maxDosePerLifetime"))
692      res.setMaxDosePerLifetime(parseQuantity(getJObject(json, "maxDosePerLifetime")));
693  }
694
695  protected Dosage.DosageDoseAndRateComponent parseDosageDoseAndRateComponent(JsonObject json) throws IOException, FHIRFormatError {
696    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
697    parseDosageDoseAndRateComponentProperties(json, res);
698    return res;
699  }
700
701  protected void parseDosageDoseAndRateComponentProperties(JsonObject json, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
702    parseElementProperties(json, res);
703    if (json.has("type"))
704      res.setType(parseCodeableConcept(getJObject(json, "type")));
705    DataType dose = parseType("dose", json);
706    if (dose != null)
707      res.setDose(dose);
708    DataType rate = parseType("rate", json);
709    if (rate != null)
710      res.setRate(rate);
711  }
712
713  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
714    Duration res = new Duration();
715    parseDurationProperties(json, res);
716    return res;
717  }
718
719  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
720    parseQuantityProperties(json, res);
721  }
722
723  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
724    ElementDefinition res = new ElementDefinition();
725    parseElementDefinitionProperties(json, res);
726    return res;
727  }
728
729  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
730    parseDataTypeProperties(json, res);
731    if (json.has("path"))
732      res.setPathElement(parseString(json.get("path").getAsString()));
733    if (json.has("_path"))
734      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
735    if (json.has("representation")) {
736      JsonArray array = getJArray(json, "representation");
737      for (int i = 0; i < array.size(); i++) {
738        if (array.get(i).isJsonNull()) {
739          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>(new ElementDefinition.PropertyRepresentationEnumFactory(), ElementDefinition.PropertyRepresentation.NULL));
740        } else {;
741          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
742        }
743      }
744    };
745    if (json.has("_representation")) {
746      JsonArray array = getJArray(json, "_representation");
747      for (int i = 0; i < array.size(); i++) {
748        if (i == res.getRepresentation().size())
749          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
750        if (array.get(i) instanceof JsonObject) 
751          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
752      }
753    };
754    if (json.has("sliceName"))
755      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
756    if (json.has("_sliceName"))
757      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
758    if (json.has("sliceIsConstraining"))
759      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
760    if (json.has("_sliceIsConstraining"))
761      parseElementProperties(getJObject(json, "_sliceIsConstraining"), res.getSliceIsConstrainingElement());
762    if (json.has("label"))
763      res.setLabelElement(parseString(json.get("label").getAsString()));
764    if (json.has("_label"))
765      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
766    if (json.has("code")) {
767      JsonArray array = getJArray(json, "code");
768      for (int i = 0; i < array.size(); i++) {
769        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
770      }
771    };
772    if (json.has("slicing"))
773      res.setSlicing(parseElementDefinitionSlicingComponent(getJObject(json, "slicing")));
774    if (json.has("short"))
775      res.setShortElement(parseString(json.get("short").getAsString()));
776    if (json.has("_short"))
777      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
778    if (json.has("definition"))
779      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
780    if (json.has("_definition"))
781      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
782    if (json.has("comment"))
783      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
784    if (json.has("_comment"))
785      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
786    if (json.has("requirements"))
787      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
788    if (json.has("_requirements"))
789      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
790    if (json.has("alias")) {
791      JsonArray array = getJArray(json, "alias");
792      for (int i = 0; i < array.size(); i++) {
793        if (array.get(i).isJsonNull()) {
794          res.getAlias().add(new StringType());
795        } else {;
796          res.getAlias().add(parseString(array.get(i).getAsString()));
797        }
798      }
799    };
800    if (json.has("_alias")) {
801      JsonArray array = getJArray(json, "_alias");
802      for (int i = 0; i < array.size(); i++) {
803        if (i == res.getAlias().size())
804          res.getAlias().add(parseString(null));
805        if (array.get(i) instanceof JsonObject) 
806          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
807      }
808    };
809    if (json.has("min"))
810      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
811    if (json.has("_min"))
812      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
813    if (json.has("max"))
814      res.setMaxElement(parseString(json.get("max").getAsString()));
815    if (json.has("_max"))
816      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
817    if (json.has("base"))
818      res.setBase(parseElementDefinitionBaseComponent(getJObject(json, "base")));
819    if (json.has("contentReference"))
820      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
821    if (json.has("_contentReference"))
822      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
823    if (json.has("type")) {
824      JsonArray array = getJArray(json, "type");
825      for (int i = 0; i < array.size(); i++) {
826        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject()));
827      }
828    };
829    DataType defaultValue = parseType("defaultValue", json);
830    if (defaultValue != null)
831      res.setDefaultValue(defaultValue);
832    if (json.has("meaningWhenMissing"))
833      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
834    if (json.has("_meaningWhenMissing"))
835      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
836    if (json.has("orderMeaning"))
837      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
838    if (json.has("_orderMeaning"))
839      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
840    DataType fixed = parseType("fixed", json);
841    if (fixed != null)
842      res.setFixed(fixed);
843    DataType pattern = parseType("pattern", json);
844    if (pattern != null)
845      res.setPattern(pattern);
846    if (json.has("example")) {
847      JsonArray array = getJArray(json, "example");
848      for (int i = 0; i < array.size(); i++) {
849        res.getExample().add(parseElementDefinitionExampleComponent(array.get(i).getAsJsonObject()));
850      }
851    };
852    DataType minValue = parseType("minValue", json);
853    if (minValue != null)
854      res.setMinValue(minValue);
855    DataType maxValue = parseType("maxValue", json);
856    if (maxValue != null)
857      res.setMaxValue(maxValue);
858    if (json.has("maxLength"))
859      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
860    if (json.has("_maxLength"))
861      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
862    if (json.has("condition")) {
863      JsonArray array = getJArray(json, "condition");
864      for (int i = 0; i < array.size(); i++) {
865        if (array.get(i).isJsonNull()) {
866          res.getCondition().add(new IdType());
867        } else {;
868          res.getCondition().add(parseId(array.get(i).getAsString()));
869        }
870      }
871    };
872    if (json.has("_condition")) {
873      JsonArray array = getJArray(json, "_condition");
874      for (int i = 0; i < array.size(); i++) {
875        if (i == res.getCondition().size())
876          res.getCondition().add(parseId(null));
877        if (array.get(i) instanceof JsonObject) 
878          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
879      }
880    };
881    if (json.has("constraint")) {
882      JsonArray array = getJArray(json, "constraint");
883      for (int i = 0; i < array.size(); i++) {
884        res.getConstraint().add(parseElementDefinitionConstraintComponent(array.get(i).getAsJsonObject()));
885      }
886    };
887    if (json.has("mustSupport"))
888      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
889    if (json.has("_mustSupport"))
890      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
891    if (json.has("isModifier"))
892      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
893    if (json.has("_isModifier"))
894      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
895    if (json.has("isModifierReason"))
896      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
897    if (json.has("_isModifierReason"))
898      parseElementProperties(getJObject(json, "_isModifierReason"), res.getIsModifierReasonElement());
899    if (json.has("isSummary"))
900      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
901    if (json.has("_isSummary"))
902      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
903    if (json.has("binding"))
904      res.setBinding(parseElementDefinitionBindingComponent(getJObject(json, "binding")));
905    if (json.has("mapping")) {
906      JsonArray array = getJArray(json, "mapping");
907      for (int i = 0; i < array.size(); i++) {
908        res.getMapping().add(parseElementDefinitionMappingComponent(array.get(i).getAsJsonObject()));
909      }
910    };
911  }
912
913  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionSlicingComponent(JsonObject json) throws IOException, FHIRFormatError {
914    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
915    parseElementDefinitionSlicingComponentProperties(json, res);
916    return res;
917  }
918
919  protected void parseElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
920    parseElementProperties(json, res);
921    if (json.has("discriminator")) {
922      JsonArray array = getJArray(json, "discriminator");
923      for (int i = 0; i < array.size(); i++) {
924        res.getDiscriminator().add(parseElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject()));
925      }
926    };
927    if (json.has("description"))
928      res.setDescriptionElement(parseString(json.get("description").getAsString()));
929    if (json.has("_description"))
930      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
931    if (json.has("ordered"))
932      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
933    if (json.has("_ordered"))
934      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
935    if (json.has("rules"))
936      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
937    if (json.has("_rules"))
938      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
939  }
940
941  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionSlicingDiscriminatorComponent(JsonObject json) throws IOException, FHIRFormatError {
942    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
943    parseElementDefinitionSlicingDiscriminatorComponentProperties(json, res);
944    return res;
945  }
946
947  protected void parseElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
948    parseElementProperties(json, res);
949    if (json.has("type"))
950      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
951    if (json.has("_type"))
952      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
953    if (json.has("path"))
954      res.setPathElement(parseString(json.get("path").getAsString()));
955    if (json.has("_path"))
956      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
957  }
958
959  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionBaseComponent(JsonObject json) throws IOException, FHIRFormatError {
960    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
961    parseElementDefinitionBaseComponentProperties(json, res);
962    return res;
963  }
964
965  protected void parseElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
966    parseElementProperties(json, res);
967    if (json.has("path"))
968      res.setPathElement(parseString(json.get("path").getAsString()));
969    if (json.has("_path"))
970      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
971    if (json.has("min"))
972      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
973    if (json.has("_min"))
974      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
975    if (json.has("max"))
976      res.setMaxElement(parseString(json.get("max").getAsString()));
977    if (json.has("_max"))
978      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
979  }
980
981  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json) throws IOException, FHIRFormatError {
982    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
983    parseElementDefinitionTypeRefComponentProperties(json, res);
984    return res;
985  }
986
987  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
988    parseElementProperties(json, res);
989    if (json.has("code"))
990      res.setCodeElement(parseUri(json.get("code").getAsString()));
991    if (json.has("_code"))
992      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
993    if (json.has("profile")) {
994      JsonArray array = getJArray(json, "profile");
995      for (int i = 0; i < array.size(); i++) {
996        if (array.get(i).isJsonNull()) {
997          res.getProfile().add(new CanonicalType());
998        } else {;
999          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1000        }
1001      }
1002    };
1003    if (json.has("_profile")) {
1004      JsonArray array = getJArray(json, "_profile");
1005      for (int i = 0; i < array.size(); i++) {
1006        if (i == res.getProfile().size())
1007          res.getProfile().add(parseCanonical(null));
1008        if (array.get(i) instanceof JsonObject) 
1009          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1010      }
1011    };
1012    if (json.has("targetProfile")) {
1013      JsonArray array = getJArray(json, "targetProfile");
1014      for (int i = 0; i < array.size(); i++) {
1015        if (array.get(i).isJsonNull()) {
1016          res.getTargetProfile().add(new CanonicalType());
1017        } else {;
1018          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1019        }
1020      }
1021    };
1022    if (json.has("_targetProfile")) {
1023      JsonArray array = getJArray(json, "_targetProfile");
1024      for (int i = 0; i < array.size(); i++) {
1025        if (i == res.getTargetProfile().size())
1026          res.getTargetProfile().add(parseCanonical(null));
1027        if (array.get(i) instanceof JsonObject) 
1028          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1029      }
1030    };
1031    if (json.has("aggregation")) {
1032      JsonArray array = getJArray(json, "aggregation");
1033      for (int i = 0; i < array.size(); i++) {
1034        if (array.get(i).isJsonNull()) {
1035          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>(new ElementDefinition.AggregationModeEnumFactory(), ElementDefinition.AggregationMode.NULL));
1036        } else {;
1037          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1038        }
1039      }
1040    };
1041    if (json.has("_aggregation")) {
1042      JsonArray array = getJArray(json, "_aggregation");
1043      for (int i = 0; i < array.size(); i++) {
1044        if (i == res.getAggregation().size())
1045          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1046        if (array.get(i) instanceof JsonObject) 
1047          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1048      }
1049    };
1050    if (json.has("versioning"))
1051      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1052    if (json.has("_versioning"))
1053      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1054  }
1055
1056  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionExampleComponent(JsonObject json) throws IOException, FHIRFormatError {
1057    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1058    parseElementDefinitionExampleComponentProperties(json, res);
1059    return res;
1060  }
1061
1062  protected void parseElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1063    parseElementProperties(json, res);
1064    if (json.has("label"))
1065      res.setLabelElement(parseString(json.get("label").getAsString()));
1066    if (json.has("_label"))
1067      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1068    DataType value = parseType("value", json);
1069    if (value != null)
1070      res.setValue(value);
1071  }
1072
1073  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionConstraintComponent(JsonObject json) throws IOException, FHIRFormatError {
1074    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1075    parseElementDefinitionConstraintComponentProperties(json, res);
1076    return res;
1077  }
1078
1079  protected void parseElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1080    parseElementProperties(json, res);
1081    if (json.has("key"))
1082      res.setKeyElement(parseId(json.get("key").getAsString()));
1083    if (json.has("_key"))
1084      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1085    if (json.has("requirements"))
1086      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1087    if (json.has("_requirements"))
1088      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1089    if (json.has("severity"))
1090      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1091    if (json.has("_severity"))
1092      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1093    if (json.has("human"))
1094      res.setHumanElement(parseString(json.get("human").getAsString()));
1095    if (json.has("_human"))
1096      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1097    if (json.has("expression"))
1098      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1099    if (json.has("_expression"))
1100      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1101    if (json.has("xpath"))
1102      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1103    if (json.has("_xpath"))
1104      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
1105    if (json.has("source"))
1106      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1107    if (json.has("_source"))
1108      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1109  }
1110
1111  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
1112    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1113    parseElementDefinitionBindingComponentProperties(json, res);
1114    return res;
1115  }
1116
1117  protected void parseElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1118    parseElementProperties(json, res);
1119    if (json.has("strength"))
1120      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1121    if (json.has("_strength"))
1122      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1123    if (json.has("description"))
1124      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1125    if (json.has("_description"))
1126      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1127    if (json.has("valueSet"))
1128      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1129    if (json.has("_valueSet"))
1130      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
1131  }
1132
1133  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
1134    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1135    parseElementDefinitionMappingComponentProperties(json, res);
1136    return res;
1137  }
1138
1139  protected void parseElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1140    parseElementProperties(json, res);
1141    if (json.has("identity"))
1142      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1143    if (json.has("_identity"))
1144      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1145    if (json.has("language"))
1146      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1147    if (json.has("_language"))
1148      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1149    if (json.has("map"))
1150      res.setMapElement(parseString(json.get("map").getAsString()));
1151    if (json.has("_map"))
1152      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1153    if (json.has("comment"))
1154      res.setCommentElement(parseString(json.get("comment").getAsString()));
1155    if (json.has("_comment"))
1156      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1157  }
1158
1159  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1160    Expression res = new Expression();
1161    parseExpressionProperties(json, res);
1162    return res;
1163  }
1164
1165  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1166    parseDataTypeProperties(json, res);
1167    if (json.has("description"))
1168      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1169    if (json.has("_description"))
1170      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1171    if (json.has("name"))
1172      res.setNameElement(parseId(json.get("name").getAsString()));
1173    if (json.has("_name"))
1174      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1175    if (json.has("language"))
1176      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1177    if (json.has("_language"))
1178      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1179    if (json.has("expression"))
1180      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1181    if (json.has("_expression"))
1182      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1183    if (json.has("reference"))
1184      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1185    if (json.has("_reference"))
1186      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1187  }
1188
1189  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
1190    Extension res = new Extension();
1191    parseExtensionProperties(json, res);
1192    return res;
1193  }
1194
1195  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
1196    parseDataTypeProperties(json, res);
1197    if (json.has("url"))
1198      res.setUrlElement(parseUri(json.get("url").getAsString()));
1199    if (json.has("_url"))
1200      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1201    DataType value = parseType("value", json);
1202    if (value != null)
1203      res.setValue(value);
1204  }
1205
1206  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
1207    HumanName res = new HumanName();
1208    parseHumanNameProperties(json, res);
1209    return res;
1210  }
1211
1212  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
1213    parseDataTypeProperties(json, res);
1214    if (json.has("use"))
1215      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
1216    if (json.has("_use"))
1217      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1218    if (json.has("text"))
1219      res.setTextElement(parseString(json.get("text").getAsString()));
1220    if (json.has("_text"))
1221      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1222    if (json.has("family"))
1223      res.setFamilyElement(parseString(json.get("family").getAsString()));
1224    if (json.has("_family"))
1225      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
1226    if (json.has("given")) {
1227      JsonArray array = getJArray(json, "given");
1228      for (int i = 0; i < array.size(); i++) {
1229        if (array.get(i).isJsonNull()) {
1230          res.getGiven().add(new StringType());
1231        } else {;
1232          res.getGiven().add(parseString(array.get(i).getAsString()));
1233        }
1234      }
1235    };
1236    if (json.has("_given")) {
1237      JsonArray array = getJArray(json, "_given");
1238      for (int i = 0; i < array.size(); i++) {
1239        if (i == res.getGiven().size())
1240          res.getGiven().add(parseString(null));
1241        if (array.get(i) instanceof JsonObject) 
1242          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1243      }
1244    };
1245    if (json.has("prefix")) {
1246      JsonArray array = getJArray(json, "prefix");
1247      for (int i = 0; i < array.size(); i++) {
1248        if (array.get(i).isJsonNull()) {
1249          res.getPrefix().add(new StringType());
1250        } else {;
1251          res.getPrefix().add(parseString(array.get(i).getAsString()));
1252        }
1253      }
1254    };
1255    if (json.has("_prefix")) {
1256      JsonArray array = getJArray(json, "_prefix");
1257      for (int i = 0; i < array.size(); i++) {
1258        if (i == res.getPrefix().size())
1259          res.getPrefix().add(parseString(null));
1260        if (array.get(i) instanceof JsonObject) 
1261          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1262      }
1263    };
1264    if (json.has("suffix")) {
1265      JsonArray array = getJArray(json, "suffix");
1266      for (int i = 0; i < array.size(); i++) {
1267        if (array.get(i).isJsonNull()) {
1268          res.getSuffix().add(new StringType());
1269        } else {;
1270          res.getSuffix().add(parseString(array.get(i).getAsString()));
1271        }
1272      }
1273    };
1274    if (json.has("_suffix")) {
1275      JsonArray array = getJArray(json, "_suffix");
1276      for (int i = 0; i < array.size(); i++) {
1277        if (i == res.getSuffix().size())
1278          res.getSuffix().add(parseString(null));
1279        if (array.get(i) instanceof JsonObject) 
1280          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1281      }
1282    };
1283    if (json.has("period"))
1284      res.setPeriod(parsePeriod(getJObject(json, "period")));
1285  }
1286
1287  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
1288    Identifier res = new Identifier();
1289    parseIdentifierProperties(json, res);
1290    return res;
1291  }
1292
1293  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
1294    parseDataTypeProperties(json, res);
1295    if (json.has("use"))
1296      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
1297    if (json.has("_use"))
1298      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1299    if (json.has("type"))
1300      res.setType(parseCodeableConcept(getJObject(json, "type")));
1301    if (json.has("system"))
1302      res.setSystemElement(parseUri(json.get("system").getAsString()));
1303    if (json.has("_system"))
1304      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1305    if (json.has("value"))
1306      res.setValueElement(parseString(json.get("value").getAsString()));
1307    if (json.has("_value"))
1308      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1309    if (json.has("period"))
1310      res.setPeriod(parsePeriod(getJObject(json, "period")));
1311    if (json.has("assigner"))
1312      res.setAssigner(parseReference(getJObject(json, "assigner")));
1313  }
1314
1315  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
1316    MarketingStatus res = new MarketingStatus();
1317    parseMarketingStatusProperties(json, res);
1318    return res;
1319  }
1320
1321  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
1322    parseDataTypeProperties(json, res);
1323    if (json.has("country"))
1324      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
1325    if (json.has("jurisdiction"))
1326      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
1327    if (json.has("status"))
1328      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
1329    if (json.has("dateRange"))
1330      res.setDateRange(parsePeriod(getJObject(json, "dateRange")));
1331    if (json.has("restoreDate"))
1332      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
1333    if (json.has("_restoreDate"))
1334      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
1335  }
1336
1337  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
1338    Meta res = new Meta();
1339    parseMetaProperties(json, res);
1340    return res;
1341  }
1342
1343  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
1344    parseDataTypeProperties(json, res);
1345    if (json.has("versionId"))
1346      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
1347    if (json.has("_versionId"))
1348      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
1349    if (json.has("lastUpdated"))
1350      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
1351    if (json.has("_lastUpdated"))
1352      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
1353    if (json.has("source"))
1354      res.setSourceElement(parseUri(json.get("source").getAsString()));
1355    if (json.has("_source"))
1356      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1357    if (json.has("profile")) {
1358      JsonArray array = getJArray(json, "profile");
1359      for (int i = 0; i < array.size(); i++) {
1360        if (array.get(i).isJsonNull()) {
1361          res.getProfile().add(new CanonicalType());
1362        } else {;
1363          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1364        }
1365      }
1366    };
1367    if (json.has("_profile")) {
1368      JsonArray array = getJArray(json, "_profile");
1369      for (int i = 0; i < array.size(); i++) {
1370        if (i == res.getProfile().size())
1371          res.getProfile().add(parseCanonical(null));
1372        if (array.get(i) instanceof JsonObject) 
1373          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1374      }
1375    };
1376    if (json.has("security")) {
1377      JsonArray array = getJArray(json, "security");
1378      for (int i = 0; i < array.size(); i++) {
1379        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
1380      }
1381    };
1382    if (json.has("tag")) {
1383      JsonArray array = getJArray(json, "tag");
1384      for (int i = 0; i < array.size(); i++) {
1385        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
1386      }
1387    };
1388  }
1389
1390  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
1391    Money res = new Money();
1392    parseMoneyProperties(json, res);
1393    return res;
1394  }
1395
1396  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
1397    parseDataTypeProperties(json, res);
1398    if (json.has("value"))
1399      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1400    if (json.has("_value"))
1401      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1402    if (json.has("currency"))
1403      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
1404    if (json.has("_currency"))
1405      parseElementProperties(getJObject(json, "_currency"), res.getCurrencyElement());
1406  }
1407
1408  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
1409    Narrative res = new Narrative();
1410    parseNarrativeProperties(json, res);
1411    return res;
1412  }
1413
1414  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
1415    parseDataTypeProperties(json, res);
1416    if (json.has("status"))
1417      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
1418    if (json.has("_status"))
1419      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1420    if (json.has("div"))
1421      res.setDiv(parseXhtml(json.get("div").getAsString()));
1422  }
1423
1424  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1425    ParameterDefinition res = new ParameterDefinition();
1426    parseParameterDefinitionProperties(json, res);
1427    return res;
1428  }
1429
1430  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1431    parseDataTypeProperties(json, res);
1432    if (json.has("name"))
1433      res.setNameElement(parseCode(json.get("name").getAsString()));
1434    if (json.has("_name"))
1435      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1436    if (json.has("use"))
1437      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
1438    if (json.has("_use"))
1439      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1440    if (json.has("min"))
1441      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1442    if (json.has("_min"))
1443      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1444    if (json.has("max"))
1445      res.setMaxElement(parseString(json.get("max").getAsString()));
1446    if (json.has("_max"))
1447      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1448    if (json.has("documentation"))
1449      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1450    if (json.has("_documentation"))
1451      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1452    if (json.has("type"))
1453      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
1454    if (json.has("_type"))
1455      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1456    if (json.has("profile"))
1457      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1458    if (json.has("_profile"))
1459      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1460  }
1461
1462  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1463    Period res = new Period();
1464    parsePeriodProperties(json, res);
1465    return res;
1466  }
1467
1468  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1469    parseDataTypeProperties(json, res);
1470    if (json.has("start"))
1471      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1472    if (json.has("_start"))
1473      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
1474    if (json.has("end"))
1475      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1476    if (json.has("_end"))
1477      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
1478  }
1479
1480  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
1481    Population res = new Population();
1482    parsePopulationProperties(json, res);
1483    return res;
1484  }
1485
1486  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
1487    parseDataTypeProperties(json, res);
1488    DataType age = parseType("age", json);
1489    if (age != null)
1490      res.setAge(age);
1491    if (json.has("gender"))
1492      res.setGender(parseCodeableConcept(getJObject(json, "gender")));
1493    if (json.has("race"))
1494      res.setRace(parseCodeableConcept(getJObject(json, "race")));
1495    if (json.has("physiologicalCondition"))
1496      res.setPhysiologicalCondition(parseCodeableConcept(getJObject(json, "physiologicalCondition")));
1497  }
1498
1499  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1500    ProdCharacteristic res = new ProdCharacteristic();
1501    parseProdCharacteristicProperties(json, res);
1502    return res;
1503  }
1504
1505  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1506    parseDataTypeProperties(json, res);
1507    if (json.has("height"))
1508      res.setHeight(parseQuantity(getJObject(json, "height")));
1509    if (json.has("width"))
1510      res.setWidth(parseQuantity(getJObject(json, "width")));
1511    if (json.has("depth"))
1512      res.setDepth(parseQuantity(getJObject(json, "depth")));
1513    if (json.has("weight"))
1514      res.setWeight(parseQuantity(getJObject(json, "weight")));
1515    if (json.has("nominalVolume"))
1516      res.setNominalVolume(parseQuantity(getJObject(json, "nominalVolume")));
1517    if (json.has("externalDiameter"))
1518      res.setExternalDiameter(parseQuantity(getJObject(json, "externalDiameter")));
1519    if (json.has("shape"))
1520      res.setShapeElement(parseString(json.get("shape").getAsString()));
1521    if (json.has("_shape"))
1522      parseElementProperties(getJObject(json, "_shape"), res.getShapeElement());
1523    if (json.has("color")) {
1524      JsonArray array = getJArray(json, "color");
1525      for (int i = 0; i < array.size(); i++) {
1526        if (array.get(i).isJsonNull()) {
1527          res.getColor().add(new StringType());
1528        } else {;
1529          res.getColor().add(parseString(array.get(i).getAsString()));
1530        }
1531      }
1532    };
1533    if (json.has("_color")) {
1534      JsonArray array = getJArray(json, "_color");
1535      for (int i = 0; i < array.size(); i++) {
1536        if (i == res.getColor().size())
1537          res.getColor().add(parseString(null));
1538        if (array.get(i) instanceof JsonObject) 
1539          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1540      }
1541    };
1542    if (json.has("imprint")) {
1543      JsonArray array = getJArray(json, "imprint");
1544      for (int i = 0; i < array.size(); i++) {
1545        if (array.get(i).isJsonNull()) {
1546          res.getImprint().add(new StringType());
1547        } else {;
1548          res.getImprint().add(parseString(array.get(i).getAsString()));
1549        }
1550      }
1551    };
1552    if (json.has("_imprint")) {
1553      JsonArray array = getJArray(json, "_imprint");
1554      for (int i = 0; i < array.size(); i++) {
1555        if (i == res.getImprint().size())
1556          res.getImprint().add(parseString(null));
1557        if (array.get(i) instanceof JsonObject) 
1558          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1559      }
1560    };
1561    if (json.has("image")) {
1562      JsonArray array = getJArray(json, "image");
1563      for (int i = 0; i < array.size(); i++) {
1564        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1565      }
1566    };
1567    if (json.has("scoring"))
1568      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
1569  }
1570
1571  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1572    ProductShelfLife res = new ProductShelfLife();
1573    parseProductShelfLifeProperties(json, res);
1574    return res;
1575  }
1576
1577  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1578    parseDataTypeProperties(json, res);
1579    if (json.has("type"))
1580      res.setType(parseCodeableConcept(getJObject(json, "type")));
1581    DataType period = parseType("period", json);
1582    if (period != null)
1583      res.setPeriod(period);
1584    if (json.has("specialPrecautionsForStorage")) {
1585      JsonArray array = getJArray(json, "specialPrecautionsForStorage");
1586      for (int i = 0; i < array.size(); i++) {
1587        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1588      }
1589    };
1590  }
1591
1592  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1593    Quantity res = new Quantity();
1594    parseQuantityProperties(json, res);
1595    return res;
1596  }
1597
1598  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1599    parseDataTypeProperties(json, res);
1600    if (json.has("value"))
1601      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1602    if (json.has("_value"))
1603      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1604    if (json.has("comparator"))
1605      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Enumerations.QuantityComparator.NULL, new Enumerations.QuantityComparatorEnumFactory()));
1606    if (json.has("_comparator"))
1607      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
1608    if (json.has("unit"))
1609      res.setUnitElement(parseString(json.get("unit").getAsString()));
1610    if (json.has("_unit"))
1611      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
1612    if (json.has("system"))
1613      res.setSystemElement(parseUri(json.get("system").getAsString()));
1614    if (json.has("_system"))
1615      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1616    if (json.has("code"))
1617      res.setCodeElement(parseCode(json.get("code").getAsString()));
1618    if (json.has("_code"))
1619      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1620  }
1621
1622  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1623    Range res = new Range();
1624    parseRangeProperties(json, res);
1625    return res;
1626  }
1627
1628  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1629    parseDataTypeProperties(json, res);
1630    if (json.has("low"))
1631      res.setLow(parseQuantity(getJObject(json, "low")));
1632    if (json.has("high"))
1633      res.setHigh(parseQuantity(getJObject(json, "high")));
1634  }
1635
1636  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
1637    Ratio res = new Ratio();
1638    parseRatioProperties(json, res);
1639    return res;
1640  }
1641
1642  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
1643    parseDataTypeProperties(json, res);
1644    if (json.has("numerator"))
1645      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
1646    if (json.has("denominator"))
1647      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1648  }
1649
1650  protected RatioRange parseRatioRange(JsonObject json) throws IOException, FHIRFormatError {
1651    RatioRange res = new RatioRange();
1652    parseRatioRangeProperties(json, res);
1653    return res;
1654  }
1655
1656  protected void parseRatioRangeProperties(JsonObject json, RatioRange res) throws IOException, FHIRFormatError {
1657    parseDataTypeProperties(json, res);
1658    if (json.has("lowNumerator"))
1659      res.setLowNumerator(parseQuantity(getJObject(json, "lowNumerator")));
1660    if (json.has("highNumerator"))
1661      res.setHighNumerator(parseQuantity(getJObject(json, "highNumerator")));
1662    if (json.has("denominator"))
1663      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1664  }
1665
1666  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
1667    Reference res = new Reference();
1668    parseReferenceProperties(json, res);
1669    return res;
1670  }
1671
1672  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
1673    parseDataTypeProperties(json, res);
1674    if (json.has("reference"))
1675      res.setReferenceElement(parseString(json.get("reference").getAsString()));
1676    if (json.has("_reference"))
1677      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1678    if (json.has("type"))
1679      res.setTypeElement(parseUri(json.get("type").getAsString()));
1680    if (json.has("_type"))
1681      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1682    if (json.has("identifier"))
1683      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1684    if (json.has("display"))
1685      res.setDisplayElement(parseString(json.get("display").getAsString()));
1686    if (json.has("_display"))
1687      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1688  }
1689
1690  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1691    RelatedArtifact res = new RelatedArtifact();
1692    parseRelatedArtifactProperties(json, res);
1693    return res;
1694  }
1695
1696  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1697    parseDataTypeProperties(json, res);
1698    if (json.has("type"))
1699      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1700    if (json.has("_type"))
1701      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1702    if (json.has("label"))
1703      res.setLabelElement(parseString(json.get("label").getAsString()));
1704    if (json.has("_label"))
1705      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1706    if (json.has("display"))
1707      res.setDisplayElement(parseString(json.get("display").getAsString()));
1708    if (json.has("_display"))
1709      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1710    if (json.has("citation"))
1711      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1712    if (json.has("_citation"))
1713      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
1714    if (json.has("url"))
1715      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1716    if (json.has("_url"))
1717      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1718    if (json.has("document"))
1719      res.setDocument(parseAttachment(getJObject(json, "document")));
1720    if (json.has("resource"))
1721      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1722    if (json.has("_resource"))
1723      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
1724  }
1725
1726  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
1727    SampledData res = new SampledData();
1728    parseSampledDataProperties(json, res);
1729    return res;
1730  }
1731
1732  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
1733    parseDataTypeProperties(json, res);
1734    if (json.has("origin"))
1735      res.setOrigin(parseQuantity(getJObject(json, "origin")));
1736    if (json.has("period"))
1737      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1738    if (json.has("_period"))
1739      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1740    if (json.has("factor"))
1741      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1742    if (json.has("_factor"))
1743      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
1744    if (json.has("lowerLimit"))
1745      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
1746    if (json.has("_lowerLimit"))
1747      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
1748    if (json.has("upperLimit"))
1749      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
1750    if (json.has("_upperLimit"))
1751      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
1752    if (json.has("dimensions"))
1753      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
1754    if (json.has("_dimensions"))
1755      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
1756    if (json.has("data"))
1757      res.setDataElement(parseString(json.get("data").getAsString()));
1758    if (json.has("_data"))
1759      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1760  }
1761
1762  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1763    Signature res = new Signature();
1764    parseSignatureProperties(json, res);
1765    return res;
1766  }
1767
1768  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1769    parseDataTypeProperties(json, res);
1770    if (json.has("type")) {
1771      JsonArray array = getJArray(json, "type");
1772      for (int i = 0; i < array.size(); i++) {
1773        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1774      }
1775    };
1776    if (json.has("when"))
1777      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1778    if (json.has("_when"))
1779      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
1780    if (json.has("who"))
1781      res.setWho(parseReference(getJObject(json, "who")));
1782    if (json.has("onBehalfOf"))
1783      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
1784    if (json.has("targetFormat"))
1785      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1786    if (json.has("_targetFormat"))
1787      parseElementProperties(getJObject(json, "_targetFormat"), res.getTargetFormatElement());
1788    if (json.has("sigFormat"))
1789      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1790    if (json.has("_sigFormat"))
1791      parseElementProperties(getJObject(json, "_sigFormat"), res.getSigFormatElement());
1792    if (json.has("data"))
1793      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1794    if (json.has("_data"))
1795      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1796  }
1797
1798  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1799    Timing res = new Timing();
1800    parseTimingProperties(json, res);
1801    return res;
1802  }
1803
1804  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1805    parseDataTypeProperties(json, res);
1806    if (json.has("event")) {
1807      JsonArray array = getJArray(json, "event");
1808      for (int i = 0; i < array.size(); i++) {
1809        if (array.get(i).isJsonNull()) {
1810          res.getEvent().add(new DateTimeType());
1811        } else {;
1812          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1813        }
1814      }
1815    };
1816    if (json.has("_event")) {
1817      JsonArray array = getJArray(json, "_event");
1818      for (int i = 0; i < array.size(); i++) {
1819        if (i == res.getEvent().size())
1820          res.getEvent().add(parseDateTime(null));
1821        if (array.get(i) instanceof JsonObject) 
1822          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1823      }
1824    };
1825    if (json.has("repeat"))
1826      res.setRepeat(parseTimingRepeatComponent(getJObject(json, "repeat")));
1827    if (json.has("code"))
1828      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1829  }
1830
1831  protected Timing.TimingRepeatComponent parseTimingRepeatComponent(JsonObject json) throws IOException, FHIRFormatError {
1832    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1833    parseTimingRepeatComponentProperties(json, res);
1834    return res;
1835  }
1836
1837  protected void parseTimingRepeatComponentProperties(JsonObject json, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1838    parseElementProperties(json, res);
1839    DataType bounds = parseType("bounds", json);
1840    if (bounds != null)
1841      res.setBounds(bounds);
1842    if (json.has("count"))
1843      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1844    if (json.has("_count"))
1845      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1846    if (json.has("countMax"))
1847      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1848    if (json.has("_countMax"))
1849      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
1850    if (json.has("duration"))
1851      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1852    if (json.has("_duration"))
1853      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
1854    if (json.has("durationMax"))
1855      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1856    if (json.has("_durationMax"))
1857      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
1858    if (json.has("durationUnit"))
1859      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1860    if (json.has("_durationUnit"))
1861      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
1862    if (json.has("frequency"))
1863      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1864    if (json.has("_frequency"))
1865      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
1866    if (json.has("frequencyMax"))
1867      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1868    if (json.has("_frequencyMax"))
1869      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
1870    if (json.has("period"))
1871      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1872    if (json.has("_period"))
1873      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1874    if (json.has("periodMax"))
1875      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1876    if (json.has("_periodMax"))
1877      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
1878    if (json.has("periodUnit"))
1879      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1880    if (json.has("_periodUnit"))
1881      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
1882    if (json.has("dayOfWeek")) {
1883      JsonArray array = getJArray(json, "dayOfWeek");
1884      for (int i = 0; i < array.size(); i++) {
1885        if (array.get(i).isJsonNull()) {
1886          res.getDayOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
1887        } else {;
1888          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
1889        }
1890      }
1891    };
1892    if (json.has("_dayOfWeek")) {
1893      JsonArray array = getJArray(json, "_dayOfWeek");
1894      for (int i = 0; i < array.size(); i++) {
1895        if (i == res.getDayOfWeek().size())
1896          res.getDayOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
1897        if (array.get(i) instanceof JsonObject) 
1898          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1899      }
1900    };
1901    if (json.has("timeOfDay")) {
1902      JsonArray array = getJArray(json, "timeOfDay");
1903      for (int i = 0; i < array.size(); i++) {
1904        if (array.get(i).isJsonNull()) {
1905          res.getTimeOfDay().add(new TimeType());
1906        } else {;
1907          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1908        }
1909      }
1910    };
1911    if (json.has("_timeOfDay")) {
1912      JsonArray array = getJArray(json, "_timeOfDay");
1913      for (int i = 0; i < array.size(); i++) {
1914        if (i == res.getTimeOfDay().size())
1915          res.getTimeOfDay().add(parseTime(null));
1916        if (array.get(i) instanceof JsonObject) 
1917          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1918      }
1919    };
1920    if (json.has("when")) {
1921      JsonArray array = getJArray(json, "when");
1922      for (int i = 0; i < array.size(); i++) {
1923        if (array.get(i).isJsonNull()) {
1924          res.getWhen().add(new Enumeration<Timing.EventTiming>(new Timing.EventTimingEnumFactory(), Timing.EventTiming.NULL));
1925        } else {;
1926          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1927        }
1928      }
1929    };
1930    if (json.has("_when")) {
1931      JsonArray array = getJArray(json, "_when");
1932      for (int i = 0; i < array.size(); i++) {
1933        if (i == res.getWhen().size())
1934          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1935        if (array.get(i) instanceof JsonObject) 
1936          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1937      }
1938    };
1939    if (json.has("offset"))
1940      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1941    if (json.has("_offset"))
1942      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
1943  }
1944
1945  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
1946    TriggerDefinition res = new TriggerDefinition();
1947    parseTriggerDefinitionProperties(json, res);
1948    return res;
1949  }
1950
1951  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
1952    parseDataTypeProperties(json, res);
1953    if (json.has("type"))
1954      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
1955    if (json.has("_type"))
1956      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1957    if (json.has("name"))
1958      res.setNameElement(parseString(json.get("name").getAsString()));
1959    if (json.has("_name"))
1960      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1961    DataType timing = parseType("timing", json);
1962    if (timing != null)
1963      res.setTiming(timing);
1964    if (json.has("data")) {
1965      JsonArray array = getJArray(json, "data");
1966      for (int i = 0; i < array.size(); i++) {
1967        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
1968      }
1969    };
1970    if (json.has("condition"))
1971      res.setCondition(parseExpression(getJObject(json, "condition")));
1972  }
1973
1974  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1975    UsageContext res = new UsageContext();
1976    parseUsageContextProperties(json, res);
1977    return res;
1978  }
1979
1980  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1981    parseDataTypeProperties(json, res);
1982    if (json.has("code"))
1983      res.setCode(parseCoding(getJObject(json, "code")));
1984    DataType value = parseType("value", json);
1985    if (value != null)
1986      res.setValue(value);
1987  }
1988
1989  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1990    if (json.has("id"))
1991      res.setIdElement(parseId(json.get("id").getAsString()));
1992    if (json.has("_id"))
1993      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
1994    if (json.has("meta"))
1995      res.setMeta(parseMeta(getJObject(json, "meta")));
1996    if (json.has("implicitRules"))
1997      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1998    if (json.has("_implicitRules"))
1999      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
2000    if (json.has("language"))
2001      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2002    if (json.has("_language"))
2003      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2004  }
2005
2006  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
2007    parseResourceProperties(json, res);
2008    if (json.has("text"))
2009      res.setText(parseNarrative(getJObject(json, "text")));
2010    if (json.has("contained")) {
2011      JsonArray array = getJArray(json, "contained");
2012      for (int i = 0; i < array.size(); i++) {
2013        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
2014      }
2015    };
2016    if (json.has("extension")) {
2017      JsonArray array = getJArray(json, "extension");
2018      for (int i = 0; i < array.size(); i++) {
2019        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2020      }
2021    };
2022    if (json.has("modifierExtension")) {
2023      JsonArray array = getJArray(json, "modifierExtension");
2024      for (int i = 0; i < array.size(); i++) {
2025        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2026      }
2027    };
2028  }
2029
2030  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2031    Account res = new Account();
2032    parseAccountProperties(json, res);
2033    return res;
2034  }
2035
2036  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2037    parseDomainResourceProperties(json, res);
2038    if (json.has("identifier")) {
2039      JsonArray array = getJArray(json, "identifier");
2040      for (int i = 0; i < array.size(); i++) {
2041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2042      }
2043    };
2044    if (json.has("status"))
2045      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2046    if (json.has("_status"))
2047      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2048    if (json.has("type"))
2049      res.setType(parseCodeableConcept(getJObject(json, "type")));
2050    if (json.has("name"))
2051      res.setNameElement(parseString(json.get("name").getAsString()));
2052    if (json.has("_name"))
2053      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2054    if (json.has("subject")) {
2055      JsonArray array = getJArray(json, "subject");
2056      for (int i = 0; i < array.size(); i++) {
2057        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2058      }
2059    };
2060    if (json.has("servicePeriod"))
2061      res.setServicePeriod(parsePeriod(getJObject(json, "servicePeriod")));
2062    if (json.has("coverage")) {
2063      JsonArray array = getJArray(json, "coverage");
2064      for (int i = 0; i < array.size(); i++) {
2065        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject()));
2066      }
2067    };
2068    if (json.has("owner"))
2069      res.setOwner(parseReference(getJObject(json, "owner")));
2070    if (json.has("description"))
2071      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2072    if (json.has("_description"))
2073      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2074    if (json.has("guarantor")) {
2075      JsonArray array = getJArray(json, "guarantor");
2076      for (int i = 0; i < array.size(); i++) {
2077        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject()));
2078      }
2079    };
2080    if (json.has("partOf"))
2081      res.setPartOf(parseReference(getJObject(json, "partOf")));
2082  }
2083
2084  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
2085    Account.CoverageComponent res = new Account.CoverageComponent();
2086    parseAccountCoverageComponentProperties(json, res);
2087    return res;
2088  }
2089
2090  protected void parseAccountCoverageComponentProperties(JsonObject json, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2091    parseBackboneElementProperties(json, res);
2092    if (json.has("coverage"))
2093      res.setCoverage(parseReference(getJObject(json, "coverage")));
2094    if (json.has("priority"))
2095      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2096    if (json.has("_priority"))
2097      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2098  }
2099
2100  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json) throws IOException, FHIRFormatError {
2101    Account.GuarantorComponent res = new Account.GuarantorComponent();
2102    parseAccountGuarantorComponentProperties(json, res);
2103    return res;
2104  }
2105
2106  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2107    parseBackboneElementProperties(json, res);
2108    if (json.has("party"))
2109      res.setParty(parseReference(getJObject(json, "party")));
2110    if (json.has("onHold"))
2111      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2112    if (json.has("_onHold"))
2113      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
2114    if (json.has("period"))
2115      res.setPeriod(parsePeriod(getJObject(json, "period")));
2116  }
2117
2118  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2119    ActivityDefinition res = new ActivityDefinition();
2120    parseActivityDefinitionProperties(json, res);
2121    return res;
2122  }
2123
2124  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2125    parseDomainResourceProperties(json, res);
2126    if (json.has("url"))
2127      res.setUrlElement(parseUri(json.get("url").getAsString()));
2128    if (json.has("_url"))
2129      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2130    if (json.has("identifier")) {
2131      JsonArray array = getJArray(json, "identifier");
2132      for (int i = 0; i < array.size(); i++) {
2133        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2134      }
2135    };
2136    if (json.has("version"))
2137      res.setVersionElement(parseString(json.get("version").getAsString()));
2138    if (json.has("_version"))
2139      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2140    if (json.has("name"))
2141      res.setNameElement(parseString(json.get("name").getAsString()));
2142    if (json.has("_name"))
2143      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2144    if (json.has("title"))
2145      res.setTitleElement(parseString(json.get("title").getAsString()));
2146    if (json.has("_title"))
2147      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2148    if (json.has("subtitle"))
2149      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2150    if (json.has("_subtitle"))
2151      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
2152    if (json.has("status"))
2153      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2154    if (json.has("_status"))
2155      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2156    if (json.has("experimental"))
2157      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2158    if (json.has("_experimental"))
2159      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2160    DataType subject = parseType("subject", json);
2161    if (subject != null)
2162      res.setSubject(subject);
2163    if (json.has("date"))
2164      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2165    if (json.has("_date"))
2166      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2167    if (json.has("publisher"))
2168      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2169    if (json.has("_publisher"))
2170      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2171    if (json.has("contact")) {
2172      JsonArray array = getJArray(json, "contact");
2173      for (int i = 0; i < array.size(); i++) {
2174        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2175      }
2176    };
2177    if (json.has("description"))
2178      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2179    if (json.has("_description"))
2180      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2181    if (json.has("useContext")) {
2182      JsonArray array = getJArray(json, "useContext");
2183      for (int i = 0; i < array.size(); i++) {
2184        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2185      }
2186    };
2187    if (json.has("jurisdiction")) {
2188      JsonArray array = getJArray(json, "jurisdiction");
2189      for (int i = 0; i < array.size(); i++) {
2190        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2191      }
2192    };
2193    if (json.has("purpose"))
2194      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2195    if (json.has("_purpose"))
2196      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2197    if (json.has("usage"))
2198      res.setUsageElement(parseString(json.get("usage").getAsString()));
2199    if (json.has("_usage"))
2200      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
2201    if (json.has("copyright"))
2202      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2203    if (json.has("_copyright"))
2204      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2205    if (json.has("approvalDate"))
2206      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2207    if (json.has("_approvalDate"))
2208      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
2209    if (json.has("lastReviewDate"))
2210      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2211    if (json.has("_lastReviewDate"))
2212      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
2213    if (json.has("effectivePeriod"))
2214      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
2215    if (json.has("topic")) {
2216      JsonArray array = getJArray(json, "topic");
2217      for (int i = 0; i < array.size(); i++) {
2218        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2219      }
2220    };
2221    if (json.has("author")) {
2222      JsonArray array = getJArray(json, "author");
2223      for (int i = 0; i < array.size(); i++) {
2224        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2225      }
2226    };
2227    if (json.has("editor")) {
2228      JsonArray array = getJArray(json, "editor");
2229      for (int i = 0; i < array.size(); i++) {
2230        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2231      }
2232    };
2233    if (json.has("reviewer")) {
2234      JsonArray array = getJArray(json, "reviewer");
2235      for (int i = 0; i < array.size(); i++) {
2236        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2237      }
2238    };
2239    if (json.has("endorser")) {
2240      JsonArray array = getJArray(json, "endorser");
2241      for (int i = 0; i < array.size(); i++) {
2242        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2243      }
2244    };
2245    if (json.has("relatedArtifact")) {
2246      JsonArray array = getJArray(json, "relatedArtifact");
2247      for (int i = 0; i < array.size(); i++) {
2248        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2249      }
2250    };
2251    if (json.has("library")) {
2252      JsonArray array = getJArray(json, "library");
2253      for (int i = 0; i < array.size(); i++) {
2254        if (array.get(i).isJsonNull()) {
2255          res.getLibrary().add(new CanonicalType());
2256        } else {;
2257          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2258        }
2259      }
2260    };
2261    if (json.has("_library")) {
2262      JsonArray array = getJArray(json, "_library");
2263      for (int i = 0; i < array.size(); i++) {
2264        if (i == res.getLibrary().size())
2265          res.getLibrary().add(parseCanonical(null));
2266        if (array.get(i) instanceof JsonObject) 
2267          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2268      }
2269    };
2270    if (json.has("kind"))
2271      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.RequestResourceType.NULL, new ActivityDefinition.RequestResourceTypeEnumFactory()));
2272    if (json.has("_kind"))
2273      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2274    if (json.has("profile"))
2275      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2276    if (json.has("_profile"))
2277      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
2278    if (json.has("code"))
2279      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2280    if (json.has("intent"))
2281      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
2282    if (json.has("_intent"))
2283      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
2284    if (json.has("priority"))
2285      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
2286    if (json.has("_priority"))
2287      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2288    if (json.has("doNotPerform"))
2289      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2290    if (json.has("_doNotPerform"))
2291      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
2292    DataType timing = parseType("timing", json);
2293    if (timing != null)
2294      res.setTiming(timing);
2295    if (json.has("location"))
2296      res.setLocation(parseReference(getJObject(json, "location")));
2297    if (json.has("participant")) {
2298      JsonArray array = getJArray(json, "participant");
2299      for (int i = 0; i < array.size(); i++) {
2300        res.getParticipant().add(parseActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject()));
2301      }
2302    };
2303    DataType product = parseType("product", json);
2304    if (product != null)
2305      res.setProduct(product);
2306    if (json.has("quantity"))
2307      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
2308    if (json.has("dosage")) {
2309      JsonArray array = getJArray(json, "dosage");
2310      for (int i = 0; i < array.size(); i++) {
2311        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2312      }
2313    };
2314    if (json.has("bodySite")) {
2315      JsonArray array = getJArray(json, "bodySite");
2316      for (int i = 0; i < array.size(); i++) {
2317        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2318      }
2319    };
2320    if (json.has("specimenRequirement")) {
2321      JsonArray array = getJArray(json, "specimenRequirement");
2322      for (int i = 0; i < array.size(); i++) {
2323        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2324      }
2325    };
2326    if (json.has("observationRequirement")) {
2327      JsonArray array = getJArray(json, "observationRequirement");
2328      for (int i = 0; i < array.size(); i++) {
2329        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2330      }
2331    };
2332    if (json.has("observationResultRequirement")) {
2333      JsonArray array = getJArray(json, "observationResultRequirement");
2334      for (int i = 0; i < array.size(); i++) {
2335        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2336      }
2337    };
2338    if (json.has("transform"))
2339      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2340    if (json.has("_transform"))
2341      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
2342    if (json.has("dynamicValue")) {
2343      JsonArray array = getJArray(json, "dynamicValue");
2344      for (int i = 0; i < array.size(); i++) {
2345        res.getDynamicValue().add(parseActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject()));
2346      }
2347    };
2348  }
2349
2350  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2351    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2352    parseActivityDefinitionParticipantComponentProperties(json, res);
2353    return res;
2354  }
2355
2356  protected void parseActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2357    parseBackboneElementProperties(json, res);
2358    if (json.has("type"))
2359      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
2360    if (json.has("_type"))
2361      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2362    if (json.has("role"))
2363      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2364  }
2365
2366  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
2367    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2368    parseActivityDefinitionDynamicValueComponentProperties(json, res);
2369    return res;
2370  }
2371
2372  protected void parseActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2373    parseBackboneElementProperties(json, res);
2374    if (json.has("path"))
2375      res.setPathElement(parseString(json.get("path").getAsString()));
2376    if (json.has("_path"))
2377      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2378    if (json.has("expression"))
2379      res.setExpression(parseExpression(getJObject(json, "expression")));
2380  }
2381
2382  protected AdministrableProductDefinition parseAdministrableProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
2383    AdministrableProductDefinition res = new AdministrableProductDefinition();
2384    parseAdministrableProductDefinitionProperties(json, res);
2385    return res;
2386  }
2387
2388  protected void parseAdministrableProductDefinitionProperties(JsonObject json, AdministrableProductDefinition res) throws IOException, FHIRFormatError {
2389    parseDomainResourceProperties(json, res);
2390    if (json.has("identifier")) {
2391      JsonArray array = getJArray(json, "identifier");
2392      for (int i = 0; i < array.size(); i++) {
2393        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2394      }
2395    };
2396    if (json.has("status"))
2397      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2398    if (json.has("_status"))
2399      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2400    if (json.has("formOf")) {
2401      JsonArray array = getJArray(json, "formOf");
2402      for (int i = 0; i < array.size(); i++) {
2403        res.getFormOf().add(parseReference(array.get(i).getAsJsonObject()));
2404      }
2405    };
2406    if (json.has("administrableDoseForm"))
2407      res.setAdministrableDoseForm(parseCodeableConcept(getJObject(json, "administrableDoseForm")));
2408    if (json.has("unitOfPresentation"))
2409      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
2410    if (json.has("producedFrom")) {
2411      JsonArray array = getJArray(json, "producedFrom");
2412      for (int i = 0; i < array.size(); i++) {
2413        res.getProducedFrom().add(parseReference(array.get(i).getAsJsonObject()));
2414      }
2415    };
2416    if (json.has("ingredient")) {
2417      JsonArray array = getJArray(json, "ingredient");
2418      for (int i = 0; i < array.size(); i++) {
2419        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2420      }
2421    };
2422    if (json.has("device"))
2423      res.setDevice(parseReference(getJObject(json, "device")));
2424    if (json.has("property")) {
2425      JsonArray array = getJArray(json, "property");
2426      for (int i = 0; i < array.size(); i++) {
2427        res.getProperty().add(parseAdministrableProductDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
2428      }
2429    };
2430    if (json.has("routeOfAdministration")) {
2431      JsonArray array = getJArray(json, "routeOfAdministration");
2432      for (int i = 0; i < array.size(); i++) {
2433        res.getRouteOfAdministration().add(parseAdministrableProductDefinitionRouteOfAdministrationComponent(array.get(i).getAsJsonObject()));
2434      }
2435    };
2436  }
2437
2438  protected AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent parseAdministrableProductDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
2439    AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent();
2440    parseAdministrableProductDefinitionPropertyComponentProperties(json, res);
2441    return res;
2442  }
2443
2444  protected void parseAdministrableProductDefinitionPropertyComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
2445    parseBackboneElementProperties(json, res);
2446    if (json.has("type"))
2447      res.setType(parseCodeableConcept(getJObject(json, "type")));
2448    DataType value = parseType("value", json);
2449    if (value != null)
2450      res.setValue(value);
2451    if (json.has("status"))
2452      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
2453  }
2454
2455  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent parseAdministrableProductDefinitionRouteOfAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
2456    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent();
2457    parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(json, res);
2458    return res;
2459  }
2460
2461  protected void parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
2462    parseBackboneElementProperties(json, res);
2463    if (json.has("code"))
2464      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2465    if (json.has("firstDose"))
2466      res.setFirstDose(parseQuantity(getJObject(json, "firstDose")));
2467    if (json.has("maxSingleDose"))
2468      res.setMaxSingleDose(parseQuantity(getJObject(json, "maxSingleDose")));
2469    if (json.has("maxDosePerDay"))
2470      res.setMaxDosePerDay(parseQuantity(getJObject(json, "maxDosePerDay")));
2471    if (json.has("maxDosePerTreatmentPeriod"))
2472      res.setMaxDosePerTreatmentPeriod(parseRatio(getJObject(json, "maxDosePerTreatmentPeriod")));
2473    if (json.has("maxTreatmentPeriod"))
2474      res.setMaxTreatmentPeriod(parseDuration(getJObject(json, "maxTreatmentPeriod")));
2475    if (json.has("targetSpecies")) {
2476      JsonArray array = getJArray(json, "targetSpecies");
2477      for (int i = 0; i < array.size(); i++) {
2478        res.getTargetSpecies().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject()));
2479      }
2480    };
2481  }
2482
2483  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(JsonObject json) throws IOException, FHIRFormatError {
2484    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
2485    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(json, res);
2486    return res;
2487  }
2488
2489  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
2490    parseBackboneElementProperties(json, res);
2491    if (json.has("code"))
2492      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2493    if (json.has("withdrawalPeriod")) {
2494      JsonArray array = getJArray(json, "withdrawalPeriod");
2495      for (int i = 0; i < array.size(); i++) {
2496        res.getWithdrawalPeriod().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject()));
2497      }
2498    };
2499  }
2500
2501  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json) throws IOException, FHIRFormatError {
2502    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
2503    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, res);
2504    return res;
2505  }
2506
2507  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
2508    parseBackboneElementProperties(json, res);
2509    if (json.has("tissue"))
2510      res.setTissue(parseCodeableConcept(getJObject(json, "tissue")));
2511    if (json.has("value"))
2512      res.setValue(parseQuantity(getJObject(json, "value")));
2513    if (json.has("supportingInformation"))
2514      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
2515    if (json.has("_supportingInformation"))
2516      parseElementProperties(getJObject(json, "_supportingInformation"), res.getSupportingInformationElement());
2517  }
2518
2519  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2520    AdverseEvent res = new AdverseEvent();
2521    parseAdverseEventProperties(json, res);
2522    return res;
2523  }
2524
2525  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2526    parseDomainResourceProperties(json, res);
2527    if (json.has("identifier"))
2528      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2529    if (json.has("actuality"))
2530      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2531    if (json.has("_actuality"))
2532      parseElementProperties(getJObject(json, "_actuality"), res.getActualityElement());
2533    if (json.has("category")) {
2534      JsonArray array = getJArray(json, "category");
2535      for (int i = 0; i < array.size(); i++) {
2536        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2537      }
2538    };
2539    if (json.has("event"))
2540      res.setEvent(parseCodeableConcept(getJObject(json, "event")));
2541    if (json.has("subject"))
2542      res.setSubject(parseReference(getJObject(json, "subject")));
2543    if (json.has("encounter"))
2544      res.setEncounter(parseReference(getJObject(json, "encounter")));
2545    if (json.has("date"))
2546      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2547    if (json.has("_date"))
2548      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2549    if (json.has("detected"))
2550      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2551    if (json.has("_detected"))
2552      parseElementProperties(getJObject(json, "_detected"), res.getDetectedElement());
2553    if (json.has("recordedDate"))
2554      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2555    if (json.has("_recordedDate"))
2556      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2557    if (json.has("resultingCondition")) {
2558      JsonArray array = getJArray(json, "resultingCondition");
2559      for (int i = 0; i < array.size(); i++) {
2560        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2561      }
2562    };
2563    if (json.has("location"))
2564      res.setLocation(parseReference(getJObject(json, "location")));
2565    if (json.has("seriousness"))
2566      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
2567    if (json.has("severity"))
2568      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
2569    if (json.has("outcome"))
2570      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
2571    if (json.has("recorder"))
2572      res.setRecorder(parseReference(getJObject(json, "recorder")));
2573    if (json.has("contributor")) {
2574      JsonArray array = getJArray(json, "contributor");
2575      for (int i = 0; i < array.size(); i++) {
2576        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2577      }
2578    };
2579    if (json.has("suspectEntity")) {
2580      JsonArray array = getJArray(json, "suspectEntity");
2581      for (int i = 0; i < array.size(); i++) {
2582        res.getSuspectEntity().add(parseAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject()));
2583      }
2584    };
2585    if (json.has("subjectMedicalHistory")) {
2586      JsonArray array = getJArray(json, "subjectMedicalHistory");
2587      for (int i = 0; i < array.size(); i++) {
2588        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2589      }
2590    };
2591    if (json.has("referenceDocument")) {
2592      JsonArray array = getJArray(json, "referenceDocument");
2593      for (int i = 0; i < array.size(); i++) {
2594        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2595      }
2596    };
2597    if (json.has("study")) {
2598      JsonArray array = getJArray(json, "study");
2599      for (int i = 0; i < array.size(); i++) {
2600        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2601      }
2602    };
2603  }
2604
2605  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventSuspectEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
2606    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2607    parseAdverseEventSuspectEntityComponentProperties(json, res);
2608    return res;
2609  }
2610
2611  protected void parseAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2612    parseBackboneElementProperties(json, res);
2613    if (json.has("instance"))
2614      res.setInstance(parseReference(getJObject(json, "instance")));
2615    if (json.has("causality")) {
2616      JsonArray array = getJArray(json, "causality");
2617      for (int i = 0; i < array.size(); i++) {
2618        res.getCausality().add(parseAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject()));
2619      }
2620    };
2621  }
2622
2623  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventSuspectEntityCausalityComponent(JsonObject json) throws IOException, FHIRFormatError {
2624    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2625    parseAdverseEventSuspectEntityCausalityComponentProperties(json, res);
2626    return res;
2627  }
2628
2629  protected void parseAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2630    parseBackboneElementProperties(json, res);
2631    if (json.has("assessment"))
2632      res.setAssessment(parseCodeableConcept(getJObject(json, "assessment")));
2633    if (json.has("productRelatedness"))
2634      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2635    if (json.has("_productRelatedness"))
2636      parseElementProperties(getJObject(json, "_productRelatedness"), res.getProductRelatednessElement());
2637    if (json.has("author"))
2638      res.setAuthor(parseReference(getJObject(json, "author")));
2639    if (json.has("method"))
2640      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
2641  }
2642
2643  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2644    AllergyIntolerance res = new AllergyIntolerance();
2645    parseAllergyIntoleranceProperties(json, res);
2646    return res;
2647  }
2648
2649  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2650    parseDomainResourceProperties(json, res);
2651    if (json.has("identifier")) {
2652      JsonArray array = getJArray(json, "identifier");
2653      for (int i = 0; i < array.size(); i++) {
2654        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2655      }
2656    };
2657    if (json.has("clinicalStatus"))
2658      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
2659    if (json.has("verificationStatus"))
2660      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
2661    if (json.has("type"))
2662      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2663    if (json.has("_type"))
2664      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2665    if (json.has("category")) {
2666      JsonArray array = getJArray(json, "category");
2667      for (int i = 0; i < array.size(); i++) {
2668        if (array.get(i).isJsonNull()) {
2669          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>(new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), AllergyIntolerance.AllergyIntoleranceCategory.NULL));
2670        } else {;
2671          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2672        }
2673      }
2674    };
2675    if (json.has("_category")) {
2676      JsonArray array = getJArray(json, "_category");
2677      for (int i = 0; i < array.size(); i++) {
2678        if (i == res.getCategory().size())
2679          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2680        if (array.get(i) instanceof JsonObject) 
2681          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2682      }
2683    };
2684    if (json.has("criticality"))
2685      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2686    if (json.has("_criticality"))
2687      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
2688    if (json.has("code"))
2689      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2690    if (json.has("patient"))
2691      res.setPatient(parseReference(getJObject(json, "patient")));
2692    if (json.has("encounter"))
2693      res.setEncounter(parseReference(getJObject(json, "encounter")));
2694    DataType onset = parseType("onset", json);
2695    if (onset != null)
2696      res.setOnset(onset);
2697    if (json.has("recordedDate"))
2698      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2699    if (json.has("_recordedDate"))
2700      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2701    if (json.has("recorder"))
2702      res.setRecorder(parseReference(getJObject(json, "recorder")));
2703    if (json.has("asserter"))
2704      res.setAsserter(parseReference(getJObject(json, "asserter")));
2705    if (json.has("lastOccurrence"))
2706      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2707    if (json.has("_lastOccurrence"))
2708      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
2709    if (json.has("note")) {
2710      JsonArray array = getJArray(json, "note");
2711      for (int i = 0; i < array.size(); i++) {
2712        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2713      }
2714    };
2715    if (json.has("reaction")) {
2716      JsonArray array = getJArray(json, "reaction");
2717      for (int i = 0; i < array.size(); i++) {
2718        res.getReaction().add(parseAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject()));
2719      }
2720    };
2721  }
2722
2723  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
2724    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2725    parseAllergyIntoleranceReactionComponentProperties(json, res);
2726    return res;
2727  }
2728
2729  protected void parseAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2730    parseBackboneElementProperties(json, res);
2731    if (json.has("substance"))
2732      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
2733    if (json.has("manifestation")) {
2734      JsonArray array = getJArray(json, "manifestation");
2735      for (int i = 0; i < array.size(); i++) {
2736        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2737      }
2738    };
2739    if (json.has("description"))
2740      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2741    if (json.has("_description"))
2742      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2743    if (json.has("onset"))
2744      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2745    if (json.has("_onset"))
2746      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
2747    if (json.has("severity"))
2748      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2749    if (json.has("_severity"))
2750      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2751    if (json.has("exposureRoute"))
2752      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
2753    if (json.has("note")) {
2754      JsonArray array = getJArray(json, "note");
2755      for (int i = 0; i < array.size(); i++) {
2756        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2757      }
2758    };
2759  }
2760
2761  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2762    Appointment res = new Appointment();
2763    parseAppointmentProperties(json, res);
2764    return res;
2765  }
2766
2767  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2768    parseDomainResourceProperties(json, res);
2769    if (json.has("identifier")) {
2770      JsonArray array = getJArray(json, "identifier");
2771      for (int i = 0; i < array.size(); i++) {
2772        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2773      }
2774    };
2775    if (json.has("status"))
2776      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2777    if (json.has("_status"))
2778      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2779    if (json.has("cancelationReason"))
2780      res.setCancelationReason(parseCodeableConcept(getJObject(json, "cancelationReason")));
2781    if (json.has("serviceCategory")) {
2782      JsonArray array = getJArray(json, "serviceCategory");
2783      for (int i = 0; i < array.size(); i++) {
2784        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2785      }
2786    };
2787    if (json.has("serviceType")) {
2788      JsonArray array = getJArray(json, "serviceType");
2789      for (int i = 0; i < array.size(); i++) {
2790        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2791      }
2792    };
2793    if (json.has("specialty")) {
2794      JsonArray array = getJArray(json, "specialty");
2795      for (int i = 0; i < array.size(); i++) {
2796        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2797      }
2798    };
2799    if (json.has("appointmentType"))
2800      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
2801    if (json.has("reasonCode")) {
2802      JsonArray array = getJArray(json, "reasonCode");
2803      for (int i = 0; i < array.size(); i++) {
2804        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2805      }
2806    };
2807    if (json.has("reasonReference")) {
2808      JsonArray array = getJArray(json, "reasonReference");
2809      for (int i = 0; i < array.size(); i++) {
2810        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2811      }
2812    };
2813    if (json.has("priority"))
2814      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2815    if (json.has("_priority"))
2816      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2817    if (json.has("description"))
2818      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2819    if (json.has("_description"))
2820      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2821    if (json.has("supportingInformation")) {
2822      JsonArray array = getJArray(json, "supportingInformation");
2823      for (int i = 0; i < array.size(); i++) {
2824        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2825      }
2826    };
2827    if (json.has("start"))
2828      res.setStartElement(parseInstant(json.get("start").getAsString()));
2829    if (json.has("_start"))
2830      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2831    if (json.has("end"))
2832      res.setEndElement(parseInstant(json.get("end").getAsString()));
2833    if (json.has("_end"))
2834      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2835    if (json.has("minutesDuration"))
2836      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2837    if (json.has("_minutesDuration"))
2838      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
2839    if (json.has("slot")) {
2840      JsonArray array = getJArray(json, "slot");
2841      for (int i = 0; i < array.size(); i++) {
2842        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2843      }
2844    };
2845    if (json.has("created"))
2846      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2847    if (json.has("_created"))
2848      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2849    if (json.has("comment"))
2850      res.setCommentElement(parseString(json.get("comment").getAsString()));
2851    if (json.has("_comment"))
2852      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2853    if (json.has("patientInstruction"))
2854      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2855    if (json.has("_patientInstruction"))
2856      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
2857    if (json.has("basedOn")) {
2858      JsonArray array = getJArray(json, "basedOn");
2859      for (int i = 0; i < array.size(); i++) {
2860        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2861      }
2862    };
2863    if (json.has("participant")) {
2864      JsonArray array = getJArray(json, "participant");
2865      for (int i = 0; i < array.size(); i++) {
2866        res.getParticipant().add(parseAppointmentParticipantComponent(array.get(i).getAsJsonObject()));
2867      }
2868    };
2869    if (json.has("requestedPeriod")) {
2870      JsonArray array = getJArray(json, "requestedPeriod");
2871      for (int i = 0; i < array.size(); i++) {
2872        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2873      }
2874    };
2875  }
2876
2877  protected Appointment.AppointmentParticipantComponent parseAppointmentParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2878    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2879    parseAppointmentParticipantComponentProperties(json, res);
2880    return res;
2881  }
2882
2883  protected void parseAppointmentParticipantComponentProperties(JsonObject json, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2884    parseBackboneElementProperties(json, res);
2885    if (json.has("type")) {
2886      JsonArray array = getJArray(json, "type");
2887      for (int i = 0; i < array.size(); i++) {
2888        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2889      }
2890    };
2891    if (json.has("actor"))
2892      res.setActor(parseReference(getJObject(json, "actor")));
2893    if (json.has("required"))
2894      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2895    if (json.has("_required"))
2896      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
2897    if (json.has("status"))
2898      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
2899    if (json.has("_status"))
2900      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2901    if (json.has("period"))
2902      res.setPeriod(parsePeriod(getJObject(json, "period")));
2903  }
2904
2905  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2906    AppointmentResponse res = new AppointmentResponse();
2907    parseAppointmentResponseProperties(json, res);
2908    return res;
2909  }
2910
2911  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2912    parseDomainResourceProperties(json, res);
2913    if (json.has("identifier")) {
2914      JsonArray array = getJArray(json, "identifier");
2915      for (int i = 0; i < array.size(); i++) {
2916        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2917      }
2918    };
2919    if (json.has("appointment"))
2920      res.setAppointment(parseReference(getJObject(json, "appointment")));
2921    if (json.has("start"))
2922      res.setStartElement(parseInstant(json.get("start").getAsString()));
2923    if (json.has("_start"))
2924      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2925    if (json.has("end"))
2926      res.setEndElement(parseInstant(json.get("end").getAsString()));
2927    if (json.has("_end"))
2928      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2929    if (json.has("participantType")) {
2930      JsonArray array = getJArray(json, "participantType");
2931      for (int i = 0; i < array.size(); i++) {
2932        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2933      }
2934    };
2935    if (json.has("actor"))
2936      res.setActor(parseReference(getJObject(json, "actor")));
2937    if (json.has("participantStatus"))
2938      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
2939    if (json.has("_participantStatus"))
2940      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
2941    if (json.has("comment"))
2942      res.setCommentElement(parseString(json.get("comment").getAsString()));
2943    if (json.has("_comment"))
2944      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2945  }
2946
2947  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2948    AuditEvent res = new AuditEvent();
2949    parseAuditEventProperties(json, res);
2950    return res;
2951  }
2952
2953  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2954    parseDomainResourceProperties(json, res);
2955    if (json.has("type"))
2956      res.setType(parseCoding(getJObject(json, "type")));
2957    if (json.has("subtype")) {
2958      JsonArray array = getJArray(json, "subtype");
2959      for (int i = 0; i < array.size(); i++) {
2960        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2961      }
2962    };
2963    if (json.has("action"))
2964      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2965    if (json.has("_action"))
2966      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
2967    if (json.has("period"))
2968      res.setPeriod(parsePeriod(getJObject(json, "period")));
2969    if (json.has("recorded"))
2970      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2971    if (json.has("_recorded"))
2972      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
2973    if (json.has("outcome"))
2974      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2975    if (json.has("_outcome"))
2976      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
2977    if (json.has("outcomeDesc"))
2978      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2979    if (json.has("_outcomeDesc"))
2980      parseElementProperties(getJObject(json, "_outcomeDesc"), res.getOutcomeDescElement());
2981    if (json.has("purposeOfEvent")) {
2982      JsonArray array = getJArray(json, "purposeOfEvent");
2983      for (int i = 0; i < array.size(); i++) {
2984        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2985      }
2986    };
2987    if (json.has("agent")) {
2988      JsonArray array = getJArray(json, "agent");
2989      for (int i = 0; i < array.size(); i++) {
2990        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
2991      }
2992    };
2993    if (json.has("source"))
2994      res.setSource(parseAuditEventSourceComponent(getJObject(json, "source")));
2995    if (json.has("entity")) {
2996      JsonArray array = getJArray(json, "entity");
2997      for (int i = 0; i < array.size(); i++) {
2998        res.getEntity().add(parseAuditEventEntityComponent(array.get(i).getAsJsonObject()));
2999      }
3000    };
3001  }
3002
3003  protected AuditEvent.AuditEventAgentComponent parseAuditEventAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
3004    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
3005    parseAuditEventAgentComponentProperties(json, res);
3006    return res;
3007  }
3008
3009  protected void parseAuditEventAgentComponentProperties(JsonObject json, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
3010    parseBackboneElementProperties(json, res);
3011    if (json.has("type"))
3012      res.setType(parseCodeableConcept(getJObject(json, "type")));
3013    if (json.has("role")) {
3014      JsonArray array = getJArray(json, "role");
3015      for (int i = 0; i < array.size(); i++) {
3016        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3017      }
3018    };
3019    if (json.has("who"))
3020      res.setWho(parseReference(getJObject(json, "who")));
3021    if (json.has("altId"))
3022      res.setAltIdElement(parseString(json.get("altId").getAsString()));
3023    if (json.has("_altId"))
3024      parseElementProperties(getJObject(json, "_altId"), res.getAltIdElement());
3025    if (json.has("name"))
3026      res.setNameElement(parseString(json.get("name").getAsString()));
3027    if (json.has("_name"))
3028      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3029    if (json.has("requestor"))
3030      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
3031    if (json.has("_requestor"))
3032      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
3033    if (json.has("location"))
3034      res.setLocation(parseReference(getJObject(json, "location")));
3035    if (json.has("policy")) {
3036      JsonArray array = getJArray(json, "policy");
3037      for (int i = 0; i < array.size(); i++) {
3038        if (array.get(i).isJsonNull()) {
3039          res.getPolicy().add(new UriType());
3040        } else {;
3041          res.getPolicy().add(parseUri(array.get(i).getAsString()));
3042        }
3043      }
3044    };
3045    if (json.has("_policy")) {
3046      JsonArray array = getJArray(json, "_policy");
3047      for (int i = 0; i < array.size(); i++) {
3048        if (i == res.getPolicy().size())
3049          res.getPolicy().add(parseUri(null));
3050        if (array.get(i) instanceof JsonObject) 
3051          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
3052      }
3053    };
3054    if (json.has("media"))
3055      res.setMedia(parseCoding(getJObject(json, "media")));
3056    if (json.has("network"))
3057      res.setNetwork(parseAuditEventAgentNetworkComponent(getJObject(json, "network")));
3058    if (json.has("purposeOfUse")) {
3059      JsonArray array = getJArray(json, "purposeOfUse");
3060      for (int i = 0; i < array.size(); i++) {
3061        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3062      }
3063    };
3064  }
3065
3066  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAgentNetworkComponent(JsonObject json) throws IOException, FHIRFormatError {
3067    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
3068    parseAuditEventAgentNetworkComponentProperties(json, res);
3069    return res;
3070  }
3071
3072  protected void parseAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
3073    parseBackboneElementProperties(json, res);
3074    if (json.has("address"))
3075      res.setAddressElement(parseString(json.get("address").getAsString()));
3076    if (json.has("_address"))
3077      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
3078    if (json.has("type"))
3079      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
3080    if (json.has("_type"))
3081      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3082  }
3083
3084  protected AuditEvent.AuditEventSourceComponent parseAuditEventSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
3085    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
3086    parseAuditEventSourceComponentProperties(json, res);
3087    return res;
3088  }
3089
3090  protected void parseAuditEventSourceComponentProperties(JsonObject json, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
3091    parseBackboneElementProperties(json, res);
3092    if (json.has("site"))
3093      res.setSiteElement(parseString(json.get("site").getAsString()));
3094    if (json.has("_site"))
3095      parseElementProperties(getJObject(json, "_site"), res.getSiteElement());
3096    if (json.has("observer"))
3097      res.setObserver(parseReference(getJObject(json, "observer")));
3098    if (json.has("type")) {
3099      JsonArray array = getJArray(json, "type");
3100      for (int i = 0; i < array.size(); i++) {
3101        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
3102      }
3103    };
3104  }
3105
3106  protected AuditEvent.AuditEventEntityComponent parseAuditEventEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
3107    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3108    parseAuditEventEntityComponentProperties(json, res);
3109    return res;
3110  }
3111
3112  protected void parseAuditEventEntityComponentProperties(JsonObject json, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
3113    parseBackboneElementProperties(json, res);
3114    if (json.has("what"))
3115      res.setWhat(parseReference(getJObject(json, "what")));
3116    if (json.has("type"))
3117      res.setType(parseCoding(getJObject(json, "type")));
3118    if (json.has("role"))
3119      res.setRole(parseCoding(getJObject(json, "role")));
3120    if (json.has("lifecycle"))
3121      res.setLifecycle(parseCoding(getJObject(json, "lifecycle")));
3122    if (json.has("securityLabel")) {
3123      JsonArray array = getJArray(json, "securityLabel");
3124      for (int i = 0; i < array.size(); i++) {
3125        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
3126      }
3127    };
3128    if (json.has("name"))
3129      res.setNameElement(parseString(json.get("name").getAsString()));
3130    if (json.has("_name"))
3131      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3132    if (json.has("description"))
3133      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3134    if (json.has("_description"))
3135      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3136    if (json.has("query"))
3137      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
3138    if (json.has("_query"))
3139      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
3140    if (json.has("detail")) {
3141      JsonArray array = getJArray(json, "detail");
3142      for (int i = 0; i < array.size(); i++) {
3143        res.getDetail().add(parseAuditEventEntityDetailComponent(array.get(i).getAsJsonObject()));
3144      }
3145    };
3146  }
3147
3148  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventEntityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
3149    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
3150    parseAuditEventEntityDetailComponentProperties(json, res);
3151    return res;
3152  }
3153
3154  protected void parseAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
3155    parseBackboneElementProperties(json, res);
3156    if (json.has("type"))
3157      res.setTypeElement(parseString(json.get("type").getAsString()));
3158    if (json.has("_type"))
3159      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3160    DataType value = parseType("value", json);
3161    if (value != null)
3162      res.setValue(value);
3163  }
3164
3165  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
3166    Basic res = new Basic();
3167    parseBasicProperties(json, res);
3168    return res;
3169  }
3170
3171  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
3172    parseDomainResourceProperties(json, res);
3173    if (json.has("identifier")) {
3174      JsonArray array = getJArray(json, "identifier");
3175      for (int i = 0; i < array.size(); i++) {
3176        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3177      }
3178    };
3179    if (json.has("code"))
3180      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3181    if (json.has("subject"))
3182      res.setSubject(parseReference(getJObject(json, "subject")));
3183    if (json.has("created"))
3184      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3185    if (json.has("_created"))
3186      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
3187    if (json.has("author"))
3188      res.setAuthor(parseReference(getJObject(json, "author")));
3189  }
3190
3191  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3192    Binary res = new Binary();
3193    parseBinaryProperties(json, res);
3194    return res;
3195  }
3196
3197  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3198    parseResourceProperties(json, res);
3199    if (json.has("contentType"))
3200      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3201    if (json.has("_contentType"))
3202      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
3203    if (json.has("securityContext"))
3204      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
3205    if (json.has("data"))
3206      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3207    if (json.has("_data"))
3208      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
3209  }
3210
3211  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3212    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3213    parseBiologicallyDerivedProductProperties(json, res);
3214    return res;
3215  }
3216
3217  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3218    parseDomainResourceProperties(json, res);
3219    if (json.has("identifier")) {
3220      JsonArray array = getJArray(json, "identifier");
3221      for (int i = 0; i < array.size(); i++) {
3222        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3223      }
3224    };
3225    if (json.has("productCategory"))
3226      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3227    if (json.has("_productCategory"))
3228      parseElementProperties(getJObject(json, "_productCategory"), res.getProductCategoryElement());
3229    if (json.has("productCode"))
3230      res.setProductCode(parseCodeableConcept(getJObject(json, "productCode")));
3231    if (json.has("status"))
3232      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3233    if (json.has("_status"))
3234      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3235    if (json.has("request")) {
3236      JsonArray array = getJArray(json, "request");
3237      for (int i = 0; i < array.size(); i++) {
3238        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3239      }
3240    };
3241    if (json.has("quantity"))
3242      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3243    if (json.has("_quantity"))
3244      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
3245    if (json.has("parent")) {
3246      JsonArray array = getJArray(json, "parent");
3247      for (int i = 0; i < array.size(); i++) {
3248        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3249      }
3250    };
3251    if (json.has("collection"))
3252      res.setCollection(parseBiologicallyDerivedProductCollectionComponent(getJObject(json, "collection")));
3253    if (json.has("processing")) {
3254      JsonArray array = getJArray(json, "processing");
3255      for (int i = 0; i < array.size(); i++) {
3256        res.getProcessing().add(parseBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject()));
3257      }
3258    };
3259    if (json.has("manipulation"))
3260      res.setManipulation(parseBiologicallyDerivedProductManipulationComponent(getJObject(json, "manipulation")));
3261    if (json.has("storage")) {
3262      JsonArray array = getJArray(json, "storage");
3263      for (int i = 0; i < array.size(); i++) {
3264        res.getStorage().add(parseBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject()));
3265      }
3266    };
3267  }
3268
3269  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
3270    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3271    parseBiologicallyDerivedProductCollectionComponentProperties(json, res);
3272    return res;
3273  }
3274
3275  protected void parseBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3276    parseBackboneElementProperties(json, res);
3277    if (json.has("collector"))
3278      res.setCollector(parseReference(getJObject(json, "collector")));
3279    if (json.has("source"))
3280      res.setSource(parseReference(getJObject(json, "source")));
3281    DataType collected = parseType("collected", json);
3282    if (collected != null)
3283      res.setCollected(collected);
3284  }
3285
3286  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductProcessingComponent(JsonObject json) throws IOException, FHIRFormatError {
3287    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3288    parseBiologicallyDerivedProductProcessingComponentProperties(json, res);
3289    return res;
3290  }
3291
3292  protected void parseBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3293    parseBackboneElementProperties(json, res);
3294    if (json.has("description"))
3295      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3296    if (json.has("_description"))
3297      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3298    if (json.has("procedure"))
3299      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
3300    if (json.has("additive"))
3301      res.setAdditive(parseReference(getJObject(json, "additive")));
3302    DataType time = parseType("time", json);
3303    if (time != null)
3304      res.setTime(time);
3305  }
3306
3307  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductManipulationComponent(JsonObject json) throws IOException, FHIRFormatError {
3308    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3309    parseBiologicallyDerivedProductManipulationComponentProperties(json, res);
3310    return res;
3311  }
3312
3313  protected void parseBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3314    parseBackboneElementProperties(json, res);
3315    if (json.has("description"))
3316      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3317    if (json.has("_description"))
3318      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3319    DataType time = parseType("time", json);
3320    if (time != null)
3321      res.setTime(time);
3322  }
3323
3324  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductStorageComponent(JsonObject json) throws IOException, FHIRFormatError {
3325    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3326    parseBiologicallyDerivedProductStorageComponentProperties(json, res);
3327    return res;
3328  }
3329
3330  protected void parseBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3331    parseBackboneElementProperties(json, res);
3332    if (json.has("description"))
3333      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3334    if (json.has("_description"))
3335      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3336    if (json.has("temperature"))
3337      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3338    if (json.has("_temperature"))
3339      parseElementProperties(getJObject(json, "_temperature"), res.getTemperatureElement());
3340    if (json.has("scale"))
3341      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3342    if (json.has("_scale"))
3343      parseElementProperties(getJObject(json, "_scale"), res.getScaleElement());
3344    if (json.has("duration"))
3345      res.setDuration(parsePeriod(getJObject(json, "duration")));
3346  }
3347
3348  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3349    BodyStructure res = new BodyStructure();
3350    parseBodyStructureProperties(json, res);
3351    return res;
3352  }
3353
3354  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3355    parseDomainResourceProperties(json, res);
3356    if (json.has("identifier")) {
3357      JsonArray array = getJArray(json, "identifier");
3358      for (int i = 0; i < array.size(); i++) {
3359        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3360      }
3361    };
3362    if (json.has("active"))
3363      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3364    if (json.has("_active"))
3365      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
3366    if (json.has("morphology"))
3367      res.setMorphology(parseCodeableConcept(getJObject(json, "morphology")));
3368    if (json.has("location"))
3369      res.setLocation(parseCodeableConcept(getJObject(json, "location")));
3370    if (json.has("locationQualifier")) {
3371      JsonArray array = getJArray(json, "locationQualifier");
3372      for (int i = 0; i < array.size(); i++) {
3373        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3374      }
3375    };
3376    if (json.has("description"))
3377      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3378    if (json.has("_description"))
3379      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3380    if (json.has("image")) {
3381      JsonArray array = getJArray(json, "image");
3382      for (int i = 0; i < array.size(); i++) {
3383        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3384      }
3385    };
3386    if (json.has("patient"))
3387      res.setPatient(parseReference(getJObject(json, "patient")));
3388  }
3389
3390  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3391    Bundle res = new Bundle();
3392    parseBundleProperties(json, res);
3393    return res;
3394  }
3395
3396  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3397    parseResourceProperties(json, res);
3398    if (json.has("identifier"))
3399      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
3400    if (json.has("type"))
3401      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3402    if (json.has("_type"))
3403      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3404    if (json.has("timestamp"))
3405      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3406    if (json.has("_timestamp"))
3407      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
3408    if (json.has("total"))
3409      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3410    if (json.has("_total"))
3411      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
3412    if (json.has("link")) {
3413      JsonArray array = getJArray(json, "link");
3414      for (int i = 0; i < array.size(); i++) {
3415        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
3416      }
3417    };
3418    if (json.has("entry")) {
3419      JsonArray array = getJArray(json, "entry");
3420      for (int i = 0; i < array.size(); i++) {
3421        res.getEntry().add(parseBundleEntryComponent(array.get(i).getAsJsonObject()));
3422      }
3423    };
3424    if (json.has("signature"))
3425      res.setSignature(parseSignature(getJObject(json, "signature")));
3426  }
3427
3428  protected Bundle.BundleLinkComponent parseBundleLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
3429    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3430    parseBundleLinkComponentProperties(json, res);
3431    return res;
3432  }
3433
3434  protected void parseBundleLinkComponentProperties(JsonObject json, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3435    parseBackboneElementProperties(json, res);
3436    if (json.has("relation"))
3437      res.setRelationElement(parseString(json.get("relation").getAsString()));
3438    if (json.has("_relation"))
3439      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
3440    if (json.has("url"))
3441      res.setUrlElement(parseUri(json.get("url").getAsString()));
3442    if (json.has("_url"))
3443      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3444  }
3445
3446  protected Bundle.BundleEntryComponent parseBundleEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
3447    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3448    parseBundleEntryComponentProperties(json, res);
3449    return res;
3450  }
3451
3452  protected void parseBundleEntryComponentProperties(JsonObject json, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3453    parseBackboneElementProperties(json, res);
3454    if (json.has("link")) {
3455      JsonArray array = getJArray(json, "link");
3456      for (int i = 0; i < array.size(); i++) {
3457        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
3458      }
3459    };
3460    if (json.has("fullUrl"))
3461      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3462    if (json.has("_fullUrl"))
3463      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
3464    if (json.has("resource"))
3465      res.setResource(parseResource(getJObject(json, "resource")));
3466    if (json.has("search"))
3467      res.setSearch(parseBundleEntrySearchComponent(getJObject(json, "search")));
3468    if (json.has("request"))
3469      res.setRequest(parseBundleEntryRequestComponent(getJObject(json, "request")));
3470    if (json.has("response"))
3471      res.setResponse(parseBundleEntryResponseComponent(getJObject(json, "response")));
3472  }
3473
3474  protected Bundle.BundleEntrySearchComponent parseBundleEntrySearchComponent(JsonObject json) throws IOException, FHIRFormatError {
3475    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3476    parseBundleEntrySearchComponentProperties(json, res);
3477    return res;
3478  }
3479
3480  protected void parseBundleEntrySearchComponentProperties(JsonObject json, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3481    parseBackboneElementProperties(json, res);
3482    if (json.has("mode"))
3483      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3484    if (json.has("_mode"))
3485      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3486    if (json.has("score"))
3487      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3488    if (json.has("_score"))
3489      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
3490  }
3491
3492  protected Bundle.BundleEntryRequestComponent parseBundleEntryRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
3493    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3494    parseBundleEntryRequestComponentProperties(json, res);
3495    return res;
3496  }
3497
3498  protected void parseBundleEntryRequestComponentProperties(JsonObject json, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3499    parseBackboneElementProperties(json, res);
3500    if (json.has("method"))
3501      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3502    if (json.has("_method"))
3503      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
3504    if (json.has("url"))
3505      res.setUrlElement(parseUri(json.get("url").getAsString()));
3506    if (json.has("_url"))
3507      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3508    if (json.has("ifNoneMatch"))
3509      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3510    if (json.has("_ifNoneMatch"))
3511      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
3512    if (json.has("ifModifiedSince"))
3513      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3514    if (json.has("_ifModifiedSince"))
3515      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
3516    if (json.has("ifMatch"))
3517      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3518    if (json.has("_ifMatch"))
3519      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
3520    if (json.has("ifNoneExist"))
3521      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3522    if (json.has("_ifNoneExist"))
3523      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
3524  }
3525
3526  protected Bundle.BundleEntryResponseComponent parseBundleEntryResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
3527    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3528    parseBundleEntryResponseComponentProperties(json, res);
3529    return res;
3530  }
3531
3532  protected void parseBundleEntryResponseComponentProperties(JsonObject json, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3533    parseBackboneElementProperties(json, res);
3534    if (json.has("status"))
3535      res.setStatusElement(parseString(json.get("status").getAsString()));
3536    if (json.has("_status"))
3537      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3538    if (json.has("location"))
3539      res.setLocationElement(parseUri(json.get("location").getAsString()));
3540    if (json.has("_location"))
3541      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
3542    if (json.has("etag"))
3543      res.setEtagElement(parseString(json.get("etag").getAsString()));
3544    if (json.has("_etag"))
3545      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
3546    if (json.has("lastModified"))
3547      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3548    if (json.has("_lastModified"))
3549      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
3550    if (json.has("outcome"))
3551      res.setOutcome(parseResource(getJObject(json, "outcome")));
3552  }
3553
3554  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3555    CapabilityStatement res = new CapabilityStatement();
3556    parseCapabilityStatementProperties(json, res);
3557    return res;
3558  }
3559
3560  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3561    parseDomainResourceProperties(json, res);
3562    if (json.has("url"))
3563      res.setUrlElement(parseUri(json.get("url").getAsString()));
3564    if (json.has("_url"))
3565      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3566    if (json.has("version"))
3567      res.setVersionElement(parseString(json.get("version").getAsString()));
3568    if (json.has("_version"))
3569      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3570    if (json.has("name"))
3571      res.setNameElement(parseString(json.get("name").getAsString()));
3572    if (json.has("_name"))
3573      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3574    if (json.has("title"))
3575      res.setTitleElement(parseString(json.get("title").getAsString()));
3576    if (json.has("_title"))
3577      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3578    if (json.has("status"))
3579      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3580    if (json.has("_status"))
3581      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3582    if (json.has("experimental"))
3583      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3584    if (json.has("_experimental"))
3585      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
3586    if (json.has("date"))
3587      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3588    if (json.has("_date"))
3589      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3590    if (json.has("publisher"))
3591      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3592    if (json.has("_publisher"))
3593      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
3594    if (json.has("contact")) {
3595      JsonArray array = getJArray(json, "contact");
3596      for (int i = 0; i < array.size(); i++) {
3597        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3598      }
3599    };
3600    if (json.has("description"))
3601      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3602    if (json.has("_description"))
3603      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3604    if (json.has("useContext")) {
3605      JsonArray array = getJArray(json, "useContext");
3606      for (int i = 0; i < array.size(); i++) {
3607        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3608      }
3609    };
3610    if (json.has("jurisdiction")) {
3611      JsonArray array = getJArray(json, "jurisdiction");
3612      for (int i = 0; i < array.size(); i++) {
3613        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3614      }
3615    };
3616    if (json.has("purpose"))
3617      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3618    if (json.has("_purpose"))
3619      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
3620    if (json.has("copyright"))
3621      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3622    if (json.has("_copyright"))
3623      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3624    if (json.has("kind"))
3625      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
3626    if (json.has("_kind"))
3627      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
3628    if (json.has("instantiates")) {
3629      JsonArray array = getJArray(json, "instantiates");
3630      for (int i = 0; i < array.size(); i++) {
3631        if (array.get(i).isJsonNull()) {
3632          res.getInstantiates().add(new CanonicalType());
3633        } else {;
3634          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3635        }
3636      }
3637    };
3638    if (json.has("_instantiates")) {
3639      JsonArray array = getJArray(json, "_instantiates");
3640      for (int i = 0; i < array.size(); i++) {
3641        if (i == res.getInstantiates().size())
3642          res.getInstantiates().add(parseCanonical(null));
3643        if (array.get(i) instanceof JsonObject) 
3644          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3645      }
3646    };
3647    if (json.has("imports")) {
3648      JsonArray array = getJArray(json, "imports");
3649      for (int i = 0; i < array.size(); i++) {
3650        if (array.get(i).isJsonNull()) {
3651          res.getImports().add(new CanonicalType());
3652        } else {;
3653          res.getImports().add(parseCanonical(array.get(i).getAsString()));
3654        }
3655      }
3656    };
3657    if (json.has("_imports")) {
3658      JsonArray array = getJArray(json, "_imports");
3659      for (int i = 0; i < array.size(); i++) {
3660        if (i == res.getImports().size())
3661          res.getImports().add(parseCanonical(null));
3662        if (array.get(i) instanceof JsonObject) 
3663          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3664      }
3665    };
3666    if (json.has("software"))
3667      res.setSoftware(parseCapabilityStatementSoftwareComponent(getJObject(json, "software")));
3668    if (json.has("implementation"))
3669      res.setImplementation(parseCapabilityStatementImplementationComponent(getJObject(json, "implementation")));
3670    if (json.has("fhirVersion"))
3671      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
3672    if (json.has("_fhirVersion"))
3673      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
3674    if (json.has("format")) {
3675      JsonArray array = getJArray(json, "format");
3676      for (int i = 0; i < array.size(); i++) {
3677        if (array.get(i).isJsonNull()) {
3678          res.getFormat().add(new CodeType());
3679        } else {;
3680          res.getFormat().add(parseCode(array.get(i).getAsString()));
3681        }
3682      }
3683    };
3684    if (json.has("_format")) {
3685      JsonArray array = getJArray(json, "_format");
3686      for (int i = 0; i < array.size(); i++) {
3687        if (i == res.getFormat().size())
3688          res.getFormat().add(parseCode(null));
3689        if (array.get(i) instanceof JsonObject) 
3690          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3691      }
3692    };
3693    if (json.has("patchFormat")) {
3694      JsonArray array = getJArray(json, "patchFormat");
3695      for (int i = 0; i < array.size(); i++) {
3696        if (array.get(i).isJsonNull()) {
3697          res.getPatchFormat().add(new CodeType());
3698        } else {;
3699          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3700        }
3701      }
3702    };
3703    if (json.has("_patchFormat")) {
3704      JsonArray array = getJArray(json, "_patchFormat");
3705      for (int i = 0; i < array.size(); i++) {
3706        if (i == res.getPatchFormat().size())
3707          res.getPatchFormat().add(parseCode(null));
3708        if (array.get(i) instanceof JsonObject) 
3709          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3710      }
3711    };
3712    if (json.has("implementationGuide")) {
3713      JsonArray array = getJArray(json, "implementationGuide");
3714      for (int i = 0; i < array.size(); i++) {
3715        if (array.get(i).isJsonNull()) {
3716          res.getImplementationGuide().add(new CanonicalType());
3717        } else {;
3718          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3719        }
3720      }
3721    };
3722    if (json.has("_implementationGuide")) {
3723      JsonArray array = getJArray(json, "_implementationGuide");
3724      for (int i = 0; i < array.size(); i++) {
3725        if (i == res.getImplementationGuide().size())
3726          res.getImplementationGuide().add(parseCanonical(null));
3727        if (array.get(i) instanceof JsonObject) 
3728          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3729      }
3730    };
3731    if (json.has("rest")) {
3732      JsonArray array = getJArray(json, "rest");
3733      for (int i = 0; i < array.size(); i++) {
3734        res.getRest().add(parseCapabilityStatementRestComponent(array.get(i).getAsJsonObject()));
3735      }
3736    };
3737    if (json.has("messaging")) {
3738      JsonArray array = getJArray(json, "messaging");
3739      for (int i = 0; i < array.size(); i++) {
3740        res.getMessaging().add(parseCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject()));
3741      }
3742    };
3743    if (json.has("document")) {
3744      JsonArray array = getJArray(json, "document");
3745      for (int i = 0; i < array.size(); i++) {
3746        res.getDocument().add(parseCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject()));
3747      }
3748    };
3749  }
3750
3751  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
3752    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3753    parseCapabilityStatementSoftwareComponentProperties(json, res);
3754    return res;
3755  }
3756
3757  protected void parseCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3758    parseBackboneElementProperties(json, res);
3759    if (json.has("name"))
3760      res.setNameElement(parseString(json.get("name").getAsString()));
3761    if (json.has("_name"))
3762      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3763    if (json.has("version"))
3764      res.setVersionElement(parseString(json.get("version").getAsString()));
3765    if (json.has("_version"))
3766      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3767    if (json.has("releaseDate"))
3768      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3769    if (json.has("_releaseDate"))
3770      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
3771  }
3772
3773  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
3774    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3775    parseCapabilityStatementImplementationComponentProperties(json, res);
3776    return res;
3777  }
3778
3779  protected void parseCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3780    parseBackboneElementProperties(json, res);
3781    if (json.has("description"))
3782      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3783    if (json.has("_description"))
3784      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3785    if (json.has("url"))
3786      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3787    if (json.has("_url"))
3788      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3789    if (json.has("custodian"))
3790      res.setCustodian(parseReference(getJObject(json, "custodian")));
3791  }
3792
3793  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementRestComponent(JsonObject json) throws IOException, FHIRFormatError {
3794    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3795    parseCapabilityStatementRestComponentProperties(json, res);
3796    return res;
3797  }
3798
3799  protected void parseCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3800    parseBackboneElementProperties(json, res);
3801    if (json.has("mode"))
3802      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3803    if (json.has("_mode"))
3804      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3805    if (json.has("documentation"))
3806      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3807    if (json.has("_documentation"))
3808      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3809    if (json.has("security"))
3810      res.setSecurity(parseCapabilityStatementRestSecurityComponent(getJObject(json, "security")));
3811    if (json.has("resource")) {
3812      JsonArray array = getJArray(json, "resource");
3813      for (int i = 0; i < array.size(); i++) {
3814        res.getResource().add(parseCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject()));
3815      }
3816    };
3817    if (json.has("interaction")) {
3818      JsonArray array = getJArray(json, "interaction");
3819      for (int i = 0; i < array.size(); i++) {
3820        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject()));
3821      }
3822    };
3823    if (json.has("searchParam")) {
3824      JsonArray array = getJArray(json, "searchParam");
3825      for (int i = 0; i < array.size(); i++) {
3826        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
3827      }
3828    };
3829    if (json.has("operation")) {
3830      JsonArray array = getJArray(json, "operation");
3831      for (int i = 0; i < array.size(); i++) {
3832        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
3833      }
3834    };
3835    if (json.has("compartment")) {
3836      JsonArray array = getJArray(json, "compartment");
3837      for (int i = 0; i < array.size(); i++) {
3838        if (array.get(i).isJsonNull()) {
3839          res.getCompartment().add(new CanonicalType());
3840        } else {;
3841          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
3842        }
3843      }
3844    };
3845    if (json.has("_compartment")) {
3846      JsonArray array = getJArray(json, "_compartment");
3847      for (int i = 0; i < array.size(); i++) {
3848        if (i == res.getCompartment().size())
3849          res.getCompartment().add(parseCanonical(null));
3850        if (array.get(i) instanceof JsonObject) 
3851          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3852      }
3853    };
3854  }
3855
3856  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementRestSecurityComponent(JsonObject json) throws IOException, FHIRFormatError {
3857    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3858    parseCapabilityStatementRestSecurityComponentProperties(json, res);
3859    return res;
3860  }
3861
3862  protected void parseCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3863    parseBackboneElementProperties(json, res);
3864    if (json.has("cors"))
3865      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3866    if (json.has("_cors"))
3867      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
3868    if (json.has("service")) {
3869      JsonArray array = getJArray(json, "service");
3870      for (int i = 0; i < array.size(); i++) {
3871        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3872      }
3873    };
3874    if (json.has("description"))
3875      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3876    if (json.has("_description"))
3877      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3878  }
3879
3880  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementRestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
3881    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3882    parseCapabilityStatementRestResourceComponentProperties(json, res);
3883    return res;
3884  }
3885
3886  protected void parseCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3887    parseBackboneElementProperties(json, res);
3888    if (json.has("type"))
3889      res.setTypeElement(parseCode(json.get("type").getAsString()));
3890    if (json.has("_type"))
3891      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3892    if (json.has("profile"))
3893      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3894    if (json.has("_profile"))
3895      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
3896    if (json.has("supportedProfile")) {
3897      JsonArray array = getJArray(json, "supportedProfile");
3898      for (int i = 0; i < array.size(); i++) {
3899        if (array.get(i).isJsonNull()) {
3900          res.getSupportedProfile().add(new CanonicalType());
3901        } else {;
3902          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
3903        }
3904      }
3905    };
3906    if (json.has("_supportedProfile")) {
3907      JsonArray array = getJArray(json, "_supportedProfile");
3908      for (int i = 0; i < array.size(); i++) {
3909        if (i == res.getSupportedProfile().size())
3910          res.getSupportedProfile().add(parseCanonical(null));
3911        if (array.get(i) instanceof JsonObject) 
3912          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
3913      }
3914    };
3915    if (json.has("documentation"))
3916      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3917    if (json.has("_documentation"))
3918      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3919    if (json.has("interaction")) {
3920      JsonArray array = getJArray(json, "interaction");
3921      for (int i = 0; i < array.size(); i++) {
3922        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject()));
3923      }
3924    };
3925    if (json.has("versioning"))
3926      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3927    if (json.has("_versioning"))
3928      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
3929    if (json.has("readHistory"))
3930      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3931    if (json.has("_readHistory"))
3932      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
3933    if (json.has("updateCreate"))
3934      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3935    if (json.has("_updateCreate"))
3936      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
3937    if (json.has("conditionalCreate"))
3938      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3939    if (json.has("_conditionalCreate"))
3940      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
3941    if (json.has("conditionalRead"))
3942      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3943    if (json.has("_conditionalRead"))
3944      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
3945    if (json.has("conditionalUpdate"))
3946      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3947    if (json.has("_conditionalUpdate"))
3948      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
3949    if (json.has("conditionalDelete"))
3950      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3951    if (json.has("_conditionalDelete"))
3952      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
3953    if (json.has("referencePolicy")) {
3954      JsonArray array = getJArray(json, "referencePolicy");
3955      for (int i = 0; i < array.size(); i++) {
3956        if (array.get(i).isJsonNull()) {
3957          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>(new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), CapabilityStatement.ReferenceHandlingPolicy.NULL));
3958        } else {;
3959          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3960        }
3961      }
3962    };
3963    if (json.has("_referencePolicy")) {
3964      JsonArray array = getJArray(json, "_referencePolicy");
3965      for (int i = 0; i < array.size(); i++) {
3966        if (i == res.getReferencePolicy().size())
3967          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3968        if (array.get(i) instanceof JsonObject) 
3969          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3970      }
3971    };
3972    if (json.has("searchInclude")) {
3973      JsonArray array = getJArray(json, "searchInclude");
3974      for (int i = 0; i < array.size(); i++) {
3975        if (array.get(i).isJsonNull()) {
3976          res.getSearchInclude().add(new StringType());
3977        } else {;
3978          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3979        }
3980      }
3981    };
3982    if (json.has("_searchInclude")) {
3983      JsonArray array = getJArray(json, "_searchInclude");
3984      for (int i = 0; i < array.size(); i++) {
3985        if (i == res.getSearchInclude().size())
3986          res.getSearchInclude().add(parseString(null));
3987        if (array.get(i) instanceof JsonObject) 
3988          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3989      }
3990    };
3991    if (json.has("searchRevInclude")) {
3992      JsonArray array = getJArray(json, "searchRevInclude");
3993      for (int i = 0; i < array.size(); i++) {
3994        if (array.get(i).isJsonNull()) {
3995          res.getSearchRevInclude().add(new StringType());
3996        } else {;
3997          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3998        }
3999      }
4000    };
4001    if (json.has("_searchRevInclude")) {
4002      JsonArray array = getJArray(json, "_searchRevInclude");
4003      for (int i = 0; i < array.size(); i++) {
4004        if (i == res.getSearchRevInclude().size())
4005          res.getSearchRevInclude().add(parseString(null));
4006        if (array.get(i) instanceof JsonObject) 
4007          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
4008      }
4009    };
4010    if (json.has("searchParam")) {
4011      JsonArray array = getJArray(json, "searchParam");
4012      for (int i = 0; i < array.size(); i++) {
4013        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4014      }
4015    };
4016    if (json.has("operation")) {
4017      JsonArray array = getJArray(json, "operation");
4018      for (int i = 0; i < array.size(); i++) {
4019        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
4020      }
4021    };
4022  }
4023
4024  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4025    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
4026    parseCapabilityStatementResourceInteractionComponentProperties(json, res);
4027    return res;
4028  }
4029
4030  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4031    parseBackboneElementProperties(json, res);
4032    if (json.has("code"))
4033      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
4034    if (json.has("_code"))
4035      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4036    if (json.has("documentation"))
4037      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4038    if (json.has("_documentation"))
4039      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4040  }
4041
4042  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementRestResourceSearchParamComponent(JsonObject json) throws IOException, FHIRFormatError {
4043    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
4044    parseCapabilityStatementRestResourceSearchParamComponentProperties(json, res);
4045    return res;
4046  }
4047
4048  protected void parseCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4049    parseBackboneElementProperties(json, res);
4050    if (json.has("name"))
4051      res.setNameElement(parseString(json.get("name").getAsString()));
4052    if (json.has("_name"))
4053      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4054    if (json.has("definition"))
4055      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4056    if (json.has("_definition"))
4057      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4058    if (json.has("type"))
4059      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4060    if (json.has("_type"))
4061      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4062    if (json.has("documentation"))
4063      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4064    if (json.has("_documentation"))
4065      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4066  }
4067
4068  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementRestResourceOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
4069    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
4070    parseCapabilityStatementRestResourceOperationComponentProperties(json, res);
4071    return res;
4072  }
4073
4074  protected void parseCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
4075    parseBackboneElementProperties(json, res);
4076    if (json.has("name"))
4077      res.setNameElement(parseString(json.get("name").getAsString()));
4078    if (json.has("_name"))
4079      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4080    if (json.has("definition"))
4081      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4082    if (json.has("_definition"))
4083      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4084    if (json.has("documentation"))
4085      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4086    if (json.has("_documentation"))
4087      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4088  }
4089
4090  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4091    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
4092    parseCapabilityStatementSystemInteractionComponentProperties(json, res);
4093    return res;
4094  }
4095
4096  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4097    parseBackboneElementProperties(json, res);
4098    if (json.has("code"))
4099      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
4100    if (json.has("_code"))
4101      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4102    if (json.has("documentation"))
4103      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4104    if (json.has("_documentation"))
4105      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4106  }
4107
4108  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementMessagingComponent(JsonObject json) throws IOException, FHIRFormatError {
4109    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
4110    parseCapabilityStatementMessagingComponentProperties(json, res);
4111    return res;
4112  }
4113
4114  protected void parseCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
4115    parseBackboneElementProperties(json, res);
4116    if (json.has("endpoint")) {
4117      JsonArray array = getJArray(json, "endpoint");
4118      for (int i = 0; i < array.size(); i++) {
4119        res.getEndpoint().add(parseCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject()));
4120      }
4121    };
4122    if (json.has("reliableCache"))
4123      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
4124    if (json.has("_reliableCache"))
4125      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
4126    if (json.has("documentation"))
4127      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4128    if (json.has("_documentation"))
4129      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4130    if (json.has("supportedMessage")) {
4131      JsonArray array = getJArray(json, "supportedMessage");
4132      for (int i = 0; i < array.size(); i++) {
4133        res.getSupportedMessage().add(parseCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject()));
4134      }
4135    };
4136  }
4137
4138  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementMessagingEndpointComponent(JsonObject json) throws IOException, FHIRFormatError {
4139    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
4140    parseCapabilityStatementMessagingEndpointComponentProperties(json, res);
4141    return res;
4142  }
4143
4144  protected void parseCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
4145    parseBackboneElementProperties(json, res);
4146    if (json.has("protocol"))
4147      res.setProtocol(parseCoding(getJObject(json, "protocol")));
4148    if (json.has("address"))
4149      res.setAddressElement(parseUrl(json.get("address").getAsString()));
4150    if (json.has("_address"))
4151      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
4152  }
4153
4154  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementMessagingSupportedMessageComponent(JsonObject json) throws IOException, FHIRFormatError {
4155    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
4156    parseCapabilityStatementMessagingSupportedMessageComponentProperties(json, res);
4157    return res;
4158  }
4159
4160  protected void parseCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
4161    parseBackboneElementProperties(json, res);
4162    if (json.has("mode"))
4163      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
4164    if (json.has("_mode"))
4165      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4166    if (json.has("definition"))
4167      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4168    if (json.has("_definition"))
4169      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4170  }
4171
4172  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementDocumentComponent(JsonObject json) throws IOException, FHIRFormatError {
4173    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
4174    parseCapabilityStatementDocumentComponentProperties(json, res);
4175    return res;
4176  }
4177
4178  protected void parseCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
4179    parseBackboneElementProperties(json, res);
4180    if (json.has("mode"))
4181      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
4182    if (json.has("_mode"))
4183      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4184    if (json.has("documentation"))
4185      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4186    if (json.has("_documentation"))
4187      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4188    if (json.has("profile"))
4189      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4190    if (json.has("_profile"))
4191      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4192  }
4193
4194  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
4195    CarePlan res = new CarePlan();
4196    parseCarePlanProperties(json, res);
4197    return res;
4198  }
4199
4200  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
4201    parseDomainResourceProperties(json, res);
4202    if (json.has("identifier")) {
4203      JsonArray array = getJArray(json, "identifier");
4204      for (int i = 0; i < array.size(); i++) {
4205        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4206      }
4207    };
4208    if (json.has("instantiatesCanonical")) {
4209      JsonArray array = getJArray(json, "instantiatesCanonical");
4210      for (int i = 0; i < array.size(); i++) {
4211        if (array.get(i).isJsonNull()) {
4212          res.getInstantiatesCanonical().add(new CanonicalType());
4213        } else {;
4214          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4215        }
4216      }
4217    };
4218    if (json.has("_instantiatesCanonical")) {
4219      JsonArray array = getJArray(json, "_instantiatesCanonical");
4220      for (int i = 0; i < array.size(); i++) {
4221        if (i == res.getInstantiatesCanonical().size())
4222          res.getInstantiatesCanonical().add(parseCanonical(null));
4223        if (array.get(i) instanceof JsonObject) 
4224          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4225      }
4226    };
4227    if (json.has("instantiatesUri")) {
4228      JsonArray array = getJArray(json, "instantiatesUri");
4229      for (int i = 0; i < array.size(); i++) {
4230        if (array.get(i).isJsonNull()) {
4231          res.getInstantiatesUri().add(new UriType());
4232        } else {;
4233          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4234        }
4235      }
4236    };
4237    if (json.has("_instantiatesUri")) {
4238      JsonArray array = getJArray(json, "_instantiatesUri");
4239      for (int i = 0; i < array.size(); i++) {
4240        if (i == res.getInstantiatesUri().size())
4241          res.getInstantiatesUri().add(parseUri(null));
4242        if (array.get(i) instanceof JsonObject) 
4243          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4244      }
4245    };
4246    if (json.has("basedOn")) {
4247      JsonArray array = getJArray(json, "basedOn");
4248      for (int i = 0; i < array.size(); i++) {
4249        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4250      }
4251    };
4252    if (json.has("replaces")) {
4253      JsonArray array = getJArray(json, "replaces");
4254      for (int i = 0; i < array.size(); i++) {
4255        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4256      }
4257    };
4258    if (json.has("partOf")) {
4259      JsonArray array = getJArray(json, "partOf");
4260      for (int i = 0; i < array.size(); i++) {
4261        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4262      }
4263    };
4264    if (json.has("status"))
4265      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
4266    if (json.has("_status"))
4267      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4268    if (json.has("intent"))
4269      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4270    if (json.has("_intent"))
4271      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
4272    if (json.has("category")) {
4273      JsonArray array = getJArray(json, "category");
4274      for (int i = 0; i < array.size(); i++) {
4275        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4276      }
4277    };
4278    if (json.has("title"))
4279      res.setTitleElement(parseString(json.get("title").getAsString()));
4280    if (json.has("_title"))
4281      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4282    if (json.has("description"))
4283      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4284    if (json.has("_description"))
4285      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4286    if (json.has("subject"))
4287      res.setSubject(parseReference(getJObject(json, "subject")));
4288    if (json.has("encounter"))
4289      res.setEncounter(parseReference(getJObject(json, "encounter")));
4290    if (json.has("period"))
4291      res.setPeriod(parsePeriod(getJObject(json, "period")));
4292    if (json.has("created"))
4293      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4294    if (json.has("_created"))
4295      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4296    if (json.has("author"))
4297      res.setAuthor(parseReference(getJObject(json, "author")));
4298    if (json.has("contributor")) {
4299      JsonArray array = getJArray(json, "contributor");
4300      for (int i = 0; i < array.size(); i++) {
4301        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4302      }
4303    };
4304    if (json.has("careTeam")) {
4305      JsonArray array = getJArray(json, "careTeam");
4306      for (int i = 0; i < array.size(); i++) {
4307        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4308      }
4309    };
4310    if (json.has("addresses")) {
4311      JsonArray array = getJArray(json, "addresses");
4312      for (int i = 0; i < array.size(); i++) {
4313        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4314      }
4315    };
4316    if (json.has("supportingInfo")) {
4317      JsonArray array = getJArray(json, "supportingInfo");
4318      for (int i = 0; i < array.size(); i++) {
4319        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4320      }
4321    };
4322    if (json.has("goal")) {
4323      JsonArray array = getJArray(json, "goal");
4324      for (int i = 0; i < array.size(); i++) {
4325        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4326      }
4327    };
4328    if (json.has("activity")) {
4329      JsonArray array = getJArray(json, "activity");
4330      for (int i = 0; i < array.size(); i++) {
4331        res.getActivity().add(parseCarePlanActivityComponent(array.get(i).getAsJsonObject()));
4332      }
4333    };
4334    if (json.has("note")) {
4335      JsonArray array = getJArray(json, "note");
4336      for (int i = 0; i < array.size(); i++) {
4337        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4338      }
4339    };
4340  }
4341
4342  protected CarePlan.CarePlanActivityComponent parseCarePlanActivityComponent(JsonObject json) throws IOException, FHIRFormatError {
4343    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4344    parseCarePlanActivityComponentProperties(json, res);
4345    return res;
4346  }
4347
4348  protected void parseCarePlanActivityComponentProperties(JsonObject json, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4349    parseBackboneElementProperties(json, res);
4350    if (json.has("outcomeCodeableConcept")) {
4351      JsonArray array = getJArray(json, "outcomeCodeableConcept");
4352      for (int i = 0; i < array.size(); i++) {
4353        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4354      }
4355    };
4356    if (json.has("outcomeReference")) {
4357      JsonArray array = getJArray(json, "outcomeReference");
4358      for (int i = 0; i < array.size(); i++) {
4359        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4360      }
4361    };
4362    if (json.has("progress")) {
4363      JsonArray array = getJArray(json, "progress");
4364      for (int i = 0; i < array.size(); i++) {
4365        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4366      }
4367    };
4368    if (json.has("reference"))
4369      res.setReference(parseReference(getJObject(json, "reference")));
4370    if (json.has("detail"))
4371      res.setDetail(parseCarePlanActivityDetailComponent(getJObject(json, "detail")));
4372  }
4373
4374  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanActivityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
4375    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4376    parseCarePlanActivityDetailComponentProperties(json, res);
4377    return res;
4378  }
4379
4380  protected void parseCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4381    parseBackboneElementProperties(json, res);
4382    if (json.has("kind"))
4383      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4384    if (json.has("_kind"))
4385      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
4386    if (json.has("instantiatesCanonical")) {
4387      JsonArray array = getJArray(json, "instantiatesCanonical");
4388      for (int i = 0; i < array.size(); i++) {
4389        if (array.get(i).isJsonNull()) {
4390          res.getInstantiatesCanonical().add(new CanonicalType());
4391        } else {;
4392          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4393        }
4394      }
4395    };
4396    if (json.has("_instantiatesCanonical")) {
4397      JsonArray array = getJArray(json, "_instantiatesCanonical");
4398      for (int i = 0; i < array.size(); i++) {
4399        if (i == res.getInstantiatesCanonical().size())
4400          res.getInstantiatesCanonical().add(parseCanonical(null));
4401        if (array.get(i) instanceof JsonObject) 
4402          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4403      }
4404    };
4405    if (json.has("instantiatesUri")) {
4406      JsonArray array = getJArray(json, "instantiatesUri");
4407      for (int i = 0; i < array.size(); i++) {
4408        if (array.get(i).isJsonNull()) {
4409          res.getInstantiatesUri().add(new UriType());
4410        } else {;
4411          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4412        }
4413      }
4414    };
4415    if (json.has("_instantiatesUri")) {
4416      JsonArray array = getJArray(json, "_instantiatesUri");
4417      for (int i = 0; i < array.size(); i++) {
4418        if (i == res.getInstantiatesUri().size())
4419          res.getInstantiatesUri().add(parseUri(null));
4420        if (array.get(i) instanceof JsonObject) 
4421          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4422      }
4423    };
4424    if (json.has("code"))
4425      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4426    if (json.has("reasonCode")) {
4427      JsonArray array = getJArray(json, "reasonCode");
4428      for (int i = 0; i < array.size(); i++) {
4429        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4430      }
4431    };
4432    if (json.has("reasonReference")) {
4433      JsonArray array = getJArray(json, "reasonReference");
4434      for (int i = 0; i < array.size(); i++) {
4435        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4436      }
4437    };
4438    if (json.has("goal")) {
4439      JsonArray array = getJArray(json, "goal");
4440      for (int i = 0; i < array.size(); i++) {
4441        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4442      }
4443    };
4444    if (json.has("status"))
4445      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4446    if (json.has("_status"))
4447      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4448    if (json.has("statusReason"))
4449      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
4450    if (json.has("doNotPerform"))
4451      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4452    if (json.has("_doNotPerform"))
4453      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
4454    DataType scheduled = parseType("scheduled", json);
4455    if (scheduled != null)
4456      res.setScheduled(scheduled);
4457    if (json.has("location"))
4458      res.setLocation(parseReference(getJObject(json, "location")));
4459    if (json.has("performer")) {
4460      JsonArray array = getJArray(json, "performer");
4461      for (int i = 0; i < array.size(); i++) {
4462        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4463      }
4464    };
4465    DataType product = parseType("product", json);
4466    if (product != null)
4467      res.setProduct(product);
4468    if (json.has("dailyAmount"))
4469      res.setDailyAmount(parseQuantity(getJObject(json, "dailyAmount")));
4470    if (json.has("quantity"))
4471      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4472    if (json.has("description"))
4473      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4474    if (json.has("_description"))
4475      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4476  }
4477
4478  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4479    CareTeam res = new CareTeam();
4480    parseCareTeamProperties(json, res);
4481    return res;
4482  }
4483
4484  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4485    parseDomainResourceProperties(json, res);
4486    if (json.has("identifier")) {
4487      JsonArray array = getJArray(json, "identifier");
4488      for (int i = 0; i < array.size(); i++) {
4489        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4490      }
4491    };
4492    if (json.has("status"))
4493      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4494    if (json.has("_status"))
4495      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4496    if (json.has("category")) {
4497      JsonArray array = getJArray(json, "category");
4498      for (int i = 0; i < array.size(); i++) {
4499        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4500      }
4501    };
4502    if (json.has("name"))
4503      res.setNameElement(parseString(json.get("name").getAsString()));
4504    if (json.has("_name"))
4505      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4506    if (json.has("subject"))
4507      res.setSubject(parseReference(getJObject(json, "subject")));
4508    if (json.has("encounter"))
4509      res.setEncounter(parseReference(getJObject(json, "encounter")));
4510    if (json.has("period"))
4511      res.setPeriod(parsePeriod(getJObject(json, "period")));
4512    if (json.has("participant")) {
4513      JsonArray array = getJArray(json, "participant");
4514      for (int i = 0; i < array.size(); i++) {
4515        res.getParticipant().add(parseCareTeamParticipantComponent(array.get(i).getAsJsonObject()));
4516      }
4517    };
4518    if (json.has("reasonCode")) {
4519      JsonArray array = getJArray(json, "reasonCode");
4520      for (int i = 0; i < array.size(); i++) {
4521        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4522      }
4523    };
4524    if (json.has("reasonReference")) {
4525      JsonArray array = getJArray(json, "reasonReference");
4526      for (int i = 0; i < array.size(); i++) {
4527        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4528      }
4529    };
4530    if (json.has("managingOrganization")) {
4531      JsonArray array = getJArray(json, "managingOrganization");
4532      for (int i = 0; i < array.size(); i++) {
4533        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4534      }
4535    };
4536    if (json.has("telecom")) {
4537      JsonArray array = getJArray(json, "telecom");
4538      for (int i = 0; i < array.size(); i++) {
4539        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4540      }
4541    };
4542    if (json.has("note")) {
4543      JsonArray array = getJArray(json, "note");
4544      for (int i = 0; i < array.size(); i++) {
4545        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4546      }
4547    };
4548  }
4549
4550  protected CareTeam.CareTeamParticipantComponent parseCareTeamParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
4551    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4552    parseCareTeamParticipantComponentProperties(json, res);
4553    return res;
4554  }
4555
4556  protected void parseCareTeamParticipantComponentProperties(JsonObject json, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4557    parseBackboneElementProperties(json, res);
4558    if (json.has("role")) {
4559      JsonArray array = getJArray(json, "role");
4560      for (int i = 0; i < array.size(); i++) {
4561        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4562      }
4563    };
4564    if (json.has("member"))
4565      res.setMember(parseReference(getJObject(json, "member")));
4566    if (json.has("onBehalfOf"))
4567      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
4568    if (json.has("period"))
4569      res.setPeriod(parsePeriod(getJObject(json, "period")));
4570  }
4571
4572  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
4573    CatalogEntry res = new CatalogEntry();
4574    parseCatalogEntryProperties(json, res);
4575    return res;
4576  }
4577
4578  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
4579    parseDomainResourceProperties(json, res);
4580    if (json.has("identifier")) {
4581      JsonArray array = getJArray(json, "identifier");
4582      for (int i = 0; i < array.size(); i++) {
4583        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4584      }
4585    };
4586    if (json.has("type"))
4587      res.setType(parseCodeableConcept(getJObject(json, "type")));
4588    if (json.has("orderable"))
4589      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
4590    if (json.has("_orderable"))
4591      parseElementProperties(getJObject(json, "_orderable"), res.getOrderableElement());
4592    if (json.has("referencedItem"))
4593      res.setReferencedItem(parseReference(getJObject(json, "referencedItem")));
4594    if (json.has("additionalIdentifier")) {
4595      JsonArray array = getJArray(json, "additionalIdentifier");
4596      for (int i = 0; i < array.size(); i++) {
4597        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4598      }
4599    };
4600    if (json.has("classification")) {
4601      JsonArray array = getJArray(json, "classification");
4602      for (int i = 0; i < array.size(); i++) {
4603        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4604      }
4605    };
4606    if (json.has("status"))
4607      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4608    if (json.has("_status"))
4609      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4610    if (json.has("validityPeriod"))
4611      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
4612    if (json.has("validTo"))
4613      res.setValidToElement(parseDateTime(json.get("validTo").getAsString()));
4614    if (json.has("_validTo"))
4615      parseElementProperties(getJObject(json, "_validTo"), res.getValidToElement());
4616    if (json.has("lastUpdated"))
4617      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
4618    if (json.has("_lastUpdated"))
4619      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
4620    if (json.has("additionalCharacteristic")) {
4621      JsonArray array = getJArray(json, "additionalCharacteristic");
4622      for (int i = 0; i < array.size(); i++) {
4623        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4624      }
4625    };
4626    if (json.has("additionalClassification")) {
4627      JsonArray array = getJArray(json, "additionalClassification");
4628      for (int i = 0; i < array.size(); i++) {
4629        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4630      }
4631    };
4632    if (json.has("relatedEntry")) {
4633      JsonArray array = getJArray(json, "relatedEntry");
4634      for (int i = 0; i < array.size(); i++) {
4635        res.getRelatedEntry().add(parseCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject()));
4636      }
4637    };
4638  }
4639
4640  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryRelatedEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
4641    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
4642    parseCatalogEntryRelatedEntryComponentProperties(json, res);
4643    return res;
4644  }
4645
4646  protected void parseCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
4647    parseBackboneElementProperties(json, res);
4648    if (json.has("relationtype"))
4649      res.setRelationtypeElement(parseEnumeration(json.get("relationtype").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
4650    if (json.has("_relationtype"))
4651      parseElementProperties(getJObject(json, "_relationtype"), res.getRelationtypeElement());
4652    if (json.has("item"))
4653      res.setItem(parseReference(getJObject(json, "item")));
4654  }
4655
4656  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
4657    ChargeItem res = new ChargeItem();
4658    parseChargeItemProperties(json, res);
4659    return res;
4660  }
4661
4662  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
4663    parseDomainResourceProperties(json, res);
4664    if (json.has("identifier")) {
4665      JsonArray array = getJArray(json, "identifier");
4666      for (int i = 0; i < array.size(); i++) {
4667        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4668      }
4669    };
4670    if (json.has("definitionUri")) {
4671      JsonArray array = getJArray(json, "definitionUri");
4672      for (int i = 0; i < array.size(); i++) {
4673        if (array.get(i).isJsonNull()) {
4674          res.getDefinitionUri().add(new UriType());
4675        } else {;
4676          res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
4677        }
4678      }
4679    };
4680    if (json.has("_definitionUri")) {
4681      JsonArray array = getJArray(json, "_definitionUri");
4682      for (int i = 0; i < array.size(); i++) {
4683        if (i == res.getDefinitionUri().size())
4684          res.getDefinitionUri().add(parseUri(null));
4685        if (array.get(i) instanceof JsonObject) 
4686          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
4687      }
4688    };
4689    if (json.has("definitionCanonical")) {
4690      JsonArray array = getJArray(json, "definitionCanonical");
4691      for (int i = 0; i < array.size(); i++) {
4692        if (array.get(i).isJsonNull()) {
4693          res.getDefinitionCanonical().add(new CanonicalType());
4694        } else {;
4695          res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
4696        }
4697      }
4698    };
4699    if (json.has("_definitionCanonical")) {
4700      JsonArray array = getJArray(json, "_definitionCanonical");
4701      for (int i = 0; i < array.size(); i++) {
4702        if (i == res.getDefinitionCanonical().size())
4703          res.getDefinitionCanonical().add(parseCanonical(null));
4704        if (array.get(i) instanceof JsonObject) 
4705          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
4706      }
4707    };
4708    if (json.has("status"))
4709      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
4710    if (json.has("_status"))
4711      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4712    if (json.has("partOf")) {
4713      JsonArray array = getJArray(json, "partOf");
4714      for (int i = 0; i < array.size(); i++) {
4715        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4716      }
4717    };
4718    if (json.has("code"))
4719      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4720    if (json.has("subject"))
4721      res.setSubject(parseReference(getJObject(json, "subject")));
4722    if (json.has("context"))
4723      res.setContext(parseReference(getJObject(json, "context")));
4724    DataType occurrence = parseType("occurrence", json);
4725    if (occurrence != null)
4726      res.setOccurrence(occurrence);
4727    if (json.has("performer")) {
4728      JsonArray array = getJArray(json, "performer");
4729      for (int i = 0; i < array.size(); i++) {
4730        res.getPerformer().add(parseChargeItemPerformerComponent(array.get(i).getAsJsonObject()));
4731      }
4732    };
4733    if (json.has("performingOrganization"))
4734      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
4735    if (json.has("requestingOrganization"))
4736      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
4737    if (json.has("costCenter"))
4738      res.setCostCenter(parseReference(getJObject(json, "costCenter")));
4739    if (json.has("quantity"))
4740      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4741    if (json.has("bodysite")) {
4742      JsonArray array = getJArray(json, "bodysite");
4743      for (int i = 0; i < array.size(); i++) {
4744        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4745      }
4746    };
4747    if (json.has("factorOverride"))
4748      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
4749    if (json.has("_factorOverride"))
4750      parseElementProperties(getJObject(json, "_factorOverride"), res.getFactorOverrideElement());
4751    if (json.has("priceOverride"))
4752      res.setPriceOverride(parseMoney(getJObject(json, "priceOverride")));
4753    if (json.has("overrideReason"))
4754      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
4755    if (json.has("_overrideReason"))
4756      parseElementProperties(getJObject(json, "_overrideReason"), res.getOverrideReasonElement());
4757    if (json.has("enterer"))
4758      res.setEnterer(parseReference(getJObject(json, "enterer")));
4759    if (json.has("enteredDate"))
4760      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
4761    if (json.has("_enteredDate"))
4762      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
4763    if (json.has("reason")) {
4764      JsonArray array = getJArray(json, "reason");
4765      for (int i = 0; i < array.size(); i++) {
4766        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4767      }
4768    };
4769    if (json.has("service")) {
4770      JsonArray array = getJArray(json, "service");
4771      for (int i = 0; i < array.size(); i++) {
4772        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
4773      }
4774    };
4775    DataType product = parseType("product", json);
4776    if (product != null)
4777      res.setProduct(product);
4778    if (json.has("account")) {
4779      JsonArray array = getJArray(json, "account");
4780      for (int i = 0; i < array.size(); i++) {
4781        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
4782      }
4783    };
4784    if (json.has("note")) {
4785      JsonArray array = getJArray(json, "note");
4786      for (int i = 0; i < array.size(); i++) {
4787        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4788      }
4789    };
4790    if (json.has("supportingInformation")) {
4791      JsonArray array = getJArray(json, "supportingInformation");
4792      for (int i = 0; i < array.size(); i++) {
4793        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4794      }
4795    };
4796  }
4797
4798  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
4799    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
4800    parseChargeItemPerformerComponentProperties(json, res);
4801    return res;
4802  }
4803
4804  protected void parseChargeItemPerformerComponentProperties(JsonObject json, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
4805    parseBackboneElementProperties(json, res);
4806    if (json.has("function"))
4807      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
4808    if (json.has("actor"))
4809      res.setActor(parseReference(getJObject(json, "actor")));
4810  }
4811
4812  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
4813    ChargeItemDefinition res = new ChargeItemDefinition();
4814    parseChargeItemDefinitionProperties(json, res);
4815    return res;
4816  }
4817
4818  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
4819    parseDomainResourceProperties(json, res);
4820    if (json.has("url"))
4821      res.setUrlElement(parseUri(json.get("url").getAsString()));
4822    if (json.has("_url"))
4823      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4824    if (json.has("identifier")) {
4825      JsonArray array = getJArray(json, "identifier");
4826      for (int i = 0; i < array.size(); i++) {
4827        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4828      }
4829    };
4830    if (json.has("version"))
4831      res.setVersionElement(parseString(json.get("version").getAsString()));
4832    if (json.has("_version"))
4833      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4834    if (json.has("title"))
4835      res.setTitleElement(parseString(json.get("title").getAsString()));
4836    if (json.has("_title"))
4837      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4838    if (json.has("derivedFromUri")) {
4839      JsonArray array = getJArray(json, "derivedFromUri");
4840      for (int i = 0; i < array.size(); i++) {
4841        if (array.get(i).isJsonNull()) {
4842          res.getDerivedFromUri().add(new UriType());
4843        } else {;
4844          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
4845        }
4846      }
4847    };
4848    if (json.has("_derivedFromUri")) {
4849      JsonArray array = getJArray(json, "_derivedFromUri");
4850      for (int i = 0; i < array.size(); i++) {
4851        if (i == res.getDerivedFromUri().size())
4852          res.getDerivedFromUri().add(parseUri(null));
4853        if (array.get(i) instanceof JsonObject) 
4854          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
4855      }
4856    };
4857    if (json.has("partOf")) {
4858      JsonArray array = getJArray(json, "partOf");
4859      for (int i = 0; i < array.size(); i++) {
4860        if (array.get(i).isJsonNull()) {
4861          res.getPartOf().add(new CanonicalType());
4862        } else {;
4863          res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
4864        }
4865      }
4866    };
4867    if (json.has("_partOf")) {
4868      JsonArray array = getJArray(json, "_partOf");
4869      for (int i = 0; i < array.size(); i++) {
4870        if (i == res.getPartOf().size())
4871          res.getPartOf().add(parseCanonical(null));
4872        if (array.get(i) instanceof JsonObject) 
4873          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
4874      }
4875    };
4876    if (json.has("replaces")) {
4877      JsonArray array = getJArray(json, "replaces");
4878      for (int i = 0; i < array.size(); i++) {
4879        if (array.get(i).isJsonNull()) {
4880          res.getReplaces().add(new CanonicalType());
4881        } else {;
4882          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
4883        }
4884      }
4885    };
4886    if (json.has("_replaces")) {
4887      JsonArray array = getJArray(json, "_replaces");
4888      for (int i = 0; i < array.size(); i++) {
4889        if (i == res.getReplaces().size())
4890          res.getReplaces().add(parseCanonical(null));
4891        if (array.get(i) instanceof JsonObject) 
4892          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
4893      }
4894    };
4895    if (json.has("status"))
4896      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4897    if (json.has("_status"))
4898      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4899    if (json.has("experimental"))
4900      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4901    if (json.has("_experimental"))
4902      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
4903    if (json.has("date"))
4904      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4905    if (json.has("_date"))
4906      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4907    if (json.has("publisher"))
4908      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4909    if (json.has("_publisher"))
4910      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
4911    if (json.has("contact")) {
4912      JsonArray array = getJArray(json, "contact");
4913      for (int i = 0; i < array.size(); i++) {
4914        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4915      }
4916    };
4917    if (json.has("description"))
4918      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4919    if (json.has("_description"))
4920      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4921    if (json.has("useContext")) {
4922      JsonArray array = getJArray(json, "useContext");
4923      for (int i = 0; i < array.size(); i++) {
4924        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4925      }
4926    };
4927    if (json.has("jurisdiction")) {
4928      JsonArray array = getJArray(json, "jurisdiction");
4929      for (int i = 0; i < array.size(); i++) {
4930        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4931      }
4932    };
4933    if (json.has("copyright"))
4934      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4935    if (json.has("_copyright"))
4936      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
4937    if (json.has("approvalDate"))
4938      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
4939    if (json.has("_approvalDate"))
4940      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
4941    if (json.has("lastReviewDate"))
4942      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
4943    if (json.has("_lastReviewDate"))
4944      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
4945    if (json.has("effectivePeriod"))
4946      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
4947    if (json.has("code"))
4948      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4949    if (json.has("instance")) {
4950      JsonArray array = getJArray(json, "instance");
4951      for (int i = 0; i < array.size(); i++) {
4952        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
4953      }
4954    };
4955    if (json.has("applicability")) {
4956      JsonArray array = getJArray(json, "applicability");
4957      for (int i = 0; i < array.size(); i++) {
4958        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
4959      }
4960    };
4961    if (json.has("propertyGroup")) {
4962      JsonArray array = getJArray(json, "propertyGroup");
4963      for (int i = 0; i < array.size(); i++) {
4964        res.getPropertyGroup().add(parseChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject()));
4965      }
4966    };
4967  }
4968
4969  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionApplicabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
4970    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
4971    parseChargeItemDefinitionApplicabilityComponentProperties(json, res);
4972    return res;
4973  }
4974
4975  protected void parseChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
4976    parseBackboneElementProperties(json, res);
4977    if (json.has("description"))
4978      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4979    if (json.has("_description"))
4980      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4981    if (json.has("language"))
4982      res.setLanguageElement(parseString(json.get("language").getAsString()));
4983    if (json.has("_language"))
4984      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
4985    if (json.has("expression"))
4986      res.setExpressionElement(parseString(json.get("expression").getAsString()));
4987    if (json.has("_expression"))
4988      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
4989  }
4990
4991  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionPropertyGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
4992    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
4993    parseChargeItemDefinitionPropertyGroupComponentProperties(json, res);
4994    return res;
4995  }
4996
4997  protected void parseChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
4998    parseBackboneElementProperties(json, res);
4999    if (json.has("applicability")) {
5000      JsonArray array = getJArray(json, "applicability");
5001      for (int i = 0; i < array.size(); i++) {
5002        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5003      }
5004    };
5005    if (json.has("priceComponent")) {
5006      JsonArray array = getJArray(json, "priceComponent");
5007      for (int i = 0; i < array.size(); i++) {
5008        res.getPriceComponent().add(parseChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject()));
5009      }
5010    };
5011  }
5012
5013  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
5014    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
5015    parseChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, res);
5016    return res;
5017  }
5018
5019  protected void parseChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
5020    parseBackboneElementProperties(json, res);
5021    if (json.has("type"))
5022      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.InvoicePriceComponentType.NULL, new Enumerations.InvoicePriceComponentTypeEnumFactory()));
5023    if (json.has("_type"))
5024      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5025    if (json.has("code"))
5026      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5027    if (json.has("factor"))
5028      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5029    if (json.has("_factor"))
5030      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5031    if (json.has("amount"))
5032      res.setAmount(parseMoney(getJObject(json, "amount")));
5033  }
5034
5035  protected Citation parseCitation(JsonObject json) throws IOException, FHIRFormatError {
5036    Citation res = new Citation();
5037    parseCitationProperties(json, res);
5038    return res;
5039  }
5040
5041  protected void parseCitationProperties(JsonObject json, Citation res) throws IOException, FHIRFormatError {
5042    parseDomainResourceProperties(json, res);
5043    if (json.has("url"))
5044      res.setUrlElement(parseUri(json.get("url").getAsString()));
5045    if (json.has("_url"))
5046      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5047    if (json.has("identifier")) {
5048      JsonArray array = getJArray(json, "identifier");
5049      for (int i = 0; i < array.size(); i++) {
5050        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5051      }
5052    };
5053    if (json.has("version"))
5054      res.setVersionElement(parseString(json.get("version").getAsString()));
5055    if (json.has("_version"))
5056      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5057    if (json.has("name"))
5058      res.setNameElement(parseString(json.get("name").getAsString()));
5059    if (json.has("_name"))
5060      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5061    if (json.has("title"))
5062      res.setTitleElement(parseString(json.get("title").getAsString()));
5063    if (json.has("_title"))
5064      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5065    if (json.has("status"))
5066      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5067    if (json.has("_status"))
5068      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5069    if (json.has("experimental"))
5070      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5071    if (json.has("_experimental"))
5072      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5073    if (json.has("date"))
5074      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5075    if (json.has("_date"))
5076      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5077    if (json.has("publisher"))
5078      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5079    if (json.has("_publisher"))
5080      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5081    if (json.has("contact")) {
5082      JsonArray array = getJArray(json, "contact");
5083      for (int i = 0; i < array.size(); i++) {
5084        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5085      }
5086    };
5087    if (json.has("description"))
5088      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5089    if (json.has("_description"))
5090      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5091    if (json.has("useContext")) {
5092      JsonArray array = getJArray(json, "useContext");
5093      for (int i = 0; i < array.size(); i++) {
5094        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5095      }
5096    };
5097    if (json.has("jurisdiction")) {
5098      JsonArray array = getJArray(json, "jurisdiction");
5099      for (int i = 0; i < array.size(); i++) {
5100        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5101      }
5102    };
5103    if (json.has("purpose"))
5104      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5105    if (json.has("_purpose"))
5106      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5107    if (json.has("copyright"))
5108      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5109    if (json.has("_copyright"))
5110      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5111    if (json.has("approvalDate"))
5112      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5113    if (json.has("_approvalDate"))
5114      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
5115    if (json.has("lastReviewDate"))
5116      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5117    if (json.has("_lastReviewDate"))
5118      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
5119    if (json.has("effectivePeriod"))
5120      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
5121    if (json.has("author")) {
5122      JsonArray array = getJArray(json, "author");
5123      for (int i = 0; i < array.size(); i++) {
5124        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
5125      }
5126    };
5127    if (json.has("editor")) {
5128      JsonArray array = getJArray(json, "editor");
5129      for (int i = 0; i < array.size(); i++) {
5130        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
5131      }
5132    };
5133    if (json.has("reviewer")) {
5134      JsonArray array = getJArray(json, "reviewer");
5135      for (int i = 0; i < array.size(); i++) {
5136        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
5137      }
5138    };
5139    if (json.has("endorser")) {
5140      JsonArray array = getJArray(json, "endorser");
5141      for (int i = 0; i < array.size(); i++) {
5142        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
5143      }
5144    };
5145    if (json.has("summary")) {
5146      JsonArray array = getJArray(json, "summary");
5147      for (int i = 0; i < array.size(); i++) {
5148        res.getSummary().add(parseContactDetail(array.get(i).getAsJsonObject()));
5149      }
5150    };
5151    if (json.has("classification")) {
5152      JsonArray array = getJArray(json, "classification");
5153      for (int i = 0; i < array.size(); i++) {
5154        res.getClassification().add(parseCitationClassificationComponent(array.get(i).getAsJsonObject()));
5155      }
5156    };
5157    if (json.has("note")) {
5158      JsonArray array = getJArray(json, "note");
5159      for (int i = 0; i < array.size(); i++) {
5160        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5161      }
5162    };
5163    if (json.has("currentState")) {
5164      JsonArray array = getJArray(json, "currentState");
5165      for (int i = 0; i < array.size(); i++) {
5166        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5167      }
5168    };
5169    if (json.has("statusDate")) {
5170      JsonArray array = getJArray(json, "statusDate");
5171      for (int i = 0; i < array.size(); i++) {
5172        res.getStatusDate().add(parseCitationStatusDateComponent(array.get(i).getAsJsonObject()));
5173      }
5174    };
5175    if (json.has("relatesTo")) {
5176      JsonArray array = getJArray(json, "relatesTo");
5177      for (int i = 0; i < array.size(); i++) {
5178        res.getRelatesTo().add(parseCitationRelatesToComponent(array.get(i).getAsJsonObject()));
5179      }
5180    };
5181    if (json.has("citedArtifact"))
5182      res.setCitedArtifact(parseCitationCitedArtifactComponent(getJObject(json, "citedArtifact")));
5183  }
5184
5185  protected Citation.CitationClassificationComponent parseCitationClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
5186    Citation.CitationClassificationComponent res = new Citation.CitationClassificationComponent();
5187    parseCitationClassificationComponentProperties(json, res);
5188    return res;
5189  }
5190
5191  protected void parseCitationClassificationComponentProperties(JsonObject json, Citation.CitationClassificationComponent res) throws IOException, FHIRFormatError {
5192    parseBackboneElementProperties(json, res);
5193    if (json.has("type"))
5194      res.setType(parseCodeableConcept(getJObject(json, "type")));
5195    if (json.has("classifier")) {
5196      JsonArray array = getJArray(json, "classifier");
5197      for (int i = 0; i < array.size(); i++) {
5198        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5199      }
5200    };
5201  }
5202
5203  protected Citation.CitationStatusDateComponent parseCitationStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
5204    Citation.CitationStatusDateComponent res = new Citation.CitationStatusDateComponent();
5205    parseCitationStatusDateComponentProperties(json, res);
5206    return res;
5207  }
5208
5209  protected void parseCitationStatusDateComponentProperties(JsonObject json, Citation.CitationStatusDateComponent res) throws IOException, FHIRFormatError {
5210    parseBackboneElementProperties(json, res);
5211    if (json.has("activity"))
5212      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
5213    if (json.has("actual"))
5214      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
5215    if (json.has("_actual"))
5216      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
5217    if (json.has("period"))
5218      res.setPeriod(parsePeriod(getJObject(json, "period")));
5219  }
5220
5221  protected Citation.CitationRelatesToComponent parseCitationRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
5222    Citation.CitationRelatesToComponent res = new Citation.CitationRelatesToComponent();
5223    parseCitationRelatesToComponentProperties(json, res);
5224    return res;
5225  }
5226
5227  protected void parseCitationRelatesToComponentProperties(JsonObject json, Citation.CitationRelatesToComponent res) throws IOException, FHIRFormatError {
5228    parseBackboneElementProperties(json, res);
5229    if (json.has("relationshipType"))
5230      res.setRelationshipType(parseCodeableConcept(getJObject(json, "relationshipType")));
5231    if (json.has("targetClassifier")) {
5232      JsonArray array = getJArray(json, "targetClassifier");
5233      for (int i = 0; i < array.size(); i++) {
5234        res.getTargetClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5235      }
5236    };
5237    DataType target = parseType("target", json);
5238    if (target != null)
5239      res.setTarget(target);
5240  }
5241
5242  protected Citation.CitationCitedArtifactComponent parseCitationCitedArtifactComponent(JsonObject json) throws IOException, FHIRFormatError {
5243    Citation.CitationCitedArtifactComponent res = new Citation.CitationCitedArtifactComponent();
5244    parseCitationCitedArtifactComponentProperties(json, res);
5245    return res;
5246  }
5247
5248  protected void parseCitationCitedArtifactComponentProperties(JsonObject json, Citation.CitationCitedArtifactComponent res) throws IOException, FHIRFormatError {
5249    parseBackboneElementProperties(json, res);
5250    if (json.has("identifier")) {
5251      JsonArray array = getJArray(json, "identifier");
5252      for (int i = 0; i < array.size(); i++) {
5253        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5254      }
5255    };
5256    if (json.has("relatedIdentifier")) {
5257      JsonArray array = getJArray(json, "relatedIdentifier");
5258      for (int i = 0; i < array.size(); i++) {
5259        res.getRelatedIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5260      }
5261    };
5262    if (json.has("dateAccessed"))
5263      res.setDateAccessedElement(parseDateTime(json.get("dateAccessed").getAsString()));
5264    if (json.has("_dateAccessed"))
5265      parseElementProperties(getJObject(json, "_dateAccessed"), res.getDateAccessedElement());
5266    if (json.has("version"))
5267      res.setVersion(parseCitationCitedArtifactVersionComponent(getJObject(json, "version")));
5268    if (json.has("currentState")) {
5269      JsonArray array = getJArray(json, "currentState");
5270      for (int i = 0; i < array.size(); i++) {
5271        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5272      }
5273    };
5274    if (json.has("statusDate")) {
5275      JsonArray array = getJArray(json, "statusDate");
5276      for (int i = 0; i < array.size(); i++) {
5277        res.getStatusDate().add(parseCitationCitedArtifactStatusDateComponent(array.get(i).getAsJsonObject()));
5278      }
5279    };
5280    if (json.has("title")) {
5281      JsonArray array = getJArray(json, "title");
5282      for (int i = 0; i < array.size(); i++) {
5283        res.getTitle().add(parseCitationCitedArtifactTitleComponent(array.get(i).getAsJsonObject()));
5284      }
5285    };
5286    if (json.has("abstract")) {
5287      JsonArray array = getJArray(json, "abstract");
5288      for (int i = 0; i < array.size(); i++) {
5289        res.getAbstract().add(parseCitationCitedArtifactAbstractComponent(array.get(i).getAsJsonObject()));
5290      }
5291    };
5292    if (json.has("part"))
5293      res.setPart(parseCitationCitedArtifactPartComponent(getJObject(json, "part")));
5294    if (json.has("relatesTo")) {
5295      JsonArray array = getJArray(json, "relatesTo");
5296      for (int i = 0; i < array.size(); i++) {
5297        res.getRelatesTo().add(parseCitationCitedArtifactRelatesToComponent(array.get(i).getAsJsonObject()));
5298      }
5299    };
5300    if (json.has("publicationForm")) {
5301      JsonArray array = getJArray(json, "publicationForm");
5302      for (int i = 0; i < array.size(); i++) {
5303        res.getPublicationForm().add(parseCitationCitedArtifactPublicationFormComponent(array.get(i).getAsJsonObject()));
5304      }
5305    };
5306    if (json.has("webLocation")) {
5307      JsonArray array = getJArray(json, "webLocation");
5308      for (int i = 0; i < array.size(); i++) {
5309        res.getWebLocation().add(parseCitationCitedArtifactWebLocationComponent(array.get(i).getAsJsonObject()));
5310      }
5311    };
5312    if (json.has("classification")) {
5313      JsonArray array = getJArray(json, "classification");
5314      for (int i = 0; i < array.size(); i++) {
5315        res.getClassification().add(parseCitationCitedArtifactClassificationComponent(array.get(i).getAsJsonObject()));
5316      }
5317    };
5318    if (json.has("contributorship"))
5319      res.setContributorship(parseCitationCitedArtifactContributorshipComponent(getJObject(json, "contributorship")));
5320    if (json.has("note")) {
5321      JsonArray array = getJArray(json, "note");
5322      for (int i = 0; i < array.size(); i++) {
5323        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5324      }
5325    };
5326  }
5327
5328  protected Citation.CitationCitedArtifactVersionComponent parseCitationCitedArtifactVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
5329    Citation.CitationCitedArtifactVersionComponent res = new Citation.CitationCitedArtifactVersionComponent();
5330    parseCitationCitedArtifactVersionComponentProperties(json, res);
5331    return res;
5332  }
5333
5334  protected void parseCitationCitedArtifactVersionComponentProperties(JsonObject json, Citation.CitationCitedArtifactVersionComponent res) throws IOException, FHIRFormatError {
5335    parseBackboneElementProperties(json, res);
5336    if (json.has("value"))
5337      res.setValueElement(parseString(json.get("value").getAsString()));
5338    if (json.has("_value"))
5339      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5340    if (json.has("baseCitation"))
5341      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
5342  }
5343
5344  protected Citation.CitationCitedArtifactStatusDateComponent parseCitationCitedArtifactStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
5345    Citation.CitationCitedArtifactStatusDateComponent res = new Citation.CitationCitedArtifactStatusDateComponent();
5346    parseCitationCitedArtifactStatusDateComponentProperties(json, res);
5347    return res;
5348  }
5349
5350  protected void parseCitationCitedArtifactStatusDateComponentProperties(JsonObject json, Citation.CitationCitedArtifactStatusDateComponent res) throws IOException, FHIRFormatError {
5351    parseBackboneElementProperties(json, res);
5352    if (json.has("activity"))
5353      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
5354    if (json.has("actual"))
5355      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
5356    if (json.has("_actual"))
5357      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
5358    if (json.has("period"))
5359      res.setPeriod(parsePeriod(getJObject(json, "period")));
5360  }
5361
5362  protected Citation.CitationCitedArtifactTitleComponent parseCitationCitedArtifactTitleComponent(JsonObject json) throws IOException, FHIRFormatError {
5363    Citation.CitationCitedArtifactTitleComponent res = new Citation.CitationCitedArtifactTitleComponent();
5364    parseCitationCitedArtifactTitleComponentProperties(json, res);
5365    return res;
5366  }
5367
5368  protected void parseCitationCitedArtifactTitleComponentProperties(JsonObject json, Citation.CitationCitedArtifactTitleComponent res) throws IOException, FHIRFormatError {
5369    parseBackboneElementProperties(json, res);
5370    if (json.has("type")) {
5371      JsonArray array = getJArray(json, "type");
5372      for (int i = 0; i < array.size(); i++) {
5373        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5374      }
5375    };
5376    if (json.has("language"))
5377      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
5378    if (json.has("text"))
5379      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
5380    if (json.has("_text"))
5381      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
5382  }
5383
5384  protected Citation.CitationCitedArtifactAbstractComponent parseCitationCitedArtifactAbstractComponent(JsonObject json) throws IOException, FHIRFormatError {
5385    Citation.CitationCitedArtifactAbstractComponent res = new Citation.CitationCitedArtifactAbstractComponent();
5386    parseCitationCitedArtifactAbstractComponentProperties(json, res);
5387    return res;
5388  }
5389
5390  protected void parseCitationCitedArtifactAbstractComponentProperties(JsonObject json, Citation.CitationCitedArtifactAbstractComponent res) throws IOException, FHIRFormatError {
5391    parseBackboneElementProperties(json, res);
5392    if (json.has("type"))
5393      res.setType(parseCodeableConcept(getJObject(json, "type")));
5394    if (json.has("language"))
5395      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
5396    if (json.has("text"))
5397      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
5398    if (json.has("_text"))
5399      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
5400    if (json.has("copyright"))
5401      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5402    if (json.has("_copyright"))
5403      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5404  }
5405
5406  protected Citation.CitationCitedArtifactPartComponent parseCitationCitedArtifactPartComponent(JsonObject json) throws IOException, FHIRFormatError {
5407    Citation.CitationCitedArtifactPartComponent res = new Citation.CitationCitedArtifactPartComponent();
5408    parseCitationCitedArtifactPartComponentProperties(json, res);
5409    return res;
5410  }
5411
5412  protected void parseCitationCitedArtifactPartComponentProperties(JsonObject json, Citation.CitationCitedArtifactPartComponent res) throws IOException, FHIRFormatError {
5413    parseBackboneElementProperties(json, res);
5414    if (json.has("type"))
5415      res.setType(parseCodeableConcept(getJObject(json, "type")));
5416    if (json.has("value"))
5417      res.setValueElement(parseString(json.get("value").getAsString()));
5418    if (json.has("_value"))
5419      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5420    if (json.has("baseCitation"))
5421      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
5422  }
5423
5424  protected Citation.CitationCitedArtifactRelatesToComponent parseCitationCitedArtifactRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
5425    Citation.CitationCitedArtifactRelatesToComponent res = new Citation.CitationCitedArtifactRelatesToComponent();
5426    parseCitationCitedArtifactRelatesToComponentProperties(json, res);
5427    return res;
5428  }
5429
5430  protected void parseCitationCitedArtifactRelatesToComponentProperties(JsonObject json, Citation.CitationCitedArtifactRelatesToComponent res) throws IOException, FHIRFormatError {
5431    parseBackboneElementProperties(json, res);
5432    if (json.has("relationshipType"))
5433      res.setRelationshipType(parseCodeableConcept(getJObject(json, "relationshipType")));
5434    if (json.has("targetClassifier")) {
5435      JsonArray array = getJArray(json, "targetClassifier");
5436      for (int i = 0; i < array.size(); i++) {
5437        res.getTargetClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5438      }
5439    };
5440    DataType target = parseType("target", json);
5441    if (target != null)
5442      res.setTarget(target);
5443  }
5444
5445  protected Citation.CitationCitedArtifactPublicationFormComponent parseCitationCitedArtifactPublicationFormComponent(JsonObject json) throws IOException, FHIRFormatError {
5446    Citation.CitationCitedArtifactPublicationFormComponent res = new Citation.CitationCitedArtifactPublicationFormComponent();
5447    parseCitationCitedArtifactPublicationFormComponentProperties(json, res);
5448    return res;
5449  }
5450
5451  protected void parseCitationCitedArtifactPublicationFormComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormComponent res) throws IOException, FHIRFormatError {
5452    parseBackboneElementProperties(json, res);
5453    if (json.has("publishedIn"))
5454      res.setPublishedIn(parseCitationCitedArtifactPublicationFormPublishedInComponent(getJObject(json, "publishedIn")));
5455    if (json.has("periodicRelease"))
5456      res.setPeriodicRelease(parseCitationCitedArtifactPublicationFormPeriodicReleaseComponent(getJObject(json, "periodicRelease")));
5457    if (json.has("articleDate"))
5458      res.setArticleDateElement(parseDateTime(json.get("articleDate").getAsString()));
5459    if (json.has("_articleDate"))
5460      parseElementProperties(getJObject(json, "_articleDate"), res.getArticleDateElement());
5461    if (json.has("lastRevisionDate"))
5462      res.setLastRevisionDateElement(parseDateTime(json.get("lastRevisionDate").getAsString()));
5463    if (json.has("_lastRevisionDate"))
5464      parseElementProperties(getJObject(json, "_lastRevisionDate"), res.getLastRevisionDateElement());
5465    if (json.has("language")) {
5466      JsonArray array = getJArray(json, "language");
5467      for (int i = 0; i < array.size(); i++) {
5468        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5469      }
5470    };
5471    if (json.has("accessionNumber"))
5472      res.setAccessionNumberElement(parseString(json.get("accessionNumber").getAsString()));
5473    if (json.has("_accessionNumber"))
5474      parseElementProperties(getJObject(json, "_accessionNumber"), res.getAccessionNumberElement());
5475    if (json.has("pageString"))
5476      res.setPageStringElement(parseString(json.get("pageString").getAsString()));
5477    if (json.has("_pageString"))
5478      parseElementProperties(getJObject(json, "_pageString"), res.getPageStringElement());
5479    if (json.has("firstPage"))
5480      res.setFirstPageElement(parseString(json.get("firstPage").getAsString()));
5481    if (json.has("_firstPage"))
5482      parseElementProperties(getJObject(json, "_firstPage"), res.getFirstPageElement());
5483    if (json.has("lastPage"))
5484      res.setLastPageElement(parseString(json.get("lastPage").getAsString()));
5485    if (json.has("_lastPage"))
5486      parseElementProperties(getJObject(json, "_lastPage"), res.getLastPageElement());
5487    if (json.has("pageCount"))
5488      res.setPageCountElement(parseString(json.get("pageCount").getAsString()));
5489    if (json.has("_pageCount"))
5490      parseElementProperties(getJObject(json, "_pageCount"), res.getPageCountElement());
5491    if (json.has("copyright"))
5492      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5493    if (json.has("_copyright"))
5494      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5495  }
5496
5497  protected Citation.CitationCitedArtifactPublicationFormPublishedInComponent parseCitationCitedArtifactPublicationFormPublishedInComponent(JsonObject json) throws IOException, FHIRFormatError {
5498    Citation.CitationCitedArtifactPublicationFormPublishedInComponent res = new Citation.CitationCitedArtifactPublicationFormPublishedInComponent();
5499    parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(json, res);
5500    return res;
5501  }
5502
5503  protected void parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPublishedInComponent res) throws IOException, FHIRFormatError {
5504    parseBackboneElementProperties(json, res);
5505    if (json.has("type"))
5506      res.setType(parseCodeableConcept(getJObject(json, "type")));
5507    if (json.has("identifier")) {
5508      JsonArray array = getJArray(json, "identifier");
5509      for (int i = 0; i < array.size(); i++) {
5510        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5511      }
5512    };
5513    if (json.has("title"))
5514      res.setTitleElement(parseString(json.get("title").getAsString()));
5515    if (json.has("_title"))
5516      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5517    if (json.has("publisher"))
5518      res.setPublisher(parseReference(getJObject(json, "publisher")));
5519    if (json.has("publisherLocation"))
5520      res.setPublisherLocationElement(parseString(json.get("publisherLocation").getAsString()));
5521    if (json.has("_publisherLocation"))
5522      parseElementProperties(getJObject(json, "_publisherLocation"), res.getPublisherLocationElement());
5523  }
5524
5525  protected Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent parseCitationCitedArtifactPublicationFormPeriodicReleaseComponent(JsonObject json) throws IOException, FHIRFormatError {
5526    Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent res = new Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent();
5527    parseCitationCitedArtifactPublicationFormPeriodicReleaseComponentProperties(json, res);
5528    return res;
5529  }
5530
5531  protected void parseCitationCitedArtifactPublicationFormPeriodicReleaseComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent res) throws IOException, FHIRFormatError {
5532    parseBackboneElementProperties(json, res);
5533    if (json.has("citedMedium"))
5534      res.setCitedMedium(parseCodeableConcept(getJObject(json, "citedMedium")));
5535    if (json.has("volume"))
5536      res.setVolumeElement(parseString(json.get("volume").getAsString()));
5537    if (json.has("_volume"))
5538      parseElementProperties(getJObject(json, "_volume"), res.getVolumeElement());
5539    if (json.has("issue"))
5540      res.setIssueElement(parseString(json.get("issue").getAsString()));
5541    if (json.has("_issue"))
5542      parseElementProperties(getJObject(json, "_issue"), res.getIssueElement());
5543    if (json.has("dateOfPublication"))
5544      res.setDateOfPublication(parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent(getJObject(json, "dateOfPublication")));
5545  }
5546
5547  protected Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent(JsonObject json) throws IOException, FHIRFormatError {
5548    Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent res = new Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent();
5549    parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponentProperties(json, res);
5550    return res;
5551  }
5552
5553  protected void parseCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent res) throws IOException, FHIRFormatError {
5554    parseBackboneElementProperties(json, res);
5555    if (json.has("date"))
5556      res.setDateElement(parseDate(json.get("date").getAsString()));
5557    if (json.has("_date"))
5558      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5559    if (json.has("year"))
5560      res.setYearElement(parseString(json.get("year").getAsString()));
5561    if (json.has("_year"))
5562      parseElementProperties(getJObject(json, "_year"), res.getYearElement());
5563    if (json.has("month"))
5564      res.setMonthElement(parseString(json.get("month").getAsString()));
5565    if (json.has("_month"))
5566      parseElementProperties(getJObject(json, "_month"), res.getMonthElement());
5567    if (json.has("day"))
5568      res.setDayElement(parseString(json.get("day").getAsString()));
5569    if (json.has("_day"))
5570      parseElementProperties(getJObject(json, "_day"), res.getDayElement());
5571    if (json.has("season"))
5572      res.setSeasonElement(parseString(json.get("season").getAsString()));
5573    if (json.has("_season"))
5574      parseElementProperties(getJObject(json, "_season"), res.getSeasonElement());
5575    if (json.has("text"))
5576      res.setTextElement(parseString(json.get("text").getAsString()));
5577    if (json.has("_text"))
5578      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
5579  }
5580
5581  protected Citation.CitationCitedArtifactWebLocationComponent parseCitationCitedArtifactWebLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
5582    Citation.CitationCitedArtifactWebLocationComponent res = new Citation.CitationCitedArtifactWebLocationComponent();
5583    parseCitationCitedArtifactWebLocationComponentProperties(json, res);
5584    return res;
5585  }
5586
5587  protected void parseCitationCitedArtifactWebLocationComponentProperties(JsonObject json, Citation.CitationCitedArtifactWebLocationComponent res) throws IOException, FHIRFormatError {
5588    parseBackboneElementProperties(json, res);
5589    if (json.has("type"))
5590      res.setType(parseCodeableConcept(getJObject(json, "type")));
5591    if (json.has("url"))
5592      res.setUrlElement(parseUri(json.get("url").getAsString()));
5593    if (json.has("_url"))
5594      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5595  }
5596
5597  protected Citation.CitationCitedArtifactClassificationComponent parseCitationCitedArtifactClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
5598    Citation.CitationCitedArtifactClassificationComponent res = new Citation.CitationCitedArtifactClassificationComponent();
5599    parseCitationCitedArtifactClassificationComponentProperties(json, res);
5600    return res;
5601  }
5602
5603  protected void parseCitationCitedArtifactClassificationComponentProperties(JsonObject json, Citation.CitationCitedArtifactClassificationComponent res) throws IOException, FHIRFormatError {
5604    parseBackboneElementProperties(json, res);
5605    if (json.has("type"))
5606      res.setType(parseCodeableConcept(getJObject(json, "type")));
5607    if (json.has("classifier")) {
5608      JsonArray array = getJArray(json, "classifier");
5609      for (int i = 0; i < array.size(); i++) {
5610        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5611      }
5612    };
5613    if (json.has("whoClassified"))
5614      res.setWhoClassified(parseCitationCitedArtifactClassificationWhoClassifiedComponent(getJObject(json, "whoClassified")));
5615  }
5616
5617  protected Citation.CitationCitedArtifactClassificationWhoClassifiedComponent parseCitationCitedArtifactClassificationWhoClassifiedComponent(JsonObject json) throws IOException, FHIRFormatError {
5618    Citation.CitationCitedArtifactClassificationWhoClassifiedComponent res = new Citation.CitationCitedArtifactClassificationWhoClassifiedComponent();
5619    parseCitationCitedArtifactClassificationWhoClassifiedComponentProperties(json, res);
5620    return res;
5621  }
5622
5623  protected void parseCitationCitedArtifactClassificationWhoClassifiedComponentProperties(JsonObject json, Citation.CitationCitedArtifactClassificationWhoClassifiedComponent res) throws IOException, FHIRFormatError {
5624    parseBackboneElementProperties(json, res);
5625    if (json.has("person"))
5626      res.setPerson(parseReference(getJObject(json, "person")));
5627    if (json.has("organization"))
5628      res.setOrganization(parseReference(getJObject(json, "organization")));
5629    if (json.has("publisher"))
5630      res.setPublisher(parseReference(getJObject(json, "publisher")));
5631    if (json.has("classifierCopyright"))
5632      res.setClassifierCopyrightElement(parseString(json.get("classifierCopyright").getAsString()));
5633    if (json.has("_classifierCopyright"))
5634      parseElementProperties(getJObject(json, "_classifierCopyright"), res.getClassifierCopyrightElement());
5635    if (json.has("freeToShare"))
5636      res.setFreeToShareElement(parseBoolean(json.get("freeToShare").getAsBoolean()));
5637    if (json.has("_freeToShare"))
5638      parseElementProperties(getJObject(json, "_freeToShare"), res.getFreeToShareElement());
5639  }
5640
5641  protected Citation.CitationCitedArtifactContributorshipComponent parseCitationCitedArtifactContributorshipComponent(JsonObject json) throws IOException, FHIRFormatError {
5642    Citation.CitationCitedArtifactContributorshipComponent res = new Citation.CitationCitedArtifactContributorshipComponent();
5643    parseCitationCitedArtifactContributorshipComponentProperties(json, res);
5644    return res;
5645  }
5646
5647  protected void parseCitationCitedArtifactContributorshipComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipComponent res) throws IOException, FHIRFormatError {
5648    parseBackboneElementProperties(json, res);
5649    if (json.has("complete"))
5650      res.setCompleteElement(parseBoolean(json.get("complete").getAsBoolean()));
5651    if (json.has("_complete"))
5652      parseElementProperties(getJObject(json, "_complete"), res.getCompleteElement());
5653    if (json.has("entry")) {
5654      JsonArray array = getJArray(json, "entry");
5655      for (int i = 0; i < array.size(); i++) {
5656        res.getEntry().add(parseCitationCitedArtifactContributorshipEntryComponent(array.get(i).getAsJsonObject()));
5657      }
5658    };
5659    if (json.has("summary")) {
5660      JsonArray array = getJArray(json, "summary");
5661      for (int i = 0; i < array.size(); i++) {
5662        res.getSummary().add(parseCitationCitedArtifactContributorshipSummaryComponent(array.get(i).getAsJsonObject()));
5663      }
5664    };
5665  }
5666
5667  protected Citation.CitationCitedArtifactContributorshipEntryComponent parseCitationCitedArtifactContributorshipEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
5668    Citation.CitationCitedArtifactContributorshipEntryComponent res = new Citation.CitationCitedArtifactContributorshipEntryComponent();
5669    parseCitationCitedArtifactContributorshipEntryComponentProperties(json, res);
5670    return res;
5671  }
5672
5673  protected void parseCitationCitedArtifactContributorshipEntryComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryComponent res) throws IOException, FHIRFormatError {
5674    parseBackboneElementProperties(json, res);
5675    if (json.has("name"))
5676      res.setName(parseHumanName(getJObject(json, "name")));
5677    if (json.has("initials"))
5678      res.setInitialsElement(parseString(json.get("initials").getAsString()));
5679    if (json.has("_initials"))
5680      parseElementProperties(getJObject(json, "_initials"), res.getInitialsElement());
5681    if (json.has("collectiveName"))
5682      res.setCollectiveNameElement(parseString(json.get("collectiveName").getAsString()));
5683    if (json.has("_collectiveName"))
5684      parseElementProperties(getJObject(json, "_collectiveName"), res.getCollectiveNameElement());
5685    if (json.has("identifier")) {
5686      JsonArray array = getJArray(json, "identifier");
5687      for (int i = 0; i < array.size(); i++) {
5688        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5689      }
5690    };
5691    if (json.has("affiliationInfo")) {
5692      JsonArray array = getJArray(json, "affiliationInfo");
5693      for (int i = 0; i < array.size(); i++) {
5694        res.getAffiliationInfo().add(parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponent(array.get(i).getAsJsonObject()));
5695      }
5696    };
5697    if (json.has("address")) {
5698      JsonArray array = getJArray(json, "address");
5699      for (int i = 0; i < array.size(); i++) {
5700        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
5701      }
5702    };
5703    if (json.has("telecom")) {
5704      JsonArray array = getJArray(json, "telecom");
5705      for (int i = 0; i < array.size(); i++) {
5706        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5707      }
5708    };
5709    if (json.has("contributionType")) {
5710      JsonArray array = getJArray(json, "contributionType");
5711      for (int i = 0; i < array.size(); i++) {
5712        res.getContributionType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5713      }
5714    };
5715    if (json.has("role"))
5716      res.setRole(parseCodeableConcept(getJObject(json, "role")));
5717    if (json.has("contributionInstance")) {
5718      JsonArray array = getJArray(json, "contributionInstance");
5719      for (int i = 0; i < array.size(); i++) {
5720        res.getContributionInstance().add(parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(array.get(i).getAsJsonObject()));
5721      }
5722    };
5723    if (json.has("correspondingContact"))
5724      res.setCorrespondingContactElement(parseBoolean(json.get("correspondingContact").getAsBoolean()));
5725    if (json.has("_correspondingContact"))
5726      parseElementProperties(getJObject(json, "_correspondingContact"), res.getCorrespondingContactElement());
5727    if (json.has("listOrder"))
5728      res.setListOrderElement(parsePositiveInt(json.get("listOrder").getAsString()));
5729    if (json.has("_listOrder"))
5730      parseElementProperties(getJObject(json, "_listOrder"), res.getListOrderElement());
5731  }
5732
5733  protected Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponent(JsonObject json) throws IOException, FHIRFormatError {
5734    Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent res = new Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent();
5735    parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponentProperties(json, res);
5736    return res;
5737  }
5738
5739  protected void parseCitationCitedArtifactContributorshipEntryAffiliationInfoComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent res) throws IOException, FHIRFormatError {
5740    parseBackboneElementProperties(json, res);
5741    if (json.has("affiliation"))
5742      res.setAffiliationElement(parseString(json.get("affiliation").getAsString()));
5743    if (json.has("_affiliation"))
5744      parseElementProperties(getJObject(json, "_affiliation"), res.getAffiliationElement());
5745    if (json.has("role"))
5746      res.setRoleElement(parseString(json.get("role").getAsString()));
5747    if (json.has("_role"))
5748      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
5749    if (json.has("identifier")) {
5750      JsonArray array = getJArray(json, "identifier");
5751      for (int i = 0; i < array.size(); i++) {
5752        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5753      }
5754    };
5755  }
5756
5757  protected Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
5758    Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res = new Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent();
5759    parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(json, res);
5760    return res;
5761  }
5762
5763  protected void parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res) throws IOException, FHIRFormatError {
5764    parseBackboneElementProperties(json, res);
5765    if (json.has("type"))
5766      res.setType(parseCodeableConcept(getJObject(json, "type")));
5767    if (json.has("time"))
5768      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
5769    if (json.has("_time"))
5770      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
5771  }
5772
5773  protected Citation.CitationCitedArtifactContributorshipSummaryComponent parseCitationCitedArtifactContributorshipSummaryComponent(JsonObject json) throws IOException, FHIRFormatError {
5774    Citation.CitationCitedArtifactContributorshipSummaryComponent res = new Citation.CitationCitedArtifactContributorshipSummaryComponent();
5775    parseCitationCitedArtifactContributorshipSummaryComponentProperties(json, res);
5776    return res;
5777  }
5778
5779  protected void parseCitationCitedArtifactContributorshipSummaryComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipSummaryComponent res) throws IOException, FHIRFormatError {
5780    parseBackboneElementProperties(json, res);
5781    if (json.has("type"))
5782      res.setType(parseCodeableConcept(getJObject(json, "type")));
5783    if (json.has("style"))
5784      res.setStyle(parseCodeableConcept(getJObject(json, "style")));
5785    if (json.has("source"))
5786      res.setSource(parseCodeableConcept(getJObject(json, "source")));
5787    if (json.has("value"))
5788      res.setValueElement(parseMarkdown(json.get("value").getAsString()));
5789    if (json.has("_value"))
5790      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5791  }
5792
5793  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
5794    Claim res = new Claim();
5795    parseClaimProperties(json, res);
5796    return res;
5797  }
5798
5799  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
5800    parseDomainResourceProperties(json, res);
5801    if (json.has("identifier")) {
5802      JsonArray array = getJArray(json, "identifier");
5803      for (int i = 0; i < array.size(); i++) {
5804        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5805      }
5806    };
5807    if (json.has("status"))
5808      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
5809    if (json.has("_status"))
5810      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5811    if (json.has("type"))
5812      res.setType(parseCodeableConcept(getJObject(json, "type")));
5813    if (json.has("subType"))
5814      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
5815    if (json.has("use"))
5816      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
5817    if (json.has("_use"))
5818      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
5819    if (json.has("patient"))
5820      res.setPatient(parseReference(getJObject(json, "patient")));
5821    if (json.has("billablePeriod"))
5822      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
5823    if (json.has("created"))
5824      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5825    if (json.has("_created"))
5826      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
5827    if (json.has("enterer"))
5828      res.setEnterer(parseReference(getJObject(json, "enterer")));
5829    if (json.has("insurer"))
5830      res.setInsurer(parseReference(getJObject(json, "insurer")));
5831    if (json.has("provider"))
5832      res.setProvider(parseReference(getJObject(json, "provider")));
5833    if (json.has("priority"))
5834      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
5835    if (json.has("fundsReserve"))
5836      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
5837    if (json.has("related")) {
5838      JsonArray array = getJArray(json, "related");
5839      for (int i = 0; i < array.size(); i++) {
5840        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject()));
5841      }
5842    };
5843    if (json.has("prescription"))
5844      res.setPrescription(parseReference(getJObject(json, "prescription")));
5845    if (json.has("originalPrescription"))
5846      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
5847    if (json.has("payee"))
5848      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee")));
5849    if (json.has("referral"))
5850      res.setReferral(parseReference(getJObject(json, "referral")));
5851    if (json.has("facility"))
5852      res.setFacility(parseReference(getJObject(json, "facility")));
5853    if (json.has("careTeam")) {
5854      JsonArray array = getJArray(json, "careTeam");
5855      for (int i = 0; i < array.size(); i++) {
5856        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject()));
5857      }
5858    };
5859    if (json.has("supportingInfo")) {
5860      JsonArray array = getJArray(json, "supportingInfo");
5861      for (int i = 0; i < array.size(); i++) {
5862        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject()));
5863      }
5864    };
5865    if (json.has("diagnosis")) {
5866      JsonArray array = getJArray(json, "diagnosis");
5867      for (int i = 0; i < array.size(); i++) {
5868        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject()));
5869      }
5870    };
5871    if (json.has("procedure")) {
5872      JsonArray array = getJArray(json, "procedure");
5873      for (int i = 0; i < array.size(); i++) {
5874        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject()));
5875      }
5876    };
5877    if (json.has("insurance")) {
5878      JsonArray array = getJArray(json, "insurance");
5879      for (int i = 0; i < array.size(); i++) {
5880        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject()));
5881      }
5882    };
5883    if (json.has("accident"))
5884      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident")));
5885    if (json.has("item")) {
5886      JsonArray array = getJArray(json, "item");
5887      for (int i = 0; i < array.size(); i++) {
5888        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject()));
5889      }
5890    };
5891    if (json.has("total"))
5892      res.setTotal(parseMoney(getJObject(json, "total")));
5893  }
5894
5895  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
5896    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
5897    parseClaimRelatedClaimComponentProperties(json, res);
5898    return res;
5899  }
5900
5901  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
5902    parseBackboneElementProperties(json, res);
5903    if (json.has("claim"))
5904      res.setClaim(parseReference(getJObject(json, "claim")));
5905    if (json.has("relationship"))
5906      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
5907    if (json.has("reference"))
5908      res.setReference(parseIdentifier(getJObject(json, "reference")));
5909  }
5910
5911  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
5912    Claim.PayeeComponent res = new Claim.PayeeComponent();
5913    parseClaimPayeeComponentProperties(json, res);
5914    return res;
5915  }
5916
5917  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
5918    parseBackboneElementProperties(json, res);
5919    if (json.has("type"))
5920      res.setType(parseCodeableConcept(getJObject(json, "type")));
5921    if (json.has("party"))
5922      res.setParty(parseReference(getJObject(json, "party")));
5923  }
5924
5925  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
5926    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
5927    parseClaimCareTeamComponentProperties(json, res);
5928    return res;
5929  }
5930
5931  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
5932    parseBackboneElementProperties(json, res);
5933    if (json.has("sequence"))
5934      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5935    if (json.has("_sequence"))
5936      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5937    if (json.has("provider"))
5938      res.setProvider(parseReference(getJObject(json, "provider")));
5939    if (json.has("responsible"))
5940      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
5941    if (json.has("_responsible"))
5942      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
5943    if (json.has("role"))
5944      res.setRole(parseCodeableConcept(getJObject(json, "role")));
5945    if (json.has("qualification"))
5946      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
5947  }
5948
5949  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
5950    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
5951    parseClaimSupportingInformationComponentProperties(json, res);
5952    return res;
5953  }
5954
5955  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
5956    parseBackboneElementProperties(json, res);
5957    if (json.has("sequence"))
5958      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5959    if (json.has("_sequence"))
5960      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5961    if (json.has("category"))
5962      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5963    if (json.has("code"))
5964      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5965    DataType timing = parseType("timing", json);
5966    if (timing != null)
5967      res.setTiming(timing);
5968    DataType value = parseType("value", json);
5969    if (value != null)
5970      res.setValue(value);
5971    if (json.has("reason"))
5972      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
5973  }
5974
5975  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
5976    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
5977    parseClaimDiagnosisComponentProperties(json, res);
5978    return res;
5979  }
5980
5981  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
5982    parseBackboneElementProperties(json, res);
5983    if (json.has("sequence"))
5984      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5985    if (json.has("_sequence"))
5986      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5987    DataType diagnosis = parseType("diagnosis", json);
5988    if (diagnosis != null)
5989      res.setDiagnosis(diagnosis);
5990    if (json.has("type")) {
5991      JsonArray array = getJArray(json, "type");
5992      for (int i = 0; i < array.size(); i++) {
5993        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5994      }
5995    };
5996    if (json.has("onAdmission"))
5997      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
5998    if (json.has("packageCode"))
5999      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
6000  }
6001
6002  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
6003    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
6004    parseClaimProcedureComponentProperties(json, res);
6005    return res;
6006  }
6007
6008  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
6009    parseBackboneElementProperties(json, res);
6010    if (json.has("sequence"))
6011      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6012    if (json.has("_sequence"))
6013      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6014    if (json.has("type")) {
6015      JsonArray array = getJArray(json, "type");
6016      for (int i = 0; i < array.size(); i++) {
6017        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6018      }
6019    };
6020    if (json.has("date"))
6021      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6022    if (json.has("_date"))
6023      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6024    DataType procedure = parseType("procedure", json);
6025    if (procedure != null)
6026      res.setProcedure(procedure);
6027    if (json.has("udi")) {
6028      JsonArray array = getJArray(json, "udi");
6029      for (int i = 0; i < array.size(); i++) {
6030        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6031      }
6032    };
6033  }
6034
6035  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
6036    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
6037    parseClaimInsuranceComponentProperties(json, res);
6038    return res;
6039  }
6040
6041  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
6042    parseBackboneElementProperties(json, res);
6043    if (json.has("sequence"))
6044      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6045    if (json.has("_sequence"))
6046      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6047    if (json.has("focal"))
6048      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6049    if (json.has("_focal"))
6050      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
6051    if (json.has("identifier"))
6052      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6053    if (json.has("coverage"))
6054      res.setCoverage(parseReference(getJObject(json, "coverage")));
6055    if (json.has("businessArrangement"))
6056      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6057    if (json.has("_businessArrangement"))
6058      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
6059    if (json.has("preAuthRef")) {
6060      JsonArray array = getJArray(json, "preAuthRef");
6061      for (int i = 0; i < array.size(); i++) {
6062        if (array.get(i).isJsonNull()) {
6063          res.getPreAuthRef().add(new StringType());
6064        } else {;
6065          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
6066        }
6067      }
6068    };
6069    if (json.has("_preAuthRef")) {
6070      JsonArray array = getJArray(json, "_preAuthRef");
6071      for (int i = 0; i < array.size(); i++) {
6072        if (i == res.getPreAuthRef().size())
6073          res.getPreAuthRef().add(parseString(null));
6074        if (array.get(i) instanceof JsonObject) 
6075          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
6076      }
6077    };
6078    if (json.has("claimResponse"))
6079      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
6080  }
6081
6082  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
6083    Claim.AccidentComponent res = new Claim.AccidentComponent();
6084    parseClaimAccidentComponentProperties(json, res);
6085    return res;
6086  }
6087
6088  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
6089    parseBackboneElementProperties(json, res);
6090    if (json.has("date"))
6091      res.setDateElement(parseDate(json.get("date").getAsString()));
6092    if (json.has("_date"))
6093      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6094    if (json.has("type"))
6095      res.setType(parseCodeableConcept(getJObject(json, "type")));
6096    DataType location = parseType("location", json);
6097    if (location != null)
6098      res.setLocation(location);
6099  }
6100
6101  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6102    Claim.ItemComponent res = new Claim.ItemComponent();
6103    parseClaimItemComponentProperties(json, res);
6104    return res;
6105  }
6106
6107  protected void parseClaimItemComponentProperties(JsonObject json, Claim.ItemComponent res) throws IOException, FHIRFormatError {
6108    parseBackboneElementProperties(json, res);
6109    if (json.has("sequence"))
6110      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6111    if (json.has("_sequence"))
6112      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6113    if (json.has("careTeamSequence")) {
6114      JsonArray array = getJArray(json, "careTeamSequence");
6115      for (int i = 0; i < array.size(); i++) {
6116        if (array.get(i).isJsonNull()) {
6117          res.getCareTeamSequence().add(new PositiveIntType());
6118        } else {;
6119          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
6120        }
6121      }
6122    };
6123    if (json.has("_careTeamSequence")) {
6124      JsonArray array = getJArray(json, "_careTeamSequence");
6125      for (int i = 0; i < array.size(); i++) {
6126        if (i == res.getCareTeamSequence().size())
6127          res.getCareTeamSequence().add(parsePositiveInt(null));
6128        if (array.get(i) instanceof JsonObject) 
6129          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
6130      }
6131    };
6132    if (json.has("diagnosisSequence")) {
6133      JsonArray array = getJArray(json, "diagnosisSequence");
6134      for (int i = 0; i < array.size(); i++) {
6135        if (array.get(i).isJsonNull()) {
6136          res.getDiagnosisSequence().add(new PositiveIntType());
6137        } else {;
6138          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
6139        }
6140      }
6141    };
6142    if (json.has("_diagnosisSequence")) {
6143      JsonArray array = getJArray(json, "_diagnosisSequence");
6144      for (int i = 0; i < array.size(); i++) {
6145        if (i == res.getDiagnosisSequence().size())
6146          res.getDiagnosisSequence().add(parsePositiveInt(null));
6147        if (array.get(i) instanceof JsonObject) 
6148          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
6149      }
6150    };
6151    if (json.has("procedureSequence")) {
6152      JsonArray array = getJArray(json, "procedureSequence");
6153      for (int i = 0; i < array.size(); i++) {
6154        if (array.get(i).isJsonNull()) {
6155          res.getProcedureSequence().add(new PositiveIntType());
6156        } else {;
6157          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
6158        }
6159      }
6160    };
6161    if (json.has("_procedureSequence")) {
6162      JsonArray array = getJArray(json, "_procedureSequence");
6163      for (int i = 0; i < array.size(); i++) {
6164        if (i == res.getProcedureSequence().size())
6165          res.getProcedureSequence().add(parsePositiveInt(null));
6166        if (array.get(i) instanceof JsonObject) 
6167          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
6168      }
6169    };
6170    if (json.has("informationSequence")) {
6171      JsonArray array = getJArray(json, "informationSequence");
6172      for (int i = 0; i < array.size(); i++) {
6173        if (array.get(i).isJsonNull()) {
6174          res.getInformationSequence().add(new PositiveIntType());
6175        } else {;
6176          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
6177        }
6178      }
6179    };
6180    if (json.has("_informationSequence")) {
6181      JsonArray array = getJArray(json, "_informationSequence");
6182      for (int i = 0; i < array.size(); i++) {
6183        if (i == res.getInformationSequence().size())
6184          res.getInformationSequence().add(parsePositiveInt(null));
6185        if (array.get(i) instanceof JsonObject) 
6186          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
6187      }
6188    };
6189    if (json.has("revenue"))
6190      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6191    if (json.has("category"))
6192      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6193    if (json.has("productOrService"))
6194      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6195    if (json.has("modifier")) {
6196      JsonArray array = getJArray(json, "modifier");
6197      for (int i = 0; i < array.size(); i++) {
6198        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6199      }
6200    };
6201    if (json.has("programCode")) {
6202      JsonArray array = getJArray(json, "programCode");
6203      for (int i = 0; i < array.size(); i++) {
6204        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6205      }
6206    };
6207    DataType serviced = parseType("serviced", json);
6208    if (serviced != null)
6209      res.setServiced(serviced);
6210    DataType location = parseType("location", json);
6211    if (location != null)
6212      res.setLocation(location);
6213    if (json.has("quantity"))
6214      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6215    if (json.has("unitPrice"))
6216      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6217    if (json.has("factor"))
6218      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6219    if (json.has("_factor"))
6220      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6221    if (json.has("net"))
6222      res.setNet(parseMoney(getJObject(json, "net")));
6223    if (json.has("udi")) {
6224      JsonArray array = getJArray(json, "udi");
6225      for (int i = 0; i < array.size(); i++) {
6226        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6227      }
6228    };
6229    if (json.has("bodySite"))
6230      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
6231    if (json.has("subSite")) {
6232      JsonArray array = getJArray(json, "subSite");
6233      for (int i = 0; i < array.size(); i++) {
6234        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6235      }
6236    };
6237    if (json.has("encounter")) {
6238      JsonArray array = getJArray(json, "encounter");
6239      for (int i = 0; i < array.size(); i++) {
6240        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
6241      }
6242    };
6243    if (json.has("detail")) {
6244      JsonArray array = getJArray(json, "detail");
6245      for (int i = 0; i < array.size(); i++) {
6246        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject()));
6247      }
6248    };
6249  }
6250
6251  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6252    Claim.DetailComponent res = new Claim.DetailComponent();
6253    parseClaimDetailComponentProperties(json, res);
6254    return res;
6255  }
6256
6257  protected void parseClaimDetailComponentProperties(JsonObject json, Claim.DetailComponent res) throws IOException, FHIRFormatError {
6258    parseBackboneElementProperties(json, res);
6259    if (json.has("sequence"))
6260      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6261    if (json.has("_sequence"))
6262      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6263    if (json.has("revenue"))
6264      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6265    if (json.has("category"))
6266      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6267    if (json.has("productOrService"))
6268      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6269    if (json.has("modifier")) {
6270      JsonArray array = getJArray(json, "modifier");
6271      for (int i = 0; i < array.size(); i++) {
6272        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6273      }
6274    };
6275    if (json.has("programCode")) {
6276      JsonArray array = getJArray(json, "programCode");
6277      for (int i = 0; i < array.size(); i++) {
6278        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6279      }
6280    };
6281    if (json.has("quantity"))
6282      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6283    if (json.has("unitPrice"))
6284      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6285    if (json.has("factor"))
6286      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6287    if (json.has("_factor"))
6288      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6289    if (json.has("net"))
6290      res.setNet(parseMoney(getJObject(json, "net")));
6291    if (json.has("udi")) {
6292      JsonArray array = getJArray(json, "udi");
6293      for (int i = 0; i < array.size(); i++) {
6294        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6295      }
6296    };
6297    if (json.has("subDetail")) {
6298      JsonArray array = getJArray(json, "subDetail");
6299      for (int i = 0; i < array.size(); i++) {
6300        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject()));
6301      }
6302    };
6303  }
6304
6305  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6306    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
6307    parseClaimSubDetailComponentProperties(json, res);
6308    return res;
6309  }
6310
6311  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
6312    parseBackboneElementProperties(json, res);
6313    if (json.has("sequence"))
6314      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6315    if (json.has("_sequence"))
6316      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6317    if (json.has("revenue"))
6318      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6319    if (json.has("category"))
6320      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6321    if (json.has("productOrService"))
6322      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6323    if (json.has("modifier")) {
6324      JsonArray array = getJArray(json, "modifier");
6325      for (int i = 0; i < array.size(); i++) {
6326        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6327      }
6328    };
6329    if (json.has("programCode")) {
6330      JsonArray array = getJArray(json, "programCode");
6331      for (int i = 0; i < array.size(); i++) {
6332        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6333      }
6334    };
6335    if (json.has("quantity"))
6336      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6337    if (json.has("unitPrice"))
6338      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6339    if (json.has("factor"))
6340      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6341    if (json.has("_factor"))
6342      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6343    if (json.has("net"))
6344      res.setNet(parseMoney(getJObject(json, "net")));
6345    if (json.has("udi")) {
6346      JsonArray array = getJArray(json, "udi");
6347      for (int i = 0; i < array.size(); i++) {
6348        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6349      }
6350    };
6351  }
6352
6353  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
6354    ClaimResponse res = new ClaimResponse();
6355    parseClaimResponseProperties(json, res);
6356    return res;
6357  }
6358
6359  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
6360    parseDomainResourceProperties(json, res);
6361    if (json.has("identifier")) {
6362      JsonArray array = getJArray(json, "identifier");
6363      for (int i = 0; i < array.size(); i++) {
6364        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6365      }
6366    };
6367    if (json.has("status"))
6368      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
6369    if (json.has("_status"))
6370      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6371    if (json.has("type"))
6372      res.setType(parseCodeableConcept(getJObject(json, "type")));
6373    if (json.has("subType"))
6374      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6375    if (json.has("use"))
6376      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
6377    if (json.has("_use"))
6378      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
6379    if (json.has("patient"))
6380      res.setPatient(parseReference(getJObject(json, "patient")));
6381    if (json.has("created"))
6382      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6383    if (json.has("_created"))
6384      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
6385    if (json.has("insurer"))
6386      res.setInsurer(parseReference(getJObject(json, "insurer")));
6387    if (json.has("requestor"))
6388      res.setRequestor(parseReference(getJObject(json, "requestor")));
6389    if (json.has("request"))
6390      res.setRequest(parseReference(getJObject(json, "request")));
6391    if (json.has("outcome"))
6392      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
6393    if (json.has("_outcome"))
6394      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
6395    if (json.has("disposition"))
6396      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
6397    if (json.has("_disposition"))
6398      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
6399    if (json.has("preAuthRef"))
6400      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
6401    if (json.has("_preAuthRef"))
6402      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
6403    if (json.has("preAuthPeriod"))
6404      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
6405    if (json.has("payeeType"))
6406      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
6407    if (json.has("item")) {
6408      JsonArray array = getJArray(json, "item");
6409      for (int i = 0; i < array.size(); i++) {
6410        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject()));
6411      }
6412    };
6413    if (json.has("addItem")) {
6414      JsonArray array = getJArray(json, "addItem");
6415      for (int i = 0; i < array.size(); i++) {
6416        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject()));
6417      }
6418    };
6419    if (json.has("adjudication")) {
6420      JsonArray array = getJArray(json, "adjudication");
6421      for (int i = 0; i < array.size(); i++) {
6422        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6423      }
6424    };
6425    if (json.has("total")) {
6426      JsonArray array = getJArray(json, "total");
6427      for (int i = 0; i < array.size(); i++) {
6428        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject()));
6429      }
6430    };
6431    if (json.has("payment"))
6432      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment")));
6433    if (json.has("fundsReserve"))
6434      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
6435    if (json.has("formCode"))
6436      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
6437    if (json.has("form"))
6438      res.setForm(parseAttachment(getJObject(json, "form")));
6439    if (json.has("processNote")) {
6440      JsonArray array = getJArray(json, "processNote");
6441      for (int i = 0; i < array.size(); i++) {
6442        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject()));
6443      }
6444    };
6445    if (json.has("communicationRequest")) {
6446      JsonArray array = getJArray(json, "communicationRequest");
6447      for (int i = 0; i < array.size(); i++) {
6448        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
6449      }
6450    };
6451    if (json.has("insurance")) {
6452      JsonArray array = getJArray(json, "insurance");
6453      for (int i = 0; i < array.size(); i++) {
6454        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject()));
6455      }
6456    };
6457    if (json.has("error")) {
6458      JsonArray array = getJArray(json, "error");
6459      for (int i = 0; i < array.size(); i++) {
6460        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject()));
6461      }
6462    };
6463  }
6464
6465  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6466    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
6467    parseClaimResponseItemComponentProperties(json, res);
6468    return res;
6469  }
6470
6471  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
6472    parseBackboneElementProperties(json, res);
6473    if (json.has("itemSequence"))
6474      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6475    if (json.has("_itemSequence"))
6476      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
6477    if (json.has("noteNumber")) {
6478      JsonArray array = getJArray(json, "noteNumber");
6479      for (int i = 0; i < array.size(); i++) {
6480        if (array.get(i).isJsonNull()) {
6481          res.getNoteNumber().add(new PositiveIntType());
6482        } else {;
6483          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6484        }
6485      }
6486    };
6487    if (json.has("_noteNumber")) {
6488      JsonArray array = getJArray(json, "_noteNumber");
6489      for (int i = 0; i < array.size(); i++) {
6490        if (i == res.getNoteNumber().size())
6491          res.getNoteNumber().add(parsePositiveInt(null));
6492        if (array.get(i) instanceof JsonObject) 
6493          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6494      }
6495    };
6496    if (json.has("adjudication")) {
6497      JsonArray array = getJArray(json, "adjudication");
6498      for (int i = 0; i < array.size(); i++) {
6499        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6500      }
6501    };
6502    if (json.has("detail")) {
6503      JsonArray array = getJArray(json, "detail");
6504      for (int i = 0; i < array.size(); i++) {
6505        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject()));
6506      }
6507    };
6508  }
6509
6510  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
6511    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
6512    parseClaimResponseAdjudicationComponentProperties(json, res);
6513    return res;
6514  }
6515
6516  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
6517    parseBackboneElementProperties(json, res);
6518    if (json.has("category"))
6519      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6520    if (json.has("reason"))
6521      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
6522    if (json.has("amount"))
6523      res.setAmount(parseMoney(getJObject(json, "amount")));
6524    if (json.has("value"))
6525      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
6526    if (json.has("_value"))
6527      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6528  }
6529
6530  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6531    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
6532    parseClaimResponseItemDetailComponentProperties(json, res);
6533    return res;
6534  }
6535
6536  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
6537    parseBackboneElementProperties(json, res);
6538    if (json.has("detailSequence"))
6539      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6540    if (json.has("_detailSequence"))
6541      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
6542    if (json.has("noteNumber")) {
6543      JsonArray array = getJArray(json, "noteNumber");
6544      for (int i = 0; i < array.size(); i++) {
6545        if (array.get(i).isJsonNull()) {
6546          res.getNoteNumber().add(new PositiveIntType());
6547        } else {;
6548          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6549        }
6550      }
6551    };
6552    if (json.has("_noteNumber")) {
6553      JsonArray array = getJArray(json, "_noteNumber");
6554      for (int i = 0; i < array.size(); i++) {
6555        if (i == res.getNoteNumber().size())
6556          res.getNoteNumber().add(parsePositiveInt(null));
6557        if (array.get(i) instanceof JsonObject) 
6558          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6559      }
6560    };
6561    if (json.has("adjudication")) {
6562      JsonArray array = getJArray(json, "adjudication");
6563      for (int i = 0; i < array.size(); i++) {
6564        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6565      }
6566    };
6567    if (json.has("subDetail")) {
6568      JsonArray array = getJArray(json, "subDetail");
6569      for (int i = 0; i < array.size(); i++) {
6570        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject()));
6571      }
6572    };
6573  }
6574
6575  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6576    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
6577    parseClaimResponseSubDetailComponentProperties(json, res);
6578    return res;
6579  }
6580
6581  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
6582    parseBackboneElementProperties(json, res);
6583    if (json.has("subDetailSequence"))
6584      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6585    if (json.has("_subDetailSequence"))
6586      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
6587    if (json.has("noteNumber")) {
6588      JsonArray array = getJArray(json, "noteNumber");
6589      for (int i = 0; i < array.size(); i++) {
6590        if (array.get(i).isJsonNull()) {
6591          res.getNoteNumber().add(new PositiveIntType());
6592        } else {;
6593          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6594        }
6595      }
6596    };
6597    if (json.has("_noteNumber")) {
6598      JsonArray array = getJArray(json, "_noteNumber");
6599      for (int i = 0; i < array.size(); i++) {
6600        if (i == res.getNoteNumber().size())
6601          res.getNoteNumber().add(parsePositiveInt(null));
6602        if (array.get(i) instanceof JsonObject) 
6603          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6604      }
6605    };
6606    if (json.has("adjudication")) {
6607      JsonArray array = getJArray(json, "adjudication");
6608      for (int i = 0; i < array.size(); i++) {
6609        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6610      }
6611    };
6612  }
6613
6614  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6615    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
6616    parseClaimResponseAddedItemComponentProperties(json, res);
6617    return res;
6618  }
6619
6620  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
6621    parseBackboneElementProperties(json, res);
6622    if (json.has("itemSequence")) {
6623      JsonArray array = getJArray(json, "itemSequence");
6624      for (int i = 0; i < array.size(); i++) {
6625        if (array.get(i).isJsonNull()) {
6626          res.getItemSequence().add(new PositiveIntType());
6627        } else {;
6628          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
6629        }
6630      }
6631    };
6632    if (json.has("_itemSequence")) {
6633      JsonArray array = getJArray(json, "_itemSequence");
6634      for (int i = 0; i < array.size(); i++) {
6635        if (i == res.getItemSequence().size())
6636          res.getItemSequence().add(parsePositiveInt(null));
6637        if (array.get(i) instanceof JsonObject) 
6638          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
6639      }
6640    };
6641    if (json.has("detailSequence")) {
6642      JsonArray array = getJArray(json, "detailSequence");
6643      for (int i = 0; i < array.size(); i++) {
6644        if (array.get(i).isJsonNull()) {
6645          res.getDetailSequence().add(new PositiveIntType());
6646        } else {;
6647          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6648        }
6649      }
6650    };
6651    if (json.has("_detailSequence")) {
6652      JsonArray array = getJArray(json, "_detailSequence");
6653      for (int i = 0; i < array.size(); i++) {
6654        if (i == res.getDetailSequence().size())
6655          res.getDetailSequence().add(parsePositiveInt(null));
6656        if (array.get(i) instanceof JsonObject) 
6657          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
6658      }
6659    };
6660    if (json.has("subdetailSequence")) {
6661      JsonArray array = getJArray(json, "subdetailSequence");
6662      for (int i = 0; i < array.size(); i++) {
6663        if (array.get(i).isJsonNull()) {
6664          res.getSubdetailSequence().add(new PositiveIntType());
6665        } else {;
6666          res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6667        }
6668      }
6669    };
6670    if (json.has("_subdetailSequence")) {
6671      JsonArray array = getJArray(json, "_subdetailSequence");
6672      for (int i = 0; i < array.size(); i++) {
6673        if (i == res.getSubdetailSequence().size())
6674          res.getSubdetailSequence().add(parsePositiveInt(null));
6675        if (array.get(i) instanceof JsonObject) 
6676          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
6677      }
6678    };
6679    if (json.has("provider")) {
6680      JsonArray array = getJArray(json, "provider");
6681      for (int i = 0; i < array.size(); i++) {
6682        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
6683      }
6684    };
6685    if (json.has("productOrService"))
6686      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6687    if (json.has("modifier")) {
6688      JsonArray array = getJArray(json, "modifier");
6689      for (int i = 0; i < array.size(); i++) {
6690        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6691      }
6692    };
6693    if (json.has("programCode")) {
6694      JsonArray array = getJArray(json, "programCode");
6695      for (int i = 0; i < array.size(); i++) {
6696        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6697      }
6698    };
6699    DataType serviced = parseType("serviced", json);
6700    if (serviced != null)
6701      res.setServiced(serviced);
6702    DataType location = parseType("location", json);
6703    if (location != null)
6704      res.setLocation(location);
6705    if (json.has("quantity"))
6706      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6707    if (json.has("unitPrice"))
6708      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6709    if (json.has("factor"))
6710      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6711    if (json.has("_factor"))
6712      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6713    if (json.has("net"))
6714      res.setNet(parseMoney(getJObject(json, "net")));
6715    if (json.has("bodySite"))
6716      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
6717    if (json.has("subSite")) {
6718      JsonArray array = getJArray(json, "subSite");
6719      for (int i = 0; i < array.size(); i++) {
6720        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6721      }
6722    };
6723    if (json.has("noteNumber")) {
6724      JsonArray array = getJArray(json, "noteNumber");
6725      for (int i = 0; i < array.size(); i++) {
6726        if (array.get(i).isJsonNull()) {
6727          res.getNoteNumber().add(new PositiveIntType());
6728        } else {;
6729          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6730        }
6731      }
6732    };
6733    if (json.has("_noteNumber")) {
6734      JsonArray array = getJArray(json, "_noteNumber");
6735      for (int i = 0; i < array.size(); i++) {
6736        if (i == res.getNoteNumber().size())
6737          res.getNoteNumber().add(parsePositiveInt(null));
6738        if (array.get(i) instanceof JsonObject) 
6739          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6740      }
6741    };
6742    if (json.has("adjudication")) {
6743      JsonArray array = getJArray(json, "adjudication");
6744      for (int i = 0; i < array.size(); i++) {
6745        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6746      }
6747    };
6748    if (json.has("detail")) {
6749      JsonArray array = getJArray(json, "detail");
6750      for (int i = 0; i < array.size(); i++) {
6751        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject()));
6752      }
6753    };
6754  }
6755
6756  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6757    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
6758    parseClaimResponseAddedItemDetailComponentProperties(json, res);
6759    return res;
6760  }
6761
6762  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
6763    parseBackboneElementProperties(json, res);
6764    if (json.has("productOrService"))
6765      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6766    if (json.has("modifier")) {
6767      JsonArray array = getJArray(json, "modifier");
6768      for (int i = 0; i < array.size(); i++) {
6769        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6770      }
6771    };
6772    if (json.has("quantity"))
6773      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6774    if (json.has("unitPrice"))
6775      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6776    if (json.has("factor"))
6777      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6778    if (json.has("_factor"))
6779      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6780    if (json.has("net"))
6781      res.setNet(parseMoney(getJObject(json, "net")));
6782    if (json.has("noteNumber")) {
6783      JsonArray array = getJArray(json, "noteNumber");
6784      for (int i = 0; i < array.size(); i++) {
6785        if (array.get(i).isJsonNull()) {
6786          res.getNoteNumber().add(new PositiveIntType());
6787        } else {;
6788          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6789        }
6790      }
6791    };
6792    if (json.has("_noteNumber")) {
6793      JsonArray array = getJArray(json, "_noteNumber");
6794      for (int i = 0; i < array.size(); i++) {
6795        if (i == res.getNoteNumber().size())
6796          res.getNoteNumber().add(parsePositiveInt(null));
6797        if (array.get(i) instanceof JsonObject) 
6798          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6799      }
6800    };
6801    if (json.has("adjudication")) {
6802      JsonArray array = getJArray(json, "adjudication");
6803      for (int i = 0; i < array.size(); i++) {
6804        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6805      }
6806    };
6807    if (json.has("subDetail")) {
6808      JsonArray array = getJArray(json, "subDetail");
6809      for (int i = 0; i < array.size(); i++) {
6810        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject()));
6811      }
6812    };
6813  }
6814
6815  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6816    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
6817    parseClaimResponseAddedItemSubDetailComponentProperties(json, res);
6818    return res;
6819  }
6820
6821  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
6822    parseBackboneElementProperties(json, res);
6823    if (json.has("productOrService"))
6824      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6825    if (json.has("modifier")) {
6826      JsonArray array = getJArray(json, "modifier");
6827      for (int i = 0; i < array.size(); i++) {
6828        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6829      }
6830    };
6831    if (json.has("quantity"))
6832      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6833    if (json.has("unitPrice"))
6834      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6835    if (json.has("factor"))
6836      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6837    if (json.has("_factor"))
6838      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6839    if (json.has("net"))
6840      res.setNet(parseMoney(getJObject(json, "net")));
6841    if (json.has("noteNumber")) {
6842      JsonArray array = getJArray(json, "noteNumber");
6843      for (int i = 0; i < array.size(); i++) {
6844        if (array.get(i).isJsonNull()) {
6845          res.getNoteNumber().add(new PositiveIntType());
6846        } else {;
6847          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6848        }
6849      }
6850    };
6851    if (json.has("_noteNumber")) {
6852      JsonArray array = getJArray(json, "_noteNumber");
6853      for (int i = 0; i < array.size(); i++) {
6854        if (i == res.getNoteNumber().size())
6855          res.getNoteNumber().add(parsePositiveInt(null));
6856        if (array.get(i) instanceof JsonObject) 
6857          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6858      }
6859    };
6860    if (json.has("adjudication")) {
6861      JsonArray array = getJArray(json, "adjudication");
6862      for (int i = 0; i < array.size(); i++) {
6863        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6864      }
6865    };
6866  }
6867
6868  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
6869    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
6870    parseClaimResponseTotalComponentProperties(json, res);
6871    return res;
6872  }
6873
6874  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
6875    parseBackboneElementProperties(json, res);
6876    if (json.has("category"))
6877      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6878    if (json.has("amount"))
6879      res.setAmount(parseMoney(getJObject(json, "amount")));
6880  }
6881
6882  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
6883    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
6884    parseClaimResponsePaymentComponentProperties(json, res);
6885    return res;
6886  }
6887
6888  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
6889    parseBackboneElementProperties(json, res);
6890    if (json.has("type"))
6891      res.setType(parseCodeableConcept(getJObject(json, "type")));
6892    if (json.has("adjustment"))
6893      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
6894    if (json.has("adjustmentReason"))
6895      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
6896    if (json.has("date"))
6897      res.setDateElement(parseDate(json.get("date").getAsString()));
6898    if (json.has("_date"))
6899      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6900    if (json.has("amount"))
6901      res.setAmount(parseMoney(getJObject(json, "amount")));
6902    if (json.has("identifier"))
6903      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6904  }
6905
6906  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
6907    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
6908    parseClaimResponseNoteComponentProperties(json, res);
6909    return res;
6910  }
6911
6912  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
6913    parseBackboneElementProperties(json, res);
6914    if (json.has("number"))
6915      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
6916    if (json.has("_number"))
6917      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
6918    if (json.has("type"))
6919      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
6920    if (json.has("_type"))
6921      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6922    if (json.has("text"))
6923      res.setTextElement(parseString(json.get("text").getAsString()));
6924    if (json.has("_text"))
6925      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6926    if (json.has("language"))
6927      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6928  }
6929
6930  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
6931    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
6932    parseClaimResponseInsuranceComponentProperties(json, res);
6933    return res;
6934  }
6935
6936  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
6937    parseBackboneElementProperties(json, res);
6938    if (json.has("sequence"))
6939      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6940    if (json.has("_sequence"))
6941      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6942    if (json.has("focal"))
6943      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6944    if (json.has("_focal"))
6945      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
6946    if (json.has("coverage"))
6947      res.setCoverage(parseReference(getJObject(json, "coverage")));
6948    if (json.has("businessArrangement"))
6949      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6950    if (json.has("_businessArrangement"))
6951      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
6952    if (json.has("claimResponse"))
6953      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
6954  }
6955
6956  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json) throws IOException, FHIRFormatError {
6957    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
6958    parseClaimResponseErrorComponentProperties(json, res);
6959    return res;
6960  }
6961
6962  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
6963    parseBackboneElementProperties(json, res);
6964    if (json.has("itemSequence"))
6965      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6966    if (json.has("_itemSequence"))
6967      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
6968    if (json.has("detailSequence"))
6969      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6970    if (json.has("_detailSequence"))
6971      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
6972    if (json.has("subDetailSequence"))
6973      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6974    if (json.has("_subDetailSequence"))
6975      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
6976    if (json.has("code"))
6977      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6978  }
6979
6980  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
6981    ClinicalImpression res = new ClinicalImpression();
6982    parseClinicalImpressionProperties(json, res);
6983    return res;
6984  }
6985
6986  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
6987    parseDomainResourceProperties(json, res);
6988    if (json.has("identifier")) {
6989      JsonArray array = getJArray(json, "identifier");
6990      for (int i = 0; i < array.size(); i++) {
6991        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6992      }
6993    };
6994    if (json.has("status"))
6995      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
6996    if (json.has("_status"))
6997      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6998    if (json.has("statusReason"))
6999      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
7000    if (json.has("code"))
7001      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7002    if (json.has("description"))
7003      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7004    if (json.has("_description"))
7005      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7006    if (json.has("subject"))
7007      res.setSubject(parseReference(getJObject(json, "subject")));
7008    if (json.has("encounter"))
7009      res.setEncounter(parseReference(getJObject(json, "encounter")));
7010    DataType effective = parseType("effective", json);
7011    if (effective != null)
7012      res.setEffective(effective);
7013    if (json.has("date"))
7014      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7015    if (json.has("_date"))
7016      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7017    if (json.has("assessor"))
7018      res.setAssessor(parseReference(getJObject(json, "assessor")));
7019    if (json.has("previous"))
7020      res.setPrevious(parseReference(getJObject(json, "previous")));
7021    if (json.has("problem")) {
7022      JsonArray array = getJArray(json, "problem");
7023      for (int i = 0; i < array.size(); i++) {
7024        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
7025      }
7026    };
7027    if (json.has("investigation")) {
7028      JsonArray array = getJArray(json, "investigation");
7029      for (int i = 0; i < array.size(); i++) {
7030        res.getInvestigation().add(parseClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject()));
7031      }
7032    };
7033    if (json.has("protocol")) {
7034      JsonArray array = getJArray(json, "protocol");
7035      for (int i = 0; i < array.size(); i++) {
7036        if (array.get(i).isJsonNull()) {
7037          res.getProtocol().add(new UriType());
7038        } else {;
7039          res.getProtocol().add(parseUri(array.get(i).getAsString()));
7040        }
7041      }
7042    };
7043    if (json.has("_protocol")) {
7044      JsonArray array = getJArray(json, "_protocol");
7045      for (int i = 0; i < array.size(); i++) {
7046        if (i == res.getProtocol().size())
7047          res.getProtocol().add(parseUri(null));
7048        if (array.get(i) instanceof JsonObject) 
7049          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
7050      }
7051    };
7052    if (json.has("summary"))
7053      res.setSummaryElement(parseString(json.get("summary").getAsString()));
7054    if (json.has("_summary"))
7055      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
7056    if (json.has("finding")) {
7057      JsonArray array = getJArray(json, "finding");
7058      for (int i = 0; i < array.size(); i++) {
7059        res.getFinding().add(parseClinicalImpressionFindingComponent(array.get(i).getAsJsonObject()));
7060      }
7061    };
7062    if (json.has("prognosisCodeableConcept")) {
7063      JsonArray array = getJArray(json, "prognosisCodeableConcept");
7064      for (int i = 0; i < array.size(); i++) {
7065        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7066      }
7067    };
7068    if (json.has("prognosisReference")) {
7069      JsonArray array = getJArray(json, "prognosisReference");
7070      for (int i = 0; i < array.size(); i++) {
7071        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
7072      }
7073    };
7074    if (json.has("supportingInfo")) {
7075      JsonArray array = getJArray(json, "supportingInfo");
7076      for (int i = 0; i < array.size(); i++) {
7077        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7078      }
7079    };
7080    if (json.has("note")) {
7081      JsonArray array = getJArray(json, "note");
7082      for (int i = 0; i < array.size(); i++) {
7083        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7084      }
7085    };
7086  }
7087
7088  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionInvestigationComponent(JsonObject json) throws IOException, FHIRFormatError {
7089    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
7090    parseClinicalImpressionInvestigationComponentProperties(json, res);
7091    return res;
7092  }
7093
7094  protected void parseClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
7095    parseBackboneElementProperties(json, res);
7096    if (json.has("code"))
7097      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7098    if (json.has("item")) {
7099      JsonArray array = getJArray(json, "item");
7100      for (int i = 0; i < array.size(); i++) {
7101        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
7102      }
7103    };
7104  }
7105
7106  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionFindingComponent(JsonObject json) throws IOException, FHIRFormatError {
7107    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
7108    parseClinicalImpressionFindingComponentProperties(json, res);
7109    return res;
7110  }
7111
7112  protected void parseClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
7113    parseBackboneElementProperties(json, res);
7114    if (json.has("itemCodeableConcept"))
7115      res.setItemCodeableConcept(parseCodeableConcept(getJObject(json, "itemCodeableConcept")));
7116    if (json.has("itemReference"))
7117      res.setItemReference(parseReference(getJObject(json, "itemReference")));
7118    if (json.has("basis"))
7119      res.setBasisElement(parseString(json.get("basis").getAsString()));
7120    if (json.has("_basis"))
7121      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
7122  }
7123
7124  protected ClinicalUseDefinition parseClinicalUseDefinition(JsonObject json) throws IOException, FHIRFormatError {
7125    ClinicalUseDefinition res = new ClinicalUseDefinition();
7126    parseClinicalUseDefinitionProperties(json, res);
7127    return res;
7128  }
7129
7130  protected void parseClinicalUseDefinitionProperties(JsonObject json, ClinicalUseDefinition res) throws IOException, FHIRFormatError {
7131    parseDomainResourceProperties(json, res);
7132    if (json.has("identifier")) {
7133      JsonArray array = getJArray(json, "identifier");
7134      for (int i = 0; i < array.size(); i++) {
7135        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7136      }
7137    };
7138    if (json.has("type"))
7139      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ClinicalUseDefinition.ClinicalUseIssueType.NULL, new ClinicalUseDefinition.ClinicalUseIssueTypeEnumFactory()));
7140    if (json.has("_type"))
7141      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7142    if (json.has("category")) {
7143      JsonArray array = getJArray(json, "category");
7144      for (int i = 0; i < array.size(); i++) {
7145        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7146      }
7147    };
7148    if (json.has("subject")) {
7149      JsonArray array = getJArray(json, "subject");
7150      for (int i = 0; i < array.size(); i++) {
7151        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7152      }
7153    };
7154    if (json.has("status"))
7155      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
7156    if (json.has("contraindication"))
7157      res.setContraindication(parseClinicalUseDefinitionContraindicationComponent(getJObject(json, "contraindication")));
7158    if (json.has("indication"))
7159      res.setIndication(parseClinicalUseDefinitionIndicationComponent(getJObject(json, "indication")));
7160    if (json.has("interaction"))
7161      res.setInteraction(parseClinicalUseDefinitionInteractionComponent(getJObject(json, "interaction")));
7162    if (json.has("population")) {
7163      JsonArray array = getJArray(json, "population");
7164      for (int i = 0; i < array.size(); i++) {
7165        res.getPopulation().add(parseReference(array.get(i).getAsJsonObject()));
7166      }
7167    };
7168    if (json.has("undesirableEffect"))
7169      res.setUndesirableEffect(parseClinicalUseDefinitionUndesirableEffectComponent(getJObject(json, "undesirableEffect")));
7170    if (json.has("warning"))
7171      res.setWarning(parseClinicalUseDefinitionWarningComponent(getJObject(json, "warning")));
7172  }
7173
7174  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent parseClinicalUseDefinitionContraindicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7175    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent();
7176    parseClinicalUseDefinitionContraindicationComponentProperties(json, res);
7177    return res;
7178  }
7179
7180  protected void parseClinicalUseDefinitionContraindicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res) throws IOException, FHIRFormatError {
7181    parseBackboneElementProperties(json, res);
7182    if (json.has("diseaseSymptomProcedure"))
7183      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
7184    if (json.has("diseaseStatus"))
7185      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
7186    if (json.has("comorbidity")) {
7187      JsonArray array = getJArray(json, "comorbidity");
7188      for (int i = 0; i < array.size(); i++) {
7189        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7190      }
7191    };
7192    if (json.has("indication")) {
7193      JsonArray array = getJArray(json, "indication");
7194      for (int i = 0; i < array.size(); i++) {
7195        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
7196      }
7197    };
7198    if (json.has("otherTherapy")) {
7199      JsonArray array = getJArray(json, "otherTherapy");
7200      for (int i = 0; i < array.size(); i++) {
7201        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7202      }
7203    };
7204  }
7205
7206  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent parseClinicalUseDefinitionContraindicationOtherTherapyComponent(JsonObject json) throws IOException, FHIRFormatError {
7207    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent();
7208    parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(json, res);
7209    return res;
7210  }
7211
7212  protected void parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
7213    parseBackboneElementProperties(json, res);
7214    if (json.has("relationshipType"))
7215      res.setRelationshipType(parseCodeableConcept(getJObject(json, "relationshipType")));
7216    if (json.has("therapy"))
7217      res.setTherapy(parseCodeableReference(getJObject(json, "therapy")));
7218  }
7219
7220  protected ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent parseClinicalUseDefinitionIndicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7221    ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent();
7222    parseClinicalUseDefinitionIndicationComponentProperties(json, res);
7223    return res;
7224  }
7225
7226  protected void parseClinicalUseDefinitionIndicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res) throws IOException, FHIRFormatError {
7227    parseBackboneElementProperties(json, res);
7228    if (json.has("diseaseSymptomProcedure"))
7229      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
7230    if (json.has("diseaseStatus"))
7231      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
7232    if (json.has("comorbidity")) {
7233      JsonArray array = getJArray(json, "comorbidity");
7234      for (int i = 0; i < array.size(); i++) {
7235        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7236      }
7237    };
7238    if (json.has("intendedEffect"))
7239      res.setIntendedEffect(parseCodeableReference(getJObject(json, "intendedEffect")));
7240    if (json.has("duration"))
7241      res.setDuration(parseQuantity(getJObject(json, "duration")));
7242    if (json.has("undesirableEffect")) {
7243      JsonArray array = getJArray(json, "undesirableEffect");
7244      for (int i = 0; i < array.size(); i++) {
7245        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
7246      }
7247    };
7248    if (json.has("otherTherapy")) {
7249      JsonArray array = getJArray(json, "otherTherapy");
7250      for (int i = 0; i < array.size(); i++) {
7251        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7252      }
7253    };
7254  }
7255
7256  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent parseClinicalUseDefinitionInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
7257    ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent();
7258    parseClinicalUseDefinitionInteractionComponentProperties(json, res);
7259    return res;
7260  }
7261
7262  protected void parseClinicalUseDefinitionInteractionComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res) throws IOException, FHIRFormatError {
7263    parseBackboneElementProperties(json, res);
7264    if (json.has("interactant")) {
7265      JsonArray array = getJArray(json, "interactant");
7266      for (int i = 0; i < array.size(); i++) {
7267        res.getInteractant().add(parseClinicalUseDefinitionInteractionInteractantComponent(array.get(i).getAsJsonObject()));
7268      }
7269    };
7270    if (json.has("type"))
7271      res.setType(parseCodeableConcept(getJObject(json, "type")));
7272    if (json.has("effect"))
7273      res.setEffect(parseCodeableReference(getJObject(json, "effect")));
7274    if (json.has("incidence"))
7275      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
7276    if (json.has("management")) {
7277      JsonArray array = getJArray(json, "management");
7278      for (int i = 0; i < array.size(); i++) {
7279        res.getManagement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7280      }
7281    };
7282  }
7283
7284  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent parseClinicalUseDefinitionInteractionInteractantComponent(JsonObject json) throws IOException, FHIRFormatError {
7285    ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent();
7286    parseClinicalUseDefinitionInteractionInteractantComponentProperties(json, res);
7287    return res;
7288  }
7289
7290  protected void parseClinicalUseDefinitionInteractionInteractantComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res) throws IOException, FHIRFormatError {
7291    parseBackboneElementProperties(json, res);
7292    DataType item = parseType("item", json);
7293    if (item != null)
7294      res.setItem(item);
7295  }
7296
7297  protected ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent parseClinicalUseDefinitionUndesirableEffectComponent(JsonObject json) throws IOException, FHIRFormatError {
7298    ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent();
7299    parseClinicalUseDefinitionUndesirableEffectComponentProperties(json, res);
7300    return res;
7301  }
7302
7303  protected void parseClinicalUseDefinitionUndesirableEffectComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res) throws IOException, FHIRFormatError {
7304    parseBackboneElementProperties(json, res);
7305    if (json.has("symptomConditionEffect"))
7306      res.setSymptomConditionEffect(parseCodeableReference(getJObject(json, "symptomConditionEffect")));
7307    if (json.has("classification"))
7308      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
7309    if (json.has("frequencyOfOccurrence"))
7310      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
7311  }
7312
7313  protected ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent parseClinicalUseDefinitionWarningComponent(JsonObject json) throws IOException, FHIRFormatError {
7314    ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent();
7315    parseClinicalUseDefinitionWarningComponentProperties(json, res);
7316    return res;
7317  }
7318
7319  protected void parseClinicalUseDefinitionWarningComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res) throws IOException, FHIRFormatError {
7320    parseBackboneElementProperties(json, res);
7321    if (json.has("description"))
7322      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7323    if (json.has("_description"))
7324      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7325    if (json.has("code"))
7326      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7327  }
7328
7329  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
7330    CodeSystem res = new CodeSystem();
7331    parseCodeSystemProperties(json, res);
7332    return res;
7333  }
7334
7335  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
7336    parseDomainResourceProperties(json, res);
7337    if (json.has("url"))
7338      res.setUrlElement(parseUri(json.get("url").getAsString()));
7339    if (json.has("_url"))
7340      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7341    if (json.has("identifier")) {
7342      JsonArray array = getJArray(json, "identifier");
7343      for (int i = 0; i < array.size(); i++) {
7344        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7345      }
7346    };
7347    if (json.has("version"))
7348      res.setVersionElement(parseString(json.get("version").getAsString()));
7349    if (json.has("_version"))
7350      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7351    if (json.has("name"))
7352      res.setNameElement(parseString(json.get("name").getAsString()));
7353    if (json.has("_name"))
7354      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7355    if (json.has("title"))
7356      res.setTitleElement(parseString(json.get("title").getAsString()));
7357    if (json.has("_title"))
7358      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7359    if (json.has("status"))
7360      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7361    if (json.has("_status"))
7362      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7363    if (json.has("experimental"))
7364      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7365    if (json.has("_experimental"))
7366      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7367    if (json.has("date"))
7368      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7369    if (json.has("_date"))
7370      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7371    if (json.has("publisher"))
7372      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7373    if (json.has("_publisher"))
7374      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7375    if (json.has("contact")) {
7376      JsonArray array = getJArray(json, "contact");
7377      for (int i = 0; i < array.size(); i++) {
7378        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7379      }
7380    };
7381    if (json.has("description"))
7382      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7383    if (json.has("_description"))
7384      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7385    if (json.has("useContext")) {
7386      JsonArray array = getJArray(json, "useContext");
7387      for (int i = 0; i < array.size(); i++) {
7388        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7389      }
7390    };
7391    if (json.has("jurisdiction")) {
7392      JsonArray array = getJArray(json, "jurisdiction");
7393      for (int i = 0; i < array.size(); i++) {
7394        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7395      }
7396    };
7397    if (json.has("purpose"))
7398      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7399    if (json.has("_purpose"))
7400      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
7401    if (json.has("copyright"))
7402      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7403    if (json.has("_copyright"))
7404      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7405    if (json.has("caseSensitive"))
7406      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
7407    if (json.has("_caseSensitive"))
7408      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
7409    if (json.has("valueSet"))
7410      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
7411    if (json.has("_valueSet"))
7412      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
7413    if (json.has("hierarchyMeaning"))
7414      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
7415    if (json.has("_hierarchyMeaning"))
7416      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
7417    if (json.has("compositional"))
7418      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
7419    if (json.has("_compositional"))
7420      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
7421    if (json.has("versionNeeded"))
7422      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
7423    if (json.has("_versionNeeded"))
7424      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
7425    if (json.has("content"))
7426      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
7427    if (json.has("_content"))
7428      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
7429    if (json.has("supplements"))
7430      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
7431    if (json.has("_supplements"))
7432      parseElementProperties(getJObject(json, "_supplements"), res.getSupplementsElement());
7433    if (json.has("count"))
7434      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
7435    if (json.has("_count"))
7436      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
7437    if (json.has("filter")) {
7438      JsonArray array = getJArray(json, "filter");
7439      for (int i = 0; i < array.size(); i++) {
7440        res.getFilter().add(parseCodeSystemFilterComponent(array.get(i).getAsJsonObject()));
7441      }
7442    };
7443    if (json.has("property")) {
7444      JsonArray array = getJArray(json, "property");
7445      for (int i = 0; i < array.size(); i++) {
7446        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject()));
7447      }
7448    };
7449    if (json.has("concept")) {
7450      JsonArray array = getJArray(json, "concept");
7451      for (int i = 0; i < array.size(); i++) {
7452        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
7453      }
7454    };
7455  }
7456
7457  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
7458    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
7459    parseCodeSystemFilterComponentProperties(json, res);
7460    return res;
7461  }
7462
7463  protected void parseCodeSystemFilterComponentProperties(JsonObject json, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
7464    parseBackboneElementProperties(json, res);
7465    if (json.has("code"))
7466      res.setCodeElement(parseCode(json.get("code").getAsString()));
7467    if (json.has("_code"))
7468      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7469    if (json.has("description"))
7470      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7471    if (json.has("_description"))
7472      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7473    if (json.has("operator")) {
7474      JsonArray array = getJArray(json, "operator");
7475      for (int i = 0; i < array.size(); i++) {
7476        if (array.get(i).isJsonNull()) {
7477          res.getOperator().add(new Enumeration<Enumerations.FilterOperator>(new Enumerations.FilterOperatorEnumFactory(), Enumerations.FilterOperator.NULL));
7478        } else {;
7479          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
7480        }
7481      }
7482    };
7483    if (json.has("_operator")) {
7484      JsonArray array = getJArray(json, "_operator");
7485      for (int i = 0; i < array.size(); i++) {
7486        if (i == res.getOperator().size())
7487          res.getOperator().add(parseEnumeration(null, Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
7488        if (array.get(i) instanceof JsonObject) 
7489          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
7490      }
7491    };
7492    if (json.has("value"))
7493      res.setValueElement(parseString(json.get("value").getAsString()));
7494    if (json.has("_value"))
7495      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7496  }
7497
7498  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
7499    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
7500    parseCodeSystemPropertyComponentProperties(json, res);
7501    return res;
7502  }
7503
7504  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
7505    parseBackboneElementProperties(json, res);
7506    if (json.has("code"))
7507      res.setCodeElement(parseCode(json.get("code").getAsString()));
7508    if (json.has("_code"))
7509      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7510    if (json.has("uri"))
7511      res.setUriElement(parseUri(json.get("uri").getAsString()));
7512    if (json.has("_uri"))
7513      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
7514    if (json.has("description"))
7515      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7516    if (json.has("_description"))
7517      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7518    if (json.has("type"))
7519      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
7520    if (json.has("_type"))
7521      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7522  }
7523
7524  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
7525    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
7526    parseCodeSystemConceptDefinitionComponentProperties(json, res);
7527    return res;
7528  }
7529
7530  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionComponent 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(getJObject(json, "_code"), res.getCodeElement());
7536    if (json.has("display"))
7537      res.setDisplayElement(parseString(json.get("display").getAsString()));
7538    if (json.has("_display"))
7539      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7540    if (json.has("definition"))
7541      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
7542    if (json.has("_definition"))
7543      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
7544    if (json.has("designation")) {
7545      JsonArray array = getJArray(json, "designation");
7546      for (int i = 0; i < array.size(); i++) {
7547        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject()));
7548      }
7549    };
7550    if (json.has("property")) {
7551      JsonArray array = getJArray(json, "property");
7552      for (int i = 0; i < array.size(); i++) {
7553        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject()));
7554      }
7555    };
7556    if (json.has("concept")) {
7557      JsonArray array = getJArray(json, "concept");
7558      for (int i = 0; i < array.size(); i++) {
7559        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
7560      }
7561    };
7562  }
7563
7564  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
7565    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
7566    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, res);
7567    return res;
7568  }
7569
7570  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
7571    parseBackboneElementProperties(json, res);
7572    if (json.has("language"))
7573      res.setLanguageElement(parseCode(json.get("language").getAsString()));
7574    if (json.has("_language"))
7575      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
7576    if (json.has("use"))
7577      res.setUse(parseCoding(getJObject(json, "use")));
7578    if (json.has("value"))
7579      res.setValueElement(parseString(json.get("value").getAsString()));
7580    if (json.has("_value"))
7581      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7582  }
7583
7584  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
7585    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
7586    parseCodeSystemConceptPropertyComponentProperties(json, res);
7587    return res;
7588  }
7589
7590  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
7591    parseBackboneElementProperties(json, res);
7592    if (json.has("code"))
7593      res.setCodeElement(parseCode(json.get("code").getAsString()));
7594    if (json.has("_code"))
7595      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7596    DataType value = parseType("value", json);
7597    if (value != null)
7598      res.setValue(value);
7599  }
7600
7601  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
7602    Communication res = new Communication();
7603    parseCommunicationProperties(json, res);
7604    return res;
7605  }
7606
7607  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
7608    parseDomainResourceProperties(json, res);
7609    if (json.has("identifier")) {
7610      JsonArray array = getJArray(json, "identifier");
7611      for (int i = 0; i < array.size(); i++) {
7612        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7613      }
7614    };
7615    if (json.has("instantiatesCanonical")) {
7616      JsonArray array = getJArray(json, "instantiatesCanonical");
7617      for (int i = 0; i < array.size(); i++) {
7618        if (array.get(i).isJsonNull()) {
7619          res.getInstantiatesCanonical().add(new CanonicalType());
7620        } else {;
7621          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
7622        }
7623      }
7624    };
7625    if (json.has("_instantiatesCanonical")) {
7626      JsonArray array = getJArray(json, "_instantiatesCanonical");
7627      for (int i = 0; i < array.size(); i++) {
7628        if (i == res.getInstantiatesCanonical().size())
7629          res.getInstantiatesCanonical().add(parseCanonical(null));
7630        if (array.get(i) instanceof JsonObject) 
7631          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
7632      }
7633    };
7634    if (json.has("instantiatesUri")) {
7635      JsonArray array = getJArray(json, "instantiatesUri");
7636      for (int i = 0; i < array.size(); i++) {
7637        if (array.get(i).isJsonNull()) {
7638          res.getInstantiatesUri().add(new UriType());
7639        } else {;
7640          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
7641        }
7642      }
7643    };
7644    if (json.has("_instantiatesUri")) {
7645      JsonArray array = getJArray(json, "_instantiatesUri");
7646      for (int i = 0; i < array.size(); i++) {
7647        if (i == res.getInstantiatesUri().size())
7648          res.getInstantiatesUri().add(parseUri(null));
7649        if (array.get(i) instanceof JsonObject) 
7650          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
7651      }
7652    };
7653    if (json.has("basedOn")) {
7654      JsonArray array = getJArray(json, "basedOn");
7655      for (int i = 0; i < array.size(); i++) {
7656        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7657      }
7658    };
7659    if (json.has("partOf")) {
7660      JsonArray array = getJArray(json, "partOf");
7661      for (int i = 0; i < array.size(); i++) {
7662        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
7663      }
7664    };
7665    if (json.has("inResponseTo")) {
7666      JsonArray array = getJArray(json, "inResponseTo");
7667      for (int i = 0; i < array.size(); i++) {
7668        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
7669      }
7670    };
7671    if (json.has("status"))
7672      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
7673    if (json.has("_status"))
7674      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7675    if (json.has("statusReason"))
7676      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
7677    if (json.has("category")) {
7678      JsonArray array = getJArray(json, "category");
7679      for (int i = 0; i < array.size(); i++) {
7680        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7681      }
7682    };
7683    if (json.has("priority"))
7684      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
7685    if (json.has("_priority"))
7686      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
7687    if (json.has("medium")) {
7688      JsonArray array = getJArray(json, "medium");
7689      for (int i = 0; i < array.size(); i++) {
7690        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7691      }
7692    };
7693    if (json.has("subject"))
7694      res.setSubject(parseReference(getJObject(json, "subject")));
7695    if (json.has("topic"))
7696      res.setTopic(parseCodeableConcept(getJObject(json, "topic")));
7697    if (json.has("about")) {
7698      JsonArray array = getJArray(json, "about");
7699      for (int i = 0; i < array.size(); i++) {
7700        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7701      }
7702    };
7703    if (json.has("encounter"))
7704      res.setEncounter(parseReference(getJObject(json, "encounter")));
7705    if (json.has("sent"))
7706      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
7707    if (json.has("_sent"))
7708      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
7709    if (json.has("received"))
7710      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
7711    if (json.has("_received"))
7712      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
7713    if (json.has("recipient")) {
7714      JsonArray array = getJArray(json, "recipient");
7715      for (int i = 0; i < array.size(); i++) {
7716        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7717      }
7718    };
7719    if (json.has("sender"))
7720      res.setSender(parseReference(getJObject(json, "sender")));
7721    if (json.has("reasonCode")) {
7722      JsonArray array = getJArray(json, "reasonCode");
7723      for (int i = 0; i < array.size(); i++) {
7724        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7725      }
7726    };
7727    if (json.has("reasonReference")) {
7728      JsonArray array = getJArray(json, "reasonReference");
7729      for (int i = 0; i < array.size(); i++) {
7730        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7731      }
7732    };
7733    if (json.has("payload")) {
7734      JsonArray array = getJArray(json, "payload");
7735      for (int i = 0; i < array.size(); i++) {
7736        res.getPayload().add(parseCommunicationPayloadComponent(array.get(i).getAsJsonObject()));
7737      }
7738    };
7739    if (json.has("note")) {
7740      JsonArray array = getJArray(json, "note");
7741      for (int i = 0; i < array.size(); i++) {
7742        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7743      }
7744    };
7745  }
7746
7747  protected Communication.CommunicationPayloadComponent parseCommunicationPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
7748    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
7749    parseCommunicationPayloadComponentProperties(json, res);
7750    return res;
7751  }
7752
7753  protected void parseCommunicationPayloadComponentProperties(JsonObject json, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
7754    parseBackboneElementProperties(json, res);
7755    DataType content = parseType("content", json);
7756    if (content != null)
7757      res.setContent(content);
7758  }
7759
7760  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
7761    CommunicationRequest res = new CommunicationRequest();
7762    parseCommunicationRequestProperties(json, res);
7763    return res;
7764  }
7765
7766  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
7767    parseDomainResourceProperties(json, res);
7768    if (json.has("identifier")) {
7769      JsonArray array = getJArray(json, "identifier");
7770      for (int i = 0; i < array.size(); i++) {
7771        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7772      }
7773    };
7774    if (json.has("basedOn")) {
7775      JsonArray array = getJArray(json, "basedOn");
7776      for (int i = 0; i < array.size(); i++) {
7777        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7778      }
7779    };
7780    if (json.has("replaces")) {
7781      JsonArray array = getJArray(json, "replaces");
7782      for (int i = 0; i < array.size(); i++) {
7783        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
7784      }
7785    };
7786    if (json.has("groupIdentifier"))
7787      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
7788    if (json.has("status"))
7789      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
7790    if (json.has("_status"))
7791      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7792    if (json.has("statusReason"))
7793      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
7794    if (json.has("category")) {
7795      JsonArray array = getJArray(json, "category");
7796      for (int i = 0; i < array.size(); i++) {
7797        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7798      }
7799    };
7800    if (json.has("priority"))
7801      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
7802    if (json.has("_priority"))
7803      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
7804    if (json.has("doNotPerform"))
7805      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
7806    if (json.has("_doNotPerform"))
7807      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
7808    if (json.has("medium")) {
7809      JsonArray array = getJArray(json, "medium");
7810      for (int i = 0; i < array.size(); i++) {
7811        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7812      }
7813    };
7814    if (json.has("subject"))
7815      res.setSubject(parseReference(getJObject(json, "subject")));
7816    if (json.has("about")) {
7817      JsonArray array = getJArray(json, "about");
7818      for (int i = 0; i < array.size(); i++) {
7819        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7820      }
7821    };
7822    if (json.has("encounter"))
7823      res.setEncounter(parseReference(getJObject(json, "encounter")));
7824    if (json.has("payload")) {
7825      JsonArray array = getJArray(json, "payload");
7826      for (int i = 0; i < array.size(); i++) {
7827        res.getPayload().add(parseCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject()));
7828      }
7829    };
7830    DataType occurrence = parseType("occurrence", json);
7831    if (occurrence != null)
7832      res.setOccurrence(occurrence);
7833    if (json.has("authoredOn"))
7834      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7835    if (json.has("_authoredOn"))
7836      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
7837    if (json.has("requester"))
7838      res.setRequester(parseReference(getJObject(json, "requester")));
7839    if (json.has("recipient")) {
7840      JsonArray array = getJArray(json, "recipient");
7841      for (int i = 0; i < array.size(); i++) {
7842        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7843      }
7844    };
7845    if (json.has("sender"))
7846      res.setSender(parseReference(getJObject(json, "sender")));
7847    if (json.has("reasonCode")) {
7848      JsonArray array = getJArray(json, "reasonCode");
7849      for (int i = 0; i < array.size(); i++) {
7850        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7851      }
7852    };
7853    if (json.has("reasonReference")) {
7854      JsonArray array = getJArray(json, "reasonReference");
7855      for (int i = 0; i < array.size(); i++) {
7856        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7857      }
7858    };
7859    if (json.has("note")) {
7860      JsonArray array = getJArray(json, "note");
7861      for (int i = 0; i < array.size(); i++) {
7862        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7863      }
7864    };
7865  }
7866
7867  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
7868    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
7869    parseCommunicationRequestPayloadComponentProperties(json, res);
7870    return res;
7871  }
7872
7873  protected void parseCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
7874    parseBackboneElementProperties(json, res);
7875    DataType content = parseType("content", json);
7876    if (content != null)
7877      res.setContent(content);
7878  }
7879
7880  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
7881    CompartmentDefinition res = new CompartmentDefinition();
7882    parseCompartmentDefinitionProperties(json, res);
7883    return res;
7884  }
7885
7886  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
7887    parseDomainResourceProperties(json, res);
7888    if (json.has("url"))
7889      res.setUrlElement(parseUri(json.get("url").getAsString()));
7890    if (json.has("_url"))
7891      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7892    if (json.has("version"))
7893      res.setVersionElement(parseString(json.get("version").getAsString()));
7894    if (json.has("_version"))
7895      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7896    if (json.has("name"))
7897      res.setNameElement(parseString(json.get("name").getAsString()));
7898    if (json.has("_name"))
7899      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7900    if (json.has("status"))
7901      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7902    if (json.has("_status"))
7903      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7904    if (json.has("experimental"))
7905      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7906    if (json.has("_experimental"))
7907      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7908    if (json.has("date"))
7909      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7910    if (json.has("_date"))
7911      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7912    if (json.has("publisher"))
7913      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7914    if (json.has("_publisher"))
7915      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7916    if (json.has("contact")) {
7917      JsonArray array = getJArray(json, "contact");
7918      for (int i = 0; i < array.size(); i++) {
7919        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7920      }
7921    };
7922    if (json.has("description"))
7923      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7924    if (json.has("_description"))
7925      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7926    if (json.has("useContext")) {
7927      JsonArray array = getJArray(json, "useContext");
7928      for (int i = 0; i < array.size(); i++) {
7929        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7930      }
7931    };
7932    if (json.has("purpose"))
7933      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7934    if (json.has("_purpose"))
7935      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
7936    if (json.has("code"))
7937      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
7938    if (json.has("_code"))
7939      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7940    if (json.has("search"))
7941      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
7942    if (json.has("_search"))
7943      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
7944    if (json.has("resource")) {
7945      JsonArray array = getJArray(json, "resource");
7946      for (int i = 0; i < array.size(); i++) {
7947        res.getResource().add(parseCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject()));
7948      }
7949    };
7950  }
7951
7952  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
7953    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
7954    parseCompartmentDefinitionResourceComponentProperties(json, res);
7955    return res;
7956  }
7957
7958  protected void parseCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
7959    parseBackboneElementProperties(json, res);
7960    if (json.has("code"))
7961      res.setCodeElement(parseCode(json.get("code").getAsString()));
7962    if (json.has("_code"))
7963      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7964    if (json.has("param")) {
7965      JsonArray array = getJArray(json, "param");
7966      for (int i = 0; i < array.size(); i++) {
7967        if (array.get(i).isJsonNull()) {
7968          res.getParam().add(new StringType());
7969        } else {;
7970          res.getParam().add(parseString(array.get(i).getAsString()));
7971        }
7972      }
7973    };
7974    if (json.has("_param")) {
7975      JsonArray array = getJArray(json, "_param");
7976      for (int i = 0; i < array.size(); i++) {
7977        if (i == res.getParam().size())
7978          res.getParam().add(parseString(null));
7979        if (array.get(i) instanceof JsonObject) 
7980          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
7981      }
7982    };
7983    if (json.has("documentation"))
7984      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
7985    if (json.has("_documentation"))
7986      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
7987  }
7988
7989  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
7990    Composition res = new Composition();
7991    parseCompositionProperties(json, res);
7992    return res;
7993  }
7994
7995  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
7996    parseDomainResourceProperties(json, res);
7997    if (json.has("identifier"))
7998      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7999    if (json.has("status"))
8000      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
8001    if (json.has("_status"))
8002      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8003    if (json.has("type"))
8004      res.setType(parseCodeableConcept(getJObject(json, "type")));
8005    if (json.has("category")) {
8006      JsonArray array = getJArray(json, "category");
8007      for (int i = 0; i < array.size(); i++) {
8008        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8009      }
8010    };
8011    if (json.has("subject"))
8012      res.setSubject(parseReference(getJObject(json, "subject")));
8013    if (json.has("encounter"))
8014      res.setEncounter(parseReference(getJObject(json, "encounter")));
8015    if (json.has("date"))
8016      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8017    if (json.has("_date"))
8018      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8019    if (json.has("author")) {
8020      JsonArray array = getJArray(json, "author");
8021      for (int i = 0; i < array.size(); i++) {
8022        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
8023      }
8024    };
8025    if (json.has("title"))
8026      res.setTitleElement(parseString(json.get("title").getAsString()));
8027    if (json.has("_title"))
8028      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8029    if (json.has("confidentiality"))
8030      res.setConfidentialityElement(parseCode(json.get("confidentiality").getAsString()));
8031    if (json.has("_confidentiality"))
8032      parseElementProperties(getJObject(json, "_confidentiality"), res.getConfidentialityElement());
8033    if (json.has("attester")) {
8034      JsonArray array = getJArray(json, "attester");
8035      for (int i = 0; i < array.size(); i++) {
8036        res.getAttester().add(parseCompositionAttesterComponent(array.get(i).getAsJsonObject()));
8037      }
8038    };
8039    if (json.has("custodian"))
8040      res.setCustodian(parseReference(getJObject(json, "custodian")));
8041    if (json.has("relatesTo")) {
8042      JsonArray array = getJArray(json, "relatesTo");
8043      for (int i = 0; i < array.size(); i++) {
8044        res.getRelatesTo().add(parseCompositionRelatesToComponent(array.get(i).getAsJsonObject()));
8045      }
8046    };
8047    if (json.has("event")) {
8048      JsonArray array = getJArray(json, "event");
8049      for (int i = 0; i < array.size(); i++) {
8050        res.getEvent().add(parseCompositionEventComponent(array.get(i).getAsJsonObject()));
8051      }
8052    };
8053    if (json.has("section")) {
8054      JsonArray array = getJArray(json, "section");
8055      for (int i = 0; i < array.size(); i++) {
8056        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
8057      }
8058    };
8059  }
8060
8061  protected Composition.CompositionAttesterComponent parseCompositionAttesterComponent(JsonObject json) throws IOException, FHIRFormatError {
8062    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
8063    parseCompositionAttesterComponentProperties(json, res);
8064    return res;
8065  }
8066
8067  protected void parseCompositionAttesterComponentProperties(JsonObject json, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
8068    parseBackboneElementProperties(json, res);
8069    if (json.has("mode"))
8070      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
8071    if (json.has("_mode"))
8072      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
8073    if (json.has("time"))
8074      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
8075    if (json.has("_time"))
8076      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
8077    if (json.has("party"))
8078      res.setParty(parseReference(getJObject(json, "party")));
8079  }
8080
8081  protected Composition.CompositionRelatesToComponent parseCompositionRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
8082    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
8083    parseCompositionRelatesToComponentProperties(json, res);
8084    return res;
8085  }
8086
8087  protected void parseCompositionRelatesToComponentProperties(JsonObject json, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
8088    parseBackboneElementProperties(json, res);
8089    if (json.has("code"))
8090      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.DocumentRelationshipType.NULL, new Enumerations.DocumentRelationshipTypeEnumFactory()));
8091    if (json.has("_code"))
8092      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8093    DataType target = parseType("target", json);
8094    if (target != null)
8095      res.setTarget(target);
8096  }
8097
8098  protected Composition.CompositionEventComponent parseCompositionEventComponent(JsonObject json) throws IOException, FHIRFormatError {
8099    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
8100    parseCompositionEventComponentProperties(json, res);
8101    return res;
8102  }
8103
8104  protected void parseCompositionEventComponentProperties(JsonObject json, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
8105    parseBackboneElementProperties(json, res);
8106    if (json.has("code")) {
8107      JsonArray array = getJArray(json, "code");
8108      for (int i = 0; i < array.size(); i++) {
8109        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8110      }
8111    };
8112    if (json.has("period"))
8113      res.setPeriod(parsePeriod(getJObject(json, "period")));
8114    if (json.has("detail")) {
8115      JsonArray array = getJArray(json, "detail");
8116      for (int i = 0; i < array.size(); i++) {
8117        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8118      }
8119    };
8120  }
8121
8122  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json) throws IOException, FHIRFormatError {
8123    Composition.SectionComponent res = new Composition.SectionComponent();
8124    parseCompositionSectionComponentProperties(json, res);
8125    return res;
8126  }
8127
8128  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition.SectionComponent res) throws IOException, FHIRFormatError {
8129    parseBackboneElementProperties(json, res);
8130    if (json.has("title"))
8131      res.setTitleElement(parseString(json.get("title").getAsString()));
8132    if (json.has("_title"))
8133      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8134    if (json.has("code"))
8135      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8136    if (json.has("author")) {
8137      JsonArray array = getJArray(json, "author");
8138      for (int i = 0; i < array.size(); i++) {
8139        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
8140      }
8141    };
8142    if (json.has("focus"))
8143      res.setFocus(parseReference(getJObject(json, "focus")));
8144    if (json.has("text"))
8145      res.setText(parseNarrative(getJObject(json, "text")));
8146    if (json.has("mode"))
8147      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
8148    if (json.has("_mode"))
8149      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
8150    if (json.has("orderedBy"))
8151      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
8152    if (json.has("entry")) {
8153      JsonArray array = getJArray(json, "entry");
8154      for (int i = 0; i < array.size(); i++) {
8155        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
8156      }
8157    };
8158    if (json.has("emptyReason"))
8159      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
8160    if (json.has("section")) {
8161      JsonArray array = getJArray(json, "section");
8162      for (int i = 0; i < array.size(); i++) {
8163        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
8164      }
8165    };
8166  }
8167
8168  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
8169    ConceptMap res = new ConceptMap();
8170    parseConceptMapProperties(json, res);
8171    return res;
8172  }
8173
8174  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
8175    parseDomainResourceProperties(json, res);
8176    if (json.has("url"))
8177      res.setUrlElement(parseUri(json.get("url").getAsString()));
8178    if (json.has("_url"))
8179      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8180    if (json.has("identifier"))
8181      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8182    if (json.has("version"))
8183      res.setVersionElement(parseString(json.get("version").getAsString()));
8184    if (json.has("_version"))
8185      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8186    if (json.has("name"))
8187      res.setNameElement(parseString(json.get("name").getAsString()));
8188    if (json.has("_name"))
8189      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8190    if (json.has("title"))
8191      res.setTitleElement(parseString(json.get("title").getAsString()));
8192    if (json.has("_title"))
8193      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8194    if (json.has("status"))
8195      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8196    if (json.has("_status"))
8197      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8198    if (json.has("experimental"))
8199      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8200    if (json.has("_experimental"))
8201      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8202    if (json.has("date"))
8203      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8204    if (json.has("_date"))
8205      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8206    if (json.has("publisher"))
8207      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8208    if (json.has("_publisher"))
8209      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8210    if (json.has("contact")) {
8211      JsonArray array = getJArray(json, "contact");
8212      for (int i = 0; i < array.size(); i++) {
8213        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8214      }
8215    };
8216    if (json.has("description"))
8217      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8218    if (json.has("_description"))
8219      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8220    if (json.has("useContext")) {
8221      JsonArray array = getJArray(json, "useContext");
8222      for (int i = 0; i < array.size(); i++) {
8223        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8224      }
8225    };
8226    if (json.has("jurisdiction")) {
8227      JsonArray array = getJArray(json, "jurisdiction");
8228      for (int i = 0; i < array.size(); i++) {
8229        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8230      }
8231    };
8232    if (json.has("purpose"))
8233      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
8234    if (json.has("_purpose"))
8235      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
8236    if (json.has("copyright"))
8237      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8238    if (json.has("_copyright"))
8239      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
8240    DataType source = parseType("source", json);
8241    if (source != null)
8242      res.setSource(source);
8243    DataType target = parseType("target", json);
8244    if (target != null)
8245      res.setTarget(target);
8246    if (json.has("group")) {
8247      JsonArray array = getJArray(json, "group");
8248      for (int i = 0; i < array.size(); i++) {
8249        res.getGroup().add(parseConceptMapGroupComponent(array.get(i).getAsJsonObject()));
8250      }
8251    };
8252  }
8253
8254  protected ConceptMap.ConceptMapGroupComponent parseConceptMapGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
8255    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
8256    parseConceptMapGroupComponentProperties(json, res);
8257    return res;
8258  }
8259
8260  protected void parseConceptMapGroupComponentProperties(JsonObject json, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
8261    parseBackboneElementProperties(json, res);
8262    if (json.has("source"))
8263      res.setSourceElement(parseUri(json.get("source").getAsString()));
8264    if (json.has("_source"))
8265      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
8266    if (json.has("sourceVersion"))
8267      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
8268    if (json.has("_sourceVersion"))
8269      parseElementProperties(getJObject(json, "_sourceVersion"), res.getSourceVersionElement());
8270    if (json.has("target"))
8271      res.setTargetElement(parseUri(json.get("target").getAsString()));
8272    if (json.has("_target"))
8273      parseElementProperties(getJObject(json, "_target"), res.getTargetElement());
8274    if (json.has("targetVersion"))
8275      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
8276    if (json.has("_targetVersion"))
8277      parseElementProperties(getJObject(json, "_targetVersion"), res.getTargetVersionElement());
8278    if (json.has("element")) {
8279      JsonArray array = getJArray(json, "element");
8280      for (int i = 0; i < array.size(); i++) {
8281        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject()));
8282      }
8283    };
8284    if (json.has("unmapped"))
8285      res.setUnmapped(parseConceptMapGroupUnmappedComponent(getJObject(json, "unmapped")));
8286  }
8287
8288  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json) throws IOException, FHIRFormatError {
8289    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
8290    parseConceptMapSourceElementComponentProperties(json, res);
8291    return res;
8292  }
8293
8294  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
8295    parseBackboneElementProperties(json, res);
8296    if (json.has("code"))
8297      res.setCodeElement(parseCode(json.get("code").getAsString()));
8298    if (json.has("_code"))
8299      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8300    if (json.has("display"))
8301      res.setDisplayElement(parseString(json.get("display").getAsString()));
8302    if (json.has("_display"))
8303      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8304    if (json.has("target")) {
8305      JsonArray array = getJArray(json, "target");
8306      for (int i = 0; i < array.size(); i++) {
8307        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject()));
8308      }
8309    };
8310  }
8311
8312  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json) throws IOException, FHIRFormatError {
8313    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
8314    parseConceptMapTargetElementComponentProperties(json, res);
8315    return res;
8316  }
8317
8318  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
8319    parseBackboneElementProperties(json, res);
8320    if (json.has("code"))
8321      res.setCodeElement(parseCode(json.get("code").getAsString()));
8322    if (json.has("_code"))
8323      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8324    if (json.has("display"))
8325      res.setDisplayElement(parseString(json.get("display").getAsString()));
8326    if (json.has("_display"))
8327      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8328    if (json.has("equivalence"))
8329      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), ConceptMap.ConceptMapEquivalence.NULL, new ConceptMap.ConceptMapEquivalenceEnumFactory()));
8330    if (json.has("_equivalence"))
8331      parseElementProperties(getJObject(json, "_equivalence"), res.getEquivalenceElement());
8332    if (json.has("comment"))
8333      res.setCommentElement(parseString(json.get("comment").getAsString()));
8334    if (json.has("_comment"))
8335      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
8336    if (json.has("dependsOn")) {
8337      JsonArray array = getJArray(json, "dependsOn");
8338      for (int i = 0; i < array.size(); i++) {
8339        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject()));
8340      }
8341    };
8342    if (json.has("product")) {
8343      JsonArray array = getJArray(json, "product");
8344      for (int i = 0; i < array.size(); i++) {
8345        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject()));
8346      }
8347    };
8348  }
8349
8350  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json) throws IOException, FHIRFormatError {
8351    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
8352    parseConceptMapOtherElementComponentProperties(json, res);
8353    return res;
8354  }
8355
8356  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
8357    parseBackboneElementProperties(json, res);
8358    if (json.has("property"))
8359      res.setPropertyElement(parseUri(json.get("property").getAsString()));
8360    if (json.has("_property"))
8361      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
8362    if (json.has("system"))
8363      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
8364    if (json.has("_system"))
8365      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
8366    if (json.has("value"))
8367      res.setValueElement(parseString(json.get("value").getAsString()));
8368    if (json.has("_value"))
8369      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8370    if (json.has("display"))
8371      res.setDisplayElement(parseString(json.get("display").getAsString()));
8372    if (json.has("_display"))
8373      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8374  }
8375
8376  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapGroupUnmappedComponent(JsonObject json) throws IOException, FHIRFormatError {
8377    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
8378    parseConceptMapGroupUnmappedComponentProperties(json, res);
8379    return res;
8380  }
8381
8382  protected void parseConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
8383    parseBackboneElementProperties(json, res);
8384    if (json.has("mode"))
8385      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
8386    if (json.has("_mode"))
8387      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
8388    if (json.has("code"))
8389      res.setCodeElement(parseCode(json.get("code").getAsString()));
8390    if (json.has("_code"))
8391      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8392    if (json.has("display"))
8393      res.setDisplayElement(parseString(json.get("display").getAsString()));
8394    if (json.has("_display"))
8395      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8396    if (json.has("url"))
8397      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
8398    if (json.has("_url"))
8399      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8400  }
8401
8402  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
8403    Condition res = new Condition();
8404    parseConditionProperties(json, res);
8405    return res;
8406  }
8407
8408  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
8409    parseDomainResourceProperties(json, res);
8410    if (json.has("identifier")) {
8411      JsonArray array = getJArray(json, "identifier");
8412      for (int i = 0; i < array.size(); i++) {
8413        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8414      }
8415    };
8416    if (json.has("clinicalStatus"))
8417      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
8418    if (json.has("verificationStatus"))
8419      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
8420    if (json.has("category")) {
8421      JsonArray array = getJArray(json, "category");
8422      for (int i = 0; i < array.size(); i++) {
8423        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8424      }
8425    };
8426    if (json.has("severity"))
8427      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
8428    if (json.has("code"))
8429      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8430    if (json.has("bodySite")) {
8431      JsonArray array = getJArray(json, "bodySite");
8432      for (int i = 0; i < array.size(); i++) {
8433        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8434      }
8435    };
8436    if (json.has("subject"))
8437      res.setSubject(parseReference(getJObject(json, "subject")));
8438    if (json.has("encounter"))
8439      res.setEncounter(parseReference(getJObject(json, "encounter")));
8440    DataType onset = parseType("onset", json);
8441    if (onset != null)
8442      res.setOnset(onset);
8443    DataType abatement = parseType("abatement", json);
8444    if (abatement != null)
8445      res.setAbatement(abatement);
8446    if (json.has("recordedDate"))
8447      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
8448    if (json.has("_recordedDate"))
8449      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
8450    if (json.has("recorder"))
8451      res.setRecorder(parseReference(getJObject(json, "recorder")));
8452    if (json.has("asserter"))
8453      res.setAsserter(parseReference(getJObject(json, "asserter")));
8454    if (json.has("stage")) {
8455      JsonArray array = getJArray(json, "stage");
8456      for (int i = 0; i < array.size(); i++) {
8457        res.getStage().add(parseConditionStageComponent(array.get(i).getAsJsonObject()));
8458      }
8459    };
8460    if (json.has("evidence")) {
8461      JsonArray array = getJArray(json, "evidence");
8462      for (int i = 0; i < array.size(); i++) {
8463        res.getEvidence().add(parseConditionEvidenceComponent(array.get(i).getAsJsonObject()));
8464      }
8465    };
8466    if (json.has("note")) {
8467      JsonArray array = getJArray(json, "note");
8468      for (int i = 0; i < array.size(); i++) {
8469        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8470      }
8471    };
8472  }
8473
8474  protected Condition.ConditionStageComponent parseConditionStageComponent(JsonObject json) throws IOException, FHIRFormatError {
8475    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
8476    parseConditionStageComponentProperties(json, res);
8477    return res;
8478  }
8479
8480  protected void parseConditionStageComponentProperties(JsonObject json, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
8481    parseBackboneElementProperties(json, res);
8482    if (json.has("summary"))
8483      res.setSummary(parseCodeableConcept(getJObject(json, "summary")));
8484    if (json.has("assessment")) {
8485      JsonArray array = getJArray(json, "assessment");
8486      for (int i = 0; i < array.size(); i++) {
8487        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
8488      }
8489    };
8490    if (json.has("type"))
8491      res.setType(parseCodeableConcept(getJObject(json, "type")));
8492  }
8493
8494  protected Condition.ConditionEvidenceComponent parseConditionEvidenceComponent(JsonObject json) throws IOException, FHIRFormatError {
8495    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
8496    parseConditionEvidenceComponentProperties(json, res);
8497    return res;
8498  }
8499
8500  protected void parseConditionEvidenceComponentProperties(JsonObject json, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
8501    parseBackboneElementProperties(json, res);
8502    if (json.has("code")) {
8503      JsonArray array = getJArray(json, "code");
8504      for (int i = 0; i < array.size(); i++) {
8505        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8506      }
8507    };
8508    if (json.has("detail")) {
8509      JsonArray array = getJArray(json, "detail");
8510      for (int i = 0; i < array.size(); i++) {
8511        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8512      }
8513    };
8514  }
8515
8516  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
8517    Consent res = new Consent();
8518    parseConsentProperties(json, res);
8519    return res;
8520  }
8521
8522  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
8523    parseDomainResourceProperties(json, res);
8524    if (json.has("identifier")) {
8525      JsonArray array = getJArray(json, "identifier");
8526      for (int i = 0; i < array.size(); i++) {
8527        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8528      }
8529    };
8530    if (json.has("status"))
8531      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
8532    if (json.has("_status"))
8533      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8534    if (json.has("scope"))
8535      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
8536    if (json.has("category")) {
8537      JsonArray array = getJArray(json, "category");
8538      for (int i = 0; i < array.size(); i++) {
8539        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8540      }
8541    };
8542    if (json.has("patient"))
8543      res.setPatient(parseReference(getJObject(json, "patient")));
8544    if (json.has("dateTime"))
8545      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
8546    if (json.has("_dateTime"))
8547      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
8548    if (json.has("performer")) {
8549      JsonArray array = getJArray(json, "performer");
8550      for (int i = 0; i < array.size(); i++) {
8551        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
8552      }
8553    };
8554    if (json.has("organization")) {
8555      JsonArray array = getJArray(json, "organization");
8556      for (int i = 0; i < array.size(); i++) {
8557        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
8558      }
8559    };
8560    DataType source = parseType("source", json);
8561    if (source != null)
8562      res.setSource(source);
8563    if (json.has("policy")) {
8564      JsonArray array = getJArray(json, "policy");
8565      for (int i = 0; i < array.size(); i++) {
8566        res.getPolicy().add(parseConsentPolicyComponent(array.get(i).getAsJsonObject()));
8567      }
8568    };
8569    if (json.has("policyRule"))
8570      res.setPolicyRule(parseCodeableConcept(getJObject(json, "policyRule")));
8571    if (json.has("verification")) {
8572      JsonArray array = getJArray(json, "verification");
8573      for (int i = 0; i < array.size(); i++) {
8574        res.getVerification().add(parseConsentVerificationComponent(array.get(i).getAsJsonObject()));
8575      }
8576    };
8577    if (json.has("provision"))
8578      res.setProvision(parseConsentProvisionComponent(getJObject(json, "provision")));
8579  }
8580
8581  protected Consent.ConsentPolicyComponent parseConsentPolicyComponent(JsonObject json) throws IOException, FHIRFormatError {
8582    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
8583    parseConsentPolicyComponentProperties(json, res);
8584    return res;
8585  }
8586
8587  protected void parseConsentPolicyComponentProperties(JsonObject json, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
8588    parseBackboneElementProperties(json, res);
8589    if (json.has("authority"))
8590      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
8591    if (json.has("_authority"))
8592      parseElementProperties(getJObject(json, "_authority"), res.getAuthorityElement());
8593    if (json.has("uri"))
8594      res.setUriElement(parseUri(json.get("uri").getAsString()));
8595    if (json.has("_uri"))
8596      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
8597  }
8598
8599  protected Consent.ConsentVerificationComponent parseConsentVerificationComponent(JsonObject json) throws IOException, FHIRFormatError {
8600    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
8601    parseConsentVerificationComponentProperties(json, res);
8602    return res;
8603  }
8604
8605  protected void parseConsentVerificationComponentProperties(JsonObject json, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
8606    parseBackboneElementProperties(json, res);
8607    if (json.has("verified"))
8608      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
8609    if (json.has("_verified"))
8610      parseElementProperties(getJObject(json, "_verified"), res.getVerifiedElement());
8611    if (json.has("verifiedWith"))
8612      res.setVerifiedWith(parseReference(getJObject(json, "verifiedWith")));
8613    if (json.has("verificationDate"))
8614      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
8615    if (json.has("_verificationDate"))
8616      parseElementProperties(getJObject(json, "_verificationDate"), res.getVerificationDateElement());
8617  }
8618
8619  protected Consent.ProvisionComponent parseConsentProvisionComponent(JsonObject json) throws IOException, FHIRFormatError {
8620    Consent.ProvisionComponent res = new Consent.ProvisionComponent();
8621    parseConsentProvisionComponentProperties(json, res);
8622    return res;
8623  }
8624
8625  protected void parseConsentProvisionComponentProperties(JsonObject json, Consent.ProvisionComponent res) throws IOException, FHIRFormatError {
8626    parseBackboneElementProperties(json, res);
8627    if (json.has("type"))
8628      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
8629    if (json.has("_type"))
8630      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
8631    if (json.has("period"))
8632      res.setPeriod(parsePeriod(getJObject(json, "period")));
8633    if (json.has("actor")) {
8634      JsonArray array = getJArray(json, "actor");
8635      for (int i = 0; i < array.size(); i++) {
8636        res.getActor().add(parseConsentProvisionActorComponent(array.get(i).getAsJsonObject()));
8637      }
8638    };
8639    if (json.has("action")) {
8640      JsonArray array = getJArray(json, "action");
8641      for (int i = 0; i < array.size(); i++) {
8642        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8643      }
8644    };
8645    if (json.has("securityLabel")) {
8646      JsonArray array = getJArray(json, "securityLabel");
8647      for (int i = 0; i < array.size(); i++) {
8648        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
8649      }
8650    };
8651    if (json.has("purpose")) {
8652      JsonArray array = getJArray(json, "purpose");
8653      for (int i = 0; i < array.size(); i++) {
8654        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
8655      }
8656    };
8657    if (json.has("class")) {
8658      JsonArray array = getJArray(json, "class");
8659      for (int i = 0; i < array.size(); i++) {
8660        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
8661      }
8662    };
8663    if (json.has("code")) {
8664      JsonArray array = getJArray(json, "code");
8665      for (int i = 0; i < array.size(); i++) {
8666        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8667      }
8668    };
8669    if (json.has("dataPeriod"))
8670      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
8671    if (json.has("data")) {
8672      JsonArray array = getJArray(json, "data");
8673      for (int i = 0; i < array.size(); i++) {
8674        res.getData().add(parseConsentProvisionDataComponent(array.get(i).getAsJsonObject()));
8675      }
8676    };
8677    if (json.has("provision")) {
8678      JsonArray array = getJArray(json, "provision");
8679      for (int i = 0; i < array.size(); i++) {
8680        res.getProvision().add(parseConsentProvisionComponent(array.get(i).getAsJsonObject()));
8681      }
8682    };
8683  }
8684
8685  protected Consent.ProvisionActorComponent parseConsentProvisionActorComponent(JsonObject json) throws IOException, FHIRFormatError {
8686    Consent.ProvisionActorComponent res = new Consent.ProvisionActorComponent();
8687    parseConsentProvisionActorComponentProperties(json, res);
8688    return res;
8689  }
8690
8691  protected void parseConsentProvisionActorComponentProperties(JsonObject json, Consent.ProvisionActorComponent res) throws IOException, FHIRFormatError {
8692    parseBackboneElementProperties(json, res);
8693    if (json.has("role"))
8694      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8695    if (json.has("reference"))
8696      res.setReference(parseReference(getJObject(json, "reference")));
8697  }
8698
8699  protected Consent.ProvisionDataComponent parseConsentProvisionDataComponent(JsonObject json) throws IOException, FHIRFormatError {
8700    Consent.ProvisionDataComponent res = new Consent.ProvisionDataComponent();
8701    parseConsentProvisionDataComponentProperties(json, res);
8702    return res;
8703  }
8704
8705  protected void parseConsentProvisionDataComponentProperties(JsonObject json, Consent.ProvisionDataComponent res) throws IOException, FHIRFormatError {
8706    parseBackboneElementProperties(json, res);
8707    if (json.has("meaning"))
8708      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
8709    if (json.has("_meaning"))
8710      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
8711    if (json.has("reference"))
8712      res.setReference(parseReference(getJObject(json, "reference")));
8713  }
8714
8715  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
8716    Contract res = new Contract();
8717    parseContractProperties(json, res);
8718    return res;
8719  }
8720
8721  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
8722    parseDomainResourceProperties(json, res);
8723    if (json.has("identifier")) {
8724      JsonArray array = getJArray(json, "identifier");
8725      for (int i = 0; i < array.size(); i++) {
8726        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8727      }
8728    };
8729    if (json.has("url"))
8730      res.setUrlElement(parseUri(json.get("url").getAsString()));
8731    if (json.has("_url"))
8732      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8733    if (json.has("version"))
8734      res.setVersionElement(parseString(json.get("version").getAsString()));
8735    if (json.has("_version"))
8736      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8737    if (json.has("status"))
8738      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractResourceStatusCodes.NULL, new Contract.ContractResourceStatusCodesEnumFactory()));
8739    if (json.has("_status"))
8740      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8741    if (json.has("legalState"))
8742      res.setLegalState(parseCodeableConcept(getJObject(json, "legalState")));
8743    if (json.has("instantiatesCanonical"))
8744      res.setInstantiatesCanonical(parseReference(getJObject(json, "instantiatesCanonical")));
8745    if (json.has("instantiatesUri"))
8746      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
8747    if (json.has("_instantiatesUri"))
8748      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
8749    if (json.has("contentDerivative"))
8750      res.setContentDerivative(parseCodeableConcept(getJObject(json, "contentDerivative")));
8751    if (json.has("issued"))
8752      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
8753    if (json.has("_issued"))
8754      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
8755    if (json.has("applies"))
8756      res.setApplies(parsePeriod(getJObject(json, "applies")));
8757    if (json.has("expirationType"))
8758      res.setExpirationType(parseCodeableConcept(getJObject(json, "expirationType")));
8759    if (json.has("subject")) {
8760      JsonArray array = getJArray(json, "subject");
8761      for (int i = 0; i < array.size(); i++) {
8762        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
8763      }
8764    };
8765    if (json.has("authority")) {
8766      JsonArray array = getJArray(json, "authority");
8767      for (int i = 0; i < array.size(); i++) {
8768        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
8769      }
8770    };
8771    if (json.has("domain")) {
8772      JsonArray array = getJArray(json, "domain");
8773      for (int i = 0; i < array.size(); i++) {
8774        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
8775      }
8776    };
8777    if (json.has("site")) {
8778      JsonArray array = getJArray(json, "site");
8779      for (int i = 0; i < array.size(); i++) {
8780        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
8781      }
8782    };
8783    if (json.has("name"))
8784      res.setNameElement(parseString(json.get("name").getAsString()));
8785    if (json.has("_name"))
8786      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8787    if (json.has("title"))
8788      res.setTitleElement(parseString(json.get("title").getAsString()));
8789    if (json.has("_title"))
8790      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8791    if (json.has("subtitle"))
8792      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
8793    if (json.has("_subtitle"))
8794      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
8795    if (json.has("alias")) {
8796      JsonArray array = getJArray(json, "alias");
8797      for (int i = 0; i < array.size(); i++) {
8798        if (array.get(i).isJsonNull()) {
8799          res.getAlias().add(new StringType());
8800        } else {;
8801          res.getAlias().add(parseString(array.get(i).getAsString()));
8802        }
8803      }
8804    };
8805    if (json.has("_alias")) {
8806      JsonArray array = getJArray(json, "_alias");
8807      for (int i = 0; i < array.size(); i++) {
8808        if (i == res.getAlias().size())
8809          res.getAlias().add(parseString(null));
8810        if (array.get(i) instanceof JsonObject) 
8811          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
8812      }
8813    };
8814    if (json.has("author"))
8815      res.setAuthor(parseReference(getJObject(json, "author")));
8816    if (json.has("scope"))
8817      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
8818    DataType topic = parseType("topic", json);
8819    if (topic != null)
8820      res.setTopic(topic);
8821    if (json.has("type"))
8822      res.setType(parseCodeableConcept(getJObject(json, "type")));
8823    if (json.has("subType")) {
8824      JsonArray array = getJArray(json, "subType");
8825      for (int i = 0; i < array.size(); i++) {
8826        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8827      }
8828    };
8829    if (json.has("contentDefinition"))
8830      res.setContentDefinition(parseContractContentDefinitionComponent(getJObject(json, "contentDefinition")));
8831    if (json.has("term")) {
8832      JsonArray array = getJArray(json, "term");
8833      for (int i = 0; i < array.size(); i++) {
8834        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject()));
8835      }
8836    };
8837    if (json.has("supportingInfo")) {
8838      JsonArray array = getJArray(json, "supportingInfo");
8839      for (int i = 0; i < array.size(); i++) {
8840        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
8841      }
8842    };
8843    if (json.has("relevantHistory")) {
8844      JsonArray array = getJArray(json, "relevantHistory");
8845      for (int i = 0; i < array.size(); i++) {
8846        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
8847      }
8848    };
8849    if (json.has("signer")) {
8850      JsonArray array = getJArray(json, "signer");
8851      for (int i = 0; i < array.size(); i++) {
8852        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject()));
8853      }
8854    };
8855    if (json.has("friendly")) {
8856      JsonArray array = getJArray(json, "friendly");
8857      for (int i = 0; i < array.size(); i++) {
8858        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject()));
8859      }
8860    };
8861    if (json.has("legal")) {
8862      JsonArray array = getJArray(json, "legal");
8863      for (int i = 0; i < array.size(); i++) {
8864        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject()));
8865      }
8866    };
8867    if (json.has("rule")) {
8868      JsonArray array = getJArray(json, "rule");
8869      for (int i = 0; i < array.size(); i++) {
8870        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject()));
8871      }
8872    };
8873    DataType legallyBinding = parseType("legallyBinding", json);
8874    if (legallyBinding != null)
8875      res.setLegallyBinding(legallyBinding);
8876  }
8877
8878  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
8879    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
8880    parseContractContentDefinitionComponentProperties(json, res);
8881    return res;
8882  }
8883
8884  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
8885    parseBackboneElementProperties(json, res);
8886    if (json.has("type"))
8887      res.setType(parseCodeableConcept(getJObject(json, "type")));
8888    if (json.has("subType"))
8889      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
8890    if (json.has("publisher"))
8891      res.setPublisher(parseReference(getJObject(json, "publisher")));
8892    if (json.has("publicationDate"))
8893      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
8894    if (json.has("_publicationDate"))
8895      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
8896    if (json.has("publicationStatus"))
8897      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractResourcePublicationStatusCodes.NULL, new Contract.ContractResourcePublicationStatusCodesEnumFactory()));
8898    if (json.has("_publicationStatus"))
8899      parseElementProperties(getJObject(json, "_publicationStatus"), res.getPublicationStatusElement());
8900    if (json.has("copyright"))
8901      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8902    if (json.has("_copyright"))
8903      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
8904  }
8905
8906  protected Contract.TermComponent parseContractTermComponent(JsonObject json) throws IOException, FHIRFormatError {
8907    Contract.TermComponent res = new Contract.TermComponent();
8908    parseContractTermComponentProperties(json, res);
8909    return res;
8910  }
8911
8912  protected void parseContractTermComponentProperties(JsonObject json, Contract.TermComponent res) throws IOException, FHIRFormatError {
8913    parseBackboneElementProperties(json, res);
8914    if (json.has("identifier"))
8915      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8916    if (json.has("issued"))
8917      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
8918    if (json.has("_issued"))
8919      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
8920    if (json.has("applies"))
8921      res.setApplies(parsePeriod(getJObject(json, "applies")));
8922    DataType topic = parseType("topic", json);
8923    if (topic != null)
8924      res.setTopic(topic);
8925    if (json.has("type"))
8926      res.setType(parseCodeableConcept(getJObject(json, "type")));
8927    if (json.has("subType"))
8928      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
8929    if (json.has("text"))
8930      res.setTextElement(parseString(json.get("text").getAsString()));
8931    if (json.has("_text"))
8932      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
8933    if (json.has("securityLabel")) {
8934      JsonArray array = getJArray(json, "securityLabel");
8935      for (int i = 0; i < array.size(); i++) {
8936        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject()));
8937      }
8938    };
8939    if (json.has("offer"))
8940      res.setOffer(parseContractOfferComponent(getJObject(json, "offer")));
8941    if (json.has("asset")) {
8942      JsonArray array = getJArray(json, "asset");
8943      for (int i = 0; i < array.size(); i++) {
8944        res.getAsset().add(parseContractAssetComponent(array.get(i).getAsJsonObject()));
8945      }
8946    };
8947    if (json.has("action")) {
8948      JsonArray array = getJArray(json, "action");
8949      for (int i = 0; i < array.size(); i++) {
8950        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject()));
8951      }
8952    };
8953    if (json.has("group")) {
8954      JsonArray array = getJArray(json, "group");
8955      for (int i = 0; i < array.size(); i++) {
8956        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject()));
8957      }
8958    };
8959  }
8960
8961  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json) throws IOException, FHIRFormatError {
8962    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
8963    parseContractSecurityLabelComponentProperties(json, res);
8964    return res;
8965  }
8966
8967  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
8968    parseBackboneElementProperties(json, res);
8969    if (json.has("number")) {
8970      JsonArray array = getJArray(json, "number");
8971      for (int i = 0; i < array.size(); i++) {
8972        if (array.get(i).isJsonNull()) {
8973          res.getNumber().add(new UnsignedIntType());
8974        } else {;
8975          res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8976        }
8977      }
8978    };
8979    if (json.has("_number")) {
8980      JsonArray array = getJArray(json, "_number");
8981      for (int i = 0; i < array.size(); i++) {
8982        if (i == res.getNumber().size())
8983          res.getNumber().add(parseUnsignedInt(null));
8984        if (array.get(i) instanceof JsonObject) 
8985          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
8986      }
8987    };
8988    if (json.has("classification"))
8989      res.setClassification(parseCoding(getJObject(json, "classification")));
8990    if (json.has("category")) {
8991      JsonArray array = getJArray(json, "category");
8992      for (int i = 0; i < array.size(); i++) {
8993        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
8994      }
8995    };
8996    if (json.has("control")) {
8997      JsonArray array = getJArray(json, "control");
8998      for (int i = 0; i < array.size(); i++) {
8999        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
9000      }
9001    };
9002  }
9003
9004  protected Contract.ContractOfferComponent parseContractOfferComponent(JsonObject json) throws IOException, FHIRFormatError {
9005    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
9006    parseContractOfferComponentProperties(json, res);
9007    return res;
9008  }
9009
9010  protected void parseContractOfferComponentProperties(JsonObject json, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
9011    parseBackboneElementProperties(json, res);
9012    if (json.has("identifier")) {
9013      JsonArray array = getJArray(json, "identifier");
9014      for (int i = 0; i < array.size(); i++) {
9015        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9016      }
9017    };
9018    if (json.has("party")) {
9019      JsonArray array = getJArray(json, "party");
9020      for (int i = 0; i < array.size(); i++) {
9021        res.getParty().add(parseContractPartyComponent(array.get(i).getAsJsonObject()));
9022      }
9023    };
9024    if (json.has("topic"))
9025      res.setTopic(parseReference(getJObject(json, "topic")));
9026    if (json.has("type"))
9027      res.setType(parseCodeableConcept(getJObject(json, "type")));
9028    if (json.has("decision"))
9029      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
9030    if (json.has("decisionMode")) {
9031      JsonArray array = getJArray(json, "decisionMode");
9032      for (int i = 0; i < array.size(); i++) {
9033        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9034      }
9035    };
9036    if (json.has("answer")) {
9037      JsonArray array = getJArray(json, "answer");
9038      for (int i = 0; i < array.size(); i++) {
9039        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject()));
9040      }
9041    };
9042    if (json.has("text"))
9043      res.setTextElement(parseString(json.get("text").getAsString()));
9044    if (json.has("_text"))
9045      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
9046    if (json.has("linkId")) {
9047      JsonArray array = getJArray(json, "linkId");
9048      for (int i = 0; i < array.size(); i++) {
9049        if (array.get(i).isJsonNull()) {
9050          res.getLinkId().add(new StringType());
9051        } else {;
9052          res.getLinkId().add(parseString(array.get(i).getAsString()));
9053        }
9054      }
9055    };
9056    if (json.has("_linkId")) {
9057      JsonArray array = getJArray(json, "_linkId");
9058      for (int i = 0; i < array.size(); i++) {
9059        if (i == res.getLinkId().size())
9060          res.getLinkId().add(parseString(null));
9061        if (array.get(i) instanceof JsonObject) 
9062          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9063      }
9064    };
9065    if (json.has("securityLabelNumber")) {
9066      JsonArray array = getJArray(json, "securityLabelNumber");
9067      for (int i = 0; i < array.size(); i++) {
9068        if (array.get(i).isJsonNull()) {
9069          res.getSecurityLabelNumber().add(new UnsignedIntType());
9070        } else {;
9071          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9072        }
9073      }
9074    };
9075    if (json.has("_securityLabelNumber")) {
9076      JsonArray array = getJArray(json, "_securityLabelNumber");
9077      for (int i = 0; i < array.size(); i++) {
9078        if (i == res.getSecurityLabelNumber().size())
9079          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9080        if (array.get(i) instanceof JsonObject) 
9081          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9082      }
9083    };
9084  }
9085
9086  protected Contract.ContractPartyComponent parseContractPartyComponent(JsonObject json) throws IOException, FHIRFormatError {
9087    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
9088    parseContractPartyComponentProperties(json, res);
9089    return res;
9090  }
9091
9092  protected void parseContractPartyComponentProperties(JsonObject json, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
9093    parseBackboneElementProperties(json, res);
9094    if (json.has("reference")) {
9095      JsonArray array = getJArray(json, "reference");
9096      for (int i = 0; i < array.size(); i++) {
9097        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
9098      }
9099    };
9100    if (json.has("role"))
9101      res.setRole(parseCodeableConcept(getJObject(json, "role")));
9102  }
9103
9104  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json) throws IOException, FHIRFormatError {
9105    Contract.AnswerComponent res = new Contract.AnswerComponent();
9106    parseContractAnswerComponentProperties(json, res);
9107    return res;
9108  }
9109
9110  protected void parseContractAnswerComponentProperties(JsonObject json, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
9111    parseBackboneElementProperties(json, res);
9112    DataType value = parseType("value", json);
9113    if (value != null)
9114      res.setValue(value);
9115  }
9116
9117  protected Contract.ContractAssetComponent parseContractAssetComponent(JsonObject json) throws IOException, FHIRFormatError {
9118    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
9119    parseContractAssetComponentProperties(json, res);
9120    return res;
9121  }
9122
9123  protected void parseContractAssetComponentProperties(JsonObject json, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
9124    parseBackboneElementProperties(json, res);
9125    if (json.has("scope"))
9126      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
9127    if (json.has("type")) {
9128      JsonArray array = getJArray(json, "type");
9129      for (int i = 0; i < array.size(); i++) {
9130        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9131      }
9132    };
9133    if (json.has("typeReference")) {
9134      JsonArray array = getJArray(json, "typeReference");
9135      for (int i = 0; i < array.size(); i++) {
9136        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
9137      }
9138    };
9139    if (json.has("subtype")) {
9140      JsonArray array = getJArray(json, "subtype");
9141      for (int i = 0; i < array.size(); i++) {
9142        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9143      }
9144    };
9145    if (json.has("relationship"))
9146      res.setRelationship(parseCoding(getJObject(json, "relationship")));
9147    if (json.has("context")) {
9148      JsonArray array = getJArray(json, "context");
9149      for (int i = 0; i < array.size(); i++) {
9150        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject()));
9151      }
9152    };
9153    if (json.has("condition"))
9154      res.setConditionElement(parseString(json.get("condition").getAsString()));
9155    if (json.has("_condition"))
9156      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
9157    if (json.has("periodType")) {
9158      JsonArray array = getJArray(json, "periodType");
9159      for (int i = 0; i < array.size(); i++) {
9160        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9161      }
9162    };
9163    if (json.has("period")) {
9164      JsonArray array = getJArray(json, "period");
9165      for (int i = 0; i < array.size(); i++) {
9166        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9167      }
9168    };
9169    if (json.has("usePeriod")) {
9170      JsonArray array = getJArray(json, "usePeriod");
9171      for (int i = 0; i < array.size(); i++) {
9172        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9173      }
9174    };
9175    if (json.has("text"))
9176      res.setTextElement(parseString(json.get("text").getAsString()));
9177    if (json.has("_text"))
9178      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
9179    if (json.has("linkId")) {
9180      JsonArray array = getJArray(json, "linkId");
9181      for (int i = 0; i < array.size(); i++) {
9182        if (array.get(i).isJsonNull()) {
9183          res.getLinkId().add(new StringType());
9184        } else {;
9185          res.getLinkId().add(parseString(array.get(i).getAsString()));
9186        }
9187      }
9188    };
9189    if (json.has("_linkId")) {
9190      JsonArray array = getJArray(json, "_linkId");
9191      for (int i = 0; i < array.size(); i++) {
9192        if (i == res.getLinkId().size())
9193          res.getLinkId().add(parseString(null));
9194        if (array.get(i) instanceof JsonObject) 
9195          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9196      }
9197    };
9198    if (json.has("answer")) {
9199      JsonArray array = getJArray(json, "answer");
9200      for (int i = 0; i < array.size(); i++) {
9201        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject()));
9202      }
9203    };
9204    if (json.has("securityLabelNumber")) {
9205      JsonArray array = getJArray(json, "securityLabelNumber");
9206      for (int i = 0; i < array.size(); i++) {
9207        if (array.get(i).isJsonNull()) {
9208          res.getSecurityLabelNumber().add(new UnsignedIntType());
9209        } else {;
9210          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9211        }
9212      }
9213    };
9214    if (json.has("_securityLabelNumber")) {
9215      JsonArray array = getJArray(json, "_securityLabelNumber");
9216      for (int i = 0; i < array.size(); i++) {
9217        if (i == res.getSecurityLabelNumber().size())
9218          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9219        if (array.get(i) instanceof JsonObject) 
9220          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9221      }
9222    };
9223    if (json.has("valuedItem")) {
9224      JsonArray array = getJArray(json, "valuedItem");
9225      for (int i = 0; i < array.size(); i++) {
9226        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject()));
9227      }
9228    };
9229  }
9230
9231  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json) throws IOException, FHIRFormatError {
9232    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
9233    parseContractAssetContextComponentProperties(json, res);
9234    return res;
9235  }
9236
9237  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
9238    parseBackboneElementProperties(json, res);
9239    if (json.has("reference"))
9240      res.setReference(parseReference(getJObject(json, "reference")));
9241    if (json.has("code")) {
9242      JsonArray array = getJArray(json, "code");
9243      for (int i = 0; i < array.size(); i++) {
9244        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9245      }
9246    };
9247    if (json.has("text"))
9248      res.setTextElement(parseString(json.get("text").getAsString()));
9249    if (json.has("_text"))
9250      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
9251  }
9252
9253  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
9254    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
9255    parseContractValuedItemComponentProperties(json, res);
9256    return res;
9257  }
9258
9259  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
9260    parseBackboneElementProperties(json, res);
9261    DataType entity = parseType("entity", json);
9262    if (entity != null)
9263      res.setEntity(entity);
9264    if (json.has("identifier"))
9265      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
9266    if (json.has("effectiveTime"))
9267      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
9268    if (json.has("_effectiveTime"))
9269      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
9270    if (json.has("quantity"))
9271      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
9272    if (json.has("unitPrice"))
9273      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
9274    if (json.has("factor"))
9275      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9276    if (json.has("_factor"))
9277      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
9278    if (json.has("points"))
9279      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
9280    if (json.has("_points"))
9281      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
9282    if (json.has("net"))
9283      res.setNet(parseMoney(getJObject(json, "net")));
9284    if (json.has("payment"))
9285      res.setPaymentElement(parseString(json.get("payment").getAsString()));
9286    if (json.has("_payment"))
9287      parseElementProperties(getJObject(json, "_payment"), res.getPaymentElement());
9288    if (json.has("paymentDate"))
9289      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
9290    if (json.has("_paymentDate"))
9291      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
9292    if (json.has("responsible"))
9293      res.setResponsible(parseReference(getJObject(json, "responsible")));
9294    if (json.has("recipient"))
9295      res.setRecipient(parseReference(getJObject(json, "recipient")));
9296    if (json.has("linkId")) {
9297      JsonArray array = getJArray(json, "linkId");
9298      for (int i = 0; i < array.size(); i++) {
9299        if (array.get(i).isJsonNull()) {
9300          res.getLinkId().add(new StringType());
9301        } else {;
9302          res.getLinkId().add(parseString(array.get(i).getAsString()));
9303        }
9304      }
9305    };
9306    if (json.has("_linkId")) {
9307      JsonArray array = getJArray(json, "_linkId");
9308      for (int i = 0; i < array.size(); i++) {
9309        if (i == res.getLinkId().size())
9310          res.getLinkId().add(parseString(null));
9311        if (array.get(i) instanceof JsonObject) 
9312          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9313      }
9314    };
9315    if (json.has("securityLabelNumber")) {
9316      JsonArray array = getJArray(json, "securityLabelNumber");
9317      for (int i = 0; i < array.size(); i++) {
9318        if (array.get(i).isJsonNull()) {
9319          res.getSecurityLabelNumber().add(new UnsignedIntType());
9320        } else {;
9321          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9322        }
9323      }
9324    };
9325    if (json.has("_securityLabelNumber")) {
9326      JsonArray array = getJArray(json, "_securityLabelNumber");
9327      for (int i = 0; i < array.size(); i++) {
9328        if (i == res.getSecurityLabelNumber().size())
9329          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9330        if (array.get(i) instanceof JsonObject) 
9331          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9332      }
9333    };
9334  }
9335
9336  protected Contract.ActionComponent parseContractActionComponent(JsonObject json) throws IOException, FHIRFormatError {
9337    Contract.ActionComponent res = new Contract.ActionComponent();
9338    parseContractActionComponentProperties(json, res);
9339    return res;
9340  }
9341
9342  protected void parseContractActionComponentProperties(JsonObject json, Contract.ActionComponent res) throws IOException, FHIRFormatError {
9343    parseBackboneElementProperties(json, res);
9344    if (json.has("doNotPerform"))
9345      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
9346    if (json.has("_doNotPerform"))
9347      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
9348    if (json.has("type"))
9349      res.setType(parseCodeableConcept(getJObject(json, "type")));
9350    if (json.has("subject")) {
9351      JsonArray array = getJArray(json, "subject");
9352      for (int i = 0; i < array.size(); i++) {
9353        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject()));
9354      }
9355    };
9356    if (json.has("intent"))
9357      res.setIntent(parseCodeableConcept(getJObject(json, "intent")));
9358    if (json.has("linkId")) {
9359      JsonArray array = getJArray(json, "linkId");
9360      for (int i = 0; i < array.size(); i++) {
9361        if (array.get(i).isJsonNull()) {
9362          res.getLinkId().add(new StringType());
9363        } else {;
9364          res.getLinkId().add(parseString(array.get(i).getAsString()));
9365        }
9366      }
9367    };
9368    if (json.has("_linkId")) {
9369      JsonArray array = getJArray(json, "_linkId");
9370      for (int i = 0; i < array.size(); i++) {
9371        if (i == res.getLinkId().size())
9372          res.getLinkId().add(parseString(null));
9373        if (array.get(i) instanceof JsonObject) 
9374          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9375      }
9376    };
9377    if (json.has("status"))
9378      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
9379    if (json.has("context"))
9380      res.setContext(parseReference(getJObject(json, "context")));
9381    if (json.has("contextLinkId")) {
9382      JsonArray array = getJArray(json, "contextLinkId");
9383      for (int i = 0; i < array.size(); i++) {
9384        if (array.get(i).isJsonNull()) {
9385          res.getContextLinkId().add(new StringType());
9386        } else {;
9387          res.getContextLinkId().add(parseString(array.get(i).getAsString()));
9388        }
9389      }
9390    };
9391    if (json.has("_contextLinkId")) {
9392      JsonArray array = getJArray(json, "_contextLinkId");
9393      for (int i = 0; i < array.size(); i++) {
9394        if (i == res.getContextLinkId().size())
9395          res.getContextLinkId().add(parseString(null));
9396        if (array.get(i) instanceof JsonObject) 
9397          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
9398      }
9399    };
9400    DataType occurrence = parseType("occurrence", json);
9401    if (occurrence != null)
9402      res.setOccurrence(occurrence);
9403    if (json.has("requester")) {
9404      JsonArray array = getJArray(json, "requester");
9405      for (int i = 0; i < array.size(); i++) {
9406        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
9407      }
9408    };
9409    if (json.has("requesterLinkId")) {
9410      JsonArray array = getJArray(json, "requesterLinkId");
9411      for (int i = 0; i < array.size(); i++) {
9412        if (array.get(i).isJsonNull()) {
9413          res.getRequesterLinkId().add(new StringType());
9414        } else {;
9415          res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
9416        }
9417      }
9418    };
9419    if (json.has("_requesterLinkId")) {
9420      JsonArray array = getJArray(json, "_requesterLinkId");
9421      for (int i = 0; i < array.size(); i++) {
9422        if (i == res.getRequesterLinkId().size())
9423          res.getRequesterLinkId().add(parseString(null));
9424        if (array.get(i) instanceof JsonObject) 
9425          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
9426      }
9427    };
9428    if (json.has("performerType")) {
9429      JsonArray array = getJArray(json, "performerType");
9430      for (int i = 0; i < array.size(); i++) {
9431        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9432      }
9433    };
9434    if (json.has("performerRole"))
9435      res.setPerformerRole(parseCodeableConcept(getJObject(json, "performerRole")));
9436    if (json.has("performer"))
9437      res.setPerformer(parseReference(getJObject(json, "performer")));
9438    if (json.has("performerLinkId")) {
9439      JsonArray array = getJArray(json, "performerLinkId");
9440      for (int i = 0; i < array.size(); i++) {
9441        if (array.get(i).isJsonNull()) {
9442          res.getPerformerLinkId().add(new StringType());
9443        } else {;
9444          res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
9445        }
9446      }
9447    };
9448    if (json.has("_performerLinkId")) {
9449      JsonArray array = getJArray(json, "_performerLinkId");
9450      for (int i = 0; i < array.size(); i++) {
9451        if (i == res.getPerformerLinkId().size())
9452          res.getPerformerLinkId().add(parseString(null));
9453        if (array.get(i) instanceof JsonObject) 
9454          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
9455      }
9456    };
9457    if (json.has("reasonCode")) {
9458      JsonArray array = getJArray(json, "reasonCode");
9459      for (int i = 0; i < array.size(); i++) {
9460        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9461      }
9462    };
9463    if (json.has("reasonReference")) {
9464      JsonArray array = getJArray(json, "reasonReference");
9465      for (int i = 0; i < array.size(); i++) {
9466        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9467      }
9468    };
9469    if (json.has("reason")) {
9470      JsonArray array = getJArray(json, "reason");
9471      for (int i = 0; i < array.size(); i++) {
9472        if (array.get(i).isJsonNull()) {
9473          res.getReason().add(new StringType());
9474        } else {;
9475          res.getReason().add(parseString(array.get(i).getAsString()));
9476        }
9477      }
9478    };
9479    if (json.has("_reason")) {
9480      JsonArray array = getJArray(json, "_reason");
9481      for (int i = 0; i < array.size(); i++) {
9482        if (i == res.getReason().size())
9483          res.getReason().add(parseString(null));
9484        if (array.get(i) instanceof JsonObject) 
9485          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
9486      }
9487    };
9488    if (json.has("reasonLinkId")) {
9489      JsonArray array = getJArray(json, "reasonLinkId");
9490      for (int i = 0; i < array.size(); i++) {
9491        if (array.get(i).isJsonNull()) {
9492          res.getReasonLinkId().add(new StringType());
9493        } else {;
9494          res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
9495        }
9496      }
9497    };
9498    if (json.has("_reasonLinkId")) {
9499      JsonArray array = getJArray(json, "_reasonLinkId");
9500      for (int i = 0; i < array.size(); i++) {
9501        if (i == res.getReasonLinkId().size())
9502          res.getReasonLinkId().add(parseString(null));
9503        if (array.get(i) instanceof JsonObject) 
9504          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
9505      }
9506    };
9507    if (json.has("note")) {
9508      JsonArray array = getJArray(json, "note");
9509      for (int i = 0; i < array.size(); i++) {
9510        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9511      }
9512    };
9513    if (json.has("securityLabelNumber")) {
9514      JsonArray array = getJArray(json, "securityLabelNumber");
9515      for (int i = 0; i < array.size(); i++) {
9516        if (array.get(i).isJsonNull()) {
9517          res.getSecurityLabelNumber().add(new UnsignedIntType());
9518        } else {;
9519          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9520        }
9521      }
9522    };
9523    if (json.has("_securityLabelNumber")) {
9524      JsonArray array = getJArray(json, "_securityLabelNumber");
9525      for (int i = 0; i < array.size(); i++) {
9526        if (i == res.getSecurityLabelNumber().size())
9527          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9528        if (array.get(i) instanceof JsonObject) 
9529          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9530      }
9531    };
9532  }
9533
9534  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json) throws IOException, FHIRFormatError {
9535    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
9536    parseContractActionSubjectComponentProperties(json, res);
9537    return res;
9538  }
9539
9540  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
9541    parseBackboneElementProperties(json, res);
9542    if (json.has("reference")) {
9543      JsonArray array = getJArray(json, "reference");
9544      for (int i = 0; i < array.size(); i++) {
9545        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
9546      }
9547    };
9548    if (json.has("role"))
9549      res.setRole(parseCodeableConcept(getJObject(json, "role")));
9550  }
9551
9552  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json) throws IOException, FHIRFormatError {
9553    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
9554    parseContractSignatoryComponentProperties(json, res);
9555    return res;
9556  }
9557
9558  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
9559    parseBackboneElementProperties(json, res);
9560    if (json.has("type"))
9561      res.setType(parseCoding(getJObject(json, "type")));
9562    if (json.has("party"))
9563      res.setParty(parseReference(getJObject(json, "party")));
9564    if (json.has("signature")) {
9565      JsonArray array = getJArray(json, "signature");
9566      for (int i = 0; i < array.size(); i++) {
9567        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
9568      }
9569    };
9570  }
9571
9572  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
9573    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
9574    parseContractFriendlyLanguageComponentProperties(json, res);
9575    return res;
9576  }
9577
9578  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
9579    parseBackboneElementProperties(json, res);
9580    DataType content = parseType("content", json);
9581    if (content != null)
9582      res.setContent(content);
9583  }
9584
9585  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
9586    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
9587    parseContractLegalLanguageComponentProperties(json, res);
9588    return res;
9589  }
9590
9591  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
9592    parseBackboneElementProperties(json, res);
9593    DataType content = parseType("content", json);
9594    if (content != null)
9595      res.setContent(content);
9596  }
9597
9598  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
9599    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
9600    parseContractComputableLanguageComponentProperties(json, res);
9601    return res;
9602  }
9603
9604  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
9605    parseBackboneElementProperties(json, res);
9606    DataType content = parseType("content", json);
9607    if (content != null)
9608      res.setContent(content);
9609  }
9610
9611  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
9612    Coverage res = new Coverage();
9613    parseCoverageProperties(json, res);
9614    return res;
9615  }
9616
9617  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
9618    parseDomainResourceProperties(json, res);
9619    if (json.has("identifier")) {
9620      JsonArray array = getJArray(json, "identifier");
9621      for (int i = 0; i < array.size(); i++) {
9622        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9623      }
9624    };
9625    if (json.has("status"))
9626      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
9627    if (json.has("_status"))
9628      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9629    if (json.has("type"))
9630      res.setType(parseCodeableConcept(getJObject(json, "type")));
9631    if (json.has("policyHolder"))
9632      res.setPolicyHolder(parseReference(getJObject(json, "policyHolder")));
9633    if (json.has("subscriber"))
9634      res.setSubscriber(parseReference(getJObject(json, "subscriber")));
9635    if (json.has("subscriberId"))
9636      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
9637    if (json.has("_subscriberId"))
9638      parseElementProperties(getJObject(json, "_subscriberId"), res.getSubscriberIdElement());
9639    if (json.has("beneficiary"))
9640      res.setBeneficiary(parseReference(getJObject(json, "beneficiary")));
9641    if (json.has("dependent"))
9642      res.setDependentElement(parseString(json.get("dependent").getAsString()));
9643    if (json.has("_dependent"))
9644      parseElementProperties(getJObject(json, "_dependent"), res.getDependentElement());
9645    if (json.has("relationship"))
9646      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
9647    if (json.has("period"))
9648      res.setPeriod(parsePeriod(getJObject(json, "period")));
9649    if (json.has("payor")) {
9650      JsonArray array = getJArray(json, "payor");
9651      for (int i = 0; i < array.size(); i++) {
9652        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
9653      }
9654    };
9655    if (json.has("class")) {
9656      JsonArray array = getJArray(json, "class");
9657      for (int i = 0; i < array.size(); i++) {
9658        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject()));
9659      }
9660    };
9661    if (json.has("order"))
9662      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
9663    if (json.has("_order"))
9664      parseElementProperties(getJObject(json, "_order"), res.getOrderElement());
9665    if (json.has("network"))
9666      res.setNetworkElement(parseString(json.get("network").getAsString()));
9667    if (json.has("_network"))
9668      parseElementProperties(getJObject(json, "_network"), res.getNetworkElement());
9669    if (json.has("costToBeneficiary")) {
9670      JsonArray array = getJArray(json, "costToBeneficiary");
9671      for (int i = 0; i < array.size(); i++) {
9672        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject()));
9673      }
9674    };
9675    if (json.has("subrogation"))
9676      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
9677    if (json.has("_subrogation"))
9678      parseElementProperties(getJObject(json, "_subrogation"), res.getSubrogationElement());
9679    if (json.has("contract")) {
9680      JsonArray array = getJArray(json, "contract");
9681      for (int i = 0; i < array.size(); i++) {
9682        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
9683      }
9684    };
9685  }
9686
9687  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json) throws IOException, FHIRFormatError {
9688    Coverage.ClassComponent res = new Coverage.ClassComponent();
9689    parseCoverageClassComponentProperties(json, res);
9690    return res;
9691  }
9692
9693  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
9694    parseBackboneElementProperties(json, res);
9695    if (json.has("type"))
9696      res.setType(parseCodeableConcept(getJObject(json, "type")));
9697    if (json.has("value"))
9698      res.setValueElement(parseString(json.get("value").getAsString()));
9699    if (json.has("_value"))
9700      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
9701    if (json.has("name"))
9702      res.setNameElement(parseString(json.get("name").getAsString()));
9703    if (json.has("_name"))
9704      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9705  }
9706
9707  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json) throws IOException, FHIRFormatError {
9708    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
9709    parseCoverageCostToBeneficiaryComponentProperties(json, res);
9710    return res;
9711  }
9712
9713  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
9714    parseBackboneElementProperties(json, res);
9715    if (json.has("type"))
9716      res.setType(parseCodeableConcept(getJObject(json, "type")));
9717    DataType value = parseType("value", json);
9718    if (value != null)
9719      res.setValue(value);
9720    if (json.has("exception")) {
9721      JsonArray array = getJArray(json, "exception");
9722      for (int i = 0; i < array.size(); i++) {
9723        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject()));
9724      }
9725    };
9726  }
9727
9728  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json) throws IOException, FHIRFormatError {
9729    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
9730    parseCoverageExemptionComponentProperties(json, res);
9731    return res;
9732  }
9733
9734  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
9735    parseBackboneElementProperties(json, res);
9736    if (json.has("type"))
9737      res.setType(parseCodeableConcept(getJObject(json, "type")));
9738    if (json.has("period"))
9739      res.setPeriod(parsePeriod(getJObject(json, "period")));
9740  }
9741
9742  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
9743    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
9744    parseCoverageEligibilityRequestProperties(json, res);
9745    return res;
9746  }
9747
9748  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
9749    parseDomainResourceProperties(json, res);
9750    if (json.has("identifier")) {
9751      JsonArray array = getJArray(json, "identifier");
9752      for (int i = 0; i < array.size(); i++) {
9753        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9754      }
9755    };
9756    if (json.has("status"))
9757      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
9758    if (json.has("_status"))
9759      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9760    if (json.has("priority"))
9761      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
9762    if (json.has("purpose")) {
9763      JsonArray array = getJArray(json, "purpose");
9764      for (int i = 0; i < array.size(); i++) {
9765        if (array.get(i).isJsonNull()) {
9766          res.getPurpose().add(new Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose>(new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL));
9767        } else {;
9768          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9769        }
9770      }
9771    };
9772    if (json.has("_purpose")) {
9773      JsonArray array = getJArray(json, "_purpose");
9774      for (int i = 0; i < array.size(); i++) {
9775        if (i == res.getPurpose().size())
9776          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9777        if (array.get(i) instanceof JsonObject) 
9778          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
9779      }
9780    };
9781    if (json.has("patient"))
9782      res.setPatient(parseReference(getJObject(json, "patient")));
9783    DataType serviced = parseType("serviced", json);
9784    if (serviced != null)
9785      res.setServiced(serviced);
9786    if (json.has("created"))
9787      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9788    if (json.has("_created"))
9789      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
9790    if (json.has("enterer"))
9791      res.setEnterer(parseReference(getJObject(json, "enterer")));
9792    if (json.has("provider"))
9793      res.setProvider(parseReference(getJObject(json, "provider")));
9794    if (json.has("insurer"))
9795      res.setInsurer(parseReference(getJObject(json, "insurer")));
9796    if (json.has("facility"))
9797      res.setFacility(parseReference(getJObject(json, "facility")));
9798    if (json.has("supportingInfo")) {
9799      JsonArray array = getJArray(json, "supportingInfo");
9800      for (int i = 0; i < array.size(); i++) {
9801        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject()));
9802      }
9803    };
9804    if (json.has("insurance")) {
9805      JsonArray array = getJArray(json, "insurance");
9806      for (int i = 0; i < array.size(); i++) {
9807        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject()));
9808      }
9809    };
9810    if (json.has("item")) {
9811      JsonArray array = getJArray(json, "item");
9812      for (int i = 0; i < array.size(); i++) {
9813        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject()));
9814      }
9815    };
9816  }
9817
9818  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
9819    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
9820    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, res);
9821    return res;
9822  }
9823
9824  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
9825    parseBackboneElementProperties(json, res);
9826    if (json.has("sequence"))
9827      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9828    if (json.has("_sequence"))
9829      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9830    if (json.has("information"))
9831      res.setInformation(parseReference(getJObject(json, "information")));
9832    if (json.has("appliesToAll"))
9833      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
9834    if (json.has("_appliesToAll"))
9835      parseElementProperties(getJObject(json, "_appliesToAll"), res.getAppliesToAllElement());
9836  }
9837
9838  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
9839    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
9840    parseCoverageEligibilityRequestInsuranceComponentProperties(json, res);
9841    return res;
9842  }
9843
9844  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
9845    parseBackboneElementProperties(json, res);
9846    if (json.has("focal"))
9847      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
9848    if (json.has("_focal"))
9849      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
9850    if (json.has("coverage"))
9851      res.setCoverage(parseReference(getJObject(json, "coverage")));
9852    if (json.has("businessArrangement"))
9853      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
9854    if (json.has("_businessArrangement"))
9855      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
9856  }
9857
9858  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json) throws IOException, FHIRFormatError {
9859    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
9860    parseCoverageEligibilityRequestDetailsComponentProperties(json, res);
9861    return res;
9862  }
9863
9864  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
9865    parseBackboneElementProperties(json, res);
9866    if (json.has("supportingInfoSequence")) {
9867      JsonArray array = getJArray(json, "supportingInfoSequence");
9868      for (int i = 0; i < array.size(); i++) {
9869        if (array.get(i).isJsonNull()) {
9870          res.getSupportingInfoSequence().add(new PositiveIntType());
9871        } else {;
9872          res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
9873        }
9874      }
9875    };
9876    if (json.has("_supportingInfoSequence")) {
9877      JsonArray array = getJArray(json, "_supportingInfoSequence");
9878      for (int i = 0; i < array.size(); i++) {
9879        if (i == res.getSupportingInfoSequence().size())
9880          res.getSupportingInfoSequence().add(parsePositiveInt(null));
9881        if (array.get(i) instanceof JsonObject) 
9882          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
9883      }
9884    };
9885    if (json.has("category"))
9886      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9887    if (json.has("productOrService"))
9888      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
9889    if (json.has("modifier")) {
9890      JsonArray array = getJArray(json, "modifier");
9891      for (int i = 0; i < array.size(); i++) {
9892        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9893      }
9894    };
9895    if (json.has("provider"))
9896      res.setProvider(parseReference(getJObject(json, "provider")));
9897    if (json.has("quantity"))
9898      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
9899    if (json.has("unitPrice"))
9900      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
9901    if (json.has("facility"))
9902      res.setFacility(parseReference(getJObject(json, "facility")));
9903    if (json.has("diagnosis")) {
9904      JsonArray array = getJArray(json, "diagnosis");
9905      for (int i = 0; i < array.size(); i++) {
9906        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject()));
9907      }
9908    };
9909    if (json.has("detail")) {
9910      JsonArray array = getJArray(json, "detail");
9911      for (int i = 0; i < array.size(); i++) {
9912        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
9913      }
9914    };
9915  }
9916
9917  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
9918    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
9919    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, res);
9920    return res;
9921  }
9922
9923  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
9924    parseBackboneElementProperties(json, res);
9925    DataType diagnosis = parseType("diagnosis", json);
9926    if (diagnosis != null)
9927      res.setDiagnosis(diagnosis);
9928  }
9929
9930  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
9931    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
9932    parseCoverageEligibilityResponseProperties(json, res);
9933    return res;
9934  }
9935
9936  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
9937    parseDomainResourceProperties(json, res);
9938    if (json.has("identifier")) {
9939      JsonArray array = getJArray(json, "identifier");
9940      for (int i = 0; i < array.size(); i++) {
9941        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9942      }
9943    };
9944    if (json.has("status"))
9945      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
9946    if (json.has("_status"))
9947      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9948    if (json.has("purpose")) {
9949      JsonArray array = getJArray(json, "purpose");
9950      for (int i = 0; i < array.size(); i++) {
9951        if (array.get(i).isJsonNull()) {
9952          res.getPurpose().add(new Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose>(new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL));
9953        } else {;
9954          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
9955        }
9956      }
9957    };
9958    if (json.has("_purpose")) {
9959      JsonArray array = getJArray(json, "_purpose");
9960      for (int i = 0; i < array.size(); i++) {
9961        if (i == res.getPurpose().size())
9962          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
9963        if (array.get(i) instanceof JsonObject) 
9964          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
9965      }
9966    };
9967    if (json.has("patient"))
9968      res.setPatient(parseReference(getJObject(json, "patient")));
9969    DataType serviced = parseType("serviced", json);
9970    if (serviced != null)
9971      res.setServiced(serviced);
9972    if (json.has("created"))
9973      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9974    if (json.has("_created"))
9975      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
9976    if (json.has("requestor"))
9977      res.setRequestor(parseReference(getJObject(json, "requestor")));
9978    if (json.has("request"))
9979      res.setRequest(parseReference(getJObject(json, "request")));
9980    if (json.has("outcome"))
9981      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
9982    if (json.has("_outcome"))
9983      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
9984    if (json.has("disposition"))
9985      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
9986    if (json.has("_disposition"))
9987      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
9988    if (json.has("insurer"))
9989      res.setInsurer(parseReference(getJObject(json, "insurer")));
9990    if (json.has("insurance")) {
9991      JsonArray array = getJArray(json, "insurance");
9992      for (int i = 0; i < array.size(); i++) {
9993        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject()));
9994      }
9995    };
9996    if (json.has("preAuthRef"))
9997      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
9998    if (json.has("_preAuthRef"))
9999      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
10000    if (json.has("form"))
10001      res.setForm(parseCodeableConcept(getJObject(json, "form")));
10002    if (json.has("error")) {
10003      JsonArray array = getJArray(json, "error");
10004      for (int i = 0; i < array.size(); i++) {
10005        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject()));
10006      }
10007    };
10008  }
10009
10010  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
10011    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
10012    parseCoverageEligibilityResponseInsuranceComponentProperties(json, res);
10013    return res;
10014  }
10015
10016  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
10017    parseBackboneElementProperties(json, res);
10018    if (json.has("coverage"))
10019      res.setCoverage(parseReference(getJObject(json, "coverage")));
10020    if (json.has("inforce"))
10021      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
10022    if (json.has("_inforce"))
10023      parseElementProperties(getJObject(json, "_inforce"), res.getInforceElement());
10024    if (json.has("benefitPeriod"))
10025      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
10026    if (json.has("item")) {
10027      JsonArray array = getJArray(json, "item");
10028      for (int i = 0; i < array.size(); i++) {
10029        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject()));
10030      }
10031    };
10032  }
10033
10034  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json) throws IOException, FHIRFormatError {
10035    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
10036    parseCoverageEligibilityResponseItemsComponentProperties(json, res);
10037    return res;
10038  }
10039
10040  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
10041    parseBackboneElementProperties(json, res);
10042    if (json.has("category"))
10043      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
10044    if (json.has("productOrService"))
10045      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
10046    if (json.has("modifier")) {
10047      JsonArray array = getJArray(json, "modifier");
10048      for (int i = 0; i < array.size(); i++) {
10049        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10050      }
10051    };
10052    if (json.has("provider"))
10053      res.setProvider(parseReference(getJObject(json, "provider")));
10054    if (json.has("excluded"))
10055      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
10056    if (json.has("_excluded"))
10057      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
10058    if (json.has("name"))
10059      res.setNameElement(parseString(json.get("name").getAsString()));
10060    if (json.has("_name"))
10061      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10062    if (json.has("description"))
10063      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10064    if (json.has("_description"))
10065      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10066    if (json.has("network"))
10067      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
10068    if (json.has("unit"))
10069      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
10070    if (json.has("term"))
10071      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
10072    if (json.has("benefit")) {
10073      JsonArray array = getJArray(json, "benefit");
10074      for (int i = 0; i < array.size(); i++) {
10075        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject()));
10076      }
10077    };
10078    if (json.has("authorizationRequired"))
10079      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
10080    if (json.has("_authorizationRequired"))
10081      parseElementProperties(getJObject(json, "_authorizationRequired"), res.getAuthorizationRequiredElement());
10082    if (json.has("authorizationSupporting")) {
10083      JsonArray array = getJArray(json, "authorizationSupporting");
10084      for (int i = 0; i < array.size(); i++) {
10085        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10086      }
10087    };
10088    if (json.has("authorizationUrl"))
10089      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
10090    if (json.has("_authorizationUrl"))
10091      parseElementProperties(getJObject(json, "_authorizationUrl"), res.getAuthorizationUrlElement());
10092  }
10093
10094  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
10095    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
10096    parseCoverageEligibilityResponseBenefitComponentProperties(json, res);
10097    return res;
10098  }
10099
10100  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
10101    parseBackboneElementProperties(json, res);
10102    if (json.has("type"))
10103      res.setType(parseCodeableConcept(getJObject(json, "type")));
10104    DataType allowed = parseType("allowed", json);
10105    if (allowed != null)
10106      res.setAllowed(allowed);
10107    DataType used = parseType("used", json);
10108    if (used != null)
10109      res.setUsed(used);
10110  }
10111
10112  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json) throws IOException, FHIRFormatError {
10113    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
10114    parseCoverageEligibilityResponseErrorsComponentProperties(json, res);
10115    return res;
10116  }
10117
10118  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
10119    parseBackboneElementProperties(json, res);
10120    if (json.has("code"))
10121      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10122  }
10123
10124  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
10125    DetectedIssue res = new DetectedIssue();
10126    parseDetectedIssueProperties(json, res);
10127    return res;
10128  }
10129
10130  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
10131    parseDomainResourceProperties(json, res);
10132    if (json.has("identifier")) {
10133      JsonArray array = getJArray(json, "identifier");
10134      for (int i = 0; i < array.size(); i++) {
10135        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10136      }
10137    };
10138    if (json.has("status"))
10139      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
10140    if (json.has("_status"))
10141      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10142    if (json.has("code"))
10143      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10144    if (json.has("severity"))
10145      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
10146    if (json.has("_severity"))
10147      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
10148    if (json.has("patient"))
10149      res.setPatient(parseReference(getJObject(json, "patient")));
10150    DataType identified = parseType("identified", json);
10151    if (identified != null)
10152      res.setIdentified(identified);
10153    if (json.has("author"))
10154      res.setAuthor(parseReference(getJObject(json, "author")));
10155    if (json.has("implicated")) {
10156      JsonArray array = getJArray(json, "implicated");
10157      for (int i = 0; i < array.size(); i++) {
10158        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
10159      }
10160    };
10161    if (json.has("evidence")) {
10162      JsonArray array = getJArray(json, "evidence");
10163      for (int i = 0; i < array.size(); i++) {
10164        res.getEvidence().add(parseDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject()));
10165      }
10166    };
10167    if (json.has("detail"))
10168      res.setDetailElement(parseString(json.get("detail").getAsString()));
10169    if (json.has("_detail"))
10170      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
10171    if (json.has("reference"))
10172      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
10173    if (json.has("_reference"))
10174      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
10175    if (json.has("mitigation")) {
10176      JsonArray array = getJArray(json, "mitigation");
10177      for (int i = 0; i < array.size(); i++) {
10178        res.getMitigation().add(parseDetectedIssueMitigationComponent(array.get(i).getAsJsonObject()));
10179      }
10180    };
10181  }
10182
10183  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueEvidenceComponent(JsonObject json) throws IOException, FHIRFormatError {
10184    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
10185    parseDetectedIssueEvidenceComponentProperties(json, res);
10186    return res;
10187  }
10188
10189  protected void parseDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
10190    parseBackboneElementProperties(json, res);
10191    if (json.has("code")) {
10192      JsonArray array = getJArray(json, "code");
10193      for (int i = 0; i < array.size(); i++) {
10194        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10195      }
10196    };
10197    if (json.has("detail")) {
10198      JsonArray array = getJArray(json, "detail");
10199      for (int i = 0; i < array.size(); i++) {
10200        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
10201      }
10202    };
10203  }
10204
10205  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueMitigationComponent(JsonObject json) throws IOException, FHIRFormatError {
10206    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
10207    parseDetectedIssueMitigationComponentProperties(json, res);
10208    return res;
10209  }
10210
10211  protected void parseDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
10212    parseBackboneElementProperties(json, res);
10213    if (json.has("action"))
10214      res.setAction(parseCodeableConcept(getJObject(json, "action")));
10215    if (json.has("date"))
10216      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10217    if (json.has("_date"))
10218      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10219    if (json.has("author"))
10220      res.setAuthor(parseReference(getJObject(json, "author")));
10221  }
10222
10223  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
10224    Device res = new Device();
10225    parseDeviceProperties(json, res);
10226    return res;
10227  }
10228
10229  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
10230    parseDomainResourceProperties(json, res);
10231    if (json.has("identifier")) {
10232      JsonArray array = getJArray(json, "identifier");
10233      for (int i = 0; i < array.size(); i++) {
10234        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10235      }
10236    };
10237    if (json.has("definition"))
10238      res.setDefinition(parseReference(getJObject(json, "definition")));
10239    if (json.has("udiCarrier")) {
10240      JsonArray array = getJArray(json, "udiCarrier");
10241      for (int i = 0; i < array.size(); i++) {
10242        res.getUdiCarrier().add(parseDeviceUdiCarrierComponent(array.get(i).getAsJsonObject()));
10243      }
10244    };
10245    if (json.has("status"))
10246      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
10247    if (json.has("_status"))
10248      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10249    if (json.has("statusReason")) {
10250      JsonArray array = getJArray(json, "statusReason");
10251      for (int i = 0; i < array.size(); i++) {
10252        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10253      }
10254    };
10255    if (json.has("distinctIdentifier"))
10256      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
10257    if (json.has("_distinctIdentifier"))
10258      parseElementProperties(getJObject(json, "_distinctIdentifier"), res.getDistinctIdentifierElement());
10259    if (json.has("manufacturer"))
10260      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
10261    if (json.has("_manufacturer"))
10262      parseElementProperties(getJObject(json, "_manufacturer"), res.getManufacturerElement());
10263    if (json.has("manufactureDate"))
10264      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
10265    if (json.has("_manufactureDate"))
10266      parseElementProperties(getJObject(json, "_manufactureDate"), res.getManufactureDateElement());
10267    if (json.has("expirationDate"))
10268      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
10269    if (json.has("_expirationDate"))
10270      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
10271    if (json.has("lotNumber"))
10272      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
10273    if (json.has("_lotNumber"))
10274      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
10275    if (json.has("serialNumber"))
10276      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
10277    if (json.has("_serialNumber"))
10278      parseElementProperties(getJObject(json, "_serialNumber"), res.getSerialNumberElement());
10279    if (json.has("deviceName")) {
10280      JsonArray array = getJArray(json, "deviceName");
10281      for (int i = 0; i < array.size(); i++) {
10282        res.getDeviceName().add(parseDeviceDeviceNameComponent(array.get(i).getAsJsonObject()));
10283      }
10284    };
10285    if (json.has("modelNumber"))
10286      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10287    if (json.has("_modelNumber"))
10288      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
10289    if (json.has("partNumber"))
10290      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
10291    if (json.has("_partNumber"))
10292      parseElementProperties(getJObject(json, "_partNumber"), res.getPartNumberElement());
10293    if (json.has("type"))
10294      res.setType(parseCodeableConcept(getJObject(json, "type")));
10295    if (json.has("specialization")) {
10296      JsonArray array = getJArray(json, "specialization");
10297      for (int i = 0; i < array.size(); i++) {
10298        res.getSpecialization().add(parseDeviceSpecializationComponent(array.get(i).getAsJsonObject()));
10299      }
10300    };
10301    if (json.has("version")) {
10302      JsonArray array = getJArray(json, "version");
10303      for (int i = 0; i < array.size(); i++) {
10304        res.getVersion().add(parseDeviceVersionComponent(array.get(i).getAsJsonObject()));
10305      }
10306    };
10307    if (json.has("property")) {
10308      JsonArray array = getJArray(json, "property");
10309      for (int i = 0; i < array.size(); i++) {
10310        res.getProperty().add(parseDevicePropertyComponent(array.get(i).getAsJsonObject()));
10311      }
10312    };
10313    if (json.has("patient"))
10314      res.setPatient(parseReference(getJObject(json, "patient")));
10315    if (json.has("owner"))
10316      res.setOwner(parseReference(getJObject(json, "owner")));
10317    if (json.has("contact")) {
10318      JsonArray array = getJArray(json, "contact");
10319      for (int i = 0; i < array.size(); i++) {
10320        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10321      }
10322    };
10323    if (json.has("location"))
10324      res.setLocation(parseReference(getJObject(json, "location")));
10325    if (json.has("url"))
10326      res.setUrlElement(parseUri(json.get("url").getAsString()));
10327    if (json.has("_url"))
10328      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10329    if (json.has("note")) {
10330      JsonArray array = getJArray(json, "note");
10331      for (int i = 0; i < array.size(); i++) {
10332        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10333      }
10334    };
10335    if (json.has("safety")) {
10336      JsonArray array = getJArray(json, "safety");
10337      for (int i = 0; i < array.size(); i++) {
10338        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10339      }
10340    };
10341    if (json.has("parent"))
10342      res.setParent(parseReference(getJObject(json, "parent")));
10343  }
10344
10345  protected Device.DeviceUdiCarrierComponent parseDeviceUdiCarrierComponent(JsonObject json) throws IOException, FHIRFormatError {
10346    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
10347    parseDeviceUdiCarrierComponentProperties(json, res);
10348    return res;
10349  }
10350
10351  protected void parseDeviceUdiCarrierComponentProperties(JsonObject json, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
10352    parseBackboneElementProperties(json, res);
10353    if (json.has("deviceIdentifier"))
10354      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10355    if (json.has("_deviceIdentifier"))
10356      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
10357    if (json.has("issuer"))
10358      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10359    if (json.has("_issuer"))
10360      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
10361    if (json.has("jurisdiction"))
10362      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10363    if (json.has("_jurisdiction"))
10364      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
10365    if (json.has("carrierAIDC"))
10366      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
10367    if (json.has("_carrierAIDC"))
10368      parseElementProperties(getJObject(json, "_carrierAIDC"), res.getCarrierAIDCElement());
10369    if (json.has("carrierHRF"))
10370      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
10371    if (json.has("_carrierHRF"))
10372      parseElementProperties(getJObject(json, "_carrierHRF"), res.getCarrierHRFElement());
10373    if (json.has("entryType"))
10374      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
10375    if (json.has("_entryType"))
10376      parseElementProperties(getJObject(json, "_entryType"), res.getEntryTypeElement());
10377  }
10378
10379  protected Device.DeviceDeviceNameComponent parseDeviceDeviceNameComponent(JsonObject json) throws IOException, FHIRFormatError {
10380    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
10381    parseDeviceDeviceNameComponentProperties(json, res);
10382    return res;
10383  }
10384
10385  protected void parseDeviceDeviceNameComponentProperties(JsonObject json, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
10386    parseBackboneElementProperties(json, res);
10387    if (json.has("name"))
10388      res.setNameElement(parseString(json.get("name").getAsString()));
10389    if (json.has("_name"))
10390      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10391    if (json.has("type"))
10392      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
10393    if (json.has("_type"))
10394      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10395  }
10396
10397  protected Device.DeviceSpecializationComponent parseDeviceSpecializationComponent(JsonObject json) throws IOException, FHIRFormatError {
10398    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
10399    parseDeviceSpecializationComponentProperties(json, res);
10400    return res;
10401  }
10402
10403  protected void parseDeviceSpecializationComponentProperties(JsonObject json, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
10404    parseBackboneElementProperties(json, res);
10405    if (json.has("systemType"))
10406      res.setSystemType(parseCodeableConcept(getJObject(json, "systemType")));
10407    if (json.has("version"))
10408      res.setVersionElement(parseString(json.get("version").getAsString()));
10409    if (json.has("_version"))
10410      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10411  }
10412
10413  protected Device.DeviceVersionComponent parseDeviceVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
10414    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
10415    parseDeviceVersionComponentProperties(json, res);
10416    return res;
10417  }
10418
10419  protected void parseDeviceVersionComponentProperties(JsonObject json, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
10420    parseBackboneElementProperties(json, res);
10421    if (json.has("type"))
10422      res.setType(parseCodeableConcept(getJObject(json, "type")));
10423    if (json.has("component"))
10424      res.setComponent(parseIdentifier(getJObject(json, "component")));
10425    if (json.has("value"))
10426      res.setValueElement(parseString(json.get("value").getAsString()));
10427    if (json.has("_value"))
10428      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
10429  }
10430
10431  protected Device.DevicePropertyComponent parseDevicePropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
10432    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
10433    parseDevicePropertyComponentProperties(json, res);
10434    return res;
10435  }
10436
10437  protected void parseDevicePropertyComponentProperties(JsonObject json, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
10438    parseBackboneElementProperties(json, res);
10439    if (json.has("type"))
10440      res.setType(parseCodeableConcept(getJObject(json, "type")));
10441    if (json.has("valueQuantity")) {
10442      JsonArray array = getJArray(json, "valueQuantity");
10443      for (int i = 0; i < array.size(); i++) {
10444        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10445      }
10446    };
10447    if (json.has("valueCode")) {
10448      JsonArray array = getJArray(json, "valueCode");
10449      for (int i = 0; i < array.size(); i++) {
10450        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10451      }
10452    };
10453  }
10454
10455  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
10456    DeviceDefinition res = new DeviceDefinition();
10457    parseDeviceDefinitionProperties(json, res);
10458    return res;
10459  }
10460
10461  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
10462    parseDomainResourceProperties(json, res);
10463    if (json.has("identifier")) {
10464      JsonArray array = getJArray(json, "identifier");
10465      for (int i = 0; i < array.size(); i++) {
10466        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10467      }
10468    };
10469    if (json.has("udiDeviceIdentifier")) {
10470      JsonArray array = getJArray(json, "udiDeviceIdentifier");
10471      for (int i = 0; i < array.size(); i++) {
10472        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject()));
10473      }
10474    };
10475    DataType manufacturer = parseType("manufacturer", json);
10476    if (manufacturer != null)
10477      res.setManufacturer(manufacturer);
10478    if (json.has("deviceName")) {
10479      JsonArray array = getJArray(json, "deviceName");
10480      for (int i = 0; i < array.size(); i++) {
10481        res.getDeviceName().add(parseDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject()));
10482      }
10483    };
10484    if (json.has("modelNumber"))
10485      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10486    if (json.has("_modelNumber"))
10487      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
10488    if (json.has("type"))
10489      res.setType(parseCodeableConcept(getJObject(json, "type")));
10490    if (json.has("specialization")) {
10491      JsonArray array = getJArray(json, "specialization");
10492      for (int i = 0; i < array.size(); i++) {
10493        res.getSpecialization().add(parseDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject()));
10494      }
10495    };
10496    if (json.has("version")) {
10497      JsonArray array = getJArray(json, "version");
10498      for (int i = 0; i < array.size(); i++) {
10499        if (array.get(i).isJsonNull()) {
10500          res.getVersion().add(new StringType());
10501        } else {;
10502          res.getVersion().add(parseString(array.get(i).getAsString()));
10503        }
10504      }
10505    };
10506    if (json.has("_version")) {
10507      JsonArray array = getJArray(json, "_version");
10508      for (int i = 0; i < array.size(); i++) {
10509        if (i == res.getVersion().size())
10510          res.getVersion().add(parseString(null));
10511        if (array.get(i) instanceof JsonObject) 
10512          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
10513      }
10514    };
10515    if (json.has("safety")) {
10516      JsonArray array = getJArray(json, "safety");
10517      for (int i = 0; i < array.size(); i++) {
10518        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10519      }
10520    };
10521    if (json.has("shelfLifeStorage")) {
10522      JsonArray array = getJArray(json, "shelfLifeStorage");
10523      for (int i = 0; i < array.size(); i++) {
10524        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
10525      }
10526    };
10527    if (json.has("physicalCharacteristics"))
10528      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
10529    if (json.has("languageCode")) {
10530      JsonArray array = getJArray(json, "languageCode");
10531      for (int i = 0; i < array.size(); i++) {
10532        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10533      }
10534    };
10535    if (json.has("capability")) {
10536      JsonArray array = getJArray(json, "capability");
10537      for (int i = 0; i < array.size(); i++) {
10538        res.getCapability().add(parseDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject()));
10539      }
10540    };
10541    if (json.has("property")) {
10542      JsonArray array = getJArray(json, "property");
10543      for (int i = 0; i < array.size(); i++) {
10544        res.getProperty().add(parseDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
10545      }
10546    };
10547    if (json.has("owner"))
10548      res.setOwner(parseReference(getJObject(json, "owner")));
10549    if (json.has("contact")) {
10550      JsonArray array = getJArray(json, "contact");
10551      for (int i = 0; i < array.size(); i++) {
10552        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10553      }
10554    };
10555    if (json.has("url"))
10556      res.setUrlElement(parseUri(json.get("url").getAsString()));
10557    if (json.has("_url"))
10558      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10559    if (json.has("onlineInformation"))
10560      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
10561    if (json.has("_onlineInformation"))
10562      parseElementProperties(getJObject(json, "_onlineInformation"), res.getOnlineInformationElement());
10563    if (json.has("note")) {
10564      JsonArray array = getJArray(json, "note");
10565      for (int i = 0; i < array.size(); i++) {
10566        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10567      }
10568    };
10569    if (json.has("quantity"))
10570      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
10571    if (json.has("parentDevice"))
10572      res.setParentDevice(parseReference(getJObject(json, "parentDevice")));
10573    if (json.has("material")) {
10574      JsonArray array = getJArray(json, "material");
10575      for (int i = 0; i < array.size(); i++) {
10576        res.getMaterial().add(parseDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject()));
10577      }
10578    };
10579  }
10580
10581  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json) throws IOException, FHIRFormatError {
10582    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
10583    parseDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, res);
10584    return res;
10585  }
10586
10587  protected void parseDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
10588    parseBackboneElementProperties(json, res);
10589    if (json.has("deviceIdentifier"))
10590      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10591    if (json.has("_deviceIdentifier"))
10592      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
10593    if (json.has("issuer"))
10594      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10595    if (json.has("_issuer"))
10596      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
10597    if (json.has("jurisdiction"))
10598      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10599    if (json.has("_jurisdiction"))
10600      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
10601  }
10602
10603  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceNameComponent(JsonObject json) throws IOException, FHIRFormatError {
10604    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
10605    parseDeviceDefinitionDeviceNameComponentProperties(json, res);
10606    return res;
10607  }
10608
10609  protected void parseDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
10610    parseBackboneElementProperties(json, res);
10611    if (json.has("name"))
10612      res.setNameElement(parseString(json.get("name").getAsString()));
10613    if (json.has("_name"))
10614      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10615    if (json.has("type"))
10616      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
10617    if (json.has("_type"))
10618      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10619  }
10620
10621  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionSpecializationComponent(JsonObject json) throws IOException, FHIRFormatError {
10622    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
10623    parseDeviceDefinitionSpecializationComponentProperties(json, res);
10624    return res;
10625  }
10626
10627  protected void parseDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
10628    parseBackboneElementProperties(json, res);
10629    if (json.has("systemType"))
10630      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
10631    if (json.has("_systemType"))
10632      parseElementProperties(getJObject(json, "_systemType"), res.getSystemTypeElement());
10633    if (json.has("version"))
10634      res.setVersionElement(parseString(json.get("version").getAsString()));
10635    if (json.has("_version"))
10636      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10637  }
10638
10639  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionCapabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
10640    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
10641    parseDeviceDefinitionCapabilityComponentProperties(json, res);
10642    return res;
10643  }
10644
10645  protected void parseDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
10646    parseBackboneElementProperties(json, res);
10647    if (json.has("type"))
10648      res.setType(parseCodeableConcept(getJObject(json, "type")));
10649    if (json.has("description")) {
10650      JsonArray array = getJArray(json, "description");
10651      for (int i = 0; i < array.size(); i++) {
10652        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10653      }
10654    };
10655  }
10656
10657  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
10658    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
10659    parseDeviceDefinitionPropertyComponentProperties(json, res);
10660    return res;
10661  }
10662
10663  protected void parseDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
10664    parseBackboneElementProperties(json, res);
10665    if (json.has("type"))
10666      res.setType(parseCodeableConcept(getJObject(json, "type")));
10667    if (json.has("valueQuantity")) {
10668      JsonArray array = getJArray(json, "valueQuantity");
10669      for (int i = 0; i < array.size(); i++) {
10670        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10671      }
10672    };
10673    if (json.has("valueCode")) {
10674      JsonArray array = getJArray(json, "valueCode");
10675      for (int i = 0; i < array.size(); i++) {
10676        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10677      }
10678    };
10679  }
10680
10681  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionMaterialComponent(JsonObject json) throws IOException, FHIRFormatError {
10682    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
10683    parseDeviceDefinitionMaterialComponentProperties(json, res);
10684    return res;
10685  }
10686
10687  protected void parseDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
10688    parseBackboneElementProperties(json, res);
10689    if (json.has("substance"))
10690      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
10691    if (json.has("alternate"))
10692      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
10693    if (json.has("_alternate"))
10694      parseElementProperties(getJObject(json, "_alternate"), res.getAlternateElement());
10695    if (json.has("allergenicIndicator"))
10696      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
10697    if (json.has("_allergenicIndicator"))
10698      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
10699  }
10700
10701  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
10702    DeviceMetric res = new DeviceMetric();
10703    parseDeviceMetricProperties(json, res);
10704    return res;
10705  }
10706
10707  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
10708    parseDomainResourceProperties(json, res);
10709    if (json.has("identifier")) {
10710      JsonArray array = getJArray(json, "identifier");
10711      for (int i = 0; i < array.size(); i++) {
10712        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10713      }
10714    };
10715    if (json.has("type"))
10716      res.setType(parseCodeableConcept(getJObject(json, "type")));
10717    if (json.has("unit"))
10718      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
10719    if (json.has("source"))
10720      res.setSource(parseReference(getJObject(json, "source")));
10721    if (json.has("parent"))
10722      res.setParent(parseReference(getJObject(json, "parent")));
10723    if (json.has("operationalStatus"))
10724      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
10725    if (json.has("_operationalStatus"))
10726      parseElementProperties(getJObject(json, "_operationalStatus"), res.getOperationalStatusElement());
10727    if (json.has("color"))
10728      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
10729    if (json.has("_color"))
10730      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
10731    if (json.has("category"))
10732      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
10733    if (json.has("_category"))
10734      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
10735    if (json.has("measurementPeriod"))
10736      res.setMeasurementPeriod(parseTiming(getJObject(json, "measurementPeriod")));
10737    if (json.has("calibration")) {
10738      JsonArray array = getJArray(json, "calibration");
10739      for (int i = 0; i < array.size(); i++) {
10740        res.getCalibration().add(parseDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject()));
10741      }
10742    };
10743  }
10744
10745  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricCalibrationComponent(JsonObject json) throws IOException, FHIRFormatError {
10746    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
10747    parseDeviceMetricCalibrationComponentProperties(json, res);
10748    return res;
10749  }
10750
10751  protected void parseDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
10752    parseBackboneElementProperties(json, res);
10753    if (json.has("type"))
10754      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
10755    if (json.has("_type"))
10756      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10757    if (json.has("state"))
10758      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
10759    if (json.has("_state"))
10760      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
10761    if (json.has("time"))
10762      res.setTimeElement(parseInstant(json.get("time").getAsString()));
10763    if (json.has("_time"))
10764      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
10765  }
10766
10767  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
10768    DeviceRequest res = new DeviceRequest();
10769    parseDeviceRequestProperties(json, res);
10770    return res;
10771  }
10772
10773  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
10774    parseDomainResourceProperties(json, res);
10775    if (json.has("identifier")) {
10776      JsonArray array = getJArray(json, "identifier");
10777      for (int i = 0; i < array.size(); i++) {
10778        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10779      }
10780    };
10781    if (json.has("instantiatesCanonical")) {
10782      JsonArray array = getJArray(json, "instantiatesCanonical");
10783      for (int i = 0; i < array.size(); i++) {
10784        if (array.get(i).isJsonNull()) {
10785          res.getInstantiatesCanonical().add(new CanonicalType());
10786        } else {;
10787          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
10788        }
10789      }
10790    };
10791    if (json.has("_instantiatesCanonical")) {
10792      JsonArray array = getJArray(json, "_instantiatesCanonical");
10793      for (int i = 0; i < array.size(); i++) {
10794        if (i == res.getInstantiatesCanonical().size())
10795          res.getInstantiatesCanonical().add(parseCanonical(null));
10796        if (array.get(i) instanceof JsonObject) 
10797          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
10798      }
10799    };
10800    if (json.has("instantiatesUri")) {
10801      JsonArray array = getJArray(json, "instantiatesUri");
10802      for (int i = 0; i < array.size(); i++) {
10803        if (array.get(i).isJsonNull()) {
10804          res.getInstantiatesUri().add(new UriType());
10805        } else {;
10806          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
10807        }
10808      }
10809    };
10810    if (json.has("_instantiatesUri")) {
10811      JsonArray array = getJArray(json, "_instantiatesUri");
10812      for (int i = 0; i < array.size(); i++) {
10813        if (i == res.getInstantiatesUri().size())
10814          res.getInstantiatesUri().add(parseUri(null));
10815        if (array.get(i) instanceof JsonObject) 
10816          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
10817      }
10818    };
10819    if (json.has("basedOn")) {
10820      JsonArray array = getJArray(json, "basedOn");
10821      for (int i = 0; i < array.size(); i++) {
10822        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10823      }
10824    };
10825    if (json.has("priorRequest")) {
10826      JsonArray array = getJArray(json, "priorRequest");
10827      for (int i = 0; i < array.size(); i++) {
10828        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
10829      }
10830    };
10831    if (json.has("groupIdentifier"))
10832      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
10833    if (json.has("status"))
10834      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
10835    if (json.has("_status"))
10836      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10837    if (json.has("intent"))
10838      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
10839    if (json.has("_intent"))
10840      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
10841    if (json.has("priority"))
10842      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
10843    if (json.has("_priority"))
10844      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
10845    DataType code = parseType("code", json);
10846    if (code != null)
10847      res.setCode(code);
10848    if (json.has("parameter")) {
10849      JsonArray array = getJArray(json, "parameter");
10850      for (int i = 0; i < array.size(); i++) {
10851        res.getParameter().add(parseDeviceRequestParameterComponent(array.get(i).getAsJsonObject()));
10852      }
10853    };
10854    if (json.has("subject"))
10855      res.setSubject(parseReference(getJObject(json, "subject")));
10856    if (json.has("encounter"))
10857      res.setEncounter(parseReference(getJObject(json, "encounter")));
10858    DataType occurrence = parseType("occurrence", json);
10859    if (occurrence != null)
10860      res.setOccurrence(occurrence);
10861    if (json.has("authoredOn"))
10862      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
10863    if (json.has("_authoredOn"))
10864      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
10865    if (json.has("requester"))
10866      res.setRequester(parseReference(getJObject(json, "requester")));
10867    if (json.has("performerType"))
10868      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
10869    if (json.has("performer"))
10870      res.setPerformer(parseReference(getJObject(json, "performer")));
10871    if (json.has("reasonCode")) {
10872      JsonArray array = getJArray(json, "reasonCode");
10873      for (int i = 0; i < array.size(); i++) {
10874        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10875      }
10876    };
10877    if (json.has("reasonReference")) {
10878      JsonArray array = getJArray(json, "reasonReference");
10879      for (int i = 0; i < array.size(); i++) {
10880        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10881      }
10882    };
10883    if (json.has("insurance")) {
10884      JsonArray array = getJArray(json, "insurance");
10885      for (int i = 0; i < array.size(); i++) {
10886        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
10887      }
10888    };
10889    if (json.has("supportingInfo")) {
10890      JsonArray array = getJArray(json, "supportingInfo");
10891      for (int i = 0; i < array.size(); i++) {
10892        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
10893      }
10894    };
10895    if (json.has("note")) {
10896      JsonArray array = getJArray(json, "note");
10897      for (int i = 0; i < array.size(); i++) {
10898        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10899      }
10900    };
10901    if (json.has("relevantHistory")) {
10902      JsonArray array = getJArray(json, "relevantHistory");
10903      for (int i = 0; i < array.size(); i++) {
10904        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
10905      }
10906    };
10907  }
10908
10909  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
10910    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
10911    parseDeviceRequestParameterComponentProperties(json, res);
10912    return res;
10913  }
10914
10915  protected void parseDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
10916    parseBackboneElementProperties(json, res);
10917    if (json.has("code"))
10918      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10919    DataType value = parseType("value", json);
10920    if (value != null)
10921      res.setValue(value);
10922  }
10923
10924  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
10925    DeviceUseStatement res = new DeviceUseStatement();
10926    parseDeviceUseStatementProperties(json, res);
10927    return res;
10928  }
10929
10930  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
10931    parseDomainResourceProperties(json, res);
10932    if (json.has("identifier")) {
10933      JsonArray array = getJArray(json, "identifier");
10934      for (int i = 0; i < array.size(); i++) {
10935        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10936      }
10937    };
10938    if (json.has("basedOn")) {
10939      JsonArray array = getJArray(json, "basedOn");
10940      for (int i = 0; i < array.size(); i++) {
10941        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10942      }
10943    };
10944    if (json.has("status"))
10945      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
10946    if (json.has("_status"))
10947      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10948    if (json.has("subject"))
10949      res.setSubject(parseReference(getJObject(json, "subject")));
10950    if (json.has("derivedFrom")) {
10951      JsonArray array = getJArray(json, "derivedFrom");
10952      for (int i = 0; i < array.size(); i++) {
10953        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
10954      }
10955    };
10956    DataType timing = parseType("timing", json);
10957    if (timing != null)
10958      res.setTiming(timing);
10959    if (json.has("recordedOn"))
10960      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
10961    if (json.has("_recordedOn"))
10962      parseElementProperties(getJObject(json, "_recordedOn"), res.getRecordedOnElement());
10963    if (json.has("source"))
10964      res.setSource(parseReference(getJObject(json, "source")));
10965    if (json.has("device"))
10966      res.setDevice(parseReference(getJObject(json, "device")));
10967    if (json.has("reasonCode")) {
10968      JsonArray array = getJArray(json, "reasonCode");
10969      for (int i = 0; i < array.size(); i++) {
10970        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10971      }
10972    };
10973    if (json.has("reasonReference")) {
10974      JsonArray array = getJArray(json, "reasonReference");
10975      for (int i = 0; i < array.size(); i++) {
10976        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10977      }
10978    };
10979    if (json.has("bodySite"))
10980      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
10981    if (json.has("note")) {
10982      JsonArray array = getJArray(json, "note");
10983      for (int i = 0; i < array.size(); i++) {
10984        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10985      }
10986    };
10987  }
10988
10989  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
10990    DiagnosticReport res = new DiagnosticReport();
10991    parseDiagnosticReportProperties(json, res);
10992    return res;
10993  }
10994
10995  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
10996    parseDomainResourceProperties(json, res);
10997    if (json.has("identifier")) {
10998      JsonArray array = getJArray(json, "identifier");
10999      for (int i = 0; i < array.size(); i++) {
11000        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11001      }
11002    };
11003    if (json.has("basedOn")) {
11004      JsonArray array = getJArray(json, "basedOn");
11005      for (int i = 0; i < array.size(); i++) {
11006        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11007      }
11008    };
11009    if (json.has("status"))
11010      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
11011    if (json.has("_status"))
11012      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11013    if (json.has("category")) {
11014      JsonArray array = getJArray(json, "category");
11015      for (int i = 0; i < array.size(); i++) {
11016        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11017      }
11018    };
11019    if (json.has("code"))
11020      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11021    if (json.has("subject"))
11022      res.setSubject(parseReference(getJObject(json, "subject")));
11023    if (json.has("encounter"))
11024      res.setEncounter(parseReference(getJObject(json, "encounter")));
11025    DataType effective = parseType("effective", json);
11026    if (effective != null)
11027      res.setEffective(effective);
11028    if (json.has("issued"))
11029      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
11030    if (json.has("_issued"))
11031      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
11032    if (json.has("performer")) {
11033      JsonArray array = getJArray(json, "performer");
11034      for (int i = 0; i < array.size(); i++) {
11035        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
11036      }
11037    };
11038    if (json.has("resultsInterpreter")) {
11039      JsonArray array = getJArray(json, "resultsInterpreter");
11040      for (int i = 0; i < array.size(); i++) {
11041        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
11042      }
11043    };
11044    if (json.has("specimen")) {
11045      JsonArray array = getJArray(json, "specimen");
11046      for (int i = 0; i < array.size(); i++) {
11047        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
11048      }
11049    };
11050    if (json.has("result")) {
11051      JsonArray array = getJArray(json, "result");
11052      for (int i = 0; i < array.size(); i++) {
11053        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
11054      }
11055    };
11056    if (json.has("imagingStudy")) {
11057      JsonArray array = getJArray(json, "imagingStudy");
11058      for (int i = 0; i < array.size(); i++) {
11059        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
11060      }
11061    };
11062    if (json.has("media")) {
11063      JsonArray array = getJArray(json, "media");
11064      for (int i = 0; i < array.size(); i++) {
11065        res.getMedia().add(parseDiagnosticReportMediaComponent(array.get(i).getAsJsonObject()));
11066      }
11067    };
11068    if (json.has("conclusion"))
11069      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
11070    if (json.has("_conclusion"))
11071      parseElementProperties(getJObject(json, "_conclusion"), res.getConclusionElement());
11072    if (json.has("conclusionCode")) {
11073      JsonArray array = getJArray(json, "conclusionCode");
11074      for (int i = 0; i < array.size(); i++) {
11075        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11076      }
11077    };
11078    if (json.has("presentedForm")) {
11079      JsonArray array = getJArray(json, "presentedForm");
11080      for (int i = 0; i < array.size(); i++) {
11081        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
11082      }
11083    };
11084  }
11085
11086  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportMediaComponent(JsonObject json) throws IOException, FHIRFormatError {
11087    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
11088    parseDiagnosticReportMediaComponentProperties(json, res);
11089    return res;
11090  }
11091
11092  protected void parseDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
11093    parseBackboneElementProperties(json, res);
11094    if (json.has("comment"))
11095      res.setCommentElement(parseString(json.get("comment").getAsString()));
11096    if (json.has("_comment"))
11097      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
11098    if (json.has("link"))
11099      res.setLink(parseReference(getJObject(json, "link")));
11100  }
11101
11102  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
11103    DocumentManifest res = new DocumentManifest();
11104    parseDocumentManifestProperties(json, res);
11105    return res;
11106  }
11107
11108  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
11109    parseDomainResourceProperties(json, res);
11110    if (json.has("masterIdentifier"))
11111      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
11112    if (json.has("identifier")) {
11113      JsonArray array = getJArray(json, "identifier");
11114      for (int i = 0; i < array.size(); i++) {
11115        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11116      }
11117    };
11118    if (json.has("status"))
11119      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
11120    if (json.has("_status"))
11121      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11122    if (json.has("type"))
11123      res.setType(parseCodeableConcept(getJObject(json, "type")));
11124    if (json.has("subject"))
11125      res.setSubject(parseReference(getJObject(json, "subject")));
11126    if (json.has("created"))
11127      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11128    if (json.has("_created"))
11129      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11130    if (json.has("author")) {
11131      JsonArray array = getJArray(json, "author");
11132      for (int i = 0; i < array.size(); i++) {
11133        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
11134      }
11135    };
11136    if (json.has("recipient")) {
11137      JsonArray array = getJArray(json, "recipient");
11138      for (int i = 0; i < array.size(); i++) {
11139        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
11140      }
11141    };
11142    if (json.has("source"))
11143      res.setSourceElement(parseUri(json.get("source").getAsString()));
11144    if (json.has("_source"))
11145      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
11146    if (json.has("description"))
11147      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11148    if (json.has("_description"))
11149      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11150    if (json.has("content")) {
11151      JsonArray array = getJArray(json, "content");
11152      for (int i = 0; i < array.size(); i++) {
11153        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
11154      }
11155    };
11156    if (json.has("related")) {
11157      JsonArray array = getJArray(json, "related");
11158      for (int i = 0; i < array.size(); i++) {
11159        res.getRelated().add(parseDocumentManifestRelatedComponent(array.get(i).getAsJsonObject()));
11160      }
11161    };
11162  }
11163
11164  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestRelatedComponent(JsonObject json) throws IOException, FHIRFormatError {
11165    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
11166    parseDocumentManifestRelatedComponentProperties(json, res);
11167    return res;
11168  }
11169
11170  protected void parseDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
11171    parseBackboneElementProperties(json, res);
11172    if (json.has("identifier"))
11173      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11174    if (json.has("ref"))
11175      res.setRef(parseReference(getJObject(json, "ref")));
11176  }
11177
11178  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
11179    DocumentReference res = new DocumentReference();
11180    parseDocumentReferenceProperties(json, res);
11181    return res;
11182  }
11183
11184  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
11185    parseDomainResourceProperties(json, res);
11186    if (json.has("masterIdentifier"))
11187      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
11188    if (json.has("identifier")) {
11189      JsonArray array = getJArray(json, "identifier");
11190      for (int i = 0; i < array.size(); i++) {
11191        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11192      }
11193    };
11194    if (json.has("status"))
11195      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
11196    if (json.has("_status"))
11197      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11198    if (json.has("docStatus"))
11199      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
11200    if (json.has("_docStatus"))
11201      parseElementProperties(getJObject(json, "_docStatus"), res.getDocStatusElement());
11202    if (json.has("type"))
11203      res.setType(parseCodeableConcept(getJObject(json, "type")));
11204    if (json.has("category")) {
11205      JsonArray array = getJArray(json, "category");
11206      for (int i = 0; i < array.size(); i++) {
11207        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11208      }
11209    };
11210    if (json.has("subject"))
11211      res.setSubject(parseReference(getJObject(json, "subject")));
11212    if (json.has("date"))
11213      res.setDateElement(parseInstant(json.get("date").getAsString()));
11214    if (json.has("_date"))
11215      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11216    if (json.has("author")) {
11217      JsonArray array = getJArray(json, "author");
11218      for (int i = 0; i < array.size(); i++) {
11219        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
11220      }
11221    };
11222    if (json.has("authenticator"))
11223      res.setAuthenticator(parseReference(getJObject(json, "authenticator")));
11224    if (json.has("custodian"))
11225      res.setCustodian(parseReference(getJObject(json, "custodian")));
11226    if (json.has("relatesTo")) {
11227      JsonArray array = getJArray(json, "relatesTo");
11228      for (int i = 0; i < array.size(); i++) {
11229        res.getRelatesTo().add(parseDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject()));
11230      }
11231    };
11232    if (json.has("description"))
11233      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11234    if (json.has("_description"))
11235      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11236    if (json.has("securityLabel")) {
11237      JsonArray array = getJArray(json, "securityLabel");
11238      for (int i = 0; i < array.size(); i++) {
11239        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11240      }
11241    };
11242    if (json.has("content")) {
11243      JsonArray array = getJArray(json, "content");
11244      for (int i = 0; i < array.size(); i++) {
11245        res.getContent().add(parseDocumentReferenceContentComponent(array.get(i).getAsJsonObject()));
11246      }
11247    };
11248    if (json.has("context"))
11249      res.setContext(parseDocumentReferenceContextComponent(getJObject(json, "context")));
11250  }
11251
11252  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
11253    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
11254    parseDocumentReferenceRelatesToComponentProperties(json, res);
11255    return res;
11256  }
11257
11258  protected void parseDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
11259    parseBackboneElementProperties(json, res);
11260    if (json.has("code"))
11261      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.DocumentRelationshipType.NULL, new Enumerations.DocumentRelationshipTypeEnumFactory()));
11262    if (json.has("_code"))
11263      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
11264    if (json.has("target"))
11265      res.setTarget(parseReference(getJObject(json, "target")));
11266  }
11267
11268  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceContentComponent(JsonObject json) throws IOException, FHIRFormatError {
11269    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
11270    parseDocumentReferenceContentComponentProperties(json, res);
11271    return res;
11272  }
11273
11274  protected void parseDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
11275    parseBackboneElementProperties(json, res);
11276    if (json.has("attachment"))
11277      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
11278    if (json.has("format"))
11279      res.setFormat(parseCoding(getJObject(json, "format")));
11280  }
11281
11282  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceContextComponent(JsonObject json) throws IOException, FHIRFormatError {
11283    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
11284    parseDocumentReferenceContextComponentProperties(json, res);
11285    return res;
11286  }
11287
11288  protected void parseDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
11289    parseBackboneElementProperties(json, res);
11290    if (json.has("encounter")) {
11291      JsonArray array = getJArray(json, "encounter");
11292      for (int i = 0; i < array.size(); i++) {
11293        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
11294      }
11295    };
11296    if (json.has("event")) {
11297      JsonArray array = getJArray(json, "event");
11298      for (int i = 0; i < array.size(); i++) {
11299        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11300      }
11301    };
11302    if (json.has("period"))
11303      res.setPeriod(parsePeriod(getJObject(json, "period")));
11304    if (json.has("facilityType"))
11305      res.setFacilityType(parseCodeableConcept(getJObject(json, "facilityType")));
11306    if (json.has("practiceSetting"))
11307      res.setPracticeSetting(parseCodeableConcept(getJObject(json, "practiceSetting")));
11308    if (json.has("sourcePatientInfo"))
11309      res.setSourcePatientInfo(parseReference(getJObject(json, "sourcePatientInfo")));
11310    if (json.has("related")) {
11311      JsonArray array = getJArray(json, "related");
11312      for (int i = 0; i < array.size(); i++) {
11313        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
11314      }
11315    };
11316  }
11317
11318  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
11319    Encounter res = new Encounter();
11320    parseEncounterProperties(json, res);
11321    return res;
11322  }
11323
11324  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
11325    parseDomainResourceProperties(json, res);
11326    if (json.has("identifier")) {
11327      JsonArray array = getJArray(json, "identifier");
11328      for (int i = 0; i < array.size(); i++) {
11329        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11330      }
11331    };
11332    if (json.has("status"))
11333      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
11334    if (json.has("_status"))
11335      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11336    if (json.has("statusHistory")) {
11337      JsonArray array = getJArray(json, "statusHistory");
11338      for (int i = 0; i < array.size(); i++) {
11339        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject()));
11340      }
11341    };
11342    if (json.has("class"))
11343      res.setClass_(parseCoding(getJObject(json, "class")));
11344    if (json.has("classHistory")) {
11345      JsonArray array = getJArray(json, "classHistory");
11346      for (int i = 0; i < array.size(); i++) {
11347        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject()));
11348      }
11349    };
11350    if (json.has("type")) {
11351      JsonArray array = getJArray(json, "type");
11352      for (int i = 0; i < array.size(); i++) {
11353        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11354      }
11355    };
11356    if (json.has("serviceType"))
11357      res.setServiceType(parseCodeableConcept(getJObject(json, "serviceType")));
11358    if (json.has("priority"))
11359      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
11360    if (json.has("subject"))
11361      res.setSubject(parseReference(getJObject(json, "subject")));
11362    if (json.has("episodeOfCare")) {
11363      JsonArray array = getJArray(json, "episodeOfCare");
11364      for (int i = 0; i < array.size(); i++) {
11365        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
11366      }
11367    };
11368    if (json.has("basedOn")) {
11369      JsonArray array = getJArray(json, "basedOn");
11370      for (int i = 0; i < array.size(); i++) {
11371        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11372      }
11373    };
11374    if (json.has("participant")) {
11375      JsonArray array = getJArray(json, "participant");
11376      for (int i = 0; i < array.size(); i++) {
11377        res.getParticipant().add(parseEncounterParticipantComponent(array.get(i).getAsJsonObject()));
11378      }
11379    };
11380    if (json.has("appointment")) {
11381      JsonArray array = getJArray(json, "appointment");
11382      for (int i = 0; i < array.size(); i++) {
11383        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
11384      }
11385    };
11386    if (json.has("period"))
11387      res.setPeriod(parsePeriod(getJObject(json, "period")));
11388    if (json.has("length"))
11389      res.setLength(parseDuration(getJObject(json, "length")));
11390    if (json.has("reasonCode")) {
11391      JsonArray array = getJArray(json, "reasonCode");
11392      for (int i = 0; i < array.size(); i++) {
11393        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11394      }
11395    };
11396    if (json.has("reasonReference")) {
11397      JsonArray array = getJArray(json, "reasonReference");
11398      for (int i = 0; i < array.size(); i++) {
11399        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11400      }
11401    };
11402    if (json.has("diagnosis")) {
11403      JsonArray array = getJArray(json, "diagnosis");
11404      for (int i = 0; i < array.size(); i++) {
11405        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject()));
11406      }
11407    };
11408    if (json.has("account")) {
11409      JsonArray array = getJArray(json, "account");
11410      for (int i = 0; i < array.size(); i++) {
11411        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11412      }
11413    };
11414    if (json.has("hospitalization"))
11415      res.setHospitalization(parseEncounterHospitalizationComponent(getJObject(json, "hospitalization")));
11416    if (json.has("location")) {
11417      JsonArray array = getJArray(json, "location");
11418      for (int i = 0; i < array.size(); i++) {
11419        res.getLocation().add(parseEncounterLocationComponent(array.get(i).getAsJsonObject()));
11420      }
11421    };
11422    if (json.has("serviceProvider"))
11423      res.setServiceProvider(parseReference(getJObject(json, "serviceProvider")));
11424    if (json.has("partOf"))
11425      res.setPartOf(parseReference(getJObject(json, "partOf")));
11426  }
11427
11428  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json) throws IOException, FHIRFormatError {
11429    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
11430    parseEncounterStatusHistoryComponentProperties(json, res);
11431    return res;
11432  }
11433
11434  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
11435    parseBackboneElementProperties(json, res);
11436    if (json.has("status"))
11437      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
11438    if (json.has("_status"))
11439      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11440    if (json.has("period"))
11441      res.setPeriod(parsePeriod(getJObject(json, "period")));
11442  }
11443
11444  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json) throws IOException, FHIRFormatError {
11445    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
11446    parseEncounterClassHistoryComponentProperties(json, res);
11447    return res;
11448  }
11449
11450  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
11451    parseBackboneElementProperties(json, res);
11452    if (json.has("class"))
11453      res.setClass_(parseCoding(getJObject(json, "class")));
11454    if (json.has("period"))
11455      res.setPeriod(parsePeriod(getJObject(json, "period")));
11456  }
11457
11458  protected Encounter.EncounterParticipantComponent parseEncounterParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
11459    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
11460    parseEncounterParticipantComponentProperties(json, res);
11461    return res;
11462  }
11463
11464  protected void parseEncounterParticipantComponentProperties(JsonObject json, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
11465    parseBackboneElementProperties(json, res);
11466    if (json.has("type")) {
11467      JsonArray array = getJArray(json, "type");
11468      for (int i = 0; i < array.size(); i++) {
11469        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11470      }
11471    };
11472    if (json.has("period"))
11473      res.setPeriod(parsePeriod(getJObject(json, "period")));
11474    if (json.has("individual"))
11475      res.setIndividual(parseReference(getJObject(json, "individual")));
11476  }
11477
11478  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
11479    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
11480    parseEncounterDiagnosisComponentProperties(json, res);
11481    return res;
11482  }
11483
11484  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
11485    parseBackboneElementProperties(json, res);
11486    if (json.has("condition"))
11487      res.setCondition(parseReference(getJObject(json, "condition")));
11488    if (json.has("use"))
11489      res.setUse(parseCodeableConcept(getJObject(json, "use")));
11490    if (json.has("rank"))
11491      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
11492    if (json.has("_rank"))
11493      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
11494  }
11495
11496  protected Encounter.EncounterHospitalizationComponent parseEncounterHospitalizationComponent(JsonObject json) throws IOException, FHIRFormatError {
11497    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
11498    parseEncounterHospitalizationComponentProperties(json, res);
11499    return res;
11500  }
11501
11502  protected void parseEncounterHospitalizationComponentProperties(JsonObject json, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
11503    parseBackboneElementProperties(json, res);
11504    if (json.has("preAdmissionIdentifier"))
11505      res.setPreAdmissionIdentifier(parseIdentifier(getJObject(json, "preAdmissionIdentifier")));
11506    if (json.has("origin"))
11507      res.setOrigin(parseReference(getJObject(json, "origin")));
11508    if (json.has("admitSource"))
11509      res.setAdmitSource(parseCodeableConcept(getJObject(json, "admitSource")));
11510    if (json.has("reAdmission"))
11511      res.setReAdmission(parseCodeableConcept(getJObject(json, "reAdmission")));
11512    if (json.has("dietPreference")) {
11513      JsonArray array = getJArray(json, "dietPreference");
11514      for (int i = 0; i < array.size(); i++) {
11515        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11516      }
11517    };
11518    if (json.has("specialCourtesy")) {
11519      JsonArray array = getJArray(json, "specialCourtesy");
11520      for (int i = 0; i < array.size(); i++) {
11521        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11522      }
11523    };
11524    if (json.has("specialArrangement")) {
11525      JsonArray array = getJArray(json, "specialArrangement");
11526      for (int i = 0; i < array.size(); i++) {
11527        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11528      }
11529    };
11530    if (json.has("destination"))
11531      res.setDestination(parseReference(getJObject(json, "destination")));
11532    if (json.has("dischargeDisposition"))
11533      res.setDischargeDisposition(parseCodeableConcept(getJObject(json, "dischargeDisposition")));
11534  }
11535
11536  protected Encounter.EncounterLocationComponent parseEncounterLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
11537    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
11538    parseEncounterLocationComponentProperties(json, res);
11539    return res;
11540  }
11541
11542  protected void parseEncounterLocationComponentProperties(JsonObject json, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
11543    parseBackboneElementProperties(json, res);
11544    if (json.has("location"))
11545      res.setLocation(parseReference(getJObject(json, "location")));
11546    if (json.has("status"))
11547      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
11548    if (json.has("_status"))
11549      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11550    if (json.has("physicalType"))
11551      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
11552    if (json.has("period"))
11553      res.setPeriod(parsePeriod(getJObject(json, "period")));
11554  }
11555
11556  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
11557    Endpoint res = new Endpoint();
11558    parseEndpointProperties(json, res);
11559    return res;
11560  }
11561
11562  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
11563    parseDomainResourceProperties(json, res);
11564    if (json.has("identifier")) {
11565      JsonArray array = getJArray(json, "identifier");
11566      for (int i = 0; i < array.size(); i++) {
11567        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11568      }
11569    };
11570    if (json.has("status"))
11571      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
11572    if (json.has("_status"))
11573      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11574    if (json.has("connectionType"))
11575      res.setConnectionType(parseCoding(getJObject(json, "connectionType")));
11576    if (json.has("name"))
11577      res.setNameElement(parseString(json.get("name").getAsString()));
11578    if (json.has("_name"))
11579      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11580    if (json.has("managingOrganization"))
11581      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
11582    if (json.has("contact")) {
11583      JsonArray array = getJArray(json, "contact");
11584      for (int i = 0; i < array.size(); i++) {
11585        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
11586      }
11587    };
11588    if (json.has("period"))
11589      res.setPeriod(parsePeriod(getJObject(json, "period")));
11590    if (json.has("payloadType")) {
11591      JsonArray array = getJArray(json, "payloadType");
11592      for (int i = 0; i < array.size(); i++) {
11593        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11594      }
11595    };
11596    if (json.has("payloadMimeType")) {
11597      JsonArray array = getJArray(json, "payloadMimeType");
11598      for (int i = 0; i < array.size(); i++) {
11599        if (array.get(i).isJsonNull()) {
11600          res.getPayloadMimeType().add(new CodeType());
11601        } else {;
11602          res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
11603        }
11604      }
11605    };
11606    if (json.has("_payloadMimeType")) {
11607      JsonArray array = getJArray(json, "_payloadMimeType");
11608      for (int i = 0; i < array.size(); i++) {
11609        if (i == res.getPayloadMimeType().size())
11610          res.getPayloadMimeType().add(parseCode(null));
11611        if (array.get(i) instanceof JsonObject) 
11612          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
11613      }
11614    };
11615    if (json.has("address"))
11616      res.setAddressElement(parseUrl(json.get("address").getAsString()));
11617    if (json.has("_address"))
11618      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
11619    if (json.has("header")) {
11620      JsonArray array = getJArray(json, "header");
11621      for (int i = 0; i < array.size(); i++) {
11622        if (array.get(i).isJsonNull()) {
11623          res.getHeader().add(new StringType());
11624        } else {;
11625          res.getHeader().add(parseString(array.get(i).getAsString()));
11626        }
11627      }
11628    };
11629    if (json.has("_header")) {
11630      JsonArray array = getJArray(json, "_header");
11631      for (int i = 0; i < array.size(); i++) {
11632        if (i == res.getHeader().size())
11633          res.getHeader().add(parseString(null));
11634        if (array.get(i) instanceof JsonObject) 
11635          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
11636      }
11637    };
11638  }
11639
11640  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
11641    EnrollmentRequest res = new EnrollmentRequest();
11642    parseEnrollmentRequestProperties(json, res);
11643    return res;
11644  }
11645
11646  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
11647    parseDomainResourceProperties(json, res);
11648    if (json.has("identifier")) {
11649      JsonArray array = getJArray(json, "identifier");
11650      for (int i = 0; i < array.size(); i++) {
11651        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11652      }
11653    };
11654    if (json.has("status"))
11655      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
11656    if (json.has("_status"))
11657      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11658    if (json.has("created"))
11659      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11660    if (json.has("_created"))
11661      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11662    if (json.has("insurer"))
11663      res.setInsurer(parseReference(getJObject(json, "insurer")));
11664    if (json.has("provider"))
11665      res.setProvider(parseReference(getJObject(json, "provider")));
11666    if (json.has("candidate"))
11667      res.setCandidate(parseReference(getJObject(json, "candidate")));
11668    if (json.has("coverage"))
11669      res.setCoverage(parseReference(getJObject(json, "coverage")));
11670  }
11671
11672  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
11673    EnrollmentResponse res = new EnrollmentResponse();
11674    parseEnrollmentResponseProperties(json, res);
11675    return res;
11676  }
11677
11678  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
11679    parseDomainResourceProperties(json, res);
11680    if (json.has("identifier")) {
11681      JsonArray array = getJArray(json, "identifier");
11682      for (int i = 0; i < array.size(); i++) {
11683        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11684      }
11685    };
11686    if (json.has("status"))
11687      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
11688    if (json.has("_status"))
11689      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11690    if (json.has("request"))
11691      res.setRequest(parseReference(getJObject(json, "request")));
11692    if (json.has("outcome"))
11693      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
11694    if (json.has("_outcome"))
11695      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
11696    if (json.has("disposition"))
11697      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11698    if (json.has("_disposition"))
11699      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
11700    if (json.has("created"))
11701      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11702    if (json.has("_created"))
11703      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11704    if (json.has("organization"))
11705      res.setOrganization(parseReference(getJObject(json, "organization")));
11706    if (json.has("requestProvider"))
11707      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
11708  }
11709
11710  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
11711    EpisodeOfCare res = new EpisodeOfCare();
11712    parseEpisodeOfCareProperties(json, res);
11713    return res;
11714  }
11715
11716  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
11717    parseDomainResourceProperties(json, res);
11718    if (json.has("identifier")) {
11719      JsonArray array = getJArray(json, "identifier");
11720      for (int i = 0; i < array.size(); i++) {
11721        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11722      }
11723    };
11724    if (json.has("status"))
11725      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
11726    if (json.has("_status"))
11727      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11728    if (json.has("statusHistory")) {
11729      JsonArray array = getJArray(json, "statusHistory");
11730      for (int i = 0; i < array.size(); i++) {
11731        res.getStatusHistory().add(parseEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject()));
11732      }
11733    };
11734    if (json.has("type")) {
11735      JsonArray array = getJArray(json, "type");
11736      for (int i = 0; i < array.size(); i++) {
11737        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11738      }
11739    };
11740    if (json.has("diagnosis")) {
11741      JsonArray array = getJArray(json, "diagnosis");
11742      for (int i = 0; i < array.size(); i++) {
11743        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject()));
11744      }
11745    };
11746    if (json.has("patient"))
11747      res.setPatient(parseReference(getJObject(json, "patient")));
11748    if (json.has("managingOrganization"))
11749      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
11750    if (json.has("period"))
11751      res.setPeriod(parsePeriod(getJObject(json, "period")));
11752    if (json.has("referralRequest")) {
11753      JsonArray array = getJArray(json, "referralRequest");
11754      for (int i = 0; i < array.size(); i++) {
11755        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
11756      }
11757    };
11758    if (json.has("careManager"))
11759      res.setCareManager(parseReference(getJObject(json, "careManager")));
11760    if (json.has("team")) {
11761      JsonArray array = getJArray(json, "team");
11762      for (int i = 0; i < array.size(); i++) {
11763        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
11764      }
11765    };
11766    if (json.has("account")) {
11767      JsonArray array = getJArray(json, "account");
11768      for (int i = 0; i < array.size(); i++) {
11769        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11770      }
11771    };
11772  }
11773
11774  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareStatusHistoryComponent(JsonObject json) throws IOException, FHIRFormatError {
11775    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
11776    parseEpisodeOfCareStatusHistoryComponentProperties(json, res);
11777    return res;
11778  }
11779
11780  protected void parseEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
11781    parseBackboneElementProperties(json, res);
11782    if (json.has("status"))
11783      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
11784    if (json.has("_status"))
11785      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11786    if (json.has("period"))
11787      res.setPeriod(parsePeriod(getJObject(json, "period")));
11788  }
11789
11790  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
11791    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
11792    parseEpisodeOfCareDiagnosisComponentProperties(json, res);
11793    return res;
11794  }
11795
11796  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
11797    parseBackboneElementProperties(json, res);
11798    if (json.has("condition"))
11799      res.setCondition(parseReference(getJObject(json, "condition")));
11800    if (json.has("role"))
11801      res.setRole(parseCodeableConcept(getJObject(json, "role")));
11802    if (json.has("rank"))
11803      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
11804    if (json.has("_rank"))
11805      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
11806  }
11807
11808  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
11809    EventDefinition res = new EventDefinition();
11810    parseEventDefinitionProperties(json, res);
11811    return res;
11812  }
11813
11814  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
11815    parseDomainResourceProperties(json, res);
11816    if (json.has("url"))
11817      res.setUrlElement(parseUri(json.get("url").getAsString()));
11818    if (json.has("_url"))
11819      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11820    if (json.has("identifier")) {
11821      JsonArray array = getJArray(json, "identifier");
11822      for (int i = 0; i < array.size(); i++) {
11823        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11824      }
11825    };
11826    if (json.has("version"))
11827      res.setVersionElement(parseString(json.get("version").getAsString()));
11828    if (json.has("_version"))
11829      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11830    if (json.has("name"))
11831      res.setNameElement(parseString(json.get("name").getAsString()));
11832    if (json.has("_name"))
11833      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11834    if (json.has("title"))
11835      res.setTitleElement(parseString(json.get("title").getAsString()));
11836    if (json.has("_title"))
11837      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11838    if (json.has("subtitle"))
11839      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11840    if (json.has("_subtitle"))
11841      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
11842    if (json.has("status"))
11843      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11844    if (json.has("_status"))
11845      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11846    if (json.has("experimental"))
11847      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11848    if (json.has("_experimental"))
11849      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
11850    DataType subject = parseType("subject", json);
11851    if (subject != null)
11852      res.setSubject(subject);
11853    if (json.has("date"))
11854      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11855    if (json.has("_date"))
11856      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11857    if (json.has("publisher"))
11858      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11859    if (json.has("_publisher"))
11860      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11861    if (json.has("contact")) {
11862      JsonArray array = getJArray(json, "contact");
11863      for (int i = 0; i < array.size(); i++) {
11864        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11865      }
11866    };
11867    if (json.has("description"))
11868      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11869    if (json.has("_description"))
11870      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11871    if (json.has("useContext")) {
11872      JsonArray array = getJArray(json, "useContext");
11873      for (int i = 0; i < array.size(); i++) {
11874        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11875      }
11876    };
11877    if (json.has("jurisdiction")) {
11878      JsonArray array = getJArray(json, "jurisdiction");
11879      for (int i = 0; i < array.size(); i++) {
11880        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11881      }
11882    };
11883    if (json.has("purpose"))
11884      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11885    if (json.has("_purpose"))
11886      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
11887    if (json.has("usage"))
11888      res.setUsageElement(parseString(json.get("usage").getAsString()));
11889    if (json.has("_usage"))
11890      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
11891    if (json.has("copyright"))
11892      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11893    if (json.has("_copyright"))
11894      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11895    if (json.has("approvalDate"))
11896      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11897    if (json.has("_approvalDate"))
11898      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11899    if (json.has("lastReviewDate"))
11900      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11901    if (json.has("_lastReviewDate"))
11902      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11903    if (json.has("effectivePeriod"))
11904      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11905    if (json.has("topic")) {
11906      JsonArray array = getJArray(json, "topic");
11907      for (int i = 0; i < array.size(); i++) {
11908        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11909      }
11910    };
11911    if (json.has("author")) {
11912      JsonArray array = getJArray(json, "author");
11913      for (int i = 0; i < array.size(); i++) {
11914        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11915      }
11916    };
11917    if (json.has("editor")) {
11918      JsonArray array = getJArray(json, "editor");
11919      for (int i = 0; i < array.size(); i++) {
11920        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11921      }
11922    };
11923    if (json.has("reviewer")) {
11924      JsonArray array = getJArray(json, "reviewer");
11925      for (int i = 0; i < array.size(); i++) {
11926        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11927      }
11928    };
11929    if (json.has("endorser")) {
11930      JsonArray array = getJArray(json, "endorser");
11931      for (int i = 0; i < array.size(); i++) {
11932        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11933      }
11934    };
11935    if (json.has("relatedArtifact")) {
11936      JsonArray array = getJArray(json, "relatedArtifact");
11937      for (int i = 0; i < array.size(); i++) {
11938        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11939      }
11940    };
11941    if (json.has("trigger")) {
11942      JsonArray array = getJArray(json, "trigger");
11943      for (int i = 0; i < array.size(); i++) {
11944        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
11945      }
11946    };
11947  }
11948
11949  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
11950    Evidence res = new Evidence();
11951    parseEvidenceProperties(json, res);
11952    return res;
11953  }
11954
11955  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
11956    parseDomainResourceProperties(json, res);
11957    if (json.has("url"))
11958      res.setUrlElement(parseUri(json.get("url").getAsString()));
11959    if (json.has("_url"))
11960      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11961    if (json.has("identifier")) {
11962      JsonArray array = getJArray(json, "identifier");
11963      for (int i = 0; i < array.size(); i++) {
11964        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11965      }
11966    };
11967    if (json.has("version"))
11968      res.setVersionElement(parseString(json.get("version").getAsString()));
11969    if (json.has("_version"))
11970      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11971    if (json.has("title"))
11972      res.setTitleElement(parseString(json.get("title").getAsString()));
11973    if (json.has("_title"))
11974      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11975    DataType citeAs = parseType("citeAs", json);
11976    if (citeAs != null)
11977      res.setCiteAs(citeAs);
11978    if (json.has("status"))
11979      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11980    if (json.has("_status"))
11981      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11982    if (json.has("date"))
11983      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11984    if (json.has("_date"))
11985      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11986    if (json.has("useContext")) {
11987      JsonArray array = getJArray(json, "useContext");
11988      for (int i = 0; i < array.size(); i++) {
11989        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11990      }
11991    };
11992    if (json.has("approvalDate"))
11993      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11994    if (json.has("_approvalDate"))
11995      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11996    if (json.has("lastReviewDate"))
11997      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11998    if (json.has("_lastReviewDate"))
11999      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
12000    if (json.has("publisher"))
12001      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12002    if (json.has("_publisher"))
12003      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12004    if (json.has("contact")) {
12005      JsonArray array = getJArray(json, "contact");
12006      for (int i = 0; i < array.size(); i++) {
12007        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12008      }
12009    };
12010    if (json.has("author")) {
12011      JsonArray array = getJArray(json, "author");
12012      for (int i = 0; i < array.size(); i++) {
12013        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12014      }
12015    };
12016    if (json.has("editor")) {
12017      JsonArray array = getJArray(json, "editor");
12018      for (int i = 0; i < array.size(); i++) {
12019        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12020      }
12021    };
12022    if (json.has("reviewer")) {
12023      JsonArray array = getJArray(json, "reviewer");
12024      for (int i = 0; i < array.size(); i++) {
12025        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12026      }
12027    };
12028    if (json.has("endorser")) {
12029      JsonArray array = getJArray(json, "endorser");
12030      for (int i = 0; i < array.size(); i++) {
12031        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12032      }
12033    };
12034    if (json.has("relatedArtifact")) {
12035      JsonArray array = getJArray(json, "relatedArtifact");
12036      for (int i = 0; i < array.size(); i++) {
12037        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12038      }
12039    };
12040    if (json.has("description"))
12041      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12042    if (json.has("_description"))
12043      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12044    if (json.has("assertion"))
12045      res.setAssertionElement(parseMarkdown(json.get("assertion").getAsString()));
12046    if (json.has("_assertion"))
12047      parseElementProperties(getJObject(json, "_assertion"), res.getAssertionElement());
12048    if (json.has("note")) {
12049      JsonArray array = getJArray(json, "note");
12050      for (int i = 0; i < array.size(); i++) {
12051        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12052      }
12053    };
12054    if (json.has("variableDefinition")) {
12055      JsonArray array = getJArray(json, "variableDefinition");
12056      for (int i = 0; i < array.size(); i++) {
12057        res.getVariableDefinition().add(parseEvidenceVariableDefinitionComponent(array.get(i).getAsJsonObject()));
12058      }
12059    };
12060    if (json.has("synthesisType"))
12061      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
12062    if (json.has("studyType"))
12063      res.setStudyType(parseCodeableConcept(getJObject(json, "studyType")));
12064    if (json.has("statistic")) {
12065      JsonArray array = getJArray(json, "statistic");
12066      for (int i = 0; i < array.size(); i++) {
12067        res.getStatistic().add(parseEvidenceStatisticComponent(array.get(i).getAsJsonObject()));
12068      }
12069    };
12070    if (json.has("certainty")) {
12071      JsonArray array = getJArray(json, "certainty");
12072      for (int i = 0; i < array.size(); i++) {
12073        res.getCertainty().add(parseEvidenceCertaintyComponent(array.get(i).getAsJsonObject()));
12074      }
12075    };
12076  }
12077
12078  protected Evidence.EvidenceVariableDefinitionComponent parseEvidenceVariableDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
12079    Evidence.EvidenceVariableDefinitionComponent res = new Evidence.EvidenceVariableDefinitionComponent();
12080    parseEvidenceVariableDefinitionComponentProperties(json, res);
12081    return res;
12082  }
12083
12084  protected void parseEvidenceVariableDefinitionComponentProperties(JsonObject json, Evidence.EvidenceVariableDefinitionComponent res) throws IOException, FHIRFormatError {
12085    parseBackboneElementProperties(json, res);
12086    if (json.has("description"))
12087      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12088    if (json.has("_description"))
12089      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12090    if (json.has("note")) {
12091      JsonArray array = getJArray(json, "note");
12092      for (int i = 0; i < array.size(); i++) {
12093        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12094      }
12095    };
12096    if (json.has("variableRole"))
12097      res.setVariableRole(parseCodeableConcept(getJObject(json, "variableRole")));
12098    if (json.has("observed"))
12099      res.setObserved(parseReference(getJObject(json, "observed")));
12100    if (json.has("intended"))
12101      res.setIntended(parseReference(getJObject(json, "intended")));
12102    if (json.has("directnessMatch"))
12103      res.setDirectnessMatch(parseCodeableConcept(getJObject(json, "directnessMatch")));
12104  }
12105
12106  protected Evidence.EvidenceStatisticComponent parseEvidenceStatisticComponent(JsonObject json) throws IOException, FHIRFormatError {
12107    Evidence.EvidenceStatisticComponent res = new Evidence.EvidenceStatisticComponent();
12108    parseEvidenceStatisticComponentProperties(json, res);
12109    return res;
12110  }
12111
12112  protected void parseEvidenceStatisticComponentProperties(JsonObject json, Evidence.EvidenceStatisticComponent res) throws IOException, FHIRFormatError {
12113    parseBackboneElementProperties(json, res);
12114    if (json.has("description"))
12115      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12116    if (json.has("_description"))
12117      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12118    if (json.has("note")) {
12119      JsonArray array = getJArray(json, "note");
12120      for (int i = 0; i < array.size(); i++) {
12121        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12122      }
12123    };
12124    if (json.has("statisticType"))
12125      res.setStatisticType(parseCodeableConcept(getJObject(json, "statisticType")));
12126    if (json.has("category"))
12127      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12128    if (json.has("quantity"))
12129      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12130    if (json.has("numberOfEvents"))
12131      res.setNumberOfEventsElement(parseUnsignedInt(json.get("numberOfEvents").getAsString()));
12132    if (json.has("_numberOfEvents"))
12133      parseElementProperties(getJObject(json, "_numberOfEvents"), res.getNumberOfEventsElement());
12134    if (json.has("numberAffected"))
12135      res.setNumberAffectedElement(parseUnsignedInt(json.get("numberAffected").getAsString()));
12136    if (json.has("_numberAffected"))
12137      parseElementProperties(getJObject(json, "_numberAffected"), res.getNumberAffectedElement());
12138    if (json.has("sampleSize"))
12139      res.setSampleSize(parseEvidenceStatisticSampleSizeComponent(getJObject(json, "sampleSize")));
12140    if (json.has("attributeEstimate")) {
12141      JsonArray array = getJArray(json, "attributeEstimate");
12142      for (int i = 0; i < array.size(); i++) {
12143        res.getAttributeEstimate().add(parseEvidenceStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject()));
12144      }
12145    };
12146    if (json.has("modelCharacteristic")) {
12147      JsonArray array = getJArray(json, "modelCharacteristic");
12148      for (int i = 0; i < array.size(); i++) {
12149        res.getModelCharacteristic().add(parseEvidenceStatisticModelCharacteristicComponent(array.get(i).getAsJsonObject()));
12150      }
12151    };
12152  }
12153
12154  protected Evidence.EvidenceStatisticSampleSizeComponent parseEvidenceStatisticSampleSizeComponent(JsonObject json) throws IOException, FHIRFormatError {
12155    Evidence.EvidenceStatisticSampleSizeComponent res = new Evidence.EvidenceStatisticSampleSizeComponent();
12156    parseEvidenceStatisticSampleSizeComponentProperties(json, res);
12157    return res;
12158  }
12159
12160  protected void parseEvidenceStatisticSampleSizeComponentProperties(JsonObject json, Evidence.EvidenceStatisticSampleSizeComponent res) throws IOException, FHIRFormatError {
12161    parseBackboneElementProperties(json, res);
12162    if (json.has("description"))
12163      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12164    if (json.has("_description"))
12165      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12166    if (json.has("note")) {
12167      JsonArray array = getJArray(json, "note");
12168      for (int i = 0; i < array.size(); i++) {
12169        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12170      }
12171    };
12172    if (json.has("numberOfStudies"))
12173      res.setNumberOfStudiesElement(parseUnsignedInt(json.get("numberOfStudies").getAsString()));
12174    if (json.has("_numberOfStudies"))
12175      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
12176    if (json.has("numberOfParticipants"))
12177      res.setNumberOfParticipantsElement(parseUnsignedInt(json.get("numberOfParticipants").getAsString()));
12178    if (json.has("_numberOfParticipants"))
12179      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
12180    if (json.has("knownDataCount"))
12181      res.setKnownDataCountElement(parseUnsignedInt(json.get("knownDataCount").getAsString()));
12182    if (json.has("_knownDataCount"))
12183      parseElementProperties(getJObject(json, "_knownDataCount"), res.getKnownDataCountElement());
12184  }
12185
12186  protected Evidence.EvidenceStatisticAttributeEstimateComponent parseEvidenceStatisticAttributeEstimateComponent(JsonObject json) throws IOException, FHIRFormatError {
12187    Evidence.EvidenceStatisticAttributeEstimateComponent res = new Evidence.EvidenceStatisticAttributeEstimateComponent();
12188    parseEvidenceStatisticAttributeEstimateComponentProperties(json, res);
12189    return res;
12190  }
12191
12192  protected void parseEvidenceStatisticAttributeEstimateComponentProperties(JsonObject json, Evidence.EvidenceStatisticAttributeEstimateComponent res) throws IOException, FHIRFormatError {
12193    parseBackboneElementProperties(json, res);
12194    if (json.has("description"))
12195      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12196    if (json.has("_description"))
12197      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12198    if (json.has("note")) {
12199      JsonArray array = getJArray(json, "note");
12200      for (int i = 0; i < array.size(); i++) {
12201        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12202      }
12203    };
12204    if (json.has("type"))
12205      res.setType(parseCodeableConcept(getJObject(json, "type")));
12206    if (json.has("quantity"))
12207      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12208    if (json.has("level"))
12209      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
12210    if (json.has("_level"))
12211      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
12212    if (json.has("range"))
12213      res.setRange(parseRange(getJObject(json, "range")));
12214    if (json.has("attributeEstimate")) {
12215      JsonArray array = getJArray(json, "attributeEstimate");
12216      for (int i = 0; i < array.size(); i++) {
12217        res.getAttributeEstimate().add(parseEvidenceStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject()));
12218      }
12219    };
12220  }
12221
12222  protected Evidence.EvidenceStatisticModelCharacteristicComponent parseEvidenceStatisticModelCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
12223    Evidence.EvidenceStatisticModelCharacteristicComponent res = new Evidence.EvidenceStatisticModelCharacteristicComponent();
12224    parseEvidenceStatisticModelCharacteristicComponentProperties(json, res);
12225    return res;
12226  }
12227
12228  protected void parseEvidenceStatisticModelCharacteristicComponentProperties(JsonObject json, Evidence.EvidenceStatisticModelCharacteristicComponent res) throws IOException, FHIRFormatError {
12229    parseBackboneElementProperties(json, res);
12230    if (json.has("code"))
12231      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12232    if (json.has("value"))
12233      res.setValue(parseQuantity(getJObject(json, "value")));
12234    if (json.has("variable")) {
12235      JsonArray array = getJArray(json, "variable");
12236      for (int i = 0; i < array.size(); i++) {
12237        res.getVariable().add(parseEvidenceStatisticModelCharacteristicVariableComponent(array.get(i).getAsJsonObject()));
12238      }
12239    };
12240    if (json.has("attributeEstimate")) {
12241      JsonArray array = getJArray(json, "attributeEstimate");
12242      for (int i = 0; i < array.size(); i++) {
12243        res.getAttributeEstimate().add(parseEvidenceStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject()));
12244      }
12245    };
12246  }
12247
12248  protected Evidence.EvidenceStatisticModelCharacteristicVariableComponent parseEvidenceStatisticModelCharacteristicVariableComponent(JsonObject json) throws IOException, FHIRFormatError {
12249    Evidence.EvidenceStatisticModelCharacteristicVariableComponent res = new Evidence.EvidenceStatisticModelCharacteristicVariableComponent();
12250    parseEvidenceStatisticModelCharacteristicVariableComponentProperties(json, res);
12251    return res;
12252  }
12253
12254  protected void parseEvidenceStatisticModelCharacteristicVariableComponentProperties(JsonObject json, Evidence.EvidenceStatisticModelCharacteristicVariableComponent res) throws IOException, FHIRFormatError {
12255    parseBackboneElementProperties(json, res);
12256    if (json.has("variableDefinition"))
12257      res.setVariableDefinition(parseReference(getJObject(json, "variableDefinition")));
12258    if (json.has("handling"))
12259      res.setHandlingElement(parseEnumeration(json.get("handling").getAsString(), Enumerations.EvidenceVariableHandling.NULL, new Enumerations.EvidenceVariableHandlingEnumFactory()));
12260    if (json.has("_handling"))
12261      parseElementProperties(getJObject(json, "_handling"), res.getHandlingElement());
12262    if (json.has("valueCategory")) {
12263      JsonArray array = getJArray(json, "valueCategory");
12264      for (int i = 0; i < array.size(); i++) {
12265        res.getValueCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12266      }
12267    };
12268    if (json.has("valueQuantity")) {
12269      JsonArray array = getJArray(json, "valueQuantity");
12270      for (int i = 0; i < array.size(); i++) {
12271        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
12272      }
12273    };
12274    if (json.has("valueRange")) {
12275      JsonArray array = getJArray(json, "valueRange");
12276      for (int i = 0; i < array.size(); i++) {
12277        res.getValueRange().add(parseRange(array.get(i).getAsJsonObject()));
12278      }
12279    };
12280  }
12281
12282  protected Evidence.EvidenceCertaintyComponent parseEvidenceCertaintyComponent(JsonObject json) throws IOException, FHIRFormatError {
12283    Evidence.EvidenceCertaintyComponent res = new Evidence.EvidenceCertaintyComponent();
12284    parseEvidenceCertaintyComponentProperties(json, res);
12285    return res;
12286  }
12287
12288  protected void parseEvidenceCertaintyComponentProperties(JsonObject json, Evidence.EvidenceCertaintyComponent res) throws IOException, FHIRFormatError {
12289    parseBackboneElementProperties(json, res);
12290    if (json.has("description"))
12291      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12292    if (json.has("_description"))
12293      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12294    if (json.has("note")) {
12295      JsonArray array = getJArray(json, "note");
12296      for (int i = 0; i < array.size(); i++) {
12297        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12298      }
12299    };
12300    if (json.has("type"))
12301      res.setType(parseCodeableConcept(getJObject(json, "type")));
12302    if (json.has("rating"))
12303      res.setRating(parseCodeableConcept(getJObject(json, "rating")));
12304    if (json.has("rater"))
12305      res.setRaterElement(parseString(json.get("rater").getAsString()));
12306    if (json.has("_rater"))
12307      parseElementProperties(getJObject(json, "_rater"), res.getRaterElement());
12308    if (json.has("subcomponent")) {
12309      JsonArray array = getJArray(json, "subcomponent");
12310      for (int i = 0; i < array.size(); i++) {
12311        res.getSubcomponent().add(parseEvidenceCertaintyComponent(array.get(i).getAsJsonObject()));
12312      }
12313    };
12314  }
12315
12316  protected EvidenceReport parseEvidenceReport(JsonObject json) throws IOException, FHIRFormatError {
12317    EvidenceReport res = new EvidenceReport();
12318    parseEvidenceReportProperties(json, res);
12319    return res;
12320  }
12321
12322  protected void parseEvidenceReportProperties(JsonObject json, EvidenceReport res) throws IOException, FHIRFormatError {
12323    parseDomainResourceProperties(json, res);
12324    if (json.has("url"))
12325      res.setUrlElement(parseUri(json.get("url").getAsString()));
12326    if (json.has("_url"))
12327      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12328    if (json.has("status"))
12329      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12330    if (json.has("_status"))
12331      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12332    if (json.has("useContext")) {
12333      JsonArray array = getJArray(json, "useContext");
12334      for (int i = 0; i < array.size(); i++) {
12335        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12336      }
12337    };
12338    if (json.has("identifier")) {
12339      JsonArray array = getJArray(json, "identifier");
12340      for (int i = 0; i < array.size(); i++) {
12341        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12342      }
12343    };
12344    if (json.has("relatedIdentifier")) {
12345      JsonArray array = getJArray(json, "relatedIdentifier");
12346      for (int i = 0; i < array.size(); i++) {
12347        res.getRelatedIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12348      }
12349    };
12350    DataType citeAs = parseType("citeAs", json);
12351    if (citeAs != null)
12352      res.setCiteAs(citeAs);
12353    if (json.has("type"))
12354      res.setType(parseCodeableConcept(getJObject(json, "type")));
12355    if (json.has("note")) {
12356      JsonArray array = getJArray(json, "note");
12357      for (int i = 0; i < array.size(); i++) {
12358        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12359      }
12360    };
12361    if (json.has("relatedArtifact")) {
12362      JsonArray array = getJArray(json, "relatedArtifact");
12363      for (int i = 0; i < array.size(); i++) {
12364        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12365      }
12366    };
12367    if (json.has("subject"))
12368      res.setSubject(parseEvidenceReportSubjectComponent(getJObject(json, "subject")));
12369    if (json.has("publisher"))
12370      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12371    if (json.has("_publisher"))
12372      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12373    if (json.has("contact")) {
12374      JsonArray array = getJArray(json, "contact");
12375      for (int i = 0; i < array.size(); i++) {
12376        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12377      }
12378    };
12379    if (json.has("author")) {
12380      JsonArray array = getJArray(json, "author");
12381      for (int i = 0; i < array.size(); i++) {
12382        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12383      }
12384    };
12385    if (json.has("editor")) {
12386      JsonArray array = getJArray(json, "editor");
12387      for (int i = 0; i < array.size(); i++) {
12388        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12389      }
12390    };
12391    if (json.has("reviewer")) {
12392      JsonArray array = getJArray(json, "reviewer");
12393      for (int i = 0; i < array.size(); i++) {
12394        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12395      }
12396    };
12397    if (json.has("endorser")) {
12398      JsonArray array = getJArray(json, "endorser");
12399      for (int i = 0; i < array.size(); i++) {
12400        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12401      }
12402    };
12403    if (json.has("relatesTo")) {
12404      JsonArray array = getJArray(json, "relatesTo");
12405      for (int i = 0; i < array.size(); i++) {
12406        res.getRelatesTo().add(parseEvidenceReportRelatesToComponent(array.get(i).getAsJsonObject()));
12407      }
12408    };
12409    if (json.has("section")) {
12410      JsonArray array = getJArray(json, "section");
12411      for (int i = 0; i < array.size(); i++) {
12412        res.getSection().add(parseEvidenceReportSectionComponent(array.get(i).getAsJsonObject()));
12413      }
12414    };
12415  }
12416
12417  protected EvidenceReport.EvidenceReportSubjectComponent parseEvidenceReportSubjectComponent(JsonObject json) throws IOException, FHIRFormatError {
12418    EvidenceReport.EvidenceReportSubjectComponent res = new EvidenceReport.EvidenceReportSubjectComponent();
12419    parseEvidenceReportSubjectComponentProperties(json, res);
12420    return res;
12421  }
12422
12423  protected void parseEvidenceReportSubjectComponentProperties(JsonObject json, EvidenceReport.EvidenceReportSubjectComponent res) throws IOException, FHIRFormatError {
12424    parseBackboneElementProperties(json, res);
12425    if (json.has("characteristic")) {
12426      JsonArray array = getJArray(json, "characteristic");
12427      for (int i = 0; i < array.size(); i++) {
12428        res.getCharacteristic().add(parseEvidenceReportSubjectCharacteristicComponent(array.get(i).getAsJsonObject()));
12429      }
12430    };
12431    if (json.has("note")) {
12432      JsonArray array = getJArray(json, "note");
12433      for (int i = 0; i < array.size(); i++) {
12434        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12435      }
12436    };
12437  }
12438
12439  protected EvidenceReport.EvidenceReportSubjectCharacteristicComponent parseEvidenceReportSubjectCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
12440    EvidenceReport.EvidenceReportSubjectCharacteristicComponent res = new EvidenceReport.EvidenceReportSubjectCharacteristicComponent();
12441    parseEvidenceReportSubjectCharacteristicComponentProperties(json, res);
12442    return res;
12443  }
12444
12445  protected void parseEvidenceReportSubjectCharacteristicComponentProperties(JsonObject json, EvidenceReport.EvidenceReportSubjectCharacteristicComponent res) throws IOException, FHIRFormatError {
12446    parseBackboneElementProperties(json, res);
12447    if (json.has("code"))
12448      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12449    DataType value = parseType("value", json);
12450    if (value != null)
12451      res.setValue(value);
12452    if (json.has("exclude"))
12453      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
12454    if (json.has("_exclude"))
12455      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
12456    if (json.has("period"))
12457      res.setPeriod(parsePeriod(getJObject(json, "period")));
12458  }
12459
12460  protected EvidenceReport.EvidenceReportRelatesToComponent parseEvidenceReportRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
12461    EvidenceReport.EvidenceReportRelatesToComponent res = new EvidenceReport.EvidenceReportRelatesToComponent();
12462    parseEvidenceReportRelatesToComponentProperties(json, res);
12463    return res;
12464  }
12465
12466  protected void parseEvidenceReportRelatesToComponentProperties(JsonObject json, EvidenceReport.EvidenceReportRelatesToComponent res) throws IOException, FHIRFormatError {
12467    parseBackboneElementProperties(json, res);
12468    if (json.has("code"))
12469      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), EvidenceReport.ReportRelationshipType.NULL, new EvidenceReport.ReportRelationshipTypeEnumFactory()));
12470    if (json.has("_code"))
12471      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
12472    DataType target = parseType("target", json);
12473    if (target != null)
12474      res.setTarget(target);
12475  }
12476
12477  protected EvidenceReport.SectionComponent parseEvidenceReportSectionComponent(JsonObject json) throws IOException, FHIRFormatError {
12478    EvidenceReport.SectionComponent res = new EvidenceReport.SectionComponent();
12479    parseEvidenceReportSectionComponentProperties(json, res);
12480    return res;
12481  }
12482
12483  protected void parseEvidenceReportSectionComponentProperties(JsonObject json, EvidenceReport.SectionComponent res) throws IOException, FHIRFormatError {
12484    parseBackboneElementProperties(json, res);
12485    if (json.has("title"))
12486      res.setTitleElement(parseString(json.get("title").getAsString()));
12487    if (json.has("_title"))
12488      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
12489    if (json.has("focus"))
12490      res.setFocus(parseCodeableConcept(getJObject(json, "focus")));
12491    if (json.has("focusReference"))
12492      res.setFocusReference(parseReference(getJObject(json, "focusReference")));
12493    if (json.has("author")) {
12494      JsonArray array = getJArray(json, "author");
12495      for (int i = 0; i < array.size(); i++) {
12496        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
12497      }
12498    };
12499    if (json.has("text"))
12500      res.setText(parseNarrative(getJObject(json, "text")));
12501    if (json.has("mode"))
12502      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
12503    if (json.has("_mode"))
12504      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
12505    if (json.has("orderedBy"))
12506      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
12507    if (json.has("entryClassifier")) {
12508      JsonArray array = getJArray(json, "entryClassifier");
12509      for (int i = 0; i < array.size(); i++) {
12510        res.getEntryClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12511      }
12512    };
12513    if (json.has("entryReference")) {
12514      JsonArray array = getJArray(json, "entryReference");
12515      for (int i = 0; i < array.size(); i++) {
12516        res.getEntryReference().add(parseReference(array.get(i).getAsJsonObject()));
12517      }
12518    };
12519    if (json.has("entryQuantity")) {
12520      JsonArray array = getJArray(json, "entryQuantity");
12521      for (int i = 0; i < array.size(); i++) {
12522        res.getEntryQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
12523      }
12524    };
12525    if (json.has("emptyReason"))
12526      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
12527    if (json.has("section")) {
12528      JsonArray array = getJArray(json, "section");
12529      for (int i = 0; i < array.size(); i++) {
12530        res.getSection().add(parseEvidenceReportSectionComponent(array.get(i).getAsJsonObject()));
12531      }
12532    };
12533  }
12534
12535  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
12536    EvidenceVariable res = new EvidenceVariable();
12537    parseEvidenceVariableProperties(json, res);
12538    return res;
12539  }
12540
12541  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
12542    parseDomainResourceProperties(json, res);
12543    if (json.has("url"))
12544      res.setUrlElement(parseUri(json.get("url").getAsString()));
12545    if (json.has("_url"))
12546      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12547    if (json.has("identifier")) {
12548      JsonArray array = getJArray(json, "identifier");
12549      for (int i = 0; i < array.size(); i++) {
12550        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12551      }
12552    };
12553    if (json.has("version"))
12554      res.setVersionElement(parseString(json.get("version").getAsString()));
12555    if (json.has("_version"))
12556      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12557    if (json.has("name"))
12558      res.setNameElement(parseString(json.get("name").getAsString()));
12559    if (json.has("_name"))
12560      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12561    if (json.has("title"))
12562      res.setTitleElement(parseString(json.get("title").getAsString()));
12563    if (json.has("_title"))
12564      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
12565    if (json.has("shortTitle"))
12566      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
12567    if (json.has("_shortTitle"))
12568      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
12569    if (json.has("subtitle"))
12570      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
12571    if (json.has("_subtitle"))
12572      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
12573    if (json.has("status"))
12574      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12575    if (json.has("_status"))
12576      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12577    if (json.has("date"))
12578      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12579    if (json.has("_date"))
12580      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12581    if (json.has("description"))
12582      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12583    if (json.has("_description"))
12584      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12585    if (json.has("note")) {
12586      JsonArray array = getJArray(json, "note");
12587      for (int i = 0; i < array.size(); i++) {
12588        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12589      }
12590    };
12591    if (json.has("useContext")) {
12592      JsonArray array = getJArray(json, "useContext");
12593      for (int i = 0; i < array.size(); i++) {
12594        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12595      }
12596    };
12597    if (json.has("publisher"))
12598      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12599    if (json.has("_publisher"))
12600      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12601    if (json.has("contact")) {
12602      JsonArray array = getJArray(json, "contact");
12603      for (int i = 0; i < array.size(); i++) {
12604        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12605      }
12606    };
12607    if (json.has("author")) {
12608      JsonArray array = getJArray(json, "author");
12609      for (int i = 0; i < array.size(); i++) {
12610        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12611      }
12612    };
12613    if (json.has("editor")) {
12614      JsonArray array = getJArray(json, "editor");
12615      for (int i = 0; i < array.size(); i++) {
12616        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12617      }
12618    };
12619    if (json.has("reviewer")) {
12620      JsonArray array = getJArray(json, "reviewer");
12621      for (int i = 0; i < array.size(); i++) {
12622        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12623      }
12624    };
12625    if (json.has("endorser")) {
12626      JsonArray array = getJArray(json, "endorser");
12627      for (int i = 0; i < array.size(); i++) {
12628        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12629      }
12630    };
12631    if (json.has("relatedArtifact")) {
12632      JsonArray array = getJArray(json, "relatedArtifact");
12633      for (int i = 0; i < array.size(); i++) {
12634        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12635      }
12636    };
12637    if (json.has("actual"))
12638      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
12639    if (json.has("_actual"))
12640      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
12641    if (json.has("characteristicCombination"))
12642      res.setCharacteristicCombinationElement(parseEnumeration(json.get("characteristicCombination").getAsString(), EvidenceVariable.CharacteristicCombination.NULL, new EvidenceVariable.CharacteristicCombinationEnumFactory()));
12643    if (json.has("_characteristicCombination"))
12644      parseElementProperties(getJObject(json, "_characteristicCombination"), res.getCharacteristicCombinationElement());
12645    if (json.has("characteristic")) {
12646      JsonArray array = getJArray(json, "characteristic");
12647      for (int i = 0; i < array.size(); i++) {
12648        res.getCharacteristic().add(parseEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject()));
12649      }
12650    };
12651    if (json.has("handling"))
12652      res.setHandlingElement(parseEnumeration(json.get("handling").getAsString(), Enumerations.EvidenceVariableHandling.NULL, new Enumerations.EvidenceVariableHandlingEnumFactory()));
12653    if (json.has("_handling"))
12654      parseElementProperties(getJObject(json, "_handling"), res.getHandlingElement());
12655    if (json.has("category")) {
12656      JsonArray array = getJArray(json, "category");
12657      for (int i = 0; i < array.size(); i++) {
12658        res.getCategory().add(parseEvidenceVariableCategoryComponent(array.get(i).getAsJsonObject()));
12659      }
12660    };
12661  }
12662
12663  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
12664    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
12665    parseEvidenceVariableCharacteristicComponentProperties(json, res);
12666    return res;
12667  }
12668
12669  protected void parseEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
12670    parseBackboneElementProperties(json, res);
12671    if (json.has("description"))
12672      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12673    if (json.has("_description"))
12674      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12675    DataType definition = parseType("definition", json);
12676    if (definition != null)
12677      res.setDefinition(definition);
12678    if (json.has("method"))
12679      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
12680    if (json.has("device"))
12681      res.setDevice(parseReference(getJObject(json, "device")));
12682    if (json.has("exclude"))
12683      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
12684    if (json.has("_exclude"))
12685      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
12686    if (json.has("timeFromStart"))
12687      res.setTimeFromStart(parseEvidenceVariableCharacteristicTimeFromStartComponent(getJObject(json, "timeFromStart")));
12688    if (json.has("groupMeasure"))
12689      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(), Enumerations.GroupMeasure.NULL, new Enumerations.GroupMeasureEnumFactory()));
12690    if (json.has("_groupMeasure"))
12691      parseElementProperties(getJObject(json, "_groupMeasure"), res.getGroupMeasureElement());
12692  }
12693
12694  protected EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent parseEvidenceVariableCharacteristicTimeFromStartComponent(JsonObject json) throws IOException, FHIRFormatError {
12695    EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent res = new EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent();
12696    parseEvidenceVariableCharacteristicTimeFromStartComponentProperties(json, res);
12697    return res;
12698  }
12699
12700  protected void parseEvidenceVariableCharacteristicTimeFromStartComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent res) throws IOException, FHIRFormatError {
12701    parseBackboneElementProperties(json, res);
12702    if (json.has("description"))
12703      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12704    if (json.has("_description"))
12705      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12706    if (json.has("quantity"))
12707      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12708    if (json.has("range"))
12709      res.setRange(parseRange(getJObject(json, "range")));
12710    if (json.has("note")) {
12711      JsonArray array = getJArray(json, "note");
12712      for (int i = 0; i < array.size(); i++) {
12713        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12714      }
12715    };
12716  }
12717
12718  protected EvidenceVariable.EvidenceVariableCategoryComponent parseEvidenceVariableCategoryComponent(JsonObject json) throws IOException, FHIRFormatError {
12719    EvidenceVariable.EvidenceVariableCategoryComponent res = new EvidenceVariable.EvidenceVariableCategoryComponent();
12720    parseEvidenceVariableCategoryComponentProperties(json, res);
12721    return res;
12722  }
12723
12724  protected void parseEvidenceVariableCategoryComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCategoryComponent res) throws IOException, FHIRFormatError {
12725    parseBackboneElementProperties(json, res);
12726    if (json.has("name"))
12727      res.setNameElement(parseString(json.get("name").getAsString()));
12728    if (json.has("_name"))
12729      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12730    DataType value = parseType("value", json);
12731    if (value != null)
12732      res.setValue(value);
12733  }
12734
12735  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
12736    ExampleScenario res = new ExampleScenario();
12737    parseExampleScenarioProperties(json, res);
12738    return res;
12739  }
12740
12741  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
12742    parseDomainResourceProperties(json, res);
12743    if (json.has("url"))
12744      res.setUrlElement(parseUri(json.get("url").getAsString()));
12745    if (json.has("_url"))
12746      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12747    if (json.has("identifier")) {
12748      JsonArray array = getJArray(json, "identifier");
12749      for (int i = 0; i < array.size(); i++) {
12750        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12751      }
12752    };
12753    if (json.has("version"))
12754      res.setVersionElement(parseString(json.get("version").getAsString()));
12755    if (json.has("_version"))
12756      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12757    if (json.has("name"))
12758      res.setNameElement(parseString(json.get("name").getAsString()));
12759    if (json.has("_name"))
12760      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12761    if (json.has("status"))
12762      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12763    if (json.has("_status"))
12764      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12765    if (json.has("experimental"))
12766      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12767    if (json.has("_experimental"))
12768      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
12769    if (json.has("date"))
12770      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12771    if (json.has("_date"))
12772      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12773    if (json.has("publisher"))
12774      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12775    if (json.has("_publisher"))
12776      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12777    if (json.has("contact")) {
12778      JsonArray array = getJArray(json, "contact");
12779      for (int i = 0; i < array.size(); i++) {
12780        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12781      }
12782    };
12783    if (json.has("useContext")) {
12784      JsonArray array = getJArray(json, "useContext");
12785      for (int i = 0; i < array.size(); i++) {
12786        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12787      }
12788    };
12789    if (json.has("jurisdiction")) {
12790      JsonArray array = getJArray(json, "jurisdiction");
12791      for (int i = 0; i < array.size(); i++) {
12792        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12793      }
12794    };
12795    if (json.has("copyright"))
12796      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12797    if (json.has("_copyright"))
12798      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
12799    if (json.has("purpose"))
12800      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12801    if (json.has("_purpose"))
12802      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
12803    if (json.has("actor")) {
12804      JsonArray array = getJArray(json, "actor");
12805      for (int i = 0; i < array.size(); i++) {
12806        res.getActor().add(parseExampleScenarioActorComponent(array.get(i).getAsJsonObject()));
12807      }
12808    };
12809    if (json.has("instance")) {
12810      JsonArray array = getJArray(json, "instance");
12811      for (int i = 0; i < array.size(); i++) {
12812        res.getInstance().add(parseExampleScenarioInstanceComponent(array.get(i).getAsJsonObject()));
12813      }
12814    };
12815    if (json.has("process")) {
12816      JsonArray array = getJArray(json, "process");
12817      for (int i = 0; i < array.size(); i++) {
12818        res.getProcess().add(parseExampleScenarioProcessComponent(array.get(i).getAsJsonObject()));
12819      }
12820    };
12821    if (json.has("workflow")) {
12822      JsonArray array = getJArray(json, "workflow");
12823      for (int i = 0; i < array.size(); i++) {
12824        if (array.get(i).isJsonNull()) {
12825          res.getWorkflow().add(new CanonicalType());
12826        } else {;
12827          res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
12828        }
12829      }
12830    };
12831    if (json.has("_workflow")) {
12832      JsonArray array = getJArray(json, "_workflow");
12833      for (int i = 0; i < array.size(); i++) {
12834        if (i == res.getWorkflow().size())
12835          res.getWorkflow().add(parseCanonical(null));
12836        if (array.get(i) instanceof JsonObject) 
12837          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
12838      }
12839    };
12840  }
12841
12842  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioActorComponent(JsonObject json) throws IOException, FHIRFormatError {
12843    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
12844    parseExampleScenarioActorComponentProperties(json, res);
12845    return res;
12846  }
12847
12848  protected void parseExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
12849    parseBackboneElementProperties(json, res);
12850    if (json.has("actorId"))
12851      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
12852    if (json.has("_actorId"))
12853      parseElementProperties(getJObject(json, "_actorId"), res.getActorIdElement());
12854    if (json.has("type"))
12855      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
12856    if (json.has("_type"))
12857      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12858    if (json.has("name"))
12859      res.setNameElement(parseString(json.get("name").getAsString()));
12860    if (json.has("_name"))
12861      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12862    if (json.has("description"))
12863      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12864    if (json.has("_description"))
12865      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12866  }
12867
12868  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
12869    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
12870    parseExampleScenarioInstanceComponentProperties(json, res);
12871    return res;
12872  }
12873
12874  protected void parseExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
12875    parseBackboneElementProperties(json, res);
12876    if (json.has("resourceId"))
12877      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
12878    if (json.has("_resourceId"))
12879      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
12880    if (json.has("resourceType"))
12881      res.setResourceTypeElement(parseCode(json.get("resourceType").getAsString()));
12882    if (json.has("_resourceType"))
12883      parseElementProperties(getJObject(json, "_resourceType"), res.getResourceTypeElement());
12884    if (json.has("name"))
12885      res.setNameElement(parseString(json.get("name").getAsString()));
12886    if (json.has("_name"))
12887      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12888    if (json.has("description"))
12889      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12890    if (json.has("_description"))
12891      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12892    if (json.has("version")) {
12893      JsonArray array = getJArray(json, "version");
12894      for (int i = 0; i < array.size(); i++) {
12895        res.getVersion().add(parseExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject()));
12896      }
12897    };
12898    if (json.has("containedInstance")) {
12899      JsonArray array = getJArray(json, "containedInstance");
12900      for (int i = 0; i < array.size(); i++) {
12901        res.getContainedInstance().add(parseExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject()));
12902      }
12903    };
12904  }
12905
12906  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioInstanceVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
12907    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
12908    parseExampleScenarioInstanceVersionComponentProperties(json, res);
12909    return res;
12910  }
12911
12912  protected void parseExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
12913    parseBackboneElementProperties(json, res);
12914    if (json.has("versionId"))
12915      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
12916    if (json.has("_versionId"))
12917      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
12918    if (json.has("description"))
12919      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12920    if (json.has("_description"))
12921      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12922  }
12923
12924  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioInstanceContainedInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
12925    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
12926    parseExampleScenarioInstanceContainedInstanceComponentProperties(json, res);
12927    return res;
12928  }
12929
12930  protected void parseExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
12931    parseBackboneElementProperties(json, res);
12932    if (json.has("resourceId"))
12933      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
12934    if (json.has("_resourceId"))
12935      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
12936    if (json.has("versionId"))
12937      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
12938    if (json.has("_versionId"))
12939      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
12940  }
12941
12942  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioProcessComponent(JsonObject json) throws IOException, FHIRFormatError {
12943    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
12944    parseExampleScenarioProcessComponentProperties(json, res);
12945    return res;
12946  }
12947
12948  protected void parseExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
12949    parseBackboneElementProperties(json, res);
12950    if (json.has("title"))
12951      res.setTitleElement(parseString(json.get("title").getAsString()));
12952    if (json.has("_title"))
12953      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
12954    if (json.has("description"))
12955      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12956    if (json.has("_description"))
12957      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12958    if (json.has("preConditions"))
12959      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
12960    if (json.has("_preConditions"))
12961      parseElementProperties(getJObject(json, "_preConditions"), res.getPreConditionsElement());
12962    if (json.has("postConditions"))
12963      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
12964    if (json.has("_postConditions"))
12965      parseElementProperties(getJObject(json, "_postConditions"), res.getPostConditionsElement());
12966    if (json.has("step")) {
12967      JsonArray array = getJArray(json, "step");
12968      for (int i = 0; i < array.size(); i++) {
12969        res.getStep().add(parseExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject()));
12970      }
12971    };
12972  }
12973
12974  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioProcessStepComponent(JsonObject json) throws IOException, FHIRFormatError {
12975    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
12976    parseExampleScenarioProcessStepComponentProperties(json, res);
12977    return res;
12978  }
12979
12980  protected void parseExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
12981    parseBackboneElementProperties(json, res);
12982    if (json.has("process")) {
12983      JsonArray array = getJArray(json, "process");
12984      for (int i = 0; i < array.size(); i++) {
12985        res.getProcess().add(parseExampleScenarioProcessComponent(array.get(i).getAsJsonObject()));
12986      }
12987    };
12988    if (json.has("pause"))
12989      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
12990    if (json.has("_pause"))
12991      parseElementProperties(getJObject(json, "_pause"), res.getPauseElement());
12992    if (json.has("operation"))
12993      res.setOperation(parseExampleScenarioProcessStepOperationComponent(getJObject(json, "operation")));
12994    if (json.has("alternative")) {
12995      JsonArray array = getJArray(json, "alternative");
12996      for (int i = 0; i < array.size(); i++) {
12997        res.getAlternative().add(parseExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject()));
12998      }
12999    };
13000  }
13001
13002  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioProcessStepOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
13003    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
13004    parseExampleScenarioProcessStepOperationComponentProperties(json, res);
13005    return res;
13006  }
13007
13008  protected void parseExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
13009    parseBackboneElementProperties(json, res);
13010    if (json.has("number"))
13011      res.setNumberElement(parseString(json.get("number").getAsString()));
13012    if (json.has("_number"))
13013      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
13014    if (json.has("type"))
13015      res.setTypeElement(parseString(json.get("type").getAsString()));
13016    if (json.has("_type"))
13017      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13018    if (json.has("name"))
13019      res.setNameElement(parseString(json.get("name").getAsString()));
13020    if (json.has("_name"))
13021      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13022    if (json.has("initiator"))
13023      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
13024    if (json.has("_initiator"))
13025      parseElementProperties(getJObject(json, "_initiator"), res.getInitiatorElement());
13026    if (json.has("receiver"))
13027      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
13028    if (json.has("_receiver"))
13029      parseElementProperties(getJObject(json, "_receiver"), res.getReceiverElement());
13030    if (json.has("description"))
13031      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13032    if (json.has("_description"))
13033      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13034    if (json.has("initiatorActive"))
13035      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
13036    if (json.has("_initiatorActive"))
13037      parseElementProperties(getJObject(json, "_initiatorActive"), res.getInitiatorActiveElement());
13038    if (json.has("receiverActive"))
13039      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
13040    if (json.has("_receiverActive"))
13041      parseElementProperties(getJObject(json, "_receiverActive"), res.getReceiverActiveElement());
13042    if (json.has("request"))
13043      res.setRequest(parseExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "request")));
13044    if (json.has("response"))
13045      res.setResponse(parseExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "response")));
13046  }
13047
13048  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioProcessStepAlternativeComponent(JsonObject json) throws IOException, FHIRFormatError {
13049    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
13050    parseExampleScenarioProcessStepAlternativeComponentProperties(json, res);
13051    return res;
13052  }
13053
13054  protected void parseExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
13055    parseBackboneElementProperties(json, res);
13056    if (json.has("title"))
13057      res.setTitleElement(parseString(json.get("title").getAsString()));
13058    if (json.has("_title"))
13059      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
13060    if (json.has("description"))
13061      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13062    if (json.has("_description"))
13063      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13064    if (json.has("step")) {
13065      JsonArray array = getJArray(json, "step");
13066      for (int i = 0; i < array.size(); i++) {
13067        res.getStep().add(parseExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject()));
13068      }
13069    };
13070  }
13071
13072  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
13073    ExplanationOfBenefit res = new ExplanationOfBenefit();
13074    parseExplanationOfBenefitProperties(json, res);
13075    return res;
13076  }
13077
13078  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
13079    parseDomainResourceProperties(json, res);
13080    if (json.has("identifier")) {
13081      JsonArray array = getJArray(json, "identifier");
13082      for (int i = 0; i < array.size(); i++) {
13083        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13084      }
13085    };
13086    if (json.has("status"))
13087      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
13088    if (json.has("_status"))
13089      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13090    if (json.has("type"))
13091      res.setType(parseCodeableConcept(getJObject(json, "type")));
13092    if (json.has("subType"))
13093      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
13094    if (json.has("use"))
13095      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
13096    if (json.has("_use"))
13097      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
13098    if (json.has("patient"))
13099      res.setPatient(parseReference(getJObject(json, "patient")));
13100    if (json.has("billablePeriod"))
13101      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
13102    if (json.has("created"))
13103      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
13104    if (json.has("_created"))
13105      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
13106    if (json.has("enterer"))
13107      res.setEnterer(parseReference(getJObject(json, "enterer")));
13108    if (json.has("insurer"))
13109      res.setInsurer(parseReference(getJObject(json, "insurer")));
13110    if (json.has("provider"))
13111      res.setProvider(parseReference(getJObject(json, "provider")));
13112    if (json.has("priority"))
13113      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
13114    if (json.has("fundsReserveRequested"))
13115      res.setFundsReserveRequested(parseCodeableConcept(getJObject(json, "fundsReserveRequested")));
13116    if (json.has("fundsReserve"))
13117      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
13118    if (json.has("related")) {
13119      JsonArray array = getJArray(json, "related");
13120      for (int i = 0; i < array.size(); i++) {
13121        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject()));
13122      }
13123    };
13124    if (json.has("prescription"))
13125      res.setPrescription(parseReference(getJObject(json, "prescription")));
13126    if (json.has("originalPrescription"))
13127      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
13128    if (json.has("payee"))
13129      res.setPayee(parseExplanationOfBenefitPayeeComponent(getJObject(json, "payee")));
13130    if (json.has("referral"))
13131      res.setReferral(parseReference(getJObject(json, "referral")));
13132    if (json.has("facility"))
13133      res.setFacility(parseReference(getJObject(json, "facility")));
13134    if (json.has("claim"))
13135      res.setClaim(parseReference(getJObject(json, "claim")));
13136    if (json.has("claimResponse"))
13137      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
13138    if (json.has("outcome"))
13139      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
13140    if (json.has("_outcome"))
13141      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
13142    if (json.has("disposition"))
13143      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
13144    if (json.has("_disposition"))
13145      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
13146    if (json.has("preAuthRef")) {
13147      JsonArray array = getJArray(json, "preAuthRef");
13148      for (int i = 0; i < array.size(); i++) {
13149        if (array.get(i).isJsonNull()) {
13150          res.getPreAuthRef().add(new StringType());
13151        } else {;
13152          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
13153        }
13154      }
13155    };
13156    if (json.has("_preAuthRef")) {
13157      JsonArray array = getJArray(json, "_preAuthRef");
13158      for (int i = 0; i < array.size(); i++) {
13159        if (i == res.getPreAuthRef().size())
13160          res.getPreAuthRef().add(parseString(null));
13161        if (array.get(i) instanceof JsonObject) 
13162          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
13163      }
13164    };
13165    if (json.has("preAuthRefPeriod")) {
13166      JsonArray array = getJArray(json, "preAuthRefPeriod");
13167      for (int i = 0; i < array.size(); i++) {
13168        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
13169      }
13170    };
13171    if (json.has("careTeam")) {
13172      JsonArray array = getJArray(json, "careTeam");
13173      for (int i = 0; i < array.size(); i++) {
13174        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject()));
13175      }
13176    };
13177    if (json.has("supportingInfo")) {
13178      JsonArray array = getJArray(json, "supportingInfo");
13179      for (int i = 0; i < array.size(); i++) {
13180        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject()));
13181      }
13182    };
13183    if (json.has("diagnosis")) {
13184      JsonArray array = getJArray(json, "diagnosis");
13185      for (int i = 0; i < array.size(); i++) {
13186        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject()));
13187      }
13188    };
13189    if (json.has("procedure")) {
13190      JsonArray array = getJArray(json, "procedure");
13191      for (int i = 0; i < array.size(); i++) {
13192        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject()));
13193      }
13194    };
13195    if (json.has("precedence"))
13196      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
13197    if (json.has("_precedence"))
13198      parseElementProperties(getJObject(json, "_precedence"), res.getPrecedenceElement());
13199    if (json.has("insurance")) {
13200      JsonArray array = getJArray(json, "insurance");
13201      for (int i = 0; i < array.size(); i++) {
13202        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject()));
13203      }
13204    };
13205    if (json.has("accident"))
13206      res.setAccident(parseExplanationOfBenefitAccidentComponent(getJObject(json, "accident")));
13207    if (json.has("item")) {
13208      JsonArray array = getJArray(json, "item");
13209      for (int i = 0; i < array.size(); i++) {
13210        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject()));
13211      }
13212    };
13213    if (json.has("addItem")) {
13214      JsonArray array = getJArray(json, "addItem");
13215      for (int i = 0; i < array.size(); i++) {
13216        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject()));
13217      }
13218    };
13219    if (json.has("adjudication")) {
13220      JsonArray array = getJArray(json, "adjudication");
13221      for (int i = 0; i < array.size(); i++) {
13222        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13223      }
13224    };
13225    if (json.has("total")) {
13226      JsonArray array = getJArray(json, "total");
13227      for (int i = 0; i < array.size(); i++) {
13228        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject()));
13229      }
13230    };
13231    if (json.has("payment"))
13232      res.setPayment(parseExplanationOfBenefitPaymentComponent(getJObject(json, "payment")));
13233    if (json.has("formCode"))
13234      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
13235    if (json.has("form"))
13236      res.setForm(parseAttachment(getJObject(json, "form")));
13237    if (json.has("processNote")) {
13238      JsonArray array = getJArray(json, "processNote");
13239      for (int i = 0; i < array.size(); i++) {
13240        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject()));
13241      }
13242    };
13243    if (json.has("benefitPeriod"))
13244      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
13245    if (json.has("benefitBalance")) {
13246      JsonArray array = getJArray(json, "benefitBalance");
13247      for (int i = 0; i < array.size(); i++) {
13248        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject()));
13249      }
13250    };
13251  }
13252
13253  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
13254    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
13255    parseExplanationOfBenefitRelatedClaimComponentProperties(json, res);
13256    return res;
13257  }
13258
13259  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
13260    parseBackboneElementProperties(json, res);
13261    if (json.has("claim"))
13262      res.setClaim(parseReference(getJObject(json, "claim")));
13263    if (json.has("relationship"))
13264      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
13265    if (json.has("reference"))
13266      res.setReference(parseIdentifier(getJObject(json, "reference")));
13267  }
13268
13269  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
13270    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
13271    parseExplanationOfBenefitPayeeComponentProperties(json, res);
13272    return res;
13273  }
13274
13275  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
13276    parseBackboneElementProperties(json, res);
13277    if (json.has("type"))
13278      res.setType(parseCodeableConcept(getJObject(json, "type")));
13279    if (json.has("party"))
13280      res.setParty(parseReference(getJObject(json, "party")));
13281  }
13282
13283  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
13284    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
13285    parseExplanationOfBenefitCareTeamComponentProperties(json, res);
13286    return res;
13287  }
13288
13289  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
13290    parseBackboneElementProperties(json, res);
13291    if (json.has("sequence"))
13292      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13293    if (json.has("_sequence"))
13294      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13295    if (json.has("provider"))
13296      res.setProvider(parseReference(getJObject(json, "provider")));
13297    if (json.has("responsible"))
13298      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
13299    if (json.has("_responsible"))
13300      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
13301    if (json.has("role"))
13302      res.setRole(parseCodeableConcept(getJObject(json, "role")));
13303    if (json.has("qualification"))
13304      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
13305  }
13306
13307  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
13308    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
13309    parseExplanationOfBenefitSupportingInformationComponentProperties(json, res);
13310    return res;
13311  }
13312
13313  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
13314    parseBackboneElementProperties(json, res);
13315    if (json.has("sequence"))
13316      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13317    if (json.has("_sequence"))
13318      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13319    if (json.has("category"))
13320      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13321    if (json.has("code"))
13322      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13323    DataType timing = parseType("timing", json);
13324    if (timing != null)
13325      res.setTiming(timing);
13326    DataType value = parseType("value", json);
13327    if (value != null)
13328      res.setValue(value);
13329    if (json.has("reason"))
13330      res.setReason(parseCoding(getJObject(json, "reason")));
13331  }
13332
13333  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
13334    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
13335    parseExplanationOfBenefitDiagnosisComponentProperties(json, res);
13336    return res;
13337  }
13338
13339  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
13340    parseBackboneElementProperties(json, res);
13341    if (json.has("sequence"))
13342      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13343    if (json.has("_sequence"))
13344      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13345    DataType diagnosis = parseType("diagnosis", json);
13346    if (diagnosis != null)
13347      res.setDiagnosis(diagnosis);
13348    if (json.has("type")) {
13349      JsonArray array = getJArray(json, "type");
13350      for (int i = 0; i < array.size(); i++) {
13351        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13352      }
13353    };
13354    if (json.has("onAdmission"))
13355      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
13356    if (json.has("packageCode"))
13357      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
13358  }
13359
13360  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
13361    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
13362    parseExplanationOfBenefitProcedureComponentProperties(json, res);
13363    return res;
13364  }
13365
13366  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
13367    parseBackboneElementProperties(json, res);
13368    if (json.has("sequence"))
13369      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13370    if (json.has("_sequence"))
13371      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13372    if (json.has("type")) {
13373      JsonArray array = getJArray(json, "type");
13374      for (int i = 0; i < array.size(); i++) {
13375        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13376      }
13377    };
13378    if (json.has("date"))
13379      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13380    if (json.has("_date"))
13381      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13382    DataType procedure = parseType("procedure", json);
13383    if (procedure != null)
13384      res.setProcedure(procedure);
13385    if (json.has("udi")) {
13386      JsonArray array = getJArray(json, "udi");
13387      for (int i = 0; i < array.size(); i++) {
13388        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13389      }
13390    };
13391  }
13392
13393  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
13394    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
13395    parseExplanationOfBenefitInsuranceComponentProperties(json, res);
13396    return res;
13397  }
13398
13399  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
13400    parseBackboneElementProperties(json, res);
13401    if (json.has("focal"))
13402      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
13403    if (json.has("_focal"))
13404      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
13405    if (json.has("coverage"))
13406      res.setCoverage(parseReference(getJObject(json, "coverage")));
13407    if (json.has("preAuthRef")) {
13408      JsonArray array = getJArray(json, "preAuthRef");
13409      for (int i = 0; i < array.size(); i++) {
13410        if (array.get(i).isJsonNull()) {
13411          res.getPreAuthRef().add(new StringType());
13412        } else {;
13413          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
13414        }
13415      }
13416    };
13417    if (json.has("_preAuthRef")) {
13418      JsonArray array = getJArray(json, "_preAuthRef");
13419      for (int i = 0; i < array.size(); i++) {
13420        if (i == res.getPreAuthRef().size())
13421          res.getPreAuthRef().add(parseString(null));
13422        if (array.get(i) instanceof JsonObject) 
13423          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
13424      }
13425    };
13426  }
13427
13428  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
13429    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
13430    parseExplanationOfBenefitAccidentComponentProperties(json, res);
13431    return res;
13432  }
13433
13434  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
13435    parseBackboneElementProperties(json, res);
13436    if (json.has("date"))
13437      res.setDateElement(parseDate(json.get("date").getAsString()));
13438    if (json.has("_date"))
13439      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13440    if (json.has("type"))
13441      res.setType(parseCodeableConcept(getJObject(json, "type")));
13442    DataType location = parseType("location", json);
13443    if (location != null)
13444      res.setLocation(location);
13445  }
13446
13447  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json) throws IOException, FHIRFormatError {
13448    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
13449    parseExplanationOfBenefitItemComponentProperties(json, res);
13450    return res;
13451  }
13452
13453  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
13454    parseBackboneElementProperties(json, res);
13455    if (json.has("sequence"))
13456      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13457    if (json.has("_sequence"))
13458      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13459    if (json.has("careTeamSequence")) {
13460      JsonArray array = getJArray(json, "careTeamSequence");
13461      for (int i = 0; i < array.size(); i++) {
13462        if (array.get(i).isJsonNull()) {
13463          res.getCareTeamSequence().add(new PositiveIntType());
13464        } else {;
13465          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
13466        }
13467      }
13468    };
13469    if (json.has("_careTeamSequence")) {
13470      JsonArray array = getJArray(json, "_careTeamSequence");
13471      for (int i = 0; i < array.size(); i++) {
13472        if (i == res.getCareTeamSequence().size())
13473          res.getCareTeamSequence().add(parsePositiveInt(null));
13474        if (array.get(i) instanceof JsonObject) 
13475          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
13476      }
13477    };
13478    if (json.has("diagnosisSequence")) {
13479      JsonArray array = getJArray(json, "diagnosisSequence");
13480      for (int i = 0; i < array.size(); i++) {
13481        if (array.get(i).isJsonNull()) {
13482          res.getDiagnosisSequence().add(new PositiveIntType());
13483        } else {;
13484          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
13485        }
13486      }
13487    };
13488    if (json.has("_diagnosisSequence")) {
13489      JsonArray array = getJArray(json, "_diagnosisSequence");
13490      for (int i = 0; i < array.size(); i++) {
13491        if (i == res.getDiagnosisSequence().size())
13492          res.getDiagnosisSequence().add(parsePositiveInt(null));
13493        if (array.get(i) instanceof JsonObject) 
13494          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
13495      }
13496    };
13497    if (json.has("procedureSequence")) {
13498      JsonArray array = getJArray(json, "procedureSequence");
13499      for (int i = 0; i < array.size(); i++) {
13500        if (array.get(i).isJsonNull()) {
13501          res.getProcedureSequence().add(new PositiveIntType());
13502        } else {;
13503          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
13504        }
13505      }
13506    };
13507    if (json.has("_procedureSequence")) {
13508      JsonArray array = getJArray(json, "_procedureSequence");
13509      for (int i = 0; i < array.size(); i++) {
13510        if (i == res.getProcedureSequence().size())
13511          res.getProcedureSequence().add(parsePositiveInt(null));
13512        if (array.get(i) instanceof JsonObject) 
13513          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
13514      }
13515    };
13516    if (json.has("informationSequence")) {
13517      JsonArray array = getJArray(json, "informationSequence");
13518      for (int i = 0; i < array.size(); i++) {
13519        if (array.get(i).isJsonNull()) {
13520          res.getInformationSequence().add(new PositiveIntType());
13521        } else {;
13522          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
13523        }
13524      }
13525    };
13526    if (json.has("_informationSequence")) {
13527      JsonArray array = getJArray(json, "_informationSequence");
13528      for (int i = 0; i < array.size(); i++) {
13529        if (i == res.getInformationSequence().size())
13530          res.getInformationSequence().add(parsePositiveInt(null));
13531        if (array.get(i) instanceof JsonObject) 
13532          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
13533      }
13534    };
13535    if (json.has("revenue"))
13536      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
13537    if (json.has("category"))
13538      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13539    if (json.has("productOrService"))
13540      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
13541    if (json.has("modifier")) {
13542      JsonArray array = getJArray(json, "modifier");
13543      for (int i = 0; i < array.size(); i++) {
13544        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13545      }
13546    };
13547    if (json.has("programCode")) {
13548      JsonArray array = getJArray(json, "programCode");
13549      for (int i = 0; i < array.size(); i++) {
13550        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13551      }
13552    };
13553    DataType serviced = parseType("serviced", json);
13554    if (serviced != null)
13555      res.setServiced(serviced);
13556    DataType location = parseType("location", json);
13557    if (location != null)
13558      res.setLocation(location);
13559    if (json.has("quantity"))
13560      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
13561    if (json.has("unitPrice"))
13562      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
13563    if (json.has("factor"))
13564      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13565    if (json.has("_factor"))
13566      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
13567    if (json.has("net"))
13568      res.setNet(parseMoney(getJObject(json, "net")));
13569    if (json.has("udi")) {
13570      JsonArray array = getJArray(json, "udi");
13571      for (int i = 0; i < array.size(); i++) {
13572        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13573      }
13574    };
13575    if (json.has("bodySite"))
13576      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
13577    if (json.has("subSite")) {
13578      JsonArray array = getJArray(json, "subSite");
13579      for (int i = 0; i < array.size(); i++) {
13580        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13581      }
13582    };
13583    if (json.has("encounter")) {
13584      JsonArray array = getJArray(json, "encounter");
13585      for (int i = 0; i < array.size(); i++) {
13586        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
13587      }
13588    };
13589    if (json.has("noteNumber")) {
13590      JsonArray array = getJArray(json, "noteNumber");
13591      for (int i = 0; i < array.size(); i++) {
13592        if (array.get(i).isJsonNull()) {
13593          res.getNoteNumber().add(new PositiveIntType());
13594        } else {;
13595          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13596        }
13597      }
13598    };
13599    if (json.has("_noteNumber")) {
13600      JsonArray array = getJArray(json, "_noteNumber");
13601      for (int i = 0; i < array.size(); i++) {
13602        if (i == res.getNoteNumber().size())
13603          res.getNoteNumber().add(parsePositiveInt(null));
13604        if (array.get(i) instanceof JsonObject) 
13605          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13606      }
13607    };
13608    if (json.has("adjudication")) {
13609      JsonArray array = getJArray(json, "adjudication");
13610      for (int i = 0; i < array.size(); i++) {
13611        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13612      }
13613    };
13614    if (json.has("detail")) {
13615      JsonArray array = getJArray(json, "detail");
13616      for (int i = 0; i < array.size(); i++) {
13617        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject()));
13618      }
13619    };
13620  }
13621
13622  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
13623    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
13624    parseExplanationOfBenefitAdjudicationComponentProperties(json, res);
13625    return res;
13626  }
13627
13628  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
13629    parseBackboneElementProperties(json, res);
13630    if (json.has("category"))
13631      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13632    if (json.has("reason"))
13633      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
13634    if (json.has("amount"))
13635      res.setAmount(parseMoney(getJObject(json, "amount")));
13636    if (json.has("value"))
13637      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
13638    if (json.has("_value"))
13639      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
13640  }
13641
13642  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13643    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
13644    parseExplanationOfBenefitDetailComponentProperties(json, res);
13645    return res;
13646  }
13647
13648  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
13649    parseBackboneElementProperties(json, res);
13650    if (json.has("sequence"))
13651      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13652    if (json.has("_sequence"))
13653      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13654    if (json.has("revenue"))
13655      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
13656    if (json.has("category"))
13657      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13658    if (json.has("productOrService"))
13659      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
13660    if (json.has("modifier")) {
13661      JsonArray array = getJArray(json, "modifier");
13662      for (int i = 0; i < array.size(); i++) {
13663        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13664      }
13665    };
13666    if (json.has("programCode")) {
13667      JsonArray array = getJArray(json, "programCode");
13668      for (int i = 0; i < array.size(); i++) {
13669        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13670      }
13671    };
13672    if (json.has("quantity"))
13673      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
13674    if (json.has("unitPrice"))
13675      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
13676    if (json.has("factor"))
13677      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13678    if (json.has("_factor"))
13679      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
13680    if (json.has("net"))
13681      res.setNet(parseMoney(getJObject(json, "net")));
13682    if (json.has("udi")) {
13683      JsonArray array = getJArray(json, "udi");
13684      for (int i = 0; i < array.size(); i++) {
13685        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13686      }
13687    };
13688    if (json.has("noteNumber")) {
13689      JsonArray array = getJArray(json, "noteNumber");
13690      for (int i = 0; i < array.size(); i++) {
13691        if (array.get(i).isJsonNull()) {
13692          res.getNoteNumber().add(new PositiveIntType());
13693        } else {;
13694          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13695        }
13696      }
13697    };
13698    if (json.has("_noteNumber")) {
13699      JsonArray array = getJArray(json, "_noteNumber");
13700      for (int i = 0; i < array.size(); i++) {
13701        if (i == res.getNoteNumber().size())
13702          res.getNoteNumber().add(parsePositiveInt(null));
13703        if (array.get(i) instanceof JsonObject) 
13704          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13705      }
13706    };
13707    if (json.has("adjudication")) {
13708      JsonArray array = getJArray(json, "adjudication");
13709      for (int i = 0; i < array.size(); i++) {
13710        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13711      }
13712    };
13713    if (json.has("subDetail")) {
13714      JsonArray array = getJArray(json, "subDetail");
13715      for (int i = 0; i < array.size(); i++) {
13716        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject()));
13717      }
13718    };
13719  }
13720
13721  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13722    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
13723    parseExplanationOfBenefitSubDetailComponentProperties(json, res);
13724    return res;
13725  }
13726
13727  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
13728    parseBackboneElementProperties(json, res);
13729    if (json.has("sequence"))
13730      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13731    if (json.has("_sequence"))
13732      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13733    if (json.has("revenue"))
13734      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
13735    if (json.has("category"))
13736      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13737    if (json.has("productOrService"))
13738      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
13739    if (json.has("modifier")) {
13740      JsonArray array = getJArray(json, "modifier");
13741      for (int i = 0; i < array.size(); i++) {
13742        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13743      }
13744    };
13745    if (json.has("programCode")) {
13746      JsonArray array = getJArray(json, "programCode");
13747      for (int i = 0; i < array.size(); i++) {
13748        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13749      }
13750    };
13751    if (json.has("quantity"))
13752      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
13753    if (json.has("unitPrice"))
13754      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
13755    if (json.has("factor"))
13756      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13757    if (json.has("_factor"))
13758      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
13759    if (json.has("net"))
13760      res.setNet(parseMoney(getJObject(json, "net")));
13761    if (json.has("udi")) {
13762      JsonArray array = getJArray(json, "udi");
13763      for (int i = 0; i < array.size(); i++) {
13764        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13765      }
13766    };
13767    if (json.has("noteNumber")) {
13768      JsonArray array = getJArray(json, "noteNumber");
13769      for (int i = 0; i < array.size(); i++) {
13770        if (array.get(i).isJsonNull()) {
13771          res.getNoteNumber().add(new PositiveIntType());
13772        } else {;
13773          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13774        }
13775      }
13776    };
13777    if (json.has("_noteNumber")) {
13778      JsonArray array = getJArray(json, "_noteNumber");
13779      for (int i = 0; i < array.size(); i++) {
13780        if (i == res.getNoteNumber().size())
13781          res.getNoteNumber().add(parsePositiveInt(null));
13782        if (array.get(i) instanceof JsonObject) 
13783          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13784      }
13785    };
13786    if (json.has("adjudication")) {
13787      JsonArray array = getJArray(json, "adjudication");
13788      for (int i = 0; i < array.size(); i++) {
13789        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13790      }
13791    };
13792  }
13793
13794  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
13795    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
13796    parseExplanationOfBenefitAddedItemComponentProperties(json, res);
13797    return res;
13798  }
13799
13800  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
13801    parseBackboneElementProperties(json, res);
13802    if (json.has("itemSequence")) {
13803      JsonArray array = getJArray(json, "itemSequence");
13804      for (int i = 0; i < array.size(); i++) {
13805        if (array.get(i).isJsonNull()) {
13806          res.getItemSequence().add(new PositiveIntType());
13807        } else {;
13808          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
13809        }
13810      }
13811    };
13812    if (json.has("_itemSequence")) {
13813      JsonArray array = getJArray(json, "_itemSequence");
13814      for (int i = 0; i < array.size(); i++) {
13815        if (i == res.getItemSequence().size())
13816          res.getItemSequence().add(parsePositiveInt(null));
13817        if (array.get(i) instanceof JsonObject) 
13818          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
13819      }
13820    };
13821    if (json.has("detailSequence")) {
13822      JsonArray array = getJArray(json, "detailSequence");
13823      for (int i = 0; i < array.size(); i++) {
13824        if (array.get(i).isJsonNull()) {
13825          res.getDetailSequence().add(new PositiveIntType());
13826        } else {;
13827          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
13828        }
13829      }
13830    };
13831    if (json.has("_detailSequence")) {
13832      JsonArray array = getJArray(json, "_detailSequence");
13833      for (int i = 0; i < array.size(); i++) {
13834        if (i == res.getDetailSequence().size())
13835          res.getDetailSequence().add(parsePositiveInt(null));
13836        if (array.get(i) instanceof JsonObject) 
13837          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
13838      }
13839    };
13840    if (json.has("subDetailSequence")) {
13841      JsonArray array = getJArray(json, "subDetailSequence");
13842      for (int i = 0; i < array.size(); i++) {
13843        if (array.get(i).isJsonNull()) {
13844          res.getSubDetailSequence().add(new PositiveIntType());
13845        } else {;
13846          res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
13847        }
13848      }
13849    };
13850    if (json.has("_subDetailSequence")) {
13851      JsonArray array = getJArray(json, "_subDetailSequence");
13852      for (int i = 0; i < array.size(); i++) {
13853        if (i == res.getSubDetailSequence().size())
13854          res.getSubDetailSequence().add(parsePositiveInt(null));
13855        if (array.get(i) instanceof JsonObject) 
13856          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
13857      }
13858    };
13859    if (json.has("provider")) {
13860      JsonArray array = getJArray(json, "provider");
13861      for (int i = 0; i < array.size(); i++) {
13862        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
13863      }
13864    };
13865    if (json.has("productOrService"))
13866      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
13867    if (json.has("modifier")) {
13868      JsonArray array = getJArray(json, "modifier");
13869      for (int i = 0; i < array.size(); i++) {
13870        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13871      }
13872    };
13873    if (json.has("programCode")) {
13874      JsonArray array = getJArray(json, "programCode");
13875      for (int i = 0; i < array.size(); i++) {
13876        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13877      }
13878    };
13879    DataType serviced = parseType("serviced", json);
13880    if (serviced != null)
13881      res.setServiced(serviced);
13882    DataType location = parseType("location", json);
13883    if (location != null)
13884      res.setLocation(location);
13885    if (json.has("quantity"))
13886      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
13887    if (json.has("unitPrice"))
13888      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
13889    if (json.has("factor"))
13890      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13891    if (json.has("_factor"))
13892      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
13893    if (json.has("net"))
13894      res.setNet(parseMoney(getJObject(json, "net")));
13895    if (json.has("bodySite"))
13896      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
13897    if (json.has("subSite")) {
13898      JsonArray array = getJArray(json, "subSite");
13899      for (int i = 0; i < array.size(); i++) {
13900        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13901      }
13902    };
13903    if (json.has("noteNumber")) {
13904      JsonArray array = getJArray(json, "noteNumber");
13905      for (int i = 0; i < array.size(); i++) {
13906        if (array.get(i).isJsonNull()) {
13907          res.getNoteNumber().add(new PositiveIntType());
13908        } else {;
13909          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13910        }
13911      }
13912    };
13913    if (json.has("_noteNumber")) {
13914      JsonArray array = getJArray(json, "_noteNumber");
13915      for (int i = 0; i < array.size(); i++) {
13916        if (i == res.getNoteNumber().size())
13917          res.getNoteNumber().add(parsePositiveInt(null));
13918        if (array.get(i) instanceof JsonObject) 
13919          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13920      }
13921    };
13922    if (json.has("adjudication")) {
13923      JsonArray array = getJArray(json, "adjudication");
13924      for (int i = 0; i < array.size(); i++) {
13925        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13926      }
13927    };
13928    if (json.has("detail")) {
13929      JsonArray array = getJArray(json, "detail");
13930      for (int i = 0; i < array.size(); i++) {
13931        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject()));
13932      }
13933    };
13934  }
13935
13936  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13937    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
13938    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, res);
13939    return res;
13940  }
13941
13942  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
13943    parseBackboneElementProperties(json, res);
13944    if (json.has("productOrService"))
13945      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
13946    if (json.has("modifier")) {
13947      JsonArray array = getJArray(json, "modifier");
13948      for (int i = 0; i < array.size(); i++) {
13949        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13950      }
13951    };
13952    if (json.has("quantity"))
13953      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
13954    if (json.has("unitPrice"))
13955      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
13956    if (json.has("factor"))
13957      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13958    if (json.has("_factor"))
13959      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
13960    if (json.has("net"))
13961      res.setNet(parseMoney(getJObject(json, "net")));
13962    if (json.has("noteNumber")) {
13963      JsonArray array = getJArray(json, "noteNumber");
13964      for (int i = 0; i < array.size(); i++) {
13965        if (array.get(i).isJsonNull()) {
13966          res.getNoteNumber().add(new PositiveIntType());
13967        } else {;
13968          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13969        }
13970      }
13971    };
13972    if (json.has("_noteNumber")) {
13973      JsonArray array = getJArray(json, "_noteNumber");
13974      for (int i = 0; i < array.size(); i++) {
13975        if (i == res.getNoteNumber().size())
13976          res.getNoteNumber().add(parsePositiveInt(null));
13977        if (array.get(i) instanceof JsonObject) 
13978          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13979      }
13980    };
13981    if (json.has("adjudication")) {
13982      JsonArray array = getJArray(json, "adjudication");
13983      for (int i = 0; i < array.size(); i++) {
13984        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13985      }
13986    };
13987    if (json.has("subDetail")) {
13988      JsonArray array = getJArray(json, "subDetail");
13989      for (int i = 0; i < array.size(); i++) {
13990        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject()));
13991      }
13992    };
13993  }
13994
13995  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13996    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
13997    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, res);
13998    return res;
13999  }
14000
14001  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
14002    parseBackboneElementProperties(json, res);
14003    if (json.has("productOrService"))
14004      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
14005    if (json.has("modifier")) {
14006      JsonArray array = getJArray(json, "modifier");
14007      for (int i = 0; i < array.size(); i++) {
14008        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14009      }
14010    };
14011    if (json.has("quantity"))
14012      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
14013    if (json.has("unitPrice"))
14014      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
14015    if (json.has("factor"))
14016      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14017    if (json.has("_factor"))
14018      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
14019    if (json.has("net"))
14020      res.setNet(parseMoney(getJObject(json, "net")));
14021    if (json.has("noteNumber")) {
14022      JsonArray array = getJArray(json, "noteNumber");
14023      for (int i = 0; i < array.size(); i++) {
14024        if (array.get(i).isJsonNull()) {
14025          res.getNoteNumber().add(new PositiveIntType());
14026        } else {;
14027          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
14028        }
14029      }
14030    };
14031    if (json.has("_noteNumber")) {
14032      JsonArray array = getJArray(json, "_noteNumber");
14033      for (int i = 0; i < array.size(); i++) {
14034        if (i == res.getNoteNumber().size())
14035          res.getNoteNumber().add(parsePositiveInt(null));
14036        if (array.get(i) instanceof JsonObject) 
14037          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
14038      }
14039    };
14040    if (json.has("adjudication")) {
14041      JsonArray array = getJArray(json, "adjudication");
14042      for (int i = 0; i < array.size(); i++) {
14043        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
14044      }
14045    };
14046  }
14047
14048  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
14049    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
14050    parseExplanationOfBenefitTotalComponentProperties(json, res);
14051    return res;
14052  }
14053
14054  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
14055    parseBackboneElementProperties(json, res);
14056    if (json.has("category"))
14057      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14058    if (json.has("amount"))
14059      res.setAmount(parseMoney(getJObject(json, "amount")));
14060  }
14061
14062  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
14063    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
14064    parseExplanationOfBenefitPaymentComponentProperties(json, res);
14065    return res;
14066  }
14067
14068  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
14069    parseBackboneElementProperties(json, res);
14070    if (json.has("type"))
14071      res.setType(parseCodeableConcept(getJObject(json, "type")));
14072    if (json.has("adjustment"))
14073      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
14074    if (json.has("adjustmentReason"))
14075      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
14076    if (json.has("date"))
14077      res.setDateElement(parseDate(json.get("date").getAsString()));
14078    if (json.has("_date"))
14079      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14080    if (json.has("amount"))
14081      res.setAmount(parseMoney(getJObject(json, "amount")));
14082    if (json.has("identifier"))
14083      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
14084  }
14085
14086  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
14087    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
14088    parseExplanationOfBenefitNoteComponentProperties(json, res);
14089    return res;
14090  }
14091
14092  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
14093    parseBackboneElementProperties(json, res);
14094    if (json.has("number"))
14095      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
14096    if (json.has("_number"))
14097      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
14098    if (json.has("type"))
14099      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
14100    if (json.has("_type"))
14101      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14102    if (json.has("text"))
14103      res.setTextElement(parseString(json.get("text").getAsString()));
14104    if (json.has("_text"))
14105      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
14106    if (json.has("language"))
14107      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
14108  }
14109
14110  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json) throws IOException, FHIRFormatError {
14111    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
14112    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, res);
14113    return res;
14114  }
14115
14116  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
14117    parseBackboneElementProperties(json, res);
14118    if (json.has("category"))
14119      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14120    if (json.has("excluded"))
14121      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
14122    if (json.has("_excluded"))
14123      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
14124    if (json.has("name"))
14125      res.setNameElement(parseString(json.get("name").getAsString()));
14126    if (json.has("_name"))
14127      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14128    if (json.has("description"))
14129      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14130    if (json.has("_description"))
14131      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14132    if (json.has("network"))
14133      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
14134    if (json.has("unit"))
14135      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
14136    if (json.has("term"))
14137      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
14138    if (json.has("financial")) {
14139      JsonArray array = getJArray(json, "financial");
14140      for (int i = 0; i < array.size(); i++) {
14141        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject()));
14142      }
14143    };
14144  }
14145
14146  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
14147    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
14148    parseExplanationOfBenefitBenefitComponentProperties(json, res);
14149    return res;
14150  }
14151
14152  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
14153    parseBackboneElementProperties(json, res);
14154    if (json.has("type"))
14155      res.setType(parseCodeableConcept(getJObject(json, "type")));
14156    DataType allowed = parseType("allowed", json);
14157    if (allowed != null)
14158      res.setAllowed(allowed);
14159    DataType used = parseType("used", json);
14160    if (used != null)
14161      res.setUsed(used);
14162  }
14163
14164  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
14165    FamilyMemberHistory res = new FamilyMemberHistory();
14166    parseFamilyMemberHistoryProperties(json, res);
14167    return res;
14168  }
14169
14170  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
14171    parseDomainResourceProperties(json, res);
14172    if (json.has("identifier")) {
14173      JsonArray array = getJArray(json, "identifier");
14174      for (int i = 0; i < array.size(); i++) {
14175        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14176      }
14177    };
14178    if (json.has("instantiatesCanonical")) {
14179      JsonArray array = getJArray(json, "instantiatesCanonical");
14180      for (int i = 0; i < array.size(); i++) {
14181        if (array.get(i).isJsonNull()) {
14182          res.getInstantiatesCanonical().add(new CanonicalType());
14183        } else {;
14184          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
14185        }
14186      }
14187    };
14188    if (json.has("_instantiatesCanonical")) {
14189      JsonArray array = getJArray(json, "_instantiatesCanonical");
14190      for (int i = 0; i < array.size(); i++) {
14191        if (i == res.getInstantiatesCanonical().size())
14192          res.getInstantiatesCanonical().add(parseCanonical(null));
14193        if (array.get(i) instanceof JsonObject) 
14194          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
14195      }
14196    };
14197    if (json.has("instantiatesUri")) {
14198      JsonArray array = getJArray(json, "instantiatesUri");
14199      for (int i = 0; i < array.size(); i++) {
14200        if (array.get(i).isJsonNull()) {
14201          res.getInstantiatesUri().add(new UriType());
14202        } else {;
14203          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
14204        }
14205      }
14206    };
14207    if (json.has("_instantiatesUri")) {
14208      JsonArray array = getJArray(json, "_instantiatesUri");
14209      for (int i = 0; i < array.size(); i++) {
14210        if (i == res.getInstantiatesUri().size())
14211          res.getInstantiatesUri().add(parseUri(null));
14212        if (array.get(i) instanceof JsonObject) 
14213          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
14214      }
14215    };
14216    if (json.has("status"))
14217      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
14218    if (json.has("_status"))
14219      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14220    if (json.has("dataAbsentReason"))
14221      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
14222    if (json.has("patient"))
14223      res.setPatient(parseReference(getJObject(json, "patient")));
14224    if (json.has("date"))
14225      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14226    if (json.has("_date"))
14227      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14228    if (json.has("name"))
14229      res.setNameElement(parseString(json.get("name").getAsString()));
14230    if (json.has("_name"))
14231      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14232    if (json.has("relationship"))
14233      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
14234    if (json.has("sex"))
14235      res.setSex(parseCodeableConcept(getJObject(json, "sex")));
14236    DataType born = parseType("born", json);
14237    if (born != null)
14238      res.setBorn(born);
14239    DataType age = parseType("age", json);
14240    if (age != null)
14241      res.setAge(age);
14242    if (json.has("estimatedAge"))
14243      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
14244    if (json.has("_estimatedAge"))
14245      parseElementProperties(getJObject(json, "_estimatedAge"), res.getEstimatedAgeElement());
14246    DataType deceased = parseType("deceased", json);
14247    if (deceased != null)
14248      res.setDeceased(deceased);
14249    if (json.has("reasonCode")) {
14250      JsonArray array = getJArray(json, "reasonCode");
14251      for (int i = 0; i < array.size(); i++) {
14252        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14253      }
14254    };
14255    if (json.has("reasonReference")) {
14256      JsonArray array = getJArray(json, "reasonReference");
14257      for (int i = 0; i < array.size(); i++) {
14258        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14259      }
14260    };
14261    if (json.has("note")) {
14262      JsonArray array = getJArray(json, "note");
14263      for (int i = 0; i < array.size(); i++) {
14264        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14265      }
14266    };
14267    if (json.has("condition")) {
14268      JsonArray array = getJArray(json, "condition");
14269      for (int i = 0; i < array.size(); i++) {
14270        res.getCondition().add(parseFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject()));
14271      }
14272    };
14273  }
14274
14275  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
14276    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
14277    parseFamilyMemberHistoryConditionComponentProperties(json, res);
14278    return res;
14279  }
14280
14281  protected void parseFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
14282    parseBackboneElementProperties(json, res);
14283    if (json.has("code"))
14284      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14285    if (json.has("outcome"))
14286      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
14287    if (json.has("contributedToDeath"))
14288      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
14289    if (json.has("_contributedToDeath"))
14290      parseElementProperties(getJObject(json, "_contributedToDeath"), res.getContributedToDeathElement());
14291    DataType onset = parseType("onset", json);
14292    if (onset != null)
14293      res.setOnset(onset);
14294    if (json.has("note")) {
14295      JsonArray array = getJArray(json, "note");
14296      for (int i = 0; i < array.size(); i++) {
14297        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14298      }
14299    };
14300  }
14301
14302  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
14303    Flag res = new Flag();
14304    parseFlagProperties(json, res);
14305    return res;
14306  }
14307
14308  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
14309    parseDomainResourceProperties(json, res);
14310    if (json.has("identifier")) {
14311      JsonArray array = getJArray(json, "identifier");
14312      for (int i = 0; i < array.size(); i++) {
14313        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14314      }
14315    };
14316    if (json.has("status"))
14317      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
14318    if (json.has("_status"))
14319      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14320    if (json.has("category")) {
14321      JsonArray array = getJArray(json, "category");
14322      for (int i = 0; i < array.size(); i++) {
14323        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14324      }
14325    };
14326    if (json.has("code"))
14327      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14328    if (json.has("subject"))
14329      res.setSubject(parseReference(getJObject(json, "subject")));
14330    if (json.has("period"))
14331      res.setPeriod(parsePeriod(getJObject(json, "period")));
14332    if (json.has("encounter"))
14333      res.setEncounter(parseReference(getJObject(json, "encounter")));
14334    if (json.has("author"))
14335      res.setAuthor(parseReference(getJObject(json, "author")));
14336  }
14337
14338  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
14339    Goal res = new Goal();
14340    parseGoalProperties(json, res);
14341    return res;
14342  }
14343
14344  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
14345    parseDomainResourceProperties(json, res);
14346    if (json.has("identifier")) {
14347      JsonArray array = getJArray(json, "identifier");
14348      for (int i = 0; i < array.size(); i++) {
14349        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14350      }
14351    };
14352    if (json.has("lifecycleStatus"))
14353      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
14354    if (json.has("_lifecycleStatus"))
14355      parseElementProperties(getJObject(json, "_lifecycleStatus"), res.getLifecycleStatusElement());
14356    if (json.has("achievementStatus"))
14357      res.setAchievementStatus(parseCodeableConcept(getJObject(json, "achievementStatus")));
14358    if (json.has("category")) {
14359      JsonArray array = getJArray(json, "category");
14360      for (int i = 0; i < array.size(); i++) {
14361        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14362      }
14363    };
14364    if (json.has("priority"))
14365      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
14366    if (json.has("description"))
14367      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
14368    if (json.has("subject"))
14369      res.setSubject(parseReference(getJObject(json, "subject")));
14370    DataType start = parseType("start", json);
14371    if (start != null)
14372      res.setStart(start);
14373    if (json.has("target")) {
14374      JsonArray array = getJArray(json, "target");
14375      for (int i = 0; i < array.size(); i++) {
14376        res.getTarget().add(parseGoalTargetComponent(array.get(i).getAsJsonObject()));
14377      }
14378    };
14379    if (json.has("statusDate"))
14380      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
14381    if (json.has("_statusDate"))
14382      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
14383    if (json.has("statusReason"))
14384      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
14385    if (json.has("_statusReason"))
14386      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
14387    if (json.has("expressedBy"))
14388      res.setExpressedBy(parseReference(getJObject(json, "expressedBy")));
14389    if (json.has("addresses")) {
14390      JsonArray array = getJArray(json, "addresses");
14391      for (int i = 0; i < array.size(); i++) {
14392        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
14393      }
14394    };
14395    if (json.has("note")) {
14396      JsonArray array = getJArray(json, "note");
14397      for (int i = 0; i < array.size(); i++) {
14398        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14399      }
14400    };
14401    if (json.has("outcomeCode")) {
14402      JsonArray array = getJArray(json, "outcomeCode");
14403      for (int i = 0; i < array.size(); i++) {
14404        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14405      }
14406    };
14407    if (json.has("outcomeReference")) {
14408      JsonArray array = getJArray(json, "outcomeReference");
14409      for (int i = 0; i < array.size(); i++) {
14410        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
14411      }
14412    };
14413  }
14414
14415  protected Goal.GoalTargetComponent parseGoalTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
14416    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
14417    parseGoalTargetComponentProperties(json, res);
14418    return res;
14419  }
14420
14421  protected void parseGoalTargetComponentProperties(JsonObject json, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
14422    parseBackboneElementProperties(json, res);
14423    if (json.has("measure"))
14424      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
14425    DataType detail = parseType("detail", json);
14426    if (detail != null)
14427      res.setDetail(detail);
14428    DataType due = parseType("due", json);
14429    if (due != null)
14430      res.setDue(due);
14431  }
14432
14433  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
14434    GraphDefinition res = new GraphDefinition();
14435    parseGraphDefinitionProperties(json, res);
14436    return res;
14437  }
14438
14439  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
14440    parseDomainResourceProperties(json, res);
14441    if (json.has("url"))
14442      res.setUrlElement(parseUri(json.get("url").getAsString()));
14443    if (json.has("_url"))
14444      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14445    if (json.has("version"))
14446      res.setVersionElement(parseString(json.get("version").getAsString()));
14447    if (json.has("_version"))
14448      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14449    if (json.has("name"))
14450      res.setNameElement(parseString(json.get("name").getAsString()));
14451    if (json.has("_name"))
14452      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14453    if (json.has("status"))
14454      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14455    if (json.has("_status"))
14456      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14457    if (json.has("experimental"))
14458      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14459    if (json.has("_experimental"))
14460      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
14461    if (json.has("date"))
14462      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14463    if (json.has("_date"))
14464      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14465    if (json.has("publisher"))
14466      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14467    if (json.has("_publisher"))
14468      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14469    if (json.has("contact")) {
14470      JsonArray array = getJArray(json, "contact");
14471      for (int i = 0; i < array.size(); i++) {
14472        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14473      }
14474    };
14475    if (json.has("description"))
14476      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14477    if (json.has("_description"))
14478      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14479    if (json.has("useContext")) {
14480      JsonArray array = getJArray(json, "useContext");
14481      for (int i = 0; i < array.size(); i++) {
14482        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14483      }
14484    };
14485    if (json.has("jurisdiction")) {
14486      JsonArray array = getJArray(json, "jurisdiction");
14487      for (int i = 0; i < array.size(); i++) {
14488        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14489      }
14490    };
14491    if (json.has("purpose"))
14492      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14493    if (json.has("_purpose"))
14494      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
14495    if (json.has("start"))
14496      res.setStartElement(parseCode(json.get("start").getAsString()));
14497    if (json.has("_start"))
14498      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
14499    if (json.has("profile"))
14500      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14501    if (json.has("_profile"))
14502      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
14503    if (json.has("link")) {
14504      JsonArray array = getJArray(json, "link");
14505      for (int i = 0; i < array.size(); i++) {
14506        res.getLink().add(parseGraphDefinitionLinkComponent(array.get(i).getAsJsonObject()));
14507      }
14508    };
14509  }
14510
14511  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
14512    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
14513    parseGraphDefinitionLinkComponentProperties(json, res);
14514    return res;
14515  }
14516
14517  protected void parseGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
14518    parseBackboneElementProperties(json, res);
14519    if (json.has("path"))
14520      res.setPathElement(parseString(json.get("path").getAsString()));
14521    if (json.has("_path"))
14522      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
14523    if (json.has("sliceName"))
14524      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
14525    if (json.has("_sliceName"))
14526      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
14527    if (json.has("min"))
14528      res.setMinElement(parseInteger(json.get("min").getAsLong()));
14529    if (json.has("_min"))
14530      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
14531    if (json.has("max"))
14532      res.setMaxElement(parseString(json.get("max").getAsString()));
14533    if (json.has("_max"))
14534      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
14535    if (json.has("description"))
14536      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14537    if (json.has("_description"))
14538      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14539    if (json.has("target")) {
14540      JsonArray array = getJArray(json, "target");
14541      for (int i = 0; i < array.size(); i++) {
14542        res.getTarget().add(parseGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject()));
14543      }
14544    };
14545  }
14546
14547  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionLinkTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
14548    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
14549    parseGraphDefinitionLinkTargetComponentProperties(json, res);
14550    return res;
14551  }
14552
14553  protected void parseGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
14554    parseBackboneElementProperties(json, res);
14555    if (json.has("type"))
14556      res.setTypeElement(parseCode(json.get("type").getAsString()));
14557    if (json.has("_type"))
14558      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14559    if (json.has("params"))
14560      res.setParamsElement(parseString(json.get("params").getAsString()));
14561    if (json.has("_params"))
14562      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
14563    if (json.has("profile"))
14564      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14565    if (json.has("_profile"))
14566      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
14567    if (json.has("compartment")) {
14568      JsonArray array = getJArray(json, "compartment");
14569      for (int i = 0; i < array.size(); i++) {
14570        res.getCompartment().add(parseGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject()));
14571      }
14572    };
14573    if (json.has("link")) {
14574      JsonArray array = getJArray(json, "link");
14575      for (int i = 0; i < array.size(); i++) {
14576        res.getLink().add(parseGraphDefinitionLinkComponent(array.get(i).getAsJsonObject()));
14577      }
14578    };
14579  }
14580
14581  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionLinkTargetCompartmentComponent(JsonObject json) throws IOException, FHIRFormatError {
14582    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
14583    parseGraphDefinitionLinkTargetCompartmentComponentProperties(json, res);
14584    return res;
14585  }
14586
14587  protected void parseGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
14588    parseBackboneElementProperties(json, res);
14589    if (json.has("use"))
14590      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
14591    if (json.has("_use"))
14592      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
14593    if (json.has("code"))
14594      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
14595    if (json.has("_code"))
14596      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
14597    if (json.has("rule"))
14598      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
14599    if (json.has("_rule"))
14600      parseElementProperties(getJObject(json, "_rule"), res.getRuleElement());
14601    if (json.has("expression"))
14602      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14603    if (json.has("_expression"))
14604      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
14605    if (json.has("description"))
14606      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14607    if (json.has("_description"))
14608      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14609  }
14610
14611  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
14612    Group res = new Group();
14613    parseGroupProperties(json, res);
14614    return res;
14615  }
14616
14617  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
14618    parseDomainResourceProperties(json, res);
14619    if (json.has("identifier")) {
14620      JsonArray array = getJArray(json, "identifier");
14621      for (int i = 0; i < array.size(); i++) {
14622        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14623      }
14624    };
14625    if (json.has("active"))
14626      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14627    if (json.has("_active"))
14628      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
14629    if (json.has("type"))
14630      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
14631    if (json.has("_type"))
14632      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14633    if (json.has("actual"))
14634      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
14635    if (json.has("_actual"))
14636      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
14637    if (json.has("code"))
14638      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14639    if (json.has("name"))
14640      res.setNameElement(parseString(json.get("name").getAsString()));
14641    if (json.has("_name"))
14642      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14643    if (json.has("quantity"))
14644      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
14645    if (json.has("_quantity"))
14646      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
14647    if (json.has("managingEntity"))
14648      res.setManagingEntity(parseReference(getJObject(json, "managingEntity")));
14649    if (json.has("characteristic")) {
14650      JsonArray array = getJArray(json, "characteristic");
14651      for (int i = 0; i < array.size(); i++) {
14652        res.getCharacteristic().add(parseGroupCharacteristicComponent(array.get(i).getAsJsonObject()));
14653      }
14654    };
14655    if (json.has("member")) {
14656      JsonArray array = getJArray(json, "member");
14657      for (int i = 0; i < array.size(); i++) {
14658        res.getMember().add(parseGroupMemberComponent(array.get(i).getAsJsonObject()));
14659      }
14660    };
14661  }
14662
14663  protected Group.GroupCharacteristicComponent parseGroupCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
14664    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
14665    parseGroupCharacteristicComponentProperties(json, res);
14666    return res;
14667  }
14668
14669  protected void parseGroupCharacteristicComponentProperties(JsonObject json, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
14670    parseBackboneElementProperties(json, res);
14671    if (json.has("code"))
14672      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14673    DataType value = parseType("value", json);
14674    if (value != null)
14675      res.setValue(value);
14676    if (json.has("exclude"))
14677      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
14678    if (json.has("_exclude"))
14679      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
14680    if (json.has("period"))
14681      res.setPeriod(parsePeriod(getJObject(json, "period")));
14682  }
14683
14684  protected Group.GroupMemberComponent parseGroupMemberComponent(JsonObject json) throws IOException, FHIRFormatError {
14685    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
14686    parseGroupMemberComponentProperties(json, res);
14687    return res;
14688  }
14689
14690  protected void parseGroupMemberComponentProperties(JsonObject json, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
14691    parseBackboneElementProperties(json, res);
14692    if (json.has("entity"))
14693      res.setEntity(parseReference(getJObject(json, "entity")));
14694    if (json.has("period"))
14695      res.setPeriod(parsePeriod(getJObject(json, "period")));
14696    if (json.has("inactive"))
14697      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
14698    if (json.has("_inactive"))
14699      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
14700  }
14701
14702  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
14703    GuidanceResponse res = new GuidanceResponse();
14704    parseGuidanceResponseProperties(json, res);
14705    return res;
14706  }
14707
14708  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
14709    parseDomainResourceProperties(json, res);
14710    if (json.has("requestIdentifier"))
14711      res.setRequestIdentifier(parseIdentifier(getJObject(json, "requestIdentifier")));
14712    if (json.has("identifier")) {
14713      JsonArray array = getJArray(json, "identifier");
14714      for (int i = 0; i < array.size(); i++) {
14715        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14716      }
14717    };
14718    DataType module = parseType("module", json);
14719    if (module != null)
14720      res.setModule(module);
14721    if (json.has("status"))
14722      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
14723    if (json.has("_status"))
14724      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14725    if (json.has("subject"))
14726      res.setSubject(parseReference(getJObject(json, "subject")));
14727    if (json.has("encounter"))
14728      res.setEncounter(parseReference(getJObject(json, "encounter")));
14729    if (json.has("occurrenceDateTime"))
14730      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
14731    if (json.has("_occurrenceDateTime"))
14732      parseElementProperties(getJObject(json, "_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
14733    if (json.has("performer"))
14734      res.setPerformer(parseReference(getJObject(json, "performer")));
14735    if (json.has("reasonCode")) {
14736      JsonArray array = getJArray(json, "reasonCode");
14737      for (int i = 0; i < array.size(); i++) {
14738        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14739      }
14740    };
14741    if (json.has("reasonReference")) {
14742      JsonArray array = getJArray(json, "reasonReference");
14743      for (int i = 0; i < array.size(); i++) {
14744        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14745      }
14746    };
14747    if (json.has("note")) {
14748      JsonArray array = getJArray(json, "note");
14749      for (int i = 0; i < array.size(); i++) {
14750        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14751      }
14752    };
14753    if (json.has("evaluationMessage")) {
14754      JsonArray array = getJArray(json, "evaluationMessage");
14755      for (int i = 0; i < array.size(); i++) {
14756        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
14757      }
14758    };
14759    if (json.has("outputParameters"))
14760      res.setOutputParameters(parseReference(getJObject(json, "outputParameters")));
14761    if (json.has("result"))
14762      res.setResult(parseReference(getJObject(json, "result")));
14763    if (json.has("dataRequirement")) {
14764      JsonArray array = getJArray(json, "dataRequirement");
14765      for (int i = 0; i < array.size(); i++) {
14766        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14767      }
14768    };
14769  }
14770
14771  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
14772    HealthcareService res = new HealthcareService();
14773    parseHealthcareServiceProperties(json, res);
14774    return res;
14775  }
14776
14777  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
14778    parseDomainResourceProperties(json, res);
14779    if (json.has("identifier")) {
14780      JsonArray array = getJArray(json, "identifier");
14781      for (int i = 0; i < array.size(); i++) {
14782        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14783      }
14784    };
14785    if (json.has("active"))
14786      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14787    if (json.has("_active"))
14788      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
14789    if (json.has("providedBy"))
14790      res.setProvidedBy(parseReference(getJObject(json, "providedBy")));
14791    if (json.has("category")) {
14792      JsonArray array = getJArray(json, "category");
14793      for (int i = 0; i < array.size(); i++) {
14794        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14795      }
14796    };
14797    if (json.has("type")) {
14798      JsonArray array = getJArray(json, "type");
14799      for (int i = 0; i < array.size(); i++) {
14800        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14801      }
14802    };
14803    if (json.has("specialty")) {
14804      JsonArray array = getJArray(json, "specialty");
14805      for (int i = 0; i < array.size(); i++) {
14806        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14807      }
14808    };
14809    if (json.has("location")) {
14810      JsonArray array = getJArray(json, "location");
14811      for (int i = 0; i < array.size(); i++) {
14812        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
14813      }
14814    };
14815    if (json.has("name"))
14816      res.setNameElement(parseString(json.get("name").getAsString()));
14817    if (json.has("_name"))
14818      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14819    if (json.has("comment"))
14820      res.setCommentElement(parseString(json.get("comment").getAsString()));
14821    if (json.has("_comment"))
14822      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
14823    if (json.has("extraDetails"))
14824      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
14825    if (json.has("_extraDetails"))
14826      parseElementProperties(getJObject(json, "_extraDetails"), res.getExtraDetailsElement());
14827    if (json.has("photo"))
14828      res.setPhoto(parseAttachment(getJObject(json, "photo")));
14829    if (json.has("telecom")) {
14830      JsonArray array = getJArray(json, "telecom");
14831      for (int i = 0; i < array.size(); i++) {
14832        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14833      }
14834    };
14835    if (json.has("coverageArea")) {
14836      JsonArray array = getJArray(json, "coverageArea");
14837      for (int i = 0; i < array.size(); i++) {
14838        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14839      }
14840    };
14841    if (json.has("serviceProvisionCode")) {
14842      JsonArray array = getJArray(json, "serviceProvisionCode");
14843      for (int i = 0; i < array.size(); i++) {
14844        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14845      }
14846    };
14847    if (json.has("eligibility")) {
14848      JsonArray array = getJArray(json, "eligibility");
14849      for (int i = 0; i < array.size(); i++) {
14850        res.getEligibility().add(parseHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject()));
14851      }
14852    };
14853    if (json.has("program")) {
14854      JsonArray array = getJArray(json, "program");
14855      for (int i = 0; i < array.size(); i++) {
14856        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14857      }
14858    };
14859    if (json.has("characteristic")) {
14860      JsonArray array = getJArray(json, "characteristic");
14861      for (int i = 0; i < array.size(); i++) {
14862        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14863      }
14864    };
14865    if (json.has("communication")) {
14866      JsonArray array = getJArray(json, "communication");
14867      for (int i = 0; i < array.size(); i++) {
14868        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14869      }
14870    };
14871    if (json.has("referralMethod")) {
14872      JsonArray array = getJArray(json, "referralMethod");
14873      for (int i = 0; i < array.size(); i++) {
14874        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14875      }
14876    };
14877    if (json.has("appointmentRequired"))
14878      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
14879    if (json.has("_appointmentRequired"))
14880      parseElementProperties(getJObject(json, "_appointmentRequired"), res.getAppointmentRequiredElement());
14881    if (json.has("availableTime")) {
14882      JsonArray array = getJArray(json, "availableTime");
14883      for (int i = 0; i < array.size(); i++) {
14884        res.getAvailableTime().add(parseHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject()));
14885      }
14886    };
14887    if (json.has("notAvailable")) {
14888      JsonArray array = getJArray(json, "notAvailable");
14889      for (int i = 0; i < array.size(); i++) {
14890        res.getNotAvailable().add(parseHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject()));
14891      }
14892    };
14893    if (json.has("availabilityExceptions"))
14894      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
14895    if (json.has("_availabilityExceptions"))
14896      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
14897    if (json.has("endpoint")) {
14898      JsonArray array = getJArray(json, "endpoint");
14899      for (int i = 0; i < array.size(); i++) {
14900        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14901      }
14902    };
14903  }
14904
14905  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceEligibilityComponent(JsonObject json) throws IOException, FHIRFormatError {
14906    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
14907    parseHealthcareServiceEligibilityComponentProperties(json, res);
14908    return res;
14909  }
14910
14911  protected void parseHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
14912    parseBackboneElementProperties(json, res);
14913    if (json.has("code"))
14914      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14915    if (json.has("comment"))
14916      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
14917    if (json.has("_comment"))
14918      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
14919  }
14920
14921  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
14922    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
14923    parseHealthcareServiceAvailableTimeComponentProperties(json, res);
14924    return res;
14925  }
14926
14927  protected void parseHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
14928    parseBackboneElementProperties(json, res);
14929    if (json.has("daysOfWeek")) {
14930      JsonArray array = getJArray(json, "daysOfWeek");
14931      for (int i = 0; i < array.size(); i++) {
14932        if (array.get(i).isJsonNull()) {
14933          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
14934        } else {;
14935          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
14936        }
14937      }
14938    };
14939    if (json.has("_daysOfWeek")) {
14940      JsonArray array = getJArray(json, "_daysOfWeek");
14941      for (int i = 0; i < array.size(); i++) {
14942        if (i == res.getDaysOfWeek().size())
14943          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
14944        if (array.get(i) instanceof JsonObject) 
14945          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
14946      }
14947    };
14948    if (json.has("allDay"))
14949      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
14950    if (json.has("_allDay"))
14951      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
14952    if (json.has("availableStartTime"))
14953      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
14954    if (json.has("_availableStartTime"))
14955      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
14956    if (json.has("availableEndTime"))
14957      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
14958    if (json.has("_availableEndTime"))
14959      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
14960  }
14961
14962  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceNotAvailableComponent(JsonObject json) throws IOException, FHIRFormatError {
14963    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
14964    parseHealthcareServiceNotAvailableComponentProperties(json, res);
14965    return res;
14966  }
14967
14968  protected void parseHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
14969    parseBackboneElementProperties(json, res);
14970    if (json.has("description"))
14971      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14972    if (json.has("_description"))
14973      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14974    if (json.has("during"))
14975      res.setDuring(parsePeriod(getJObject(json, "during")));
14976  }
14977
14978  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
14979    ImagingStudy res = new ImagingStudy();
14980    parseImagingStudyProperties(json, res);
14981    return res;
14982  }
14983
14984  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
14985    parseDomainResourceProperties(json, res);
14986    if (json.has("identifier")) {
14987      JsonArray array = getJArray(json, "identifier");
14988      for (int i = 0; i < array.size(); i++) {
14989        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14990      }
14991    };
14992    if (json.has("status"))
14993      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
14994    if (json.has("_status"))
14995      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14996    if (json.has("modality")) {
14997      JsonArray array = getJArray(json, "modality");
14998      for (int i = 0; i < array.size(); i++) {
14999        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
15000      }
15001    };
15002    if (json.has("subject"))
15003      res.setSubject(parseReference(getJObject(json, "subject")));
15004    if (json.has("encounter"))
15005      res.setEncounter(parseReference(getJObject(json, "encounter")));
15006    if (json.has("started"))
15007      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
15008    if (json.has("_started"))
15009      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
15010    if (json.has("basedOn")) {
15011      JsonArray array = getJArray(json, "basedOn");
15012      for (int i = 0; i < array.size(); i++) {
15013        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15014      }
15015    };
15016    if (json.has("referrer"))
15017      res.setReferrer(parseReference(getJObject(json, "referrer")));
15018    if (json.has("interpreter")) {
15019      JsonArray array = getJArray(json, "interpreter");
15020      for (int i = 0; i < array.size(); i++) {
15021        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
15022      }
15023    };
15024    if (json.has("endpoint")) {
15025      JsonArray array = getJArray(json, "endpoint");
15026      for (int i = 0; i < array.size(); i++) {
15027        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15028      }
15029    };
15030    if (json.has("numberOfSeries"))
15031      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
15032    if (json.has("_numberOfSeries"))
15033      parseElementProperties(getJObject(json, "_numberOfSeries"), res.getNumberOfSeriesElement());
15034    if (json.has("numberOfInstances"))
15035      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
15036    if (json.has("_numberOfInstances"))
15037      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
15038    if (json.has("procedureReference"))
15039      res.setProcedureReference(parseReference(getJObject(json, "procedureReference")));
15040    if (json.has("procedureCode")) {
15041      JsonArray array = getJArray(json, "procedureCode");
15042      for (int i = 0; i < array.size(); i++) {
15043        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15044      }
15045    };
15046    if (json.has("location"))
15047      res.setLocation(parseReference(getJObject(json, "location")));
15048    if (json.has("reasonCode")) {
15049      JsonArray array = getJArray(json, "reasonCode");
15050      for (int i = 0; i < array.size(); i++) {
15051        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15052      }
15053    };
15054    if (json.has("reasonReference")) {
15055      JsonArray array = getJArray(json, "reasonReference");
15056      for (int i = 0; i < array.size(); i++) {
15057        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15058      }
15059    };
15060    if (json.has("note")) {
15061      JsonArray array = getJArray(json, "note");
15062      for (int i = 0; i < array.size(); i++) {
15063        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15064      }
15065    };
15066    if (json.has("description"))
15067      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15068    if (json.has("_description"))
15069      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15070    if (json.has("series")) {
15071      JsonArray array = getJArray(json, "series");
15072      for (int i = 0; i < array.size(); i++) {
15073        res.getSeries().add(parseImagingStudySeriesComponent(array.get(i).getAsJsonObject()));
15074      }
15075    };
15076  }
15077
15078  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudySeriesComponent(JsonObject json) throws IOException, FHIRFormatError {
15079    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
15080    parseImagingStudySeriesComponentProperties(json, res);
15081    return res;
15082  }
15083
15084  protected void parseImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
15085    parseBackboneElementProperties(json, res);
15086    if (json.has("uid"))
15087      res.setUidElement(parseId(json.get("uid").getAsString()));
15088    if (json.has("_uid"))
15089      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
15090    if (json.has("number"))
15091      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
15092    if (json.has("_number"))
15093      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
15094    if (json.has("modality"))
15095      res.setModality(parseCoding(getJObject(json, "modality")));
15096    if (json.has("description"))
15097      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15098    if (json.has("_description"))
15099      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15100    if (json.has("numberOfInstances"))
15101      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
15102    if (json.has("_numberOfInstances"))
15103      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
15104    if (json.has("endpoint")) {
15105      JsonArray array = getJArray(json, "endpoint");
15106      for (int i = 0; i < array.size(); i++) {
15107        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15108      }
15109    };
15110    if (json.has("bodySite"))
15111      res.setBodySite(parseCoding(getJObject(json, "bodySite")));
15112    if (json.has("laterality"))
15113      res.setLaterality(parseCoding(getJObject(json, "laterality")));
15114    if (json.has("specimen")) {
15115      JsonArray array = getJArray(json, "specimen");
15116      for (int i = 0; i < array.size(); i++) {
15117        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
15118      }
15119    };
15120    if (json.has("started"))
15121      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
15122    if (json.has("_started"))
15123      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
15124    if (json.has("performer")) {
15125      JsonArray array = getJArray(json, "performer");
15126      for (int i = 0; i < array.size(); i++) {
15127        res.getPerformer().add(parseImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject()));
15128      }
15129    };
15130    if (json.has("instance")) {
15131      JsonArray array = getJArray(json, "instance");
15132      for (int i = 0; i < array.size(); i++) {
15133        res.getInstance().add(parseImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject()));
15134      }
15135    };
15136  }
15137
15138  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudySeriesPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
15139    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
15140    parseImagingStudySeriesPerformerComponentProperties(json, res);
15141    return res;
15142  }
15143
15144  protected void parseImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
15145    parseBackboneElementProperties(json, res);
15146    if (json.has("function"))
15147      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
15148    if (json.has("actor"))
15149      res.setActor(parseReference(getJObject(json, "actor")));
15150  }
15151
15152  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudySeriesInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
15153    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
15154    parseImagingStudySeriesInstanceComponentProperties(json, res);
15155    return res;
15156  }
15157
15158  protected void parseImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
15159    parseBackboneElementProperties(json, res);
15160    if (json.has("uid"))
15161      res.setUidElement(parseId(json.get("uid").getAsString()));
15162    if (json.has("_uid"))
15163      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
15164    if (json.has("sopClass"))
15165      res.setSopClass(parseCoding(getJObject(json, "sopClass")));
15166    if (json.has("number"))
15167      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
15168    if (json.has("_number"))
15169      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
15170    if (json.has("title"))
15171      res.setTitleElement(parseString(json.get("title").getAsString()));
15172    if (json.has("_title"))
15173      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15174  }
15175
15176  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
15177    Immunization res = new Immunization();
15178    parseImmunizationProperties(json, res);
15179    return res;
15180  }
15181
15182  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
15183    parseDomainResourceProperties(json, res);
15184    if (json.has("identifier")) {
15185      JsonArray array = getJArray(json, "identifier");
15186      for (int i = 0; i < array.size(); i++) {
15187        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15188      }
15189    };
15190    if (json.has("status"))
15191      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatusCodes.NULL, new Immunization.ImmunizationStatusCodesEnumFactory()));
15192    if (json.has("_status"))
15193      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15194    if (json.has("statusReason"))
15195      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
15196    if (json.has("vaccineCode"))
15197      res.setVaccineCode(parseCodeableConcept(getJObject(json, "vaccineCode")));
15198    if (json.has("patient"))
15199      res.setPatient(parseReference(getJObject(json, "patient")));
15200    if (json.has("encounter"))
15201      res.setEncounter(parseReference(getJObject(json, "encounter")));
15202    DataType occurrence = parseType("occurrence", json);
15203    if (occurrence != null)
15204      res.setOccurrence(occurrence);
15205    if (json.has("recorded"))
15206      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
15207    if (json.has("_recorded"))
15208      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
15209    if (json.has("primarySource"))
15210      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
15211    if (json.has("_primarySource"))
15212      parseElementProperties(getJObject(json, "_primarySource"), res.getPrimarySourceElement());
15213    if (json.has("reportOrigin"))
15214      res.setReportOrigin(parseCodeableConcept(getJObject(json, "reportOrigin")));
15215    if (json.has("location"))
15216      res.setLocation(parseReference(getJObject(json, "location")));
15217    if (json.has("manufacturer"))
15218      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
15219    if (json.has("lotNumber"))
15220      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
15221    if (json.has("_lotNumber"))
15222      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
15223    if (json.has("expirationDate"))
15224      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
15225    if (json.has("_expirationDate"))
15226      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
15227    if (json.has("site"))
15228      res.setSite(parseCodeableConcept(getJObject(json, "site")));
15229    if (json.has("route"))
15230      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
15231    if (json.has("doseQuantity"))
15232      res.setDoseQuantity(parseQuantity(getJObject(json, "doseQuantity")));
15233    if (json.has("performer")) {
15234      JsonArray array = getJArray(json, "performer");
15235      for (int i = 0; i < array.size(); i++) {
15236        res.getPerformer().add(parseImmunizationPerformerComponent(array.get(i).getAsJsonObject()));
15237      }
15238    };
15239    if (json.has("note")) {
15240      JsonArray array = getJArray(json, "note");
15241      for (int i = 0; i < array.size(); i++) {
15242        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15243      }
15244    };
15245    if (json.has("reasonCode")) {
15246      JsonArray array = getJArray(json, "reasonCode");
15247      for (int i = 0; i < array.size(); i++) {
15248        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15249      }
15250    };
15251    if (json.has("reasonReference")) {
15252      JsonArray array = getJArray(json, "reasonReference");
15253      for (int i = 0; i < array.size(); i++) {
15254        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15255      }
15256    };
15257    if (json.has("isSubpotent"))
15258      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
15259    if (json.has("_isSubpotent"))
15260      parseElementProperties(getJObject(json, "_isSubpotent"), res.getIsSubpotentElement());
15261    if (json.has("subpotentReason")) {
15262      JsonArray array = getJArray(json, "subpotentReason");
15263      for (int i = 0; i < array.size(); i++) {
15264        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15265      }
15266    };
15267    if (json.has("education")) {
15268      JsonArray array = getJArray(json, "education");
15269      for (int i = 0; i < array.size(); i++) {
15270        res.getEducation().add(parseImmunizationEducationComponent(array.get(i).getAsJsonObject()));
15271      }
15272    };
15273    if (json.has("programEligibility")) {
15274      JsonArray array = getJArray(json, "programEligibility");
15275      for (int i = 0; i < array.size(); i++) {
15276        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15277      }
15278    };
15279    if (json.has("fundingSource"))
15280      res.setFundingSource(parseCodeableConcept(getJObject(json, "fundingSource")));
15281    if (json.has("reaction")) {
15282      JsonArray array = getJArray(json, "reaction");
15283      for (int i = 0; i < array.size(); i++) {
15284        res.getReaction().add(parseImmunizationReactionComponent(array.get(i).getAsJsonObject()));
15285      }
15286    };
15287    if (json.has("protocolApplied")) {
15288      JsonArray array = getJArray(json, "protocolApplied");
15289      for (int i = 0; i < array.size(); i++) {
15290        res.getProtocolApplied().add(parseImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject()));
15291      }
15292    };
15293  }
15294
15295  protected Immunization.ImmunizationPerformerComponent parseImmunizationPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
15296    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
15297    parseImmunizationPerformerComponentProperties(json, res);
15298    return res;
15299  }
15300
15301  protected void parseImmunizationPerformerComponentProperties(JsonObject json, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
15302    parseBackboneElementProperties(json, res);
15303    if (json.has("function"))
15304      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
15305    if (json.has("actor"))
15306      res.setActor(parseReference(getJObject(json, "actor")));
15307  }
15308
15309  protected Immunization.ImmunizationEducationComponent parseImmunizationEducationComponent(JsonObject json) throws IOException, FHIRFormatError {
15310    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
15311    parseImmunizationEducationComponentProperties(json, res);
15312    return res;
15313  }
15314
15315  protected void parseImmunizationEducationComponentProperties(JsonObject json, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
15316    parseBackboneElementProperties(json, res);
15317    if (json.has("documentType"))
15318      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
15319    if (json.has("_documentType"))
15320      parseElementProperties(getJObject(json, "_documentType"), res.getDocumentTypeElement());
15321    if (json.has("reference"))
15322      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
15323    if (json.has("_reference"))
15324      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
15325    if (json.has("publicationDate"))
15326      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
15327    if (json.has("_publicationDate"))
15328      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
15329    if (json.has("presentationDate"))
15330      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
15331    if (json.has("_presentationDate"))
15332      parseElementProperties(getJObject(json, "_presentationDate"), res.getPresentationDateElement());
15333  }
15334
15335  protected Immunization.ImmunizationReactionComponent parseImmunizationReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
15336    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
15337    parseImmunizationReactionComponentProperties(json, res);
15338    return res;
15339  }
15340
15341  protected void parseImmunizationReactionComponentProperties(JsonObject json, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
15342    parseBackboneElementProperties(json, res);
15343    if (json.has("date"))
15344      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15345    if (json.has("_date"))
15346      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15347    if (json.has("detail"))
15348      res.setDetail(parseReference(getJObject(json, "detail")));
15349    if (json.has("reported"))
15350      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
15351    if (json.has("_reported"))
15352      parseElementProperties(getJObject(json, "_reported"), res.getReportedElement());
15353  }
15354
15355  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationProtocolAppliedComponent(JsonObject json) throws IOException, FHIRFormatError {
15356    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
15357    parseImmunizationProtocolAppliedComponentProperties(json, res);
15358    return res;
15359  }
15360
15361  protected void parseImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
15362    parseBackboneElementProperties(json, res);
15363    if (json.has("series"))
15364      res.setSeriesElement(parseString(json.get("series").getAsString()));
15365    if (json.has("_series"))
15366      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
15367    if (json.has("authority"))
15368      res.setAuthority(parseReference(getJObject(json, "authority")));
15369    if (json.has("targetDisease")) {
15370      JsonArray array = getJArray(json, "targetDisease");
15371      for (int i = 0; i < array.size(); i++) {
15372        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15373      }
15374    };
15375    DataType doseNumber = parseType("doseNumber", json);
15376    if (doseNumber != null)
15377      res.setDoseNumber(doseNumber);
15378    DataType seriesDoses = parseType("seriesDoses", json);
15379    if (seriesDoses != null)
15380      res.setSeriesDoses(seriesDoses);
15381  }
15382
15383  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
15384    ImmunizationEvaluation res = new ImmunizationEvaluation();
15385    parseImmunizationEvaluationProperties(json, res);
15386    return res;
15387  }
15388
15389  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
15390    parseDomainResourceProperties(json, res);
15391    if (json.has("identifier")) {
15392      JsonArray array = getJArray(json, "identifier");
15393      for (int i = 0; i < array.size(); i++) {
15394        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15395      }
15396    };
15397    if (json.has("status"))
15398      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory()));
15399    if (json.has("_status"))
15400      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15401    if (json.has("patient"))
15402      res.setPatient(parseReference(getJObject(json, "patient")));
15403    if (json.has("date"))
15404      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15405    if (json.has("_date"))
15406      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15407    if (json.has("authority"))
15408      res.setAuthority(parseReference(getJObject(json, "authority")));
15409    if (json.has("targetDisease"))
15410      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
15411    if (json.has("immunizationEvent"))
15412      res.setImmunizationEvent(parseReference(getJObject(json, "immunizationEvent")));
15413    if (json.has("doseStatus"))
15414      res.setDoseStatus(parseCodeableConcept(getJObject(json, "doseStatus")));
15415    if (json.has("doseStatusReason")) {
15416      JsonArray array = getJArray(json, "doseStatusReason");
15417      for (int i = 0; i < array.size(); i++) {
15418        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15419      }
15420    };
15421    if (json.has("description"))
15422      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15423    if (json.has("_description"))
15424      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15425    if (json.has("series"))
15426      res.setSeriesElement(parseString(json.get("series").getAsString()));
15427    if (json.has("_series"))
15428      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
15429    DataType doseNumber = parseType("doseNumber", json);
15430    if (doseNumber != null)
15431      res.setDoseNumber(doseNumber);
15432    DataType seriesDoses = parseType("seriesDoses", json);
15433    if (seriesDoses != null)
15434      res.setSeriesDoses(seriesDoses);
15435  }
15436
15437  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
15438    ImmunizationRecommendation res = new ImmunizationRecommendation();
15439    parseImmunizationRecommendationProperties(json, res);
15440    return res;
15441  }
15442
15443  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
15444    parseDomainResourceProperties(json, res);
15445    if (json.has("identifier")) {
15446      JsonArray array = getJArray(json, "identifier");
15447      for (int i = 0; i < array.size(); i++) {
15448        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15449      }
15450    };
15451    if (json.has("patient"))
15452      res.setPatient(parseReference(getJObject(json, "patient")));
15453    if (json.has("date"))
15454      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15455    if (json.has("_date"))
15456      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15457    if (json.has("authority"))
15458      res.setAuthority(parseReference(getJObject(json, "authority")));
15459    if (json.has("recommendation")) {
15460      JsonArray array = getJArray(json, "recommendation");
15461      for (int i = 0; i < array.size(); i++) {
15462        res.getRecommendation().add(parseImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject()));
15463      }
15464    };
15465  }
15466
15467  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationRecommendationComponent(JsonObject json) throws IOException, FHIRFormatError {
15468    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
15469    parseImmunizationRecommendationRecommendationComponentProperties(json, res);
15470    return res;
15471  }
15472
15473  protected void parseImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
15474    parseBackboneElementProperties(json, res);
15475    if (json.has("vaccineCode")) {
15476      JsonArray array = getJArray(json, "vaccineCode");
15477      for (int i = 0; i < array.size(); i++) {
15478        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15479      }
15480    };
15481    if (json.has("targetDisease"))
15482      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
15483    if (json.has("contraindicatedVaccineCode")) {
15484      JsonArray array = getJArray(json, "contraindicatedVaccineCode");
15485      for (int i = 0; i < array.size(); i++) {
15486        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15487      }
15488    };
15489    if (json.has("forecastStatus"))
15490      res.setForecastStatus(parseCodeableConcept(getJObject(json, "forecastStatus")));
15491    if (json.has("forecastReason")) {
15492      JsonArray array = getJArray(json, "forecastReason");
15493      for (int i = 0; i < array.size(); i++) {
15494        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15495      }
15496    };
15497    if (json.has("dateCriterion")) {
15498      JsonArray array = getJArray(json, "dateCriterion");
15499      for (int i = 0; i < array.size(); i++) {
15500        res.getDateCriterion().add(parseImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject()));
15501      }
15502    };
15503    if (json.has("description"))
15504      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15505    if (json.has("_description"))
15506      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15507    if (json.has("series"))
15508      res.setSeriesElement(parseString(json.get("series").getAsString()));
15509    if (json.has("_series"))
15510      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
15511    DataType doseNumber = parseType("doseNumber", json);
15512    if (doseNumber != null)
15513      res.setDoseNumber(doseNumber);
15514    DataType seriesDoses = parseType("seriesDoses", json);
15515    if (seriesDoses != null)
15516      res.setSeriesDoses(seriesDoses);
15517    if (json.has("supportingImmunization")) {
15518      JsonArray array = getJArray(json, "supportingImmunization");
15519      for (int i = 0; i < array.size(); i++) {
15520        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
15521      }
15522    };
15523    if (json.has("supportingPatientInformation")) {
15524      JsonArray array = getJArray(json, "supportingPatientInformation");
15525      for (int i = 0; i < array.size(); i++) {
15526        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
15527      }
15528    };
15529  }
15530
15531  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json) throws IOException, FHIRFormatError {
15532    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
15533    parseImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, res);
15534    return res;
15535  }
15536
15537  protected void parseImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
15538    parseBackboneElementProperties(json, res);
15539    if (json.has("code"))
15540      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15541    if (json.has("value"))
15542      res.setValueElement(parseDateTime(json.get("value").getAsString()));
15543    if (json.has("_value"))
15544      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
15545  }
15546
15547  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
15548    ImplementationGuide res = new ImplementationGuide();
15549    parseImplementationGuideProperties(json, res);
15550    return res;
15551  }
15552
15553  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
15554    parseDomainResourceProperties(json, res);
15555    if (json.has("url"))
15556      res.setUrlElement(parseUri(json.get("url").getAsString()));
15557    if (json.has("_url"))
15558      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
15559    if (json.has("version"))
15560      res.setVersionElement(parseString(json.get("version").getAsString()));
15561    if (json.has("_version"))
15562      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
15563    if (json.has("name"))
15564      res.setNameElement(parseString(json.get("name").getAsString()));
15565    if (json.has("_name"))
15566      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15567    if (json.has("title"))
15568      res.setTitleElement(parseString(json.get("title").getAsString()));
15569    if (json.has("_title"))
15570      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15571    if (json.has("status"))
15572      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15573    if (json.has("_status"))
15574      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15575    if (json.has("experimental"))
15576      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15577    if (json.has("_experimental"))
15578      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
15579    if (json.has("date"))
15580      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15581    if (json.has("_date"))
15582      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15583    if (json.has("publisher"))
15584      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15585    if (json.has("_publisher"))
15586      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
15587    if (json.has("contact")) {
15588      JsonArray array = getJArray(json, "contact");
15589      for (int i = 0; i < array.size(); i++) {
15590        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15591      }
15592    };
15593    if (json.has("description"))
15594      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15595    if (json.has("_description"))
15596      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15597    if (json.has("useContext")) {
15598      JsonArray array = getJArray(json, "useContext");
15599      for (int i = 0; i < array.size(); i++) {
15600        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15601      }
15602    };
15603    if (json.has("jurisdiction")) {
15604      JsonArray array = getJArray(json, "jurisdiction");
15605      for (int i = 0; i < array.size(); i++) {
15606        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15607      }
15608    };
15609    if (json.has("copyright"))
15610      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15611    if (json.has("_copyright"))
15612      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
15613    if (json.has("packageId"))
15614      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
15615    if (json.has("_packageId"))
15616      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
15617    if (json.has("license"))
15618      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
15619    if (json.has("_license"))
15620      parseElementProperties(getJObject(json, "_license"), res.getLicenseElement());
15621    if (json.has("fhirVersion")) {
15622      JsonArray array = getJArray(json, "fhirVersion");
15623      for (int i = 0; i < array.size(); i++) {
15624        if (array.get(i).isJsonNull()) {
15625          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>(new Enumerations.FHIRVersionEnumFactory(), Enumerations.FHIRVersion.NULL));
15626        } else {;
15627          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15628        }
15629      }
15630    };
15631    if (json.has("_fhirVersion")) {
15632      JsonArray array = getJArray(json, "_fhirVersion");
15633      for (int i = 0; i < array.size(); i++) {
15634        if (i == res.getFhirVersion().size())
15635          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15636        if (array.get(i) instanceof JsonObject) 
15637          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
15638      }
15639    };
15640    if (json.has("dependsOn")) {
15641      JsonArray array = getJArray(json, "dependsOn");
15642      for (int i = 0; i < array.size(); i++) {
15643        res.getDependsOn().add(parseImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject()));
15644      }
15645    };
15646    if (json.has("global")) {
15647      JsonArray array = getJArray(json, "global");
15648      for (int i = 0; i < array.size(); i++) {
15649        res.getGlobal().add(parseImplementationGuideGlobalComponent(array.get(i).getAsJsonObject()));
15650      }
15651    };
15652    if (json.has("definition"))
15653      res.setDefinition(parseImplementationGuideDefinitionComponent(getJObject(json, "definition")));
15654    if (json.has("manifest"))
15655      res.setManifest(parseImplementationGuideManifestComponent(getJObject(json, "manifest")));
15656  }
15657
15658  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideDependsOnComponent(JsonObject json) throws IOException, FHIRFormatError {
15659    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
15660    parseImplementationGuideDependsOnComponentProperties(json, res);
15661    return res;
15662  }
15663
15664  protected void parseImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
15665    parseBackboneElementProperties(json, res);
15666    if (json.has("uri"))
15667      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
15668    if (json.has("_uri"))
15669      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
15670    if (json.has("packageId"))
15671      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
15672    if (json.has("_packageId"))
15673      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
15674    if (json.has("version"))
15675      res.setVersionElement(parseString(json.get("version").getAsString()));
15676    if (json.has("_version"))
15677      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
15678  }
15679
15680  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideGlobalComponent(JsonObject json) throws IOException, FHIRFormatError {
15681    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
15682    parseImplementationGuideGlobalComponentProperties(json, res);
15683    return res;
15684  }
15685
15686  protected void parseImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
15687    parseBackboneElementProperties(json, res);
15688    if (json.has("type"))
15689      res.setTypeElement(parseCode(json.get("type").getAsString()));
15690    if (json.has("_type"))
15691      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15692    if (json.has("profile"))
15693      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
15694    if (json.has("_profile"))
15695      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
15696  }
15697
15698  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
15699    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
15700    parseImplementationGuideDefinitionComponentProperties(json, res);
15701    return res;
15702  }
15703
15704  protected void parseImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
15705    parseBackboneElementProperties(json, res);
15706    if (json.has("grouping")) {
15707      JsonArray array = getJArray(json, "grouping");
15708      for (int i = 0; i < array.size(); i++) {
15709        res.getGrouping().add(parseImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject()));
15710      }
15711    };
15712    if (json.has("resource")) {
15713      JsonArray array = getJArray(json, "resource");
15714      for (int i = 0; i < array.size(); i++) {
15715        res.getResource().add(parseImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject()));
15716      }
15717    };
15718    if (json.has("page"))
15719      res.setPage(parseImplementationGuideDefinitionPageComponent(getJObject(json, "page")));
15720    if (json.has("parameter")) {
15721      JsonArray array = getJArray(json, "parameter");
15722      for (int i = 0; i < array.size(); i++) {
15723        res.getParameter().add(parseImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject()));
15724      }
15725    };
15726    if (json.has("template")) {
15727      JsonArray array = getJArray(json, "template");
15728      for (int i = 0; i < array.size(); i++) {
15729        res.getTemplate().add(parseImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject()));
15730      }
15731    };
15732  }
15733
15734  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideDefinitionGroupingComponent(JsonObject json) throws IOException, FHIRFormatError {
15735    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
15736    parseImplementationGuideDefinitionGroupingComponentProperties(json, res);
15737    return res;
15738  }
15739
15740  protected void parseImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
15741    parseBackboneElementProperties(json, res);
15742    if (json.has("name"))
15743      res.setNameElement(parseString(json.get("name").getAsString()));
15744    if (json.has("_name"))
15745      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15746    if (json.has("description"))
15747      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15748    if (json.has("_description"))
15749      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15750  }
15751
15752  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
15753    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
15754    parseImplementationGuideDefinitionResourceComponentProperties(json, res);
15755    return res;
15756  }
15757
15758  protected void parseImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
15759    parseBackboneElementProperties(json, res);
15760    if (json.has("reference"))
15761      res.setReference(parseReference(getJObject(json, "reference")));
15762    if (json.has("fhirVersion")) {
15763      JsonArray array = getJArray(json, "fhirVersion");
15764      for (int i = 0; i < array.size(); i++) {
15765        if (array.get(i).isJsonNull()) {
15766          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>(new Enumerations.FHIRVersionEnumFactory(), Enumerations.FHIRVersion.NULL));
15767        } else {;
15768          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15769        }
15770      }
15771    };
15772    if (json.has("_fhirVersion")) {
15773      JsonArray array = getJArray(json, "_fhirVersion");
15774      for (int i = 0; i < array.size(); i++) {
15775        if (i == res.getFhirVersion().size())
15776          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15777        if (array.get(i) instanceof JsonObject) 
15778          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
15779      }
15780    };
15781    if (json.has("name"))
15782      res.setNameElement(parseString(json.get("name").getAsString()));
15783    if (json.has("_name"))
15784      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15785    if (json.has("description"))
15786      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15787    if (json.has("_description"))
15788      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15789    DataType example = parseType("example", json);
15790    if (example != null)
15791      res.setExample(example);
15792    if (json.has("groupingId"))
15793      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
15794    if (json.has("_groupingId"))
15795      parseElementProperties(getJObject(json, "_groupingId"), res.getGroupingIdElement());
15796  }
15797
15798  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideDefinitionPageComponent(JsonObject json) throws IOException, FHIRFormatError {
15799    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
15800    parseImplementationGuideDefinitionPageComponentProperties(json, res);
15801    return res;
15802  }
15803
15804  protected void parseImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
15805    parseBackboneElementProperties(json, res);
15806    DataType name = parseType("name", json);
15807    if (name != null)
15808      res.setName(name);
15809    if (json.has("title"))
15810      res.setTitleElement(parseString(json.get("title").getAsString()));
15811    if (json.has("_title"))
15812      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15813    if (json.has("generation"))
15814      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
15815    if (json.has("_generation"))
15816      parseElementProperties(getJObject(json, "_generation"), res.getGenerationElement());
15817    if (json.has("page")) {
15818      JsonArray array = getJArray(json, "page");
15819      for (int i = 0; i < array.size(); i++) {
15820        res.getPage().add(parseImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject()));
15821      }
15822    };
15823  }
15824
15825  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideDefinitionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
15826    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
15827    parseImplementationGuideDefinitionParameterComponentProperties(json, res);
15828    return res;
15829  }
15830
15831  protected void parseImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
15832    parseBackboneElementProperties(json, res);
15833    if (json.has("code"))
15834      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory()));
15835    if (json.has("_code"))
15836      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
15837    if (json.has("value"))
15838      res.setValueElement(parseString(json.get("value").getAsString()));
15839    if (json.has("_value"))
15840      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
15841  }
15842
15843  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideDefinitionTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
15844    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
15845    parseImplementationGuideDefinitionTemplateComponentProperties(json, res);
15846    return res;
15847  }
15848
15849  protected void parseImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
15850    parseBackboneElementProperties(json, res);
15851    if (json.has("code"))
15852      res.setCodeElement(parseCode(json.get("code").getAsString()));
15853    if (json.has("_code"))
15854      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
15855    if (json.has("source"))
15856      res.setSourceElement(parseString(json.get("source").getAsString()));
15857    if (json.has("_source"))
15858      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
15859    if (json.has("scope"))
15860      res.setScopeElement(parseString(json.get("scope").getAsString()));
15861    if (json.has("_scope"))
15862      parseElementProperties(getJObject(json, "_scope"), res.getScopeElement());
15863  }
15864
15865  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideManifestComponent(JsonObject json) throws IOException, FHIRFormatError {
15866    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
15867    parseImplementationGuideManifestComponentProperties(json, res);
15868    return res;
15869  }
15870
15871  protected void parseImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
15872    parseBackboneElementProperties(json, res);
15873    if (json.has("rendering"))
15874      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
15875    if (json.has("_rendering"))
15876      parseElementProperties(getJObject(json, "_rendering"), res.getRenderingElement());
15877    if (json.has("resource")) {
15878      JsonArray array = getJArray(json, "resource");
15879      for (int i = 0; i < array.size(); i++) {
15880        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject()));
15881      }
15882    };
15883    if (json.has("page")) {
15884      JsonArray array = getJArray(json, "page");
15885      for (int i = 0; i < array.size(); i++) {
15886        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject()));
15887      }
15888    };
15889    if (json.has("image")) {
15890      JsonArray array = getJArray(json, "image");
15891      for (int i = 0; i < array.size(); i++) {
15892        if (array.get(i).isJsonNull()) {
15893          res.getImage().add(new StringType());
15894        } else {;
15895          res.getImage().add(parseString(array.get(i).getAsString()));
15896        }
15897      }
15898    };
15899    if (json.has("_image")) {
15900      JsonArray array = getJArray(json, "_image");
15901      for (int i = 0; i < array.size(); i++) {
15902        if (i == res.getImage().size())
15903          res.getImage().add(parseString(null));
15904        if (array.get(i) instanceof JsonObject) 
15905          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
15906      }
15907    };
15908    if (json.has("other")) {
15909      JsonArray array = getJArray(json, "other");
15910      for (int i = 0; i < array.size(); i++) {
15911        if (array.get(i).isJsonNull()) {
15912          res.getOther().add(new StringType());
15913        } else {;
15914          res.getOther().add(parseString(array.get(i).getAsString()));
15915        }
15916      }
15917    };
15918    if (json.has("_other")) {
15919      JsonArray array = getJArray(json, "_other");
15920      for (int i = 0; i < array.size(); i++) {
15921        if (i == res.getOther().size())
15922          res.getOther().add(parseString(null));
15923        if (array.get(i) instanceof JsonObject) 
15924          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
15925      }
15926    };
15927  }
15928
15929  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
15930    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
15931    parseImplementationGuideManifestResourceComponentProperties(json, res);
15932    return res;
15933  }
15934
15935  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
15936    parseBackboneElementProperties(json, res);
15937    if (json.has("reference"))
15938      res.setReference(parseReference(getJObject(json, "reference")));
15939    DataType example = parseType("example", json);
15940    if (example != null)
15941      res.setExample(example);
15942    if (json.has("relativePath"))
15943      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
15944    if (json.has("_relativePath"))
15945      parseElementProperties(getJObject(json, "_relativePath"), res.getRelativePathElement());
15946  }
15947
15948  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json) throws IOException, FHIRFormatError {
15949    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
15950    parseImplementationGuideManifestPageComponentProperties(json, res);
15951    return res;
15952  }
15953
15954  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
15955    parseBackboneElementProperties(json, res);
15956    if (json.has("name"))
15957      res.setNameElement(parseString(json.get("name").getAsString()));
15958    if (json.has("_name"))
15959      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15960    if (json.has("title"))
15961      res.setTitleElement(parseString(json.get("title").getAsString()));
15962    if (json.has("_title"))
15963      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15964    if (json.has("anchor")) {
15965      JsonArray array = getJArray(json, "anchor");
15966      for (int i = 0; i < array.size(); i++) {
15967        if (array.get(i).isJsonNull()) {
15968          res.getAnchor().add(new StringType());
15969        } else {;
15970          res.getAnchor().add(parseString(array.get(i).getAsString()));
15971        }
15972      }
15973    };
15974    if (json.has("_anchor")) {
15975      JsonArray array = getJArray(json, "_anchor");
15976      for (int i = 0; i < array.size(); i++) {
15977        if (i == res.getAnchor().size())
15978          res.getAnchor().add(parseString(null));
15979        if (array.get(i) instanceof JsonObject) 
15980          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
15981      }
15982    };
15983  }
15984
15985  protected Ingredient parseIngredient(JsonObject json) throws IOException, FHIRFormatError {
15986    Ingredient res = new Ingredient();
15987    parseIngredientProperties(json, res);
15988    return res;
15989  }
15990
15991  protected void parseIngredientProperties(JsonObject json, Ingredient res) throws IOException, FHIRFormatError {
15992    parseDomainResourceProperties(json, res);
15993    if (json.has("identifier"))
15994      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
15995    if (json.has("status"))
15996      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15997    if (json.has("_status"))
15998      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15999    if (json.has("for")) {
16000      JsonArray array = getJArray(json, "for");
16001      for (int i = 0; i < array.size(); i++) {
16002        res.getFor().add(parseReference(array.get(i).getAsJsonObject()));
16003      }
16004    };
16005    if (json.has("role"))
16006      res.setRole(parseCodeableConcept(getJObject(json, "role")));
16007    if (json.has("function")) {
16008      JsonArray array = getJArray(json, "function");
16009      for (int i = 0; i < array.size(); i++) {
16010        res.getFunction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16011      }
16012    };
16013    if (json.has("allergenicIndicator"))
16014      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
16015    if (json.has("_allergenicIndicator"))
16016      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
16017    if (json.has("manufacturer")) {
16018      JsonArray array = getJArray(json, "manufacturer");
16019      for (int i = 0; i < array.size(); i++) {
16020        res.getManufacturer().add(parseIngredientManufacturerComponent(array.get(i).getAsJsonObject()));
16021      }
16022    };
16023    if (json.has("substance"))
16024      res.setSubstance(parseIngredientSubstanceComponent(getJObject(json, "substance")));
16025  }
16026
16027  protected Ingredient.IngredientManufacturerComponent parseIngredientManufacturerComponent(JsonObject json) throws IOException, FHIRFormatError {
16028    Ingredient.IngredientManufacturerComponent res = new Ingredient.IngredientManufacturerComponent();
16029    parseIngredientManufacturerComponentProperties(json, res);
16030    return res;
16031  }
16032
16033  protected void parseIngredientManufacturerComponentProperties(JsonObject json, Ingredient.IngredientManufacturerComponent res) throws IOException, FHIRFormatError {
16034    parseBackboneElementProperties(json, res);
16035    if (json.has("role"))
16036      res.setRole(parseCoding(getJObject(json, "role")));
16037    if (json.has("manufacturer"))
16038      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
16039  }
16040
16041  protected Ingredient.IngredientSubstanceComponent parseIngredientSubstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
16042    Ingredient.IngredientSubstanceComponent res = new Ingredient.IngredientSubstanceComponent();
16043    parseIngredientSubstanceComponentProperties(json, res);
16044    return res;
16045  }
16046
16047  protected void parseIngredientSubstanceComponentProperties(JsonObject json, Ingredient.IngredientSubstanceComponent res) throws IOException, FHIRFormatError {
16048    parseBackboneElementProperties(json, res);
16049    if (json.has("code"))
16050      res.setCode(parseCodeableReference(getJObject(json, "code")));
16051    if (json.has("strength")) {
16052      JsonArray array = getJArray(json, "strength");
16053      for (int i = 0; i < array.size(); i++) {
16054        res.getStrength().add(parseIngredientSubstanceStrengthComponent(array.get(i).getAsJsonObject()));
16055      }
16056    };
16057  }
16058
16059  protected Ingredient.IngredientSubstanceStrengthComponent parseIngredientSubstanceStrengthComponent(JsonObject json) throws IOException, FHIRFormatError {
16060    Ingredient.IngredientSubstanceStrengthComponent res = new Ingredient.IngredientSubstanceStrengthComponent();
16061    parseIngredientSubstanceStrengthComponentProperties(json, res);
16062    return res;
16063  }
16064
16065  protected void parseIngredientSubstanceStrengthComponentProperties(JsonObject json, Ingredient.IngredientSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
16066    parseBackboneElementProperties(json, res);
16067    DataType presentation = parseType("presentation", json);
16068    if (presentation != null)
16069      res.setPresentation(presentation);
16070    if (json.has("presentationText"))
16071      res.setPresentationTextElement(parseString(json.get("presentationText").getAsString()));
16072    if (json.has("_presentationText"))
16073      parseElementProperties(getJObject(json, "_presentationText"), res.getPresentationTextElement());
16074    DataType concentration = parseType("concentration", json);
16075    if (concentration != null)
16076      res.setConcentration(concentration);
16077    if (json.has("concentrationText"))
16078      res.setConcentrationTextElement(parseString(json.get("concentrationText").getAsString()));
16079    if (json.has("_concentrationText"))
16080      parseElementProperties(getJObject(json, "_concentrationText"), res.getConcentrationTextElement());
16081    if (json.has("measurementPoint"))
16082      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
16083    if (json.has("_measurementPoint"))
16084      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
16085    if (json.has("country")) {
16086      JsonArray array = getJArray(json, "country");
16087      for (int i = 0; i < array.size(); i++) {
16088        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16089      }
16090    };
16091    if (json.has("referenceStrength")) {
16092      JsonArray array = getJArray(json, "referenceStrength");
16093      for (int i = 0; i < array.size(); i++) {
16094        res.getReferenceStrength().add(parseIngredientSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject()));
16095      }
16096    };
16097  }
16098
16099  protected Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent parseIngredientSubstanceStrengthReferenceStrengthComponent(JsonObject json) throws IOException, FHIRFormatError {
16100    Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent res = new Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent();
16101    parseIngredientSubstanceStrengthReferenceStrengthComponentProperties(json, res);
16102    return res;
16103  }
16104
16105  protected void parseIngredientSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
16106    parseBackboneElementProperties(json, res);
16107    if (json.has("substance"))
16108      res.setSubstance(parseCodeableReference(getJObject(json, "substance")));
16109    DataType strength = parseType("strength", json);
16110    if (strength != null)
16111      res.setStrength(strength);
16112    if (json.has("measurementPoint"))
16113      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
16114    if (json.has("_measurementPoint"))
16115      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
16116    if (json.has("country")) {
16117      JsonArray array = getJArray(json, "country");
16118      for (int i = 0; i < array.size(); i++) {
16119        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16120      }
16121    };
16122  }
16123
16124  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
16125    InsurancePlan res = new InsurancePlan();
16126    parseInsurancePlanProperties(json, res);
16127    return res;
16128  }
16129
16130  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
16131    parseDomainResourceProperties(json, res);
16132    if (json.has("identifier")) {
16133      JsonArray array = getJArray(json, "identifier");
16134      for (int i = 0; i < array.size(); i++) {
16135        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16136      }
16137    };
16138    if (json.has("status"))
16139      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16140    if (json.has("_status"))
16141      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16142    if (json.has("type")) {
16143      JsonArray array = getJArray(json, "type");
16144      for (int i = 0; i < array.size(); i++) {
16145        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16146      }
16147    };
16148    if (json.has("name"))
16149      res.setNameElement(parseString(json.get("name").getAsString()));
16150    if (json.has("_name"))
16151      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16152    if (json.has("alias")) {
16153      JsonArray array = getJArray(json, "alias");
16154      for (int i = 0; i < array.size(); i++) {
16155        if (array.get(i).isJsonNull()) {
16156          res.getAlias().add(new StringType());
16157        } else {;
16158          res.getAlias().add(parseString(array.get(i).getAsString()));
16159        }
16160      }
16161    };
16162    if (json.has("_alias")) {
16163      JsonArray array = getJArray(json, "_alias");
16164      for (int i = 0; i < array.size(); i++) {
16165        if (i == res.getAlias().size())
16166          res.getAlias().add(parseString(null));
16167        if (array.get(i) instanceof JsonObject) 
16168          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
16169      }
16170    };
16171    if (json.has("period"))
16172      res.setPeriod(parsePeriod(getJObject(json, "period")));
16173    if (json.has("ownedBy"))
16174      res.setOwnedBy(parseReference(getJObject(json, "ownedBy")));
16175    if (json.has("administeredBy"))
16176      res.setAdministeredBy(parseReference(getJObject(json, "administeredBy")));
16177    if (json.has("coverageArea")) {
16178      JsonArray array = getJArray(json, "coverageArea");
16179      for (int i = 0; i < array.size(); i++) {
16180        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
16181      }
16182    };
16183    if (json.has("contact")) {
16184      JsonArray array = getJArray(json, "contact");
16185      for (int i = 0; i < array.size(); i++) {
16186        res.getContact().add(parseInsurancePlanContactComponent(array.get(i).getAsJsonObject()));
16187      }
16188    };
16189    if (json.has("endpoint")) {
16190      JsonArray array = getJArray(json, "endpoint");
16191      for (int i = 0; i < array.size(); i++) {
16192        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
16193      }
16194    };
16195    if (json.has("network")) {
16196      JsonArray array = getJArray(json, "network");
16197      for (int i = 0; i < array.size(); i++) {
16198        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16199      }
16200    };
16201    if (json.has("coverage")) {
16202      JsonArray array = getJArray(json, "coverage");
16203      for (int i = 0; i < array.size(); i++) {
16204        res.getCoverage().add(parseInsurancePlanCoverageComponent(array.get(i).getAsJsonObject()));
16205      }
16206    };
16207    if (json.has("plan")) {
16208      JsonArray array = getJArray(json, "plan");
16209      for (int i = 0; i < array.size(); i++) {
16210        res.getPlan().add(parseInsurancePlanPlanComponent(array.get(i).getAsJsonObject()));
16211      }
16212    };
16213  }
16214
16215  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanContactComponent(JsonObject json) throws IOException, FHIRFormatError {
16216    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
16217    parseInsurancePlanContactComponentProperties(json, res);
16218    return res;
16219  }
16220
16221  protected void parseInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
16222    parseBackboneElementProperties(json, res);
16223    if (json.has("purpose"))
16224      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
16225    if (json.has("name"))
16226      res.setName(parseHumanName(getJObject(json, "name")));
16227    if (json.has("telecom")) {
16228      JsonArray array = getJArray(json, "telecom");
16229      for (int i = 0; i < array.size(); i++) {
16230        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16231      }
16232    };
16233    if (json.has("address"))
16234      res.setAddress(parseAddress(getJObject(json, "address")));
16235  }
16236
16237  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
16238    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
16239    parseInsurancePlanCoverageComponentProperties(json, res);
16240    return res;
16241  }
16242
16243  protected void parseInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
16244    parseBackboneElementProperties(json, res);
16245    if (json.has("type"))
16246      res.setType(parseCodeableConcept(getJObject(json, "type")));
16247    if (json.has("network")) {
16248      JsonArray array = getJArray(json, "network");
16249      for (int i = 0; i < array.size(); i++) {
16250        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16251      }
16252    };
16253    if (json.has("benefit")) {
16254      JsonArray array = getJArray(json, "benefit");
16255      for (int i = 0; i < array.size(); i++) {
16256        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject()));
16257      }
16258    };
16259  }
16260
16261  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
16262    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
16263    parseInsurancePlanCoverageBenefitComponentProperties(json, res);
16264    return res;
16265  }
16266
16267  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
16268    parseBackboneElementProperties(json, res);
16269    if (json.has("type"))
16270      res.setType(parseCodeableConcept(getJObject(json, "type")));
16271    if (json.has("requirement"))
16272      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
16273    if (json.has("_requirement"))
16274      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
16275    if (json.has("limit")) {
16276      JsonArray array = getJArray(json, "limit");
16277      for (int i = 0; i < array.size(); i++) {
16278        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject()));
16279      }
16280    };
16281  }
16282
16283  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json) throws IOException, FHIRFormatError {
16284    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
16285    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, res);
16286    return res;
16287  }
16288
16289  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
16290    parseBackboneElementProperties(json, res);
16291    if (json.has("value"))
16292      res.setValue(parseQuantity(getJObject(json, "value")));
16293    if (json.has("code"))
16294      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16295  }
16296
16297  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanPlanComponent(JsonObject json) throws IOException, FHIRFormatError {
16298    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
16299    parseInsurancePlanPlanComponentProperties(json, res);
16300    return res;
16301  }
16302
16303  protected void parseInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
16304    parseBackboneElementProperties(json, res);
16305    if (json.has("identifier")) {
16306      JsonArray array = getJArray(json, "identifier");
16307      for (int i = 0; i < array.size(); i++) {
16308        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16309      }
16310    };
16311    if (json.has("type"))
16312      res.setType(parseCodeableConcept(getJObject(json, "type")));
16313    if (json.has("coverageArea")) {
16314      JsonArray array = getJArray(json, "coverageArea");
16315      for (int i = 0; i < array.size(); i++) {
16316        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
16317      }
16318    };
16319    if (json.has("network")) {
16320      JsonArray array = getJArray(json, "network");
16321      for (int i = 0; i < array.size(); i++) {
16322        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16323      }
16324    };
16325    if (json.has("generalCost")) {
16326      JsonArray array = getJArray(json, "generalCost");
16327      for (int i = 0; i < array.size(); i++) {
16328        res.getGeneralCost().add(parseInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject()));
16329      }
16330    };
16331    if (json.has("specificCost")) {
16332      JsonArray array = getJArray(json, "specificCost");
16333      for (int i = 0; i < array.size(); i++) {
16334        res.getSpecificCost().add(parseInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject()));
16335      }
16336    };
16337  }
16338
16339  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanPlanGeneralCostComponent(JsonObject json) throws IOException, FHIRFormatError {
16340    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
16341    parseInsurancePlanPlanGeneralCostComponentProperties(json, res);
16342    return res;
16343  }
16344
16345  protected void parseInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
16346    parseBackboneElementProperties(json, res);
16347    if (json.has("type"))
16348      res.setType(parseCodeableConcept(getJObject(json, "type")));
16349    if (json.has("groupSize"))
16350      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
16351    if (json.has("_groupSize"))
16352      parseElementProperties(getJObject(json, "_groupSize"), res.getGroupSizeElement());
16353    if (json.has("cost"))
16354      res.setCost(parseMoney(getJObject(json, "cost")));
16355    if (json.has("comment"))
16356      res.setCommentElement(parseString(json.get("comment").getAsString()));
16357    if (json.has("_comment"))
16358      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
16359  }
16360
16361  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanPlanSpecificCostComponent(JsonObject json) throws IOException, FHIRFormatError {
16362    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
16363    parseInsurancePlanPlanSpecificCostComponentProperties(json, res);
16364    return res;
16365  }
16366
16367  protected void parseInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
16368    parseBackboneElementProperties(json, res);
16369    if (json.has("category"))
16370      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16371    if (json.has("benefit")) {
16372      JsonArray array = getJArray(json, "benefit");
16373      for (int i = 0; i < array.size(); i++) {
16374        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject()));
16375      }
16376    };
16377  }
16378
16379  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
16380    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
16381    parseInsurancePlanPlanBenefitComponentProperties(json, res);
16382    return res;
16383  }
16384
16385  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
16386    parseBackboneElementProperties(json, res);
16387    if (json.has("type"))
16388      res.setType(parseCodeableConcept(getJObject(json, "type")));
16389    if (json.has("cost")) {
16390      JsonArray array = getJArray(json, "cost");
16391      for (int i = 0; i < array.size(); i++) {
16392        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject()));
16393      }
16394    };
16395  }
16396
16397  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json) throws IOException, FHIRFormatError {
16398    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
16399    parseInsurancePlanPlanBenefitCostComponentProperties(json, res);
16400    return res;
16401  }
16402
16403  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
16404    parseBackboneElementProperties(json, res);
16405    if (json.has("type"))
16406      res.setType(parseCodeableConcept(getJObject(json, "type")));
16407    if (json.has("applicability"))
16408      res.setApplicability(parseCodeableConcept(getJObject(json, "applicability")));
16409    if (json.has("qualifiers")) {
16410      JsonArray array = getJArray(json, "qualifiers");
16411      for (int i = 0; i < array.size(); i++) {
16412        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16413      }
16414    };
16415    if (json.has("value"))
16416      res.setValue(parseQuantity(getJObject(json, "value")));
16417  }
16418
16419  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
16420    Invoice res = new Invoice();
16421    parseInvoiceProperties(json, res);
16422    return res;
16423  }
16424
16425  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
16426    parseDomainResourceProperties(json, res);
16427    if (json.has("identifier")) {
16428      JsonArray array = getJArray(json, "identifier");
16429      for (int i = 0; i < array.size(); i++) {
16430        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16431      }
16432    };
16433    if (json.has("status"))
16434      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
16435    if (json.has("_status"))
16436      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16437    if (json.has("cancelledReason"))
16438      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
16439    if (json.has("_cancelledReason"))
16440      parseElementProperties(getJObject(json, "_cancelledReason"), res.getCancelledReasonElement());
16441    if (json.has("type"))
16442      res.setType(parseCodeableConcept(getJObject(json, "type")));
16443    if (json.has("subject"))
16444      res.setSubject(parseReference(getJObject(json, "subject")));
16445    if (json.has("recipient"))
16446      res.setRecipient(parseReference(getJObject(json, "recipient")));
16447    if (json.has("date"))
16448      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16449    if (json.has("_date"))
16450      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16451    if (json.has("participant")) {
16452      JsonArray array = getJArray(json, "participant");
16453      for (int i = 0; i < array.size(); i++) {
16454        res.getParticipant().add(parseInvoiceParticipantComponent(array.get(i).getAsJsonObject()));
16455      }
16456    };
16457    if (json.has("issuer"))
16458      res.setIssuer(parseReference(getJObject(json, "issuer")));
16459    if (json.has("account"))
16460      res.setAccount(parseReference(getJObject(json, "account")));
16461    if (json.has("lineItem")) {
16462      JsonArray array = getJArray(json, "lineItem");
16463      for (int i = 0; i < array.size(); i++) {
16464        res.getLineItem().add(parseInvoiceLineItemComponent(array.get(i).getAsJsonObject()));
16465      }
16466    };
16467    if (json.has("totalPriceComponent")) {
16468      JsonArray array = getJArray(json, "totalPriceComponent");
16469      for (int i = 0; i < array.size(); i++) {
16470        res.getTotalPriceComponent().add(parseInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject()));
16471      }
16472    };
16473    if (json.has("totalNet"))
16474      res.setTotalNet(parseMoney(getJObject(json, "totalNet")));
16475    if (json.has("totalGross"))
16476      res.setTotalGross(parseMoney(getJObject(json, "totalGross")));
16477    if (json.has("paymentTerms"))
16478      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
16479    if (json.has("_paymentTerms"))
16480      parseElementProperties(getJObject(json, "_paymentTerms"), res.getPaymentTermsElement());
16481    if (json.has("note")) {
16482      JsonArray array = getJArray(json, "note");
16483      for (int i = 0; i < array.size(); i++) {
16484        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16485      }
16486    };
16487  }
16488
16489  protected Invoice.InvoiceParticipantComponent parseInvoiceParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
16490    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
16491    parseInvoiceParticipantComponentProperties(json, res);
16492    return res;
16493  }
16494
16495  protected void parseInvoiceParticipantComponentProperties(JsonObject json, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
16496    parseBackboneElementProperties(json, res);
16497    if (json.has("role"))
16498      res.setRole(parseCodeableConcept(getJObject(json, "role")));
16499    if (json.has("actor"))
16500      res.setActor(parseReference(getJObject(json, "actor")));
16501  }
16502
16503  protected Invoice.InvoiceLineItemComponent parseInvoiceLineItemComponent(JsonObject json) throws IOException, FHIRFormatError {
16504    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
16505    parseInvoiceLineItemComponentProperties(json, res);
16506    return res;
16507  }
16508
16509  protected void parseInvoiceLineItemComponentProperties(JsonObject json, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
16510    parseBackboneElementProperties(json, res);
16511    if (json.has("sequence"))
16512      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
16513    if (json.has("_sequence"))
16514      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
16515    DataType chargeItem = parseType("chargeItem", json);
16516    if (chargeItem != null)
16517      res.setChargeItem(chargeItem);
16518    if (json.has("priceComponent")) {
16519      JsonArray array = getJArray(json, "priceComponent");
16520      for (int i = 0; i < array.size(); i++) {
16521        res.getPriceComponent().add(parseInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject()));
16522      }
16523    };
16524  }
16525
16526  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceLineItemPriceComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
16527    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
16528    parseInvoiceLineItemPriceComponentComponentProperties(json, res);
16529    return res;
16530  }
16531
16532  protected void parseInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
16533    parseBackboneElementProperties(json, res);
16534    if (json.has("type"))
16535      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.InvoicePriceComponentType.NULL, new Enumerations.InvoicePriceComponentTypeEnumFactory()));
16536    if (json.has("_type"))
16537      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
16538    if (json.has("code"))
16539      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16540    if (json.has("factor"))
16541      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16542    if (json.has("_factor"))
16543      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
16544    if (json.has("amount"))
16545      res.setAmount(parseMoney(getJObject(json, "amount")));
16546  }
16547
16548  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
16549    Library res = new Library();
16550    parseLibraryProperties(json, res);
16551    return res;
16552  }
16553
16554  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
16555    parseDomainResourceProperties(json, res);
16556    if (json.has("url"))
16557      res.setUrlElement(parseUri(json.get("url").getAsString()));
16558    if (json.has("_url"))
16559      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
16560    if (json.has("identifier")) {
16561      JsonArray array = getJArray(json, "identifier");
16562      for (int i = 0; i < array.size(); i++) {
16563        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16564      }
16565    };
16566    if (json.has("version"))
16567      res.setVersionElement(parseString(json.get("version").getAsString()));
16568    if (json.has("_version"))
16569      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
16570    if (json.has("name"))
16571      res.setNameElement(parseString(json.get("name").getAsString()));
16572    if (json.has("_name"))
16573      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16574    if (json.has("title"))
16575      res.setTitleElement(parseString(json.get("title").getAsString()));
16576    if (json.has("_title"))
16577      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
16578    if (json.has("subtitle"))
16579      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
16580    if (json.has("_subtitle"))
16581      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
16582    if (json.has("status"))
16583      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16584    if (json.has("_status"))
16585      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16586    if (json.has("experimental"))
16587      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16588    if (json.has("_experimental"))
16589      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
16590    if (json.has("type"))
16591      res.setType(parseCodeableConcept(getJObject(json, "type")));
16592    DataType subject = parseType("subject", json);
16593    if (subject != null)
16594      res.setSubject(subject);
16595    if (json.has("date"))
16596      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16597    if (json.has("_date"))
16598      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16599    if (json.has("publisher"))
16600      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16601    if (json.has("_publisher"))
16602      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
16603    if (json.has("contact")) {
16604      JsonArray array = getJArray(json, "contact");
16605      for (int i = 0; i < array.size(); i++) {
16606        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16607      }
16608    };
16609    if (json.has("description"))
16610      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16611    if (json.has("_description"))
16612      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16613    if (json.has("useContext")) {
16614      JsonArray array = getJArray(json, "useContext");
16615      for (int i = 0; i < array.size(); i++) {
16616        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16617      }
16618    };
16619    if (json.has("jurisdiction")) {
16620      JsonArray array = getJArray(json, "jurisdiction");
16621      for (int i = 0; i < array.size(); i++) {
16622        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16623      }
16624    };
16625    if (json.has("purpose"))
16626      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16627    if (json.has("_purpose"))
16628      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
16629    if (json.has("usage"))
16630      res.setUsageElement(parseString(json.get("usage").getAsString()));
16631    if (json.has("_usage"))
16632      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
16633    if (json.has("copyright"))
16634      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
16635    if (json.has("_copyright"))
16636      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
16637    if (json.has("approvalDate"))
16638      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
16639    if (json.has("_approvalDate"))
16640      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
16641    if (json.has("lastReviewDate"))
16642      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
16643    if (json.has("_lastReviewDate"))
16644      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
16645    if (json.has("effectivePeriod"))
16646      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
16647    if (json.has("topic")) {
16648      JsonArray array = getJArray(json, "topic");
16649      for (int i = 0; i < array.size(); i++) {
16650        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16651      }
16652    };
16653    if (json.has("author")) {
16654      JsonArray array = getJArray(json, "author");
16655      for (int i = 0; i < array.size(); i++) {
16656        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16657      }
16658    };
16659    if (json.has("editor")) {
16660      JsonArray array = getJArray(json, "editor");
16661      for (int i = 0; i < array.size(); i++) {
16662        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16663      }
16664    };
16665    if (json.has("reviewer")) {
16666      JsonArray array = getJArray(json, "reviewer");
16667      for (int i = 0; i < array.size(); i++) {
16668        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
16669      }
16670    };
16671    if (json.has("endorser")) {
16672      JsonArray array = getJArray(json, "endorser");
16673      for (int i = 0; i < array.size(); i++) {
16674        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
16675      }
16676    };
16677    if (json.has("relatedArtifact")) {
16678      JsonArray array = getJArray(json, "relatedArtifact");
16679      for (int i = 0; i < array.size(); i++) {
16680        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16681      }
16682    };
16683    if (json.has("parameter")) {
16684      JsonArray array = getJArray(json, "parameter");
16685      for (int i = 0; i < array.size(); i++) {
16686        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
16687      }
16688    };
16689    if (json.has("dataRequirement")) {
16690      JsonArray array = getJArray(json, "dataRequirement");
16691      for (int i = 0; i < array.size(); i++) {
16692        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
16693      }
16694    };
16695    if (json.has("content")) {
16696      JsonArray array = getJArray(json, "content");
16697      for (int i = 0; i < array.size(); i++) {
16698        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
16699      }
16700    };
16701  }
16702
16703  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
16704    Linkage res = new Linkage();
16705    parseLinkageProperties(json, res);
16706    return res;
16707  }
16708
16709  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
16710    parseDomainResourceProperties(json, res);
16711    if (json.has("active"))
16712      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16713    if (json.has("_active"))
16714      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
16715    if (json.has("author"))
16716      res.setAuthor(parseReference(getJObject(json, "author")));
16717    if (json.has("item")) {
16718      JsonArray array = getJArray(json, "item");
16719      for (int i = 0; i < array.size(); i++) {
16720        res.getItem().add(parseLinkageItemComponent(array.get(i).getAsJsonObject()));
16721      }
16722    };
16723  }
16724
16725  protected Linkage.LinkageItemComponent parseLinkageItemComponent(JsonObject json) throws IOException, FHIRFormatError {
16726    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
16727    parseLinkageItemComponentProperties(json, res);
16728    return res;
16729  }
16730
16731  protected void parseLinkageItemComponentProperties(JsonObject json, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
16732    parseBackboneElementProperties(json, res);
16733    if (json.has("type"))
16734      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
16735    if (json.has("_type"))
16736      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
16737    if (json.has("resource"))
16738      res.setResource(parseReference(getJObject(json, "resource")));
16739  }
16740
16741  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
16742    ListResource res = new ListResource();
16743    parseListResourceProperties(json, res);
16744    return res;
16745  }
16746
16747  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
16748    parseDomainResourceProperties(json, res);
16749    if (json.has("identifier")) {
16750      JsonArray array = getJArray(json, "identifier");
16751      for (int i = 0; i < array.size(); i++) {
16752        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16753      }
16754    };
16755    if (json.has("status"))
16756      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
16757    if (json.has("_status"))
16758      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16759    if (json.has("mode"))
16760      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
16761    if (json.has("_mode"))
16762      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
16763    if (json.has("title"))
16764      res.setTitleElement(parseString(json.get("title").getAsString()));
16765    if (json.has("_title"))
16766      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
16767    if (json.has("code"))
16768      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16769    if (json.has("subject"))
16770      res.setSubject(parseReference(getJObject(json, "subject")));
16771    if (json.has("encounter"))
16772      res.setEncounter(parseReference(getJObject(json, "encounter")));
16773    if (json.has("date"))
16774      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16775    if (json.has("_date"))
16776      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16777    if (json.has("source"))
16778      res.setSource(parseReference(getJObject(json, "source")));
16779    if (json.has("orderedBy"))
16780      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
16781    if (json.has("note")) {
16782      JsonArray array = getJArray(json, "note");
16783      for (int i = 0; i < array.size(); i++) {
16784        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16785      }
16786    };
16787    if (json.has("entry")) {
16788      JsonArray array = getJArray(json, "entry");
16789      for (int i = 0; i < array.size(); i++) {
16790        res.getEntry().add(parseListResourceEntryComponent(array.get(i).getAsJsonObject()));
16791      }
16792    };
16793    if (json.has("emptyReason"))
16794      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
16795  }
16796
16797  protected ListResource.ListResourceEntryComponent parseListResourceEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
16798    ListResource.ListResourceEntryComponent res = new ListResource.ListResourceEntryComponent();
16799    parseListResourceEntryComponentProperties(json, res);
16800    return res;
16801  }
16802
16803  protected void parseListResourceEntryComponentProperties(JsonObject json, ListResource.ListResourceEntryComponent res) throws IOException, FHIRFormatError {
16804    parseBackboneElementProperties(json, res);
16805    if (json.has("flag"))
16806      res.setFlag(parseCodeableConcept(getJObject(json, "flag")));
16807    if (json.has("deleted"))
16808      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
16809    if (json.has("_deleted"))
16810      parseElementProperties(getJObject(json, "_deleted"), res.getDeletedElement());
16811    if (json.has("date"))
16812      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16813    if (json.has("_date"))
16814      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16815    if (json.has("item"))
16816      res.setItem(parseReference(getJObject(json, "item")));
16817  }
16818
16819  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
16820    Location res = new Location();
16821    parseLocationProperties(json, res);
16822    return res;
16823  }
16824
16825  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
16826    parseDomainResourceProperties(json, res);
16827    if (json.has("identifier")) {
16828      JsonArray array = getJArray(json, "identifier");
16829      for (int i = 0; i < array.size(); i++) {
16830        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16831      }
16832    };
16833    if (json.has("status"))
16834      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
16835    if (json.has("_status"))
16836      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16837    if (json.has("operationalStatus"))
16838      res.setOperationalStatus(parseCoding(getJObject(json, "operationalStatus")));
16839    if (json.has("name"))
16840      res.setNameElement(parseString(json.get("name").getAsString()));
16841    if (json.has("_name"))
16842      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16843    if (json.has("alias")) {
16844      JsonArray array = getJArray(json, "alias");
16845      for (int i = 0; i < array.size(); i++) {
16846        if (array.get(i).isJsonNull()) {
16847          res.getAlias().add(new StringType());
16848        } else {;
16849          res.getAlias().add(parseString(array.get(i).getAsString()));
16850        }
16851      }
16852    };
16853    if (json.has("_alias")) {
16854      JsonArray array = getJArray(json, "_alias");
16855      for (int i = 0; i < array.size(); i++) {
16856        if (i == res.getAlias().size())
16857          res.getAlias().add(parseString(null));
16858        if (array.get(i) instanceof JsonObject) 
16859          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
16860      }
16861    };
16862    if (json.has("description"))
16863      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16864    if (json.has("_description"))
16865      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16866    if (json.has("mode"))
16867      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
16868    if (json.has("_mode"))
16869      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
16870    if (json.has("type")) {
16871      JsonArray array = getJArray(json, "type");
16872      for (int i = 0; i < array.size(); i++) {
16873        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16874      }
16875    };
16876    if (json.has("telecom")) {
16877      JsonArray array = getJArray(json, "telecom");
16878      for (int i = 0; i < array.size(); i++) {
16879        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16880      }
16881    };
16882    if (json.has("address"))
16883      res.setAddress(parseAddress(getJObject(json, "address")));
16884    if (json.has("physicalType"))
16885      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
16886    if (json.has("position"))
16887      res.setPosition(parseLocationPositionComponent(getJObject(json, "position")));
16888    if (json.has("managingOrganization"))
16889      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
16890    if (json.has("partOf"))
16891      res.setPartOf(parseReference(getJObject(json, "partOf")));
16892    if (json.has("hoursOfOperation")) {
16893      JsonArray array = getJArray(json, "hoursOfOperation");
16894      for (int i = 0; i < array.size(); i++) {
16895        res.getHoursOfOperation().add(parseLocationHoursOfOperationComponent(array.get(i).getAsJsonObject()));
16896      }
16897    };
16898    if (json.has("availabilityExceptions"))
16899      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
16900    if (json.has("_availabilityExceptions"))
16901      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
16902    if (json.has("endpoint")) {
16903      JsonArray array = getJArray(json, "endpoint");
16904      for (int i = 0; i < array.size(); i++) {
16905        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
16906      }
16907    };
16908  }
16909
16910  protected Location.LocationPositionComponent parseLocationPositionComponent(JsonObject json) throws IOException, FHIRFormatError {
16911    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
16912    parseLocationPositionComponentProperties(json, res);
16913    return res;
16914  }
16915
16916  protected void parseLocationPositionComponentProperties(JsonObject json, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
16917    parseBackboneElementProperties(json, res);
16918    if (json.has("longitude"))
16919      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
16920    if (json.has("_longitude"))
16921      parseElementProperties(getJObject(json, "_longitude"), res.getLongitudeElement());
16922    if (json.has("latitude"))
16923      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
16924    if (json.has("_latitude"))
16925      parseElementProperties(getJObject(json, "_latitude"), res.getLatitudeElement());
16926    if (json.has("altitude"))
16927      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
16928    if (json.has("_altitude"))
16929      parseElementProperties(getJObject(json, "_altitude"), res.getAltitudeElement());
16930  }
16931
16932  protected Location.LocationHoursOfOperationComponent parseLocationHoursOfOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
16933    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
16934    parseLocationHoursOfOperationComponentProperties(json, res);
16935    return res;
16936  }
16937
16938  protected void parseLocationHoursOfOperationComponentProperties(JsonObject json, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
16939    parseBackboneElementProperties(json, res);
16940    if (json.has("daysOfWeek")) {
16941      JsonArray array = getJArray(json, "daysOfWeek");
16942      for (int i = 0; i < array.size(); i++) {
16943        if (array.get(i).isJsonNull()) {
16944          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
16945        } else {;
16946          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
16947        }
16948      }
16949    };
16950    if (json.has("_daysOfWeek")) {
16951      JsonArray array = getJArray(json, "_daysOfWeek");
16952      for (int i = 0; i < array.size(); i++) {
16953        if (i == res.getDaysOfWeek().size())
16954          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
16955        if (array.get(i) instanceof JsonObject) 
16956          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
16957      }
16958    };
16959    if (json.has("allDay"))
16960      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
16961    if (json.has("_allDay"))
16962      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
16963    if (json.has("openingTime"))
16964      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
16965    if (json.has("_openingTime"))
16966      parseElementProperties(getJObject(json, "_openingTime"), res.getOpeningTimeElement());
16967    if (json.has("closingTime"))
16968      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
16969    if (json.has("_closingTime"))
16970      parseElementProperties(getJObject(json, "_closingTime"), res.getClosingTimeElement());
16971  }
16972
16973  protected ManufacturedItemDefinition parseManufacturedItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
16974    ManufacturedItemDefinition res = new ManufacturedItemDefinition();
16975    parseManufacturedItemDefinitionProperties(json, res);
16976    return res;
16977  }
16978
16979  protected void parseManufacturedItemDefinitionProperties(JsonObject json, ManufacturedItemDefinition res) throws IOException, FHIRFormatError {
16980    parseDomainResourceProperties(json, res);
16981    if (json.has("identifier")) {
16982      JsonArray array = getJArray(json, "identifier");
16983      for (int i = 0; i < array.size(); i++) {
16984        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16985      }
16986    };
16987    if (json.has("status"))
16988      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16989    if (json.has("_status"))
16990      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16991    if (json.has("manufacturedDoseForm"))
16992      res.setManufacturedDoseForm(parseCodeableConcept(getJObject(json, "manufacturedDoseForm")));
16993    if (json.has("unitOfPresentation"))
16994      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
16995    if (json.has("manufacturer")) {
16996      JsonArray array = getJArray(json, "manufacturer");
16997      for (int i = 0; i < array.size(); i++) {
16998        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
16999      }
17000    };
17001    if (json.has("ingredient")) {
17002      JsonArray array = getJArray(json, "ingredient");
17003      for (int i = 0; i < array.size(); i++) {
17004        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17005      }
17006    };
17007    if (json.has("property")) {
17008      JsonArray array = getJArray(json, "property");
17009      for (int i = 0; i < array.size(); i++) {
17010        res.getProperty().add(parseManufacturedItemDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
17011      }
17012    };
17013  }
17014
17015  protected ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent parseManufacturedItemDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
17016    ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent res = new ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent();
17017    parseManufacturedItemDefinitionPropertyComponentProperties(json, res);
17018    return res;
17019  }
17020
17021  protected void parseManufacturedItemDefinitionPropertyComponentProperties(JsonObject json, ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
17022    parseBackboneElementProperties(json, res);
17023    if (json.has("type"))
17024      res.setType(parseCodeableConcept(getJObject(json, "type")));
17025    DataType value = parseType("value", json);
17026    if (value != null)
17027      res.setValue(value);
17028  }
17029
17030  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
17031    Measure res = new Measure();
17032    parseMeasureProperties(json, res);
17033    return res;
17034  }
17035
17036  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
17037    parseDomainResourceProperties(json, res);
17038    if (json.has("url"))
17039      res.setUrlElement(parseUri(json.get("url").getAsString()));
17040    if (json.has("_url"))
17041      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17042    if (json.has("identifier")) {
17043      JsonArray array = getJArray(json, "identifier");
17044      for (int i = 0; i < array.size(); i++) {
17045        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17046      }
17047    };
17048    if (json.has("version"))
17049      res.setVersionElement(parseString(json.get("version").getAsString()));
17050    if (json.has("_version"))
17051      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17052    if (json.has("name"))
17053      res.setNameElement(parseString(json.get("name").getAsString()));
17054    if (json.has("_name"))
17055      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17056    if (json.has("title"))
17057      res.setTitleElement(parseString(json.get("title").getAsString()));
17058    if (json.has("_title"))
17059      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17060    if (json.has("subtitle"))
17061      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
17062    if (json.has("_subtitle"))
17063      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
17064    if (json.has("status"))
17065      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17066    if (json.has("_status"))
17067      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17068    if (json.has("experimental"))
17069      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17070    if (json.has("_experimental"))
17071      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17072    DataType subject = parseType("subject", json);
17073    if (subject != null)
17074      res.setSubject(subject);
17075    if (json.has("date"))
17076      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17077    if (json.has("_date"))
17078      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17079    if (json.has("publisher"))
17080      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17081    if (json.has("_publisher"))
17082      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17083    if (json.has("contact")) {
17084      JsonArray array = getJArray(json, "contact");
17085      for (int i = 0; i < array.size(); i++) {
17086        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17087      }
17088    };
17089    if (json.has("description"))
17090      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17091    if (json.has("_description"))
17092      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17093    if (json.has("useContext")) {
17094      JsonArray array = getJArray(json, "useContext");
17095      for (int i = 0; i < array.size(); i++) {
17096        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17097      }
17098    };
17099    if (json.has("jurisdiction")) {
17100      JsonArray array = getJArray(json, "jurisdiction");
17101      for (int i = 0; i < array.size(); i++) {
17102        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17103      }
17104    };
17105    if (json.has("purpose"))
17106      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17107    if (json.has("_purpose"))
17108      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17109    if (json.has("usage"))
17110      res.setUsageElement(parseString(json.get("usage").getAsString()));
17111    if (json.has("_usage"))
17112      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
17113    if (json.has("copyright"))
17114      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17115    if (json.has("_copyright"))
17116      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17117    if (json.has("approvalDate"))
17118      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
17119    if (json.has("_approvalDate"))
17120      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
17121    if (json.has("lastReviewDate"))
17122      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
17123    if (json.has("_lastReviewDate"))
17124      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
17125    if (json.has("effectivePeriod"))
17126      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
17127    if (json.has("topic")) {
17128      JsonArray array = getJArray(json, "topic");
17129      for (int i = 0; i < array.size(); i++) {
17130        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17131      }
17132    };
17133    if (json.has("author")) {
17134      JsonArray array = getJArray(json, "author");
17135      for (int i = 0; i < array.size(); i++) {
17136        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
17137      }
17138    };
17139    if (json.has("editor")) {
17140      JsonArray array = getJArray(json, "editor");
17141      for (int i = 0; i < array.size(); i++) {
17142        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
17143      }
17144    };
17145    if (json.has("reviewer")) {
17146      JsonArray array = getJArray(json, "reviewer");
17147      for (int i = 0; i < array.size(); i++) {
17148        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
17149      }
17150    };
17151    if (json.has("endorser")) {
17152      JsonArray array = getJArray(json, "endorser");
17153      for (int i = 0; i < array.size(); i++) {
17154        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
17155      }
17156    };
17157    if (json.has("relatedArtifact")) {
17158      JsonArray array = getJArray(json, "relatedArtifact");
17159      for (int i = 0; i < array.size(); i++) {
17160        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
17161      }
17162    };
17163    if (json.has("library")) {
17164      JsonArray array = getJArray(json, "library");
17165      for (int i = 0; i < array.size(); i++) {
17166        if (array.get(i).isJsonNull()) {
17167          res.getLibrary().add(new CanonicalType());
17168        } else {;
17169          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
17170        }
17171      }
17172    };
17173    if (json.has("_library")) {
17174      JsonArray array = getJArray(json, "_library");
17175      for (int i = 0; i < array.size(); i++) {
17176        if (i == res.getLibrary().size())
17177          res.getLibrary().add(parseCanonical(null));
17178        if (array.get(i) instanceof JsonObject) 
17179          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
17180      }
17181    };
17182    if (json.has("disclaimer"))
17183      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
17184    if (json.has("_disclaimer"))
17185      parseElementProperties(getJObject(json, "_disclaimer"), res.getDisclaimerElement());
17186    if (json.has("scoring"))
17187      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
17188    if (json.has("compositeScoring"))
17189      res.setCompositeScoring(parseCodeableConcept(getJObject(json, "compositeScoring")));
17190    if (json.has("type")) {
17191      JsonArray array = getJArray(json, "type");
17192      for (int i = 0; i < array.size(); i++) {
17193        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17194      }
17195    };
17196    if (json.has("riskAdjustment"))
17197      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
17198    if (json.has("_riskAdjustment"))
17199      parseElementProperties(getJObject(json, "_riskAdjustment"), res.getRiskAdjustmentElement());
17200    if (json.has("rateAggregation"))
17201      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
17202    if (json.has("_rateAggregation"))
17203      parseElementProperties(getJObject(json, "_rateAggregation"), res.getRateAggregationElement());
17204    if (json.has("rationale"))
17205      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
17206    if (json.has("_rationale"))
17207      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
17208    if (json.has("clinicalRecommendationStatement"))
17209      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
17210    if (json.has("_clinicalRecommendationStatement"))
17211      parseElementProperties(getJObject(json, "_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
17212    if (json.has("improvementNotation"))
17213      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
17214    if (json.has("definition")) {
17215      JsonArray array = getJArray(json, "definition");
17216      for (int i = 0; i < array.size(); i++) {
17217        if (array.get(i).isJsonNull()) {
17218          res.getDefinition().add(new MarkdownType());
17219        } else {;
17220          res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
17221        }
17222      }
17223    };
17224    if (json.has("_definition")) {
17225      JsonArray array = getJArray(json, "_definition");
17226      for (int i = 0; i < array.size(); i++) {
17227        if (i == res.getDefinition().size())
17228          res.getDefinition().add(parseMarkdown(null));
17229        if (array.get(i) instanceof JsonObject) 
17230          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
17231      }
17232    };
17233    if (json.has("guidance"))
17234      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
17235    if (json.has("_guidance"))
17236      parseElementProperties(getJObject(json, "_guidance"), res.getGuidanceElement());
17237    if (json.has("group")) {
17238      JsonArray array = getJArray(json, "group");
17239      for (int i = 0; i < array.size(); i++) {
17240        res.getGroup().add(parseMeasureGroupComponent(array.get(i).getAsJsonObject()));
17241      }
17242    };
17243    if (json.has("supplementalData")) {
17244      JsonArray array = getJArray(json, "supplementalData");
17245      for (int i = 0; i < array.size(); i++) {
17246        res.getSupplementalData().add(parseMeasureSupplementalDataComponent(array.get(i).getAsJsonObject()));
17247      }
17248    };
17249  }
17250
17251  protected Measure.MeasureGroupComponent parseMeasureGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
17252    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
17253    parseMeasureGroupComponentProperties(json, res);
17254    return res;
17255  }
17256
17257  protected void parseMeasureGroupComponentProperties(JsonObject json, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
17258    parseBackboneElementProperties(json, res);
17259    if (json.has("code"))
17260      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17261    if (json.has("description"))
17262      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17263    if (json.has("_description"))
17264      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17265    if (json.has("population")) {
17266      JsonArray array = getJArray(json, "population");
17267      for (int i = 0; i < array.size(); i++) {
17268        res.getPopulation().add(parseMeasureGroupPopulationComponent(array.get(i).getAsJsonObject()));
17269      }
17270    };
17271    if (json.has("stratifier")) {
17272      JsonArray array = getJArray(json, "stratifier");
17273      for (int i = 0; i < array.size(); i++) {
17274        res.getStratifier().add(parseMeasureGroupStratifierComponent(array.get(i).getAsJsonObject()));
17275      }
17276    };
17277  }
17278
17279  protected Measure.MeasureGroupPopulationComponent parseMeasureGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
17280    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
17281    parseMeasureGroupPopulationComponentProperties(json, res);
17282    return res;
17283  }
17284
17285  protected void parseMeasureGroupPopulationComponentProperties(JsonObject json, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
17286    parseBackboneElementProperties(json, res);
17287    if (json.has("code"))
17288      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17289    if (json.has("description"))
17290      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17291    if (json.has("_description"))
17292      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17293    if (json.has("criteria"))
17294      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17295  }
17296
17297  protected Measure.MeasureGroupStratifierComponent parseMeasureGroupStratifierComponent(JsonObject json) throws IOException, FHIRFormatError {
17298    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
17299    parseMeasureGroupStratifierComponentProperties(json, res);
17300    return res;
17301  }
17302
17303  protected void parseMeasureGroupStratifierComponentProperties(JsonObject json, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
17304    parseBackboneElementProperties(json, res);
17305    if (json.has("code"))
17306      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17307    if (json.has("description"))
17308      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17309    if (json.has("_description"))
17310      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17311    if (json.has("criteria"))
17312      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17313    if (json.has("component")) {
17314      JsonArray array = getJArray(json, "component");
17315      for (int i = 0; i < array.size(); i++) {
17316        res.getComponent().add(parseMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject()));
17317      }
17318    };
17319  }
17320
17321  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureGroupStratifierComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
17322    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
17323    parseMeasureGroupStratifierComponentComponentProperties(json, res);
17324    return res;
17325  }
17326
17327  protected void parseMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
17328    parseBackboneElementProperties(json, res);
17329    if (json.has("code"))
17330      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17331    if (json.has("description"))
17332      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17333    if (json.has("_description"))
17334      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17335    if (json.has("criteria"))
17336      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17337  }
17338
17339  protected Measure.MeasureSupplementalDataComponent parseMeasureSupplementalDataComponent(JsonObject json) throws IOException, FHIRFormatError {
17340    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
17341    parseMeasureSupplementalDataComponentProperties(json, res);
17342    return res;
17343  }
17344
17345  protected void parseMeasureSupplementalDataComponentProperties(JsonObject json, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
17346    parseBackboneElementProperties(json, res);
17347    if (json.has("code"))
17348      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17349    if (json.has("usage")) {
17350      JsonArray array = getJArray(json, "usage");
17351      for (int i = 0; i < array.size(); i++) {
17352        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17353      }
17354    };
17355    if (json.has("description"))
17356      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17357    if (json.has("_description"))
17358      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17359    if (json.has("criteria"))
17360      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17361  }
17362
17363  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
17364    MeasureReport res = new MeasureReport();
17365    parseMeasureReportProperties(json, res);
17366    return res;
17367  }
17368
17369  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
17370    parseDomainResourceProperties(json, res);
17371    if (json.has("identifier")) {
17372      JsonArray array = getJArray(json, "identifier");
17373      for (int i = 0; i < array.size(); i++) {
17374        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17375      }
17376    };
17377    if (json.has("status"))
17378      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
17379    if (json.has("_status"))
17380      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17381    if (json.has("type"))
17382      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
17383    if (json.has("_type"))
17384      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17385    if (json.has("measure"))
17386      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
17387    if (json.has("_measure"))
17388      parseElementProperties(getJObject(json, "_measure"), res.getMeasureElement());
17389    if (json.has("subject"))
17390      res.setSubject(parseReference(getJObject(json, "subject")));
17391    if (json.has("date"))
17392      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17393    if (json.has("_date"))
17394      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17395    if (json.has("reporter"))
17396      res.setReporter(parseReference(getJObject(json, "reporter")));
17397    if (json.has("period"))
17398      res.setPeriod(parsePeriod(getJObject(json, "period")));
17399    if (json.has("improvementNotation"))
17400      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
17401    if (json.has("group")) {
17402      JsonArray array = getJArray(json, "group");
17403      for (int i = 0; i < array.size(); i++) {
17404        res.getGroup().add(parseMeasureReportGroupComponent(array.get(i).getAsJsonObject()));
17405      }
17406    };
17407    if (json.has("evaluatedResource")) {
17408      JsonArray array = getJArray(json, "evaluatedResource");
17409      for (int i = 0; i < array.size(); i++) {
17410        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
17411      }
17412    };
17413  }
17414
17415  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
17416    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
17417    parseMeasureReportGroupComponentProperties(json, res);
17418    return res;
17419  }
17420
17421  protected void parseMeasureReportGroupComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
17422    parseBackboneElementProperties(json, res);
17423    if (json.has("code"))
17424      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17425    if (json.has("population")) {
17426      JsonArray array = getJArray(json, "population");
17427      for (int i = 0; i < array.size(); i++) {
17428        res.getPopulation().add(parseMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject()));
17429      }
17430    };
17431    if (json.has("measureScore"))
17432      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
17433    if (json.has("stratifier")) {
17434      JsonArray array = getJArray(json, "stratifier");
17435      for (int i = 0; i < array.size(); i++) {
17436        res.getStratifier().add(parseMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject()));
17437      }
17438    };
17439  }
17440
17441  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
17442    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
17443    parseMeasureReportGroupPopulationComponentProperties(json, res);
17444    return res;
17445  }
17446
17447  protected void parseMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
17448    parseBackboneElementProperties(json, res);
17449    if (json.has("code"))
17450      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17451    if (json.has("count"))
17452      res.setCountElement(parseInteger(json.get("count").getAsLong()));
17453    if (json.has("_count"))
17454      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
17455    if (json.has("subjectResults"))
17456      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
17457  }
17458
17459  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportGroupStratifierComponent(JsonObject json) throws IOException, FHIRFormatError {
17460    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
17461    parseMeasureReportGroupStratifierComponentProperties(json, res);
17462    return res;
17463  }
17464
17465  protected void parseMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
17466    parseBackboneElementProperties(json, res);
17467    if (json.has("code")) {
17468      JsonArray array = getJArray(json, "code");
17469      for (int i = 0; i < array.size(); i++) {
17470        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17471      }
17472    };
17473    if (json.has("stratum")) {
17474      JsonArray array = getJArray(json, "stratum");
17475      for (int i = 0; i < array.size(); i++) {
17476        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject()));
17477      }
17478    };
17479  }
17480
17481  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
17482    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
17483    parseMeasureReportStratifierGroupComponentProperties(json, res);
17484    return res;
17485  }
17486
17487  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
17488    parseBackboneElementProperties(json, res);
17489    if (json.has("value"))
17490      res.setValue(parseCodeableConcept(getJObject(json, "value")));
17491    if (json.has("component")) {
17492      JsonArray array = getJArray(json, "component");
17493      for (int i = 0; i < array.size(); i++) {
17494        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject()));
17495      }
17496    };
17497    if (json.has("population")) {
17498      JsonArray array = getJArray(json, "population");
17499      for (int i = 0; i < array.size(); i++) {
17500        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject()));
17501      }
17502    };
17503    if (json.has("measureScore"))
17504      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
17505  }
17506
17507  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
17508    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
17509    parseMeasureReportStratifierGroupComponentComponentProperties(json, res);
17510    return res;
17511  }
17512
17513  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
17514    parseBackboneElementProperties(json, res);
17515    if (json.has("code"))
17516      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17517    if (json.has("value"))
17518      res.setValue(parseCodeableConcept(getJObject(json, "value")));
17519  }
17520
17521  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
17522    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
17523    parseMeasureReportStratifierGroupPopulationComponentProperties(json, res);
17524    return res;
17525  }
17526
17527  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
17528    parseBackboneElementProperties(json, res);
17529    if (json.has("code"))
17530      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17531    if (json.has("count"))
17532      res.setCountElement(parseInteger(json.get("count").getAsLong()));
17533    if (json.has("_count"))
17534      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
17535    if (json.has("subjectResults"))
17536      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
17537  }
17538
17539  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
17540    Media res = new Media();
17541    parseMediaProperties(json, res);
17542    return res;
17543  }
17544
17545  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
17546    parseDomainResourceProperties(json, res);
17547    if (json.has("identifier")) {
17548      JsonArray array = getJArray(json, "identifier");
17549      for (int i = 0; i < array.size(); i++) {
17550        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17551      }
17552    };
17553    if (json.has("basedOn")) {
17554      JsonArray array = getJArray(json, "basedOn");
17555      for (int i = 0; i < array.size(); i++) {
17556        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17557      }
17558    };
17559    if (json.has("partOf")) {
17560      JsonArray array = getJArray(json, "partOf");
17561      for (int i = 0; i < array.size(); i++) {
17562        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17563      }
17564    };
17565    if (json.has("status"))
17566      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
17567    if (json.has("_status"))
17568      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17569    if (json.has("type"))
17570      res.setType(parseCodeableConcept(getJObject(json, "type")));
17571    if (json.has("modality"))
17572      res.setModality(parseCodeableConcept(getJObject(json, "modality")));
17573    if (json.has("view"))
17574      res.setView(parseCodeableConcept(getJObject(json, "view")));
17575    if (json.has("subject"))
17576      res.setSubject(parseReference(getJObject(json, "subject")));
17577    if (json.has("encounter"))
17578      res.setEncounter(parseReference(getJObject(json, "encounter")));
17579    DataType created = parseType("created", json);
17580    if (created != null)
17581      res.setCreated(created);
17582    if (json.has("issued"))
17583      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
17584    if (json.has("_issued"))
17585      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
17586    if (json.has("operator"))
17587      res.setOperator(parseReference(getJObject(json, "operator")));
17588    if (json.has("reasonCode")) {
17589      JsonArray array = getJArray(json, "reasonCode");
17590      for (int i = 0; i < array.size(); i++) {
17591        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17592      }
17593    };
17594    if (json.has("bodySite"))
17595      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
17596    if (json.has("deviceName"))
17597      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
17598    if (json.has("_deviceName"))
17599      parseElementProperties(getJObject(json, "_deviceName"), res.getDeviceNameElement());
17600    if (json.has("device"))
17601      res.setDevice(parseReference(getJObject(json, "device")));
17602    if (json.has("height"))
17603      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
17604    if (json.has("_height"))
17605      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
17606    if (json.has("width"))
17607      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
17608    if (json.has("_width"))
17609      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
17610    if (json.has("frames"))
17611      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
17612    if (json.has("_frames"))
17613      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
17614    if (json.has("duration"))
17615      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
17616    if (json.has("_duration"))
17617      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
17618    if (json.has("content"))
17619      res.setContent(parseAttachment(getJObject(json, "content")));
17620    if (json.has("note")) {
17621      JsonArray array = getJArray(json, "note");
17622      for (int i = 0; i < array.size(); i++) {
17623        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17624      }
17625    };
17626  }
17627
17628  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
17629    Medication res = new Medication();
17630    parseMedicationProperties(json, res);
17631    return res;
17632  }
17633
17634  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
17635    parseDomainResourceProperties(json, res);
17636    if (json.has("identifier")) {
17637      JsonArray array = getJArray(json, "identifier");
17638      for (int i = 0; i < array.size(); i++) {
17639        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17640      }
17641    };
17642    if (json.has("code"))
17643      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17644    if (json.has("status"))
17645      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatusCodes.NULL, new Medication.MedicationStatusCodesEnumFactory()));
17646    if (json.has("_status"))
17647      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17648    if (json.has("manufacturer"))
17649      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
17650    if (json.has("form"))
17651      res.setForm(parseCodeableConcept(getJObject(json, "form")));
17652    if (json.has("amount"))
17653      res.setAmount(parseRatio(getJObject(json, "amount")));
17654    if (json.has("ingredient")) {
17655      JsonArray array = getJArray(json, "ingredient");
17656      for (int i = 0; i < array.size(); i++) {
17657        res.getIngredient().add(parseMedicationIngredientComponent(array.get(i).getAsJsonObject()));
17658      }
17659    };
17660    if (json.has("batch"))
17661      res.setBatch(parseMedicationBatchComponent(getJObject(json, "batch")));
17662  }
17663
17664  protected Medication.MedicationIngredientComponent parseMedicationIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
17665    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
17666    parseMedicationIngredientComponentProperties(json, res);
17667    return res;
17668  }
17669
17670  protected void parseMedicationIngredientComponentProperties(JsonObject json, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
17671    parseBackboneElementProperties(json, res);
17672    DataType item = parseType("item", json);
17673    if (item != null)
17674      res.setItem(item);
17675    if (json.has("isActive"))
17676      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
17677    if (json.has("_isActive"))
17678      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
17679    if (json.has("strength"))
17680      res.setStrength(parseRatio(getJObject(json, "strength")));
17681  }
17682
17683  protected Medication.MedicationBatchComponent parseMedicationBatchComponent(JsonObject json) throws IOException, FHIRFormatError {
17684    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
17685    parseMedicationBatchComponentProperties(json, res);
17686    return res;
17687  }
17688
17689  protected void parseMedicationBatchComponentProperties(JsonObject json, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
17690    parseBackboneElementProperties(json, res);
17691    if (json.has("lotNumber"))
17692      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
17693    if (json.has("_lotNumber"))
17694      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
17695    if (json.has("expirationDate"))
17696      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
17697    if (json.has("_expirationDate"))
17698      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
17699  }
17700
17701  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
17702    MedicationAdministration res = new MedicationAdministration();
17703    parseMedicationAdministrationProperties(json, res);
17704    return res;
17705  }
17706
17707  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
17708    parseDomainResourceProperties(json, res);
17709    if (json.has("identifier")) {
17710      JsonArray array = getJArray(json, "identifier");
17711      for (int i = 0; i < array.size(); i++) {
17712        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17713      }
17714    };
17715    if (json.has("instantiates")) {
17716      JsonArray array = getJArray(json, "instantiates");
17717      for (int i = 0; i < array.size(); i++) {
17718        if (array.get(i).isJsonNull()) {
17719          res.getInstantiates().add(new UriType());
17720        } else {;
17721          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
17722        }
17723      }
17724    };
17725    if (json.has("_instantiates")) {
17726      JsonArray array = getJArray(json, "_instantiates");
17727      for (int i = 0; i < array.size(); i++) {
17728        if (i == res.getInstantiates().size())
17729          res.getInstantiates().add(parseUri(null));
17730        if (array.get(i) instanceof JsonObject) 
17731          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
17732      }
17733    };
17734    if (json.has("partOf")) {
17735      JsonArray array = getJArray(json, "partOf");
17736      for (int i = 0; i < array.size(); i++) {
17737        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17738      }
17739    };
17740    if (json.has("status"))
17741      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatusCodes.NULL, new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory()));
17742    if (json.has("_status"))
17743      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17744    if (json.has("statusReason")) {
17745      JsonArray array = getJArray(json, "statusReason");
17746      for (int i = 0; i < array.size(); i++) {
17747        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17748      }
17749    };
17750    if (json.has("category"))
17751      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
17752    DataType medication = parseType("medication", json);
17753    if (medication != null)
17754      res.setMedication(medication);
17755    if (json.has("subject"))
17756      res.setSubject(parseReference(getJObject(json, "subject")));
17757    if (json.has("context"))
17758      res.setContext(parseReference(getJObject(json, "context")));
17759    if (json.has("supportingInformation")) {
17760      JsonArray array = getJArray(json, "supportingInformation");
17761      for (int i = 0; i < array.size(); i++) {
17762        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17763      }
17764    };
17765    DataType effective = parseType("effective", json);
17766    if (effective != null)
17767      res.setEffective(effective);
17768    if (json.has("performer")) {
17769      JsonArray array = getJArray(json, "performer");
17770      for (int i = 0; i < array.size(); i++) {
17771        res.getPerformer().add(parseMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject()));
17772      }
17773    };
17774    if (json.has("reasonCode")) {
17775      JsonArray array = getJArray(json, "reasonCode");
17776      for (int i = 0; i < array.size(); i++) {
17777        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17778      }
17779    };
17780    if (json.has("reasonReference")) {
17781      JsonArray array = getJArray(json, "reasonReference");
17782      for (int i = 0; i < array.size(); i++) {
17783        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
17784      }
17785    };
17786    if (json.has("request"))
17787      res.setRequest(parseReference(getJObject(json, "request")));
17788    if (json.has("device")) {
17789      JsonArray array = getJArray(json, "device");
17790      for (int i = 0; i < array.size(); i++) {
17791        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17792      }
17793    };
17794    if (json.has("note")) {
17795      JsonArray array = getJArray(json, "note");
17796      for (int i = 0; i < array.size(); i++) {
17797        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17798      }
17799    };
17800    if (json.has("dosage"))
17801      res.setDosage(parseMedicationAdministrationDosageComponent(getJObject(json, "dosage")));
17802    if (json.has("eventHistory")) {
17803      JsonArray array = getJArray(json, "eventHistory");
17804      for (int i = 0; i < array.size(); i++) {
17805        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17806      }
17807    };
17808  }
17809
17810  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
17811    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
17812    parseMedicationAdministrationPerformerComponentProperties(json, res);
17813    return res;
17814  }
17815
17816  protected void parseMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
17817    parseBackboneElementProperties(json, res);
17818    if (json.has("function"))
17819      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
17820    if (json.has("actor"))
17821      res.setActor(parseReference(getJObject(json, "actor")));
17822  }
17823
17824  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationDosageComponent(JsonObject json) throws IOException, FHIRFormatError {
17825    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
17826    parseMedicationAdministrationDosageComponentProperties(json, res);
17827    return res;
17828  }
17829
17830  protected void parseMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
17831    parseBackboneElementProperties(json, res);
17832    if (json.has("text"))
17833      res.setTextElement(parseString(json.get("text").getAsString()));
17834    if (json.has("_text"))
17835      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
17836    if (json.has("site"))
17837      res.setSite(parseCodeableConcept(getJObject(json, "site")));
17838    if (json.has("route"))
17839      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
17840    if (json.has("method"))
17841      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
17842    if (json.has("dose"))
17843      res.setDose(parseQuantity(getJObject(json, "dose")));
17844    DataType rate = parseType("rate", json);
17845    if (rate != null)
17846      res.setRate(rate);
17847  }
17848
17849  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
17850    MedicationDispense res = new MedicationDispense();
17851    parseMedicationDispenseProperties(json, res);
17852    return res;
17853  }
17854
17855  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
17856    parseDomainResourceProperties(json, res);
17857    if (json.has("identifier")) {
17858      JsonArray array = getJArray(json, "identifier");
17859      for (int i = 0; i < array.size(); i++) {
17860        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17861      }
17862    };
17863    if (json.has("partOf")) {
17864      JsonArray array = getJArray(json, "partOf");
17865      for (int i = 0; i < array.size(); i++) {
17866        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17867      }
17868    };
17869    if (json.has("status"))
17870      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatusCodes.NULL, new MedicationDispense.MedicationDispenseStatusCodesEnumFactory()));
17871    if (json.has("_status"))
17872      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17873    DataType statusReason = parseType("statusReason", json);
17874    if (statusReason != null)
17875      res.setStatusReason(statusReason);
17876    if (json.has("category"))
17877      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
17878    DataType medication = parseType("medication", json);
17879    if (medication != null)
17880      res.setMedication(medication);
17881    if (json.has("subject"))
17882      res.setSubject(parseReference(getJObject(json, "subject")));
17883    if (json.has("context"))
17884      res.setContext(parseReference(getJObject(json, "context")));
17885    if (json.has("supportingInformation")) {
17886      JsonArray array = getJArray(json, "supportingInformation");
17887      for (int i = 0; i < array.size(); i++) {
17888        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17889      }
17890    };
17891    if (json.has("performer")) {
17892      JsonArray array = getJArray(json, "performer");
17893      for (int i = 0; i < array.size(); i++) {
17894        res.getPerformer().add(parseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject()));
17895      }
17896    };
17897    if (json.has("location"))
17898      res.setLocation(parseReference(getJObject(json, "location")));
17899    if (json.has("authorizingPrescription")) {
17900      JsonArray array = getJArray(json, "authorizingPrescription");
17901      for (int i = 0; i < array.size(); i++) {
17902        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
17903      }
17904    };
17905    if (json.has("type"))
17906      res.setType(parseCodeableConcept(getJObject(json, "type")));
17907    if (json.has("quantity"))
17908      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
17909    if (json.has("daysSupply"))
17910      res.setDaysSupply(parseQuantity(getJObject(json, "daysSupply")));
17911    if (json.has("whenPrepared"))
17912      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
17913    if (json.has("_whenPrepared"))
17914      parseElementProperties(getJObject(json, "_whenPrepared"), res.getWhenPreparedElement());
17915    if (json.has("whenHandedOver"))
17916      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
17917    if (json.has("_whenHandedOver"))
17918      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
17919    if (json.has("destination"))
17920      res.setDestination(parseReference(getJObject(json, "destination")));
17921    if (json.has("receiver")) {
17922      JsonArray array = getJArray(json, "receiver");
17923      for (int i = 0; i < array.size(); i++) {
17924        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
17925      }
17926    };
17927    if (json.has("note")) {
17928      JsonArray array = getJArray(json, "note");
17929      for (int i = 0; i < array.size(); i++) {
17930        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17931      }
17932    };
17933    if (json.has("dosageInstruction")) {
17934      JsonArray array = getJArray(json, "dosageInstruction");
17935      for (int i = 0; i < array.size(); i++) {
17936        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
17937      }
17938    };
17939    if (json.has("substitution"))
17940      res.setSubstitution(parseMedicationDispenseSubstitutionComponent(getJObject(json, "substitution")));
17941    if (json.has("detectedIssue")) {
17942      JsonArray array = getJArray(json, "detectedIssue");
17943      for (int i = 0; i < array.size(); i++) {
17944        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
17945      }
17946    };
17947    if (json.has("eventHistory")) {
17948      JsonArray array = getJArray(json, "eventHistory");
17949      for (int i = 0; i < array.size(); i++) {
17950        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17951      }
17952    };
17953  }
17954
17955  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispensePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
17956    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
17957    parseMedicationDispensePerformerComponentProperties(json, res);
17958    return res;
17959  }
17960
17961  protected void parseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
17962    parseBackboneElementProperties(json, res);
17963    if (json.has("function"))
17964      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
17965    if (json.has("actor"))
17966      res.setActor(parseReference(getJObject(json, "actor")));
17967  }
17968
17969  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseSubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
17970    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
17971    parseMedicationDispenseSubstitutionComponentProperties(json, res);
17972    return res;
17973  }
17974
17975  protected void parseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
17976    parseBackboneElementProperties(json, res);
17977    if (json.has("wasSubstituted"))
17978      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
17979    if (json.has("_wasSubstituted"))
17980      parseElementProperties(getJObject(json, "_wasSubstituted"), res.getWasSubstitutedElement());
17981    if (json.has("type"))
17982      res.setType(parseCodeableConcept(getJObject(json, "type")));
17983    if (json.has("reason")) {
17984      JsonArray array = getJArray(json, "reason");
17985      for (int i = 0; i < array.size(); i++) {
17986        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17987      }
17988    };
17989    if (json.has("responsibleParty")) {
17990      JsonArray array = getJArray(json, "responsibleParty");
17991      for (int i = 0; i < array.size(); i++) {
17992        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
17993      }
17994    };
17995  }
17996
17997  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
17998    MedicationKnowledge res = new MedicationKnowledge();
17999    parseMedicationKnowledgeProperties(json, res);
18000    return res;
18001  }
18002
18003  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
18004    parseDomainResourceProperties(json, res);
18005    if (json.has("code"))
18006      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18007    if (json.has("status"))
18008      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatusCodes.NULL, new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory()));
18009    if (json.has("_status"))
18010      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18011    if (json.has("manufacturer"))
18012      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
18013    if (json.has("doseForm"))
18014      res.setDoseForm(parseCodeableConcept(getJObject(json, "doseForm")));
18015    if (json.has("amount"))
18016      res.setAmount(parseQuantity(getJObject(json, "amount")));
18017    if (json.has("synonym")) {
18018      JsonArray array = getJArray(json, "synonym");
18019      for (int i = 0; i < array.size(); i++) {
18020        if (array.get(i).isJsonNull()) {
18021          res.getSynonym().add(new StringType());
18022        } else {;
18023          res.getSynonym().add(parseString(array.get(i).getAsString()));
18024        }
18025      }
18026    };
18027    if (json.has("_synonym")) {
18028      JsonArray array = getJArray(json, "_synonym");
18029      for (int i = 0; i < array.size(); i++) {
18030        if (i == res.getSynonym().size())
18031          res.getSynonym().add(parseString(null));
18032        if (array.get(i) instanceof JsonObject) 
18033          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
18034      }
18035    };
18036    if (json.has("relatedMedicationKnowledge")) {
18037      JsonArray array = getJArray(json, "relatedMedicationKnowledge");
18038      for (int i = 0; i < array.size(); i++) {
18039        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject()));
18040      }
18041    };
18042    if (json.has("associatedMedication")) {
18043      JsonArray array = getJArray(json, "associatedMedication");
18044      for (int i = 0; i < array.size(); i++) {
18045        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
18046      }
18047    };
18048    if (json.has("productType")) {
18049      JsonArray array = getJArray(json, "productType");
18050      for (int i = 0; i < array.size(); i++) {
18051        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18052      }
18053    };
18054    if (json.has("monograph")) {
18055      JsonArray array = getJArray(json, "monograph");
18056      for (int i = 0; i < array.size(); i++) {
18057        res.getMonograph().add(parseMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject()));
18058      }
18059    };
18060    if (json.has("ingredient")) {
18061      JsonArray array = getJArray(json, "ingredient");
18062      for (int i = 0; i < array.size(); i++) {
18063        res.getIngredient().add(parseMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject()));
18064      }
18065    };
18066    if (json.has("preparationInstruction"))
18067      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
18068    if (json.has("_preparationInstruction"))
18069      parseElementProperties(getJObject(json, "_preparationInstruction"), res.getPreparationInstructionElement());
18070    if (json.has("intendedRoute")) {
18071      JsonArray array = getJArray(json, "intendedRoute");
18072      for (int i = 0; i < array.size(); i++) {
18073        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18074      }
18075    };
18076    if (json.has("cost")) {
18077      JsonArray array = getJArray(json, "cost");
18078      for (int i = 0; i < array.size(); i++) {
18079        res.getCost().add(parseMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject()));
18080      }
18081    };
18082    if (json.has("monitoringProgram")) {
18083      JsonArray array = getJArray(json, "monitoringProgram");
18084      for (int i = 0; i < array.size(); i++) {
18085        res.getMonitoringProgram().add(parseMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject()));
18086      }
18087    };
18088    if (json.has("administrationGuidelines")) {
18089      JsonArray array = getJArray(json, "administrationGuidelines");
18090      for (int i = 0; i < array.size(); i++) {
18091        res.getAdministrationGuidelines().add(parseMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject()));
18092      }
18093    };
18094    if (json.has("medicineClassification")) {
18095      JsonArray array = getJArray(json, "medicineClassification");
18096      for (int i = 0; i < array.size(); i++) {
18097        res.getMedicineClassification().add(parseMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject()));
18098      }
18099    };
18100    if (json.has("packaging"))
18101      res.setPackaging(parseMedicationKnowledgePackagingComponent(getJObject(json, "packaging")));
18102    if (json.has("drugCharacteristic")) {
18103      JsonArray array = getJArray(json, "drugCharacteristic");
18104      for (int i = 0; i < array.size(); i++) {
18105        res.getDrugCharacteristic().add(parseMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject()));
18106      }
18107    };
18108    if (json.has("contraindication")) {
18109      JsonArray array = getJArray(json, "contraindication");
18110      for (int i = 0; i < array.size(); i++) {
18111        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
18112      }
18113    };
18114    if (json.has("regulatory")) {
18115      JsonArray array = getJArray(json, "regulatory");
18116      for (int i = 0; i < array.size(); i++) {
18117        res.getRegulatory().add(parseMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject()));
18118      }
18119    };
18120    if (json.has("kinetics")) {
18121      JsonArray array = getJArray(json, "kinetics");
18122      for (int i = 0; i < array.size(); i++) {
18123        res.getKinetics().add(parseMedicationKnowledgeKineticsComponent(array.get(i).getAsJsonObject()));
18124      }
18125    };
18126  }
18127
18128  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json) throws IOException, FHIRFormatError {
18129    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
18130    parseMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, res);
18131    return res;
18132  }
18133
18134  protected void parseMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
18135    parseBackboneElementProperties(json, res);
18136    if (json.has("type"))
18137      res.setType(parseCodeableConcept(getJObject(json, "type")));
18138    if (json.has("reference")) {
18139      JsonArray array = getJArray(json, "reference");
18140      for (int i = 0; i < array.size(); i++) {
18141        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
18142      }
18143    };
18144  }
18145
18146  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMonographComponent(JsonObject json) throws IOException, FHIRFormatError {
18147    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
18148    parseMedicationKnowledgeMonographComponentProperties(json, res);
18149    return res;
18150  }
18151
18152  protected void parseMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
18153    parseBackboneElementProperties(json, res);
18154    if (json.has("type"))
18155      res.setType(parseCodeableConcept(getJObject(json, "type")));
18156    if (json.has("source"))
18157      res.setSource(parseReference(getJObject(json, "source")));
18158  }
18159
18160  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
18161    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
18162    parseMedicationKnowledgeIngredientComponentProperties(json, res);
18163    return res;
18164  }
18165
18166  protected void parseMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
18167    parseBackboneElementProperties(json, res);
18168    DataType item = parseType("item", json);
18169    if (item != null)
18170      res.setItem(item);
18171    if (json.has("isActive"))
18172      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
18173    if (json.has("_isActive"))
18174      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
18175    if (json.has("strength"))
18176      res.setStrength(parseRatio(getJObject(json, "strength")));
18177  }
18178
18179  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeCostComponent(JsonObject json) throws IOException, FHIRFormatError {
18180    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
18181    parseMedicationKnowledgeCostComponentProperties(json, res);
18182    return res;
18183  }
18184
18185  protected void parseMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
18186    parseBackboneElementProperties(json, res);
18187    if (json.has("type"))
18188      res.setType(parseCodeableConcept(getJObject(json, "type")));
18189    if (json.has("source"))
18190      res.setSourceElement(parseString(json.get("source").getAsString()));
18191    if (json.has("_source"))
18192      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
18193    if (json.has("cost"))
18194      res.setCost(parseMoney(getJObject(json, "cost")));
18195  }
18196
18197  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMonitoringProgramComponent(JsonObject json) throws IOException, FHIRFormatError {
18198    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
18199    parseMedicationKnowledgeMonitoringProgramComponentProperties(json, res);
18200    return res;
18201  }
18202
18203  protected void parseMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
18204    parseBackboneElementProperties(json, res);
18205    if (json.has("type"))
18206      res.setType(parseCodeableConcept(getJObject(json, "type")));
18207    if (json.has("name"))
18208      res.setNameElement(parseString(json.get("name").getAsString()));
18209    if (json.has("_name"))
18210      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18211  }
18212
18213  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeAdministrationGuidelinesComponent(JsonObject json) throws IOException, FHIRFormatError {
18214    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
18215    parseMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, res);
18216    return res;
18217  }
18218
18219  protected void parseMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res) throws IOException, FHIRFormatError {
18220    parseBackboneElementProperties(json, res);
18221    if (json.has("dosage")) {
18222      JsonArray array = getJArray(json, "dosage");
18223      for (int i = 0; i < array.size(); i++) {
18224        res.getDosage().add(parseMedicationKnowledgeAdministrationGuidelinesDosageComponent(array.get(i).getAsJsonObject()));
18225      }
18226    };
18227    DataType indication = parseType("indication", json);
18228    if (indication != null)
18229      res.setIndication(indication);
18230    if (json.has("patientCharacteristics")) {
18231      JsonArray array = getJArray(json, "patientCharacteristics");
18232      for (int i = 0; i < array.size(); i++) {
18233        res.getPatientCharacteristics().add(parseMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(array.get(i).getAsJsonObject()));
18234      }
18235    };
18236  }
18237
18238  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeAdministrationGuidelinesDosageComponent(JsonObject json) throws IOException, FHIRFormatError {
18239    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
18240    parseMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(json, res);
18241    return res;
18242  }
18243
18244  protected void parseMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res) throws IOException, FHIRFormatError {
18245    parseBackboneElementProperties(json, res);
18246    if (json.has("type"))
18247      res.setType(parseCodeableConcept(getJObject(json, "type")));
18248    if (json.has("dosage")) {
18249      JsonArray array = getJArray(json, "dosage");
18250      for (int i = 0; i < array.size(); i++) {
18251        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
18252      }
18253    };
18254  }
18255
18256  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(JsonObject json) throws IOException, FHIRFormatError {
18257    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
18258    parseMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json, res);
18259    return res;
18260  }
18261
18262  protected void parseMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res) throws IOException, FHIRFormatError {
18263    parseBackboneElementProperties(json, res);
18264    DataType characteristic = parseType("characteristic", json);
18265    if (characteristic != null)
18266      res.setCharacteristic(characteristic);
18267    if (json.has("value")) {
18268      JsonArray array = getJArray(json, "value");
18269      for (int i = 0; i < array.size(); i++) {
18270        if (array.get(i).isJsonNull()) {
18271          res.getValue().add(new StringType());
18272        } else {;
18273          res.getValue().add(parseString(array.get(i).getAsString()));
18274        }
18275      }
18276    };
18277    if (json.has("_value")) {
18278      JsonArray array = getJArray(json, "_value");
18279      for (int i = 0; i < array.size(); i++) {
18280        if (i == res.getValue().size())
18281          res.getValue().add(parseString(null));
18282        if (array.get(i) instanceof JsonObject) 
18283          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
18284      }
18285    };
18286  }
18287
18288  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicineClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
18289    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
18290    parseMedicationKnowledgeMedicineClassificationComponentProperties(json, res);
18291    return res;
18292  }
18293
18294  protected void parseMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
18295    parseBackboneElementProperties(json, res);
18296    if (json.has("type"))
18297      res.setType(parseCodeableConcept(getJObject(json, "type")));
18298    if (json.has("classification")) {
18299      JsonArray array = getJArray(json, "classification");
18300      for (int i = 0; i < array.size(); i++) {
18301        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18302      }
18303    };
18304  }
18305
18306  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgePackagingComponent(JsonObject json) throws IOException, FHIRFormatError {
18307    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
18308    parseMedicationKnowledgePackagingComponentProperties(json, res);
18309    return res;
18310  }
18311
18312  protected void parseMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
18313    parseBackboneElementProperties(json, res);
18314    if (json.has("type"))
18315      res.setType(parseCodeableConcept(getJObject(json, "type")));
18316    if (json.has("quantity"))
18317      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18318  }
18319
18320  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeDrugCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
18321    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
18322    parseMedicationKnowledgeDrugCharacteristicComponentProperties(json, res);
18323    return res;
18324  }
18325
18326  protected void parseMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
18327    parseBackboneElementProperties(json, res);
18328    if (json.has("type"))
18329      res.setType(parseCodeableConcept(getJObject(json, "type")));
18330    DataType value = parseType("value", json);
18331    if (value != null)
18332      res.setValue(value);
18333  }
18334
18335  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeRegulatoryComponent(JsonObject json) throws IOException, FHIRFormatError {
18336    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
18337    parseMedicationKnowledgeRegulatoryComponentProperties(json, res);
18338    return res;
18339  }
18340
18341  protected void parseMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
18342    parseBackboneElementProperties(json, res);
18343    if (json.has("regulatoryAuthority"))
18344      res.setRegulatoryAuthority(parseReference(getJObject(json, "regulatoryAuthority")));
18345    if (json.has("substitution")) {
18346      JsonArray array = getJArray(json, "substitution");
18347      for (int i = 0; i < array.size(); i++) {
18348        res.getSubstitution().add(parseMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject()));
18349      }
18350    };
18351    if (json.has("schedule")) {
18352      JsonArray array = getJArray(json, "schedule");
18353      for (int i = 0; i < array.size(); i++) {
18354        res.getSchedule().add(parseMedicationKnowledgeRegulatoryScheduleComponent(array.get(i).getAsJsonObject()));
18355      }
18356    };
18357    if (json.has("maxDispense"))
18358      res.setMaxDispense(parseMedicationKnowledgeRegulatoryMaxDispenseComponent(getJObject(json, "maxDispense")));
18359  }
18360
18361  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
18362    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
18363    parseMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, res);
18364    return res;
18365  }
18366
18367  protected void parseMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
18368    parseBackboneElementProperties(json, res);
18369    if (json.has("type"))
18370      res.setType(parseCodeableConcept(getJObject(json, "type")));
18371    if (json.has("allowed"))
18372      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
18373    if (json.has("_allowed"))
18374      parseElementProperties(getJObject(json, "_allowed"), res.getAllowedElement());
18375  }
18376
18377  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeRegulatoryScheduleComponent(JsonObject json) throws IOException, FHIRFormatError {
18378    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
18379    parseMedicationKnowledgeRegulatoryScheduleComponentProperties(json, res);
18380    return res;
18381  }
18382
18383  protected void parseMedicationKnowledgeRegulatoryScheduleComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res) throws IOException, FHIRFormatError {
18384    parseBackboneElementProperties(json, res);
18385    if (json.has("schedule"))
18386      res.setSchedule(parseCodeableConcept(getJObject(json, "schedule")));
18387  }
18388
18389  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json) throws IOException, FHIRFormatError {
18390    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
18391    parseMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, res);
18392    return res;
18393  }
18394
18395  protected void parseMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
18396    parseBackboneElementProperties(json, res);
18397    if (json.has("quantity"))
18398      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18399    if (json.has("period"))
18400      res.setPeriod(parseDuration(getJObject(json, "period")));
18401  }
18402
18403  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeKineticsComponent(JsonObject json) throws IOException, FHIRFormatError {
18404    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
18405    parseMedicationKnowledgeKineticsComponentProperties(json, res);
18406    return res;
18407  }
18408
18409  protected void parseMedicationKnowledgeKineticsComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeKineticsComponent res) throws IOException, FHIRFormatError {
18410    parseBackboneElementProperties(json, res);
18411    if (json.has("areaUnderCurve")) {
18412      JsonArray array = getJArray(json, "areaUnderCurve");
18413      for (int i = 0; i < array.size(); i++) {
18414        res.getAreaUnderCurve().add(parseQuantity(array.get(i).getAsJsonObject()));
18415      }
18416    };
18417    if (json.has("lethalDose50")) {
18418      JsonArray array = getJArray(json, "lethalDose50");
18419      for (int i = 0; i < array.size(); i++) {
18420        res.getLethalDose50().add(parseQuantity(array.get(i).getAsJsonObject()));
18421      }
18422    };
18423    if (json.has("halfLifePeriod"))
18424      res.setHalfLifePeriod(parseDuration(getJObject(json, "halfLifePeriod")));
18425  }
18426
18427  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
18428    MedicationRequest res = new MedicationRequest();
18429    parseMedicationRequestProperties(json, res);
18430    return res;
18431  }
18432
18433  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
18434    parseDomainResourceProperties(json, res);
18435    if (json.has("identifier")) {
18436      JsonArray array = getJArray(json, "identifier");
18437      for (int i = 0; i < array.size(); i++) {
18438        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18439      }
18440    };
18441    if (json.has("status"))
18442      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationrequestStatus.NULL, new MedicationRequest.MedicationrequestStatusEnumFactory()));
18443    if (json.has("_status"))
18444      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18445    if (json.has("statusReason"))
18446      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
18447    if (json.has("intent"))
18448      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
18449    if (json.has("_intent"))
18450      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
18451    if (json.has("category")) {
18452      JsonArray array = getJArray(json, "category");
18453      for (int i = 0; i < array.size(); i++) {
18454        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18455      }
18456    };
18457    if (json.has("priority"))
18458      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
18459    if (json.has("_priority"))
18460      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
18461    if (json.has("doNotPerform"))
18462      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
18463    if (json.has("_doNotPerform"))
18464      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
18465    DataType reported = parseType("reported", json);
18466    if (reported != null)
18467      res.setReported(reported);
18468    DataType medication = parseType("medication", json);
18469    if (medication != null)
18470      res.setMedication(medication);
18471    if (json.has("subject"))
18472      res.setSubject(parseReference(getJObject(json, "subject")));
18473    if (json.has("encounter"))
18474      res.setEncounter(parseReference(getJObject(json, "encounter")));
18475    if (json.has("supportingInformation")) {
18476      JsonArray array = getJArray(json, "supportingInformation");
18477      for (int i = 0; i < array.size(); i++) {
18478        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
18479      }
18480    };
18481    if (json.has("authoredOn"))
18482      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
18483    if (json.has("_authoredOn"))
18484      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
18485    if (json.has("requester"))
18486      res.setRequester(parseReference(getJObject(json, "requester")));
18487    if (json.has("performer"))
18488      res.setPerformer(parseReference(getJObject(json, "performer")));
18489    if (json.has("performerType"))
18490      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
18491    if (json.has("recorder"))
18492      res.setRecorder(parseReference(getJObject(json, "recorder")));
18493    if (json.has("reasonCode")) {
18494      JsonArray array = getJArray(json, "reasonCode");
18495      for (int i = 0; i < array.size(); i++) {
18496        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18497      }
18498    };
18499    if (json.has("reasonReference")) {
18500      JsonArray array = getJArray(json, "reasonReference");
18501      for (int i = 0; i < array.size(); i++) {
18502        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
18503      }
18504    };
18505    if (json.has("instantiatesCanonical")) {
18506      JsonArray array = getJArray(json, "instantiatesCanonical");
18507      for (int i = 0; i < array.size(); i++) {
18508        if (array.get(i).isJsonNull()) {
18509          res.getInstantiatesCanonical().add(new CanonicalType());
18510        } else {;
18511          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
18512        }
18513      }
18514    };
18515    if (json.has("_instantiatesCanonical")) {
18516      JsonArray array = getJArray(json, "_instantiatesCanonical");
18517      for (int i = 0; i < array.size(); i++) {
18518        if (i == res.getInstantiatesCanonical().size())
18519          res.getInstantiatesCanonical().add(parseCanonical(null));
18520        if (array.get(i) instanceof JsonObject) 
18521          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
18522      }
18523    };
18524    if (json.has("instantiatesUri")) {
18525      JsonArray array = getJArray(json, "instantiatesUri");
18526      for (int i = 0; i < array.size(); i++) {
18527        if (array.get(i).isJsonNull()) {
18528          res.getInstantiatesUri().add(new UriType());
18529        } else {;
18530          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
18531        }
18532      }
18533    };
18534    if (json.has("_instantiatesUri")) {
18535      JsonArray array = getJArray(json, "_instantiatesUri");
18536      for (int i = 0; i < array.size(); i++) {
18537        if (i == res.getInstantiatesUri().size())
18538          res.getInstantiatesUri().add(parseUri(null));
18539        if (array.get(i) instanceof JsonObject) 
18540          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
18541      }
18542    };
18543    if (json.has("basedOn")) {
18544      JsonArray array = getJArray(json, "basedOn");
18545      for (int i = 0; i < array.size(); i++) {
18546        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18547      }
18548    };
18549    if (json.has("groupIdentifier"))
18550      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
18551    if (json.has("courseOfTherapyType"))
18552      res.setCourseOfTherapyType(parseCodeableConcept(getJObject(json, "courseOfTherapyType")));
18553    if (json.has("insurance")) {
18554      JsonArray array = getJArray(json, "insurance");
18555      for (int i = 0; i < array.size(); i++) {
18556        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
18557      }
18558    };
18559    if (json.has("note")) {
18560      JsonArray array = getJArray(json, "note");
18561      for (int i = 0; i < array.size(); i++) {
18562        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18563      }
18564    };
18565    if (json.has("dosageInstruction")) {
18566      JsonArray array = getJArray(json, "dosageInstruction");
18567      for (int i = 0; i < array.size(); i++) {
18568        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
18569      }
18570    };
18571    if (json.has("dispenseRequest"))
18572      res.setDispenseRequest(parseMedicationRequestDispenseRequestComponent(getJObject(json, "dispenseRequest")));
18573    if (json.has("substitution"))
18574      res.setSubstitution(parseMedicationRequestSubstitutionComponent(getJObject(json, "substitution")));
18575    if (json.has("priorPrescription"))
18576      res.setPriorPrescription(parseReference(getJObject(json, "priorPrescription")));
18577    if (json.has("detectedIssue")) {
18578      JsonArray array = getJArray(json, "detectedIssue");
18579      for (int i = 0; i < array.size(); i++) {
18580        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
18581      }
18582    };
18583    if (json.has("eventHistory")) {
18584      JsonArray array = getJArray(json, "eventHistory");
18585      for (int i = 0; i < array.size(); i++) {
18586        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
18587      }
18588    };
18589  }
18590
18591  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestDispenseRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
18592    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
18593    parseMedicationRequestDispenseRequestComponentProperties(json, res);
18594    return res;
18595  }
18596
18597  protected void parseMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
18598    parseBackboneElementProperties(json, res);
18599    if (json.has("initialFill"))
18600      res.setInitialFill(parseMedicationRequestDispenseRequestInitialFillComponent(getJObject(json, "initialFill")));
18601    if (json.has("dispenseInterval"))
18602      res.setDispenseInterval(parseDuration(getJObject(json, "dispenseInterval")));
18603    if (json.has("validityPeriod"))
18604      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
18605    if (json.has("numberOfRepeatsAllowed"))
18606      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
18607    if (json.has("_numberOfRepeatsAllowed"))
18608      parseElementProperties(getJObject(json, "_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
18609    if (json.has("quantity"))
18610      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18611    if (json.has("expectedSupplyDuration"))
18612      res.setExpectedSupplyDuration(parseDuration(getJObject(json, "expectedSupplyDuration")));
18613    if (json.has("performer"))
18614      res.setPerformer(parseReference(getJObject(json, "performer")));
18615  }
18616
18617  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestDispenseRequestInitialFillComponent(JsonObject json) throws IOException, FHIRFormatError {
18618    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
18619    parseMedicationRequestDispenseRequestInitialFillComponentProperties(json, res);
18620    return res;
18621  }
18622
18623  protected void parseMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
18624    parseBackboneElementProperties(json, res);
18625    if (json.has("quantity"))
18626      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18627    if (json.has("duration"))
18628      res.setDuration(parseDuration(getJObject(json, "duration")));
18629  }
18630
18631  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestSubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
18632    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
18633    parseMedicationRequestSubstitutionComponentProperties(json, res);
18634    return res;
18635  }
18636
18637  protected void parseMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
18638    parseBackboneElementProperties(json, res);
18639    DataType allowed = parseType("allowed", json);
18640    if (allowed != null)
18641      res.setAllowed(allowed);
18642    if (json.has("reason"))
18643      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
18644  }
18645
18646  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
18647    MedicationStatement res = new MedicationStatement();
18648    parseMedicationStatementProperties(json, res);
18649    return res;
18650  }
18651
18652  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
18653    parseDomainResourceProperties(json, res);
18654    if (json.has("identifier")) {
18655      JsonArray array = getJArray(json, "identifier");
18656      for (int i = 0; i < array.size(); i++) {
18657        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18658      }
18659    };
18660    if (json.has("basedOn")) {
18661      JsonArray array = getJArray(json, "basedOn");
18662      for (int i = 0; i < array.size(); i++) {
18663        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18664      }
18665    };
18666    if (json.has("partOf")) {
18667      JsonArray array = getJArray(json, "partOf");
18668      for (int i = 0; i < array.size(); i++) {
18669        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18670      }
18671    };
18672    if (json.has("status"))
18673      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatusCodes.NULL, new MedicationStatement.MedicationStatusCodesEnumFactory()));
18674    if (json.has("_status"))
18675      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18676    if (json.has("statusReason")) {
18677      JsonArray array = getJArray(json, "statusReason");
18678      for (int i = 0; i < array.size(); i++) {
18679        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18680      }
18681    };
18682    if (json.has("category"))
18683      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
18684    DataType medication = parseType("medication", json);
18685    if (medication != null)
18686      res.setMedication(medication);
18687    if (json.has("subject"))
18688      res.setSubject(parseReference(getJObject(json, "subject")));
18689    if (json.has("context"))
18690      res.setContext(parseReference(getJObject(json, "context")));
18691    DataType effective = parseType("effective", json);
18692    if (effective != null)
18693      res.setEffective(effective);
18694    if (json.has("dateAsserted"))
18695      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
18696    if (json.has("_dateAsserted"))
18697      parseElementProperties(getJObject(json, "_dateAsserted"), res.getDateAssertedElement());
18698    if (json.has("informationSource"))
18699      res.setInformationSource(parseReference(getJObject(json, "informationSource")));
18700    if (json.has("derivedFrom")) {
18701      JsonArray array = getJArray(json, "derivedFrom");
18702      for (int i = 0; i < array.size(); i++) {
18703        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
18704      }
18705    };
18706    if (json.has("reasonCode")) {
18707      JsonArray array = getJArray(json, "reasonCode");
18708      for (int i = 0; i < array.size(); i++) {
18709        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18710      }
18711    };
18712    if (json.has("reasonReference")) {
18713      JsonArray array = getJArray(json, "reasonReference");
18714      for (int i = 0; i < array.size(); i++) {
18715        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
18716      }
18717    };
18718    if (json.has("note")) {
18719      JsonArray array = getJArray(json, "note");
18720      for (int i = 0; i < array.size(); i++) {
18721        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18722      }
18723    };
18724    if (json.has("dosage")) {
18725      JsonArray array = getJArray(json, "dosage");
18726      for (int i = 0; i < array.size(); i++) {
18727        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
18728      }
18729    };
18730  }
18731
18732  protected MedicinalProductDefinition parseMedicinalProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
18733    MedicinalProductDefinition res = new MedicinalProductDefinition();
18734    parseMedicinalProductDefinitionProperties(json, res);
18735    return res;
18736  }
18737
18738  protected void parseMedicinalProductDefinitionProperties(JsonObject json, MedicinalProductDefinition res) throws IOException, FHIRFormatError {
18739    parseDomainResourceProperties(json, res);
18740    if (json.has("identifier")) {
18741      JsonArray array = getJArray(json, "identifier");
18742      for (int i = 0; i < array.size(); i++) {
18743        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18744      }
18745    };
18746    if (json.has("type"))
18747      res.setType(parseCodeableConcept(getJObject(json, "type")));
18748    if (json.has("domain"))
18749      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
18750    if (json.has("version"))
18751      res.setVersionElement(parseString(json.get("version").getAsString()));
18752    if (json.has("_version"))
18753      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
18754    if (json.has("status"))
18755      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
18756    if (json.has("statusDate"))
18757      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
18758    if (json.has("_statusDate"))
18759      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
18760    if (json.has("description"))
18761      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18762    if (json.has("_description"))
18763      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18764    if (json.has("combinedPharmaceuticalDoseForm"))
18765      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(getJObject(json, "combinedPharmaceuticalDoseForm")));
18766    if (json.has("route")) {
18767      JsonArray array = getJArray(json, "route");
18768      for (int i = 0; i < array.size(); i++) {
18769        res.getRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18770      }
18771    };
18772    if (json.has("indication"))
18773      res.setIndicationElement(parseMarkdown(json.get("indication").getAsString()));
18774    if (json.has("_indication"))
18775      parseElementProperties(getJObject(json, "_indication"), res.getIndicationElement());
18776    if (json.has("legalStatusOfSupply"))
18777      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
18778    if (json.has("additionalMonitoringIndicator"))
18779      res.setAdditionalMonitoringIndicator(parseCodeableConcept(getJObject(json, "additionalMonitoringIndicator")));
18780    if (json.has("specialMeasures")) {
18781      JsonArray array = getJArray(json, "specialMeasures");
18782      for (int i = 0; i < array.size(); i++) {
18783        res.getSpecialMeasures().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18784      }
18785    };
18786    if (json.has("pediatricUseIndicator"))
18787      res.setPediatricUseIndicator(parseCodeableConcept(getJObject(json, "pediatricUseIndicator")));
18788    if (json.has("classification")) {
18789      JsonArray array = getJArray(json, "classification");
18790      for (int i = 0; i < array.size(); i++) {
18791        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18792      }
18793    };
18794    if (json.has("marketingStatus")) {
18795      JsonArray array = getJArray(json, "marketingStatus");
18796      for (int i = 0; i < array.size(); i++) {
18797        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
18798      }
18799    };
18800    if (json.has("packagedMedicinalProduct")) {
18801      JsonArray array = getJArray(json, "packagedMedicinalProduct");
18802      for (int i = 0; i < array.size(); i++) {
18803        res.getPackagedMedicinalProduct().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18804      }
18805    };
18806    if (json.has("ingredient")) {
18807      JsonArray array = getJArray(json, "ingredient");
18808      for (int i = 0; i < array.size(); i++) {
18809        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18810      }
18811    };
18812    if (json.has("impurity")) {
18813      JsonArray array = getJArray(json, "impurity");
18814      for (int i = 0; i < array.size(); i++) {
18815        res.getImpurity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
18816      }
18817    };
18818    if (json.has("attachedDocument")) {
18819      JsonArray array = getJArray(json, "attachedDocument");
18820      for (int i = 0; i < array.size(); i++) {
18821        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
18822      }
18823    };
18824    if (json.has("masterFile")) {
18825      JsonArray array = getJArray(json, "masterFile");
18826      for (int i = 0; i < array.size(); i++) {
18827        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
18828      }
18829    };
18830    if (json.has("contact")) {
18831      JsonArray array = getJArray(json, "contact");
18832      for (int i = 0; i < array.size(); i++) {
18833        res.getContact().add(parseMedicinalProductDefinitionContactComponent(array.get(i).getAsJsonObject()));
18834      }
18835    };
18836    if (json.has("clinicalTrial")) {
18837      JsonArray array = getJArray(json, "clinicalTrial");
18838      for (int i = 0; i < array.size(); i++) {
18839        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
18840      }
18841    };
18842    if (json.has("code")) {
18843      JsonArray array = getJArray(json, "code");
18844      for (int i = 0; i < array.size(); i++) {
18845        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
18846      }
18847    };
18848    if (json.has("name")) {
18849      JsonArray array = getJArray(json, "name");
18850      for (int i = 0; i < array.size(); i++) {
18851        res.getName().add(parseMedicinalProductDefinitionNameComponent(array.get(i).getAsJsonObject()));
18852      }
18853    };
18854    if (json.has("crossReference")) {
18855      JsonArray array = getJArray(json, "crossReference");
18856      for (int i = 0; i < array.size(); i++) {
18857        res.getCrossReference().add(parseMedicinalProductDefinitionCrossReferenceComponent(array.get(i).getAsJsonObject()));
18858      }
18859    };
18860    if (json.has("operation")) {
18861      JsonArray array = getJArray(json, "operation");
18862      for (int i = 0; i < array.size(); i++) {
18863        res.getOperation().add(parseMedicinalProductDefinitionOperationComponent(array.get(i).getAsJsonObject()));
18864      }
18865    };
18866    if (json.has("characteristic")) {
18867      JsonArray array = getJArray(json, "characteristic");
18868      for (int i = 0; i < array.size(); i++) {
18869        res.getCharacteristic().add(parseMedicinalProductDefinitionCharacteristicComponent(array.get(i).getAsJsonObject()));
18870      }
18871    };
18872  }
18873
18874  protected MedicinalProductDefinition.MedicinalProductDefinitionContactComponent parseMedicinalProductDefinitionContactComponent(JsonObject json) throws IOException, FHIRFormatError {
18875    MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionContactComponent();
18876    parseMedicinalProductDefinitionContactComponentProperties(json, res);
18877    return res;
18878  }
18879
18880  protected void parseMedicinalProductDefinitionContactComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res) throws IOException, FHIRFormatError {
18881    parseBackboneElementProperties(json, res);
18882    if (json.has("type"))
18883      res.setType(parseCodeableConcept(getJObject(json, "type")));
18884    if (json.has("contact"))
18885      res.setContact(parseReference(getJObject(json, "contact")));
18886  }
18887
18888  protected MedicinalProductDefinition.MedicinalProductDefinitionNameComponent parseMedicinalProductDefinitionNameComponent(JsonObject json) throws IOException, FHIRFormatError {
18889    MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameComponent();
18890    parseMedicinalProductDefinitionNameComponentProperties(json, res);
18891    return res;
18892  }
18893
18894  protected void parseMedicinalProductDefinitionNameComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res) throws IOException, FHIRFormatError {
18895    parseBackboneElementProperties(json, res);
18896    if (json.has("productName"))
18897      res.setProductNameElement(parseString(json.get("productName").getAsString()));
18898    if (json.has("_productName"))
18899      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
18900    if (json.has("type"))
18901      res.setType(parseCodeableConcept(getJObject(json, "type")));
18902    if (json.has("namePart")) {
18903      JsonArray array = getJArray(json, "namePart");
18904      for (int i = 0; i < array.size(); i++) {
18905        res.getNamePart().add(parseMedicinalProductDefinitionNameNamePartComponent(array.get(i).getAsJsonObject()));
18906      }
18907    };
18908    if (json.has("countryLanguage")) {
18909      JsonArray array = getJArray(json, "countryLanguage");
18910      for (int i = 0; i < array.size(); i++) {
18911        res.getCountryLanguage().add(parseMedicinalProductDefinitionNameCountryLanguageComponent(array.get(i).getAsJsonObject()));
18912      }
18913    };
18914  }
18915
18916  protected MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent parseMedicinalProductDefinitionNameNamePartComponent(JsonObject json) throws IOException, FHIRFormatError {
18917    MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent();
18918    parseMedicinalProductDefinitionNameNamePartComponentProperties(json, res);
18919    return res;
18920  }
18921
18922  protected void parseMedicinalProductDefinitionNameNamePartComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent res) throws IOException, FHIRFormatError {
18923    parseBackboneElementProperties(json, res);
18924    if (json.has("part"))
18925      res.setPartElement(parseString(json.get("part").getAsString()));
18926    if (json.has("_part"))
18927      parseElementProperties(getJObject(json, "_part"), res.getPartElement());
18928    if (json.has("type"))
18929      res.setType(parseCodeableConcept(getJObject(json, "type")));
18930  }
18931
18932  protected MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent parseMedicinalProductDefinitionNameCountryLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
18933    MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent();
18934    parseMedicinalProductDefinitionNameCountryLanguageComponentProperties(json, res);
18935    return res;
18936  }
18937
18938  protected void parseMedicinalProductDefinitionNameCountryLanguageComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
18939    parseBackboneElementProperties(json, res);
18940    if (json.has("country"))
18941      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
18942    if (json.has("jurisdiction"))
18943      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
18944    if (json.has("language"))
18945      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
18946  }
18947
18948  protected MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent parseMedicinalProductDefinitionCrossReferenceComponent(JsonObject json) throws IOException, FHIRFormatError {
18949    MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent();
18950    parseMedicinalProductDefinitionCrossReferenceComponentProperties(json, res);
18951    return res;
18952  }
18953
18954  protected void parseMedicinalProductDefinitionCrossReferenceComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res) throws IOException, FHIRFormatError {
18955    parseBackboneElementProperties(json, res);
18956    if (json.has("product"))
18957      res.setProduct(parseCodeableReference(getJObject(json, "product")));
18958    if (json.has("type"))
18959      res.setType(parseCodeableConcept(getJObject(json, "type")));
18960  }
18961
18962  protected MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent parseMedicinalProductDefinitionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
18963    MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent();
18964    parseMedicinalProductDefinitionOperationComponentProperties(json, res);
18965    return res;
18966  }
18967
18968  protected void parseMedicinalProductDefinitionOperationComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent res) throws IOException, FHIRFormatError {
18969    parseBackboneElementProperties(json, res);
18970    if (json.has("type"))
18971      res.setType(parseCodeableReference(getJObject(json, "type")));
18972    if (json.has("effectiveDate"))
18973      res.setEffectiveDate(parsePeriod(getJObject(json, "effectiveDate")));
18974    if (json.has("organization")) {
18975      JsonArray array = getJArray(json, "organization");
18976      for (int i = 0; i < array.size(); i++) {
18977        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
18978      }
18979    };
18980    if (json.has("confidentialityIndicator"))
18981      res.setConfidentialityIndicator(parseCodeableConcept(getJObject(json, "confidentialityIndicator")));
18982  }
18983
18984  protected MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent parseMedicinalProductDefinitionCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
18985    MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent();
18986    parseMedicinalProductDefinitionCharacteristicComponentProperties(json, res);
18987    return res;
18988  }
18989
18990  protected void parseMedicinalProductDefinitionCharacteristicComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
18991    parseBackboneElementProperties(json, res);
18992    if (json.has("type"))
18993      res.setType(parseCodeableConcept(getJObject(json, "type")));
18994    DataType value = parseType("value", json);
18995    if (value != null)
18996      res.setValue(value);
18997  }
18998
18999  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
19000    MessageDefinition res = new MessageDefinition();
19001    parseMessageDefinitionProperties(json, res);
19002    return res;
19003  }
19004
19005  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
19006    parseDomainResourceProperties(json, res);
19007    if (json.has("url"))
19008      res.setUrlElement(parseUri(json.get("url").getAsString()));
19009    if (json.has("_url"))
19010      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
19011    if (json.has("identifier")) {
19012      JsonArray array = getJArray(json, "identifier");
19013      for (int i = 0; i < array.size(); i++) {
19014        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19015      }
19016    };
19017    if (json.has("version"))
19018      res.setVersionElement(parseString(json.get("version").getAsString()));
19019    if (json.has("_version"))
19020      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
19021    if (json.has("name"))
19022      res.setNameElement(parseString(json.get("name").getAsString()));
19023    if (json.has("_name"))
19024      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19025    if (json.has("title"))
19026      res.setTitleElement(parseString(json.get("title").getAsString()));
19027    if (json.has("_title"))
19028      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
19029    if (json.has("replaces")) {
19030      JsonArray array = getJArray(json, "replaces");
19031      for (int i = 0; i < array.size(); i++) {
19032        if (array.get(i).isJsonNull()) {
19033          res.getReplaces().add(new CanonicalType());
19034        } else {;
19035          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
19036        }
19037      }
19038    };
19039    if (json.has("_replaces")) {
19040      JsonArray array = getJArray(json, "_replaces");
19041      for (int i = 0; i < array.size(); i++) {
19042        if (i == res.getReplaces().size())
19043          res.getReplaces().add(parseCanonical(null));
19044        if (array.get(i) instanceof JsonObject) 
19045          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
19046      }
19047    };
19048    if (json.has("status"))
19049      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19050    if (json.has("_status"))
19051      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19052    if (json.has("experimental"))
19053      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19054    if (json.has("_experimental"))
19055      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
19056    if (json.has("date"))
19057      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19058    if (json.has("_date"))
19059      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19060    if (json.has("publisher"))
19061      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19062    if (json.has("_publisher"))
19063      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
19064    if (json.has("contact")) {
19065      JsonArray array = getJArray(json, "contact");
19066      for (int i = 0; i < array.size(); i++) {
19067        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19068      }
19069    };
19070    if (json.has("description"))
19071      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19072    if (json.has("_description"))
19073      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19074    if (json.has("useContext")) {
19075      JsonArray array = getJArray(json, "useContext");
19076      for (int i = 0; i < array.size(); i++) {
19077        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19078      }
19079    };
19080    if (json.has("jurisdiction")) {
19081      JsonArray array = getJArray(json, "jurisdiction");
19082      for (int i = 0; i < array.size(); i++) {
19083        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19084      }
19085    };
19086    if (json.has("purpose"))
19087      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19088    if (json.has("_purpose"))
19089      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
19090    if (json.has("copyright"))
19091      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
19092    if (json.has("_copyright"))
19093      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
19094    if (json.has("base"))
19095      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
19096    if (json.has("_base"))
19097      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
19098    if (json.has("parent")) {
19099      JsonArray array = getJArray(json, "parent");
19100      for (int i = 0; i < array.size(); i++) {
19101        if (array.get(i).isJsonNull()) {
19102          res.getParent().add(new CanonicalType());
19103        } else {;
19104          res.getParent().add(parseCanonical(array.get(i).getAsString()));
19105        }
19106      }
19107    };
19108    if (json.has("_parent")) {
19109      JsonArray array = getJArray(json, "_parent");
19110      for (int i = 0; i < array.size(); i++) {
19111        if (i == res.getParent().size())
19112          res.getParent().add(parseCanonical(null));
19113        if (array.get(i) instanceof JsonObject) 
19114          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
19115      }
19116    };
19117    DataType event = parseType("event", json);
19118    if (event != null)
19119      res.setEvent(event);
19120    if (json.has("category"))
19121      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
19122    if (json.has("_category"))
19123      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
19124    if (json.has("focus")) {
19125      JsonArray array = getJArray(json, "focus");
19126      for (int i = 0; i < array.size(); i++) {
19127        res.getFocus().add(parseMessageDefinitionFocusComponent(array.get(i).getAsJsonObject()));
19128      }
19129    };
19130    if (json.has("responseRequired"))
19131      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
19132    if (json.has("_responseRequired"))
19133      parseElementProperties(getJObject(json, "_responseRequired"), res.getResponseRequiredElement());
19134    if (json.has("allowedResponse")) {
19135      JsonArray array = getJArray(json, "allowedResponse");
19136      for (int i = 0; i < array.size(); i++) {
19137        res.getAllowedResponse().add(parseMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject()));
19138      }
19139    };
19140    if (json.has("graph")) {
19141      JsonArray array = getJArray(json, "graph");
19142      for (int i = 0; i < array.size(); i++) {
19143        if (array.get(i).isJsonNull()) {
19144          res.getGraph().add(new CanonicalType());
19145        } else {;
19146          res.getGraph().add(parseCanonical(array.get(i).getAsString()));
19147        }
19148      }
19149    };
19150    if (json.has("_graph")) {
19151      JsonArray array = getJArray(json, "_graph");
19152      for (int i = 0; i < array.size(); i++) {
19153        if (i == res.getGraph().size())
19154          res.getGraph().add(parseCanonical(null));
19155        if (array.get(i) instanceof JsonObject) 
19156          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
19157      }
19158    };
19159  }
19160
19161  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionFocusComponent(JsonObject json) throws IOException, FHIRFormatError {
19162    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
19163    parseMessageDefinitionFocusComponentProperties(json, res);
19164    return res;
19165  }
19166
19167  protected void parseMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
19168    parseBackboneElementProperties(json, res);
19169    if (json.has("code"))
19170      res.setCodeElement(parseCode(json.get("code").getAsString()));
19171    if (json.has("_code"))
19172      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19173    if (json.has("profile"))
19174      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
19175    if (json.has("_profile"))
19176      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
19177    if (json.has("min"))
19178      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
19179    if (json.has("_min"))
19180      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
19181    if (json.has("max"))
19182      res.setMaxElement(parseString(json.get("max").getAsString()));
19183    if (json.has("_max"))
19184      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
19185  }
19186
19187  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionAllowedResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
19188    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
19189    parseMessageDefinitionAllowedResponseComponentProperties(json, res);
19190    return res;
19191  }
19192
19193  protected void parseMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
19194    parseBackboneElementProperties(json, res);
19195    if (json.has("message"))
19196      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
19197    if (json.has("_message"))
19198      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
19199    if (json.has("situation"))
19200      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
19201    if (json.has("_situation"))
19202      parseElementProperties(getJObject(json, "_situation"), res.getSituationElement());
19203  }
19204
19205  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
19206    MessageHeader res = new MessageHeader();
19207    parseMessageHeaderProperties(json, res);
19208    return res;
19209  }
19210
19211  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
19212    parseDomainResourceProperties(json, res);
19213    DataType event = parseType("event", json);
19214    if (event != null)
19215      res.setEvent(event);
19216    if (json.has("destination")) {
19217      JsonArray array = getJArray(json, "destination");
19218      for (int i = 0; i < array.size(); i++) {
19219        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject()));
19220      }
19221    };
19222    if (json.has("sender"))
19223      res.setSender(parseReference(getJObject(json, "sender")));
19224    if (json.has("enterer"))
19225      res.setEnterer(parseReference(getJObject(json, "enterer")));
19226    if (json.has("author"))
19227      res.setAuthor(parseReference(getJObject(json, "author")));
19228    if (json.has("source"))
19229      res.setSource(parseMessageHeaderMessageSourceComponent(getJObject(json, "source")));
19230    if (json.has("responsible"))
19231      res.setResponsible(parseReference(getJObject(json, "responsible")));
19232    if (json.has("reason"))
19233      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
19234    if (json.has("response"))
19235      res.setResponse(parseMessageHeaderResponseComponent(getJObject(json, "response")));
19236    if (json.has("focus")) {
19237      JsonArray array = getJArray(json, "focus");
19238      for (int i = 0; i < array.size(); i++) {
19239        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
19240      }
19241    };
19242    if (json.has("definition"))
19243      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
19244    if (json.has("_definition"))
19245      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
19246  }
19247
19248  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json) throws IOException, FHIRFormatError {
19249    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
19250    parseMessageHeaderMessageDestinationComponentProperties(json, res);
19251    return res;
19252  }
19253
19254  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
19255    parseBackboneElementProperties(json, res);
19256    if (json.has("name"))
19257      res.setNameElement(parseString(json.get("name").getAsString()));
19258    if (json.has("_name"))
19259      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19260    if (json.has("target"))
19261      res.setTarget(parseReference(getJObject(json, "target")));
19262    if (json.has("endpoint"))
19263      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
19264    if (json.has("_endpoint"))
19265      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
19266    if (json.has("receiver"))
19267      res.setReceiver(parseReference(getJObject(json, "receiver")));
19268  }
19269
19270  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
19271    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
19272    parseMessageHeaderMessageSourceComponentProperties(json, res);
19273    return res;
19274  }
19275
19276  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
19277    parseBackboneElementProperties(json, res);
19278    if (json.has("name"))
19279      res.setNameElement(parseString(json.get("name").getAsString()));
19280    if (json.has("_name"))
19281      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19282    if (json.has("software"))
19283      res.setSoftwareElement(parseString(json.get("software").getAsString()));
19284    if (json.has("_software"))
19285      parseElementProperties(getJObject(json, "_software"), res.getSoftwareElement());
19286    if (json.has("version"))
19287      res.setVersionElement(parseString(json.get("version").getAsString()));
19288    if (json.has("_version"))
19289      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
19290    if (json.has("contact"))
19291      res.setContact(parseContactPoint(getJObject(json, "contact")));
19292    if (json.has("endpoint"))
19293      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
19294    if (json.has("_endpoint"))
19295      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
19296  }
19297
19298  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
19299    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
19300    parseMessageHeaderResponseComponentProperties(json, res);
19301    return res;
19302  }
19303
19304  protected void parseMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
19305    parseBackboneElementProperties(json, res);
19306    if (json.has("identifier"))
19307      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
19308    if (json.has("_identifier"))
19309      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
19310    if (json.has("code"))
19311      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
19312    if (json.has("_code"))
19313      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19314    if (json.has("details"))
19315      res.setDetails(parseReference(getJObject(json, "details")));
19316  }
19317
19318  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
19319    MolecularSequence res = new MolecularSequence();
19320    parseMolecularSequenceProperties(json, res);
19321    return res;
19322  }
19323
19324  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
19325    parseDomainResourceProperties(json, res);
19326    if (json.has("identifier")) {
19327      JsonArray array = getJArray(json, "identifier");
19328      for (int i = 0; i < array.size(); i++) {
19329        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19330      }
19331    };
19332    if (json.has("type"))
19333      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
19334    if (json.has("_type"))
19335      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19336    if (json.has("coordinateSystem"))
19337      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
19338    if (json.has("_coordinateSystem"))
19339      parseElementProperties(getJObject(json, "_coordinateSystem"), res.getCoordinateSystemElement());
19340    if (json.has("patient"))
19341      res.setPatient(parseReference(getJObject(json, "patient")));
19342    if (json.has("specimen"))
19343      res.setSpecimen(parseReference(getJObject(json, "specimen")));
19344    if (json.has("device"))
19345      res.setDevice(parseReference(getJObject(json, "device")));
19346    if (json.has("performer"))
19347      res.setPerformer(parseReference(getJObject(json, "performer")));
19348    if (json.has("quantity"))
19349      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19350    if (json.has("referenceSeq"))
19351      res.setReferenceSeq(parseMolecularSequenceReferenceSeqComponent(getJObject(json, "referenceSeq")));
19352    if (json.has("variant")) {
19353      JsonArray array = getJArray(json, "variant");
19354      for (int i = 0; i < array.size(); i++) {
19355        res.getVariant().add(parseMolecularSequenceVariantComponent(array.get(i).getAsJsonObject()));
19356      }
19357    };
19358    if (json.has("observedSeq"))
19359      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
19360    if (json.has("_observedSeq"))
19361      parseElementProperties(getJObject(json, "_observedSeq"), res.getObservedSeqElement());
19362    if (json.has("quality")) {
19363      JsonArray array = getJArray(json, "quality");
19364      for (int i = 0; i < array.size(); i++) {
19365        res.getQuality().add(parseMolecularSequenceQualityComponent(array.get(i).getAsJsonObject()));
19366      }
19367    };
19368    if (json.has("readCoverage"))
19369      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
19370    if (json.has("_readCoverage"))
19371      parseElementProperties(getJObject(json, "_readCoverage"), res.getReadCoverageElement());
19372    if (json.has("repository")) {
19373      JsonArray array = getJArray(json, "repository");
19374      for (int i = 0; i < array.size(); i++) {
19375        res.getRepository().add(parseMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject()));
19376      }
19377    };
19378    if (json.has("pointer")) {
19379      JsonArray array = getJArray(json, "pointer");
19380      for (int i = 0; i < array.size(); i++) {
19381        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
19382      }
19383    };
19384    if (json.has("structureVariant")) {
19385      JsonArray array = getJArray(json, "structureVariant");
19386      for (int i = 0; i < array.size(); i++) {
19387        res.getStructureVariant().add(parseMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject()));
19388      }
19389    };
19390  }
19391
19392  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceReferenceSeqComponent(JsonObject json) throws IOException, FHIRFormatError {
19393    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
19394    parseMolecularSequenceReferenceSeqComponentProperties(json, res);
19395    return res;
19396  }
19397
19398  protected void parseMolecularSequenceReferenceSeqComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
19399    parseBackboneElementProperties(json, res);
19400    if (json.has("chromosome"))
19401      res.setChromosome(parseCodeableConcept(getJObject(json, "chromosome")));
19402    if (json.has("genomeBuild"))
19403      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
19404    if (json.has("_genomeBuild"))
19405      parseElementProperties(getJObject(json, "_genomeBuild"), res.getGenomeBuildElement());
19406    if (json.has("orientation"))
19407      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
19408    if (json.has("_orientation"))
19409      parseElementProperties(getJObject(json, "_orientation"), res.getOrientationElement());
19410    if (json.has("referenceSeqId"))
19411      res.setReferenceSeqId(parseCodeableConcept(getJObject(json, "referenceSeqId")));
19412    if (json.has("referenceSeqPointer"))
19413      res.setReferenceSeqPointer(parseReference(getJObject(json, "referenceSeqPointer")));
19414    if (json.has("referenceSeqString"))
19415      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
19416    if (json.has("_referenceSeqString"))
19417      parseElementProperties(getJObject(json, "_referenceSeqString"), res.getReferenceSeqStringElement());
19418    if (json.has("strand"))
19419      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
19420    if (json.has("_strand"))
19421      parseElementProperties(getJObject(json, "_strand"), res.getStrandElement());
19422    if (json.has("windowStart"))
19423      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
19424    if (json.has("_windowStart"))
19425      parseElementProperties(getJObject(json, "_windowStart"), res.getWindowStartElement());
19426    if (json.has("windowEnd"))
19427      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
19428    if (json.has("_windowEnd"))
19429      parseElementProperties(getJObject(json, "_windowEnd"), res.getWindowEndElement());
19430  }
19431
19432  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceVariantComponent(JsonObject json) throws IOException, FHIRFormatError {
19433    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
19434    parseMolecularSequenceVariantComponentProperties(json, res);
19435    return res;
19436  }
19437
19438  protected void parseMolecularSequenceVariantComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceVariantComponent res) throws IOException, FHIRFormatError {
19439    parseBackboneElementProperties(json, res);
19440    if (json.has("start"))
19441      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19442    if (json.has("_start"))
19443      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
19444    if (json.has("end"))
19445      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19446    if (json.has("_end"))
19447      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
19448    if (json.has("observedAllele"))
19449      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
19450    if (json.has("_observedAllele"))
19451      parseElementProperties(getJObject(json, "_observedAllele"), res.getObservedAlleleElement());
19452    if (json.has("referenceAllele"))
19453      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
19454    if (json.has("_referenceAllele"))
19455      parseElementProperties(getJObject(json, "_referenceAllele"), res.getReferenceAlleleElement());
19456    if (json.has("cigar"))
19457      res.setCigarElement(parseString(json.get("cigar").getAsString()));
19458    if (json.has("_cigar"))
19459      parseElementProperties(getJObject(json, "_cigar"), res.getCigarElement());
19460    if (json.has("variantPointer"))
19461      res.setVariantPointer(parseReference(getJObject(json, "variantPointer")));
19462  }
19463
19464  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceQualityComponent(JsonObject json) throws IOException, FHIRFormatError {
19465    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
19466    parseMolecularSequenceQualityComponentProperties(json, res);
19467    return res;
19468  }
19469
19470  protected void parseMolecularSequenceQualityComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceQualityComponent res) throws IOException, FHIRFormatError {
19471    parseBackboneElementProperties(json, res);
19472    if (json.has("type"))
19473      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL, new MolecularSequence.QualityTypeEnumFactory()));
19474    if (json.has("_type"))
19475      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19476    if (json.has("standardSequence"))
19477      res.setStandardSequence(parseCodeableConcept(getJObject(json, "standardSequence")));
19478    if (json.has("start"))
19479      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19480    if (json.has("_start"))
19481      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
19482    if (json.has("end"))
19483      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19484    if (json.has("_end"))
19485      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
19486    if (json.has("score"))
19487      res.setScore(parseQuantity(getJObject(json, "score")));
19488    if (json.has("method"))
19489      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
19490    if (json.has("truthTP"))
19491      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
19492    if (json.has("_truthTP"))
19493      parseElementProperties(getJObject(json, "_truthTP"), res.getTruthTPElement());
19494    if (json.has("queryTP"))
19495      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
19496    if (json.has("_queryTP"))
19497      parseElementProperties(getJObject(json, "_queryTP"), res.getQueryTPElement());
19498    if (json.has("truthFN"))
19499      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
19500    if (json.has("_truthFN"))
19501      parseElementProperties(getJObject(json, "_truthFN"), res.getTruthFNElement());
19502    if (json.has("queryFP"))
19503      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
19504    if (json.has("_queryFP"))
19505      parseElementProperties(getJObject(json, "_queryFP"), res.getQueryFPElement());
19506    if (json.has("gtFP"))
19507      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
19508    if (json.has("_gtFP"))
19509      parseElementProperties(getJObject(json, "_gtFP"), res.getGtFPElement());
19510    if (json.has("precision"))
19511      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
19512    if (json.has("_precision"))
19513      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
19514    if (json.has("recall"))
19515      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
19516    if (json.has("_recall"))
19517      parseElementProperties(getJObject(json, "_recall"), res.getRecallElement());
19518    if (json.has("fScore"))
19519      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
19520    if (json.has("_fScore"))
19521      parseElementProperties(getJObject(json, "_fScore"), res.getFScoreElement());
19522    if (json.has("roc"))
19523      res.setRoc(parseMolecularSequenceQualityRocComponent(getJObject(json, "roc")));
19524  }
19525
19526  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceQualityRocComponent(JsonObject json) throws IOException, FHIRFormatError {
19527    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
19528    parseMolecularSequenceQualityRocComponentProperties(json, res);
19529    return res;
19530  }
19531
19532  protected void parseMolecularSequenceQualityRocComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceQualityRocComponent res) throws IOException, FHIRFormatError {
19533    parseBackboneElementProperties(json, res);
19534    if (json.has("score")) {
19535      JsonArray array = getJArray(json, "score");
19536      for (int i = 0; i < array.size(); i++) {
19537        if (array.get(i).isJsonNull()) {
19538          res.getScore().add(new IntegerType());
19539        } else {;
19540          res.getScore().add(parseInteger(array.get(i).getAsLong()));
19541        }
19542      }
19543    };
19544    if (json.has("_score")) {
19545      JsonArray array = getJArray(json, "_score");
19546      for (int i = 0; i < array.size(); i++) {
19547        if (i == res.getScore().size())
19548          res.getScore().add(parseInteger(null));
19549        if (array.get(i) instanceof JsonObject) 
19550          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
19551      }
19552    };
19553    if (json.has("numTP")) {
19554      JsonArray array = getJArray(json, "numTP");
19555      for (int i = 0; i < array.size(); i++) {
19556        if (array.get(i).isJsonNull()) {
19557          res.getNumTP().add(new IntegerType());
19558        } else {;
19559          res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
19560        }
19561      }
19562    };
19563    if (json.has("_numTP")) {
19564      JsonArray array = getJArray(json, "_numTP");
19565      for (int i = 0; i < array.size(); i++) {
19566        if (i == res.getNumTP().size())
19567          res.getNumTP().add(parseInteger(null));
19568        if (array.get(i) instanceof JsonObject) 
19569          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
19570      }
19571    };
19572    if (json.has("numFP")) {
19573      JsonArray array = getJArray(json, "numFP");
19574      for (int i = 0; i < array.size(); i++) {
19575        if (array.get(i).isJsonNull()) {
19576          res.getNumFP().add(new IntegerType());
19577        } else {;
19578          res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
19579        }
19580      }
19581    };
19582    if (json.has("_numFP")) {
19583      JsonArray array = getJArray(json, "_numFP");
19584      for (int i = 0; i < array.size(); i++) {
19585        if (i == res.getNumFP().size())
19586          res.getNumFP().add(parseInteger(null));
19587        if (array.get(i) instanceof JsonObject) 
19588          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
19589      }
19590    };
19591    if (json.has("numFN")) {
19592      JsonArray array = getJArray(json, "numFN");
19593      for (int i = 0; i < array.size(); i++) {
19594        if (array.get(i).isJsonNull()) {
19595          res.getNumFN().add(new IntegerType());
19596        } else {;
19597          res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
19598        }
19599      }
19600    };
19601    if (json.has("_numFN")) {
19602      JsonArray array = getJArray(json, "_numFN");
19603      for (int i = 0; i < array.size(); i++) {
19604        if (i == res.getNumFN().size())
19605          res.getNumFN().add(parseInteger(null));
19606        if (array.get(i) instanceof JsonObject) 
19607          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
19608      }
19609    };
19610    if (json.has("precision")) {
19611      JsonArray array = getJArray(json, "precision");
19612      for (int i = 0; i < array.size(); i++) {
19613        if (array.get(i).isJsonNull()) {
19614          res.getPrecision().add(new DecimalType());
19615        } else {;
19616          res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
19617        }
19618      }
19619    };
19620    if (json.has("_precision")) {
19621      JsonArray array = getJArray(json, "_precision");
19622      for (int i = 0; i < array.size(); i++) {
19623        if (i == res.getPrecision().size())
19624          res.getPrecision().add(parseDecimal(null));
19625        if (array.get(i) instanceof JsonObject) 
19626          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
19627      }
19628    };
19629    if (json.has("sensitivity")) {
19630      JsonArray array = getJArray(json, "sensitivity");
19631      for (int i = 0; i < array.size(); i++) {
19632        if (array.get(i).isJsonNull()) {
19633          res.getSensitivity().add(new DecimalType());
19634        } else {;
19635          res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
19636        }
19637      }
19638    };
19639    if (json.has("_sensitivity")) {
19640      JsonArray array = getJArray(json, "_sensitivity");
19641      for (int i = 0; i < array.size(); i++) {
19642        if (i == res.getSensitivity().size())
19643          res.getSensitivity().add(parseDecimal(null));
19644        if (array.get(i) instanceof JsonObject) 
19645          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
19646      }
19647    };
19648    if (json.has("fMeasure")) {
19649      JsonArray array = getJArray(json, "fMeasure");
19650      for (int i = 0; i < array.size(); i++) {
19651        if (array.get(i).isJsonNull()) {
19652          res.getFMeasure().add(new DecimalType());
19653        } else {;
19654          res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
19655        }
19656      }
19657    };
19658    if (json.has("_fMeasure")) {
19659      JsonArray array = getJArray(json, "_fMeasure");
19660      for (int i = 0; i < array.size(); i++) {
19661        if (i == res.getFMeasure().size())
19662          res.getFMeasure().add(parseDecimal(null));
19663        if (array.get(i) instanceof JsonObject) 
19664          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
19665      }
19666    };
19667  }
19668
19669  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceRepositoryComponent(JsonObject json) throws IOException, FHIRFormatError {
19670    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
19671    parseMolecularSequenceRepositoryComponentProperties(json, res);
19672    return res;
19673  }
19674
19675  protected void parseMolecularSequenceRepositoryComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceRepositoryComponent res) throws IOException, FHIRFormatError {
19676    parseBackboneElementProperties(json, res);
19677    if (json.has("type"))
19678      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL, new MolecularSequence.RepositoryTypeEnumFactory()));
19679    if (json.has("_type"))
19680      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19681    if (json.has("url"))
19682      res.setUrlElement(parseUri(json.get("url").getAsString()));
19683    if (json.has("_url"))
19684      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
19685    if (json.has("name"))
19686      res.setNameElement(parseString(json.get("name").getAsString()));
19687    if (json.has("_name"))
19688      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19689    if (json.has("datasetId"))
19690      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
19691    if (json.has("_datasetId"))
19692      parseElementProperties(getJObject(json, "_datasetId"), res.getDatasetIdElement());
19693    if (json.has("variantsetId"))
19694      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
19695    if (json.has("_variantsetId"))
19696      parseElementProperties(getJObject(json, "_variantsetId"), res.getVariantsetIdElement());
19697    if (json.has("readsetId"))
19698      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
19699    if (json.has("_readsetId"))
19700      parseElementProperties(getJObject(json, "_readsetId"), res.getReadsetIdElement());
19701  }
19702
19703  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceStructureVariantComponent(JsonObject json) throws IOException, FHIRFormatError {
19704    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
19705    parseMolecularSequenceStructureVariantComponentProperties(json, res);
19706    return res;
19707  }
19708
19709  protected void parseMolecularSequenceStructureVariantComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
19710    parseBackboneElementProperties(json, res);
19711    if (json.has("variantType"))
19712      res.setVariantType(parseCodeableConcept(getJObject(json, "variantType")));
19713    if (json.has("exact"))
19714      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
19715    if (json.has("_exact"))
19716      parseElementProperties(getJObject(json, "_exact"), res.getExactElement());
19717    if (json.has("length"))
19718      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
19719    if (json.has("_length"))
19720      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
19721    if (json.has("outer"))
19722      res.setOuter(parseMolecularSequenceStructureVariantOuterComponent(getJObject(json, "outer")));
19723    if (json.has("inner"))
19724      res.setInner(parseMolecularSequenceStructureVariantInnerComponent(getJObject(json, "inner")));
19725  }
19726
19727  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceStructureVariantOuterComponent(JsonObject json) throws IOException, FHIRFormatError {
19728    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
19729    parseMolecularSequenceStructureVariantOuterComponentProperties(json, res);
19730    return res;
19731  }
19732
19733  protected void parseMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
19734    parseBackboneElementProperties(json, res);
19735    if (json.has("start"))
19736      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19737    if (json.has("_start"))
19738      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
19739    if (json.has("end"))
19740      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19741    if (json.has("_end"))
19742      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
19743  }
19744
19745  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceStructureVariantInnerComponent(JsonObject json) throws IOException, FHIRFormatError {
19746    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
19747    parseMolecularSequenceStructureVariantInnerComponentProperties(json, res);
19748    return res;
19749  }
19750
19751  protected void parseMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
19752    parseBackboneElementProperties(json, res);
19753    if (json.has("start"))
19754      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19755    if (json.has("_start"))
19756      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
19757    if (json.has("end"))
19758      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19759    if (json.has("_end"))
19760      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
19761  }
19762
19763  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
19764    NamingSystem res = new NamingSystem();
19765    parseNamingSystemProperties(json, res);
19766    return res;
19767  }
19768
19769  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
19770    parseDomainResourceProperties(json, res);
19771    if (json.has("name"))
19772      res.setNameElement(parseString(json.get("name").getAsString()));
19773    if (json.has("_name"))
19774      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19775    if (json.has("status"))
19776      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19777    if (json.has("_status"))
19778      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19779    if (json.has("kind"))
19780      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
19781    if (json.has("_kind"))
19782      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
19783    if (json.has("date"))
19784      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19785    if (json.has("_date"))
19786      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19787    if (json.has("publisher"))
19788      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19789    if (json.has("_publisher"))
19790      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
19791    if (json.has("contact")) {
19792      JsonArray array = getJArray(json, "contact");
19793      for (int i = 0; i < array.size(); i++) {
19794        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19795      }
19796    };
19797    if (json.has("responsible"))
19798      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
19799    if (json.has("_responsible"))
19800      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
19801    if (json.has("type"))
19802      res.setType(parseCodeableConcept(getJObject(json, "type")));
19803    if (json.has("description"))
19804      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19805    if (json.has("_description"))
19806      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19807    if (json.has("useContext")) {
19808      JsonArray array = getJArray(json, "useContext");
19809      for (int i = 0; i < array.size(); i++) {
19810        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19811      }
19812    };
19813    if (json.has("jurisdiction")) {
19814      JsonArray array = getJArray(json, "jurisdiction");
19815      for (int i = 0; i < array.size(); i++) {
19816        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19817      }
19818    };
19819    if (json.has("usage"))
19820      res.setUsageElement(parseString(json.get("usage").getAsString()));
19821    if (json.has("_usage"))
19822      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
19823    if (json.has("uniqueId")) {
19824      JsonArray array = getJArray(json, "uniqueId");
19825      for (int i = 0; i < array.size(); i++) {
19826        res.getUniqueId().add(parseNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject()));
19827      }
19828    };
19829  }
19830
19831  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemUniqueIdComponent(JsonObject json) throws IOException, FHIRFormatError {
19832    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
19833    parseNamingSystemUniqueIdComponentProperties(json, res);
19834    return res;
19835  }
19836
19837  protected void parseNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
19838    parseBackboneElementProperties(json, res);
19839    if (json.has("type"))
19840      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
19841    if (json.has("_type"))
19842      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19843    if (json.has("value"))
19844      res.setValueElement(parseString(json.get("value").getAsString()));
19845    if (json.has("_value"))
19846      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19847    if (json.has("preferred"))
19848      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
19849    if (json.has("_preferred"))
19850      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
19851    if (json.has("comment"))
19852      res.setCommentElement(parseString(json.get("comment").getAsString()));
19853    if (json.has("_comment"))
19854      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
19855    if (json.has("period"))
19856      res.setPeriod(parsePeriod(getJObject(json, "period")));
19857  }
19858
19859  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
19860    NutritionOrder res = new NutritionOrder();
19861    parseNutritionOrderProperties(json, res);
19862    return res;
19863  }
19864
19865  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
19866    parseDomainResourceProperties(json, res);
19867    if (json.has("identifier")) {
19868      JsonArray array = getJArray(json, "identifier");
19869      for (int i = 0; i < array.size(); i++) {
19870        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19871      }
19872    };
19873    if (json.has("instantiatesCanonical")) {
19874      JsonArray array = getJArray(json, "instantiatesCanonical");
19875      for (int i = 0; i < array.size(); i++) {
19876        if (array.get(i).isJsonNull()) {
19877          res.getInstantiatesCanonical().add(new CanonicalType());
19878        } else {;
19879          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
19880        }
19881      }
19882    };
19883    if (json.has("_instantiatesCanonical")) {
19884      JsonArray array = getJArray(json, "_instantiatesCanonical");
19885      for (int i = 0; i < array.size(); i++) {
19886        if (i == res.getInstantiatesCanonical().size())
19887          res.getInstantiatesCanonical().add(parseCanonical(null));
19888        if (array.get(i) instanceof JsonObject) 
19889          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
19890      }
19891    };
19892    if (json.has("instantiatesUri")) {
19893      JsonArray array = getJArray(json, "instantiatesUri");
19894      for (int i = 0; i < array.size(); i++) {
19895        if (array.get(i).isJsonNull()) {
19896          res.getInstantiatesUri().add(new UriType());
19897        } else {;
19898          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
19899        }
19900      }
19901    };
19902    if (json.has("_instantiatesUri")) {
19903      JsonArray array = getJArray(json, "_instantiatesUri");
19904      for (int i = 0; i < array.size(); i++) {
19905        if (i == res.getInstantiatesUri().size())
19906          res.getInstantiatesUri().add(parseUri(null));
19907        if (array.get(i) instanceof JsonObject) 
19908          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
19909      }
19910    };
19911    if (json.has("instantiates")) {
19912      JsonArray array = getJArray(json, "instantiates");
19913      for (int i = 0; i < array.size(); i++) {
19914        if (array.get(i).isJsonNull()) {
19915          res.getInstantiates().add(new UriType());
19916        } else {;
19917          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
19918        }
19919      }
19920    };
19921    if (json.has("_instantiates")) {
19922      JsonArray array = getJArray(json, "_instantiates");
19923      for (int i = 0; i < array.size(); i++) {
19924        if (i == res.getInstantiates().size())
19925          res.getInstantiates().add(parseUri(null));
19926        if (array.get(i) instanceof JsonObject) 
19927          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
19928      }
19929    };
19930    if (json.has("status"))
19931      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
19932    if (json.has("_status"))
19933      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19934    if (json.has("intent"))
19935      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
19936    if (json.has("_intent"))
19937      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
19938    if (json.has("patient"))
19939      res.setPatient(parseReference(getJObject(json, "patient")));
19940    if (json.has("encounter"))
19941      res.setEncounter(parseReference(getJObject(json, "encounter")));
19942    if (json.has("dateTime"))
19943      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
19944    if (json.has("_dateTime"))
19945      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
19946    if (json.has("orderer"))
19947      res.setOrderer(parseReference(getJObject(json, "orderer")));
19948    if (json.has("allergyIntolerance")) {
19949      JsonArray array = getJArray(json, "allergyIntolerance");
19950      for (int i = 0; i < array.size(); i++) {
19951        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
19952      }
19953    };
19954    if (json.has("foodPreferenceModifier")) {
19955      JsonArray array = getJArray(json, "foodPreferenceModifier");
19956      for (int i = 0; i < array.size(); i++) {
19957        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19958      }
19959    };
19960    if (json.has("excludeFoodModifier")) {
19961      JsonArray array = getJArray(json, "excludeFoodModifier");
19962      for (int i = 0; i < array.size(); i++) {
19963        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19964      }
19965    };
19966    if (json.has("oralDiet"))
19967      res.setOralDiet(parseNutritionOrderOralDietComponent(getJObject(json, "oralDiet")));
19968    if (json.has("supplement")) {
19969      JsonArray array = getJArray(json, "supplement");
19970      for (int i = 0; i < array.size(); i++) {
19971        res.getSupplement().add(parseNutritionOrderSupplementComponent(array.get(i).getAsJsonObject()));
19972      }
19973    };
19974    if (json.has("enteralFormula"))
19975      res.setEnteralFormula(parseNutritionOrderEnteralFormulaComponent(getJObject(json, "enteralFormula")));
19976    if (json.has("note")) {
19977      JsonArray array = getJArray(json, "note");
19978      for (int i = 0; i < array.size(); i++) {
19979        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19980      }
19981    };
19982  }
19983
19984  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderOralDietComponent(JsonObject json) throws IOException, FHIRFormatError {
19985    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
19986    parseNutritionOrderOralDietComponentProperties(json, res);
19987    return res;
19988  }
19989
19990  protected void parseNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
19991    parseBackboneElementProperties(json, res);
19992    if (json.has("type")) {
19993      JsonArray array = getJArray(json, "type");
19994      for (int i = 0; i < array.size(); i++) {
19995        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19996      }
19997    };
19998    if (json.has("schedule")) {
19999      JsonArray array = getJArray(json, "schedule");
20000      for (int i = 0; i < array.size(); i++) {
20001        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
20002      }
20003    };
20004    if (json.has("nutrient")) {
20005      JsonArray array = getJArray(json, "nutrient");
20006      for (int i = 0; i < array.size(); i++) {
20007        res.getNutrient().add(parseNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject()));
20008      }
20009    };
20010    if (json.has("texture")) {
20011      JsonArray array = getJArray(json, "texture");
20012      for (int i = 0; i < array.size(); i++) {
20013        res.getTexture().add(parseNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject()));
20014      }
20015    };
20016    if (json.has("fluidConsistencyType")) {
20017      JsonArray array = getJArray(json, "fluidConsistencyType");
20018      for (int i = 0; i < array.size(); i++) {
20019        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20020      }
20021    };
20022    if (json.has("instruction"))
20023      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
20024    if (json.has("_instruction"))
20025      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
20026  }
20027
20028  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderOralDietNutrientComponent(JsonObject json) throws IOException, FHIRFormatError {
20029    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
20030    parseNutritionOrderOralDietNutrientComponentProperties(json, res);
20031    return res;
20032  }
20033
20034  protected void parseNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
20035    parseBackboneElementProperties(json, res);
20036    if (json.has("modifier"))
20037      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
20038    if (json.has("amount"))
20039      res.setAmount(parseQuantity(getJObject(json, "amount")));
20040  }
20041
20042  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderOralDietTextureComponent(JsonObject json) throws IOException, FHIRFormatError {
20043    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
20044    parseNutritionOrderOralDietTextureComponentProperties(json, res);
20045    return res;
20046  }
20047
20048  protected void parseNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
20049    parseBackboneElementProperties(json, res);
20050    if (json.has("modifier"))
20051      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
20052    if (json.has("foodType"))
20053      res.setFoodType(parseCodeableConcept(getJObject(json, "foodType")));
20054  }
20055
20056  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderSupplementComponent(JsonObject json) throws IOException, FHIRFormatError {
20057    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
20058    parseNutritionOrderSupplementComponentProperties(json, res);
20059    return res;
20060  }
20061
20062  protected void parseNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
20063    parseBackboneElementProperties(json, res);
20064    if (json.has("type"))
20065      res.setType(parseCodeableConcept(getJObject(json, "type")));
20066    if (json.has("productName"))
20067      res.setProductNameElement(parseString(json.get("productName").getAsString()));
20068    if (json.has("_productName"))
20069      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
20070    if (json.has("schedule")) {
20071      JsonArray array = getJArray(json, "schedule");
20072      for (int i = 0; i < array.size(); i++) {
20073        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
20074      }
20075    };
20076    if (json.has("quantity"))
20077      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
20078    if (json.has("instruction"))
20079      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
20080    if (json.has("_instruction"))
20081      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
20082  }
20083
20084  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderEnteralFormulaComponent(JsonObject json) throws IOException, FHIRFormatError {
20085    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
20086    parseNutritionOrderEnteralFormulaComponentProperties(json, res);
20087    return res;
20088  }
20089
20090  protected void parseNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
20091    parseBackboneElementProperties(json, res);
20092    if (json.has("baseFormulaType"))
20093      res.setBaseFormulaType(parseCodeableConcept(getJObject(json, "baseFormulaType")));
20094    if (json.has("baseFormulaProductName"))
20095      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
20096    if (json.has("_baseFormulaProductName"))
20097      parseElementProperties(getJObject(json, "_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
20098    if (json.has("additiveType"))
20099      res.setAdditiveType(parseCodeableConcept(getJObject(json, "additiveType")));
20100    if (json.has("additiveProductName"))
20101      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
20102    if (json.has("_additiveProductName"))
20103      parseElementProperties(getJObject(json, "_additiveProductName"), res.getAdditiveProductNameElement());
20104    if (json.has("caloricDensity"))
20105      res.setCaloricDensity(parseQuantity(getJObject(json, "caloricDensity")));
20106    if (json.has("routeofAdministration"))
20107      res.setRouteofAdministration(parseCodeableConcept(getJObject(json, "routeofAdministration")));
20108    if (json.has("administration")) {
20109      JsonArray array = getJArray(json, "administration");
20110      for (int i = 0; i < array.size(); i++) {
20111        res.getAdministration().add(parseNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject()));
20112      }
20113    };
20114    if (json.has("maxVolumeToDeliver"))
20115      res.setMaxVolumeToDeliver(parseQuantity(getJObject(json, "maxVolumeToDeliver")));
20116    if (json.has("administrationInstruction"))
20117      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
20118    if (json.has("_administrationInstruction"))
20119      parseElementProperties(getJObject(json, "_administrationInstruction"), res.getAdministrationInstructionElement());
20120  }
20121
20122  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
20123    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
20124    parseNutritionOrderEnteralFormulaAdministrationComponentProperties(json, res);
20125    return res;
20126  }
20127
20128  protected void parseNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
20129    parseBackboneElementProperties(json, res);
20130    if (json.has("schedule"))
20131      res.setSchedule(parseTiming(getJObject(json, "schedule")));
20132    if (json.has("quantity"))
20133      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
20134    DataType rate = parseType("rate", json);
20135    if (rate != null)
20136      res.setRate(rate);
20137  }
20138
20139  protected NutritionProduct parseNutritionProduct(JsonObject json) throws IOException, FHIRFormatError {
20140    NutritionProduct res = new NutritionProduct();
20141    parseNutritionProductProperties(json, res);
20142    return res;
20143  }
20144
20145  protected void parseNutritionProductProperties(JsonObject json, NutritionProduct res) throws IOException, FHIRFormatError {
20146    parseDomainResourceProperties(json, res);
20147    if (json.has("status"))
20148      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionProduct.NutritionProductStatus.NULL, new NutritionProduct.NutritionProductStatusEnumFactory()));
20149    if (json.has("_status"))
20150      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20151    if (json.has("category")) {
20152      JsonArray array = getJArray(json, "category");
20153      for (int i = 0; i < array.size(); i++) {
20154        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20155      }
20156    };
20157    if (json.has("code"))
20158      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20159    if (json.has("manufacturer")) {
20160      JsonArray array = getJArray(json, "manufacturer");
20161      for (int i = 0; i < array.size(); i++) {
20162        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20163      }
20164    };
20165    if (json.has("nutrient")) {
20166      JsonArray array = getJArray(json, "nutrient");
20167      for (int i = 0; i < array.size(); i++) {
20168        res.getNutrient().add(parseNutritionProductNutrientComponent(array.get(i).getAsJsonObject()));
20169      }
20170    };
20171    if (json.has("ingredient")) {
20172      JsonArray array = getJArray(json, "ingredient");
20173      for (int i = 0; i < array.size(); i++) {
20174        res.getIngredient().add(parseNutritionProductIngredientComponent(array.get(i).getAsJsonObject()));
20175      }
20176    };
20177    if (json.has("knownAllergen")) {
20178      JsonArray array = getJArray(json, "knownAllergen");
20179      for (int i = 0; i < array.size(); i++) {
20180        res.getKnownAllergen().add(parseCodeableReference(array.get(i).getAsJsonObject()));
20181      }
20182    };
20183    if (json.has("productCharacteristic")) {
20184      JsonArray array = getJArray(json, "productCharacteristic");
20185      for (int i = 0; i < array.size(); i++) {
20186        res.getProductCharacteristic().add(parseNutritionProductProductCharacteristicComponent(array.get(i).getAsJsonObject()));
20187      }
20188    };
20189    if (json.has("instance"))
20190      res.setInstance(parseNutritionProductInstanceComponent(getJObject(json, "instance")));
20191    if (json.has("note")) {
20192      JsonArray array = getJArray(json, "note");
20193      for (int i = 0; i < array.size(); i++) {
20194        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20195      }
20196    };
20197  }
20198
20199  protected NutritionProduct.NutritionProductNutrientComponent parseNutritionProductNutrientComponent(JsonObject json) throws IOException, FHIRFormatError {
20200    NutritionProduct.NutritionProductNutrientComponent res = new NutritionProduct.NutritionProductNutrientComponent();
20201    parseNutritionProductNutrientComponentProperties(json, res);
20202    return res;
20203  }
20204
20205  protected void parseNutritionProductNutrientComponentProperties(JsonObject json, NutritionProduct.NutritionProductNutrientComponent res) throws IOException, FHIRFormatError {
20206    parseBackboneElementProperties(json, res);
20207    if (json.has("item"))
20208      res.setItem(parseCodeableReference(getJObject(json, "item")));
20209    if (json.has("amount")) {
20210      JsonArray array = getJArray(json, "amount");
20211      for (int i = 0; i < array.size(); i++) {
20212        res.getAmount().add(parseRatio(array.get(i).getAsJsonObject()));
20213      }
20214    };
20215  }
20216
20217  protected NutritionProduct.NutritionProductIngredientComponent parseNutritionProductIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
20218    NutritionProduct.NutritionProductIngredientComponent res = new NutritionProduct.NutritionProductIngredientComponent();
20219    parseNutritionProductIngredientComponentProperties(json, res);
20220    return res;
20221  }
20222
20223  protected void parseNutritionProductIngredientComponentProperties(JsonObject json, NutritionProduct.NutritionProductIngredientComponent res) throws IOException, FHIRFormatError {
20224    parseBackboneElementProperties(json, res);
20225    if (json.has("item"))
20226      res.setItem(parseCodeableReference(getJObject(json, "item")));
20227    if (json.has("amount")) {
20228      JsonArray array = getJArray(json, "amount");
20229      for (int i = 0; i < array.size(); i++) {
20230        res.getAmount().add(parseRatio(array.get(i).getAsJsonObject()));
20231      }
20232    };
20233  }
20234
20235  protected NutritionProduct.NutritionProductProductCharacteristicComponent parseNutritionProductProductCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
20236    NutritionProduct.NutritionProductProductCharacteristicComponent res = new NutritionProduct.NutritionProductProductCharacteristicComponent();
20237    parseNutritionProductProductCharacteristicComponentProperties(json, res);
20238    return res;
20239  }
20240
20241  protected void parseNutritionProductProductCharacteristicComponentProperties(JsonObject json, NutritionProduct.NutritionProductProductCharacteristicComponent res) throws IOException, FHIRFormatError {
20242    parseBackboneElementProperties(json, res);
20243    if (json.has("type"))
20244      res.setType(parseCodeableConcept(getJObject(json, "type")));
20245    DataType value = parseType("value", json);
20246    if (value != null)
20247      res.setValue(value);
20248  }
20249
20250  protected NutritionProduct.NutritionProductInstanceComponent parseNutritionProductInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
20251    NutritionProduct.NutritionProductInstanceComponent res = new NutritionProduct.NutritionProductInstanceComponent();
20252    parseNutritionProductInstanceComponentProperties(json, res);
20253    return res;
20254  }
20255
20256  protected void parseNutritionProductInstanceComponentProperties(JsonObject json, NutritionProduct.NutritionProductInstanceComponent res) throws IOException, FHIRFormatError {
20257    parseBackboneElementProperties(json, res);
20258    if (json.has("quantity"))
20259      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
20260    if (json.has("identifier")) {
20261      JsonArray array = getJArray(json, "identifier");
20262      for (int i = 0; i < array.size(); i++) {
20263        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20264      }
20265    };
20266    if (json.has("lotNumber"))
20267      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
20268    if (json.has("_lotNumber"))
20269      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
20270    if (json.has("expiry"))
20271      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
20272    if (json.has("_expiry"))
20273      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
20274    if (json.has("useBy"))
20275      res.setUseByElement(parseDateTime(json.get("useBy").getAsString()));
20276    if (json.has("_useBy"))
20277      parseElementProperties(getJObject(json, "_useBy"), res.getUseByElement());
20278  }
20279
20280  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
20281    Observation res = new Observation();
20282    parseObservationProperties(json, res);
20283    return res;
20284  }
20285
20286  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
20287    parseDomainResourceProperties(json, res);
20288    if (json.has("identifier")) {
20289      JsonArray array = getJArray(json, "identifier");
20290      for (int i = 0; i < array.size(); i++) {
20291        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20292      }
20293    };
20294    if (json.has("basedOn")) {
20295      JsonArray array = getJArray(json, "basedOn");
20296      for (int i = 0; i < array.size(); i++) {
20297        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20298      }
20299    };
20300    if (json.has("partOf")) {
20301      JsonArray array = getJArray(json, "partOf");
20302      for (int i = 0; i < array.size(); i++) {
20303        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
20304      }
20305    };
20306    if (json.has("status"))
20307      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
20308    if (json.has("_status"))
20309      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20310    if (json.has("category")) {
20311      JsonArray array = getJArray(json, "category");
20312      for (int i = 0; i < array.size(); i++) {
20313        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20314      }
20315    };
20316    if (json.has("code"))
20317      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20318    if (json.has("subject"))
20319      res.setSubject(parseReference(getJObject(json, "subject")));
20320    if (json.has("focus")) {
20321      JsonArray array = getJArray(json, "focus");
20322      for (int i = 0; i < array.size(); i++) {
20323        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
20324      }
20325    };
20326    if (json.has("encounter"))
20327      res.setEncounter(parseReference(getJObject(json, "encounter")));
20328    DataType effective = parseType("effective", json);
20329    if (effective != null)
20330      res.setEffective(effective);
20331    if (json.has("issued"))
20332      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
20333    if (json.has("_issued"))
20334      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
20335    if (json.has("performer")) {
20336      JsonArray array = getJArray(json, "performer");
20337      for (int i = 0; i < array.size(); i++) {
20338        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
20339      }
20340    };
20341    DataType value = parseType("value", json);
20342    if (value != null)
20343      res.setValue(value);
20344    if (json.has("dataAbsentReason"))
20345      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
20346    if (json.has("interpretation")) {
20347      JsonArray array = getJArray(json, "interpretation");
20348      for (int i = 0; i < array.size(); i++) {
20349        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20350      }
20351    };
20352    if (json.has("note")) {
20353      JsonArray array = getJArray(json, "note");
20354      for (int i = 0; i < array.size(); i++) {
20355        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20356      }
20357    };
20358    if (json.has("bodySite"))
20359      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
20360    if (json.has("method"))
20361      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
20362    if (json.has("specimen"))
20363      res.setSpecimen(parseReference(getJObject(json, "specimen")));
20364    if (json.has("device"))
20365      res.setDevice(parseReference(getJObject(json, "device")));
20366    if (json.has("referenceRange")) {
20367      JsonArray array = getJArray(json, "referenceRange");
20368      for (int i = 0; i < array.size(); i++) {
20369        res.getReferenceRange().add(parseObservationReferenceRangeComponent(array.get(i).getAsJsonObject()));
20370      }
20371    };
20372    if (json.has("hasMember")) {
20373      JsonArray array = getJArray(json, "hasMember");
20374      for (int i = 0; i < array.size(); i++) {
20375        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
20376      }
20377    };
20378    if (json.has("derivedFrom")) {
20379      JsonArray array = getJArray(json, "derivedFrom");
20380      for (int i = 0; i < array.size(); i++) {
20381        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
20382      }
20383    };
20384    if (json.has("component")) {
20385      JsonArray array = getJArray(json, "component");
20386      for (int i = 0; i < array.size(); i++) {
20387        res.getComponent().add(parseObservationComponentComponent(array.get(i).getAsJsonObject()));
20388      }
20389    };
20390  }
20391
20392  protected Observation.ObservationReferenceRangeComponent parseObservationReferenceRangeComponent(JsonObject json) throws IOException, FHIRFormatError {
20393    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
20394    parseObservationReferenceRangeComponentProperties(json, res);
20395    return res;
20396  }
20397
20398  protected void parseObservationReferenceRangeComponentProperties(JsonObject json, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
20399    parseBackboneElementProperties(json, res);
20400    if (json.has("low"))
20401      res.setLow(parseQuantity(getJObject(json, "low")));
20402    if (json.has("high"))
20403      res.setHigh(parseQuantity(getJObject(json, "high")));
20404    if (json.has("type"))
20405      res.setType(parseCodeableConcept(getJObject(json, "type")));
20406    if (json.has("appliesTo")) {
20407      JsonArray array = getJArray(json, "appliesTo");
20408      for (int i = 0; i < array.size(); i++) {
20409        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20410      }
20411    };
20412    if (json.has("age"))
20413      res.setAge(parseRange(getJObject(json, "age")));
20414    if (json.has("text"))
20415      res.setTextElement(parseString(json.get("text").getAsString()));
20416    if (json.has("_text"))
20417      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
20418  }
20419
20420  protected Observation.ObservationComponentComponent parseObservationComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
20421    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
20422    parseObservationComponentComponentProperties(json, res);
20423    return res;
20424  }
20425
20426  protected void parseObservationComponentComponentProperties(JsonObject json, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
20427    parseBackboneElementProperties(json, res);
20428    if (json.has("code"))
20429      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20430    DataType value = parseType("value", json);
20431    if (value != null)
20432      res.setValue(value);
20433    if (json.has("dataAbsentReason"))
20434      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
20435    if (json.has("interpretation")) {
20436      JsonArray array = getJArray(json, "interpretation");
20437      for (int i = 0; i < array.size(); i++) {
20438        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20439      }
20440    };
20441    if (json.has("referenceRange")) {
20442      JsonArray array = getJArray(json, "referenceRange");
20443      for (int i = 0; i < array.size(); i++) {
20444        res.getReferenceRange().add(parseObservationReferenceRangeComponent(array.get(i).getAsJsonObject()));
20445      }
20446    };
20447  }
20448
20449  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
20450    ObservationDefinition res = new ObservationDefinition();
20451    parseObservationDefinitionProperties(json, res);
20452    return res;
20453  }
20454
20455  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
20456    parseDomainResourceProperties(json, res);
20457    if (json.has("category")) {
20458      JsonArray array = getJArray(json, "category");
20459      for (int i = 0; i < array.size(); i++) {
20460        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20461      }
20462    };
20463    if (json.has("code"))
20464      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20465    if (json.has("identifier")) {
20466      JsonArray array = getJArray(json, "identifier");
20467      for (int i = 0; i < array.size(); i++) {
20468        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20469      }
20470    };
20471    if (json.has("permittedDataType")) {
20472      JsonArray array = getJArray(json, "permittedDataType");
20473      for (int i = 0; i < array.size(); i++) {
20474        if (array.get(i).isJsonNull()) {
20475          res.getPermittedDataType().add(new Enumeration<ObservationDefinition.ObservationDataType>(new ObservationDefinition.ObservationDataTypeEnumFactory(), ObservationDefinition.ObservationDataType.NULL));
20476        } else {;
20477          res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
20478        }
20479      }
20480    };
20481    if (json.has("_permittedDataType")) {
20482      JsonArray array = getJArray(json, "_permittedDataType");
20483      for (int i = 0; i < array.size(); i++) {
20484        if (i == res.getPermittedDataType().size())
20485          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
20486        if (array.get(i) instanceof JsonObject) 
20487          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
20488      }
20489    };
20490    if (json.has("multipleResultsAllowed"))
20491      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
20492    if (json.has("_multipleResultsAllowed"))
20493      parseElementProperties(getJObject(json, "_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
20494    if (json.has("method"))
20495      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
20496    if (json.has("preferredReportName"))
20497      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
20498    if (json.has("_preferredReportName"))
20499      parseElementProperties(getJObject(json, "_preferredReportName"), res.getPreferredReportNameElement());
20500    if (json.has("quantitativeDetails"))
20501      res.setQuantitativeDetails(parseObservationDefinitionQuantitativeDetailsComponent(getJObject(json, "quantitativeDetails")));
20502    if (json.has("qualifiedInterval")) {
20503      JsonArray array = getJArray(json, "qualifiedInterval");
20504      for (int i = 0; i < array.size(); i++) {
20505        res.getQualifiedInterval().add(parseObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject()));
20506      }
20507    };
20508    if (json.has("validCodedValueSet"))
20509      res.setValidCodedValueSet(parseReference(getJObject(json, "validCodedValueSet")));
20510    if (json.has("normalCodedValueSet"))
20511      res.setNormalCodedValueSet(parseReference(getJObject(json, "normalCodedValueSet")));
20512    if (json.has("abnormalCodedValueSet"))
20513      res.setAbnormalCodedValueSet(parseReference(getJObject(json, "abnormalCodedValueSet")));
20514    if (json.has("criticalCodedValueSet"))
20515      res.setCriticalCodedValueSet(parseReference(getJObject(json, "criticalCodedValueSet")));
20516  }
20517
20518  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionQuantitativeDetailsComponent(JsonObject json) throws IOException, FHIRFormatError {
20519    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
20520    parseObservationDefinitionQuantitativeDetailsComponentProperties(json, res);
20521    return res;
20522  }
20523
20524  protected void parseObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
20525    parseBackboneElementProperties(json, res);
20526    if (json.has("customaryUnit"))
20527      res.setCustomaryUnit(parseCodeableConcept(getJObject(json, "customaryUnit")));
20528    if (json.has("unit"))
20529      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
20530    if (json.has("conversionFactor"))
20531      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
20532    if (json.has("_conversionFactor"))
20533      parseElementProperties(getJObject(json, "_conversionFactor"), res.getConversionFactorElement());
20534    if (json.has("decimalPrecision"))
20535      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
20536    if (json.has("_decimalPrecision"))
20537      parseElementProperties(getJObject(json, "_decimalPrecision"), res.getDecimalPrecisionElement());
20538  }
20539
20540  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionQualifiedIntervalComponent(JsonObject json) throws IOException, FHIRFormatError {
20541    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
20542    parseObservationDefinitionQualifiedIntervalComponentProperties(json, res);
20543    return res;
20544  }
20545
20546  protected void parseObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
20547    parseBackboneElementProperties(json, res);
20548    if (json.has("category"))
20549      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
20550    if (json.has("_category"))
20551      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
20552    if (json.has("range"))
20553      res.setRange(parseRange(getJObject(json, "range")));
20554    if (json.has("context"))
20555      res.setContext(parseCodeableConcept(getJObject(json, "context")));
20556    if (json.has("appliesTo")) {
20557      JsonArray array = getJArray(json, "appliesTo");
20558      for (int i = 0; i < array.size(); i++) {
20559        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20560      }
20561    };
20562    if (json.has("gender"))
20563      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20564    if (json.has("_gender"))
20565      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
20566    if (json.has("age"))
20567      res.setAge(parseRange(getJObject(json, "age")));
20568    if (json.has("gestationalAge"))
20569      res.setGestationalAge(parseRange(getJObject(json, "gestationalAge")));
20570    if (json.has("condition"))
20571      res.setConditionElement(parseString(json.get("condition").getAsString()));
20572    if (json.has("_condition"))
20573      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
20574  }
20575
20576  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
20577    OperationDefinition res = new OperationDefinition();
20578    parseOperationDefinitionProperties(json, res);
20579    return res;
20580  }
20581
20582  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
20583    parseDomainResourceProperties(json, res);
20584    if (json.has("url"))
20585      res.setUrlElement(parseUri(json.get("url").getAsString()));
20586    if (json.has("_url"))
20587      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
20588    if (json.has("version"))
20589      res.setVersionElement(parseString(json.get("version").getAsString()));
20590    if (json.has("_version"))
20591      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
20592    if (json.has("name"))
20593      res.setNameElement(parseString(json.get("name").getAsString()));
20594    if (json.has("_name"))
20595      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20596    if (json.has("title"))
20597      res.setTitleElement(parseString(json.get("title").getAsString()));
20598    if (json.has("_title"))
20599      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20600    if (json.has("status"))
20601      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20602    if (json.has("_status"))
20603      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20604    if (json.has("kind"))
20605      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
20606    if (json.has("_kind"))
20607      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
20608    if (json.has("experimental"))
20609      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20610    if (json.has("_experimental"))
20611      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
20612    if (json.has("date"))
20613      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20614    if (json.has("_date"))
20615      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20616    if (json.has("publisher"))
20617      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20618    if (json.has("_publisher"))
20619      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
20620    if (json.has("contact")) {
20621      JsonArray array = getJArray(json, "contact");
20622      for (int i = 0; i < array.size(); i++) {
20623        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20624      }
20625    };
20626    if (json.has("description"))
20627      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20628    if (json.has("_description"))
20629      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20630    if (json.has("useContext")) {
20631      JsonArray array = getJArray(json, "useContext");
20632      for (int i = 0; i < array.size(); i++) {
20633        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20634      }
20635    };
20636    if (json.has("jurisdiction")) {
20637      JsonArray array = getJArray(json, "jurisdiction");
20638      for (int i = 0; i < array.size(); i++) {
20639        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20640      }
20641    };
20642    if (json.has("purpose"))
20643      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20644    if (json.has("_purpose"))
20645      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
20646    if (json.has("affectsState"))
20647      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
20648    if (json.has("_affectsState"))
20649      parseElementProperties(getJObject(json, "_affectsState"), res.getAffectsStateElement());
20650    if (json.has("code"))
20651      res.setCodeElement(parseCode(json.get("code").getAsString()));
20652    if (json.has("_code"))
20653      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
20654    if (json.has("comment"))
20655      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
20656    if (json.has("_comment"))
20657      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
20658    if (json.has("base"))
20659      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
20660    if (json.has("_base"))
20661      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
20662    if (json.has("resource")) {
20663      JsonArray array = getJArray(json, "resource");
20664      for (int i = 0; i < array.size(); i++) {
20665        if (array.get(i).isJsonNull()) {
20666          res.getResource().add(new CodeType());
20667        } else {;
20668          res.getResource().add(parseCode(array.get(i).getAsString()));
20669        }
20670      }
20671    };
20672    if (json.has("_resource")) {
20673      JsonArray array = getJArray(json, "_resource");
20674      for (int i = 0; i < array.size(); i++) {
20675        if (i == res.getResource().size())
20676          res.getResource().add(parseCode(null));
20677        if (array.get(i) instanceof JsonObject) 
20678          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
20679      }
20680    };
20681    if (json.has("system"))
20682      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
20683    if (json.has("_system"))
20684      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
20685    if (json.has("type"))
20686      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
20687    if (json.has("_type"))
20688      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
20689    if (json.has("instance"))
20690      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
20691    if (json.has("_instance"))
20692      parseElementProperties(getJObject(json, "_instance"), res.getInstanceElement());
20693    if (json.has("inputProfile"))
20694      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
20695    if (json.has("_inputProfile"))
20696      parseElementProperties(getJObject(json, "_inputProfile"), res.getInputProfileElement());
20697    if (json.has("outputProfile"))
20698      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
20699    if (json.has("_outputProfile"))
20700      parseElementProperties(getJObject(json, "_outputProfile"), res.getOutputProfileElement());
20701    if (json.has("parameter")) {
20702      JsonArray array = getJArray(json, "parameter");
20703      for (int i = 0; i < array.size(); i++) {
20704        res.getParameter().add(parseOperationDefinitionParameterComponent(array.get(i).getAsJsonObject()));
20705      }
20706    };
20707    if (json.has("overload")) {
20708      JsonArray array = getJArray(json, "overload");
20709      for (int i = 0; i < array.size(); i++) {
20710        res.getOverload().add(parseOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject()));
20711      }
20712    };
20713  }
20714
20715  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
20716    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
20717    parseOperationDefinitionParameterComponentProperties(json, res);
20718    return res;
20719  }
20720
20721  protected void parseOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
20722    parseBackboneElementProperties(json, res);
20723    if (json.has("name"))
20724      res.setNameElement(parseCode(json.get("name").getAsString()));
20725    if (json.has("_name"))
20726      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20727    if (json.has("use"))
20728      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
20729    if (json.has("_use"))
20730      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
20731    if (json.has("min"))
20732      res.setMinElement(parseInteger(json.get("min").getAsLong()));
20733    if (json.has("_min"))
20734      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
20735    if (json.has("max"))
20736      res.setMaxElement(parseString(json.get("max").getAsString()));
20737    if (json.has("_max"))
20738      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
20739    if (json.has("documentation"))
20740      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
20741    if (json.has("_documentation"))
20742      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
20743    if (json.has("type"))
20744      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
20745    if (json.has("_type"))
20746      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
20747    if (json.has("targetProfile")) {
20748      JsonArray array = getJArray(json, "targetProfile");
20749      for (int i = 0; i < array.size(); i++) {
20750        if (array.get(i).isJsonNull()) {
20751          res.getTargetProfile().add(new CanonicalType());
20752        } else {;
20753          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
20754        }
20755      }
20756    };
20757    if (json.has("_targetProfile")) {
20758      JsonArray array = getJArray(json, "_targetProfile");
20759      for (int i = 0; i < array.size(); i++) {
20760        if (i == res.getTargetProfile().size())
20761          res.getTargetProfile().add(parseCanonical(null));
20762        if (array.get(i) instanceof JsonObject) 
20763          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
20764      }
20765    };
20766    if (json.has("searchType"))
20767      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
20768    if (json.has("_searchType"))
20769      parseElementProperties(getJObject(json, "_searchType"), res.getSearchTypeElement());
20770    if (json.has("binding"))
20771      res.setBinding(parseOperationDefinitionParameterBindingComponent(getJObject(json, "binding")));
20772    if (json.has("referencedFrom")) {
20773      JsonArray array = getJArray(json, "referencedFrom");
20774      for (int i = 0; i < array.size(); i++) {
20775        res.getReferencedFrom().add(parseOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject()));
20776      }
20777    };
20778    if (json.has("part")) {
20779      JsonArray array = getJArray(json, "part");
20780      for (int i = 0; i < array.size(); i++) {
20781        res.getPart().add(parseOperationDefinitionParameterComponent(array.get(i).getAsJsonObject()));
20782      }
20783    };
20784  }
20785
20786  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionParameterBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
20787    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
20788    parseOperationDefinitionParameterBindingComponentProperties(json, res);
20789    return res;
20790  }
20791
20792  protected void parseOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
20793    parseBackboneElementProperties(json, res);
20794    if (json.has("strength"))
20795      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
20796    if (json.has("_strength"))
20797      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
20798    if (json.has("valueSet"))
20799      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
20800    if (json.has("_valueSet"))
20801      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
20802  }
20803
20804  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionParameterReferencedFromComponent(JsonObject json) throws IOException, FHIRFormatError {
20805    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
20806    parseOperationDefinitionParameterReferencedFromComponentProperties(json, res);
20807    return res;
20808  }
20809
20810  protected void parseOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
20811    parseBackboneElementProperties(json, res);
20812    if (json.has("source"))
20813      res.setSourceElement(parseString(json.get("source").getAsString()));
20814    if (json.has("_source"))
20815      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
20816    if (json.has("sourceId"))
20817      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
20818    if (json.has("_sourceId"))
20819      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
20820  }
20821
20822  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOverloadComponent(JsonObject json) throws IOException, FHIRFormatError {
20823    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
20824    parseOperationDefinitionOverloadComponentProperties(json, res);
20825    return res;
20826  }
20827
20828  protected void parseOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
20829    parseBackboneElementProperties(json, res);
20830    if (json.has("parameterName")) {
20831      JsonArray array = getJArray(json, "parameterName");
20832      for (int i = 0; i < array.size(); i++) {
20833        if (array.get(i).isJsonNull()) {
20834          res.getParameterName().add(new StringType());
20835        } else {;
20836          res.getParameterName().add(parseString(array.get(i).getAsString()));
20837        }
20838      }
20839    };
20840    if (json.has("_parameterName")) {
20841      JsonArray array = getJArray(json, "_parameterName");
20842      for (int i = 0; i < array.size(); i++) {
20843        if (i == res.getParameterName().size())
20844          res.getParameterName().add(parseString(null));
20845        if (array.get(i) instanceof JsonObject) 
20846          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
20847      }
20848    };
20849    if (json.has("comment"))
20850      res.setCommentElement(parseString(json.get("comment").getAsString()));
20851    if (json.has("_comment"))
20852      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
20853  }
20854
20855  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
20856    OperationOutcome res = new OperationOutcome();
20857    parseOperationOutcomeProperties(json, res);
20858    return res;
20859  }
20860
20861  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
20862    parseDomainResourceProperties(json, res);
20863    if (json.has("issue")) {
20864      JsonArray array = getJArray(json, "issue");
20865      for (int i = 0; i < array.size(); i++) {
20866        res.getIssue().add(parseOperationOutcomeIssueComponent(array.get(i).getAsJsonObject()));
20867      }
20868    };
20869  }
20870
20871  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeIssueComponent(JsonObject json) throws IOException, FHIRFormatError {
20872    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
20873    parseOperationOutcomeIssueComponentProperties(json, res);
20874    return res;
20875  }
20876
20877  protected void parseOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
20878    parseBackboneElementProperties(json, res);
20879    if (json.has("severity"))
20880      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
20881    if (json.has("_severity"))
20882      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
20883    if (json.has("code"))
20884      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
20885    if (json.has("_code"))
20886      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
20887    if (json.has("details"))
20888      res.setDetails(parseCodeableConcept(getJObject(json, "details")));
20889    if (json.has("diagnostics"))
20890      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
20891    if (json.has("_diagnostics"))
20892      parseElementProperties(getJObject(json, "_diagnostics"), res.getDiagnosticsElement());
20893    if (json.has("location")) {
20894      JsonArray array = getJArray(json, "location");
20895      for (int i = 0; i < array.size(); i++) {
20896        if (array.get(i).isJsonNull()) {
20897          res.getLocation().add(new StringType());
20898        } else {;
20899          res.getLocation().add(parseString(array.get(i).getAsString()));
20900        }
20901      }
20902    };
20903    if (json.has("_location")) {
20904      JsonArray array = getJArray(json, "_location");
20905      for (int i = 0; i < array.size(); i++) {
20906        if (i == res.getLocation().size())
20907          res.getLocation().add(parseString(null));
20908        if (array.get(i) instanceof JsonObject) 
20909          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
20910      }
20911    };
20912    if (json.has("expression")) {
20913      JsonArray array = getJArray(json, "expression");
20914      for (int i = 0; i < array.size(); i++) {
20915        if (array.get(i).isJsonNull()) {
20916          res.getExpression().add(new StringType());
20917        } else {;
20918          res.getExpression().add(parseString(array.get(i).getAsString()));
20919        }
20920      }
20921    };
20922    if (json.has("_expression")) {
20923      JsonArray array = getJArray(json, "_expression");
20924      for (int i = 0; i < array.size(); i++) {
20925        if (i == res.getExpression().size())
20926          res.getExpression().add(parseString(null));
20927        if (array.get(i) instanceof JsonObject) 
20928          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
20929      }
20930    };
20931  }
20932
20933  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
20934    Organization res = new Organization();
20935    parseOrganizationProperties(json, res);
20936    return res;
20937  }
20938
20939  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
20940    parseDomainResourceProperties(json, res);
20941    if (json.has("identifier")) {
20942      JsonArray array = getJArray(json, "identifier");
20943      for (int i = 0; i < array.size(); i++) {
20944        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20945      }
20946    };
20947    if (json.has("active"))
20948      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20949    if (json.has("_active"))
20950      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20951    if (json.has("type")) {
20952      JsonArray array = getJArray(json, "type");
20953      for (int i = 0; i < array.size(); i++) {
20954        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20955      }
20956    };
20957    if (json.has("name"))
20958      res.setNameElement(parseString(json.get("name").getAsString()));
20959    if (json.has("_name"))
20960      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20961    if (json.has("alias")) {
20962      JsonArray array = getJArray(json, "alias");
20963      for (int i = 0; i < array.size(); i++) {
20964        if (array.get(i).isJsonNull()) {
20965          res.getAlias().add(new StringType());
20966        } else {;
20967          res.getAlias().add(parseString(array.get(i).getAsString()));
20968        }
20969      }
20970    };
20971    if (json.has("_alias")) {
20972      JsonArray array = getJArray(json, "_alias");
20973      for (int i = 0; i < array.size(); i++) {
20974        if (i == res.getAlias().size())
20975          res.getAlias().add(parseString(null));
20976        if (array.get(i) instanceof JsonObject) 
20977          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
20978      }
20979    };
20980    if (json.has("telecom")) {
20981      JsonArray array = getJArray(json, "telecom");
20982      for (int i = 0; i < array.size(); i++) {
20983        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20984      }
20985    };
20986    if (json.has("address")) {
20987      JsonArray array = getJArray(json, "address");
20988      for (int i = 0; i < array.size(); i++) {
20989        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20990      }
20991    };
20992    if (json.has("partOf"))
20993      res.setPartOf(parseReference(getJObject(json, "partOf")));
20994    if (json.has("contact")) {
20995      JsonArray array = getJArray(json, "contact");
20996      for (int i = 0; i < array.size(); i++) {
20997        res.getContact().add(parseOrganizationContactComponent(array.get(i).getAsJsonObject()));
20998      }
20999    };
21000    if (json.has("endpoint")) {
21001      JsonArray array = getJArray(json, "endpoint");
21002      for (int i = 0; i < array.size(); i++) {
21003        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
21004      }
21005    };
21006  }
21007
21008  protected Organization.OrganizationContactComponent parseOrganizationContactComponent(JsonObject json) throws IOException, FHIRFormatError {
21009    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
21010    parseOrganizationContactComponentProperties(json, res);
21011    return res;
21012  }
21013
21014  protected void parseOrganizationContactComponentProperties(JsonObject json, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
21015    parseBackboneElementProperties(json, res);
21016    if (json.has("purpose"))
21017      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
21018    if (json.has("name"))
21019      res.setName(parseHumanName(getJObject(json, "name")));
21020    if (json.has("telecom")) {
21021      JsonArray array = getJArray(json, "telecom");
21022      for (int i = 0; i < array.size(); i++) {
21023        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21024      }
21025    };
21026    if (json.has("address"))
21027      res.setAddress(parseAddress(getJObject(json, "address")));
21028  }
21029
21030  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
21031    OrganizationAffiliation res = new OrganizationAffiliation();
21032    parseOrganizationAffiliationProperties(json, res);
21033    return res;
21034  }
21035
21036  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
21037    parseDomainResourceProperties(json, res);
21038    if (json.has("identifier")) {
21039      JsonArray array = getJArray(json, "identifier");
21040      for (int i = 0; i < array.size(); i++) {
21041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21042      }
21043    };
21044    if (json.has("active"))
21045      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21046    if (json.has("_active"))
21047      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
21048    if (json.has("period"))
21049      res.setPeriod(parsePeriod(getJObject(json, "period")));
21050    if (json.has("organization"))
21051      res.setOrganization(parseReference(getJObject(json, "organization")));
21052    if (json.has("participatingOrganization"))
21053      res.setParticipatingOrganization(parseReference(getJObject(json, "participatingOrganization")));
21054    if (json.has("network")) {
21055      JsonArray array = getJArray(json, "network");
21056      for (int i = 0; i < array.size(); i++) {
21057        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
21058      }
21059    };
21060    if (json.has("code")) {
21061      JsonArray array = getJArray(json, "code");
21062      for (int i = 0; i < array.size(); i++) {
21063        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21064      }
21065    };
21066    if (json.has("specialty")) {
21067      JsonArray array = getJArray(json, "specialty");
21068      for (int i = 0; i < array.size(); i++) {
21069        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21070      }
21071    };
21072    if (json.has("location")) {
21073      JsonArray array = getJArray(json, "location");
21074      for (int i = 0; i < array.size(); i++) {
21075        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
21076      }
21077    };
21078    if (json.has("healthcareService")) {
21079      JsonArray array = getJArray(json, "healthcareService");
21080      for (int i = 0; i < array.size(); i++) {
21081        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
21082      }
21083    };
21084    if (json.has("telecom")) {
21085      JsonArray array = getJArray(json, "telecom");
21086      for (int i = 0; i < array.size(); i++) {
21087        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21088      }
21089    };
21090    if (json.has("endpoint")) {
21091      JsonArray array = getJArray(json, "endpoint");
21092      for (int i = 0; i < array.size(); i++) {
21093        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
21094      }
21095    };
21096  }
21097
21098  protected PackagedProductDefinition parsePackagedProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
21099    PackagedProductDefinition res = new PackagedProductDefinition();
21100    parsePackagedProductDefinitionProperties(json, res);
21101    return res;
21102  }
21103
21104  protected void parsePackagedProductDefinitionProperties(JsonObject json, PackagedProductDefinition res) throws IOException, FHIRFormatError {
21105    parseDomainResourceProperties(json, res);
21106    if (json.has("identifier")) {
21107      JsonArray array = getJArray(json, "identifier");
21108      for (int i = 0; i < array.size(); i++) {
21109        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21110      }
21111    };
21112    if (json.has("name"))
21113      res.setNameElement(parseString(json.get("name").getAsString()));
21114    if (json.has("_name"))
21115      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21116    if (json.has("type"))
21117      res.setType(parseCodeableConcept(getJObject(json, "type")));
21118    if (json.has("packageFor")) {
21119      JsonArray array = getJArray(json, "packageFor");
21120      for (int i = 0; i < array.size(); i++) {
21121        res.getPackageFor().add(parseReference(array.get(i).getAsJsonObject()));
21122      }
21123    };
21124    if (json.has("status"))
21125      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
21126    if (json.has("statusDate"))
21127      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
21128    if (json.has("_statusDate"))
21129      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
21130    if (json.has("containedItemQuantity")) {
21131      JsonArray array = getJArray(json, "containedItemQuantity");
21132      for (int i = 0; i < array.size(); i++) {
21133        res.getContainedItemQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
21134      }
21135    };
21136    if (json.has("description"))
21137      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21138    if (json.has("_description"))
21139      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21140    if (json.has("legalStatusOfSupply")) {
21141      JsonArray array = getJArray(json, "legalStatusOfSupply");
21142      for (int i = 0; i < array.size(); i++) {
21143        res.getLegalStatusOfSupply().add(parsePackagedProductDefinitionLegalStatusOfSupplyComponent(array.get(i).getAsJsonObject()));
21144      }
21145    };
21146    if (json.has("marketingStatus")) {
21147      JsonArray array = getJArray(json, "marketingStatus");
21148      for (int i = 0; i < array.size(); i++) {
21149        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
21150      }
21151    };
21152    if (json.has("characteristic")) {
21153      JsonArray array = getJArray(json, "characteristic");
21154      for (int i = 0; i < array.size(); i++) {
21155        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21156      }
21157    };
21158    if (json.has("copackagedIndicator"))
21159      res.setCopackagedIndicatorElement(parseBoolean(json.get("copackagedIndicator").getAsBoolean()));
21160    if (json.has("_copackagedIndicator"))
21161      parseElementProperties(getJObject(json, "_copackagedIndicator"), res.getCopackagedIndicatorElement());
21162    if (json.has("manufacturer")) {
21163      JsonArray array = getJArray(json, "manufacturer");
21164      for (int i = 0; i < array.size(); i++) {
21165        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
21166      }
21167    };
21168    if (json.has("package"))
21169      res.setPackage(parsePackagedProductDefinitionPackageComponent(getJObject(json, "package")));
21170  }
21171
21172  protected PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent parsePackagedProductDefinitionLegalStatusOfSupplyComponent(JsonObject json) throws IOException, FHIRFormatError {
21173    PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent res = new PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent();
21174    parsePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(json, res);
21175    return res;
21176  }
21177
21178  protected void parsePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent res) throws IOException, FHIRFormatError {
21179    parseBackboneElementProperties(json, res);
21180    if (json.has("code"))
21181      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21182    if (json.has("jurisdiction"))
21183      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
21184  }
21185
21186  protected PackagedProductDefinition.PackagedProductDefinitionPackageComponent parsePackagedProductDefinitionPackageComponent(JsonObject json) throws IOException, FHIRFormatError {
21187    PackagedProductDefinition.PackagedProductDefinitionPackageComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageComponent();
21188    parsePackagedProductDefinitionPackageComponentProperties(json, res);
21189    return res;
21190  }
21191
21192  protected void parsePackagedProductDefinitionPackageComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackageComponent res) throws IOException, FHIRFormatError {
21193    parseBackboneElementProperties(json, res);
21194    if (json.has("identifier")) {
21195      JsonArray array = getJArray(json, "identifier");
21196      for (int i = 0; i < array.size(); i++) {
21197        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21198      }
21199    };
21200    if (json.has("type"))
21201      res.setType(parseCodeableConcept(getJObject(json, "type")));
21202    if (json.has("quantity"))
21203      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
21204    if (json.has("_quantity"))
21205      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
21206    if (json.has("material")) {
21207      JsonArray array = getJArray(json, "material");
21208      for (int i = 0; i < array.size(); i++) {
21209        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21210      }
21211    };
21212    if (json.has("alternateMaterial")) {
21213      JsonArray array = getJArray(json, "alternateMaterial");
21214      for (int i = 0; i < array.size(); i++) {
21215        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21216      }
21217    };
21218    if (json.has("shelfLifeStorage")) {
21219      JsonArray array = getJArray(json, "shelfLifeStorage");
21220      for (int i = 0; i < array.size(); i++) {
21221        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
21222      }
21223    };
21224    if (json.has("manufacturer")) {
21225      JsonArray array = getJArray(json, "manufacturer");
21226      for (int i = 0; i < array.size(); i++) {
21227        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
21228      }
21229    };
21230    if (json.has("property")) {
21231      JsonArray array = getJArray(json, "property");
21232      for (int i = 0; i < array.size(); i++) {
21233        res.getProperty().add(parsePackagedProductDefinitionPackagePropertyComponent(array.get(i).getAsJsonObject()));
21234      }
21235    };
21236    if (json.has("containedItem")) {
21237      JsonArray array = getJArray(json, "containedItem");
21238      for (int i = 0; i < array.size(); i++) {
21239        res.getContainedItem().add(parsePackagedProductDefinitionPackageContainedItemComponent(array.get(i).getAsJsonObject()));
21240      }
21241    };
21242    if (json.has("package")) {
21243      JsonArray array = getJArray(json, "package");
21244      for (int i = 0; i < array.size(); i++) {
21245        res.getPackage().add(parsePackagedProductDefinitionPackageComponent(array.get(i).getAsJsonObject()));
21246      }
21247    };
21248  }
21249
21250  protected PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent parsePackagedProductDefinitionPackagePropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
21251    PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent();
21252    parsePackagedProductDefinitionPackagePropertyComponentProperties(json, res);
21253    return res;
21254  }
21255
21256  protected void parsePackagedProductDefinitionPackagePropertyComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent res) throws IOException, FHIRFormatError {
21257    parseBackboneElementProperties(json, res);
21258    if (json.has("type"))
21259      res.setType(parseCodeableConcept(getJObject(json, "type")));
21260    DataType value = parseType("value", json);
21261    if (value != null)
21262      res.setValue(value);
21263  }
21264
21265  protected PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent parsePackagedProductDefinitionPackageContainedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
21266    PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent();
21267    parsePackagedProductDefinitionPackageContainedItemComponentProperties(json, res);
21268    return res;
21269  }
21270
21271  protected void parsePackagedProductDefinitionPackageContainedItemComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res) throws IOException, FHIRFormatError {
21272    parseBackboneElementProperties(json, res);
21273    if (json.has("item"))
21274      res.setItem(parseCodeableReference(getJObject(json, "item")));
21275    if (json.has("amount"))
21276      res.setAmount(parseQuantity(getJObject(json, "amount")));
21277  }
21278
21279  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
21280    Parameters res = new Parameters();
21281    parseParametersProperties(json, res);
21282    return res;
21283  }
21284
21285  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
21286    parseResourceProperties(json, res);
21287    if (json.has("parameter")) {
21288      JsonArray array = getJArray(json, "parameter");
21289      for (int i = 0; i < array.size(); i++) {
21290        res.getParameter().add(parseParametersParameterComponent(array.get(i).getAsJsonObject()));
21291      }
21292    };
21293  }
21294
21295  protected Parameters.ParametersParameterComponent parseParametersParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
21296    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
21297    parseParametersParameterComponentProperties(json, res);
21298    return res;
21299  }
21300
21301  protected void parseParametersParameterComponentProperties(JsonObject json, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
21302    parseBackboneElementProperties(json, res);
21303    if (json.has("name"))
21304      res.setNameElement(parseString(json.get("name").getAsString()));
21305    if (json.has("_name"))
21306      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21307    DataType value = parseType("value", json);
21308    if (value != null)
21309      res.setValue(value);
21310    if (json.has("resource"))
21311      res.setResource(parseResource(getJObject(json, "resource")));
21312    if (json.has("part")) {
21313      JsonArray array = getJArray(json, "part");
21314      for (int i = 0; i < array.size(); i++) {
21315        res.getPart().add(parseParametersParameterComponent(array.get(i).getAsJsonObject()));
21316      }
21317    };
21318  }
21319
21320  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
21321    Patient res = new Patient();
21322    parsePatientProperties(json, res);
21323    return res;
21324  }
21325
21326  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
21327    parseDomainResourceProperties(json, res);
21328    if (json.has("identifier")) {
21329      JsonArray array = getJArray(json, "identifier");
21330      for (int i = 0; i < array.size(); i++) {
21331        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21332      }
21333    };
21334    if (json.has("active"))
21335      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21336    if (json.has("_active"))
21337      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
21338    if (json.has("name")) {
21339      JsonArray array = getJArray(json, "name");
21340      for (int i = 0; i < array.size(); i++) {
21341        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21342      }
21343    };
21344    if (json.has("telecom")) {
21345      JsonArray array = getJArray(json, "telecom");
21346      for (int i = 0; i < array.size(); i++) {
21347        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21348      }
21349    };
21350    if (json.has("gender"))
21351      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21352    if (json.has("_gender"))
21353      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
21354    if (json.has("birthDate"))
21355      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21356    if (json.has("_birthDate"))
21357      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
21358    DataType deceased = parseType("deceased", json);
21359    if (deceased != null)
21360      res.setDeceased(deceased);
21361    if (json.has("address")) {
21362      JsonArray array = getJArray(json, "address");
21363      for (int i = 0; i < array.size(); i++) {
21364        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21365      }
21366    };
21367    if (json.has("maritalStatus"))
21368      res.setMaritalStatus(parseCodeableConcept(getJObject(json, "maritalStatus")));
21369    DataType multipleBirth = parseType("multipleBirth", json);
21370    if (multipleBirth != null)
21371      res.setMultipleBirth(multipleBirth);
21372    if (json.has("photo")) {
21373      JsonArray array = getJArray(json, "photo");
21374      for (int i = 0; i < array.size(); i++) {
21375        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
21376      }
21377    };
21378    if (json.has("contact")) {
21379      JsonArray array = getJArray(json, "contact");
21380      for (int i = 0; i < array.size(); i++) {
21381        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject()));
21382      }
21383    };
21384    if (json.has("communication")) {
21385      JsonArray array = getJArray(json, "communication");
21386      for (int i = 0; i < array.size(); i++) {
21387        res.getCommunication().add(parsePatientCommunicationComponent(array.get(i).getAsJsonObject()));
21388      }
21389    };
21390    if (json.has("generalPractitioner")) {
21391      JsonArray array = getJArray(json, "generalPractitioner");
21392      for (int i = 0; i < array.size(); i++) {
21393        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
21394      }
21395    };
21396    if (json.has("managingOrganization"))
21397      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
21398    if (json.has("link")) {
21399      JsonArray array = getJArray(json, "link");
21400      for (int i = 0; i < array.size(); i++) {
21401        res.getLink().add(parsePatientLinkComponent(array.get(i).getAsJsonObject()));
21402      }
21403    };
21404  }
21405
21406  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json) throws IOException, FHIRFormatError {
21407    Patient.ContactComponent res = new Patient.ContactComponent();
21408    parsePatientContactComponentProperties(json, res);
21409    return res;
21410  }
21411
21412  protected void parsePatientContactComponentProperties(JsonObject json, Patient.ContactComponent res) throws IOException, FHIRFormatError {
21413    parseBackboneElementProperties(json, res);
21414    if (json.has("relationship")) {
21415      JsonArray array = getJArray(json, "relationship");
21416      for (int i = 0; i < array.size(); i++) {
21417        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21418      }
21419    };
21420    if (json.has("name"))
21421      res.setName(parseHumanName(getJObject(json, "name")));
21422    if (json.has("telecom")) {
21423      JsonArray array = getJArray(json, "telecom");
21424      for (int i = 0; i < array.size(); i++) {
21425        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21426      }
21427    };
21428    if (json.has("address"))
21429      res.setAddress(parseAddress(getJObject(json, "address")));
21430    if (json.has("gender"))
21431      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21432    if (json.has("_gender"))
21433      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
21434    if (json.has("organization"))
21435      res.setOrganization(parseReference(getJObject(json, "organization")));
21436    if (json.has("period"))
21437      res.setPeriod(parsePeriod(getJObject(json, "period")));
21438  }
21439
21440  protected Patient.PatientCommunicationComponent parsePatientCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
21441    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
21442    parsePatientCommunicationComponentProperties(json, res);
21443    return res;
21444  }
21445
21446  protected void parsePatientCommunicationComponentProperties(JsonObject json, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
21447    parseBackboneElementProperties(json, res);
21448    if (json.has("language"))
21449      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
21450    if (json.has("preferred"))
21451      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
21452    if (json.has("_preferred"))
21453      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
21454  }
21455
21456  protected Patient.PatientLinkComponent parsePatientLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
21457    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
21458    parsePatientLinkComponentProperties(json, res);
21459    return res;
21460  }
21461
21462  protected void parsePatientLinkComponentProperties(JsonObject json, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
21463    parseBackboneElementProperties(json, res);
21464    if (json.has("other"))
21465      res.setOther(parseReference(getJObject(json, "other")));
21466    if (json.has("type"))
21467      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
21468    if (json.has("_type"))
21469      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21470  }
21471
21472  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
21473    PaymentNotice res = new PaymentNotice();
21474    parsePaymentNoticeProperties(json, res);
21475    return res;
21476  }
21477
21478  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
21479    parseDomainResourceProperties(json, res);
21480    if (json.has("identifier")) {
21481      JsonArray array = getJArray(json, "identifier");
21482      for (int i = 0; i < array.size(); i++) {
21483        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21484      }
21485    };
21486    if (json.has("status"))
21487      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
21488    if (json.has("_status"))
21489      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21490    if (json.has("request"))
21491      res.setRequest(parseReference(getJObject(json, "request")));
21492    if (json.has("response"))
21493      res.setResponse(parseReference(getJObject(json, "response")));
21494    if (json.has("created"))
21495      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
21496    if (json.has("_created"))
21497      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
21498    if (json.has("provider"))
21499      res.setProvider(parseReference(getJObject(json, "provider")));
21500    if (json.has("payment"))
21501      res.setPayment(parseReference(getJObject(json, "payment")));
21502    if (json.has("paymentDate"))
21503      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
21504    if (json.has("_paymentDate"))
21505      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
21506    if (json.has("payee"))
21507      res.setPayee(parseReference(getJObject(json, "payee")));
21508    if (json.has("recipient"))
21509      res.setRecipient(parseReference(getJObject(json, "recipient")));
21510    if (json.has("amount"))
21511      res.setAmount(parseMoney(getJObject(json, "amount")));
21512    if (json.has("paymentStatus"))
21513      res.setPaymentStatus(parseCodeableConcept(getJObject(json, "paymentStatus")));
21514  }
21515
21516  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
21517    PaymentReconciliation res = new PaymentReconciliation();
21518    parsePaymentReconciliationProperties(json, res);
21519    return res;
21520  }
21521
21522  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
21523    parseDomainResourceProperties(json, res);
21524    if (json.has("identifier")) {
21525      JsonArray array = getJArray(json, "identifier");
21526      for (int i = 0; i < array.size(); i++) {
21527        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21528      }
21529    };
21530    if (json.has("status"))
21531      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
21532    if (json.has("_status"))
21533      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21534    if (json.has("period"))
21535      res.setPeriod(parsePeriod(getJObject(json, "period")));
21536    if (json.has("created"))
21537      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
21538    if (json.has("_created"))
21539      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
21540    if (json.has("paymentIssuer"))
21541      res.setPaymentIssuer(parseReference(getJObject(json, "paymentIssuer")));
21542    if (json.has("request"))
21543      res.setRequest(parseReference(getJObject(json, "request")));
21544    if (json.has("requestor"))
21545      res.setRequestor(parseReference(getJObject(json, "requestor")));
21546    if (json.has("outcome"))
21547      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
21548    if (json.has("_outcome"))
21549      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
21550    if (json.has("disposition"))
21551      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
21552    if (json.has("_disposition"))
21553      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
21554    if (json.has("paymentDate"))
21555      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
21556    if (json.has("_paymentDate"))
21557      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
21558    if (json.has("paymentAmount"))
21559      res.setPaymentAmount(parseMoney(getJObject(json, "paymentAmount")));
21560    if (json.has("paymentIdentifier"))
21561      res.setPaymentIdentifier(parseIdentifier(getJObject(json, "paymentIdentifier")));
21562    if (json.has("detail")) {
21563      JsonArray array = getJArray(json, "detail");
21564      for (int i = 0; i < array.size(); i++) {
21565        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject()));
21566      }
21567    };
21568    if (json.has("formCode"))
21569      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
21570    if (json.has("processNote")) {
21571      JsonArray array = getJArray(json, "processNote");
21572      for (int i = 0; i < array.size(); i++) {
21573        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject()));
21574      }
21575    };
21576  }
21577
21578  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json) throws IOException, FHIRFormatError {
21579    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
21580    parsePaymentReconciliationDetailsComponentProperties(json, res);
21581    return res;
21582  }
21583
21584  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
21585    parseBackboneElementProperties(json, res);
21586    if (json.has("identifier"))
21587      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
21588    if (json.has("predecessor"))
21589      res.setPredecessor(parseIdentifier(getJObject(json, "predecessor")));
21590    if (json.has("type"))
21591      res.setType(parseCodeableConcept(getJObject(json, "type")));
21592    if (json.has("request"))
21593      res.setRequest(parseReference(getJObject(json, "request")));
21594    if (json.has("submitter"))
21595      res.setSubmitter(parseReference(getJObject(json, "submitter")));
21596    if (json.has("response"))
21597      res.setResponse(parseReference(getJObject(json, "response")));
21598    if (json.has("date"))
21599      res.setDateElement(parseDate(json.get("date").getAsString()));
21600    if (json.has("_date"))
21601      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21602    if (json.has("responsible"))
21603      res.setResponsible(parseReference(getJObject(json, "responsible")));
21604    if (json.has("payee"))
21605      res.setPayee(parseReference(getJObject(json, "payee")));
21606    if (json.has("amount"))
21607      res.setAmount(parseMoney(getJObject(json, "amount")));
21608  }
21609
21610  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json) throws IOException, FHIRFormatError {
21611    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
21612    parsePaymentReconciliationNotesComponentProperties(json, res);
21613    return res;
21614  }
21615
21616  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
21617    parseBackboneElementProperties(json, res);
21618    if (json.has("type"))
21619      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
21620    if (json.has("_type"))
21621      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21622    if (json.has("text"))
21623      res.setTextElement(parseString(json.get("text").getAsString()));
21624    if (json.has("_text"))
21625      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
21626  }
21627
21628  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
21629    Person res = new Person();
21630    parsePersonProperties(json, res);
21631    return res;
21632  }
21633
21634  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
21635    parseDomainResourceProperties(json, res);
21636    if (json.has("identifier")) {
21637      JsonArray array = getJArray(json, "identifier");
21638      for (int i = 0; i < array.size(); i++) {
21639        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21640      }
21641    };
21642    if (json.has("name")) {
21643      JsonArray array = getJArray(json, "name");
21644      for (int i = 0; i < array.size(); i++) {
21645        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21646      }
21647    };
21648    if (json.has("telecom")) {
21649      JsonArray array = getJArray(json, "telecom");
21650      for (int i = 0; i < array.size(); i++) {
21651        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21652      }
21653    };
21654    if (json.has("gender"))
21655      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21656    if (json.has("_gender"))
21657      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
21658    if (json.has("birthDate"))
21659      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21660    if (json.has("_birthDate"))
21661      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
21662    if (json.has("address")) {
21663      JsonArray array = getJArray(json, "address");
21664      for (int i = 0; i < array.size(); i++) {
21665        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21666      }
21667    };
21668    if (json.has("photo"))
21669      res.setPhoto(parseAttachment(getJObject(json, "photo")));
21670    if (json.has("managingOrganization"))
21671      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
21672    if (json.has("active"))
21673      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21674    if (json.has("_active"))
21675      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
21676    if (json.has("link")) {
21677      JsonArray array = getJArray(json, "link");
21678      for (int i = 0; i < array.size(); i++) {
21679        res.getLink().add(parsePersonLinkComponent(array.get(i).getAsJsonObject()));
21680      }
21681    };
21682  }
21683
21684  protected Person.PersonLinkComponent parsePersonLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
21685    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
21686    parsePersonLinkComponentProperties(json, res);
21687    return res;
21688  }
21689
21690  protected void parsePersonLinkComponentProperties(JsonObject json, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
21691    parseBackboneElementProperties(json, res);
21692    if (json.has("target"))
21693      res.setTarget(parseReference(getJObject(json, "target")));
21694    if (json.has("assurance"))
21695      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
21696    if (json.has("_assurance"))
21697      parseElementProperties(getJObject(json, "_assurance"), res.getAssuranceElement());
21698  }
21699
21700  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
21701    PlanDefinition res = new PlanDefinition();
21702    parsePlanDefinitionProperties(json, res);
21703    return res;
21704  }
21705
21706  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
21707    parseDomainResourceProperties(json, res);
21708    if (json.has("url"))
21709      res.setUrlElement(parseUri(json.get("url").getAsString()));
21710    if (json.has("_url"))
21711      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
21712    if (json.has("identifier")) {
21713      JsonArray array = getJArray(json, "identifier");
21714      for (int i = 0; i < array.size(); i++) {
21715        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21716      }
21717    };
21718    if (json.has("version"))
21719      res.setVersionElement(parseString(json.get("version").getAsString()));
21720    if (json.has("_version"))
21721      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
21722    if (json.has("name"))
21723      res.setNameElement(parseString(json.get("name").getAsString()));
21724    if (json.has("_name"))
21725      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21726    if (json.has("title"))
21727      res.setTitleElement(parseString(json.get("title").getAsString()));
21728    if (json.has("_title"))
21729      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
21730    if (json.has("subtitle"))
21731      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21732    if (json.has("_subtitle"))
21733      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
21734    if (json.has("type"))
21735      res.setType(parseCodeableConcept(getJObject(json, "type")));
21736    if (json.has("status"))
21737      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21738    if (json.has("_status"))
21739      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21740    if (json.has("experimental"))
21741      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21742    if (json.has("_experimental"))
21743      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
21744    DataType subject = parseType("subject", json);
21745    if (subject != null)
21746      res.setSubject(subject);
21747    if (json.has("date"))
21748      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21749    if (json.has("_date"))
21750      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21751    if (json.has("publisher"))
21752      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21753    if (json.has("_publisher"))
21754      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
21755    if (json.has("contact")) {
21756      JsonArray array = getJArray(json, "contact");
21757      for (int i = 0; i < array.size(); i++) {
21758        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21759      }
21760    };
21761    if (json.has("description"))
21762      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21763    if (json.has("_description"))
21764      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21765    if (json.has("useContext")) {
21766      JsonArray array = getJArray(json, "useContext");
21767      for (int i = 0; i < array.size(); i++) {
21768        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21769      }
21770    };
21771    if (json.has("jurisdiction")) {
21772      JsonArray array = getJArray(json, "jurisdiction");
21773      for (int i = 0; i < array.size(); i++) {
21774        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21775      }
21776    };
21777    if (json.has("purpose"))
21778      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21779    if (json.has("_purpose"))
21780      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
21781    if (json.has("usage"))
21782      res.setUsageElement(parseString(json.get("usage").getAsString()));
21783    if (json.has("_usage"))
21784      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
21785    if (json.has("copyright"))
21786      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21787    if (json.has("_copyright"))
21788      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
21789    if (json.has("approvalDate"))
21790      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21791    if (json.has("_approvalDate"))
21792      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
21793    if (json.has("lastReviewDate"))
21794      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21795    if (json.has("_lastReviewDate"))
21796      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
21797    if (json.has("effectivePeriod"))
21798      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
21799    if (json.has("topic")) {
21800      JsonArray array = getJArray(json, "topic");
21801      for (int i = 0; i < array.size(); i++) {
21802        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21803      }
21804    };
21805    if (json.has("author")) {
21806      JsonArray array = getJArray(json, "author");
21807      for (int i = 0; i < array.size(); i++) {
21808        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21809      }
21810    };
21811    if (json.has("editor")) {
21812      JsonArray array = getJArray(json, "editor");
21813      for (int i = 0; i < array.size(); i++) {
21814        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21815      }
21816    };
21817    if (json.has("reviewer")) {
21818      JsonArray array = getJArray(json, "reviewer");
21819      for (int i = 0; i < array.size(); i++) {
21820        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
21821      }
21822    };
21823    if (json.has("endorser")) {
21824      JsonArray array = getJArray(json, "endorser");
21825      for (int i = 0; i < array.size(); i++) {
21826        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
21827      }
21828    };
21829    if (json.has("relatedArtifact")) {
21830      JsonArray array = getJArray(json, "relatedArtifact");
21831      for (int i = 0; i < array.size(); i++) {
21832        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21833      }
21834    };
21835    if (json.has("library")) {
21836      JsonArray array = getJArray(json, "library");
21837      for (int i = 0; i < array.size(); i++) {
21838        if (array.get(i).isJsonNull()) {
21839          res.getLibrary().add(new CanonicalType());
21840        } else {;
21841          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
21842        }
21843      }
21844    };
21845    if (json.has("_library")) {
21846      JsonArray array = getJArray(json, "_library");
21847      for (int i = 0; i < array.size(); i++) {
21848        if (i == res.getLibrary().size())
21849          res.getLibrary().add(parseCanonical(null));
21850        if (array.get(i) instanceof JsonObject) 
21851          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
21852      }
21853    };
21854    if (json.has("goal")) {
21855      JsonArray array = getJArray(json, "goal");
21856      for (int i = 0; i < array.size(); i++) {
21857        res.getGoal().add(parsePlanDefinitionGoalComponent(array.get(i).getAsJsonObject()));
21858      }
21859    };
21860    if (json.has("action")) {
21861      JsonArray array = getJArray(json, "action");
21862      for (int i = 0; i < array.size(); i++) {
21863        res.getAction().add(parsePlanDefinitionActionComponent(array.get(i).getAsJsonObject()));
21864      }
21865    };
21866  }
21867
21868  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionGoalComponent(JsonObject json) throws IOException, FHIRFormatError {
21869    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
21870    parsePlanDefinitionGoalComponentProperties(json, res);
21871    return res;
21872  }
21873
21874  protected void parsePlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
21875    parseBackboneElementProperties(json, res);
21876    if (json.has("category"))
21877      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
21878    if (json.has("description"))
21879      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
21880    if (json.has("priority"))
21881      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
21882    if (json.has("start"))
21883      res.setStart(parseCodeableConcept(getJObject(json, "start")));
21884    if (json.has("addresses")) {
21885      JsonArray array = getJArray(json, "addresses");
21886      for (int i = 0; i < array.size(); i++) {
21887        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21888      }
21889    };
21890    if (json.has("documentation")) {
21891      JsonArray array = getJArray(json, "documentation");
21892      for (int i = 0; i < array.size(); i++) {
21893        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21894      }
21895    };
21896    if (json.has("target")) {
21897      JsonArray array = getJArray(json, "target");
21898      for (int i = 0; i < array.size(); i++) {
21899        res.getTarget().add(parsePlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject()));
21900      }
21901    };
21902  }
21903
21904  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionGoalTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
21905    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
21906    parsePlanDefinitionGoalTargetComponentProperties(json, res);
21907    return res;
21908  }
21909
21910  protected void parsePlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
21911    parseBackboneElementProperties(json, res);
21912    if (json.has("measure"))
21913      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
21914    DataType detail = parseType("detail", json);
21915    if (detail != null)
21916      res.setDetail(detail);
21917    if (json.has("due"))
21918      res.setDue(parseDuration(getJObject(json, "due")));
21919  }
21920
21921  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionActionComponent(JsonObject json) throws IOException, FHIRFormatError {
21922    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
21923    parsePlanDefinitionActionComponentProperties(json, res);
21924    return res;
21925  }
21926
21927  protected void parsePlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
21928    parseBackboneElementProperties(json, res);
21929    if (json.has("prefix"))
21930      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21931    if (json.has("_prefix"))
21932      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
21933    if (json.has("title"))
21934      res.setTitleElement(parseString(json.get("title").getAsString()));
21935    if (json.has("_title"))
21936      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
21937    if (json.has("description"))
21938      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21939    if (json.has("_description"))
21940      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21941    if (json.has("textEquivalent"))
21942      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
21943    if (json.has("_textEquivalent"))
21944      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
21945    if (json.has("priority"))
21946      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
21947    if (json.has("_priority"))
21948      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
21949    if (json.has("code")) {
21950      JsonArray array = getJArray(json, "code");
21951      for (int i = 0; i < array.size(); i++) {
21952        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21953      }
21954    };
21955    if (json.has("reason")) {
21956      JsonArray array = getJArray(json, "reason");
21957      for (int i = 0; i < array.size(); i++) {
21958        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21959      }
21960    };
21961    if (json.has("documentation")) {
21962      JsonArray array = getJArray(json, "documentation");
21963      for (int i = 0; i < array.size(); i++) {
21964        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21965      }
21966    };
21967    if (json.has("goalId")) {
21968      JsonArray array = getJArray(json, "goalId");
21969      for (int i = 0; i < array.size(); i++) {
21970        if (array.get(i).isJsonNull()) {
21971          res.getGoalId().add(new IdType());
21972        } else {;
21973          res.getGoalId().add(parseId(array.get(i).getAsString()));
21974        }
21975      }
21976    };
21977    if (json.has("_goalId")) {
21978      JsonArray array = getJArray(json, "_goalId");
21979      for (int i = 0; i < array.size(); i++) {
21980        if (i == res.getGoalId().size())
21981          res.getGoalId().add(parseId(null));
21982        if (array.get(i) instanceof JsonObject) 
21983          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
21984      }
21985    };
21986    DataType subject = parseType("subject", json);
21987    if (subject != null)
21988      res.setSubject(subject);
21989    if (json.has("trigger")) {
21990      JsonArray array = getJArray(json, "trigger");
21991      for (int i = 0; i < array.size(); i++) {
21992        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
21993      }
21994    };
21995    if (json.has("condition")) {
21996      JsonArray array = getJArray(json, "condition");
21997      for (int i = 0; i < array.size(); i++) {
21998        res.getCondition().add(parsePlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject()));
21999      }
22000    };
22001    if (json.has("input")) {
22002      JsonArray array = getJArray(json, "input");
22003      for (int i = 0; i < array.size(); i++) {
22004        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
22005      }
22006    };
22007    if (json.has("output")) {
22008      JsonArray array = getJArray(json, "output");
22009      for (int i = 0; i < array.size(); i++) {
22010        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
22011      }
22012    };
22013    if (json.has("relatedAction")) {
22014      JsonArray array = getJArray(json, "relatedAction");
22015      for (int i = 0; i < array.size(); i++) {
22016        res.getRelatedAction().add(parsePlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject()));
22017      }
22018    };
22019    DataType timing = parseType("timing", json);
22020    if (timing != null)
22021      res.setTiming(timing);
22022    if (json.has("participant")) {
22023      JsonArray array = getJArray(json, "participant");
22024      for (int i = 0; i < array.size(); i++) {
22025        res.getParticipant().add(parsePlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject()));
22026      }
22027    };
22028    if (json.has("type"))
22029      res.setType(parseCodeableConcept(getJObject(json, "type")));
22030    if (json.has("groupingBehavior"))
22031      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
22032    if (json.has("_groupingBehavior"))
22033      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
22034    if (json.has("selectionBehavior"))
22035      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
22036    if (json.has("_selectionBehavior"))
22037      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
22038    if (json.has("requiredBehavior"))
22039      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
22040    if (json.has("_requiredBehavior"))
22041      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
22042    if (json.has("precheckBehavior"))
22043      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
22044    if (json.has("_precheckBehavior"))
22045      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
22046    if (json.has("cardinalityBehavior"))
22047      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.ActionCardinalityBehaviorEnumFactory()));
22048    if (json.has("_cardinalityBehavior"))
22049      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
22050    DataType definition = parseType("definition", json);
22051    if (definition != null)
22052      res.setDefinition(definition);
22053    if (json.has("transform"))
22054      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
22055    if (json.has("_transform"))
22056      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
22057    if (json.has("dynamicValue")) {
22058      JsonArray array = getJArray(json, "dynamicValue");
22059      for (int i = 0; i < array.size(); i++) {
22060        res.getDynamicValue().add(parsePlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject()));
22061      }
22062    };
22063    if (json.has("action")) {
22064      JsonArray array = getJArray(json, "action");
22065      for (int i = 0; i < array.size(); i++) {
22066        res.getAction().add(parsePlanDefinitionActionComponent(array.get(i).getAsJsonObject()));
22067      }
22068    };
22069  }
22070
22071  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionActionConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
22072    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
22073    parsePlanDefinitionActionConditionComponentProperties(json, res);
22074    return res;
22075  }
22076
22077  protected void parsePlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
22078    parseBackboneElementProperties(json, res);
22079    if (json.has("kind"))
22080      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.ActionConditionKind.NULL, new Enumerations.ActionConditionKindEnumFactory()));
22081    if (json.has("_kind"))
22082      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
22083    if (json.has("expression"))
22084      res.setExpression(parseExpression(getJObject(json, "expression")));
22085  }
22086
22087  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionActionRelatedActionComponent(JsonObject json) throws IOException, FHIRFormatError {
22088    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
22089    parsePlanDefinitionActionRelatedActionComponentProperties(json, res);
22090    return res;
22091  }
22092
22093  protected void parsePlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
22094    parseBackboneElementProperties(json, res);
22095    if (json.has("actionId"))
22096      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
22097    if (json.has("_actionId"))
22098      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
22099    if (json.has("relationship"))
22100      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
22101    if (json.has("_relationship"))
22102      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
22103    DataType offset = parseType("offset", json);
22104    if (offset != null)
22105      res.setOffset(offset);
22106  }
22107
22108  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionActionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
22109    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
22110    parsePlanDefinitionActionParticipantComponentProperties(json, res);
22111    return res;
22112  }
22113
22114  protected void parsePlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
22115    parseBackboneElementProperties(json, res);
22116    if (json.has("type"))
22117      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
22118    if (json.has("_type"))
22119      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
22120    if (json.has("role"))
22121      res.setRole(parseCodeableConcept(getJObject(json, "role")));
22122  }
22123
22124  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionActionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
22125    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
22126    parsePlanDefinitionActionDynamicValueComponentProperties(json, res);
22127    return res;
22128  }
22129
22130  protected void parsePlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
22131    parseBackboneElementProperties(json, res);
22132    if (json.has("path"))
22133      res.setPathElement(parseString(json.get("path").getAsString()));
22134    if (json.has("_path"))
22135      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
22136    if (json.has("expression"))
22137      res.setExpression(parseExpression(getJObject(json, "expression")));
22138  }
22139
22140  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
22141    Practitioner res = new Practitioner();
22142    parsePractitionerProperties(json, res);
22143    return res;
22144  }
22145
22146  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
22147    parseDomainResourceProperties(json, res);
22148    if (json.has("identifier")) {
22149      JsonArray array = getJArray(json, "identifier");
22150      for (int i = 0; i < array.size(); i++) {
22151        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22152      }
22153    };
22154    if (json.has("active"))
22155      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22156    if (json.has("_active"))
22157      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
22158    if (json.has("name")) {
22159      JsonArray array = getJArray(json, "name");
22160      for (int i = 0; i < array.size(); i++) {
22161        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
22162      }
22163    };
22164    if (json.has("telecom")) {
22165      JsonArray array = getJArray(json, "telecom");
22166      for (int i = 0; i < array.size(); i++) {
22167        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22168      }
22169    };
22170    if (json.has("address")) {
22171      JsonArray array = getJArray(json, "address");
22172      for (int i = 0; i < array.size(); i++) {
22173        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
22174      }
22175    };
22176    if (json.has("gender"))
22177      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
22178    if (json.has("_gender"))
22179      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
22180    if (json.has("birthDate"))
22181      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
22182    if (json.has("_birthDate"))
22183      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
22184    if (json.has("photo")) {
22185      JsonArray array = getJArray(json, "photo");
22186      for (int i = 0; i < array.size(); i++) {
22187        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
22188      }
22189    };
22190    if (json.has("qualification")) {
22191      JsonArray array = getJArray(json, "qualification");
22192      for (int i = 0; i < array.size(); i++) {
22193        res.getQualification().add(parsePractitionerQualificationComponent(array.get(i).getAsJsonObject()));
22194      }
22195    };
22196    if (json.has("communication")) {
22197      JsonArray array = getJArray(json, "communication");
22198      for (int i = 0; i < array.size(); i++) {
22199        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22200      }
22201    };
22202  }
22203
22204  protected Practitioner.PractitionerQualificationComponent parsePractitionerQualificationComponent(JsonObject json) throws IOException, FHIRFormatError {
22205    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
22206    parsePractitionerQualificationComponentProperties(json, res);
22207    return res;
22208  }
22209
22210  protected void parsePractitionerQualificationComponentProperties(JsonObject json, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
22211    parseBackboneElementProperties(json, res);
22212    if (json.has("identifier")) {
22213      JsonArray array = getJArray(json, "identifier");
22214      for (int i = 0; i < array.size(); i++) {
22215        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22216      }
22217    };
22218    if (json.has("code"))
22219      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22220    if (json.has("period"))
22221      res.setPeriod(parsePeriod(getJObject(json, "period")));
22222    if (json.has("issuer"))
22223      res.setIssuer(parseReference(getJObject(json, "issuer")));
22224  }
22225
22226  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
22227    PractitionerRole res = new PractitionerRole();
22228    parsePractitionerRoleProperties(json, res);
22229    return res;
22230  }
22231
22232  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
22233    parseDomainResourceProperties(json, res);
22234    if (json.has("identifier")) {
22235      JsonArray array = getJArray(json, "identifier");
22236      for (int i = 0; i < array.size(); i++) {
22237        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22238      }
22239    };
22240    if (json.has("active"))
22241      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22242    if (json.has("_active"))
22243      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
22244    if (json.has("period"))
22245      res.setPeriod(parsePeriod(getJObject(json, "period")));
22246    if (json.has("practitioner"))
22247      res.setPractitioner(parseReference(getJObject(json, "practitioner")));
22248    if (json.has("organization"))
22249      res.setOrganization(parseReference(getJObject(json, "organization")));
22250    if (json.has("code")) {
22251      JsonArray array = getJArray(json, "code");
22252      for (int i = 0; i < array.size(); i++) {
22253        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22254      }
22255    };
22256    if (json.has("specialty")) {
22257      JsonArray array = getJArray(json, "specialty");
22258      for (int i = 0; i < array.size(); i++) {
22259        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22260      }
22261    };
22262    if (json.has("location")) {
22263      JsonArray array = getJArray(json, "location");
22264      for (int i = 0; i < array.size(); i++) {
22265        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
22266      }
22267    };
22268    if (json.has("healthcareService")) {
22269      JsonArray array = getJArray(json, "healthcareService");
22270      for (int i = 0; i < array.size(); i++) {
22271        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
22272      }
22273    };
22274    if (json.has("telecom")) {
22275      JsonArray array = getJArray(json, "telecom");
22276      for (int i = 0; i < array.size(); i++) {
22277        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22278      }
22279    };
22280    if (json.has("availableTime")) {
22281      JsonArray array = getJArray(json, "availableTime");
22282      for (int i = 0; i < array.size(); i++) {
22283        res.getAvailableTime().add(parsePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject()));
22284      }
22285    };
22286    if (json.has("notAvailable")) {
22287      JsonArray array = getJArray(json, "notAvailable");
22288      for (int i = 0; i < array.size(); i++) {
22289        res.getNotAvailable().add(parsePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject()));
22290      }
22291    };
22292    if (json.has("availabilityExceptions"))
22293      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
22294    if (json.has("_availabilityExceptions"))
22295      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
22296    if (json.has("endpoint")) {
22297      JsonArray array = getJArray(json, "endpoint");
22298      for (int i = 0; i < array.size(); i++) {
22299        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
22300      }
22301    };
22302  }
22303
22304  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRoleAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
22305    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
22306    parsePractitionerRoleAvailableTimeComponentProperties(json, res);
22307    return res;
22308  }
22309
22310  protected void parsePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
22311    parseBackboneElementProperties(json, res);
22312    if (json.has("daysOfWeek")) {
22313      JsonArray array = getJArray(json, "daysOfWeek");
22314      for (int i = 0; i < array.size(); i++) {
22315        if (array.get(i).isJsonNull()) {
22316          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
22317        } else {;
22318          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
22319        }
22320      }
22321    };
22322    if (json.has("_daysOfWeek")) {
22323      JsonArray array = getJArray(json, "_daysOfWeek");
22324      for (int i = 0; i < array.size(); i++) {
22325        if (i == res.getDaysOfWeek().size())
22326          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
22327        if (array.get(i) instanceof JsonObject) 
22328          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
22329      }
22330    };
22331    if (json.has("allDay"))
22332      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
22333    if (json.has("_allDay"))
22334      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
22335    if (json.has("availableStartTime"))
22336      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
22337    if (json.has("_availableStartTime"))
22338      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
22339    if (json.has("availableEndTime"))
22340      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
22341    if (json.has("_availableEndTime"))
22342      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
22343  }
22344
22345  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRoleNotAvailableComponent(JsonObject json) throws IOException, FHIRFormatError {
22346    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
22347    parsePractitionerRoleNotAvailableComponentProperties(json, res);
22348    return res;
22349  }
22350
22351  protected void parsePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
22352    parseBackboneElementProperties(json, res);
22353    if (json.has("description"))
22354      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22355    if (json.has("_description"))
22356      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22357    if (json.has("during"))
22358      res.setDuring(parsePeriod(getJObject(json, "during")));
22359  }
22360
22361  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
22362    Procedure res = new Procedure();
22363    parseProcedureProperties(json, res);
22364    return res;
22365  }
22366
22367  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
22368    parseDomainResourceProperties(json, res);
22369    if (json.has("identifier")) {
22370      JsonArray array = getJArray(json, "identifier");
22371      for (int i = 0; i < array.size(); i++) {
22372        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22373      }
22374    };
22375    if (json.has("instantiatesCanonical")) {
22376      JsonArray array = getJArray(json, "instantiatesCanonical");
22377      for (int i = 0; i < array.size(); i++) {
22378        if (array.get(i).isJsonNull()) {
22379          res.getInstantiatesCanonical().add(new CanonicalType());
22380        } else {;
22381          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
22382        }
22383      }
22384    };
22385    if (json.has("_instantiatesCanonical")) {
22386      JsonArray array = getJArray(json, "_instantiatesCanonical");
22387      for (int i = 0; i < array.size(); i++) {
22388        if (i == res.getInstantiatesCanonical().size())
22389          res.getInstantiatesCanonical().add(parseCanonical(null));
22390        if (array.get(i) instanceof JsonObject) 
22391          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
22392      }
22393    };
22394    if (json.has("instantiatesUri")) {
22395      JsonArray array = getJArray(json, "instantiatesUri");
22396      for (int i = 0; i < array.size(); i++) {
22397        if (array.get(i).isJsonNull()) {
22398          res.getInstantiatesUri().add(new UriType());
22399        } else {;
22400          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
22401        }
22402      }
22403    };
22404    if (json.has("_instantiatesUri")) {
22405      JsonArray array = getJArray(json, "_instantiatesUri");
22406      for (int i = 0; i < array.size(); i++) {
22407        if (i == res.getInstantiatesUri().size())
22408          res.getInstantiatesUri().add(parseUri(null));
22409        if (array.get(i) instanceof JsonObject) 
22410          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
22411      }
22412    };
22413    if (json.has("basedOn")) {
22414      JsonArray array = getJArray(json, "basedOn");
22415      for (int i = 0; i < array.size(); i++) {
22416        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22417      }
22418    };
22419    if (json.has("partOf")) {
22420      JsonArray array = getJArray(json, "partOf");
22421      for (int i = 0; i < array.size(); i++) {
22422        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22423      }
22424    };
22425    if (json.has("status"))
22426      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
22427    if (json.has("_status"))
22428      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22429    if (json.has("statusReason"))
22430      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
22431    if (json.has("category"))
22432      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
22433    if (json.has("code"))
22434      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22435    if (json.has("subject"))
22436      res.setSubject(parseReference(getJObject(json, "subject")));
22437    if (json.has("encounter"))
22438      res.setEncounter(parseReference(getJObject(json, "encounter")));
22439    DataType performed = parseType("performed", json);
22440    if (performed != null)
22441      res.setPerformed(performed);
22442    if (json.has("recorder"))
22443      res.setRecorder(parseReference(getJObject(json, "recorder")));
22444    if (json.has("asserter"))
22445      res.setAsserter(parseReference(getJObject(json, "asserter")));
22446    if (json.has("performer")) {
22447      JsonArray array = getJArray(json, "performer");
22448      for (int i = 0; i < array.size(); i++) {
22449        res.getPerformer().add(parseProcedurePerformerComponent(array.get(i).getAsJsonObject()));
22450      }
22451    };
22452    if (json.has("location"))
22453      res.setLocation(parseReference(getJObject(json, "location")));
22454    if (json.has("reasonCode")) {
22455      JsonArray array = getJArray(json, "reasonCode");
22456      for (int i = 0; i < array.size(); i++) {
22457        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22458      }
22459    };
22460    if (json.has("reasonReference")) {
22461      JsonArray array = getJArray(json, "reasonReference");
22462      for (int i = 0; i < array.size(); i++) {
22463        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22464      }
22465    };
22466    if (json.has("bodySite")) {
22467      JsonArray array = getJArray(json, "bodySite");
22468      for (int i = 0; i < array.size(); i++) {
22469        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22470      }
22471    };
22472    if (json.has("outcome"))
22473      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
22474    if (json.has("report")) {
22475      JsonArray array = getJArray(json, "report");
22476      for (int i = 0; i < array.size(); i++) {
22477        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
22478      }
22479    };
22480    if (json.has("complication")) {
22481      JsonArray array = getJArray(json, "complication");
22482      for (int i = 0; i < array.size(); i++) {
22483        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22484      }
22485    };
22486    if (json.has("complicationDetail")) {
22487      JsonArray array = getJArray(json, "complicationDetail");
22488      for (int i = 0; i < array.size(); i++) {
22489        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
22490      }
22491    };
22492    if (json.has("followUp")) {
22493      JsonArray array = getJArray(json, "followUp");
22494      for (int i = 0; i < array.size(); i++) {
22495        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22496      }
22497    };
22498    if (json.has("note")) {
22499      JsonArray array = getJArray(json, "note");
22500      for (int i = 0; i < array.size(); i++) {
22501        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22502      }
22503    };
22504    if (json.has("focalDevice")) {
22505      JsonArray array = getJArray(json, "focalDevice");
22506      for (int i = 0; i < array.size(); i++) {
22507        res.getFocalDevice().add(parseProcedureFocalDeviceComponent(array.get(i).getAsJsonObject()));
22508      }
22509    };
22510    if (json.has("usedReference")) {
22511      JsonArray array = getJArray(json, "usedReference");
22512      for (int i = 0; i < array.size(); i++) {
22513        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
22514      }
22515    };
22516    if (json.has("usedCode")) {
22517      JsonArray array = getJArray(json, "usedCode");
22518      for (int i = 0; i < array.size(); i++) {
22519        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22520      }
22521    };
22522  }
22523
22524  protected Procedure.ProcedurePerformerComponent parseProcedurePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
22525    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
22526    parseProcedurePerformerComponentProperties(json, res);
22527    return res;
22528  }
22529
22530  protected void parseProcedurePerformerComponentProperties(JsonObject json, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
22531    parseBackboneElementProperties(json, res);
22532    if (json.has("function"))
22533      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
22534    if (json.has("actor"))
22535      res.setActor(parseReference(getJObject(json, "actor")));
22536    if (json.has("onBehalfOf"))
22537      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
22538  }
22539
22540  protected Procedure.ProcedureFocalDeviceComponent parseProcedureFocalDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
22541    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
22542    parseProcedureFocalDeviceComponentProperties(json, res);
22543    return res;
22544  }
22545
22546  protected void parseProcedureFocalDeviceComponentProperties(JsonObject json, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
22547    parseBackboneElementProperties(json, res);
22548    if (json.has("action"))
22549      res.setAction(parseCodeableConcept(getJObject(json, "action")));
22550    if (json.has("manipulated"))
22551      res.setManipulated(parseReference(getJObject(json, "manipulated")));
22552  }
22553
22554  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
22555    Provenance res = new Provenance();
22556    parseProvenanceProperties(json, res);
22557    return res;
22558  }
22559
22560  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
22561    parseDomainResourceProperties(json, res);
22562    if (json.has("target")) {
22563      JsonArray array = getJArray(json, "target");
22564      for (int i = 0; i < array.size(); i++) {
22565        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
22566      }
22567    };
22568    DataType occurred = parseType("occurred", json);
22569    if (occurred != null)
22570      res.setOccurred(occurred);
22571    if (json.has("recorded"))
22572      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
22573    if (json.has("_recorded"))
22574      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
22575    if (json.has("policy")) {
22576      JsonArray array = getJArray(json, "policy");
22577      for (int i = 0; i < array.size(); i++) {
22578        if (array.get(i).isJsonNull()) {
22579          res.getPolicy().add(new UriType());
22580        } else {;
22581          res.getPolicy().add(parseUri(array.get(i).getAsString()));
22582        }
22583      }
22584    };
22585    if (json.has("_policy")) {
22586      JsonArray array = getJArray(json, "_policy");
22587      for (int i = 0; i < array.size(); i++) {
22588        if (i == res.getPolicy().size())
22589          res.getPolicy().add(parseUri(null));
22590        if (array.get(i) instanceof JsonObject) 
22591          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
22592      }
22593    };
22594    if (json.has("location"))
22595      res.setLocation(parseReference(getJObject(json, "location")));
22596    if (json.has("reason")) {
22597      JsonArray array = getJArray(json, "reason");
22598      for (int i = 0; i < array.size(); i++) {
22599        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22600      }
22601    };
22602    if (json.has("activity"))
22603      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
22604    if (json.has("agent")) {
22605      JsonArray array = getJArray(json, "agent");
22606      for (int i = 0; i < array.size(); i++) {
22607        res.getAgent().add(parseProvenanceAgentComponent(array.get(i).getAsJsonObject()));
22608      }
22609    };
22610    if (json.has("entity")) {
22611      JsonArray array = getJArray(json, "entity");
22612      for (int i = 0; i < array.size(); i++) {
22613        res.getEntity().add(parseProvenanceEntityComponent(array.get(i).getAsJsonObject()));
22614      }
22615    };
22616    if (json.has("signature")) {
22617      JsonArray array = getJArray(json, "signature");
22618      for (int i = 0; i < array.size(); i++) {
22619        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
22620      }
22621    };
22622  }
22623
22624  protected Provenance.ProvenanceAgentComponent parseProvenanceAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
22625    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
22626    parseProvenanceAgentComponentProperties(json, res);
22627    return res;
22628  }
22629
22630  protected void parseProvenanceAgentComponentProperties(JsonObject json, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
22631    parseBackboneElementProperties(json, res);
22632    if (json.has("type"))
22633      res.setType(parseCodeableConcept(getJObject(json, "type")));
22634    if (json.has("role")) {
22635      JsonArray array = getJArray(json, "role");
22636      for (int i = 0; i < array.size(); i++) {
22637        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22638      }
22639    };
22640    if (json.has("who"))
22641      res.setWho(parseReference(getJObject(json, "who")));
22642    if (json.has("onBehalfOf"))
22643      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
22644  }
22645
22646  protected Provenance.ProvenanceEntityComponent parseProvenanceEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
22647    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
22648    parseProvenanceEntityComponentProperties(json, res);
22649    return res;
22650  }
22651
22652  protected void parseProvenanceEntityComponentProperties(JsonObject json, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
22653    parseBackboneElementProperties(json, res);
22654    if (json.has("role"))
22655      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
22656    if (json.has("_role"))
22657      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
22658    if (json.has("what"))
22659      res.setWhat(parseReference(getJObject(json, "what")));
22660    if (json.has("agent")) {
22661      JsonArray array = getJArray(json, "agent");
22662      for (int i = 0; i < array.size(); i++) {
22663        res.getAgent().add(parseProvenanceAgentComponent(array.get(i).getAsJsonObject()));
22664      }
22665    };
22666  }
22667
22668  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
22669    Questionnaire res = new Questionnaire();
22670    parseQuestionnaireProperties(json, res);
22671    return res;
22672  }
22673
22674  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
22675    parseDomainResourceProperties(json, res);
22676    if (json.has("url"))
22677      res.setUrlElement(parseUri(json.get("url").getAsString()));
22678    if (json.has("_url"))
22679      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
22680    if (json.has("identifier")) {
22681      JsonArray array = getJArray(json, "identifier");
22682      for (int i = 0; i < array.size(); i++) {
22683        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22684      }
22685    };
22686    if (json.has("version"))
22687      res.setVersionElement(parseString(json.get("version").getAsString()));
22688    if (json.has("_version"))
22689      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22690    if (json.has("name"))
22691      res.setNameElement(parseString(json.get("name").getAsString()));
22692    if (json.has("_name"))
22693      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22694    if (json.has("title"))
22695      res.setTitleElement(parseString(json.get("title").getAsString()));
22696    if (json.has("_title"))
22697      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22698    if (json.has("derivedFrom")) {
22699      JsonArray array = getJArray(json, "derivedFrom");
22700      for (int i = 0; i < array.size(); i++) {
22701        if (array.get(i).isJsonNull()) {
22702          res.getDerivedFrom().add(new CanonicalType());
22703        } else {;
22704          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
22705        }
22706      }
22707    };
22708    if (json.has("_derivedFrom")) {
22709      JsonArray array = getJArray(json, "_derivedFrom");
22710      for (int i = 0; i < array.size(); i++) {
22711        if (i == res.getDerivedFrom().size())
22712          res.getDerivedFrom().add(parseCanonical(null));
22713        if (array.get(i) instanceof JsonObject) 
22714          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
22715      }
22716    };
22717    if (json.has("status"))
22718      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22719    if (json.has("_status"))
22720      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22721    if (json.has("experimental"))
22722      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22723    if (json.has("_experimental"))
22724      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
22725    if (json.has("subjectType")) {
22726      JsonArray array = getJArray(json, "subjectType");
22727      for (int i = 0; i < array.size(); i++) {
22728        if (array.get(i).isJsonNull()) {
22729          res.getSubjectType().add(new CodeType());
22730        } else {;
22731          res.getSubjectType().add(parseCode(array.get(i).getAsString()));
22732        }
22733      }
22734    };
22735    if (json.has("_subjectType")) {
22736      JsonArray array = getJArray(json, "_subjectType");
22737      for (int i = 0; i < array.size(); i++) {
22738        if (i == res.getSubjectType().size())
22739          res.getSubjectType().add(parseCode(null));
22740        if (array.get(i) instanceof JsonObject) 
22741          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
22742      }
22743    };
22744    if (json.has("date"))
22745      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22746    if (json.has("_date"))
22747      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
22748    if (json.has("publisher"))
22749      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22750    if (json.has("_publisher"))
22751      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
22752    if (json.has("contact")) {
22753      JsonArray array = getJArray(json, "contact");
22754      for (int i = 0; i < array.size(); i++) {
22755        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22756      }
22757    };
22758    if (json.has("description"))
22759      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22760    if (json.has("_description"))
22761      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22762    if (json.has("useContext")) {
22763      JsonArray array = getJArray(json, "useContext");
22764      for (int i = 0; i < array.size(); i++) {
22765        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22766      }
22767    };
22768    if (json.has("jurisdiction")) {
22769      JsonArray array = getJArray(json, "jurisdiction");
22770      for (int i = 0; i < array.size(); i++) {
22771        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22772      }
22773    };
22774    if (json.has("purpose"))
22775      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22776    if (json.has("_purpose"))
22777      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
22778    if (json.has("copyright"))
22779      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22780    if (json.has("_copyright"))
22781      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
22782    if (json.has("approvalDate"))
22783      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22784    if (json.has("_approvalDate"))
22785      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
22786    if (json.has("lastReviewDate"))
22787      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22788    if (json.has("_lastReviewDate"))
22789      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
22790    if (json.has("effectivePeriod"))
22791      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
22792    if (json.has("code")) {
22793      JsonArray array = getJArray(json, "code");
22794      for (int i = 0; i < array.size(); i++) {
22795        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
22796      }
22797    };
22798    if (json.has("item")) {
22799      JsonArray array = getJArray(json, "item");
22800      for (int i = 0; i < array.size(); i++) {
22801        res.getItem().add(parseQuestionnaireItemComponent(array.get(i).getAsJsonObject()));
22802      }
22803    };
22804  }
22805
22806  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireItemComponent(JsonObject json) throws IOException, FHIRFormatError {
22807    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
22808    parseQuestionnaireItemComponentProperties(json, res);
22809    return res;
22810  }
22811
22812  protected void parseQuestionnaireItemComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
22813    parseBackboneElementProperties(json, res);
22814    if (json.has("linkId"))
22815      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
22816    if (json.has("_linkId"))
22817      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
22818    if (json.has("definition"))
22819      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
22820    if (json.has("_definition"))
22821      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
22822    if (json.has("code")) {
22823      JsonArray array = getJArray(json, "code");
22824      for (int i = 0; i < array.size(); i++) {
22825        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
22826      }
22827    };
22828    if (json.has("prefix"))
22829      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
22830    if (json.has("_prefix"))
22831      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
22832    if (json.has("text"))
22833      res.setTextElement(parseString(json.get("text").getAsString()));
22834    if (json.has("_text"))
22835      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
22836    if (json.has("type"))
22837      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
22838    if (json.has("_type"))
22839      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
22840    if (json.has("enableWhen")) {
22841      JsonArray array = getJArray(json, "enableWhen");
22842      for (int i = 0; i < array.size(); i++) {
22843        res.getEnableWhen().add(parseQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject()));
22844      }
22845    };
22846    if (json.has("enableBehavior"))
22847      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
22848    if (json.has("_enableBehavior"))
22849      parseElementProperties(getJObject(json, "_enableBehavior"), res.getEnableBehaviorElement());
22850    if (json.has("required"))
22851      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
22852    if (json.has("_required"))
22853      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
22854    if (json.has("repeats"))
22855      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
22856    if (json.has("_repeats"))
22857      parseElementProperties(getJObject(json, "_repeats"), res.getRepeatsElement());
22858    if (json.has("readOnly"))
22859      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
22860    if (json.has("_readOnly"))
22861      parseElementProperties(getJObject(json, "_readOnly"), res.getReadOnlyElement());
22862    if (json.has("maxLength"))
22863      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
22864    if (json.has("_maxLength"))
22865      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
22866    if (json.has("answerValueSet"))
22867      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
22868    if (json.has("_answerValueSet"))
22869      parseElementProperties(getJObject(json, "_answerValueSet"), res.getAnswerValueSetElement());
22870    if (json.has("answerOption")) {
22871      JsonArray array = getJArray(json, "answerOption");
22872      for (int i = 0; i < array.size(); i++) {
22873        res.getAnswerOption().add(parseQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject()));
22874      }
22875    };
22876    if (json.has("initial")) {
22877      JsonArray array = getJArray(json, "initial");
22878      for (int i = 0; i < array.size(); i++) {
22879        res.getInitial().add(parseQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject()));
22880      }
22881    };
22882    if (json.has("item")) {
22883      JsonArray array = getJArray(json, "item");
22884      for (int i = 0; i < array.size(); i++) {
22885        res.getItem().add(parseQuestionnaireItemComponent(array.get(i).getAsJsonObject()));
22886      }
22887    };
22888  }
22889
22890  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireItemEnableWhenComponent(JsonObject json) throws IOException, FHIRFormatError {
22891    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
22892    parseQuestionnaireItemEnableWhenComponentProperties(json, res);
22893    return res;
22894  }
22895
22896  protected void parseQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
22897    parseBackboneElementProperties(json, res);
22898    if (json.has("question"))
22899      res.setQuestionElement(parseString(json.get("question").getAsString()));
22900    if (json.has("_question"))
22901      parseElementProperties(getJObject(json, "_question"), res.getQuestionElement());
22902    if (json.has("operator"))
22903      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
22904    if (json.has("_operator"))
22905      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
22906    DataType answer = parseType("answer", json);
22907    if (answer != null)
22908      res.setAnswer(answer);
22909  }
22910
22911  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireItemAnswerOptionComponent(JsonObject json) throws IOException, FHIRFormatError {
22912    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
22913    parseQuestionnaireItemAnswerOptionComponentProperties(json, res);
22914    return res;
22915  }
22916
22917  protected void parseQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
22918    parseBackboneElementProperties(json, res);
22919    DataType value = parseType("value", json);
22920    if (value != null)
22921      res.setValue(value);
22922    if (json.has("initialSelected"))
22923      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
22924    if (json.has("_initialSelected"))
22925      parseElementProperties(getJObject(json, "_initialSelected"), res.getInitialSelectedElement());
22926  }
22927
22928  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireItemInitialComponent(JsonObject json) throws IOException, FHIRFormatError {
22929    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
22930    parseQuestionnaireItemInitialComponentProperties(json, res);
22931    return res;
22932  }
22933
22934  protected void parseQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
22935    parseBackboneElementProperties(json, res);
22936    DataType value = parseType("value", json);
22937    if (value != null)
22938      res.setValue(value);
22939  }
22940
22941  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
22942    QuestionnaireResponse res = new QuestionnaireResponse();
22943    parseQuestionnaireResponseProperties(json, res);
22944    return res;
22945  }
22946
22947  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
22948    parseDomainResourceProperties(json, res);
22949    if (json.has("identifier"))
22950      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
22951    if (json.has("basedOn")) {
22952      JsonArray array = getJArray(json, "basedOn");
22953      for (int i = 0; i < array.size(); i++) {
22954        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22955      }
22956    };
22957    if (json.has("partOf")) {
22958      JsonArray array = getJArray(json, "partOf");
22959      for (int i = 0; i < array.size(); i++) {
22960        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22961      }
22962    };
22963    if (json.has("questionnaire"))
22964      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
22965    if (json.has("_questionnaire"))
22966      parseElementProperties(getJObject(json, "_questionnaire"), res.getQuestionnaireElement());
22967    if (json.has("status"))
22968      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
22969    if (json.has("_status"))
22970      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22971    if (json.has("subject"))
22972      res.setSubject(parseReference(getJObject(json, "subject")));
22973    if (json.has("encounter"))
22974      res.setEncounter(parseReference(getJObject(json, "encounter")));
22975    if (json.has("authored"))
22976      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
22977    if (json.has("_authored"))
22978      parseElementProperties(getJObject(json, "_authored"), res.getAuthoredElement());
22979    if (json.has("author"))
22980      res.setAuthor(parseReference(getJObject(json, "author")));
22981    if (json.has("source"))
22982      res.setSource(parseReference(getJObject(json, "source")));
22983    if (json.has("item")) {
22984      JsonArray array = getJArray(json, "item");
22985      for (int i = 0; i < array.size(); i++) {
22986        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
22987      }
22988    };
22989  }
22990
22991  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
22992    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
22993    parseQuestionnaireResponseItemComponentProperties(json, res);
22994    return res;
22995  }
22996
22997  protected void parseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
22998    parseBackboneElementProperties(json, res);
22999    if (json.has("linkId"))
23000      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
23001    if (json.has("_linkId"))
23002      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
23003    if (json.has("definition"))
23004      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
23005    if (json.has("_definition"))
23006      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
23007    if (json.has("text"))
23008      res.setTextElement(parseString(json.get("text").getAsString()));
23009    if (json.has("_text"))
23010      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
23011    if (json.has("answer")) {
23012      JsonArray array = getJArray(json, "answer");
23013      for (int i = 0; i < array.size(); i++) {
23014        res.getAnswer().add(parseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject()));
23015      }
23016    };
23017    if (json.has("item")) {
23018      JsonArray array = getJArray(json, "item");
23019      for (int i = 0; i < array.size(); i++) {
23020        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
23021      }
23022    };
23023  }
23024
23025  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseItemAnswerComponent(JsonObject json) throws IOException, FHIRFormatError {
23026    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
23027    parseQuestionnaireResponseItemAnswerComponentProperties(json, res);
23028    return res;
23029  }
23030
23031  protected void parseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
23032    parseBackboneElementProperties(json, res);
23033    DataType value = parseType("value", json);
23034    if (value != null)
23035      res.setValue(value);
23036    if (json.has("item")) {
23037      JsonArray array = getJArray(json, "item");
23038      for (int i = 0; i < array.size(); i++) {
23039        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
23040      }
23041    };
23042  }
23043
23044  protected RegulatedAuthorization parseRegulatedAuthorization(JsonObject json) throws IOException, FHIRFormatError {
23045    RegulatedAuthorization res = new RegulatedAuthorization();
23046    parseRegulatedAuthorizationProperties(json, res);
23047    return res;
23048  }
23049
23050  protected void parseRegulatedAuthorizationProperties(JsonObject json, RegulatedAuthorization res) throws IOException, FHIRFormatError {
23051    parseDomainResourceProperties(json, res);
23052    if (json.has("identifier")) {
23053      JsonArray array = getJArray(json, "identifier");
23054      for (int i = 0; i < array.size(); i++) {
23055        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23056      }
23057    };
23058    if (json.has("subject")) {
23059      JsonArray array = getJArray(json, "subject");
23060      for (int i = 0; i < array.size(); i++) {
23061        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
23062      }
23063    };
23064    if (json.has("type"))
23065      res.setType(parseCodeableConcept(getJObject(json, "type")));
23066    if (json.has("description"))
23067      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23068    if (json.has("_description"))
23069      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23070    if (json.has("region")) {
23071      JsonArray array = getJArray(json, "region");
23072      for (int i = 0; i < array.size(); i++) {
23073        res.getRegion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23074      }
23075    };
23076    if (json.has("status"))
23077      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
23078    if (json.has("statusDate"))
23079      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
23080    if (json.has("_statusDate"))
23081      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
23082    if (json.has("validityPeriod"))
23083      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
23084    if (json.has("indication"))
23085      res.setIndication(parseCodeableReference(getJObject(json, "indication")));
23086    if (json.has("intendedUse"))
23087      res.setIntendedUse(parseCodeableConcept(getJObject(json, "intendedUse")));
23088    if (json.has("basis")) {
23089      JsonArray array = getJArray(json, "basis");
23090      for (int i = 0; i < array.size(); i++) {
23091        res.getBasis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23092      }
23093    };
23094    if (json.has("holder"))
23095      res.setHolder(parseReference(getJObject(json, "holder")));
23096    if (json.has("regulator"))
23097      res.setRegulator(parseReference(getJObject(json, "regulator")));
23098    if (json.has("case"))
23099      res.setCase(parseRegulatedAuthorizationCaseComponent(getJObject(json, "case")));
23100  }
23101
23102  protected RegulatedAuthorization.RegulatedAuthorizationCaseComponent parseRegulatedAuthorizationCaseComponent(JsonObject json) throws IOException, FHIRFormatError {
23103    RegulatedAuthorization.RegulatedAuthorizationCaseComponent res = new RegulatedAuthorization.RegulatedAuthorizationCaseComponent();
23104    parseRegulatedAuthorizationCaseComponentProperties(json, res);
23105    return res;
23106  }
23107
23108  protected void parseRegulatedAuthorizationCaseComponentProperties(JsonObject json, RegulatedAuthorization.RegulatedAuthorizationCaseComponent res) throws IOException, FHIRFormatError {
23109    parseBackboneElementProperties(json, res);
23110    if (json.has("identifier"))
23111      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
23112    if (json.has("type"))
23113      res.setType(parseCodeableConcept(getJObject(json, "type")));
23114    if (json.has("status"))
23115      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
23116    DataType date = parseType("date", json);
23117    if (date != null)
23118      res.setDate(date);
23119    if (json.has("application")) {
23120      JsonArray array = getJArray(json, "application");
23121      for (int i = 0; i < array.size(); i++) {
23122        res.getApplication().add(parseRegulatedAuthorizationCaseComponent(array.get(i).getAsJsonObject()));
23123      }
23124    };
23125  }
23126
23127  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
23128    RelatedPerson res = new RelatedPerson();
23129    parseRelatedPersonProperties(json, res);
23130    return res;
23131  }
23132
23133  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
23134    parseDomainResourceProperties(json, res);
23135    if (json.has("identifier")) {
23136      JsonArray array = getJArray(json, "identifier");
23137      for (int i = 0; i < array.size(); i++) {
23138        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23139      }
23140    };
23141    if (json.has("active"))
23142      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23143    if (json.has("_active"))
23144      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
23145    if (json.has("patient"))
23146      res.setPatient(parseReference(getJObject(json, "patient")));
23147    if (json.has("relationship")) {
23148      JsonArray array = getJArray(json, "relationship");
23149      for (int i = 0; i < array.size(); i++) {
23150        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23151      }
23152    };
23153    if (json.has("name")) {
23154      JsonArray array = getJArray(json, "name");
23155      for (int i = 0; i < array.size(); i++) {
23156        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
23157      }
23158    };
23159    if (json.has("telecom")) {
23160      JsonArray array = getJArray(json, "telecom");
23161      for (int i = 0; i < array.size(); i++) {
23162        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
23163      }
23164    };
23165    if (json.has("gender"))
23166      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
23167    if (json.has("_gender"))
23168      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
23169    if (json.has("birthDate"))
23170      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
23171    if (json.has("_birthDate"))
23172      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
23173    if (json.has("address")) {
23174      JsonArray array = getJArray(json, "address");
23175      for (int i = 0; i < array.size(); i++) {
23176        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
23177      }
23178    };
23179    if (json.has("photo")) {
23180      JsonArray array = getJArray(json, "photo");
23181      for (int i = 0; i < array.size(); i++) {
23182        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
23183      }
23184    };
23185    if (json.has("period"))
23186      res.setPeriod(parsePeriod(getJObject(json, "period")));
23187    if (json.has("communication")) {
23188      JsonArray array = getJArray(json, "communication");
23189      for (int i = 0; i < array.size(); i++) {
23190        res.getCommunication().add(parseRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject()));
23191      }
23192    };
23193  }
23194
23195  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
23196    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
23197    parseRelatedPersonCommunicationComponentProperties(json, res);
23198    return res;
23199  }
23200
23201  protected void parseRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
23202    parseBackboneElementProperties(json, res);
23203    if (json.has("language"))
23204      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
23205    if (json.has("preferred"))
23206      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
23207    if (json.has("_preferred"))
23208      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
23209  }
23210
23211  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
23212    RequestGroup res = new RequestGroup();
23213    parseRequestGroupProperties(json, res);
23214    return res;
23215  }
23216
23217  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
23218    parseDomainResourceProperties(json, res);
23219    if (json.has("identifier")) {
23220      JsonArray array = getJArray(json, "identifier");
23221      for (int i = 0; i < array.size(); i++) {
23222        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23223      }
23224    };
23225    if (json.has("instantiatesCanonical")) {
23226      JsonArray array = getJArray(json, "instantiatesCanonical");
23227      for (int i = 0; i < array.size(); i++) {
23228        if (array.get(i).isJsonNull()) {
23229          res.getInstantiatesCanonical().add(new CanonicalType());
23230        } else {;
23231          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
23232        }
23233      }
23234    };
23235    if (json.has("_instantiatesCanonical")) {
23236      JsonArray array = getJArray(json, "_instantiatesCanonical");
23237      for (int i = 0; i < array.size(); i++) {
23238        if (i == res.getInstantiatesCanonical().size())
23239          res.getInstantiatesCanonical().add(parseCanonical(null));
23240        if (array.get(i) instanceof JsonObject) 
23241          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
23242      }
23243    };
23244    if (json.has("instantiatesUri")) {
23245      JsonArray array = getJArray(json, "instantiatesUri");
23246      for (int i = 0; i < array.size(); i++) {
23247        if (array.get(i).isJsonNull()) {
23248          res.getInstantiatesUri().add(new UriType());
23249        } else {;
23250          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
23251        }
23252      }
23253    };
23254    if (json.has("_instantiatesUri")) {
23255      JsonArray array = getJArray(json, "_instantiatesUri");
23256      for (int i = 0; i < array.size(); i++) {
23257        if (i == res.getInstantiatesUri().size())
23258          res.getInstantiatesUri().add(parseUri(null));
23259        if (array.get(i) instanceof JsonObject) 
23260          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
23261      }
23262    };
23263    if (json.has("basedOn")) {
23264      JsonArray array = getJArray(json, "basedOn");
23265      for (int i = 0; i < array.size(); i++) {
23266        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23267      }
23268    };
23269    if (json.has("replaces")) {
23270      JsonArray array = getJArray(json, "replaces");
23271      for (int i = 0; i < array.size(); i++) {
23272        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
23273      }
23274    };
23275    if (json.has("groupIdentifier"))
23276      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
23277    if (json.has("status"))
23278      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
23279    if (json.has("_status"))
23280      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23281    if (json.has("intent"))
23282      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
23283    if (json.has("_intent"))
23284      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
23285    if (json.has("priority"))
23286      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
23287    if (json.has("_priority"))
23288      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
23289    if (json.has("code"))
23290      res.setCode(parseCodeableConcept(getJObject(json, "code")));
23291    if (json.has("subject"))
23292      res.setSubject(parseReference(getJObject(json, "subject")));
23293    if (json.has("encounter"))
23294      res.setEncounter(parseReference(getJObject(json, "encounter")));
23295    if (json.has("authoredOn"))
23296      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23297    if (json.has("_authoredOn"))
23298      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
23299    if (json.has("author"))
23300      res.setAuthor(parseReference(getJObject(json, "author")));
23301    if (json.has("reasonCode")) {
23302      JsonArray array = getJArray(json, "reasonCode");
23303      for (int i = 0; i < array.size(); i++) {
23304        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23305      }
23306    };
23307    if (json.has("reasonReference")) {
23308      JsonArray array = getJArray(json, "reasonReference");
23309      for (int i = 0; i < array.size(); i++) {
23310        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
23311      }
23312    };
23313    if (json.has("note")) {
23314      JsonArray array = getJArray(json, "note");
23315      for (int i = 0; i < array.size(); i++) {
23316        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23317      }
23318    };
23319    if (json.has("action")) {
23320      JsonArray array = getJArray(json, "action");
23321      for (int i = 0; i < array.size(); i++) {
23322        res.getAction().add(parseRequestGroupActionComponent(array.get(i).getAsJsonObject()));
23323      }
23324    };
23325  }
23326
23327  protected RequestGroup.RequestGroupActionComponent parseRequestGroupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
23328    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
23329    parseRequestGroupActionComponentProperties(json, res);
23330    return res;
23331  }
23332
23333  protected void parseRequestGroupActionComponentProperties(JsonObject json, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
23334    parseBackboneElementProperties(json, res);
23335    if (json.has("prefix"))
23336      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
23337    if (json.has("_prefix"))
23338      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
23339    if (json.has("title"))
23340      res.setTitleElement(parseString(json.get("title").getAsString()));
23341    if (json.has("_title"))
23342      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23343    if (json.has("description"))
23344      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23345    if (json.has("_description"))
23346      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23347    if (json.has("textEquivalent"))
23348      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
23349    if (json.has("_textEquivalent"))
23350      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
23351    if (json.has("priority"))
23352      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
23353    if (json.has("_priority"))
23354      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
23355    if (json.has("code")) {
23356      JsonArray array = getJArray(json, "code");
23357      for (int i = 0; i < array.size(); i++) {
23358        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23359      }
23360    };
23361    if (json.has("documentation")) {
23362      JsonArray array = getJArray(json, "documentation");
23363      for (int i = 0; i < array.size(); i++) {
23364        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23365      }
23366    };
23367    if (json.has("condition")) {
23368      JsonArray array = getJArray(json, "condition");
23369      for (int i = 0; i < array.size(); i++) {
23370        res.getCondition().add(parseRequestGroupActionConditionComponent(array.get(i).getAsJsonObject()));
23371      }
23372    };
23373    if (json.has("relatedAction")) {
23374      JsonArray array = getJArray(json, "relatedAction");
23375      for (int i = 0; i < array.size(); i++) {
23376        res.getRelatedAction().add(parseRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject()));
23377      }
23378    };
23379    DataType timing = parseType("timing", json);
23380    if (timing != null)
23381      res.setTiming(timing);
23382    if (json.has("participant")) {
23383      JsonArray array = getJArray(json, "participant");
23384      for (int i = 0; i < array.size(); i++) {
23385        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
23386      }
23387    };
23388    if (json.has("type"))
23389      res.setType(parseCodeableConcept(getJObject(json, "type")));
23390    if (json.has("groupingBehavior"))
23391      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
23392    if (json.has("_groupingBehavior"))
23393      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
23394    if (json.has("selectionBehavior"))
23395      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
23396    if (json.has("_selectionBehavior"))
23397      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
23398    if (json.has("requiredBehavior"))
23399      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
23400    if (json.has("_requiredBehavior"))
23401      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
23402    if (json.has("precheckBehavior"))
23403      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
23404    if (json.has("_precheckBehavior"))
23405      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
23406    if (json.has("cardinalityBehavior"))
23407      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.ActionCardinalityBehaviorEnumFactory()));
23408    if (json.has("_cardinalityBehavior"))
23409      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
23410    if (json.has("resource"))
23411      res.setResource(parseReference(getJObject(json, "resource")));
23412    if (json.has("action")) {
23413      JsonArray array = getJArray(json, "action");
23414      for (int i = 0; i < array.size(); i++) {
23415        res.getAction().add(parseRequestGroupActionComponent(array.get(i).getAsJsonObject()));
23416      }
23417    };
23418  }
23419
23420  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupActionConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
23421    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
23422    parseRequestGroupActionConditionComponentProperties(json, res);
23423    return res;
23424  }
23425
23426  protected void parseRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
23427    parseBackboneElementProperties(json, res);
23428    if (json.has("kind"))
23429      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.ActionConditionKind.NULL, new Enumerations.ActionConditionKindEnumFactory()));
23430    if (json.has("_kind"))
23431      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
23432    if (json.has("expression"))
23433      res.setExpression(parseExpression(getJObject(json, "expression")));
23434  }
23435
23436  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupActionRelatedActionComponent(JsonObject json) throws IOException, FHIRFormatError {
23437    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
23438    parseRequestGroupActionRelatedActionComponentProperties(json, res);
23439    return res;
23440  }
23441
23442  protected void parseRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
23443    parseBackboneElementProperties(json, res);
23444    if (json.has("actionId"))
23445      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
23446    if (json.has("_actionId"))
23447      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
23448    if (json.has("relationship"))
23449      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
23450    if (json.has("_relationship"))
23451      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
23452    DataType offset = parseType("offset", json);
23453    if (offset != null)
23454      res.setOffset(offset);
23455  }
23456
23457  protected ResearchDefinition parseResearchDefinition(JsonObject json) throws IOException, FHIRFormatError {
23458    ResearchDefinition res = new ResearchDefinition();
23459    parseResearchDefinitionProperties(json, res);
23460    return res;
23461  }
23462
23463  protected void parseResearchDefinitionProperties(JsonObject json, ResearchDefinition res) throws IOException, FHIRFormatError {
23464    parseDomainResourceProperties(json, res);
23465    if (json.has("url"))
23466      res.setUrlElement(parseUri(json.get("url").getAsString()));
23467    if (json.has("_url"))
23468      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23469    if (json.has("identifier")) {
23470      JsonArray array = getJArray(json, "identifier");
23471      for (int i = 0; i < array.size(); i++) {
23472        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23473      }
23474    };
23475    if (json.has("version"))
23476      res.setVersionElement(parseString(json.get("version").getAsString()));
23477    if (json.has("_version"))
23478      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23479    if (json.has("name"))
23480      res.setNameElement(parseString(json.get("name").getAsString()));
23481    if (json.has("_name"))
23482      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23483    if (json.has("title"))
23484      res.setTitleElement(parseString(json.get("title").getAsString()));
23485    if (json.has("_title"))
23486      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23487    if (json.has("shortTitle"))
23488      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
23489    if (json.has("_shortTitle"))
23490      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
23491    if (json.has("subtitle"))
23492      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
23493    if (json.has("_subtitle"))
23494      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
23495    if (json.has("status"))
23496      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23497    if (json.has("_status"))
23498      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23499    if (json.has("experimental"))
23500      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23501    if (json.has("_experimental"))
23502      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
23503    DataType subject = parseType("subject", json);
23504    if (subject != null)
23505      res.setSubject(subject);
23506    if (json.has("date"))
23507      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23508    if (json.has("_date"))
23509      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23510    if (json.has("publisher"))
23511      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23512    if (json.has("_publisher"))
23513      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23514    if (json.has("contact")) {
23515      JsonArray array = getJArray(json, "contact");
23516      for (int i = 0; i < array.size(); i++) {
23517        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23518      }
23519    };
23520    if (json.has("description"))
23521      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23522    if (json.has("_description"))
23523      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23524    if (json.has("comment")) {
23525      JsonArray array = getJArray(json, "comment");
23526      for (int i = 0; i < array.size(); i++) {
23527        if (array.get(i).isJsonNull()) {
23528          res.getComment().add(new StringType());
23529        } else {;
23530          res.getComment().add(parseString(array.get(i).getAsString()));
23531        }
23532      }
23533    };
23534    if (json.has("_comment")) {
23535      JsonArray array = getJArray(json, "_comment");
23536      for (int i = 0; i < array.size(); i++) {
23537        if (i == res.getComment().size())
23538          res.getComment().add(parseString(null));
23539        if (array.get(i) instanceof JsonObject) 
23540          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
23541      }
23542    };
23543    if (json.has("useContext")) {
23544      JsonArray array = getJArray(json, "useContext");
23545      for (int i = 0; i < array.size(); i++) {
23546        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23547      }
23548    };
23549    if (json.has("jurisdiction")) {
23550      JsonArray array = getJArray(json, "jurisdiction");
23551      for (int i = 0; i < array.size(); i++) {
23552        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23553      }
23554    };
23555    if (json.has("purpose"))
23556      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23557    if (json.has("_purpose"))
23558      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
23559    if (json.has("usage"))
23560      res.setUsageElement(parseString(json.get("usage").getAsString()));
23561    if (json.has("_usage"))
23562      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
23563    if (json.has("copyright"))
23564      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23565    if (json.has("_copyright"))
23566      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
23567    if (json.has("approvalDate"))
23568      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
23569    if (json.has("_approvalDate"))
23570      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
23571    if (json.has("lastReviewDate"))
23572      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
23573    if (json.has("_lastReviewDate"))
23574      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
23575    if (json.has("effectivePeriod"))
23576      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
23577    if (json.has("topic")) {
23578      JsonArray array = getJArray(json, "topic");
23579      for (int i = 0; i < array.size(); i++) {
23580        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23581      }
23582    };
23583    if (json.has("author")) {
23584      JsonArray array = getJArray(json, "author");
23585      for (int i = 0; i < array.size(); i++) {
23586        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23587      }
23588    };
23589    if (json.has("editor")) {
23590      JsonArray array = getJArray(json, "editor");
23591      for (int i = 0; i < array.size(); i++) {
23592        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23593      }
23594    };
23595    if (json.has("reviewer")) {
23596      JsonArray array = getJArray(json, "reviewer");
23597      for (int i = 0; i < array.size(); i++) {
23598        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
23599      }
23600    };
23601    if (json.has("endorser")) {
23602      JsonArray array = getJArray(json, "endorser");
23603      for (int i = 0; i < array.size(); i++) {
23604        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
23605      }
23606    };
23607    if (json.has("relatedArtifact")) {
23608      JsonArray array = getJArray(json, "relatedArtifact");
23609      for (int i = 0; i < array.size(); i++) {
23610        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23611      }
23612    };
23613    if (json.has("library")) {
23614      JsonArray array = getJArray(json, "library");
23615      for (int i = 0; i < array.size(); i++) {
23616        if (array.get(i).isJsonNull()) {
23617          res.getLibrary().add(new CanonicalType());
23618        } else {;
23619          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
23620        }
23621      }
23622    };
23623    if (json.has("_library")) {
23624      JsonArray array = getJArray(json, "_library");
23625      for (int i = 0; i < array.size(); i++) {
23626        if (i == res.getLibrary().size())
23627          res.getLibrary().add(parseCanonical(null));
23628        if (array.get(i) instanceof JsonObject) 
23629          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
23630      }
23631    };
23632    if (json.has("population"))
23633      res.setPopulation(parseReference(getJObject(json, "population")));
23634    if (json.has("exposure"))
23635      res.setExposure(parseReference(getJObject(json, "exposure")));
23636    if (json.has("exposureAlternative"))
23637      res.setExposureAlternative(parseReference(getJObject(json, "exposureAlternative")));
23638    if (json.has("outcome"))
23639      res.setOutcome(parseReference(getJObject(json, "outcome")));
23640  }
23641
23642  protected ResearchElementDefinition parseResearchElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
23643    ResearchElementDefinition res = new ResearchElementDefinition();
23644    parseResearchElementDefinitionProperties(json, res);
23645    return res;
23646  }
23647
23648  protected void parseResearchElementDefinitionProperties(JsonObject json, ResearchElementDefinition res) throws IOException, FHIRFormatError {
23649    parseDomainResourceProperties(json, res);
23650    if (json.has("url"))
23651      res.setUrlElement(parseUri(json.get("url").getAsString()));
23652    if (json.has("_url"))
23653      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23654    if (json.has("identifier")) {
23655      JsonArray array = getJArray(json, "identifier");
23656      for (int i = 0; i < array.size(); i++) {
23657        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23658      }
23659    };
23660    if (json.has("version"))
23661      res.setVersionElement(parseString(json.get("version").getAsString()));
23662    if (json.has("_version"))
23663      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23664    if (json.has("name"))
23665      res.setNameElement(parseString(json.get("name").getAsString()));
23666    if (json.has("_name"))
23667      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23668    if (json.has("title"))
23669      res.setTitleElement(parseString(json.get("title").getAsString()));
23670    if (json.has("_title"))
23671      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23672    if (json.has("shortTitle"))
23673      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
23674    if (json.has("_shortTitle"))
23675      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
23676    if (json.has("subtitle"))
23677      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
23678    if (json.has("_subtitle"))
23679      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
23680    if (json.has("status"))
23681      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23682    if (json.has("_status"))
23683      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23684    if (json.has("experimental"))
23685      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23686    if (json.has("_experimental"))
23687      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
23688    DataType subject = parseType("subject", json);
23689    if (subject != null)
23690      res.setSubject(subject);
23691    if (json.has("date"))
23692      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23693    if (json.has("_date"))
23694      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23695    if (json.has("publisher"))
23696      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23697    if (json.has("_publisher"))
23698      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23699    if (json.has("contact")) {
23700      JsonArray array = getJArray(json, "contact");
23701      for (int i = 0; i < array.size(); i++) {
23702        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23703      }
23704    };
23705    if (json.has("description"))
23706      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23707    if (json.has("_description"))
23708      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23709    if (json.has("comment")) {
23710      JsonArray array = getJArray(json, "comment");
23711      for (int i = 0; i < array.size(); i++) {
23712        if (array.get(i).isJsonNull()) {
23713          res.getComment().add(new StringType());
23714        } else {;
23715          res.getComment().add(parseString(array.get(i).getAsString()));
23716        }
23717      }
23718    };
23719    if (json.has("_comment")) {
23720      JsonArray array = getJArray(json, "_comment");
23721      for (int i = 0; i < array.size(); i++) {
23722        if (i == res.getComment().size())
23723          res.getComment().add(parseString(null));
23724        if (array.get(i) instanceof JsonObject) 
23725          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
23726      }
23727    };
23728    if (json.has("useContext")) {
23729      JsonArray array = getJArray(json, "useContext");
23730      for (int i = 0; i < array.size(); i++) {
23731        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23732      }
23733    };
23734    if (json.has("jurisdiction")) {
23735      JsonArray array = getJArray(json, "jurisdiction");
23736      for (int i = 0; i < array.size(); i++) {
23737        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23738      }
23739    };
23740    if (json.has("purpose"))
23741      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23742    if (json.has("_purpose"))
23743      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
23744    if (json.has("usage"))
23745      res.setUsageElement(parseString(json.get("usage").getAsString()));
23746    if (json.has("_usage"))
23747      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
23748    if (json.has("copyright"))
23749      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23750    if (json.has("_copyright"))
23751      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
23752    if (json.has("approvalDate"))
23753      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
23754    if (json.has("_approvalDate"))
23755      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
23756    if (json.has("lastReviewDate"))
23757      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
23758    if (json.has("_lastReviewDate"))
23759      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
23760    if (json.has("effectivePeriod"))
23761      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
23762    if (json.has("topic")) {
23763      JsonArray array = getJArray(json, "topic");
23764      for (int i = 0; i < array.size(); i++) {
23765        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23766      }
23767    };
23768    if (json.has("author")) {
23769      JsonArray array = getJArray(json, "author");
23770      for (int i = 0; i < array.size(); i++) {
23771        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23772      }
23773    };
23774    if (json.has("editor")) {
23775      JsonArray array = getJArray(json, "editor");
23776      for (int i = 0; i < array.size(); i++) {
23777        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23778      }
23779    };
23780    if (json.has("reviewer")) {
23781      JsonArray array = getJArray(json, "reviewer");
23782      for (int i = 0; i < array.size(); i++) {
23783        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
23784      }
23785    };
23786    if (json.has("endorser")) {
23787      JsonArray array = getJArray(json, "endorser");
23788      for (int i = 0; i < array.size(); i++) {
23789        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
23790      }
23791    };
23792    if (json.has("relatedArtifact")) {
23793      JsonArray array = getJArray(json, "relatedArtifact");
23794      for (int i = 0; i < array.size(); i++) {
23795        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23796      }
23797    };
23798    if (json.has("library")) {
23799      JsonArray array = getJArray(json, "library");
23800      for (int i = 0; i < array.size(); i++) {
23801        if (array.get(i).isJsonNull()) {
23802          res.getLibrary().add(new CanonicalType());
23803        } else {;
23804          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
23805        }
23806      }
23807    };
23808    if (json.has("_library")) {
23809      JsonArray array = getJArray(json, "_library");
23810      for (int i = 0; i < array.size(); i++) {
23811        if (i == res.getLibrary().size())
23812          res.getLibrary().add(parseCanonical(null));
23813        if (array.get(i) instanceof JsonObject) 
23814          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
23815      }
23816    };
23817    if (json.has("type"))
23818      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ResearchElementDefinition.ResearchElementType.NULL, new ResearchElementDefinition.ResearchElementTypeEnumFactory()));
23819    if (json.has("_type"))
23820      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23821    if (json.has("variableType"))
23822      res.setVariableTypeElement(parseEnumeration(json.get("variableType").getAsString(), ResearchElementDefinition.VariableType.NULL, new ResearchElementDefinition.VariableTypeEnumFactory()));
23823    if (json.has("_variableType"))
23824      parseElementProperties(getJObject(json, "_variableType"), res.getVariableTypeElement());
23825    if (json.has("characteristic")) {
23826      JsonArray array = getJArray(json, "characteristic");
23827      for (int i = 0; i < array.size(); i++) {
23828        res.getCharacteristic().add(parseResearchElementDefinitionCharacteristicComponent(array.get(i).getAsJsonObject()));
23829      }
23830    };
23831  }
23832
23833  protected ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent parseResearchElementDefinitionCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
23834    ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res = new ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent();
23835    parseResearchElementDefinitionCharacteristicComponentProperties(json, res);
23836    return res;
23837  }
23838
23839  protected void parseResearchElementDefinitionCharacteristicComponentProperties(JsonObject json, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
23840    parseBackboneElementProperties(json, res);
23841    DataType definition = parseType("definition", json);
23842    if (definition != null)
23843      res.setDefinition(definition);
23844    if (json.has("usageContext")) {
23845      JsonArray array = getJArray(json, "usageContext");
23846      for (int i = 0; i < array.size(); i++) {
23847        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23848      }
23849    };
23850    if (json.has("exclude"))
23851      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
23852    if (json.has("_exclude"))
23853      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
23854    if (json.has("unitOfMeasure"))
23855      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
23856    if (json.has("studyEffectiveDescription"))
23857      res.setStudyEffectiveDescriptionElement(parseString(json.get("studyEffectiveDescription").getAsString()));
23858    if (json.has("_studyEffectiveDescription"))
23859      parseElementProperties(getJObject(json, "_studyEffectiveDescription"), res.getStudyEffectiveDescriptionElement());
23860    DataType studyEffective = parseType("studyEffective", json);
23861    if (studyEffective != null)
23862      res.setStudyEffective(studyEffective);
23863    if (json.has("studyEffectiveTimeFromStart"))
23864      res.setStudyEffectiveTimeFromStart(parseDuration(getJObject(json, "studyEffectiveTimeFromStart")));
23865    if (json.has("studyEffectiveGroupMeasure"))
23866      res.setStudyEffectiveGroupMeasureElement(parseEnumeration(json.get("studyEffectiveGroupMeasure").getAsString(), Enumerations.GroupMeasure.NULL, new Enumerations.GroupMeasureEnumFactory()));
23867    if (json.has("_studyEffectiveGroupMeasure"))
23868      parseElementProperties(getJObject(json, "_studyEffectiveGroupMeasure"), res.getStudyEffectiveGroupMeasureElement());
23869    if (json.has("participantEffectiveDescription"))
23870      res.setParticipantEffectiveDescriptionElement(parseString(json.get("participantEffectiveDescription").getAsString()));
23871    if (json.has("_participantEffectiveDescription"))
23872      parseElementProperties(getJObject(json, "_participantEffectiveDescription"), res.getParticipantEffectiveDescriptionElement());
23873    DataType participantEffective = parseType("participantEffective", json);
23874    if (participantEffective != null)
23875      res.setParticipantEffective(participantEffective);
23876    if (json.has("participantEffectiveTimeFromStart"))
23877      res.setParticipantEffectiveTimeFromStart(parseDuration(getJObject(json, "participantEffectiveTimeFromStart")));
23878    if (json.has("participantEffectiveGroupMeasure"))
23879      res.setParticipantEffectiveGroupMeasureElement(parseEnumeration(json.get("participantEffectiveGroupMeasure").getAsString(), Enumerations.GroupMeasure.NULL, new Enumerations.GroupMeasureEnumFactory()));
23880    if (json.has("_participantEffectiveGroupMeasure"))
23881      parseElementProperties(getJObject(json, "_participantEffectiveGroupMeasure"), res.getParticipantEffectiveGroupMeasureElement());
23882  }
23883
23884  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
23885    ResearchStudy res = new ResearchStudy();
23886    parseResearchStudyProperties(json, res);
23887    return res;
23888  }
23889
23890  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
23891    parseDomainResourceProperties(json, res);
23892    if (json.has("identifier")) {
23893      JsonArray array = getJArray(json, "identifier");
23894      for (int i = 0; i < array.size(); i++) {
23895        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23896      }
23897    };
23898    if (json.has("title"))
23899      res.setTitleElement(parseString(json.get("title").getAsString()));
23900    if (json.has("_title"))
23901      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23902    if (json.has("protocol")) {
23903      JsonArray array = getJArray(json, "protocol");
23904      for (int i = 0; i < array.size(); i++) {
23905        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
23906      }
23907    };
23908    if (json.has("partOf")) {
23909      JsonArray array = getJArray(json, "partOf");
23910      for (int i = 0; i < array.size(); i++) {
23911        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
23912      }
23913    };
23914    if (json.has("status"))
23915      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
23916    if (json.has("_status"))
23917      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23918    if (json.has("primaryPurposeType"))
23919      res.setPrimaryPurposeType(parseCodeableConcept(getJObject(json, "primaryPurposeType")));
23920    if (json.has("phase"))
23921      res.setPhase(parseCodeableConcept(getJObject(json, "phase")));
23922    if (json.has("category")) {
23923      JsonArray array = getJArray(json, "category");
23924      for (int i = 0; i < array.size(); i++) {
23925        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23926      }
23927    };
23928    if (json.has("focus")) {
23929      JsonArray array = getJArray(json, "focus");
23930      for (int i = 0; i < array.size(); i++) {
23931        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23932      }
23933    };
23934    if (json.has("condition")) {
23935      JsonArray array = getJArray(json, "condition");
23936      for (int i = 0; i < array.size(); i++) {
23937        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23938      }
23939    };
23940    if (json.has("contact")) {
23941      JsonArray array = getJArray(json, "contact");
23942      for (int i = 0; i < array.size(); i++) {
23943        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23944      }
23945    };
23946    if (json.has("relatedArtifact")) {
23947      JsonArray array = getJArray(json, "relatedArtifact");
23948      for (int i = 0; i < array.size(); i++) {
23949        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23950      }
23951    };
23952    if (json.has("keyword")) {
23953      JsonArray array = getJArray(json, "keyword");
23954      for (int i = 0; i < array.size(); i++) {
23955        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23956      }
23957    };
23958    if (json.has("location")) {
23959      JsonArray array = getJArray(json, "location");
23960      for (int i = 0; i < array.size(); i++) {
23961        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23962      }
23963    };
23964    if (json.has("description"))
23965      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23966    if (json.has("_description"))
23967      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23968    if (json.has("enrollment")) {
23969      JsonArray array = getJArray(json, "enrollment");
23970      for (int i = 0; i < array.size(); i++) {
23971        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
23972      }
23973    };
23974    if (json.has("period"))
23975      res.setPeriod(parsePeriod(getJObject(json, "period")));
23976    if (json.has("sponsor"))
23977      res.setSponsor(parseReference(getJObject(json, "sponsor")));
23978    if (json.has("principalInvestigator"))
23979      res.setPrincipalInvestigator(parseReference(getJObject(json, "principalInvestigator")));
23980    if (json.has("site")) {
23981      JsonArray array = getJArray(json, "site");
23982      for (int i = 0; i < array.size(); i++) {
23983        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
23984      }
23985    };
23986    if (json.has("reasonStopped"))
23987      res.setReasonStopped(parseCodeableConcept(getJObject(json, "reasonStopped")));
23988    if (json.has("note")) {
23989      JsonArray array = getJArray(json, "note");
23990      for (int i = 0; i < array.size(); i++) {
23991        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23992      }
23993    };
23994    if (json.has("arm")) {
23995      JsonArray array = getJArray(json, "arm");
23996      for (int i = 0; i < array.size(); i++) {
23997        res.getArm().add(parseResearchStudyArmComponent(array.get(i).getAsJsonObject()));
23998      }
23999    };
24000    if (json.has("objective")) {
24001      JsonArray array = getJArray(json, "objective");
24002      for (int i = 0; i < array.size(); i++) {
24003        res.getObjective().add(parseResearchStudyObjectiveComponent(array.get(i).getAsJsonObject()));
24004      }
24005    };
24006  }
24007
24008  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyArmComponent(JsonObject json) throws IOException, FHIRFormatError {
24009    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
24010    parseResearchStudyArmComponentProperties(json, res);
24011    return res;
24012  }
24013
24014  protected void parseResearchStudyArmComponentProperties(JsonObject json, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
24015    parseBackboneElementProperties(json, res);
24016    if (json.has("name"))
24017      res.setNameElement(parseString(json.get("name").getAsString()));
24018    if (json.has("_name"))
24019      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24020    if (json.has("type"))
24021      res.setType(parseCodeableConcept(getJObject(json, "type")));
24022    if (json.has("description"))
24023      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24024    if (json.has("_description"))
24025      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24026  }
24027
24028  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyObjectiveComponent(JsonObject json) throws IOException, FHIRFormatError {
24029    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
24030    parseResearchStudyObjectiveComponentProperties(json, res);
24031    return res;
24032  }
24033
24034  protected void parseResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
24035    parseBackboneElementProperties(json, res);
24036    if (json.has("name"))
24037      res.setNameElement(parseString(json.get("name").getAsString()));
24038    if (json.has("_name"))
24039      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24040    if (json.has("type"))
24041      res.setType(parseCodeableConcept(getJObject(json, "type")));
24042  }
24043
24044  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
24045    ResearchSubject res = new ResearchSubject();
24046    parseResearchSubjectProperties(json, res);
24047    return res;
24048  }
24049
24050  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
24051    parseDomainResourceProperties(json, res);
24052    if (json.has("identifier")) {
24053      JsonArray array = getJArray(json, "identifier");
24054      for (int i = 0; i < array.size(); i++) {
24055        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24056      }
24057    };
24058    if (json.has("status"))
24059      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
24060    if (json.has("_status"))
24061      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24062    if (json.has("period"))
24063      res.setPeriod(parsePeriod(getJObject(json, "period")));
24064    if (json.has("study"))
24065      res.setStudy(parseReference(getJObject(json, "study")));
24066    if (json.has("individual"))
24067      res.setIndividual(parseReference(getJObject(json, "individual")));
24068    if (json.has("assignedArm"))
24069      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
24070    if (json.has("_assignedArm"))
24071      parseElementProperties(getJObject(json, "_assignedArm"), res.getAssignedArmElement());
24072    if (json.has("actualArm"))
24073      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
24074    if (json.has("_actualArm"))
24075      parseElementProperties(getJObject(json, "_actualArm"), res.getActualArmElement());
24076    if (json.has("consent"))
24077      res.setConsent(parseReference(getJObject(json, "consent")));
24078  }
24079
24080  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
24081    RiskAssessment res = new RiskAssessment();
24082    parseRiskAssessmentProperties(json, res);
24083    return res;
24084  }
24085
24086  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
24087    parseDomainResourceProperties(json, res);
24088    if (json.has("identifier")) {
24089      JsonArray array = getJArray(json, "identifier");
24090      for (int i = 0; i < array.size(); i++) {
24091        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24092      }
24093    };
24094    if (json.has("basedOn"))
24095      res.setBasedOn(parseReference(getJObject(json, "basedOn")));
24096    if (json.has("parent"))
24097      res.setParent(parseReference(getJObject(json, "parent")));
24098    if (json.has("status"))
24099      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
24100    if (json.has("_status"))
24101      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24102    if (json.has("method"))
24103      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
24104    if (json.has("code"))
24105      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24106    if (json.has("subject"))
24107      res.setSubject(parseReference(getJObject(json, "subject")));
24108    if (json.has("encounter"))
24109      res.setEncounter(parseReference(getJObject(json, "encounter")));
24110    DataType occurrence = parseType("occurrence", json);
24111    if (occurrence != null)
24112      res.setOccurrence(occurrence);
24113    if (json.has("condition"))
24114      res.setCondition(parseReference(getJObject(json, "condition")));
24115    if (json.has("performer"))
24116      res.setPerformer(parseReference(getJObject(json, "performer")));
24117    if (json.has("reasonCode")) {
24118      JsonArray array = getJArray(json, "reasonCode");
24119      for (int i = 0; i < array.size(); i++) {
24120        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24121      }
24122    };
24123    if (json.has("reasonReference")) {
24124      JsonArray array = getJArray(json, "reasonReference");
24125      for (int i = 0; i < array.size(); i++) {
24126        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
24127      }
24128    };
24129    if (json.has("basis")) {
24130      JsonArray array = getJArray(json, "basis");
24131      for (int i = 0; i < array.size(); i++) {
24132        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
24133      }
24134    };
24135    if (json.has("prediction")) {
24136      JsonArray array = getJArray(json, "prediction");
24137      for (int i = 0; i < array.size(); i++) {
24138        res.getPrediction().add(parseRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject()));
24139      }
24140    };
24141    if (json.has("mitigation"))
24142      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
24143    if (json.has("_mitigation"))
24144      parseElementProperties(getJObject(json, "_mitigation"), res.getMitigationElement());
24145    if (json.has("note")) {
24146      JsonArray array = getJArray(json, "note");
24147      for (int i = 0; i < array.size(); i++) {
24148        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24149      }
24150    };
24151  }
24152
24153  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentPredictionComponent(JsonObject json) throws IOException, FHIRFormatError {
24154    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
24155    parseRiskAssessmentPredictionComponentProperties(json, res);
24156    return res;
24157  }
24158
24159  protected void parseRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
24160    parseBackboneElementProperties(json, res);
24161    if (json.has("outcome"))
24162      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
24163    DataType probability = parseType("probability", json);
24164    if (probability != null)
24165      res.setProbability(probability);
24166    if (json.has("qualitativeRisk"))
24167      res.setQualitativeRisk(parseCodeableConcept(getJObject(json, "qualitativeRisk")));
24168    if (json.has("relativeRisk"))
24169      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
24170    if (json.has("_relativeRisk"))
24171      parseElementProperties(getJObject(json, "_relativeRisk"), res.getRelativeRiskElement());
24172    DataType when = parseType("when", json);
24173    if (when != null)
24174      res.setWhen(when);
24175    if (json.has("rationale"))
24176      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
24177    if (json.has("_rationale"))
24178      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
24179  }
24180
24181  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
24182    Schedule res = new Schedule();
24183    parseScheduleProperties(json, res);
24184    return res;
24185  }
24186
24187  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
24188    parseDomainResourceProperties(json, res);
24189    if (json.has("identifier")) {
24190      JsonArray array = getJArray(json, "identifier");
24191      for (int i = 0; i < array.size(); i++) {
24192        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24193      }
24194    };
24195    if (json.has("active"))
24196      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
24197    if (json.has("_active"))
24198      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
24199    if (json.has("serviceCategory")) {
24200      JsonArray array = getJArray(json, "serviceCategory");
24201      for (int i = 0; i < array.size(); i++) {
24202        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24203      }
24204    };
24205    if (json.has("serviceType")) {
24206      JsonArray array = getJArray(json, "serviceType");
24207      for (int i = 0; i < array.size(); i++) {
24208        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24209      }
24210    };
24211    if (json.has("specialty")) {
24212      JsonArray array = getJArray(json, "specialty");
24213      for (int i = 0; i < array.size(); i++) {
24214        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24215      }
24216    };
24217    if (json.has("actor")) {
24218      JsonArray array = getJArray(json, "actor");
24219      for (int i = 0; i < array.size(); i++) {
24220        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
24221      }
24222    };
24223    if (json.has("planningHorizon"))
24224      res.setPlanningHorizon(parsePeriod(getJObject(json, "planningHorizon")));
24225    if (json.has("comment"))
24226      res.setCommentElement(parseString(json.get("comment").getAsString()));
24227    if (json.has("_comment"))
24228      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
24229  }
24230
24231  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
24232    SearchParameter res = new SearchParameter();
24233    parseSearchParameterProperties(json, res);
24234    return res;
24235  }
24236
24237  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
24238    parseDomainResourceProperties(json, res);
24239    if (json.has("url"))
24240      res.setUrlElement(parseUri(json.get("url").getAsString()));
24241    if (json.has("_url"))
24242      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24243    if (json.has("version"))
24244      res.setVersionElement(parseString(json.get("version").getAsString()));
24245    if (json.has("_version"))
24246      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
24247    if (json.has("name"))
24248      res.setNameElement(parseString(json.get("name").getAsString()));
24249    if (json.has("_name"))
24250      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24251    if (json.has("derivedFrom"))
24252      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
24253    if (json.has("_derivedFrom"))
24254      parseElementProperties(getJObject(json, "_derivedFrom"), res.getDerivedFromElement());
24255    if (json.has("status"))
24256      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24257    if (json.has("_status"))
24258      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24259    if (json.has("experimental"))
24260      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24261    if (json.has("_experimental"))
24262      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
24263    if (json.has("date"))
24264      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24265    if (json.has("_date"))
24266      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
24267    if (json.has("publisher"))
24268      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24269    if (json.has("_publisher"))
24270      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
24271    if (json.has("contact")) {
24272      JsonArray array = getJArray(json, "contact");
24273      for (int i = 0; i < array.size(); i++) {
24274        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24275      }
24276    };
24277    if (json.has("description"))
24278      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24279    if (json.has("_description"))
24280      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24281    if (json.has("useContext")) {
24282      JsonArray array = getJArray(json, "useContext");
24283      for (int i = 0; i < array.size(); i++) {
24284        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24285      }
24286    };
24287    if (json.has("jurisdiction")) {
24288      JsonArray array = getJArray(json, "jurisdiction");
24289      for (int i = 0; i < array.size(); i++) {
24290        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24291      }
24292    };
24293    if (json.has("purpose"))
24294      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24295    if (json.has("_purpose"))
24296      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
24297    if (json.has("code"))
24298      res.setCodeElement(parseCode(json.get("code").getAsString()));
24299    if (json.has("_code"))
24300      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
24301    if (json.has("base")) {
24302      JsonArray array = getJArray(json, "base");
24303      for (int i = 0; i < array.size(); i++) {
24304        if (array.get(i).isJsonNull()) {
24305          res.getBase().add(new CodeType());
24306        } else {;
24307          res.getBase().add(parseCode(array.get(i).getAsString()));
24308        }
24309      }
24310    };
24311    if (json.has("_base")) {
24312      JsonArray array = getJArray(json, "_base");
24313      for (int i = 0; i < array.size(); i++) {
24314        if (i == res.getBase().size())
24315          res.getBase().add(parseCode(null));
24316        if (array.get(i) instanceof JsonObject) 
24317          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
24318      }
24319    };
24320    if (json.has("type"))
24321      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
24322    if (json.has("_type"))
24323      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24324    if (json.has("expression"))
24325      res.setExpressionElement(parseString(json.get("expression").getAsString()));
24326    if (json.has("_expression"))
24327      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
24328    if (json.has("xpath"))
24329      res.setXpathElement(parseString(json.get("xpath").getAsString()));
24330    if (json.has("_xpath"))
24331      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
24332    if (json.has("xpathUsage"))
24333      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
24334    if (json.has("_xpathUsage"))
24335      parseElementProperties(getJObject(json, "_xpathUsage"), res.getXpathUsageElement());
24336    if (json.has("target")) {
24337      JsonArray array = getJArray(json, "target");
24338      for (int i = 0; i < array.size(); i++) {
24339        if (array.get(i).isJsonNull()) {
24340          res.getTarget().add(new CodeType());
24341        } else {;
24342          res.getTarget().add(parseCode(array.get(i).getAsString()));
24343        }
24344      }
24345    };
24346    if (json.has("_target")) {
24347      JsonArray array = getJArray(json, "_target");
24348      for (int i = 0; i < array.size(); i++) {
24349        if (i == res.getTarget().size())
24350          res.getTarget().add(parseCode(null));
24351        if (array.get(i) instanceof JsonObject) 
24352          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
24353      }
24354    };
24355    if (json.has("multipleOr"))
24356      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
24357    if (json.has("_multipleOr"))
24358      parseElementProperties(getJObject(json, "_multipleOr"), res.getMultipleOrElement());
24359    if (json.has("multipleAnd"))
24360      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
24361    if (json.has("_multipleAnd"))
24362      parseElementProperties(getJObject(json, "_multipleAnd"), res.getMultipleAndElement());
24363    if (json.has("comparator")) {
24364      JsonArray array = getJArray(json, "comparator");
24365      for (int i = 0; i < array.size(); i++) {
24366        if (array.get(i).isJsonNull()) {
24367          res.getComparator().add(new Enumeration<SearchParameter.SearchComparator>(new SearchParameter.SearchComparatorEnumFactory(), SearchParameter.SearchComparator.NULL));
24368        } else {;
24369          res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
24370        }
24371      }
24372    };
24373    if (json.has("_comparator")) {
24374      JsonArray array = getJArray(json, "_comparator");
24375      for (int i = 0; i < array.size(); i++) {
24376        if (i == res.getComparator().size())
24377          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
24378        if (array.get(i) instanceof JsonObject) 
24379          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
24380      }
24381    };
24382    if (json.has("modifier")) {
24383      JsonArray array = getJArray(json, "modifier");
24384      for (int i = 0; i < array.size(); i++) {
24385        if (array.get(i).isJsonNull()) {
24386          res.getModifier().add(new Enumeration<SearchParameter.SearchModifierCode>(new SearchParameter.SearchModifierCodeEnumFactory(), SearchParameter.SearchModifierCode.NULL));
24387        } else {;
24388          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
24389        }
24390      }
24391    };
24392    if (json.has("_modifier")) {
24393      JsonArray array = getJArray(json, "_modifier");
24394      for (int i = 0; i < array.size(); i++) {
24395        if (i == res.getModifier().size())
24396          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
24397        if (array.get(i) instanceof JsonObject) 
24398          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
24399      }
24400    };
24401    if (json.has("chain")) {
24402      JsonArray array = getJArray(json, "chain");
24403      for (int i = 0; i < array.size(); i++) {
24404        if (array.get(i).isJsonNull()) {
24405          res.getChain().add(new StringType());
24406        } else {;
24407          res.getChain().add(parseString(array.get(i).getAsString()));
24408        }
24409      }
24410    };
24411    if (json.has("_chain")) {
24412      JsonArray array = getJArray(json, "_chain");
24413      for (int i = 0; i < array.size(); i++) {
24414        if (i == res.getChain().size())
24415          res.getChain().add(parseString(null));
24416        if (array.get(i) instanceof JsonObject) 
24417          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
24418      }
24419    };
24420    if (json.has("component")) {
24421      JsonArray array = getJArray(json, "component");
24422      for (int i = 0; i < array.size(); i++) {
24423        res.getComponent().add(parseSearchParameterComponentComponent(array.get(i).getAsJsonObject()));
24424      }
24425    };
24426  }
24427
24428  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
24429    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
24430    parseSearchParameterComponentComponentProperties(json, res);
24431    return res;
24432  }
24433
24434  protected void parseSearchParameterComponentComponentProperties(JsonObject json, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
24435    parseBackboneElementProperties(json, res);
24436    if (json.has("definition"))
24437      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
24438    if (json.has("_definition"))
24439      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
24440    if (json.has("expression"))
24441      res.setExpressionElement(parseString(json.get("expression").getAsString()));
24442    if (json.has("_expression"))
24443      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
24444  }
24445
24446  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
24447    ServiceRequest res = new ServiceRequest();
24448    parseServiceRequestProperties(json, res);
24449    return res;
24450  }
24451
24452  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
24453    parseDomainResourceProperties(json, res);
24454    if (json.has("identifier")) {
24455      JsonArray array = getJArray(json, "identifier");
24456      for (int i = 0; i < array.size(); i++) {
24457        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24458      }
24459    };
24460    if (json.has("instantiatesCanonical")) {
24461      JsonArray array = getJArray(json, "instantiatesCanonical");
24462      for (int i = 0; i < array.size(); i++) {
24463        if (array.get(i).isJsonNull()) {
24464          res.getInstantiatesCanonical().add(new CanonicalType());
24465        } else {;
24466          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
24467        }
24468      }
24469    };
24470    if (json.has("_instantiatesCanonical")) {
24471      JsonArray array = getJArray(json, "_instantiatesCanonical");
24472      for (int i = 0; i < array.size(); i++) {
24473        if (i == res.getInstantiatesCanonical().size())
24474          res.getInstantiatesCanonical().add(parseCanonical(null));
24475        if (array.get(i) instanceof JsonObject) 
24476          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
24477      }
24478    };
24479    if (json.has("instantiatesUri")) {
24480      JsonArray array = getJArray(json, "instantiatesUri");
24481      for (int i = 0; i < array.size(); i++) {
24482        if (array.get(i).isJsonNull()) {
24483          res.getInstantiatesUri().add(new UriType());
24484        } else {;
24485          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
24486        }
24487      }
24488    };
24489    if (json.has("_instantiatesUri")) {
24490      JsonArray array = getJArray(json, "_instantiatesUri");
24491      for (int i = 0; i < array.size(); i++) {
24492        if (i == res.getInstantiatesUri().size())
24493          res.getInstantiatesUri().add(parseUri(null));
24494        if (array.get(i) instanceof JsonObject) 
24495          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
24496      }
24497    };
24498    if (json.has("basedOn")) {
24499      JsonArray array = getJArray(json, "basedOn");
24500      for (int i = 0; i < array.size(); i++) {
24501        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
24502      }
24503    };
24504    if (json.has("replaces")) {
24505      JsonArray array = getJArray(json, "replaces");
24506      for (int i = 0; i < array.size(); i++) {
24507        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
24508      }
24509    };
24510    if (json.has("requisition"))
24511      res.setRequisition(parseIdentifier(getJObject(json, "requisition")));
24512    if (json.has("status"))
24513      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
24514    if (json.has("_status"))
24515      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24516    if (json.has("intent"))
24517      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
24518    if (json.has("_intent"))
24519      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
24520    if (json.has("category")) {
24521      JsonArray array = getJArray(json, "category");
24522      for (int i = 0; i < array.size(); i++) {
24523        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24524      }
24525    };
24526    if (json.has("priority"))
24527      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
24528    if (json.has("_priority"))
24529      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
24530    if (json.has("doNotPerform"))
24531      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
24532    if (json.has("_doNotPerform"))
24533      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
24534    if (json.has("code"))
24535      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24536    if (json.has("orderDetail")) {
24537      JsonArray array = getJArray(json, "orderDetail");
24538      for (int i = 0; i < array.size(); i++) {
24539        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24540      }
24541    };
24542    DataType quantity = parseType("quantity", json);
24543    if (quantity != null)
24544      res.setQuantity(quantity);
24545    if (json.has("subject"))
24546      res.setSubject(parseReference(getJObject(json, "subject")));
24547    if (json.has("encounter"))
24548      res.setEncounter(parseReference(getJObject(json, "encounter")));
24549    DataType occurrence = parseType("occurrence", json);
24550    if (occurrence != null)
24551      res.setOccurrence(occurrence);
24552    DataType asNeeded = parseType("asNeeded", json);
24553    if (asNeeded != null)
24554      res.setAsNeeded(asNeeded);
24555    if (json.has("authoredOn"))
24556      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
24557    if (json.has("_authoredOn"))
24558      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
24559    if (json.has("requester"))
24560      res.setRequester(parseReference(getJObject(json, "requester")));
24561    if (json.has("performerType"))
24562      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
24563    if (json.has("performer")) {
24564      JsonArray array = getJArray(json, "performer");
24565      for (int i = 0; i < array.size(); i++) {
24566        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
24567      }
24568    };
24569    if (json.has("locationCode")) {
24570      JsonArray array = getJArray(json, "locationCode");
24571      for (int i = 0; i < array.size(); i++) {
24572        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24573      }
24574    };
24575    if (json.has("locationReference")) {
24576      JsonArray array = getJArray(json, "locationReference");
24577      for (int i = 0; i < array.size(); i++) {
24578        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
24579      }
24580    };
24581    if (json.has("reasonCode")) {
24582      JsonArray array = getJArray(json, "reasonCode");
24583      for (int i = 0; i < array.size(); i++) {
24584        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24585      }
24586    };
24587    if (json.has("reasonReference")) {
24588      JsonArray array = getJArray(json, "reasonReference");
24589      for (int i = 0; i < array.size(); i++) {
24590        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
24591      }
24592    };
24593    if (json.has("insurance")) {
24594      JsonArray array = getJArray(json, "insurance");
24595      for (int i = 0; i < array.size(); i++) {
24596        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
24597      }
24598    };
24599    if (json.has("supportingInfo")) {
24600      JsonArray array = getJArray(json, "supportingInfo");
24601      for (int i = 0; i < array.size(); i++) {
24602        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
24603      }
24604    };
24605    if (json.has("specimen")) {
24606      JsonArray array = getJArray(json, "specimen");
24607      for (int i = 0; i < array.size(); i++) {
24608        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
24609      }
24610    };
24611    if (json.has("bodySite")) {
24612      JsonArray array = getJArray(json, "bodySite");
24613      for (int i = 0; i < array.size(); i++) {
24614        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24615      }
24616    };
24617    if (json.has("note")) {
24618      JsonArray array = getJArray(json, "note");
24619      for (int i = 0; i < array.size(); i++) {
24620        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24621      }
24622    };
24623    if (json.has("patientInstruction"))
24624      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
24625    if (json.has("_patientInstruction"))
24626      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
24627    if (json.has("relevantHistory")) {
24628      JsonArray array = getJArray(json, "relevantHistory");
24629      for (int i = 0; i < array.size(); i++) {
24630        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
24631      }
24632    };
24633  }
24634
24635  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
24636    Slot res = new Slot();
24637    parseSlotProperties(json, res);
24638    return res;
24639  }
24640
24641  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
24642    parseDomainResourceProperties(json, res);
24643    if (json.has("identifier")) {
24644      JsonArray array = getJArray(json, "identifier");
24645      for (int i = 0; i < array.size(); i++) {
24646        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24647      }
24648    };
24649    if (json.has("serviceCategory")) {
24650      JsonArray array = getJArray(json, "serviceCategory");
24651      for (int i = 0; i < array.size(); i++) {
24652        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24653      }
24654    };
24655    if (json.has("serviceType")) {
24656      JsonArray array = getJArray(json, "serviceType");
24657      for (int i = 0; i < array.size(); i++) {
24658        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24659      }
24660    };
24661    if (json.has("specialty")) {
24662      JsonArray array = getJArray(json, "specialty");
24663      for (int i = 0; i < array.size(); i++) {
24664        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24665      }
24666    };
24667    if (json.has("appointmentType"))
24668      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
24669    if (json.has("schedule"))
24670      res.setSchedule(parseReference(getJObject(json, "schedule")));
24671    if (json.has("status"))
24672      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
24673    if (json.has("_status"))
24674      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24675    if (json.has("start"))
24676      res.setStartElement(parseInstant(json.get("start").getAsString()));
24677    if (json.has("_start"))
24678      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
24679    if (json.has("end"))
24680      res.setEndElement(parseInstant(json.get("end").getAsString()));
24681    if (json.has("_end"))
24682      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
24683    if (json.has("overbooked"))
24684      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
24685    if (json.has("_overbooked"))
24686      parseElementProperties(getJObject(json, "_overbooked"), res.getOverbookedElement());
24687    if (json.has("comment"))
24688      res.setCommentElement(parseString(json.get("comment").getAsString()));
24689    if (json.has("_comment"))
24690      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
24691  }
24692
24693  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
24694    Specimen res = new Specimen();
24695    parseSpecimenProperties(json, res);
24696    return res;
24697  }
24698
24699  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
24700    parseDomainResourceProperties(json, res);
24701    if (json.has("identifier")) {
24702      JsonArray array = getJArray(json, "identifier");
24703      for (int i = 0; i < array.size(); i++) {
24704        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24705      }
24706    };
24707    if (json.has("accessionIdentifier"))
24708      res.setAccessionIdentifier(parseIdentifier(getJObject(json, "accessionIdentifier")));
24709    if (json.has("status"))
24710      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
24711    if (json.has("_status"))
24712      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24713    if (json.has("type"))
24714      res.setType(parseCodeableConcept(getJObject(json, "type")));
24715    if (json.has("subject"))
24716      res.setSubject(parseReference(getJObject(json, "subject")));
24717    if (json.has("receivedTime"))
24718      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
24719    if (json.has("_receivedTime"))
24720      parseElementProperties(getJObject(json, "_receivedTime"), res.getReceivedTimeElement());
24721    if (json.has("parent")) {
24722      JsonArray array = getJArray(json, "parent");
24723      for (int i = 0; i < array.size(); i++) {
24724        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
24725      }
24726    };
24727    if (json.has("request")) {
24728      JsonArray array = getJArray(json, "request");
24729      for (int i = 0; i < array.size(); i++) {
24730        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
24731      }
24732    };
24733    if (json.has("collection"))
24734      res.setCollection(parseSpecimenCollectionComponent(getJObject(json, "collection")));
24735    if (json.has("processing")) {
24736      JsonArray array = getJArray(json, "processing");
24737      for (int i = 0; i < array.size(); i++) {
24738        res.getProcessing().add(parseSpecimenProcessingComponent(array.get(i).getAsJsonObject()));
24739      }
24740    };
24741    if (json.has("container")) {
24742      JsonArray array = getJArray(json, "container");
24743      for (int i = 0; i < array.size(); i++) {
24744        res.getContainer().add(parseSpecimenContainerComponent(array.get(i).getAsJsonObject()));
24745      }
24746    };
24747    if (json.has("condition")) {
24748      JsonArray array = getJArray(json, "condition");
24749      for (int i = 0; i < array.size(); i++) {
24750        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24751      }
24752    };
24753    if (json.has("note")) {
24754      JsonArray array = getJArray(json, "note");
24755      for (int i = 0; i < array.size(); i++) {
24756        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24757      }
24758    };
24759  }
24760
24761  protected Specimen.SpecimenCollectionComponent parseSpecimenCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
24762    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
24763    parseSpecimenCollectionComponentProperties(json, res);
24764    return res;
24765  }
24766
24767  protected void parseSpecimenCollectionComponentProperties(JsonObject json, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
24768    parseBackboneElementProperties(json, res);
24769    if (json.has("collector"))
24770      res.setCollector(parseReference(getJObject(json, "collector")));
24771    DataType collected = parseType("collected", json);
24772    if (collected != null)
24773      res.setCollected(collected);
24774    if (json.has("duration"))
24775      res.setDuration(parseDuration(getJObject(json, "duration")));
24776    if (json.has("quantity"))
24777      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
24778    if (json.has("method"))
24779      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
24780    if (json.has("bodySite"))
24781      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
24782    DataType fastingStatus = parseType("fastingStatus", json);
24783    if (fastingStatus != null)
24784      res.setFastingStatus(fastingStatus);
24785  }
24786
24787  protected Specimen.SpecimenProcessingComponent parseSpecimenProcessingComponent(JsonObject json) throws IOException, FHIRFormatError {
24788    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
24789    parseSpecimenProcessingComponentProperties(json, res);
24790    return res;
24791  }
24792
24793  protected void parseSpecimenProcessingComponentProperties(JsonObject json, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
24794    parseBackboneElementProperties(json, res);
24795    if (json.has("description"))
24796      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24797    if (json.has("_description"))
24798      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24799    if (json.has("procedure"))
24800      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
24801    if (json.has("additive")) {
24802      JsonArray array = getJArray(json, "additive");
24803      for (int i = 0; i < array.size(); i++) {
24804        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
24805      }
24806    };
24807    DataType time = parseType("time", json);
24808    if (time != null)
24809      res.setTime(time);
24810  }
24811
24812  protected Specimen.SpecimenContainerComponent parseSpecimenContainerComponent(JsonObject json) throws IOException, FHIRFormatError {
24813    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
24814    parseSpecimenContainerComponentProperties(json, res);
24815    return res;
24816  }
24817
24818  protected void parseSpecimenContainerComponentProperties(JsonObject json, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
24819    parseBackboneElementProperties(json, res);
24820    if (json.has("identifier")) {
24821      JsonArray array = getJArray(json, "identifier");
24822      for (int i = 0; i < array.size(); i++) {
24823        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24824      }
24825    };
24826    if (json.has("description"))
24827      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24828    if (json.has("_description"))
24829      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24830    if (json.has("type"))
24831      res.setType(parseCodeableConcept(getJObject(json, "type")));
24832    if (json.has("capacity"))
24833      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
24834    if (json.has("specimenQuantity"))
24835      res.setSpecimenQuantity(parseQuantity(getJObject(json, "specimenQuantity")));
24836    DataType additive = parseType("additive", json);
24837    if (additive != null)
24838      res.setAdditive(additive);
24839  }
24840
24841  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
24842    SpecimenDefinition res = new SpecimenDefinition();
24843    parseSpecimenDefinitionProperties(json, res);
24844    return res;
24845  }
24846
24847  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
24848    parseDomainResourceProperties(json, res);
24849    if (json.has("identifier"))
24850      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24851    if (json.has("typeCollected"))
24852      res.setTypeCollected(parseCodeableConcept(getJObject(json, "typeCollected")));
24853    if (json.has("patientPreparation")) {
24854      JsonArray array = getJArray(json, "patientPreparation");
24855      for (int i = 0; i < array.size(); i++) {
24856        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24857      }
24858    };
24859    if (json.has("timeAspect"))
24860      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
24861    if (json.has("_timeAspect"))
24862      parseElementProperties(getJObject(json, "_timeAspect"), res.getTimeAspectElement());
24863    if (json.has("collection")) {
24864      JsonArray array = getJArray(json, "collection");
24865      for (int i = 0; i < array.size(); i++) {
24866        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24867      }
24868    };
24869    if (json.has("typeTested")) {
24870      JsonArray array = getJArray(json, "typeTested");
24871      for (int i = 0; i < array.size(); i++) {
24872        res.getTypeTested().add(parseSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject()));
24873      }
24874    };
24875  }
24876
24877  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionTypeTestedComponent(JsonObject json) throws IOException, FHIRFormatError {
24878    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
24879    parseSpecimenDefinitionTypeTestedComponentProperties(json, res);
24880    return res;
24881  }
24882
24883  protected void parseSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
24884    parseBackboneElementProperties(json, res);
24885    if (json.has("isDerived"))
24886      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
24887    if (json.has("_isDerived"))
24888      parseElementProperties(getJObject(json, "_isDerived"), res.getIsDerivedElement());
24889    if (json.has("type"))
24890      res.setType(parseCodeableConcept(getJObject(json, "type")));
24891    if (json.has("preference"))
24892      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
24893    if (json.has("_preference"))
24894      parseElementProperties(getJObject(json, "_preference"), res.getPreferenceElement());
24895    if (json.has("container"))
24896      res.setContainer(parseSpecimenDefinitionTypeTestedContainerComponent(getJObject(json, "container")));
24897    if (json.has("requirement"))
24898      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
24899    if (json.has("_requirement"))
24900      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
24901    if (json.has("retentionTime"))
24902      res.setRetentionTime(parseDuration(getJObject(json, "retentionTime")));
24903    if (json.has("rejectionCriterion")) {
24904      JsonArray array = getJArray(json, "rejectionCriterion");
24905      for (int i = 0; i < array.size(); i++) {
24906        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24907      }
24908    };
24909    if (json.has("handling")) {
24910      JsonArray array = getJArray(json, "handling");
24911      for (int i = 0; i < array.size(); i++) {
24912        res.getHandling().add(parseSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject()));
24913      }
24914    };
24915  }
24916
24917  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionTypeTestedContainerComponent(JsonObject json) throws IOException, FHIRFormatError {
24918    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
24919    parseSpecimenDefinitionTypeTestedContainerComponentProperties(json, res);
24920    return res;
24921  }
24922
24923  protected void parseSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
24924    parseBackboneElementProperties(json, res);
24925    if (json.has("material"))
24926      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
24927    if (json.has("type"))
24928      res.setType(parseCodeableConcept(getJObject(json, "type")));
24929    if (json.has("cap"))
24930      res.setCap(parseCodeableConcept(getJObject(json, "cap")));
24931    if (json.has("description"))
24932      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24933    if (json.has("_description"))
24934      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24935    if (json.has("capacity"))
24936      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
24937    DataType minimumVolume = parseType("minimumVolume", json);
24938    if (minimumVolume != null)
24939      res.setMinimumVolume(minimumVolume);
24940    if (json.has("additive")) {
24941      JsonArray array = getJArray(json, "additive");
24942      for (int i = 0; i < array.size(); i++) {
24943        res.getAdditive().add(parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject()));
24944      }
24945    };
24946    if (json.has("preparation"))
24947      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
24948    if (json.has("_preparation"))
24949      parseElementProperties(getJObject(json, "_preparation"), res.getPreparationElement());
24950  }
24951
24952  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json) throws IOException, FHIRFormatError {
24953    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
24954    parseSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, res);
24955    return res;
24956  }
24957
24958  protected void parseSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
24959    parseBackboneElementProperties(json, res);
24960    DataType additive = parseType("additive", json);
24961    if (additive != null)
24962      res.setAdditive(additive);
24963  }
24964
24965  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json) throws IOException, FHIRFormatError {
24966    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
24967    parseSpecimenDefinitionTypeTestedHandlingComponentProperties(json, res);
24968    return res;
24969  }
24970
24971  protected void parseSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
24972    parseBackboneElementProperties(json, res);
24973    if (json.has("temperatureQualifier"))
24974      res.setTemperatureQualifier(parseCodeableConcept(getJObject(json, "temperatureQualifier")));
24975    if (json.has("temperatureRange"))
24976      res.setTemperatureRange(parseRange(getJObject(json, "temperatureRange")));
24977    if (json.has("maxDuration"))
24978      res.setMaxDuration(parseDuration(getJObject(json, "maxDuration")));
24979    if (json.has("instruction"))
24980      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
24981    if (json.has("_instruction"))
24982      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
24983  }
24984
24985  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
24986    StructureDefinition res = new StructureDefinition();
24987    parseStructureDefinitionProperties(json, res);
24988    return res;
24989  }
24990
24991  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
24992    parseDomainResourceProperties(json, res);
24993    if (json.has("url"))
24994      res.setUrlElement(parseUri(json.get("url").getAsString()));
24995    if (json.has("_url"))
24996      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24997    if (json.has("identifier")) {
24998      JsonArray array = getJArray(json, "identifier");
24999      for (int i = 0; i < array.size(); i++) {
25000        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25001      }
25002    };
25003    if (json.has("version"))
25004      res.setVersionElement(parseString(json.get("version").getAsString()));
25005    if (json.has("_version"))
25006      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
25007    if (json.has("name"))
25008      res.setNameElement(parseString(json.get("name").getAsString()));
25009    if (json.has("_name"))
25010      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25011    if (json.has("title"))
25012      res.setTitleElement(parseString(json.get("title").getAsString()));
25013    if (json.has("_title"))
25014      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25015    if (json.has("status"))
25016      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
25017    if (json.has("_status"))
25018      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25019    if (json.has("experimental"))
25020      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25021    if (json.has("_experimental"))
25022      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
25023    if (json.has("date"))
25024      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25025    if (json.has("_date"))
25026      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25027    if (json.has("publisher"))
25028      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25029    if (json.has("_publisher"))
25030      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
25031    if (json.has("contact")) {
25032      JsonArray array = getJArray(json, "contact");
25033      for (int i = 0; i < array.size(); i++) {
25034        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25035      }
25036    };
25037    if (json.has("description"))
25038      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25039    if (json.has("_description"))
25040      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25041    if (json.has("useContext")) {
25042      JsonArray array = getJArray(json, "useContext");
25043      for (int i = 0; i < array.size(); i++) {
25044        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25045      }
25046    };
25047    if (json.has("jurisdiction")) {
25048      JsonArray array = getJArray(json, "jurisdiction");
25049      for (int i = 0; i < array.size(); i++) {
25050        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25051      }
25052    };
25053    if (json.has("purpose"))
25054      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25055    if (json.has("_purpose"))
25056      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
25057    if (json.has("copyright"))
25058      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25059    if (json.has("_copyright"))
25060      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
25061    if (json.has("keyword")) {
25062      JsonArray array = getJArray(json, "keyword");
25063      for (int i = 0; i < array.size(); i++) {
25064        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
25065      }
25066    };
25067    if (json.has("fhirVersion"))
25068      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
25069    if (json.has("_fhirVersion"))
25070      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
25071    if (json.has("mapping")) {
25072      JsonArray array = getJArray(json, "mapping");
25073      for (int i = 0; i < array.size(); i++) {
25074        res.getMapping().add(parseStructureDefinitionMappingComponent(array.get(i).getAsJsonObject()));
25075      }
25076    };
25077    if (json.has("kind"))
25078      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
25079    if (json.has("_kind"))
25080      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
25081    if (json.has("abstract"))
25082      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
25083    if (json.has("_abstract"))
25084      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
25085    if (json.has("context")) {
25086      JsonArray array = getJArray(json, "context");
25087      for (int i = 0; i < array.size(); i++) {
25088        res.getContext().add(parseStructureDefinitionContextComponent(array.get(i).getAsJsonObject()));
25089      }
25090    };
25091    if (json.has("contextInvariant")) {
25092      JsonArray array = getJArray(json, "contextInvariant");
25093      for (int i = 0; i < array.size(); i++) {
25094        if (array.get(i).isJsonNull()) {
25095          res.getContextInvariant().add(new StringType());
25096        } else {;
25097          res.getContextInvariant().add(parseString(array.get(i).getAsString()));
25098        }
25099      }
25100    };
25101    if (json.has("_contextInvariant")) {
25102      JsonArray array = getJArray(json, "_contextInvariant");
25103      for (int i = 0; i < array.size(); i++) {
25104        if (i == res.getContextInvariant().size())
25105          res.getContextInvariant().add(parseString(null));
25106        if (array.get(i) instanceof JsonObject) 
25107          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
25108      }
25109    };
25110    if (json.has("type"))
25111      res.setTypeElement(parseUri(json.get("type").getAsString()));
25112    if (json.has("_type"))
25113      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25114    if (json.has("baseDefinition"))
25115      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
25116    if (json.has("_baseDefinition"))
25117      parseElementProperties(getJObject(json, "_baseDefinition"), res.getBaseDefinitionElement());
25118    if (json.has("derivation"))
25119      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
25120    if (json.has("_derivation"))
25121      parseElementProperties(getJObject(json, "_derivation"), res.getDerivationElement());
25122    if (json.has("snapshot"))
25123      res.setSnapshot(parseStructureDefinitionSnapshotComponent(getJObject(json, "snapshot")));
25124    if (json.has("differential"))
25125      res.setDifferential(parseStructureDefinitionDifferentialComponent(getJObject(json, "differential")));
25126  }
25127
25128  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
25129    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
25130    parseStructureDefinitionMappingComponentProperties(json, res);
25131    return res;
25132  }
25133
25134  protected void parseStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
25135    parseBackboneElementProperties(json, res);
25136    if (json.has("identity"))
25137      res.setIdentityElement(parseId(json.get("identity").getAsString()));
25138    if (json.has("_identity"))
25139      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
25140    if (json.has("uri"))
25141      res.setUriElement(parseUri(json.get("uri").getAsString()));
25142    if (json.has("_uri"))
25143      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
25144    if (json.has("name"))
25145      res.setNameElement(parseString(json.get("name").getAsString()));
25146    if (json.has("_name"))
25147      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25148    if (json.has("comment"))
25149      res.setCommentElement(parseString(json.get("comment").getAsString()));
25150    if (json.has("_comment"))
25151      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
25152  }
25153
25154  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionContextComponent(JsonObject json) throws IOException, FHIRFormatError {
25155    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
25156    parseStructureDefinitionContextComponentProperties(json, res);
25157    return res;
25158  }
25159
25160  protected void parseStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
25161    parseBackboneElementProperties(json, res);
25162    if (json.has("type"))
25163      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
25164    if (json.has("_type"))
25165      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25166    if (json.has("expression"))
25167      res.setExpressionElement(parseString(json.get("expression").getAsString()));
25168    if (json.has("_expression"))
25169      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
25170  }
25171
25172  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionSnapshotComponent(JsonObject json) throws IOException, FHIRFormatError {
25173    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
25174    parseStructureDefinitionSnapshotComponentProperties(json, res);
25175    return res;
25176  }
25177
25178  protected void parseStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
25179    parseBackboneElementProperties(json, res);
25180    if (json.has("element")) {
25181      JsonArray array = getJArray(json, "element");
25182      for (int i = 0; i < array.size(); i++) {
25183        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
25184      }
25185    };
25186  }
25187
25188  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionDifferentialComponent(JsonObject json) throws IOException, FHIRFormatError {
25189    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
25190    parseStructureDefinitionDifferentialComponentProperties(json, res);
25191    return res;
25192  }
25193
25194  protected void parseStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
25195    parseBackboneElementProperties(json, res);
25196    if (json.has("element")) {
25197      JsonArray array = getJArray(json, "element");
25198      for (int i = 0; i < array.size(); i++) {
25199        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
25200      }
25201    };
25202  }
25203
25204  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
25205    StructureMap res = new StructureMap();
25206    parseStructureMapProperties(json, res);
25207    return res;
25208  }
25209
25210  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
25211    parseDomainResourceProperties(json, res);
25212    if (json.has("url"))
25213      res.setUrlElement(parseUri(json.get("url").getAsString()));
25214    if (json.has("_url"))
25215      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
25216    if (json.has("identifier")) {
25217      JsonArray array = getJArray(json, "identifier");
25218      for (int i = 0; i < array.size(); i++) {
25219        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25220      }
25221    };
25222    if (json.has("version"))
25223      res.setVersionElement(parseString(json.get("version").getAsString()));
25224    if (json.has("_version"))
25225      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
25226    if (json.has("name"))
25227      res.setNameElement(parseString(json.get("name").getAsString()));
25228    if (json.has("_name"))
25229      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25230    if (json.has("title"))
25231      res.setTitleElement(parseString(json.get("title").getAsString()));
25232    if (json.has("_title"))
25233      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25234    if (json.has("status"))
25235      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
25236    if (json.has("_status"))
25237      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25238    if (json.has("experimental"))
25239      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25240    if (json.has("_experimental"))
25241      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
25242    if (json.has("date"))
25243      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25244    if (json.has("_date"))
25245      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25246    if (json.has("publisher"))
25247      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25248    if (json.has("_publisher"))
25249      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
25250    if (json.has("contact")) {
25251      JsonArray array = getJArray(json, "contact");
25252      for (int i = 0; i < array.size(); i++) {
25253        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25254      }
25255    };
25256    if (json.has("description"))
25257      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25258    if (json.has("_description"))
25259      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25260    if (json.has("useContext")) {
25261      JsonArray array = getJArray(json, "useContext");
25262      for (int i = 0; i < array.size(); i++) {
25263        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25264      }
25265    };
25266    if (json.has("jurisdiction")) {
25267      JsonArray array = getJArray(json, "jurisdiction");
25268      for (int i = 0; i < array.size(); i++) {
25269        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25270      }
25271    };
25272    if (json.has("purpose"))
25273      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25274    if (json.has("_purpose"))
25275      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
25276    if (json.has("copyright"))
25277      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25278    if (json.has("_copyright"))
25279      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
25280    if (json.has("structure")) {
25281      JsonArray array = getJArray(json, "structure");
25282      for (int i = 0; i < array.size(); i++) {
25283        res.getStructure().add(parseStructureMapStructureComponent(array.get(i).getAsJsonObject()));
25284      }
25285    };
25286    if (json.has("import")) {
25287      JsonArray array = getJArray(json, "import");
25288      for (int i = 0; i < array.size(); i++) {
25289        if (array.get(i).isJsonNull()) {
25290          res.getImport().add(new CanonicalType());
25291        } else {;
25292          res.getImport().add(parseCanonical(array.get(i).getAsString()));
25293        }
25294      }
25295    };
25296    if (json.has("_import")) {
25297      JsonArray array = getJArray(json, "_import");
25298      for (int i = 0; i < array.size(); i++) {
25299        if (i == res.getImport().size())
25300          res.getImport().add(parseCanonical(null));
25301        if (array.get(i) instanceof JsonObject) 
25302          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
25303      }
25304    };
25305    if (json.has("group")) {
25306      JsonArray array = getJArray(json, "group");
25307      for (int i = 0; i < array.size(); i++) {
25308        res.getGroup().add(parseStructureMapGroupComponent(array.get(i).getAsJsonObject()));
25309      }
25310    };
25311  }
25312
25313  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
25314    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
25315    parseStructureMapStructureComponentProperties(json, res);
25316    return res;
25317  }
25318
25319  protected void parseStructureMapStructureComponentProperties(JsonObject json, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
25320    parseBackboneElementProperties(json, res);
25321    if (json.has("url"))
25322      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
25323    if (json.has("_url"))
25324      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
25325    if (json.has("mode"))
25326      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
25327    if (json.has("_mode"))
25328      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
25329    if (json.has("alias"))
25330      res.setAliasElement(parseString(json.get("alias").getAsString()));
25331    if (json.has("_alias"))
25332      parseElementProperties(getJObject(json, "_alias"), res.getAliasElement());
25333    if (json.has("documentation"))
25334      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25335    if (json.has("_documentation"))
25336      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
25337  }
25338
25339  protected StructureMap.StructureMapGroupComponent parseStructureMapGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
25340    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
25341    parseStructureMapGroupComponentProperties(json, res);
25342    return res;
25343  }
25344
25345  protected void parseStructureMapGroupComponentProperties(JsonObject json, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
25346    parseBackboneElementProperties(json, res);
25347    if (json.has("name"))
25348      res.setNameElement(parseId(json.get("name").getAsString()));
25349    if (json.has("_name"))
25350      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25351    if (json.has("extends"))
25352      res.setExtendsElement(parseId(json.get("extends").getAsString()));
25353    if (json.has("_extends"))
25354      parseElementProperties(getJObject(json, "_extends"), res.getExtendsElement());
25355    if (json.has("typeMode"))
25356      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
25357    if (json.has("_typeMode"))
25358      parseElementProperties(getJObject(json, "_typeMode"), res.getTypeModeElement());
25359    if (json.has("documentation"))
25360      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25361    if (json.has("_documentation"))
25362      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
25363    if (json.has("input")) {
25364      JsonArray array = getJArray(json, "input");
25365      for (int i = 0; i < array.size(); i++) {
25366        res.getInput().add(parseStructureMapGroupInputComponent(array.get(i).getAsJsonObject()));
25367      }
25368    };
25369    if (json.has("rule")) {
25370      JsonArray array = getJArray(json, "rule");
25371      for (int i = 0; i < array.size(); i++) {
25372        res.getRule().add(parseStructureMapGroupRuleComponent(array.get(i).getAsJsonObject()));
25373      }
25374    };
25375  }
25376
25377  protected StructureMap.StructureMapGroupInputComponent parseStructureMapGroupInputComponent(JsonObject json) throws IOException, FHIRFormatError {
25378    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
25379    parseStructureMapGroupInputComponentProperties(json, res);
25380    return res;
25381  }
25382
25383  protected void parseStructureMapGroupInputComponentProperties(JsonObject json, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
25384    parseBackboneElementProperties(json, res);
25385    if (json.has("name"))
25386      res.setNameElement(parseId(json.get("name").getAsString()));
25387    if (json.has("_name"))
25388      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25389    if (json.has("type"))
25390      res.setTypeElement(parseString(json.get("type").getAsString()));
25391    if (json.has("_type"))
25392      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25393    if (json.has("mode"))
25394      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
25395    if (json.has("_mode"))
25396      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
25397    if (json.has("documentation"))
25398      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25399    if (json.has("_documentation"))
25400      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
25401  }
25402
25403  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapGroupRuleComponent(JsonObject json) throws IOException, FHIRFormatError {
25404    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
25405    parseStructureMapGroupRuleComponentProperties(json, res);
25406    return res;
25407  }
25408
25409  protected void parseStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
25410    parseBackboneElementProperties(json, res);
25411    if (json.has("name"))
25412      res.setNameElement(parseId(json.get("name").getAsString()));
25413    if (json.has("_name"))
25414      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25415    if (json.has("source")) {
25416      JsonArray array = getJArray(json, "source");
25417      for (int i = 0; i < array.size(); i++) {
25418        res.getSource().add(parseStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject()));
25419      }
25420    };
25421    if (json.has("target")) {
25422      JsonArray array = getJArray(json, "target");
25423      for (int i = 0; i < array.size(); i++) {
25424        res.getTarget().add(parseStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject()));
25425      }
25426    };
25427    if (json.has("rule")) {
25428      JsonArray array = getJArray(json, "rule");
25429      for (int i = 0; i < array.size(); i++) {
25430        res.getRule().add(parseStructureMapGroupRuleComponent(array.get(i).getAsJsonObject()));
25431      }
25432    };
25433    if (json.has("dependent")) {
25434      JsonArray array = getJArray(json, "dependent");
25435      for (int i = 0; i < array.size(); i++) {
25436        res.getDependent().add(parseStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject()));
25437      }
25438    };
25439    if (json.has("documentation"))
25440      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25441    if (json.has("_documentation"))
25442      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
25443  }
25444
25445  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapGroupRuleSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
25446    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
25447    parseStructureMapGroupRuleSourceComponentProperties(json, res);
25448    return res;
25449  }
25450
25451  protected void parseStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
25452    parseBackboneElementProperties(json, res);
25453    if (json.has("context"))
25454      res.setContextElement(parseId(json.get("context").getAsString()));
25455    if (json.has("_context"))
25456      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
25457    if (json.has("min"))
25458      res.setMinElement(parseInteger(json.get("min").getAsLong()));
25459    if (json.has("_min"))
25460      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
25461    if (json.has("max"))
25462      res.setMaxElement(parseString(json.get("max").getAsString()));
25463    if (json.has("_max"))
25464      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
25465    if (json.has("type"))
25466      res.setTypeElement(parseString(json.get("type").getAsString()));
25467    if (json.has("_type"))
25468      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25469    DataType defaultValue = parseType("defaultValue", json);
25470    if (defaultValue != null)
25471      res.setDefaultValue(defaultValue);
25472    if (json.has("element"))
25473      res.setElementElement(parseString(json.get("element").getAsString()));
25474    if (json.has("_element"))
25475      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
25476    if (json.has("listMode"))
25477      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
25478    if (json.has("_listMode"))
25479      parseElementProperties(getJObject(json, "_listMode"), res.getListModeElement());
25480    if (json.has("variable"))
25481      res.setVariableElement(parseId(json.get("variable").getAsString()));
25482    if (json.has("_variable"))
25483      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
25484    if (json.has("condition"))
25485      res.setConditionElement(parseString(json.get("condition").getAsString()));
25486    if (json.has("_condition"))
25487      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
25488    if (json.has("check"))
25489      res.setCheckElement(parseString(json.get("check").getAsString()));
25490    if (json.has("_check"))
25491      parseElementProperties(getJObject(json, "_check"), res.getCheckElement());
25492    if (json.has("logMessage"))
25493      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
25494    if (json.has("_logMessage"))
25495      parseElementProperties(getJObject(json, "_logMessage"), res.getLogMessageElement());
25496  }
25497
25498  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapGroupRuleTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
25499    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
25500    parseStructureMapGroupRuleTargetComponentProperties(json, res);
25501    return res;
25502  }
25503
25504  protected void parseStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
25505    parseBackboneElementProperties(json, res);
25506    if (json.has("context"))
25507      res.setContextElement(parseId(json.get("context").getAsString()));
25508    if (json.has("_context"))
25509      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
25510    if (json.has("contextType"))
25511      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
25512    if (json.has("_contextType"))
25513      parseElementProperties(getJObject(json, "_contextType"), res.getContextTypeElement());
25514    if (json.has("element"))
25515      res.setElementElement(parseString(json.get("element").getAsString()));
25516    if (json.has("_element"))
25517      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
25518    if (json.has("variable"))
25519      res.setVariableElement(parseId(json.get("variable").getAsString()));
25520    if (json.has("_variable"))
25521      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
25522    if (json.has("listMode")) {
25523      JsonArray array = getJArray(json, "listMode");
25524      for (int i = 0; i < array.size(); i++) {
25525        if (array.get(i).isJsonNull()) {
25526          res.getListMode().add(new Enumeration<StructureMap.StructureMapTargetListMode>(new StructureMap.StructureMapTargetListModeEnumFactory(), StructureMap.StructureMapTargetListMode.NULL));
25527        } else {;
25528          res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
25529        }
25530      }
25531    };
25532    if (json.has("_listMode")) {
25533      JsonArray array = getJArray(json, "_listMode");
25534      for (int i = 0; i < array.size(); i++) {
25535        if (i == res.getListMode().size())
25536          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
25537        if (array.get(i) instanceof JsonObject) 
25538          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
25539      }
25540    };
25541    if (json.has("listRuleId"))
25542      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
25543    if (json.has("_listRuleId"))
25544      parseElementProperties(getJObject(json, "_listRuleId"), res.getListRuleIdElement());
25545    if (json.has("transform"))
25546      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
25547    if (json.has("_transform"))
25548      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
25549    if (json.has("parameter")) {
25550      JsonArray array = getJArray(json, "parameter");
25551      for (int i = 0; i < array.size(); i++) {
25552        res.getParameter().add(parseStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject()));
25553      }
25554    };
25555  }
25556
25557  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapGroupRuleTargetParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
25558    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
25559    parseStructureMapGroupRuleTargetParameterComponentProperties(json, res);
25560    return res;
25561  }
25562
25563  protected void parseStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
25564    parseBackboneElementProperties(json, res);
25565    DataType value = parseType("value", json);
25566    if (value != null)
25567      res.setValue(value);
25568  }
25569
25570  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapGroupRuleDependentComponent(JsonObject json) throws IOException, FHIRFormatError {
25571    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
25572    parseStructureMapGroupRuleDependentComponentProperties(json, res);
25573    return res;
25574  }
25575
25576  protected void parseStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
25577    parseBackboneElementProperties(json, res);
25578    if (json.has("name"))
25579      res.setNameElement(parseId(json.get("name").getAsString()));
25580    if (json.has("_name"))
25581      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25582    if (json.has("variable")) {
25583      JsonArray array = getJArray(json, "variable");
25584      for (int i = 0; i < array.size(); i++) {
25585        if (array.get(i).isJsonNull()) {
25586          res.getVariable().add(new StringType());
25587        } else {;
25588          res.getVariable().add(parseString(array.get(i).getAsString()));
25589        }
25590      }
25591    };
25592    if (json.has("_variable")) {
25593      JsonArray array = getJArray(json, "_variable");
25594      for (int i = 0; i < array.size(); i++) {
25595        if (i == res.getVariable().size())
25596          res.getVariable().add(parseString(null));
25597        if (array.get(i) instanceof JsonObject) 
25598          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
25599      }
25600    };
25601  }
25602
25603  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
25604    Subscription res = new Subscription();
25605    parseSubscriptionProperties(json, res);
25606    return res;
25607  }
25608
25609  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
25610    parseDomainResourceProperties(json, res);
25611    if (json.has("status"))
25612      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.SubscriptionStatus.NULL, new Enumerations.SubscriptionStatusEnumFactory()));
25613    if (json.has("_status"))
25614      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25615    if (json.has("contact")) {
25616      JsonArray array = getJArray(json, "contact");
25617      for (int i = 0; i < array.size(); i++) {
25618        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
25619      }
25620    };
25621    if (json.has("end"))
25622      res.setEndElement(parseInstant(json.get("end").getAsString()));
25623    if (json.has("_end"))
25624      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
25625    if (json.has("reason"))
25626      res.setReasonElement(parseString(json.get("reason").getAsString()));
25627    if (json.has("_reason"))
25628      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
25629    if (json.has("criteria"))
25630      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
25631    if (json.has("_criteria"))
25632      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
25633    if (json.has("error"))
25634      res.setErrorElement(parseString(json.get("error").getAsString()));
25635    if (json.has("_error"))
25636      parseElementProperties(getJObject(json, "_error"), res.getErrorElement());
25637    if (json.has("channel"))
25638      res.setChannel(parseSubscriptionChannelComponent(getJObject(json, "channel")));
25639  }
25640
25641  protected Subscription.SubscriptionChannelComponent parseSubscriptionChannelComponent(JsonObject json) throws IOException, FHIRFormatError {
25642    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
25643    parseSubscriptionChannelComponentProperties(json, res);
25644    return res;
25645  }
25646
25647  protected void parseSubscriptionChannelComponentProperties(JsonObject json, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
25648    parseBackboneElementProperties(json, res);
25649    if (json.has("type"))
25650      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
25651    if (json.has("_type"))
25652      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25653    if (json.has("endpoint"))
25654      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
25655    if (json.has("_endpoint"))
25656      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
25657    if (json.has("payload"))
25658      res.setPayloadElement(parseCode(json.get("payload").getAsString()));
25659    if (json.has("_payload"))
25660      parseElementProperties(getJObject(json, "_payload"), res.getPayloadElement());
25661    if (json.has("header")) {
25662      JsonArray array = getJArray(json, "header");
25663      for (int i = 0; i < array.size(); i++) {
25664        if (array.get(i).isJsonNull()) {
25665          res.getHeader().add(new StringType());
25666        } else {;
25667          res.getHeader().add(parseString(array.get(i).getAsString()));
25668        }
25669      }
25670    };
25671    if (json.has("_header")) {
25672      JsonArray array = getJArray(json, "_header");
25673      for (int i = 0; i < array.size(); i++) {
25674        if (i == res.getHeader().size())
25675          res.getHeader().add(parseString(null));
25676        if (array.get(i) instanceof JsonObject) 
25677          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
25678      }
25679    };
25680  }
25681
25682  protected SubscriptionStatus parseSubscriptionStatus(JsonObject json) throws IOException, FHIRFormatError {
25683    SubscriptionStatus res = new SubscriptionStatus();
25684    parseSubscriptionStatusProperties(json, res);
25685    return res;
25686  }
25687
25688  protected void parseSubscriptionStatusProperties(JsonObject json, SubscriptionStatus res) throws IOException, FHIRFormatError {
25689    parseDomainResourceProperties(json, res);
25690    if (json.has("status"))
25691      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.SubscriptionStatus.NULL, new Enumerations.SubscriptionStatusEnumFactory()));
25692    if (json.has("_status"))
25693      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25694    if (json.has("type"))
25695      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), SubscriptionStatus.SubscriptionNotificationType.NULL, new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory()));
25696    if (json.has("_type"))
25697      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25698    if (json.has("eventsSinceSubscriptionStart"))
25699      res.setEventsSinceSubscriptionStartElement(parseString(json.get("eventsSinceSubscriptionStart").getAsString()));
25700    if (json.has("_eventsSinceSubscriptionStart"))
25701      parseElementProperties(getJObject(json, "_eventsSinceSubscriptionStart"), res.getEventsSinceSubscriptionStartElement());
25702    if (json.has("eventsInNotification"))
25703      res.setEventsInNotificationElement(parseInteger(json.get("eventsInNotification").getAsLong()));
25704    if (json.has("_eventsInNotification"))
25705      parseElementProperties(getJObject(json, "_eventsInNotification"), res.getEventsInNotificationElement());
25706    if (json.has("notificationEvent")) {
25707      JsonArray array = getJArray(json, "notificationEvent");
25708      for (int i = 0; i < array.size(); i++) {
25709        res.getNotificationEvent().add(parseSubscriptionStatusNotificationEventComponent(array.get(i).getAsJsonObject()));
25710      }
25711    };
25712    if (json.has("subscription"))
25713      res.setSubscription(parseReference(getJObject(json, "subscription")));
25714    if (json.has("topic"))
25715      res.setTopicElement(parseCanonical(json.get("topic").getAsString()));
25716    if (json.has("_topic"))
25717      parseElementProperties(getJObject(json, "_topic"), res.getTopicElement());
25718    if (json.has("error")) {
25719      JsonArray array = getJArray(json, "error");
25720      for (int i = 0; i < array.size(); i++) {
25721        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25722      }
25723    };
25724  }
25725
25726  protected SubscriptionStatus.SubscriptionStatusNotificationEventComponent parseSubscriptionStatusNotificationEventComponent(JsonObject json) throws IOException, FHIRFormatError {
25727    SubscriptionStatus.SubscriptionStatusNotificationEventComponent res = new SubscriptionStatus.SubscriptionStatusNotificationEventComponent();
25728    parseSubscriptionStatusNotificationEventComponentProperties(json, res);
25729    return res;
25730  }
25731
25732  protected void parseSubscriptionStatusNotificationEventComponentProperties(JsonObject json, SubscriptionStatus.SubscriptionStatusNotificationEventComponent res) throws IOException, FHIRFormatError {
25733    parseBackboneElementProperties(json, res);
25734    if (json.has("eventNumber"))
25735      res.setEventNumberElement(parseString(json.get("eventNumber").getAsString()));
25736    if (json.has("_eventNumber"))
25737      parseElementProperties(getJObject(json, "_eventNumber"), res.getEventNumberElement());
25738    if (json.has("timestamp"))
25739      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
25740    if (json.has("_timestamp"))
25741      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
25742    if (json.has("focus"))
25743      res.setFocus(parseReference(getJObject(json, "focus")));
25744    if (json.has("additionalContext")) {
25745      JsonArray array = getJArray(json, "additionalContext");
25746      for (int i = 0; i < array.size(); i++) {
25747        res.getAdditionalContext().add(parseReference(array.get(i).getAsJsonObject()));
25748      }
25749    };
25750  }
25751
25752  protected SubscriptionTopic parseSubscriptionTopic(JsonObject json) throws IOException, FHIRFormatError {
25753    SubscriptionTopic res = new SubscriptionTopic();
25754    parseSubscriptionTopicProperties(json, res);
25755    return res;
25756  }
25757
25758  protected void parseSubscriptionTopicProperties(JsonObject json, SubscriptionTopic res) throws IOException, FHIRFormatError {
25759    parseDomainResourceProperties(json, res);
25760    if (json.has("url"))
25761      res.setUrlElement(parseUri(json.get("url").getAsString()));
25762    if (json.has("_url"))
25763      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
25764    if (json.has("identifier")) {
25765      JsonArray array = getJArray(json, "identifier");
25766      for (int i = 0; i < array.size(); i++) {
25767        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25768      }
25769    };
25770    if (json.has("version"))
25771      res.setVersionElement(parseString(json.get("version").getAsString()));
25772    if (json.has("_version"))
25773      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
25774    if (json.has("title"))
25775      res.setTitleElement(parseString(json.get("title").getAsString()));
25776    if (json.has("_title"))
25777      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25778    if (json.has("derivedFrom")) {
25779      JsonArray array = getJArray(json, "derivedFrom");
25780      for (int i = 0; i < array.size(); i++) {
25781        if (array.get(i).isJsonNull()) {
25782          res.getDerivedFrom().add(new CanonicalType());
25783        } else {;
25784          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
25785        }
25786      }
25787    };
25788    if (json.has("_derivedFrom")) {
25789      JsonArray array = getJArray(json, "_derivedFrom");
25790      for (int i = 0; i < array.size(); i++) {
25791        if (i == res.getDerivedFrom().size())
25792          res.getDerivedFrom().add(parseCanonical(null));
25793        if (array.get(i) instanceof JsonObject) 
25794          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
25795      }
25796    };
25797    if (json.has("status"))
25798      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
25799    if (json.has("_status"))
25800      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25801    if (json.has("experimental"))
25802      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25803    if (json.has("_experimental"))
25804      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
25805    if (json.has("date"))
25806      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25807    if (json.has("_date"))
25808      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25809    if (json.has("publisher"))
25810      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25811    if (json.has("_publisher"))
25812      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
25813    if (json.has("contact")) {
25814      JsonArray array = getJArray(json, "contact");
25815      for (int i = 0; i < array.size(); i++) {
25816        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25817      }
25818    };
25819    if (json.has("description"))
25820      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25821    if (json.has("_description"))
25822      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25823    if (json.has("useContext")) {
25824      JsonArray array = getJArray(json, "useContext");
25825      for (int i = 0; i < array.size(); i++) {
25826        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25827      }
25828    };
25829    if (json.has("jurisdiction")) {
25830      JsonArray array = getJArray(json, "jurisdiction");
25831      for (int i = 0; i < array.size(); i++) {
25832        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25833      }
25834    };
25835    if (json.has("purpose"))
25836      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25837    if (json.has("_purpose"))
25838      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
25839    if (json.has("copyright"))
25840      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25841    if (json.has("_copyright"))
25842      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
25843    if (json.has("approvalDate"))
25844      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
25845    if (json.has("_approvalDate"))
25846      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
25847    if (json.has("lastReviewDate"))
25848      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
25849    if (json.has("_lastReviewDate"))
25850      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
25851    if (json.has("effectivePeriod"))
25852      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
25853    if (json.has("resourceTrigger")) {
25854      JsonArray array = getJArray(json, "resourceTrigger");
25855      for (int i = 0; i < array.size(); i++) {
25856        res.getResourceTrigger().add(parseSubscriptionTopicResourceTriggerComponent(array.get(i).getAsJsonObject()));
25857      }
25858    };
25859    if (json.has("eventTrigger")) {
25860      JsonArray array = getJArray(json, "eventTrigger");
25861      for (int i = 0; i < array.size(); i++) {
25862        res.getEventTrigger().add(parseSubscriptionTopicEventTriggerComponent(array.get(i).getAsJsonObject()));
25863      }
25864    };
25865    if (json.has("canFilterBy")) {
25866      JsonArray array = getJArray(json, "canFilterBy");
25867      for (int i = 0; i < array.size(); i++) {
25868        res.getCanFilterBy().add(parseSubscriptionTopicCanFilterByComponent(array.get(i).getAsJsonObject()));
25869      }
25870    };
25871    if (json.has("notificationShape")) {
25872      JsonArray array = getJArray(json, "notificationShape");
25873      for (int i = 0; i < array.size(); i++) {
25874        res.getNotificationShape().add(parseSubscriptionTopicNotificationShapeComponent(array.get(i).getAsJsonObject()));
25875      }
25876    };
25877  }
25878
25879  protected SubscriptionTopic.SubscriptionTopicResourceTriggerComponent parseSubscriptionTopicResourceTriggerComponent(JsonObject json) throws IOException, FHIRFormatError {
25880    SubscriptionTopic.SubscriptionTopicResourceTriggerComponent res = new SubscriptionTopic.SubscriptionTopicResourceTriggerComponent();
25881    parseSubscriptionTopicResourceTriggerComponentProperties(json, res);
25882    return res;
25883  }
25884
25885  protected void parseSubscriptionTopicResourceTriggerComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicResourceTriggerComponent res) throws IOException, FHIRFormatError {
25886    parseBackboneElementProperties(json, res);
25887    if (json.has("description"))
25888      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25889    if (json.has("_description"))
25890      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25891    if (json.has("resource"))
25892      res.setResourceElement(parseUri(json.get("resource").getAsString()));
25893    if (json.has("_resource"))
25894      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
25895    if (json.has("supportedInteraction")) {
25896      JsonArray array = getJArray(json, "supportedInteraction");
25897      for (int i = 0; i < array.size(); i++) {
25898        if (array.get(i).isJsonNull()) {
25899          res.getSupportedInteraction().add(new Enumeration<SubscriptionTopic.InteractionTrigger>(new SubscriptionTopic.InteractionTriggerEnumFactory(), SubscriptionTopic.InteractionTrigger.NULL));
25900        } else {;
25901          res.getSupportedInteraction().add(parseEnumeration(array.get(i).getAsString(), SubscriptionTopic.InteractionTrigger.NULL, new SubscriptionTopic.InteractionTriggerEnumFactory()));
25902        }
25903      }
25904    };
25905    if (json.has("_supportedInteraction")) {
25906      JsonArray array = getJArray(json, "_supportedInteraction");
25907      for (int i = 0; i < array.size(); i++) {
25908        if (i == res.getSupportedInteraction().size())
25909          res.getSupportedInteraction().add(parseEnumeration(null, SubscriptionTopic.InteractionTrigger.NULL, new SubscriptionTopic.InteractionTriggerEnumFactory()));
25910        if (array.get(i) instanceof JsonObject) 
25911          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedInteraction().get(i));
25912      }
25913    };
25914    if (json.has("queryCriteria"))
25915      res.setQueryCriteria(parseSubscriptionTopicResourceTriggerQueryCriteriaComponent(getJObject(json, "queryCriteria")));
25916    if (json.has("fhirPathCriteria"))
25917      res.setFhirPathCriteriaElement(parseString(json.get("fhirPathCriteria").getAsString()));
25918    if (json.has("_fhirPathCriteria"))
25919      parseElementProperties(getJObject(json, "_fhirPathCriteria"), res.getFhirPathCriteriaElement());
25920  }
25921
25922  protected SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent parseSubscriptionTopicResourceTriggerQueryCriteriaComponent(JsonObject json) throws IOException, FHIRFormatError {
25923    SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent res = new SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent();
25924    parseSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(json, res);
25925    return res;
25926  }
25927
25928  protected void parseSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent res) throws IOException, FHIRFormatError {
25929    parseBackboneElementProperties(json, res);
25930    if (json.has("previous"))
25931      res.setPreviousElement(parseString(json.get("previous").getAsString()));
25932    if (json.has("_previous"))
25933      parseElementProperties(getJObject(json, "_previous"), res.getPreviousElement());
25934    if (json.has("resultForCreate"))
25935      res.setResultForCreateElement(parseEnumeration(json.get("resultForCreate").getAsString(), SubscriptionTopic.CriteriaNotExistsBehavior.NULL, new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory()));
25936    if (json.has("_resultForCreate"))
25937      parseElementProperties(getJObject(json, "_resultForCreate"), res.getResultForCreateElement());
25938    if (json.has("current"))
25939      res.setCurrentElement(parseString(json.get("current").getAsString()));
25940    if (json.has("_current"))
25941      parseElementProperties(getJObject(json, "_current"), res.getCurrentElement());
25942    if (json.has("resultForDelete"))
25943      res.setResultForDeleteElement(parseEnumeration(json.get("resultForDelete").getAsString(), SubscriptionTopic.CriteriaNotExistsBehavior.NULL, new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory()));
25944    if (json.has("_resultForDelete"))
25945      parseElementProperties(getJObject(json, "_resultForDelete"), res.getResultForDeleteElement());
25946    if (json.has("requireBoth"))
25947      res.setRequireBothElement(parseBoolean(json.get("requireBoth").getAsBoolean()));
25948    if (json.has("_requireBoth"))
25949      parseElementProperties(getJObject(json, "_requireBoth"), res.getRequireBothElement());
25950  }
25951
25952  protected SubscriptionTopic.SubscriptionTopicEventTriggerComponent parseSubscriptionTopicEventTriggerComponent(JsonObject json) throws IOException, FHIRFormatError {
25953    SubscriptionTopic.SubscriptionTopicEventTriggerComponent res = new SubscriptionTopic.SubscriptionTopicEventTriggerComponent();
25954    parseSubscriptionTopicEventTriggerComponentProperties(json, res);
25955    return res;
25956  }
25957
25958  protected void parseSubscriptionTopicEventTriggerComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicEventTriggerComponent res) throws IOException, FHIRFormatError {
25959    parseBackboneElementProperties(json, res);
25960    if (json.has("description"))
25961      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25962    if (json.has("_description"))
25963      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25964    if (json.has("event"))
25965      res.setEvent(parseCodeableConcept(getJObject(json, "event")));
25966    if (json.has("resource"))
25967      res.setResourceElement(parseUri(json.get("resource").getAsString()));
25968    if (json.has("_resource"))
25969      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
25970  }
25971
25972  protected SubscriptionTopic.SubscriptionTopicCanFilterByComponent parseSubscriptionTopicCanFilterByComponent(JsonObject json) throws IOException, FHIRFormatError {
25973    SubscriptionTopic.SubscriptionTopicCanFilterByComponent res = new SubscriptionTopic.SubscriptionTopicCanFilterByComponent();
25974    parseSubscriptionTopicCanFilterByComponentProperties(json, res);
25975    return res;
25976  }
25977
25978  protected void parseSubscriptionTopicCanFilterByComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicCanFilterByComponent res) throws IOException, FHIRFormatError {
25979    parseBackboneElementProperties(json, res);
25980    if (json.has("description"))
25981      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25982    if (json.has("_description"))
25983      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25984    if (json.has("resource"))
25985      res.setResourceElement(parseUri(json.get("resource").getAsString()));
25986    if (json.has("_resource"))
25987      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
25988    if (json.has("filterParameter"))
25989      res.setFilterParameterElement(parseString(json.get("filterParameter").getAsString()));
25990    if (json.has("_filterParameter"))
25991      parseElementProperties(getJObject(json, "_filterParameter"), res.getFilterParameterElement());
25992    if (json.has("modifier")) {
25993      JsonArray array = getJArray(json, "modifier");
25994      for (int i = 0; i < array.size(); i++) {
25995        if (array.get(i).isJsonNull()) {
25996          res.getModifier().add(new Enumeration<SubscriptionTopic.SubscriptionSearchModifier>(new SubscriptionTopic.SubscriptionSearchModifierEnumFactory(), SubscriptionTopic.SubscriptionSearchModifier.NULL));
25997        } else {;
25998          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SubscriptionTopic.SubscriptionSearchModifier.NULL, new SubscriptionTopic.SubscriptionSearchModifierEnumFactory()));
25999        }
26000      }
26001    };
26002    if (json.has("_modifier")) {
26003      JsonArray array = getJArray(json, "_modifier");
26004      for (int i = 0; i < array.size(); i++) {
26005        if (i == res.getModifier().size())
26006          res.getModifier().add(parseEnumeration(null, SubscriptionTopic.SubscriptionSearchModifier.NULL, new SubscriptionTopic.SubscriptionSearchModifierEnumFactory()));
26007        if (array.get(i) instanceof JsonObject) 
26008          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
26009      }
26010    };
26011  }
26012
26013  protected SubscriptionTopic.SubscriptionTopicNotificationShapeComponent parseSubscriptionTopicNotificationShapeComponent(JsonObject json) throws IOException, FHIRFormatError {
26014    SubscriptionTopic.SubscriptionTopicNotificationShapeComponent res = new SubscriptionTopic.SubscriptionTopicNotificationShapeComponent();
26015    parseSubscriptionTopicNotificationShapeComponentProperties(json, res);
26016    return res;
26017  }
26018
26019  protected void parseSubscriptionTopicNotificationShapeComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicNotificationShapeComponent res) throws IOException, FHIRFormatError {
26020    parseBackboneElementProperties(json, res);
26021    if (json.has("resource"))
26022      res.setResourceElement(parseUri(json.get("resource").getAsString()));
26023    if (json.has("_resource"))
26024      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
26025    if (json.has("include")) {
26026      JsonArray array = getJArray(json, "include");
26027      for (int i = 0; i < array.size(); i++) {
26028        if (array.get(i).isJsonNull()) {
26029          res.getInclude().add(new StringType());
26030        } else {;
26031          res.getInclude().add(parseString(array.get(i).getAsString()));
26032        }
26033      }
26034    };
26035    if (json.has("_include")) {
26036      JsonArray array = getJArray(json, "_include");
26037      for (int i = 0; i < array.size(); i++) {
26038        if (i == res.getInclude().size())
26039          res.getInclude().add(parseString(null));
26040        if (array.get(i) instanceof JsonObject) 
26041          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
26042      }
26043    };
26044    if (json.has("revInclude")) {
26045      JsonArray array = getJArray(json, "revInclude");
26046      for (int i = 0; i < array.size(); i++) {
26047        if (array.get(i).isJsonNull()) {
26048          res.getRevInclude().add(new StringType());
26049        } else {;
26050          res.getRevInclude().add(parseString(array.get(i).getAsString()));
26051        }
26052      }
26053    };
26054    if (json.has("_revInclude")) {
26055      JsonArray array = getJArray(json, "_revInclude");
26056      for (int i = 0; i < array.size(); i++) {
26057        if (i == res.getRevInclude().size())
26058          res.getRevInclude().add(parseString(null));
26059        if (array.get(i) instanceof JsonObject) 
26060          parseElementProperties(array.get(i).getAsJsonObject(), res.getRevInclude().get(i));
26061      }
26062    };
26063  }
26064
26065  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
26066    Substance res = new Substance();
26067    parseSubstanceProperties(json, res);
26068    return res;
26069  }
26070
26071  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
26072    parseDomainResourceProperties(json, res);
26073    if (json.has("identifier")) {
26074      JsonArray array = getJArray(json, "identifier");
26075      for (int i = 0; i < array.size(); i++) {
26076        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26077      }
26078    };
26079    if (json.has("status"))
26080      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
26081    if (json.has("_status"))
26082      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26083    if (json.has("category")) {
26084      JsonArray array = getJArray(json, "category");
26085      for (int i = 0; i < array.size(); i++) {
26086        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26087      }
26088    };
26089    if (json.has("code"))
26090      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26091    if (json.has("description"))
26092      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26093    if (json.has("_description"))
26094      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26095    if (json.has("instance")) {
26096      JsonArray array = getJArray(json, "instance");
26097      for (int i = 0; i < array.size(); i++) {
26098        res.getInstance().add(parseSubstanceInstanceComponent(array.get(i).getAsJsonObject()));
26099      }
26100    };
26101    if (json.has("ingredient")) {
26102      JsonArray array = getJArray(json, "ingredient");
26103      for (int i = 0; i < array.size(); i++) {
26104        res.getIngredient().add(parseSubstanceIngredientComponent(array.get(i).getAsJsonObject()));
26105      }
26106    };
26107  }
26108
26109  protected Substance.SubstanceInstanceComponent parseSubstanceInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
26110    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
26111    parseSubstanceInstanceComponentProperties(json, res);
26112    return res;
26113  }
26114
26115  protected void parseSubstanceInstanceComponentProperties(JsonObject json, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
26116    parseBackboneElementProperties(json, res);
26117    if (json.has("identifier"))
26118      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
26119    if (json.has("expiry"))
26120      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
26121    if (json.has("_expiry"))
26122      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
26123    if (json.has("quantity"))
26124      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
26125  }
26126
26127  protected Substance.SubstanceIngredientComponent parseSubstanceIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
26128    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
26129    parseSubstanceIngredientComponentProperties(json, res);
26130    return res;
26131  }
26132
26133  protected void parseSubstanceIngredientComponentProperties(JsonObject json, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
26134    parseBackboneElementProperties(json, res);
26135    if (json.has("quantity"))
26136      res.setQuantity(parseRatio(getJObject(json, "quantity")));
26137    DataType substance = parseType("substance", json);
26138    if (substance != null)
26139      res.setSubstance(substance);
26140  }
26141
26142  protected SubstanceDefinition parseSubstanceDefinition(JsonObject json) throws IOException, FHIRFormatError {
26143    SubstanceDefinition res = new SubstanceDefinition();
26144    parseSubstanceDefinitionProperties(json, res);
26145    return res;
26146  }
26147
26148  protected void parseSubstanceDefinitionProperties(JsonObject json, SubstanceDefinition res) throws IOException, FHIRFormatError {
26149    parseDomainResourceProperties(json, res);
26150    if (json.has("identifier")) {
26151      JsonArray array = getJArray(json, "identifier");
26152      for (int i = 0; i < array.size(); i++) {
26153        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26154      }
26155    };
26156    if (json.has("version"))
26157      res.setVersionElement(parseString(json.get("version").getAsString()));
26158    if (json.has("_version"))
26159      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26160    if (json.has("status"))
26161      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
26162    if (json.has("classification")) {
26163      JsonArray array = getJArray(json, "classification");
26164      for (int i = 0; i < array.size(); i++) {
26165        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26166      }
26167    };
26168    if (json.has("domain"))
26169      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
26170    if (json.has("grade")) {
26171      JsonArray array = getJArray(json, "grade");
26172      for (int i = 0; i < array.size(); i++) {
26173        res.getGrade().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26174      }
26175    };
26176    if (json.has("description"))
26177      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26178    if (json.has("_description"))
26179      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26180    if (json.has("informationSource")) {
26181      JsonArray array = getJArray(json, "informationSource");
26182      for (int i = 0; i < array.size(); i++) {
26183        res.getInformationSource().add(parseReference(array.get(i).getAsJsonObject()));
26184      }
26185    };
26186    if (json.has("note")) {
26187      JsonArray array = getJArray(json, "note");
26188      for (int i = 0; i < array.size(); i++) {
26189        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26190      }
26191    };
26192    if (json.has("manufacturer")) {
26193      JsonArray array = getJArray(json, "manufacturer");
26194      for (int i = 0; i < array.size(); i++) {
26195        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
26196      }
26197    };
26198    if (json.has("supplier")) {
26199      JsonArray array = getJArray(json, "supplier");
26200      for (int i = 0; i < array.size(); i++) {
26201        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
26202      }
26203    };
26204    if (json.has("moiety")) {
26205      JsonArray array = getJArray(json, "moiety");
26206      for (int i = 0; i < array.size(); i++) {
26207        res.getMoiety().add(parseSubstanceDefinitionMoietyComponent(array.get(i).getAsJsonObject()));
26208      }
26209    };
26210    if (json.has("property")) {
26211      JsonArray array = getJArray(json, "property");
26212      for (int i = 0; i < array.size(); i++) {
26213        res.getProperty().add(parseSubstanceDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
26214      }
26215    };
26216    if (json.has("molecularWeight")) {
26217      JsonArray array = getJArray(json, "molecularWeight");
26218      for (int i = 0; i < array.size(); i++) {
26219        res.getMolecularWeight().add(parseSubstanceDefinitionMolecularWeightComponent(array.get(i).getAsJsonObject()));
26220      }
26221    };
26222    if (json.has("structure"))
26223      res.setStructure(parseSubstanceDefinitionStructureComponent(getJObject(json, "structure")));
26224    if (json.has("code")) {
26225      JsonArray array = getJArray(json, "code");
26226      for (int i = 0; i < array.size(); i++) {
26227        res.getCode().add(parseSubstanceDefinitionCodeComponent(array.get(i).getAsJsonObject()));
26228      }
26229    };
26230    if (json.has("name")) {
26231      JsonArray array = getJArray(json, "name");
26232      for (int i = 0; i < array.size(); i++) {
26233        res.getName().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
26234      }
26235    };
26236    if (json.has("relationship")) {
26237      JsonArray array = getJArray(json, "relationship");
26238      for (int i = 0; i < array.size(); i++) {
26239        res.getRelationship().add(parseSubstanceDefinitionRelationshipComponent(array.get(i).getAsJsonObject()));
26240      }
26241    };
26242    if (json.has("sourceMaterial"))
26243      res.setSourceMaterial(parseSubstanceDefinitionSourceMaterialComponent(getJObject(json, "sourceMaterial")));
26244  }
26245
26246  protected SubstanceDefinition.SubstanceDefinitionMoietyComponent parseSubstanceDefinitionMoietyComponent(JsonObject json) throws IOException, FHIRFormatError {
26247    SubstanceDefinition.SubstanceDefinitionMoietyComponent res = new SubstanceDefinition.SubstanceDefinitionMoietyComponent();
26248    parseSubstanceDefinitionMoietyComponentProperties(json, res);
26249    return res;
26250  }
26251
26252  protected void parseSubstanceDefinitionMoietyComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionMoietyComponent res) throws IOException, FHIRFormatError {
26253    parseBackboneElementProperties(json, res);
26254    if (json.has("role"))
26255      res.setRole(parseCodeableConcept(getJObject(json, "role")));
26256    if (json.has("identifier"))
26257      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
26258    if (json.has("name"))
26259      res.setNameElement(parseString(json.get("name").getAsString()));
26260    if (json.has("_name"))
26261      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26262    if (json.has("stereochemistry"))
26263      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
26264    if (json.has("opticalActivity"))
26265      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
26266    if (json.has("molecularFormula"))
26267      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
26268    if (json.has("_molecularFormula"))
26269      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
26270    DataType amount = parseType("amount", json);
26271    if (amount != null)
26272      res.setAmount(amount);
26273    if (json.has("amountType"))
26274      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
26275  }
26276
26277  protected SubstanceDefinition.SubstanceDefinitionPropertyComponent parseSubstanceDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
26278    SubstanceDefinition.SubstanceDefinitionPropertyComponent res = new SubstanceDefinition.SubstanceDefinitionPropertyComponent();
26279    parseSubstanceDefinitionPropertyComponentProperties(json, res);
26280    return res;
26281  }
26282
26283  protected void parseSubstanceDefinitionPropertyComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
26284    parseBackboneElementProperties(json, res);
26285    if (json.has("type"))
26286      res.setType(parseCodeableConcept(getJObject(json, "type")));
26287    DataType value = parseType("value", json);
26288    if (value != null)
26289      res.setValue(value);
26290  }
26291
26292  protected SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent parseSubstanceDefinitionMolecularWeightComponent(JsonObject json) throws IOException, FHIRFormatError {
26293    SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent res = new SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent();
26294    parseSubstanceDefinitionMolecularWeightComponentProperties(json, res);
26295    return res;
26296  }
26297
26298  protected void parseSubstanceDefinitionMolecularWeightComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent res) throws IOException, FHIRFormatError {
26299    parseBackboneElementProperties(json, res);
26300    if (json.has("method"))
26301      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
26302    if (json.has("type"))
26303      res.setType(parseCodeableConcept(getJObject(json, "type")));
26304    if (json.has("amount"))
26305      res.setAmount(parseQuantity(getJObject(json, "amount")));
26306  }
26307
26308  protected SubstanceDefinition.SubstanceDefinitionStructureComponent parseSubstanceDefinitionStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
26309    SubstanceDefinition.SubstanceDefinitionStructureComponent res = new SubstanceDefinition.SubstanceDefinitionStructureComponent();
26310    parseSubstanceDefinitionStructureComponentProperties(json, res);
26311    return res;
26312  }
26313
26314  protected void parseSubstanceDefinitionStructureComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureComponent res) throws IOException, FHIRFormatError {
26315    parseBackboneElementProperties(json, res);
26316    if (json.has("stereochemistry"))
26317      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
26318    if (json.has("opticalActivity"))
26319      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
26320    if (json.has("molecularFormula"))
26321      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
26322    if (json.has("_molecularFormula"))
26323      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
26324    if (json.has("molecularFormulaByMoiety"))
26325      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
26326    if (json.has("_molecularFormulaByMoiety"))
26327      parseElementProperties(getJObject(json, "_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
26328    if (json.has("molecularWeight"))
26329      res.setMolecularWeight(parseSubstanceDefinitionMolecularWeightComponent(getJObject(json, "molecularWeight")));
26330    if (json.has("technique")) {
26331      JsonArray array = getJArray(json, "technique");
26332      for (int i = 0; i < array.size(); i++) {
26333        res.getTechnique().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26334      }
26335    };
26336    if (json.has("sourceDocument")) {
26337      JsonArray array = getJArray(json, "sourceDocument");
26338      for (int i = 0; i < array.size(); i++) {
26339        res.getSourceDocument().add(parseReference(array.get(i).getAsJsonObject()));
26340      }
26341    };
26342    if (json.has("representation")) {
26343      JsonArray array = getJArray(json, "representation");
26344      for (int i = 0; i < array.size(); i++) {
26345        res.getRepresentation().add(parseSubstanceDefinitionStructureRepresentationComponent(array.get(i).getAsJsonObject()));
26346      }
26347    };
26348  }
26349
26350  protected SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent parseSubstanceDefinitionStructureRepresentationComponent(JsonObject json) throws IOException, FHIRFormatError {
26351    SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res = new SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent();
26352    parseSubstanceDefinitionStructureRepresentationComponentProperties(json, res);
26353    return res;
26354  }
26355
26356  protected void parseSubstanceDefinitionStructureRepresentationComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res) throws IOException, FHIRFormatError {
26357    parseBackboneElementProperties(json, res);
26358    if (json.has("type"))
26359      res.setType(parseCodeableConcept(getJObject(json, "type")));
26360    if (json.has("representation"))
26361      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
26362    if (json.has("_representation"))
26363      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
26364    if (json.has("format"))
26365      res.setFormat(parseCodeableConcept(getJObject(json, "format")));
26366    if (json.has("document"))
26367      res.setDocument(parseReference(getJObject(json, "document")));
26368  }
26369
26370  protected SubstanceDefinition.SubstanceDefinitionCodeComponent parseSubstanceDefinitionCodeComponent(JsonObject json) throws IOException, FHIRFormatError {
26371    SubstanceDefinition.SubstanceDefinitionCodeComponent res = new SubstanceDefinition.SubstanceDefinitionCodeComponent();
26372    parseSubstanceDefinitionCodeComponentProperties(json, res);
26373    return res;
26374  }
26375
26376  protected void parseSubstanceDefinitionCodeComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionCodeComponent res) throws IOException, FHIRFormatError {
26377    parseBackboneElementProperties(json, res);
26378    if (json.has("code"))
26379      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26380    if (json.has("status"))
26381      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
26382    if (json.has("statusDate"))
26383      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
26384    if (json.has("_statusDate"))
26385      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
26386    if (json.has("note")) {
26387      JsonArray array = getJArray(json, "note");
26388      for (int i = 0; i < array.size(); i++) {
26389        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26390      }
26391    };
26392    if (json.has("source")) {
26393      JsonArray array = getJArray(json, "source");
26394      for (int i = 0; i < array.size(); i++) {
26395        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
26396      }
26397    };
26398  }
26399
26400  protected SubstanceDefinition.SubstanceDefinitionNameComponent parseSubstanceDefinitionNameComponent(JsonObject json) throws IOException, FHIRFormatError {
26401    SubstanceDefinition.SubstanceDefinitionNameComponent res = new SubstanceDefinition.SubstanceDefinitionNameComponent();
26402    parseSubstanceDefinitionNameComponentProperties(json, res);
26403    return res;
26404  }
26405
26406  protected void parseSubstanceDefinitionNameComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionNameComponent res) throws IOException, FHIRFormatError {
26407    parseBackboneElementProperties(json, res);
26408    if (json.has("name"))
26409      res.setNameElement(parseString(json.get("name").getAsString()));
26410    if (json.has("_name"))
26411      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26412    if (json.has("type"))
26413      res.setType(parseCodeableConcept(getJObject(json, "type")));
26414    if (json.has("status"))
26415      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
26416    if (json.has("preferred"))
26417      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
26418    if (json.has("_preferred"))
26419      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
26420    if (json.has("language")) {
26421      JsonArray array = getJArray(json, "language");
26422      for (int i = 0; i < array.size(); i++) {
26423        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26424      }
26425    };
26426    if (json.has("domain")) {
26427      JsonArray array = getJArray(json, "domain");
26428      for (int i = 0; i < array.size(); i++) {
26429        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26430      }
26431    };
26432    if (json.has("jurisdiction")) {
26433      JsonArray array = getJArray(json, "jurisdiction");
26434      for (int i = 0; i < array.size(); i++) {
26435        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26436      }
26437    };
26438    if (json.has("synonym")) {
26439      JsonArray array = getJArray(json, "synonym");
26440      for (int i = 0; i < array.size(); i++) {
26441        res.getSynonym().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
26442      }
26443    };
26444    if (json.has("translation")) {
26445      JsonArray array = getJArray(json, "translation");
26446      for (int i = 0; i < array.size(); i++) {
26447        res.getTranslation().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
26448      }
26449    };
26450    if (json.has("official")) {
26451      JsonArray array = getJArray(json, "official");
26452      for (int i = 0; i < array.size(); i++) {
26453        res.getOfficial().add(parseSubstanceDefinitionNameOfficialComponent(array.get(i).getAsJsonObject()));
26454      }
26455    };
26456    if (json.has("source")) {
26457      JsonArray array = getJArray(json, "source");
26458      for (int i = 0; i < array.size(); i++) {
26459        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
26460      }
26461    };
26462  }
26463
26464  protected SubstanceDefinition.SubstanceDefinitionNameOfficialComponent parseSubstanceDefinitionNameOfficialComponent(JsonObject json) throws IOException, FHIRFormatError {
26465    SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res = new SubstanceDefinition.SubstanceDefinitionNameOfficialComponent();
26466    parseSubstanceDefinitionNameOfficialComponentProperties(json, res);
26467    return res;
26468  }
26469
26470  protected void parseSubstanceDefinitionNameOfficialComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res) throws IOException, FHIRFormatError {
26471    parseBackboneElementProperties(json, res);
26472    if (json.has("authority"))
26473      res.setAuthority(parseCodeableConcept(getJObject(json, "authority")));
26474    if (json.has("status"))
26475      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
26476    if (json.has("date"))
26477      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26478    if (json.has("_date"))
26479      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26480  }
26481
26482  protected SubstanceDefinition.SubstanceDefinitionRelationshipComponent parseSubstanceDefinitionRelationshipComponent(JsonObject json) throws IOException, FHIRFormatError {
26483    SubstanceDefinition.SubstanceDefinitionRelationshipComponent res = new SubstanceDefinition.SubstanceDefinitionRelationshipComponent();
26484    parseSubstanceDefinitionRelationshipComponentProperties(json, res);
26485    return res;
26486  }
26487
26488  protected void parseSubstanceDefinitionRelationshipComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionRelationshipComponent res) throws IOException, FHIRFormatError {
26489    parseBackboneElementProperties(json, res);
26490    DataType substanceDefinition = parseType("substanceDefinition", json);
26491    if (substanceDefinition != null)
26492      res.setSubstanceDefinition(substanceDefinition);
26493    if (json.has("type"))
26494      res.setType(parseCodeableConcept(getJObject(json, "type")));
26495    if (json.has("isDefining"))
26496      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
26497    if (json.has("_isDefining"))
26498      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
26499    DataType amount = parseType("amount", json);
26500    if (amount != null)
26501      res.setAmount(amount);
26502    if (json.has("amountRatioHighLimit"))
26503      res.setAmountRatioHighLimit(parseRatio(getJObject(json, "amountRatioHighLimit")));
26504    if (json.has("amountType"))
26505      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
26506    if (json.has("source")) {
26507      JsonArray array = getJArray(json, "source");
26508      for (int i = 0; i < array.size(); i++) {
26509        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
26510      }
26511    };
26512  }
26513
26514  protected SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent parseSubstanceDefinitionSourceMaterialComponent(JsonObject json) throws IOException, FHIRFormatError {
26515    SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent res = new SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent();
26516    parseSubstanceDefinitionSourceMaterialComponentProperties(json, res);
26517    return res;
26518  }
26519
26520  protected void parseSubstanceDefinitionSourceMaterialComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent res) throws IOException, FHIRFormatError {
26521    parseBackboneElementProperties(json, res);
26522    if (json.has("type"))
26523      res.setType(parseCodeableConcept(getJObject(json, "type")));
26524    if (json.has("genus"))
26525      res.setGenus(parseCodeableConcept(getJObject(json, "genus")));
26526    if (json.has("species"))
26527      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
26528    if (json.has("part"))
26529      res.setPart(parseCodeableConcept(getJObject(json, "part")));
26530    if (json.has("countryOfOrigin")) {
26531      JsonArray array = getJArray(json, "countryOfOrigin");
26532      for (int i = 0; i < array.size(); i++) {
26533        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26534      }
26535    };
26536  }
26537
26538  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
26539    SupplyDelivery res = new SupplyDelivery();
26540    parseSupplyDeliveryProperties(json, res);
26541    return res;
26542  }
26543
26544  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
26545    parseDomainResourceProperties(json, res);
26546    if (json.has("identifier")) {
26547      JsonArray array = getJArray(json, "identifier");
26548      for (int i = 0; i < array.size(); i++) {
26549        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26550      }
26551    };
26552    if (json.has("basedOn")) {
26553      JsonArray array = getJArray(json, "basedOn");
26554      for (int i = 0; i < array.size(); i++) {
26555        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
26556      }
26557    };
26558    if (json.has("partOf")) {
26559      JsonArray array = getJArray(json, "partOf");
26560      for (int i = 0; i < array.size(); i++) {
26561        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
26562      }
26563    };
26564    if (json.has("status"))
26565      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
26566    if (json.has("_status"))
26567      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26568    if (json.has("patient"))
26569      res.setPatient(parseReference(getJObject(json, "patient")));
26570    if (json.has("type"))
26571      res.setType(parseCodeableConcept(getJObject(json, "type")));
26572    if (json.has("suppliedItem"))
26573      res.setSuppliedItem(parseSupplyDeliverySuppliedItemComponent(getJObject(json, "suppliedItem")));
26574    DataType occurrence = parseType("occurrence", json);
26575    if (occurrence != null)
26576      res.setOccurrence(occurrence);
26577    if (json.has("supplier"))
26578      res.setSupplier(parseReference(getJObject(json, "supplier")));
26579    if (json.has("destination"))
26580      res.setDestination(parseReference(getJObject(json, "destination")));
26581    if (json.has("receiver")) {
26582      JsonArray array = getJArray(json, "receiver");
26583      for (int i = 0; i < array.size(); i++) {
26584        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
26585      }
26586    };
26587  }
26588
26589  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySuppliedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
26590    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
26591    parseSupplyDeliverySuppliedItemComponentProperties(json, res);
26592    return res;
26593  }
26594
26595  protected void parseSupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
26596    parseBackboneElementProperties(json, res);
26597    if (json.has("quantity"))
26598      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
26599    DataType item = parseType("item", json);
26600    if (item != null)
26601      res.setItem(item);
26602  }
26603
26604  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
26605    SupplyRequest res = new SupplyRequest();
26606    parseSupplyRequestProperties(json, res);
26607    return res;
26608  }
26609
26610  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
26611    parseDomainResourceProperties(json, res);
26612    if (json.has("identifier")) {
26613      JsonArray array = getJArray(json, "identifier");
26614      for (int i = 0; i < array.size(); i++) {
26615        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26616      }
26617    };
26618    if (json.has("status"))
26619      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
26620    if (json.has("_status"))
26621      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26622    if (json.has("category"))
26623      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
26624    if (json.has("priority"))
26625      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
26626    if (json.has("_priority"))
26627      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
26628    DataType item = parseType("item", json);
26629    if (item != null)
26630      res.setItem(item);
26631    if (json.has("quantity"))
26632      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
26633    if (json.has("parameter")) {
26634      JsonArray array = getJArray(json, "parameter");
26635      for (int i = 0; i < array.size(); i++) {
26636        res.getParameter().add(parseSupplyRequestParameterComponent(array.get(i).getAsJsonObject()));
26637      }
26638    };
26639    DataType occurrence = parseType("occurrence", json);
26640    if (occurrence != null)
26641      res.setOccurrence(occurrence);
26642    if (json.has("authoredOn"))
26643      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
26644    if (json.has("_authoredOn"))
26645      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
26646    if (json.has("requester"))
26647      res.setRequester(parseReference(getJObject(json, "requester")));
26648    if (json.has("supplier")) {
26649      JsonArray array = getJArray(json, "supplier");
26650      for (int i = 0; i < array.size(); i++) {
26651        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
26652      }
26653    };
26654    if (json.has("reasonCode")) {
26655      JsonArray array = getJArray(json, "reasonCode");
26656      for (int i = 0; i < array.size(); i++) {
26657        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26658      }
26659    };
26660    if (json.has("reasonReference")) {
26661      JsonArray array = getJArray(json, "reasonReference");
26662      for (int i = 0; i < array.size(); i++) {
26663        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
26664      }
26665    };
26666    if (json.has("deliverFrom"))
26667      res.setDeliverFrom(parseReference(getJObject(json, "deliverFrom")));
26668    if (json.has("deliverTo"))
26669      res.setDeliverTo(parseReference(getJObject(json, "deliverTo")));
26670  }
26671
26672  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
26673    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
26674    parseSupplyRequestParameterComponentProperties(json, res);
26675    return res;
26676  }
26677
26678  protected void parseSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
26679    parseBackboneElementProperties(json, res);
26680    if (json.has("code"))
26681      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26682    DataType value = parseType("value", json);
26683    if (value != null)
26684      res.setValue(value);
26685  }
26686
26687  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
26688    Task res = new Task();
26689    parseTaskProperties(json, res);
26690    return res;
26691  }
26692
26693  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
26694    parseDomainResourceProperties(json, res);
26695    if (json.has("identifier")) {
26696      JsonArray array = getJArray(json, "identifier");
26697      for (int i = 0; i < array.size(); i++) {
26698        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26699      }
26700    };
26701    if (json.has("instantiatesCanonical"))
26702      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
26703    if (json.has("_instantiatesCanonical"))
26704      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
26705    if (json.has("instantiatesUri"))
26706      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
26707    if (json.has("_instantiatesUri"))
26708      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
26709    if (json.has("basedOn")) {
26710      JsonArray array = getJArray(json, "basedOn");
26711      for (int i = 0; i < array.size(); i++) {
26712        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
26713      }
26714    };
26715    if (json.has("groupIdentifier"))
26716      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
26717    if (json.has("partOf")) {
26718      JsonArray array = getJArray(json, "partOf");
26719      for (int i = 0; i < array.size(); i++) {
26720        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
26721      }
26722    };
26723    if (json.has("status"))
26724      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
26725    if (json.has("_status"))
26726      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26727    if (json.has("statusReason"))
26728      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
26729    if (json.has("businessStatus"))
26730      res.setBusinessStatus(parseCodeableConcept(getJObject(json, "businessStatus")));
26731    if (json.has("intent"))
26732      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
26733    if (json.has("_intent"))
26734      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
26735    if (json.has("priority"))
26736      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
26737    if (json.has("_priority"))
26738      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
26739    if (json.has("code"))
26740      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26741    if (json.has("description"))
26742      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26743    if (json.has("_description"))
26744      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26745    if (json.has("focus"))
26746      res.setFocus(parseReference(getJObject(json, "focus")));
26747    if (json.has("for"))
26748      res.setFor(parseReference(getJObject(json, "for")));
26749    if (json.has("encounter"))
26750      res.setEncounter(parseReference(getJObject(json, "encounter")));
26751    if (json.has("executionPeriod"))
26752      res.setExecutionPeriod(parsePeriod(getJObject(json, "executionPeriod")));
26753    if (json.has("authoredOn"))
26754      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
26755    if (json.has("_authoredOn"))
26756      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
26757    if (json.has("lastModified"))
26758      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
26759    if (json.has("_lastModified"))
26760      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
26761    if (json.has("requester"))
26762      res.setRequester(parseReference(getJObject(json, "requester")));
26763    if (json.has("performerType")) {
26764      JsonArray array = getJArray(json, "performerType");
26765      for (int i = 0; i < array.size(); i++) {
26766        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26767      }
26768    };
26769    if (json.has("owner"))
26770      res.setOwner(parseReference(getJObject(json, "owner")));
26771    if (json.has("location"))
26772      res.setLocation(parseReference(getJObject(json, "location")));
26773    if (json.has("reasonCode"))
26774      res.setReasonCode(parseCodeableConcept(getJObject(json, "reasonCode")));
26775    if (json.has("reasonReference"))
26776      res.setReasonReference(parseReference(getJObject(json, "reasonReference")));
26777    if (json.has("insurance")) {
26778      JsonArray array = getJArray(json, "insurance");
26779      for (int i = 0; i < array.size(); i++) {
26780        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
26781      }
26782    };
26783    if (json.has("note")) {
26784      JsonArray array = getJArray(json, "note");
26785      for (int i = 0; i < array.size(); i++) {
26786        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26787      }
26788    };
26789    if (json.has("relevantHistory")) {
26790      JsonArray array = getJArray(json, "relevantHistory");
26791      for (int i = 0; i < array.size(); i++) {
26792        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
26793      }
26794    };
26795    if (json.has("restriction"))
26796      res.setRestriction(parseTaskRestrictionComponent(getJObject(json, "restriction")));
26797    if (json.has("input")) {
26798      JsonArray array = getJArray(json, "input");
26799      for (int i = 0; i < array.size(); i++) {
26800        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject()));
26801      }
26802    };
26803    if (json.has("output")) {
26804      JsonArray array = getJArray(json, "output");
26805      for (int i = 0; i < array.size(); i++) {
26806        res.getOutput().add(parseTaskOutputComponent(array.get(i).getAsJsonObject()));
26807      }
26808    };
26809  }
26810
26811  protected Task.TaskRestrictionComponent parseTaskRestrictionComponent(JsonObject json) throws IOException, FHIRFormatError {
26812    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
26813    parseTaskRestrictionComponentProperties(json, res);
26814    return res;
26815  }
26816
26817  protected void parseTaskRestrictionComponentProperties(JsonObject json, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
26818    parseBackboneElementProperties(json, res);
26819    if (json.has("repetitions"))
26820      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
26821    if (json.has("_repetitions"))
26822      parseElementProperties(getJObject(json, "_repetitions"), res.getRepetitionsElement());
26823    if (json.has("period"))
26824      res.setPeriod(parsePeriod(getJObject(json, "period")));
26825    if (json.has("recipient")) {
26826      JsonArray array = getJArray(json, "recipient");
26827      for (int i = 0; i < array.size(); i++) {
26828        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
26829      }
26830    };
26831  }
26832
26833  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
26834    Task.ParameterComponent res = new Task.ParameterComponent();
26835    parseTaskParameterComponentProperties(json, res);
26836    return res;
26837  }
26838
26839  protected void parseTaskParameterComponentProperties(JsonObject json, Task.ParameterComponent res) throws IOException, FHIRFormatError {
26840    parseBackboneElementProperties(json, res);
26841    if (json.has("type"))
26842      res.setType(parseCodeableConcept(getJObject(json, "type")));
26843    DataType value = parseType("value", json);
26844    if (value != null)
26845      res.setValue(value);
26846  }
26847
26848  protected Task.TaskOutputComponent parseTaskOutputComponent(JsonObject json) throws IOException, FHIRFormatError {
26849    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
26850    parseTaskOutputComponentProperties(json, res);
26851    return res;
26852  }
26853
26854  protected void parseTaskOutputComponentProperties(JsonObject json, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
26855    parseBackboneElementProperties(json, res);
26856    if (json.has("type"))
26857      res.setType(parseCodeableConcept(getJObject(json, "type")));
26858    DataType value = parseType("value", json);
26859    if (value != null)
26860      res.setValue(value);
26861  }
26862
26863  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
26864    TerminologyCapabilities res = new TerminologyCapabilities();
26865    parseTerminologyCapabilitiesProperties(json, res);
26866    return res;
26867  }
26868
26869  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
26870    parseDomainResourceProperties(json, res);
26871    if (json.has("url"))
26872      res.setUrlElement(parseUri(json.get("url").getAsString()));
26873    if (json.has("_url"))
26874      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26875    if (json.has("version"))
26876      res.setVersionElement(parseString(json.get("version").getAsString()));
26877    if (json.has("_version"))
26878      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26879    if (json.has("name"))
26880      res.setNameElement(parseString(json.get("name").getAsString()));
26881    if (json.has("_name"))
26882      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26883    if (json.has("title"))
26884      res.setTitleElement(parseString(json.get("title").getAsString()));
26885    if (json.has("_title"))
26886      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26887    if (json.has("status"))
26888      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26889    if (json.has("_status"))
26890      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26891    if (json.has("experimental"))
26892      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26893    if (json.has("_experimental"))
26894      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
26895    if (json.has("date"))
26896      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26897    if (json.has("_date"))
26898      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26899    if (json.has("publisher"))
26900      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26901    if (json.has("_publisher"))
26902      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26903    if (json.has("contact")) {
26904      JsonArray array = getJArray(json, "contact");
26905      for (int i = 0; i < array.size(); i++) {
26906        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26907      }
26908    };
26909    if (json.has("description"))
26910      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26911    if (json.has("_description"))
26912      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26913    if (json.has("useContext")) {
26914      JsonArray array = getJArray(json, "useContext");
26915      for (int i = 0; i < array.size(); i++) {
26916        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26917      }
26918    };
26919    if (json.has("jurisdiction")) {
26920      JsonArray array = getJArray(json, "jurisdiction");
26921      for (int i = 0; i < array.size(); i++) {
26922        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26923      }
26924    };
26925    if (json.has("purpose"))
26926      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26927    if (json.has("_purpose"))
26928      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
26929    if (json.has("copyright"))
26930      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26931    if (json.has("_copyright"))
26932      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
26933    if (json.has("kind"))
26934      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
26935    if (json.has("_kind"))
26936      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
26937    if (json.has("software"))
26938      res.setSoftware(parseTerminologyCapabilitiesSoftwareComponent(getJObject(json, "software")));
26939    if (json.has("implementation"))
26940      res.setImplementation(parseTerminologyCapabilitiesImplementationComponent(getJObject(json, "implementation")));
26941    if (json.has("lockedDate"))
26942      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
26943    if (json.has("_lockedDate"))
26944      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
26945    if (json.has("codeSystem")) {
26946      JsonArray array = getJArray(json, "codeSystem");
26947      for (int i = 0; i < array.size(); i++) {
26948        res.getCodeSystem().add(parseTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject()));
26949      }
26950    };
26951    if (json.has("expansion"))
26952      res.setExpansion(parseTerminologyCapabilitiesExpansionComponent(getJObject(json, "expansion")));
26953    if (json.has("codeSearch"))
26954      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
26955    if (json.has("_codeSearch"))
26956      parseElementProperties(getJObject(json, "_codeSearch"), res.getCodeSearchElement());
26957    if (json.has("validateCode"))
26958      res.setValidateCode(parseTerminologyCapabilitiesValidateCodeComponent(getJObject(json, "validateCode")));
26959    if (json.has("translation"))
26960      res.setTranslation(parseTerminologyCapabilitiesTranslationComponent(getJObject(json, "translation")));
26961    if (json.has("closure"))
26962      res.setClosure(parseTerminologyCapabilitiesClosureComponent(getJObject(json, "closure")));
26963  }
26964
26965  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
26966    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
26967    parseTerminologyCapabilitiesSoftwareComponentProperties(json, res);
26968    return res;
26969  }
26970
26971  protected void parseTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
26972    parseBackboneElementProperties(json, res);
26973    if (json.has("name"))
26974      res.setNameElement(parseString(json.get("name").getAsString()));
26975    if (json.has("_name"))
26976      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26977    if (json.has("version"))
26978      res.setVersionElement(parseString(json.get("version").getAsString()));
26979    if (json.has("_version"))
26980      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26981  }
26982
26983  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
26984    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
26985    parseTerminologyCapabilitiesImplementationComponentProperties(json, res);
26986    return res;
26987  }
26988
26989  protected void parseTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
26990    parseBackboneElementProperties(json, res);
26991    if (json.has("description"))
26992      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26993    if (json.has("_description"))
26994      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26995    if (json.has("url"))
26996      res.setUrlElement(parseUrl(json.get("url").getAsString()));
26997    if (json.has("_url"))
26998      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26999  }
27000
27001  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesCodeSystemComponent(JsonObject json) throws IOException, FHIRFormatError {
27002    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
27003    parseTerminologyCapabilitiesCodeSystemComponentProperties(json, res);
27004    return res;
27005  }
27006
27007  protected void parseTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
27008    parseBackboneElementProperties(json, res);
27009    if (json.has("uri"))
27010      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
27011    if (json.has("_uri"))
27012      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
27013    if (json.has("version")) {
27014      JsonArray array = getJArray(json, "version");
27015      for (int i = 0; i < array.size(); i++) {
27016        res.getVersion().add(parseTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject()));
27017      }
27018    };
27019    if (json.has("subsumption"))
27020      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
27021    if (json.has("_subsumption"))
27022      parseElementProperties(getJObject(json, "_subsumption"), res.getSubsumptionElement());
27023  }
27024
27025  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
27026    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
27027    parseTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, res);
27028    return res;
27029  }
27030
27031  protected void parseTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
27032    parseBackboneElementProperties(json, res);
27033    if (json.has("code"))
27034      res.setCodeElement(parseString(json.get("code").getAsString()));
27035    if (json.has("_code"))
27036      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
27037    if (json.has("isDefault"))
27038      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
27039    if (json.has("_isDefault"))
27040      parseElementProperties(getJObject(json, "_isDefault"), res.getIsDefaultElement());
27041    if (json.has("compositional"))
27042      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
27043    if (json.has("_compositional"))
27044      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
27045    if (json.has("language")) {
27046      JsonArray array = getJArray(json, "language");
27047      for (int i = 0; i < array.size(); i++) {
27048        if (array.get(i).isJsonNull()) {
27049          res.getLanguage().add(new CodeType());
27050        } else {;
27051          res.getLanguage().add(parseCode(array.get(i).getAsString()));
27052        }
27053      }
27054    };
27055    if (json.has("_language")) {
27056      JsonArray array = getJArray(json, "_language");
27057      for (int i = 0; i < array.size(); i++) {
27058        if (i == res.getLanguage().size())
27059          res.getLanguage().add(parseCode(null));
27060        if (array.get(i) instanceof JsonObject) 
27061          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
27062      }
27063    };
27064    if (json.has("filter")) {
27065      JsonArray array = getJArray(json, "filter");
27066      for (int i = 0; i < array.size(); i++) {
27067        res.getFilter().add(parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject()));
27068      }
27069    };
27070    if (json.has("property")) {
27071      JsonArray array = getJArray(json, "property");
27072      for (int i = 0; i < array.size(); i++) {
27073        if (array.get(i).isJsonNull()) {
27074          res.getProperty().add(new CodeType());
27075        } else {;
27076          res.getProperty().add(parseCode(array.get(i).getAsString()));
27077        }
27078      }
27079    };
27080    if (json.has("_property")) {
27081      JsonArray array = getJArray(json, "_property");
27082      for (int i = 0; i < array.size(); i++) {
27083        if (i == res.getProperty().size())
27084          res.getProperty().add(parseCode(null));
27085        if (array.get(i) instanceof JsonObject) 
27086          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
27087      }
27088    };
27089  }
27090
27091  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
27092    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
27093    parseTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, res);
27094    return res;
27095  }
27096
27097  protected void parseTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
27098    parseBackboneElementProperties(json, res);
27099    if (json.has("code"))
27100      res.setCodeElement(parseCode(json.get("code").getAsString()));
27101    if (json.has("_code"))
27102      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
27103    if (json.has("op")) {
27104      JsonArray array = getJArray(json, "op");
27105      for (int i = 0; i < array.size(); i++) {
27106        if (array.get(i).isJsonNull()) {
27107          res.getOp().add(new CodeType());
27108        } else {;
27109          res.getOp().add(parseCode(array.get(i).getAsString()));
27110        }
27111      }
27112    };
27113    if (json.has("_op")) {
27114      JsonArray array = getJArray(json, "_op");
27115      for (int i = 0; i < array.size(); i++) {
27116        if (i == res.getOp().size())
27117          res.getOp().add(parseCode(null));
27118        if (array.get(i) instanceof JsonObject) 
27119          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
27120      }
27121    };
27122  }
27123
27124  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesExpansionComponent(JsonObject json) throws IOException, FHIRFormatError {
27125    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
27126    parseTerminologyCapabilitiesExpansionComponentProperties(json, res);
27127    return res;
27128  }
27129
27130  protected void parseTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
27131    parseBackboneElementProperties(json, res);
27132    if (json.has("hierarchical"))
27133      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
27134    if (json.has("_hierarchical"))
27135      parseElementProperties(getJObject(json, "_hierarchical"), res.getHierarchicalElement());
27136    if (json.has("paging"))
27137      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
27138    if (json.has("_paging"))
27139      parseElementProperties(getJObject(json, "_paging"), res.getPagingElement());
27140    if (json.has("incomplete"))
27141      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
27142    if (json.has("_incomplete"))
27143      parseElementProperties(getJObject(json, "_incomplete"), res.getIncompleteElement());
27144    if (json.has("parameter")) {
27145      JsonArray array = getJArray(json, "parameter");
27146      for (int i = 0; i < array.size(); i++) {
27147        res.getParameter().add(parseTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject()));
27148      }
27149    };
27150    if (json.has("textFilter"))
27151      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
27152    if (json.has("_textFilter"))
27153      parseElementProperties(getJObject(json, "_textFilter"), res.getTextFilterElement());
27154  }
27155
27156  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesExpansionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
27157    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
27158    parseTerminologyCapabilitiesExpansionParameterComponentProperties(json, res);
27159    return res;
27160  }
27161
27162  protected void parseTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
27163    parseBackboneElementProperties(json, res);
27164    if (json.has("name"))
27165      res.setNameElement(parseCode(json.get("name").getAsString()));
27166    if (json.has("_name"))
27167      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27168    if (json.has("documentation"))
27169      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
27170    if (json.has("_documentation"))
27171      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
27172  }
27173
27174  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesValidateCodeComponent(JsonObject json) throws IOException, FHIRFormatError {
27175    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
27176    parseTerminologyCapabilitiesValidateCodeComponentProperties(json, res);
27177    return res;
27178  }
27179
27180  protected void parseTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
27181    parseBackboneElementProperties(json, res);
27182    if (json.has("translations"))
27183      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
27184    if (json.has("_translations"))
27185      parseElementProperties(getJObject(json, "_translations"), res.getTranslationsElement());
27186  }
27187
27188  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTranslationComponent(JsonObject json) throws IOException, FHIRFormatError {
27189    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
27190    parseTerminologyCapabilitiesTranslationComponentProperties(json, res);
27191    return res;
27192  }
27193
27194  protected void parseTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
27195    parseBackboneElementProperties(json, res);
27196    if (json.has("needsMap"))
27197      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
27198    if (json.has("_needsMap"))
27199      parseElementProperties(getJObject(json, "_needsMap"), res.getNeedsMapElement());
27200  }
27201
27202  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesClosureComponent(JsonObject json) throws IOException, FHIRFormatError {
27203    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
27204    parseTerminologyCapabilitiesClosureComponentProperties(json, res);
27205    return res;
27206  }
27207
27208  protected void parseTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
27209    parseBackboneElementProperties(json, res);
27210    if (json.has("translation"))
27211      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
27212    if (json.has("_translation"))
27213      parseElementProperties(getJObject(json, "_translation"), res.getTranslationElement());
27214  }
27215
27216  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
27217    TestReport res = new TestReport();
27218    parseTestReportProperties(json, res);
27219    return res;
27220  }
27221
27222  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
27223    parseDomainResourceProperties(json, res);
27224    if (json.has("identifier"))
27225      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
27226    if (json.has("name"))
27227      res.setNameElement(parseString(json.get("name").getAsString()));
27228    if (json.has("_name"))
27229      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27230    if (json.has("status"))
27231      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
27232    if (json.has("_status"))
27233      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27234    if (json.has("testScript"))
27235      res.setTestScript(parseReference(getJObject(json, "testScript")));
27236    if (json.has("result"))
27237      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
27238    if (json.has("_result"))
27239      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
27240    if (json.has("score"))
27241      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
27242    if (json.has("_score"))
27243      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
27244    if (json.has("tester"))
27245      res.setTesterElement(parseString(json.get("tester").getAsString()));
27246    if (json.has("_tester"))
27247      parseElementProperties(getJObject(json, "_tester"), res.getTesterElement());
27248    if (json.has("issued"))
27249      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
27250    if (json.has("_issued"))
27251      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
27252    if (json.has("participant")) {
27253      JsonArray array = getJArray(json, "participant");
27254      for (int i = 0; i < array.size(); i++) {
27255        res.getParticipant().add(parseTestReportParticipantComponent(array.get(i).getAsJsonObject()));
27256      }
27257    };
27258    if (json.has("setup"))
27259      res.setSetup(parseTestReportSetupComponent(getJObject(json, "setup")));
27260    if (json.has("test")) {
27261      JsonArray array = getJArray(json, "test");
27262      for (int i = 0; i < array.size(); i++) {
27263        res.getTest().add(parseTestReportTestComponent(array.get(i).getAsJsonObject()));
27264      }
27265    };
27266    if (json.has("teardown"))
27267      res.setTeardown(parseTestReportTeardownComponent(getJObject(json, "teardown")));
27268  }
27269
27270  protected TestReport.TestReportParticipantComponent parseTestReportParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
27271    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
27272    parseTestReportParticipantComponentProperties(json, res);
27273    return res;
27274  }
27275
27276  protected void parseTestReportParticipantComponentProperties(JsonObject json, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
27277    parseBackboneElementProperties(json, res);
27278    if (json.has("type"))
27279      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
27280    if (json.has("_type"))
27281      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27282    if (json.has("uri"))
27283      res.setUriElement(parseUri(json.get("uri").getAsString()));
27284    if (json.has("_uri"))
27285      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
27286    if (json.has("display"))
27287      res.setDisplayElement(parseString(json.get("display").getAsString()));
27288    if (json.has("_display"))
27289      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
27290  }
27291
27292  protected TestReport.TestReportSetupComponent parseTestReportSetupComponent(JsonObject json) throws IOException, FHIRFormatError {
27293    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
27294    parseTestReportSetupComponentProperties(json, res);
27295    return res;
27296  }
27297
27298  protected void parseTestReportSetupComponentProperties(JsonObject json, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
27299    parseBackboneElementProperties(json, res);
27300    if (json.has("action")) {
27301      JsonArray array = getJArray(json, "action");
27302      for (int i = 0; i < array.size(); i++) {
27303        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject()));
27304      }
27305    };
27306  }
27307
27308  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27309    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
27310    parseTestReportSetupActionComponentProperties(json, res);
27311    return res;
27312  }
27313
27314  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
27315    parseBackboneElementProperties(json, res);
27316    if (json.has("operation"))
27317      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation")));
27318    if (json.has("assert"))
27319      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert")));
27320  }
27321
27322  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
27323    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
27324    parseTestReportSetupActionOperationComponentProperties(json, res);
27325    return res;
27326  }
27327
27328  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
27329    parseBackboneElementProperties(json, res);
27330    if (json.has("result"))
27331      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
27332    if (json.has("_result"))
27333      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
27334    if (json.has("message"))
27335      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
27336    if (json.has("_message"))
27337      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
27338    if (json.has("detail"))
27339      res.setDetailElement(parseUri(json.get("detail").getAsString()));
27340    if (json.has("_detail"))
27341      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
27342  }
27343
27344  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json) throws IOException, FHIRFormatError {
27345    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
27346    parseTestReportSetupActionAssertComponentProperties(json, res);
27347    return res;
27348  }
27349
27350  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
27351    parseBackboneElementProperties(json, res);
27352    if (json.has("result"))
27353      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
27354    if (json.has("_result"))
27355      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
27356    if (json.has("message"))
27357      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
27358    if (json.has("_message"))
27359      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
27360    if (json.has("detail"))
27361      res.setDetailElement(parseString(json.get("detail").getAsString()));
27362    if (json.has("_detail"))
27363      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
27364  }
27365
27366  protected TestReport.TestReportTestComponent parseTestReportTestComponent(JsonObject json) throws IOException, FHIRFormatError {
27367    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
27368    parseTestReportTestComponentProperties(json, res);
27369    return res;
27370  }
27371
27372  protected void parseTestReportTestComponentProperties(JsonObject json, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
27373    parseBackboneElementProperties(json, res);
27374    if (json.has("name"))
27375      res.setNameElement(parseString(json.get("name").getAsString()));
27376    if (json.has("_name"))
27377      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27378    if (json.has("description"))
27379      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27380    if (json.has("_description"))
27381      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27382    if (json.has("action")) {
27383      JsonArray array = getJArray(json, "action");
27384      for (int i = 0; i < array.size(); i++) {
27385        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject()));
27386      }
27387    };
27388  }
27389
27390  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27391    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
27392    parseTestReportTestActionComponentProperties(json, res);
27393    return res;
27394  }
27395
27396  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
27397    parseBackboneElementProperties(json, res);
27398    if (json.has("operation"))
27399      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation")));
27400    if (json.has("assert"))
27401      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert")));
27402  }
27403
27404  protected TestReport.TestReportTeardownComponent parseTestReportTeardownComponent(JsonObject json) throws IOException, FHIRFormatError {
27405    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
27406    parseTestReportTeardownComponentProperties(json, res);
27407    return res;
27408  }
27409
27410  protected void parseTestReportTeardownComponentProperties(JsonObject json, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
27411    parseBackboneElementProperties(json, res);
27412    if (json.has("action")) {
27413      JsonArray array = getJArray(json, "action");
27414      for (int i = 0; i < array.size(); i++) {
27415        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject()));
27416      }
27417    };
27418  }
27419
27420  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27421    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
27422    parseTestReportTeardownActionComponentProperties(json, res);
27423    return res;
27424  }
27425
27426  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
27427    parseBackboneElementProperties(json, res);
27428    if (json.has("operation"))
27429      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation")));
27430  }
27431
27432  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
27433    TestScript res = new TestScript();
27434    parseTestScriptProperties(json, res);
27435    return res;
27436  }
27437
27438  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
27439    parseDomainResourceProperties(json, res);
27440    if (json.has("url"))
27441      res.setUrlElement(parseUri(json.get("url").getAsString()));
27442    if (json.has("_url"))
27443      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27444    if (json.has("identifier"))
27445      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
27446    if (json.has("version"))
27447      res.setVersionElement(parseString(json.get("version").getAsString()));
27448    if (json.has("_version"))
27449      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27450    if (json.has("name"))
27451      res.setNameElement(parseString(json.get("name").getAsString()));
27452    if (json.has("_name"))
27453      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27454    if (json.has("title"))
27455      res.setTitleElement(parseString(json.get("title").getAsString()));
27456    if (json.has("_title"))
27457      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27458    if (json.has("status"))
27459      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
27460    if (json.has("_status"))
27461      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27462    if (json.has("experimental"))
27463      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27464    if (json.has("_experimental"))
27465      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
27466    if (json.has("date"))
27467      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27468    if (json.has("_date"))
27469      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
27470    if (json.has("publisher"))
27471      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
27472    if (json.has("_publisher"))
27473      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
27474    if (json.has("contact")) {
27475      JsonArray array = getJArray(json, "contact");
27476      for (int i = 0; i < array.size(); i++) {
27477        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27478      }
27479    };
27480    if (json.has("description"))
27481      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27482    if (json.has("_description"))
27483      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27484    if (json.has("useContext")) {
27485      JsonArray array = getJArray(json, "useContext");
27486      for (int i = 0; i < array.size(); i++) {
27487        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27488      }
27489    };
27490    if (json.has("jurisdiction")) {
27491      JsonArray array = getJArray(json, "jurisdiction");
27492      for (int i = 0; i < array.size(); i++) {
27493        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27494      }
27495    };
27496    if (json.has("purpose"))
27497      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27498    if (json.has("_purpose"))
27499      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
27500    if (json.has("copyright"))
27501      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27502    if (json.has("_copyright"))
27503      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
27504    if (json.has("origin")) {
27505      JsonArray array = getJArray(json, "origin");
27506      for (int i = 0; i < array.size(); i++) {
27507        res.getOrigin().add(parseTestScriptOriginComponent(array.get(i).getAsJsonObject()));
27508      }
27509    };
27510    if (json.has("destination")) {
27511      JsonArray array = getJArray(json, "destination");
27512      for (int i = 0; i < array.size(); i++) {
27513        res.getDestination().add(parseTestScriptDestinationComponent(array.get(i).getAsJsonObject()));
27514      }
27515    };
27516    if (json.has("metadata"))
27517      res.setMetadata(parseTestScriptMetadataComponent(getJObject(json, "metadata")));
27518    if (json.has("fixture")) {
27519      JsonArray array = getJArray(json, "fixture");
27520      for (int i = 0; i < array.size(); i++) {
27521        res.getFixture().add(parseTestScriptFixtureComponent(array.get(i).getAsJsonObject()));
27522      }
27523    };
27524    if (json.has("profile")) {
27525      JsonArray array = getJArray(json, "profile");
27526      for (int i = 0; i < array.size(); i++) {
27527        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
27528      }
27529    };
27530    if (json.has("variable")) {
27531      JsonArray array = getJArray(json, "variable");
27532      for (int i = 0; i < array.size(); i++) {
27533        res.getVariable().add(parseTestScriptVariableComponent(array.get(i).getAsJsonObject()));
27534      }
27535    };
27536    if (json.has("setup"))
27537      res.setSetup(parseTestScriptSetupComponent(getJObject(json, "setup")));
27538    if (json.has("test")) {
27539      JsonArray array = getJArray(json, "test");
27540      for (int i = 0; i < array.size(); i++) {
27541        res.getTest().add(parseTestScriptTestComponent(array.get(i).getAsJsonObject()));
27542      }
27543    };
27544    if (json.has("teardown"))
27545      res.setTeardown(parseTestScriptTeardownComponent(getJObject(json, "teardown")));
27546  }
27547
27548  protected TestScript.TestScriptOriginComponent parseTestScriptOriginComponent(JsonObject json) throws IOException, FHIRFormatError {
27549    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
27550    parseTestScriptOriginComponentProperties(json, res);
27551    return res;
27552  }
27553
27554  protected void parseTestScriptOriginComponentProperties(JsonObject json, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
27555    parseBackboneElementProperties(json, res);
27556    if (json.has("index"))
27557      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
27558    if (json.has("_index"))
27559      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
27560    if (json.has("profile"))
27561      res.setProfile(parseCoding(getJObject(json, "profile")));
27562  }
27563
27564  protected TestScript.TestScriptDestinationComponent parseTestScriptDestinationComponent(JsonObject json) throws IOException, FHIRFormatError {
27565    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
27566    parseTestScriptDestinationComponentProperties(json, res);
27567    return res;
27568  }
27569
27570  protected void parseTestScriptDestinationComponentProperties(JsonObject json, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
27571    parseBackboneElementProperties(json, res);
27572    if (json.has("index"))
27573      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
27574    if (json.has("_index"))
27575      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
27576    if (json.has("profile"))
27577      res.setProfile(parseCoding(getJObject(json, "profile")));
27578  }
27579
27580  protected TestScript.TestScriptMetadataComponent parseTestScriptMetadataComponent(JsonObject json) throws IOException, FHIRFormatError {
27581    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
27582    parseTestScriptMetadataComponentProperties(json, res);
27583    return res;
27584  }
27585
27586  protected void parseTestScriptMetadataComponentProperties(JsonObject json, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
27587    parseBackboneElementProperties(json, res);
27588    if (json.has("link")) {
27589      JsonArray array = getJArray(json, "link");
27590      for (int i = 0; i < array.size(); i++) {
27591        res.getLink().add(parseTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject()));
27592      }
27593    };
27594    if (json.has("capability")) {
27595      JsonArray array = getJArray(json, "capability");
27596      for (int i = 0; i < array.size(); i++) {
27597        res.getCapability().add(parseTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject()));
27598      }
27599    };
27600  }
27601
27602  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptMetadataLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
27603    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
27604    parseTestScriptMetadataLinkComponentProperties(json, res);
27605    return res;
27606  }
27607
27608  protected void parseTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
27609    parseBackboneElementProperties(json, res);
27610    if (json.has("url"))
27611      res.setUrlElement(parseUri(json.get("url").getAsString()));
27612    if (json.has("_url"))
27613      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27614    if (json.has("description"))
27615      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27616    if (json.has("_description"))
27617      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27618  }
27619
27620  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptMetadataCapabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
27621    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
27622    parseTestScriptMetadataCapabilityComponentProperties(json, res);
27623    return res;
27624  }
27625
27626  protected void parseTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
27627    parseBackboneElementProperties(json, res);
27628    if (json.has("required"))
27629      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
27630    if (json.has("_required"))
27631      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
27632    if (json.has("validated"))
27633      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
27634    if (json.has("_validated"))
27635      parseElementProperties(getJObject(json, "_validated"), res.getValidatedElement());
27636    if (json.has("description"))
27637      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27638    if (json.has("_description"))
27639      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27640    if (json.has("origin")) {
27641      JsonArray array = getJArray(json, "origin");
27642      for (int i = 0; i < array.size(); i++) {
27643        if (array.get(i).isJsonNull()) {
27644          res.getOrigin().add(new IntegerType());
27645        } else {;
27646          res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
27647        }
27648      }
27649    };
27650    if (json.has("_origin")) {
27651      JsonArray array = getJArray(json, "_origin");
27652      for (int i = 0; i < array.size(); i++) {
27653        if (i == res.getOrigin().size())
27654          res.getOrigin().add(parseInteger(null));
27655        if (array.get(i) instanceof JsonObject) 
27656          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
27657      }
27658    };
27659    if (json.has("destination"))
27660      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
27661    if (json.has("_destination"))
27662      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
27663    if (json.has("link")) {
27664      JsonArray array = getJArray(json, "link");
27665      for (int i = 0; i < array.size(); i++) {
27666        if (array.get(i).isJsonNull()) {
27667          res.getLink().add(new UriType());
27668        } else {;
27669          res.getLink().add(parseUri(array.get(i).getAsString()));
27670        }
27671      }
27672    };
27673    if (json.has("_link")) {
27674      JsonArray array = getJArray(json, "_link");
27675      for (int i = 0; i < array.size(); i++) {
27676        if (i == res.getLink().size())
27677          res.getLink().add(parseUri(null));
27678        if (array.get(i) instanceof JsonObject) 
27679          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
27680      }
27681    };
27682    if (json.has("capabilities"))
27683      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
27684    if (json.has("_capabilities"))
27685      parseElementProperties(getJObject(json, "_capabilities"), res.getCapabilitiesElement());
27686  }
27687
27688  protected TestScript.TestScriptFixtureComponent parseTestScriptFixtureComponent(JsonObject json) throws IOException, FHIRFormatError {
27689    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
27690    parseTestScriptFixtureComponentProperties(json, res);
27691    return res;
27692  }
27693
27694  protected void parseTestScriptFixtureComponentProperties(JsonObject json, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
27695    parseBackboneElementProperties(json, res);
27696    if (json.has("autocreate"))
27697      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
27698    if (json.has("_autocreate"))
27699      parseElementProperties(getJObject(json, "_autocreate"), res.getAutocreateElement());
27700    if (json.has("autodelete"))
27701      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
27702    if (json.has("_autodelete"))
27703      parseElementProperties(getJObject(json, "_autodelete"), res.getAutodeleteElement());
27704    if (json.has("resource"))
27705      res.setResource(parseReference(getJObject(json, "resource")));
27706  }
27707
27708  protected TestScript.TestScriptVariableComponent parseTestScriptVariableComponent(JsonObject json) throws IOException, FHIRFormatError {
27709    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
27710    parseTestScriptVariableComponentProperties(json, res);
27711    return res;
27712  }
27713
27714  protected void parseTestScriptVariableComponentProperties(JsonObject json, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
27715    parseBackboneElementProperties(json, res);
27716    if (json.has("name"))
27717      res.setNameElement(parseString(json.get("name").getAsString()));
27718    if (json.has("_name"))
27719      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27720    if (json.has("defaultValue"))
27721      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
27722    if (json.has("_defaultValue"))
27723      parseElementProperties(getJObject(json, "_defaultValue"), res.getDefaultValueElement());
27724    if (json.has("description"))
27725      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27726    if (json.has("_description"))
27727      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27728    if (json.has("expression"))
27729      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27730    if (json.has("_expression"))
27731      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
27732    if (json.has("headerField"))
27733      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
27734    if (json.has("_headerField"))
27735      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
27736    if (json.has("hint"))
27737      res.setHintElement(parseString(json.get("hint").getAsString()));
27738    if (json.has("_hint"))
27739      parseElementProperties(getJObject(json, "_hint"), res.getHintElement());
27740    if (json.has("path"))
27741      res.setPathElement(parseString(json.get("path").getAsString()));
27742    if (json.has("_path"))
27743      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
27744    if (json.has("sourceId"))
27745      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27746    if (json.has("_sourceId"))
27747      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
27748  }
27749
27750  protected TestScript.TestScriptSetupComponent parseTestScriptSetupComponent(JsonObject json) throws IOException, FHIRFormatError {
27751    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
27752    parseTestScriptSetupComponentProperties(json, res);
27753    return res;
27754  }
27755
27756  protected void parseTestScriptSetupComponentProperties(JsonObject json, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
27757    parseBackboneElementProperties(json, res);
27758    if (json.has("action")) {
27759      JsonArray array = getJArray(json, "action");
27760      for (int i = 0; i < array.size(); i++) {
27761        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject()));
27762      }
27763    };
27764  }
27765
27766  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27767    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
27768    parseTestScriptSetupActionComponentProperties(json, res);
27769    return res;
27770  }
27771
27772  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
27773    parseBackboneElementProperties(json, res);
27774    if (json.has("operation"))
27775      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation")));
27776    if (json.has("assert"))
27777      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert")));
27778  }
27779
27780  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
27781    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
27782    parseTestScriptSetupActionOperationComponentProperties(json, res);
27783    return res;
27784  }
27785
27786  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
27787    parseBackboneElementProperties(json, res);
27788    if (json.has("type"))
27789      res.setType(parseCoding(getJObject(json, "type")));
27790    if (json.has("resource"))
27791      res.setResourceElement(parseEnumeration(json.get("resource").getAsString(), TestScript.FHIRDefinedType.NULL, new TestScript.FHIRDefinedTypeEnumFactory()));
27792    if (json.has("_resource"))
27793      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
27794    if (json.has("label"))
27795      res.setLabelElement(parseString(json.get("label").getAsString()));
27796    if (json.has("_label"))
27797      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
27798    if (json.has("description"))
27799      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27800    if (json.has("_description"))
27801      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27802    if (json.has("accept"))
27803      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
27804    if (json.has("_accept"))
27805      parseElementProperties(getJObject(json, "_accept"), res.getAcceptElement());
27806    if (json.has("contentType"))
27807      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27808    if (json.has("_contentType"))
27809      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
27810    if (json.has("destination"))
27811      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
27812    if (json.has("_destination"))
27813      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
27814    if (json.has("encodeRequestUrl"))
27815      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
27816    if (json.has("_encodeRequestUrl"))
27817      parseElementProperties(getJObject(json, "_encodeRequestUrl"), res.getEncodeRequestUrlElement());
27818    if (json.has("method"))
27819      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27820    if (json.has("_method"))
27821      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
27822    if (json.has("origin"))
27823      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
27824    if (json.has("_origin"))
27825      parseElementProperties(getJObject(json, "_origin"), res.getOriginElement());
27826    if (json.has("params"))
27827      res.setParamsElement(parseString(json.get("params").getAsString()));
27828    if (json.has("_params"))
27829      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
27830    if (json.has("requestHeader")) {
27831      JsonArray array = getJArray(json, "requestHeader");
27832      for (int i = 0; i < array.size(); i++) {
27833        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject()));
27834      }
27835    };
27836    if (json.has("requestId"))
27837      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
27838    if (json.has("_requestId"))
27839      parseElementProperties(getJObject(json, "_requestId"), res.getRequestIdElement());
27840    if (json.has("responseId"))
27841      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
27842    if (json.has("_responseId"))
27843      parseElementProperties(getJObject(json, "_responseId"), res.getResponseIdElement());
27844    if (json.has("sourceId"))
27845      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27846    if (json.has("_sourceId"))
27847      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
27848    if (json.has("targetId"))
27849      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
27850    if (json.has("_targetId"))
27851      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
27852    if (json.has("url"))
27853      res.setUrlElement(parseString(json.get("url").getAsString()));
27854    if (json.has("_url"))
27855      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27856  }
27857
27858  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json) throws IOException, FHIRFormatError {
27859    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
27860    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, res);
27861    return res;
27862  }
27863
27864  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
27865    parseBackboneElementProperties(json, res);
27866    if (json.has("field"))
27867      res.setFieldElement(parseString(json.get("field").getAsString()));
27868    if (json.has("_field"))
27869      parseElementProperties(getJObject(json, "_field"), res.getFieldElement());
27870    if (json.has("value"))
27871      res.setValueElement(parseString(json.get("value").getAsString()));
27872    if (json.has("_value"))
27873      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
27874  }
27875
27876  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json) throws IOException, FHIRFormatError {
27877    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
27878    parseTestScriptSetupActionAssertComponentProperties(json, res);
27879    return res;
27880  }
27881
27882  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
27883    parseBackboneElementProperties(json, res);
27884    if (json.has("label"))
27885      res.setLabelElement(parseString(json.get("label").getAsString()));
27886    if (json.has("_label"))
27887      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
27888    if (json.has("description"))
27889      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27890    if (json.has("_description"))
27891      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27892    if (json.has("direction"))
27893      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
27894    if (json.has("_direction"))
27895      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
27896    if (json.has("compareToSourceId"))
27897      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
27898    if (json.has("_compareToSourceId"))
27899      parseElementProperties(getJObject(json, "_compareToSourceId"), res.getCompareToSourceIdElement());
27900    if (json.has("compareToSourceExpression"))
27901      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
27902    if (json.has("_compareToSourceExpression"))
27903      parseElementProperties(getJObject(json, "_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
27904    if (json.has("compareToSourcePath"))
27905      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
27906    if (json.has("_compareToSourcePath"))
27907      parseElementProperties(getJObject(json, "_compareToSourcePath"), res.getCompareToSourcePathElement());
27908    if (json.has("contentType"))
27909      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27910    if (json.has("_contentType"))
27911      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
27912    if (json.has("expression"))
27913      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27914    if (json.has("_expression"))
27915      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
27916    if (json.has("headerField"))
27917      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
27918    if (json.has("_headerField"))
27919      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
27920    if (json.has("minimumId"))
27921      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
27922    if (json.has("_minimumId"))
27923      parseElementProperties(getJObject(json, "_minimumId"), res.getMinimumIdElement());
27924    if (json.has("navigationLinks"))
27925      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
27926    if (json.has("_navigationLinks"))
27927      parseElementProperties(getJObject(json, "_navigationLinks"), res.getNavigationLinksElement());
27928    if (json.has("operator"))
27929      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
27930    if (json.has("_operator"))
27931      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
27932    if (json.has("path"))
27933      res.setPathElement(parseString(json.get("path").getAsString()));
27934    if (json.has("_path"))
27935      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
27936    if (json.has("requestMethod"))
27937      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27938    if (json.has("_requestMethod"))
27939      parseElementProperties(getJObject(json, "_requestMethod"), res.getRequestMethodElement());
27940    if (json.has("requestURL"))
27941      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
27942    if (json.has("_requestURL"))
27943      parseElementProperties(getJObject(json, "_requestURL"), res.getRequestURLElement());
27944    if (json.has("resource"))
27945      res.setResourceElement(parseEnumeration(json.get("resource").getAsString(), TestScript.FHIRDefinedType.NULL, new TestScript.FHIRDefinedTypeEnumFactory()));
27946    if (json.has("_resource"))
27947      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
27948    if (json.has("response"))
27949      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
27950    if (json.has("_response"))
27951      parseElementProperties(getJObject(json, "_response"), res.getResponseElement());
27952    if (json.has("responseCode"))
27953      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
27954    if (json.has("_responseCode"))
27955      parseElementProperties(getJObject(json, "_responseCode"), res.getResponseCodeElement());
27956    if (json.has("sourceId"))
27957      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27958    if (json.has("_sourceId"))
27959      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
27960    if (json.has("validateProfileId"))
27961      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
27962    if (json.has("_validateProfileId"))
27963      parseElementProperties(getJObject(json, "_validateProfileId"), res.getValidateProfileIdElement());
27964    if (json.has("value"))
27965      res.setValueElement(parseString(json.get("value").getAsString()));
27966    if (json.has("_value"))
27967      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
27968    if (json.has("warningOnly"))
27969      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
27970    if (json.has("_warningOnly"))
27971      parseElementProperties(getJObject(json, "_warningOnly"), res.getWarningOnlyElement());
27972  }
27973
27974  protected TestScript.TestScriptTestComponent parseTestScriptTestComponent(JsonObject json) throws IOException, FHIRFormatError {
27975    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
27976    parseTestScriptTestComponentProperties(json, res);
27977    return res;
27978  }
27979
27980  protected void parseTestScriptTestComponentProperties(JsonObject json, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
27981    parseBackboneElementProperties(json, res);
27982    if (json.has("name"))
27983      res.setNameElement(parseString(json.get("name").getAsString()));
27984    if (json.has("_name"))
27985      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27986    if (json.has("description"))
27987      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27988    if (json.has("_description"))
27989      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27990    if (json.has("action")) {
27991      JsonArray array = getJArray(json, "action");
27992      for (int i = 0; i < array.size(); i++) {
27993        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject()));
27994      }
27995    };
27996  }
27997
27998  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27999    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
28000    parseTestScriptTestActionComponentProperties(json, res);
28001    return res;
28002  }
28003
28004  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
28005    parseBackboneElementProperties(json, res);
28006    if (json.has("operation"))
28007      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation")));
28008    if (json.has("assert"))
28009      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert")));
28010  }
28011
28012  protected TestScript.TestScriptTeardownComponent parseTestScriptTeardownComponent(JsonObject json) throws IOException, FHIRFormatError {
28013    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
28014    parseTestScriptTeardownComponentProperties(json, res);
28015    return res;
28016  }
28017
28018  protected void parseTestScriptTeardownComponentProperties(JsonObject json, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
28019    parseBackboneElementProperties(json, res);
28020    if (json.has("action")) {
28021      JsonArray array = getJArray(json, "action");
28022      for (int i = 0; i < array.size(); i++) {
28023        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject()));
28024      }
28025    };
28026  }
28027
28028  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json) throws IOException, FHIRFormatError {
28029    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
28030    parseTestScriptTeardownActionComponentProperties(json, res);
28031    return res;
28032  }
28033
28034  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
28035    parseBackboneElementProperties(json, res);
28036    if (json.has("operation"))
28037      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation")));
28038  }
28039
28040  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
28041    ValueSet res = new ValueSet();
28042    parseValueSetProperties(json, res);
28043    return res;
28044  }
28045
28046  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
28047    parseDomainResourceProperties(json, res);
28048    if (json.has("url"))
28049      res.setUrlElement(parseUri(json.get("url").getAsString()));
28050    if (json.has("_url"))
28051      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
28052    if (json.has("identifier")) {
28053      JsonArray array = getJArray(json, "identifier");
28054      for (int i = 0; i < array.size(); i++) {
28055        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28056      }
28057    };
28058    if (json.has("version"))
28059      res.setVersionElement(parseString(json.get("version").getAsString()));
28060    if (json.has("_version"))
28061      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
28062    if (json.has("name"))
28063      res.setNameElement(parseString(json.get("name").getAsString()));
28064    if (json.has("_name"))
28065      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28066    if (json.has("title"))
28067      res.setTitleElement(parseString(json.get("title").getAsString()));
28068    if (json.has("_title"))
28069      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
28070    if (json.has("status"))
28071      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
28072    if (json.has("_status"))
28073      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28074    if (json.has("experimental"))
28075      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
28076    if (json.has("_experimental"))
28077      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
28078    if (json.has("date"))
28079      res.setDateElement(parseDateTime(json.get("date").getAsString()));
28080    if (json.has("_date"))
28081      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
28082    if (json.has("publisher"))
28083      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
28084    if (json.has("_publisher"))
28085      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
28086    if (json.has("contact")) {
28087      JsonArray array = getJArray(json, "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(getJObject(json, "_description"), res.getDescriptionElement());
28096    if (json.has("useContext")) {
28097      JsonArray array = getJArray(json, "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 = getJArray(json, "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("immutable"))
28109      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
28110    if (json.has("_immutable"))
28111      parseElementProperties(getJObject(json, "_immutable"), res.getImmutableElement());
28112    if (json.has("purpose"))
28113      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
28114    if (json.has("_purpose"))
28115      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
28116    if (json.has("copyright"))
28117      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
28118    if (json.has("_copyright"))
28119      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
28120    if (json.has("compose"))
28121      res.setCompose(parseValueSetComposeComponent(getJObject(json, "compose")));
28122    if (json.has("expansion"))
28123      res.setExpansion(parseValueSetExpansionComponent(getJObject(json, "expansion")));
28124  }
28125
28126  protected ValueSet.ValueSetComposeComponent parseValueSetComposeComponent(JsonObject json) throws IOException, FHIRFormatError {
28127    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
28128    parseValueSetComposeComponentProperties(json, res);
28129    return res;
28130  }
28131
28132  protected void parseValueSetComposeComponentProperties(JsonObject json, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
28133    parseBackboneElementProperties(json, res);
28134    if (json.has("lockedDate"))
28135      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
28136    if (json.has("_lockedDate"))
28137      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
28138    if (json.has("inactive"))
28139      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
28140    if (json.has("_inactive"))
28141      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
28142    if (json.has("include")) {
28143      JsonArray array = getJArray(json, "include");
28144      for (int i = 0; i < array.size(); i++) {
28145        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject()));
28146      }
28147    };
28148    if (json.has("exclude")) {
28149      JsonArray array = getJArray(json, "exclude");
28150      for (int i = 0; i < array.size(); i++) {
28151        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject()));
28152      }
28153    };
28154  }
28155
28156  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json) throws IOException, FHIRFormatError {
28157    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
28158    parseValueSetConceptSetComponentProperties(json, res);
28159    return res;
28160  }
28161
28162  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
28163    parseBackboneElementProperties(json, res);
28164    if (json.has("system"))
28165      res.setSystemElement(parseUri(json.get("system").getAsString()));
28166    if (json.has("_system"))
28167      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
28168    if (json.has("version"))
28169      res.setVersionElement(parseString(json.get("version").getAsString()));
28170    if (json.has("_version"))
28171      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
28172    if (json.has("concept")) {
28173      JsonArray array = getJArray(json, "concept");
28174      for (int i = 0; i < array.size(); i++) {
28175        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject()));
28176      }
28177    };
28178    if (json.has("filter")) {
28179      JsonArray array = getJArray(json, "filter");
28180      for (int i = 0; i < array.size(); i++) {
28181        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject()));
28182      }
28183    };
28184    if (json.has("valueSet")) {
28185      JsonArray array = getJArray(json, "valueSet");
28186      for (int i = 0; i < array.size(); i++) {
28187        if (array.get(i).isJsonNull()) {
28188          res.getValueSet().add(new CanonicalType());
28189        } else {;
28190          res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
28191        }
28192      }
28193    };
28194    if (json.has("_valueSet")) {
28195      JsonArray array = getJArray(json, "_valueSet");
28196      for (int i = 0; i < array.size(); i++) {
28197        if (i == res.getValueSet().size())
28198          res.getValueSet().add(parseCanonical(null));
28199        if (array.get(i) instanceof JsonObject) 
28200          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
28201      }
28202    };
28203  }
28204
28205  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json) throws IOException, FHIRFormatError {
28206    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
28207    parseValueSetConceptReferenceComponentProperties(json, res);
28208    return res;
28209  }
28210
28211  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
28212    parseBackboneElementProperties(json, res);
28213    if (json.has("code"))
28214      res.setCodeElement(parseCode(json.get("code").getAsString()));
28215    if (json.has("_code"))
28216      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
28217    if (json.has("display"))
28218      res.setDisplayElement(parseString(json.get("display").getAsString()));
28219    if (json.has("_display"))
28220      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
28221    if (json.has("designation")) {
28222      JsonArray array = getJArray(json, "designation");
28223      for (int i = 0; i < array.size(); i++) {
28224        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject()));
28225      }
28226    };
28227  }
28228
28229  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
28230    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
28231    parseValueSetConceptReferenceDesignationComponentProperties(json, res);
28232    return res;
28233  }
28234
28235  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
28236    parseBackboneElementProperties(json, res);
28237    if (json.has("language"))
28238      res.setLanguageElement(parseCode(json.get("language").getAsString()));
28239    if (json.has("_language"))
28240      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
28241    if (json.has("use"))
28242      res.setUse(parseCoding(getJObject(json, "use")));
28243    if (json.has("value"))
28244      res.setValueElement(parseString(json.get("value").getAsString()));
28245    if (json.has("_value"))
28246      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
28247  }
28248
28249  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
28250    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
28251    parseValueSetConceptSetFilterComponentProperties(json, res);
28252    return res;
28253  }
28254
28255  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
28256    parseBackboneElementProperties(json, res);
28257    if (json.has("property"))
28258      res.setPropertyElement(parseCode(json.get("property").getAsString()));
28259    if (json.has("_property"))
28260      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
28261    if (json.has("op"))
28262      res.setOpElement(parseEnumeration(json.get("op").getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
28263    if (json.has("_op"))
28264      parseElementProperties(getJObject(json, "_op"), res.getOpElement());
28265    if (json.has("value"))
28266      res.setValueElement(parseString(json.get("value").getAsString()));
28267    if (json.has("_value"))
28268      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
28269  }
28270
28271  protected ValueSet.ValueSetExpansionComponent parseValueSetExpansionComponent(JsonObject json) throws IOException, FHIRFormatError {
28272    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
28273    parseValueSetExpansionComponentProperties(json, res);
28274    return res;
28275  }
28276
28277  protected void parseValueSetExpansionComponentProperties(JsonObject json, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
28278    parseBackboneElementProperties(json, res);
28279    if (json.has("identifier"))
28280      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
28281    if (json.has("_identifier"))
28282      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
28283    if (json.has("timestamp"))
28284      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
28285    if (json.has("_timestamp"))
28286      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
28287    if (json.has("total"))
28288      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
28289    if (json.has("_total"))
28290      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
28291    if (json.has("offset"))
28292      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
28293    if (json.has("_offset"))
28294      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
28295    if (json.has("parameter")) {
28296      JsonArray array = getJArray(json, "parameter");
28297      for (int i = 0; i < array.size(); i++) {
28298        res.getParameter().add(parseValueSetExpansionParameterComponent(array.get(i).getAsJsonObject()));
28299      }
28300    };
28301    if (json.has("contains")) {
28302      JsonArray array = getJArray(json, "contains");
28303      for (int i = 0; i < array.size(); i++) {
28304        res.getContains().add(parseValueSetExpansionContainsComponent(array.get(i).getAsJsonObject()));
28305      }
28306    };
28307  }
28308
28309  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetExpansionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
28310    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
28311    parseValueSetExpansionParameterComponentProperties(json, res);
28312    return res;
28313  }
28314
28315  protected void parseValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
28316    parseBackboneElementProperties(json, res);
28317    if (json.has("name"))
28318      res.setNameElement(parseString(json.get("name").getAsString()));
28319    if (json.has("_name"))
28320      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28321    DataType value = parseType("value", json);
28322    if (value != null)
28323      res.setValue(value);
28324  }
28325
28326  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetExpansionContainsComponent(JsonObject json) throws IOException, FHIRFormatError {
28327    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
28328    parseValueSetExpansionContainsComponentProperties(json, res);
28329    return res;
28330  }
28331
28332  protected void parseValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
28333    parseBackboneElementProperties(json, res);
28334    if (json.has("system"))
28335      res.setSystemElement(parseUri(json.get("system").getAsString()));
28336    if (json.has("_system"))
28337      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
28338    if (json.has("abstract"))
28339      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
28340    if (json.has("_abstract"))
28341      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
28342    if (json.has("inactive"))
28343      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
28344    if (json.has("_inactive"))
28345      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
28346    if (json.has("version"))
28347      res.setVersionElement(parseString(json.get("version").getAsString()));
28348    if (json.has("_version"))
28349      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
28350    if (json.has("code"))
28351      res.setCodeElement(parseCode(json.get("code").getAsString()));
28352    if (json.has("_code"))
28353      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
28354    if (json.has("display"))
28355      res.setDisplayElement(parseString(json.get("display").getAsString()));
28356    if (json.has("_display"))
28357      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
28358    if (json.has("designation")) {
28359      JsonArray array = getJArray(json, "designation");
28360      for (int i = 0; i < array.size(); i++) {
28361        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject()));
28362      }
28363    };
28364    if (json.has("contains")) {
28365      JsonArray array = getJArray(json, "contains");
28366      for (int i = 0; i < array.size(); i++) {
28367        res.getContains().add(parseValueSetExpansionContainsComponent(array.get(i).getAsJsonObject()));
28368      }
28369    };
28370  }
28371
28372  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
28373    VerificationResult res = new VerificationResult();
28374    parseVerificationResultProperties(json, res);
28375    return res;
28376  }
28377
28378  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
28379    parseDomainResourceProperties(json, res);
28380    if (json.has("target")) {
28381      JsonArray array = getJArray(json, "target");
28382      for (int i = 0; i < array.size(); i++) {
28383        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
28384      }
28385    };
28386    if (json.has("targetLocation")) {
28387      JsonArray array = getJArray(json, "targetLocation");
28388      for (int i = 0; i < array.size(); i++) {
28389        if (array.get(i).isJsonNull()) {
28390          res.getTargetLocation().add(new StringType());
28391        } else {;
28392          res.getTargetLocation().add(parseString(array.get(i).getAsString()));
28393        }
28394      }
28395    };
28396    if (json.has("_targetLocation")) {
28397      JsonArray array = getJArray(json, "_targetLocation");
28398      for (int i = 0; i < array.size(); i++) {
28399        if (i == res.getTargetLocation().size())
28400          res.getTargetLocation().add(parseString(null));
28401        if (array.get(i) instanceof JsonObject) 
28402          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
28403      }
28404    };
28405    if (json.has("need"))
28406      res.setNeed(parseCodeableConcept(getJObject(json, "need")));
28407    if (json.has("status"))
28408      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
28409    if (json.has("_status"))
28410      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28411    if (json.has("statusDate"))
28412      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
28413    if (json.has("_statusDate"))
28414      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
28415    if (json.has("validationType"))
28416      res.setValidationType(parseCodeableConcept(getJObject(json, "validationType")));
28417    if (json.has("validationProcess")) {
28418      JsonArray array = getJArray(json, "validationProcess");
28419      for (int i = 0; i < array.size(); i++) {
28420        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28421      }
28422    };
28423    if (json.has("frequency"))
28424      res.setFrequency(parseTiming(getJObject(json, "frequency")));
28425    if (json.has("lastPerformed"))
28426      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
28427    if (json.has("_lastPerformed"))
28428      parseElementProperties(getJObject(json, "_lastPerformed"), res.getLastPerformedElement());
28429    if (json.has("nextScheduled"))
28430      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
28431    if (json.has("_nextScheduled"))
28432      parseElementProperties(getJObject(json, "_nextScheduled"), res.getNextScheduledElement());
28433    if (json.has("failureAction"))
28434      res.setFailureAction(parseCodeableConcept(getJObject(json, "failureAction")));
28435    if (json.has("primarySource")) {
28436      JsonArray array = getJArray(json, "primarySource");
28437      for (int i = 0; i < array.size(); i++) {
28438        res.getPrimarySource().add(parseVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject()));
28439      }
28440    };
28441    if (json.has("attestation"))
28442      res.setAttestation(parseVerificationResultAttestationComponent(getJObject(json, "attestation")));
28443    if (json.has("validator")) {
28444      JsonArray array = getJArray(json, "validator");
28445      for (int i = 0; i < array.size(); i++) {
28446        res.getValidator().add(parseVerificationResultValidatorComponent(array.get(i).getAsJsonObject()));
28447      }
28448    };
28449  }
28450
28451  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultPrimarySourceComponent(JsonObject json) throws IOException, FHIRFormatError {
28452    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
28453    parseVerificationResultPrimarySourceComponentProperties(json, res);
28454    return res;
28455  }
28456
28457  protected void parseVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
28458    parseBackboneElementProperties(json, res);
28459    if (json.has("who"))
28460      res.setWho(parseReference(getJObject(json, "who")));
28461    if (json.has("type")) {
28462      JsonArray array = getJArray(json, "type");
28463      for (int i = 0; i < array.size(); i++) {
28464        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28465      }
28466    };
28467    if (json.has("communicationMethod")) {
28468      JsonArray array = getJArray(json, "communicationMethod");
28469      for (int i = 0; i < array.size(); i++) {
28470        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28471      }
28472    };
28473    if (json.has("validationStatus"))
28474      res.setValidationStatus(parseCodeableConcept(getJObject(json, "validationStatus")));
28475    if (json.has("validationDate"))
28476      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
28477    if (json.has("_validationDate"))
28478      parseElementProperties(getJObject(json, "_validationDate"), res.getValidationDateElement());
28479    if (json.has("canPushUpdates"))
28480      res.setCanPushUpdates(parseCodeableConcept(getJObject(json, "canPushUpdates")));
28481    if (json.has("pushTypeAvailable")) {
28482      JsonArray array = getJArray(json, "pushTypeAvailable");
28483      for (int i = 0; i < array.size(); i++) {
28484        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28485      }
28486    };
28487  }
28488
28489  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultAttestationComponent(JsonObject json) throws IOException, FHIRFormatError {
28490    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
28491    parseVerificationResultAttestationComponentProperties(json, res);
28492    return res;
28493  }
28494
28495  protected void parseVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
28496    parseBackboneElementProperties(json, res);
28497    if (json.has("who"))
28498      res.setWho(parseReference(getJObject(json, "who")));
28499    if (json.has("onBehalfOf"))
28500      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
28501    if (json.has("communicationMethod"))
28502      res.setCommunicationMethod(parseCodeableConcept(getJObject(json, "communicationMethod")));
28503    if (json.has("date"))
28504      res.setDateElement(parseDate(json.get("date").getAsString()));
28505    if (json.has("_date"))
28506      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
28507    if (json.has("sourceIdentityCertificate"))
28508      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
28509    if (json.has("_sourceIdentityCertificate"))
28510      parseElementProperties(getJObject(json, "_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
28511    if (json.has("proxyIdentityCertificate"))
28512      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
28513    if (json.has("_proxyIdentityCertificate"))
28514      parseElementProperties(getJObject(json, "_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
28515    if (json.has("proxySignature"))
28516      res.setProxySignature(parseSignature(getJObject(json, "proxySignature")));
28517    if (json.has("sourceSignature"))
28518      res.setSourceSignature(parseSignature(getJObject(json, "sourceSignature")));
28519  }
28520
28521  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultValidatorComponent(JsonObject json) throws IOException, FHIRFormatError {
28522    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
28523    parseVerificationResultValidatorComponentProperties(json, res);
28524    return res;
28525  }
28526
28527  protected void parseVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
28528    parseBackboneElementProperties(json, res);
28529    if (json.has("organization"))
28530      res.setOrganization(parseReference(getJObject(json, "organization")));
28531    if (json.has("identityCertificate"))
28532      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
28533    if (json.has("_identityCertificate"))
28534      parseElementProperties(getJObject(json, "_identityCertificate"), res.getIdentityCertificateElement());
28535    if (json.has("attestationSignature"))
28536      res.setAttestationSignature(parseSignature(getJObject(json, "attestationSignature")));
28537  }
28538
28539  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
28540    VisionPrescription res = new VisionPrescription();
28541    parseVisionPrescriptionProperties(json, res);
28542    return res;
28543  }
28544
28545  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
28546    parseDomainResourceProperties(json, res);
28547    if (json.has("identifier")) {
28548      JsonArray array = getJArray(json, "identifier");
28549      for (int i = 0; i < array.size(); i++) {
28550        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28551      }
28552    };
28553    if (json.has("status"))
28554      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
28555    if (json.has("_status"))
28556      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28557    if (json.has("created"))
28558      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
28559    if (json.has("_created"))
28560      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
28561    if (json.has("patient"))
28562      res.setPatient(parseReference(getJObject(json, "patient")));
28563    if (json.has("encounter"))
28564      res.setEncounter(parseReference(getJObject(json, "encounter")));
28565    if (json.has("dateWritten"))
28566      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
28567    if (json.has("_dateWritten"))
28568      parseElementProperties(getJObject(json, "_dateWritten"), res.getDateWrittenElement());
28569    if (json.has("prescriber"))
28570      res.setPrescriber(parseReference(getJObject(json, "prescriber")));
28571    if (json.has("lensSpecification")) {
28572      JsonArray array = getJArray(json, "lensSpecification");
28573      for (int i = 0; i < array.size(); i++) {
28574        res.getLensSpecification().add(parseVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject()));
28575      }
28576    };
28577  }
28578
28579  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionLensSpecificationComponent(JsonObject json) throws IOException, FHIRFormatError {
28580    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
28581    parseVisionPrescriptionLensSpecificationComponentProperties(json, res);
28582    return res;
28583  }
28584
28585  protected void parseVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
28586    parseBackboneElementProperties(json, res);
28587    if (json.has("product"))
28588      res.setProduct(parseCodeableConcept(getJObject(json, "product")));
28589    if (json.has("eye"))
28590      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
28591    if (json.has("_eye"))
28592      parseElementProperties(getJObject(json, "_eye"), res.getEyeElement());
28593    if (json.has("sphere"))
28594      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
28595    if (json.has("_sphere"))
28596      parseElementProperties(getJObject(json, "_sphere"), res.getSphereElement());
28597    if (json.has("cylinder"))
28598      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
28599    if (json.has("_cylinder"))
28600      parseElementProperties(getJObject(json, "_cylinder"), res.getCylinderElement());
28601    if (json.has("axis"))
28602      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
28603    if (json.has("_axis"))
28604      parseElementProperties(getJObject(json, "_axis"), res.getAxisElement());
28605    if (json.has("prism")) {
28606      JsonArray array = getJArray(json, "prism");
28607      for (int i = 0; i < array.size(); i++) {
28608        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject()));
28609      }
28610    };
28611    if (json.has("add"))
28612      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
28613    if (json.has("_add"))
28614      parseElementProperties(getJObject(json, "_add"), res.getAddElement());
28615    if (json.has("power"))
28616      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
28617    if (json.has("_power"))
28618      parseElementProperties(getJObject(json, "_power"), res.getPowerElement());
28619    if (json.has("backCurve"))
28620      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
28621    if (json.has("_backCurve"))
28622      parseElementProperties(getJObject(json, "_backCurve"), res.getBackCurveElement());
28623    if (json.has("diameter"))
28624      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
28625    if (json.has("_diameter"))
28626      parseElementProperties(getJObject(json, "_diameter"), res.getDiameterElement());
28627    if (json.has("duration"))
28628      res.setDuration(parseQuantity(getJObject(json, "duration")));
28629    if (json.has("color"))
28630      res.setColorElement(parseString(json.get("color").getAsString()));
28631    if (json.has("_color"))
28632      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
28633    if (json.has("brand"))
28634      res.setBrandElement(parseString(json.get("brand").getAsString()));
28635    if (json.has("_brand"))
28636      parseElementProperties(getJObject(json, "_brand"), res.getBrandElement());
28637    if (json.has("note")) {
28638      JsonArray array = getJArray(json, "note");
28639      for (int i = 0; i < array.size(); i++) {
28640        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
28641      }
28642    };
28643  }
28644
28645  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json) throws IOException, FHIRFormatError {
28646    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
28647    parseVisionPrescriptionPrismComponentProperties(json, res);
28648    return res;
28649  }
28650
28651  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
28652    parseBackboneElementProperties(json, res);
28653    if (json.has("amount"))
28654      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
28655    if (json.has("_amount"))
28656      parseElementProperties(getJObject(json, "_amount"), res.getAmountElement());
28657    if (json.has("base"))
28658      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
28659    if (json.has("_base"))
28660      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
28661  }
28662
28663
28664  
28665  @Override
28666  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
28667    if (!json.has("resourceType")) {
28668      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28669    }
28670    String t = json.get("resourceType").getAsString();
28671    if (Utilities.noString(t)) {
28672      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28673    } else if (t.equals("Account")) {
28674      return parseAccount(json);
28675    } else if (t.equals("ActivityDefinition")) {
28676      return parseActivityDefinition(json);
28677    } else if (t.equals("AdministrableProductDefinition")) {
28678      return parseAdministrableProductDefinition(json);
28679    } else if (t.equals("AdverseEvent")) {
28680      return parseAdverseEvent(json);
28681    } else if (t.equals("AllergyIntolerance")) {
28682      return parseAllergyIntolerance(json);
28683    } else if (t.equals("Appointment")) {
28684      return parseAppointment(json);
28685    } else if (t.equals("AppointmentResponse")) {
28686      return parseAppointmentResponse(json);
28687    } else if (t.equals("AuditEvent")) {
28688      return parseAuditEvent(json);
28689    } else if (t.equals("Basic")) {
28690      return parseBasic(json);
28691    } else if (t.equals("Binary")) {
28692      return parseBinary(json);
28693    } else if (t.equals("BiologicallyDerivedProduct")) {
28694      return parseBiologicallyDerivedProduct(json);
28695    } else if (t.equals("BodyStructure")) {
28696      return parseBodyStructure(json);
28697    } else if (t.equals("Bundle")) {
28698      return parseBundle(json);
28699    } else if (t.equals("CapabilityStatement")) {
28700      return parseCapabilityStatement(json);
28701    } else if (t.equals("CarePlan")) {
28702      return parseCarePlan(json);
28703    } else if (t.equals("CareTeam")) {
28704      return parseCareTeam(json);
28705    } else if (t.equals("CatalogEntry")) {
28706      return parseCatalogEntry(json);
28707    } else if (t.equals("ChargeItem")) {
28708      return parseChargeItem(json);
28709    } else if (t.equals("ChargeItemDefinition")) {
28710      return parseChargeItemDefinition(json);
28711    } else if (t.equals("Citation")) {
28712      return parseCitation(json);
28713    } else if (t.equals("Claim")) {
28714      return parseClaim(json);
28715    } else if (t.equals("ClaimResponse")) {
28716      return parseClaimResponse(json);
28717    } else if (t.equals("ClinicalImpression")) {
28718      return parseClinicalImpression(json);
28719    } else if (t.equals("ClinicalUseDefinition")) {
28720      return parseClinicalUseDefinition(json);
28721    } else if (t.equals("CodeSystem")) {
28722      return parseCodeSystem(json);
28723    } else if (t.equals("Communication")) {
28724      return parseCommunication(json);
28725    } else if (t.equals("CommunicationRequest")) {
28726      return parseCommunicationRequest(json);
28727    } else if (t.equals("CompartmentDefinition")) {
28728      return parseCompartmentDefinition(json);
28729    } else if (t.equals("Composition")) {
28730      return parseComposition(json);
28731    } else if (t.equals("ConceptMap")) {
28732      return parseConceptMap(json);
28733    } else if (t.equals("Condition")) {
28734      return parseCondition(json);
28735    } else if (t.equals("Consent")) {
28736      return parseConsent(json);
28737    } else if (t.equals("Contract")) {
28738      return parseContract(json);
28739    } else if (t.equals("Coverage")) {
28740      return parseCoverage(json);
28741    } else if (t.equals("CoverageEligibilityRequest")) {
28742      return parseCoverageEligibilityRequest(json);
28743    } else if (t.equals("CoverageEligibilityResponse")) {
28744      return parseCoverageEligibilityResponse(json);
28745    } else if (t.equals("DetectedIssue")) {
28746      return parseDetectedIssue(json);
28747    } else if (t.equals("Device")) {
28748      return parseDevice(json);
28749    } else if (t.equals("DeviceDefinition")) {
28750      return parseDeviceDefinition(json);
28751    } else if (t.equals("DeviceMetric")) {
28752      return parseDeviceMetric(json);
28753    } else if (t.equals("DeviceRequest")) {
28754      return parseDeviceRequest(json);
28755    } else if (t.equals("DeviceUseStatement")) {
28756      return parseDeviceUseStatement(json);
28757    } else if (t.equals("DiagnosticReport")) {
28758      return parseDiagnosticReport(json);
28759    } else if (t.equals("DocumentManifest")) {
28760      return parseDocumentManifest(json);
28761    } else if (t.equals("DocumentReference")) {
28762      return parseDocumentReference(json);
28763    } else if (t.equals("Encounter")) {
28764      return parseEncounter(json);
28765    } else if (t.equals("Endpoint")) {
28766      return parseEndpoint(json);
28767    } else if (t.equals("EnrollmentRequest")) {
28768      return parseEnrollmentRequest(json);
28769    } else if (t.equals("EnrollmentResponse")) {
28770      return parseEnrollmentResponse(json);
28771    } else if (t.equals("EpisodeOfCare")) {
28772      return parseEpisodeOfCare(json);
28773    } else if (t.equals("EventDefinition")) {
28774      return parseEventDefinition(json);
28775    } else if (t.equals("Evidence")) {
28776      return parseEvidence(json);
28777    } else if (t.equals("EvidenceReport")) {
28778      return parseEvidenceReport(json);
28779    } else if (t.equals("EvidenceVariable")) {
28780      return parseEvidenceVariable(json);
28781    } else if (t.equals("ExampleScenario")) {
28782      return parseExampleScenario(json);
28783    } else if (t.equals("ExplanationOfBenefit")) {
28784      return parseExplanationOfBenefit(json);
28785    } else if (t.equals("FamilyMemberHistory")) {
28786      return parseFamilyMemberHistory(json);
28787    } else if (t.equals("Flag")) {
28788      return parseFlag(json);
28789    } else if (t.equals("Goal")) {
28790      return parseGoal(json);
28791    } else if (t.equals("GraphDefinition")) {
28792      return parseGraphDefinition(json);
28793    } else if (t.equals("Group")) {
28794      return parseGroup(json);
28795    } else if (t.equals("GuidanceResponse")) {
28796      return parseGuidanceResponse(json);
28797    } else if (t.equals("HealthcareService")) {
28798      return parseHealthcareService(json);
28799    } else if (t.equals("ImagingStudy")) {
28800      return parseImagingStudy(json);
28801    } else if (t.equals("Immunization")) {
28802      return parseImmunization(json);
28803    } else if (t.equals("ImmunizationEvaluation")) {
28804      return parseImmunizationEvaluation(json);
28805    } else if (t.equals("ImmunizationRecommendation")) {
28806      return parseImmunizationRecommendation(json);
28807    } else if (t.equals("ImplementationGuide")) {
28808      return parseImplementationGuide(json);
28809    } else if (t.equals("Ingredient")) {
28810      return parseIngredient(json);
28811    } else if (t.equals("InsurancePlan")) {
28812      return parseInsurancePlan(json);
28813    } else if (t.equals("Invoice")) {
28814      return parseInvoice(json);
28815    } else if (t.equals("Library")) {
28816      return parseLibrary(json);
28817    } else if (t.equals("Linkage")) {
28818      return parseLinkage(json);
28819    } else if (t.equals("List")) {
28820      return parseListResource(json);
28821    } else if (t.equals("Location")) {
28822      return parseLocation(json);
28823    } else if (t.equals("ManufacturedItemDefinition")) {
28824      return parseManufacturedItemDefinition(json);
28825    } else if (t.equals("Measure")) {
28826      return parseMeasure(json);
28827    } else if (t.equals("MeasureReport")) {
28828      return parseMeasureReport(json);
28829    } else if (t.equals("Media")) {
28830      return parseMedia(json);
28831    } else if (t.equals("Medication")) {
28832      return parseMedication(json);
28833    } else if (t.equals("MedicationAdministration")) {
28834      return parseMedicationAdministration(json);
28835    } else if (t.equals("MedicationDispense")) {
28836      return parseMedicationDispense(json);
28837    } else if (t.equals("MedicationKnowledge")) {
28838      return parseMedicationKnowledge(json);
28839    } else if (t.equals("MedicationRequest")) {
28840      return parseMedicationRequest(json);
28841    } else if (t.equals("MedicationStatement")) {
28842      return parseMedicationStatement(json);
28843    } else if (t.equals("MedicinalProductDefinition")) {
28844      return parseMedicinalProductDefinition(json);
28845    } else if (t.equals("MessageDefinition")) {
28846      return parseMessageDefinition(json);
28847    } else if (t.equals("MessageHeader")) {
28848      return parseMessageHeader(json);
28849    } else if (t.equals("MolecularSequence")) {
28850      return parseMolecularSequence(json);
28851    } else if (t.equals("NamingSystem")) {
28852      return parseNamingSystem(json);
28853    } else if (t.equals("NutritionOrder")) {
28854      return parseNutritionOrder(json);
28855    } else if (t.equals("NutritionProduct")) {
28856      return parseNutritionProduct(json);
28857    } else if (t.equals("Observation")) {
28858      return parseObservation(json);
28859    } else if (t.equals("ObservationDefinition")) {
28860      return parseObservationDefinition(json);
28861    } else if (t.equals("OperationDefinition")) {
28862      return parseOperationDefinition(json);
28863    } else if (t.equals("OperationOutcome")) {
28864      return parseOperationOutcome(json);
28865    } else if (t.equals("Organization")) {
28866      return parseOrganization(json);
28867    } else if (t.equals("OrganizationAffiliation")) {
28868      return parseOrganizationAffiliation(json);
28869    } else if (t.equals("PackagedProductDefinition")) {
28870      return parsePackagedProductDefinition(json);
28871    } else if (t.equals("Parameters")) {
28872      return parseParameters(json);
28873    } else if (t.equals("Patient")) {
28874      return parsePatient(json);
28875    } else if (t.equals("PaymentNotice")) {
28876      return parsePaymentNotice(json);
28877    } else if (t.equals("PaymentReconciliation")) {
28878      return parsePaymentReconciliation(json);
28879    } else if (t.equals("Person")) {
28880      return parsePerson(json);
28881    } else if (t.equals("PlanDefinition")) {
28882      return parsePlanDefinition(json);
28883    } else if (t.equals("Practitioner")) {
28884      return parsePractitioner(json);
28885    } else if (t.equals("PractitionerRole")) {
28886      return parsePractitionerRole(json);
28887    } else if (t.equals("Procedure")) {
28888      return parseProcedure(json);
28889    } else if (t.equals("Provenance")) {
28890      return parseProvenance(json);
28891    } else if (t.equals("Questionnaire")) {
28892      return parseQuestionnaire(json);
28893    } else if (t.equals("QuestionnaireResponse")) {
28894      return parseQuestionnaireResponse(json);
28895    } else if (t.equals("RegulatedAuthorization")) {
28896      return parseRegulatedAuthorization(json);
28897    } else if (t.equals("RelatedPerson")) {
28898      return parseRelatedPerson(json);
28899    } else if (t.equals("RequestGroup")) {
28900      return parseRequestGroup(json);
28901    } else if (t.equals("ResearchDefinition")) {
28902      return parseResearchDefinition(json);
28903    } else if (t.equals("ResearchElementDefinition")) {
28904      return parseResearchElementDefinition(json);
28905    } else if (t.equals("ResearchStudy")) {
28906      return parseResearchStudy(json);
28907    } else if (t.equals("ResearchSubject")) {
28908      return parseResearchSubject(json);
28909    } else if (t.equals("RiskAssessment")) {
28910      return parseRiskAssessment(json);
28911    } else if (t.equals("Schedule")) {
28912      return parseSchedule(json);
28913    } else if (t.equals("SearchParameter")) {
28914      return parseSearchParameter(json);
28915    } else if (t.equals("ServiceRequest")) {
28916      return parseServiceRequest(json);
28917    } else if (t.equals("Slot")) {
28918      return parseSlot(json);
28919    } else if (t.equals("Specimen")) {
28920      return parseSpecimen(json);
28921    } else if (t.equals("SpecimenDefinition")) {
28922      return parseSpecimenDefinition(json);
28923    } else if (t.equals("StructureDefinition")) {
28924      return parseStructureDefinition(json);
28925    } else if (t.equals("StructureMap")) {
28926      return parseStructureMap(json);
28927    } else if (t.equals("Subscription")) {
28928      return parseSubscription(json);
28929    } else if (t.equals("SubscriptionStatus")) {
28930      return parseSubscriptionStatus(json);
28931    } else if (t.equals("SubscriptionTopic")) {
28932      return parseSubscriptionTopic(json);
28933    } else if (t.equals("Substance")) {
28934      return parseSubstance(json);
28935    } else if (t.equals("SubstanceDefinition")) {
28936      return parseSubstanceDefinition(json);
28937    } else if (t.equals("SupplyDelivery")) {
28938      return parseSupplyDelivery(json);
28939    } else if (t.equals("SupplyRequest")) {
28940      return parseSupplyRequest(json);
28941    } else if (t.equals("Task")) {
28942      return parseTask(json);
28943    } else if (t.equals("TerminologyCapabilities")) {
28944      return parseTerminologyCapabilities(json);
28945    } else if (t.equals("TestReport")) {
28946      return parseTestReport(json);
28947    } else if (t.equals("TestScript")) {
28948      return parseTestScript(json);
28949    } else if (t.equals("ValueSet")) {
28950      return parseValueSet(json);
28951    } else if (t.equals("VerificationResult")) {
28952      return parseVerificationResult(json);
28953    } else if (t.equals("VisionPrescription")) {
28954      return parseVisionPrescription(json);
28955
28956    } else {
28957      throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
28958    }
28959  }
28960
28961  protected DataType parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
28962    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
28963      DataType t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
28964      if (json.has("_"+prefix+"Date"))
28965        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
28966      return t;
28967    }
28968    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
28969      DataType t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
28970      if (json.has("_"+prefix+"DateTime"))
28971        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
28972      return t;
28973    }
28974    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
28975      DataType t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
28976      if (json.has("_"+prefix+"Code"))
28977        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
28978      return t;
28979    }
28980    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
28981      DataType t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
28982      if (json.has("_"+prefix+"String"))
28983        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
28984      return t;
28985    }
28986    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
28987      DataType t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
28988      if (json.has("_"+prefix+"Integer"))
28989        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
28990      return t;
28991    }
28992    else if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64")) {
28993      DataType t = json.has(prefix+"Integer64") ? parseInteger64(json.get(prefix+"Integer64").getAsLong()) : new Integer64Type();
28994      if (json.has("_"+prefix+"Integer64"))
28995        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer64"), t);
28996      return t;
28997    }
28998    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
28999      DataType t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
29000      if (json.has("_"+prefix+"Oid"))
29001        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
29002      return t;
29003    }
29004    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
29005      DataType t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
29006      if (json.has("_"+prefix+"Canonical"))
29007        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
29008      return t;
29009    }
29010    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
29011      DataType t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
29012      if (json.has("_"+prefix+"Uri"))
29013        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
29014      return t;
29015    }
29016    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
29017      DataType t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
29018      if (json.has("_"+prefix+"Uuid"))
29019        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
29020      return t;
29021    }
29022    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
29023      DataType t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
29024      if (json.has("_"+prefix+"Url"))
29025        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
29026      return t;
29027    }
29028    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
29029      DataType t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
29030      if (json.has("_"+prefix+"Instant"))
29031        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
29032      return t;
29033    }
29034    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
29035      DataType t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
29036      if (json.has("_"+prefix+"Boolean"))
29037        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
29038      return t;
29039    }
29040    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
29041      DataType t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
29042      if (json.has("_"+prefix+"Base64Binary"))
29043        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
29044      return t;
29045    }
29046    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
29047      DataType t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
29048      if (json.has("_"+prefix+"UnsignedInt"))
29049        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
29050      return t;
29051    }
29052    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
29053      DataType t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
29054      if (json.has("_"+prefix+"Markdown"))
29055        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
29056      return t;
29057    }
29058    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
29059      DataType t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
29060      if (json.has("_"+prefix+"Time"))
29061        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
29062      return t;
29063    }
29064    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
29065      DataType t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
29066      if (json.has("_"+prefix+"Id"))
29067        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
29068      return t;
29069    }
29070    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
29071      DataType t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
29072      if (json.has("_"+prefix+"PositiveInt"))
29073        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
29074      return t;
29075    }
29076    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
29077      DataType t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
29078      if (json.has("_"+prefix+"Decimal"))
29079        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
29080      return t;
29081    } else if (json.has(prefix+"Address")) {
29082      return parseAddress(getJObject(json, prefix+"Address"));
29083    } else if (json.has(prefix+"Age")) {
29084      return parseAge(getJObject(json, prefix+"Age"));
29085    } else if (json.has(prefix+"Annotation")) {
29086      return parseAnnotation(getJObject(json, prefix+"Annotation"));
29087    } else if (json.has(prefix+"Attachment")) {
29088      return parseAttachment(getJObject(json, prefix+"Attachment"));
29089    } else if (json.has(prefix+"CodeableConcept")) {
29090      return parseCodeableConcept(getJObject(json, prefix+"CodeableConcept"));
29091    } else if (json.has(prefix+"CodeableReference")) {
29092      return parseCodeableReference(getJObject(json, prefix+"CodeableReference"));
29093    } else if (json.has(prefix+"Coding")) {
29094      return parseCoding(getJObject(json, prefix+"Coding"));
29095    } else if (json.has(prefix+"ContactDetail")) {
29096      return parseContactDetail(getJObject(json, prefix+"ContactDetail"));
29097    } else if (json.has(prefix+"ContactPoint")) {
29098      return parseContactPoint(getJObject(json, prefix+"ContactPoint"));
29099    } else if (json.has(prefix+"Contributor")) {
29100      return parseContributor(getJObject(json, prefix+"Contributor"));
29101    } else if (json.has(prefix+"Count")) {
29102      return parseCount(getJObject(json, prefix+"Count"));
29103    } else if (json.has(prefix+"DataRequirement")) {
29104      return parseDataRequirement(getJObject(json, prefix+"DataRequirement"));
29105    } else if (json.has(prefix+"Distance")) {
29106      return parseDistance(getJObject(json, prefix+"Distance"));
29107    } else if (json.has(prefix+"Dosage")) {
29108      return parseDosage(getJObject(json, prefix+"Dosage"));
29109    } else if (json.has(prefix+"Duration")) {
29110      return parseDuration(getJObject(json, prefix+"Duration"));
29111    } else if (json.has(prefix+"ElementDefinition")) {
29112      return parseElementDefinition(getJObject(json, prefix+"ElementDefinition"));
29113    } else if (json.has(prefix+"Expression")) {
29114      return parseExpression(getJObject(json, prefix+"Expression"));
29115    } else if (json.has(prefix+"Extension")) {
29116      return parseExtension(getJObject(json, prefix+"Extension"));
29117    } else if (json.has(prefix+"HumanName")) {
29118      return parseHumanName(getJObject(json, prefix+"HumanName"));
29119    } else if (json.has(prefix+"Identifier")) {
29120      return parseIdentifier(getJObject(json, prefix+"Identifier"));
29121    } else if (json.has(prefix+"MarketingStatus")) {
29122      return parseMarketingStatus(getJObject(json, prefix+"MarketingStatus"));
29123    } else if (json.has(prefix+"Meta")) {
29124      return parseMeta(getJObject(json, prefix+"Meta"));
29125    } else if (json.has(prefix+"Money")) {
29126      return parseMoney(getJObject(json, prefix+"Money"));
29127    } else if (json.has(prefix+"Narrative")) {
29128      return parseNarrative(getJObject(json, prefix+"Narrative"));
29129    } else if (json.has(prefix+"ParameterDefinition")) {
29130      return parseParameterDefinition(getJObject(json, prefix+"ParameterDefinition"));
29131    } else if (json.has(prefix+"Period")) {
29132      return parsePeriod(getJObject(json, prefix+"Period"));
29133    } else if (json.has(prefix+"Population")) {
29134      return parsePopulation(getJObject(json, prefix+"Population"));
29135    } else if (json.has(prefix+"ProdCharacteristic")) {
29136      return parseProdCharacteristic(getJObject(json, prefix+"ProdCharacteristic"));
29137    } else if (json.has(prefix+"ProductShelfLife")) {
29138      return parseProductShelfLife(getJObject(json, prefix+"ProductShelfLife"));
29139    } else if (json.has(prefix+"Quantity")) {
29140      return parseQuantity(getJObject(json, prefix+"Quantity"));
29141    } else if (json.has(prefix+"Range")) {
29142      return parseRange(getJObject(json, prefix+"Range"));
29143    } else if (json.has(prefix+"Ratio")) {
29144      return parseRatio(getJObject(json, prefix+"Ratio"));
29145    } else if (json.has(prefix+"RatioRange")) {
29146      return parseRatioRange(getJObject(json, prefix+"RatioRange"));
29147    } else if (json.has(prefix+"Reference")) {
29148      return parseReference(getJObject(json, prefix+"Reference"));
29149    } else if (json.has(prefix+"RelatedArtifact")) {
29150      return parseRelatedArtifact(getJObject(json, prefix+"RelatedArtifact"));
29151    } else if (json.has(prefix+"SampledData")) {
29152      return parseSampledData(getJObject(json, prefix+"SampledData"));
29153    } else if (json.has(prefix+"Signature")) {
29154      return parseSignature(getJObject(json, prefix+"Signature"));
29155    } else if (json.has(prefix+"Timing")) {
29156      return parseTiming(getJObject(json, prefix+"Timing"));
29157    } else if (json.has(prefix+"TriggerDefinition")) {
29158      return parseTriggerDefinition(getJObject(json, prefix+"TriggerDefinition"));
29159    } else if (json.has(prefix+"UsageContext")) {
29160      return parseUsageContext(getJObject(json, prefix+"UsageContext"));
29161
29162    } else {
29163      return null;
29164    }
29165  }
29166
29167  protected DataType parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
29168    return parseType(json, type);
29169  }
29170
29171  protected DataType parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
29172    if (Utilities.noString(type)) {
29173      throw new FHIRFormatError("Unable to parse type - type not specified"); 
29174   } else if (type.equals("Address")) {
29175      return parseAddress(json);
29176   } else if (type.equals("Age")) {
29177      return parseAge(json);
29178   } else if (type.equals("Annotation")) {
29179      return parseAnnotation(json);
29180   } else if (type.equals("Attachment")) {
29181      return parseAttachment(json);
29182   } else if (type.equals("CodeableConcept")) {
29183      return parseCodeableConcept(json);
29184   } else if (type.equals("CodeableReference")) {
29185      return parseCodeableReference(json);
29186   } else if (type.equals("Coding")) {
29187      return parseCoding(json);
29188   } else if (type.equals("ContactDetail")) {
29189      return parseContactDetail(json);
29190   } else if (type.equals("ContactPoint")) {
29191      return parseContactPoint(json);
29192   } else if (type.equals("Contributor")) {
29193      return parseContributor(json);
29194   } else if (type.equals("Count")) {
29195      return parseCount(json);
29196   } else if (type.equals("DataRequirement")) {
29197      return parseDataRequirement(json);
29198   } else if (type.equals("Distance")) {
29199      return parseDistance(json);
29200   } else if (type.equals("Dosage")) {
29201      return parseDosage(json);
29202   } else if (type.equals("Duration")) {
29203      return parseDuration(json);
29204   } else if (type.equals("ElementDefinition")) {
29205      return parseElementDefinition(json);
29206   } else if (type.equals("Expression")) {
29207      return parseExpression(json);
29208   } else if (type.equals("Extension")) {
29209      return parseExtension(json);
29210   } else if (type.equals("HumanName")) {
29211      return parseHumanName(json);
29212   } else if (type.equals("Identifier")) {
29213      return parseIdentifier(json);
29214   } else if (type.equals("MarketingStatus")) {
29215      return parseMarketingStatus(json);
29216   } else if (type.equals("Meta")) {
29217      return parseMeta(json);
29218   } else if (type.equals("Money")) {
29219      return parseMoney(json);
29220   } else if (type.equals("Narrative")) {
29221      return parseNarrative(json);
29222   } else if (type.equals("ParameterDefinition")) {
29223      return parseParameterDefinition(json);
29224   } else if (type.equals("Period")) {
29225      return parsePeriod(json);
29226   } else if (type.equals("Population")) {
29227      return parsePopulation(json);
29228   } else if (type.equals("ProdCharacteristic")) {
29229      return parseProdCharacteristic(json);
29230   } else if (type.equals("ProductShelfLife")) {
29231      return parseProductShelfLife(json);
29232   } else if (type.equals("Quantity")) {
29233      return parseQuantity(json);
29234   } else if (type.equals("Range")) {
29235      return parseRange(json);
29236   } else if (type.equals("Ratio")) {
29237      return parseRatio(json);
29238   } else if (type.equals("RatioRange")) {
29239      return parseRatioRange(json);
29240   } else if (type.equals("Reference")) {
29241      return parseReference(json);
29242   } else if (type.equals("RelatedArtifact")) {
29243      return parseRelatedArtifact(json);
29244   } else if (type.equals("SampledData")) {
29245      return parseSampledData(json);
29246   } else if (type.equals("Signature")) {
29247      return parseSignature(json);
29248   } else if (type.equals("Timing")) {
29249      return parseTiming(json);
29250   } else if (type.equals("TriggerDefinition")) {
29251      return parseTriggerDefinition(json);
29252   } else if (type.equals("UsageContext")) {
29253      return parseUsageContext(json);
29254
29255    } else {
29256      throw new FHIRFormatError("Unknown Type "+type);
29257    }
29258  }
29259
29260  protected boolean hasTypeName(JsonObject json, String prefix) {
29261    if (json.has(prefix+"Address")) {
29262      return true;
29263    };
29264    if (json.has(prefix+"Age")) {
29265      return true;
29266    };
29267    if (json.has(prefix+"Annotation")) {
29268      return true;
29269    };
29270    if (json.has(prefix+"Attachment")) {
29271      return true;
29272    };
29273    if (json.has(prefix+"CodeableConcept")) {
29274      return true;
29275    };
29276    if (json.has(prefix+"CodeableReference")) {
29277      return true;
29278    };
29279    if (json.has(prefix+"Coding")) {
29280      return true;
29281    };
29282    if (json.has(prefix+"ContactDetail")) {
29283      return true;
29284    };
29285    if (json.has(prefix+"ContactPoint")) {
29286      return true;
29287    };
29288    if (json.has(prefix+"Contributor")) {
29289      return true;
29290    };
29291    if (json.has(prefix+"Count")) {
29292      return true;
29293    };
29294    if (json.has(prefix+"DataRequirement")) {
29295      return true;
29296    };
29297    if (json.has(prefix+"Distance")) {
29298      return true;
29299    };
29300    if (json.has(prefix+"Dosage")) {
29301      return true;
29302    };
29303    if (json.has(prefix+"Duration")) {
29304      return true;
29305    };
29306    if (json.has(prefix+"ElementDefinition")) {
29307      return true;
29308    };
29309    if (json.has(prefix+"Expression")) {
29310      return true;
29311    };
29312    if (json.has(prefix+"Extension")) {
29313      return true;
29314    };
29315    if (json.has(prefix+"HumanName")) {
29316      return true;
29317    };
29318    if (json.has(prefix+"Identifier")) {
29319      return true;
29320    };
29321    if (json.has(prefix+"MarketingStatus")) {
29322      return true;
29323    };
29324    if (json.has(prefix+"Meta")) {
29325      return true;
29326    };
29327    if (json.has(prefix+"Money")) {
29328      return true;
29329    };
29330    if (json.has(prefix+"Narrative")) {
29331      return true;
29332    };
29333    if (json.has(prefix+"ParameterDefinition")) {
29334      return true;
29335    };
29336    if (json.has(prefix+"Period")) {
29337      return true;
29338    };
29339    if (json.has(prefix+"Population")) {
29340      return true;
29341    };
29342    if (json.has(prefix+"ProdCharacteristic")) {
29343      return true;
29344    };
29345    if (json.has(prefix+"ProductShelfLife")) {
29346      return true;
29347    };
29348    if (json.has(prefix+"Quantity")) {
29349      return true;
29350    };
29351    if (json.has(prefix+"Range")) {
29352      return true;
29353    };
29354    if (json.has(prefix+"Ratio")) {
29355      return true;
29356    };
29357    if (json.has(prefix+"RatioRange")) {
29358      return true;
29359    };
29360    if (json.has(prefix+"Reference")) {
29361      return true;
29362    };
29363    if (json.has(prefix+"RelatedArtifact")) {
29364      return true;
29365    };
29366    if (json.has(prefix+"SampledData")) {
29367      return true;
29368    };
29369    if (json.has(prefix+"Signature")) {
29370      return true;
29371    };
29372    if (json.has(prefix+"Timing")) {
29373      return true;
29374    };
29375    if (json.has(prefix+"TriggerDefinition")) {
29376      return true;
29377    };
29378    if (json.has(prefix+"UsageContext")) {
29379      return true;
29380    };
29381    if (json.has(prefix+"Account")) {
29382      return true;
29383    };
29384    if (json.has(prefix+"ActivityDefinition")) {
29385      return true;
29386    };
29387    if (json.has(prefix+"AdministrableProductDefinition")) {
29388      return true;
29389    };
29390    if (json.has(prefix+"AdverseEvent")) {
29391      return true;
29392    };
29393    if (json.has(prefix+"AllergyIntolerance")) {
29394      return true;
29395    };
29396    if (json.has(prefix+"Appointment")) {
29397      return true;
29398    };
29399    if (json.has(prefix+"AppointmentResponse")) {
29400      return true;
29401    };
29402    if (json.has(prefix+"AuditEvent")) {
29403      return true;
29404    };
29405    if (json.has(prefix+"Basic")) {
29406      return true;
29407    };
29408    if (json.has(prefix+"Binary")) {
29409      return true;
29410    };
29411    if (json.has(prefix+"BiologicallyDerivedProduct")) {
29412      return true;
29413    };
29414    if (json.has(prefix+"BodyStructure")) {
29415      return true;
29416    };
29417    if (json.has(prefix+"Bundle")) {
29418      return true;
29419    };
29420    if (json.has(prefix+"CapabilityStatement")) {
29421      return true;
29422    };
29423    if (json.has(prefix+"CarePlan")) {
29424      return true;
29425    };
29426    if (json.has(prefix+"CareTeam")) {
29427      return true;
29428    };
29429    if (json.has(prefix+"CatalogEntry")) {
29430      return true;
29431    };
29432    if (json.has(prefix+"ChargeItem")) {
29433      return true;
29434    };
29435    if (json.has(prefix+"ChargeItemDefinition")) {
29436      return true;
29437    };
29438    if (json.has(prefix+"Citation")) {
29439      return true;
29440    };
29441    if (json.has(prefix+"Claim")) {
29442      return true;
29443    };
29444    if (json.has(prefix+"ClaimResponse")) {
29445      return true;
29446    };
29447    if (json.has(prefix+"ClinicalImpression")) {
29448      return true;
29449    };
29450    if (json.has(prefix+"ClinicalUseDefinition")) {
29451      return true;
29452    };
29453    if (json.has(prefix+"CodeSystem")) {
29454      return true;
29455    };
29456    if (json.has(prefix+"Communication")) {
29457      return true;
29458    };
29459    if (json.has(prefix+"CommunicationRequest")) {
29460      return true;
29461    };
29462    if (json.has(prefix+"CompartmentDefinition")) {
29463      return true;
29464    };
29465    if (json.has(prefix+"Composition")) {
29466      return true;
29467    };
29468    if (json.has(prefix+"ConceptMap")) {
29469      return true;
29470    };
29471    if (json.has(prefix+"Condition")) {
29472      return true;
29473    };
29474    if (json.has(prefix+"Consent")) {
29475      return true;
29476    };
29477    if (json.has(prefix+"Contract")) {
29478      return true;
29479    };
29480    if (json.has(prefix+"Coverage")) {
29481      return true;
29482    };
29483    if (json.has(prefix+"CoverageEligibilityRequest")) {
29484      return true;
29485    };
29486    if (json.has(prefix+"CoverageEligibilityResponse")) {
29487      return true;
29488    };
29489    if (json.has(prefix+"DetectedIssue")) {
29490      return true;
29491    };
29492    if (json.has(prefix+"Device")) {
29493      return true;
29494    };
29495    if (json.has(prefix+"DeviceDefinition")) {
29496      return true;
29497    };
29498    if (json.has(prefix+"DeviceMetric")) {
29499      return true;
29500    };
29501    if (json.has(prefix+"DeviceRequest")) {
29502      return true;
29503    };
29504    if (json.has(prefix+"DeviceUseStatement")) {
29505      return true;
29506    };
29507    if (json.has(prefix+"DiagnosticReport")) {
29508      return true;
29509    };
29510    if (json.has(prefix+"DocumentManifest")) {
29511      return true;
29512    };
29513    if (json.has(prefix+"DocumentReference")) {
29514      return true;
29515    };
29516    if (json.has(prefix+"Encounter")) {
29517      return true;
29518    };
29519    if (json.has(prefix+"Endpoint")) {
29520      return true;
29521    };
29522    if (json.has(prefix+"EnrollmentRequest")) {
29523      return true;
29524    };
29525    if (json.has(prefix+"EnrollmentResponse")) {
29526      return true;
29527    };
29528    if (json.has(prefix+"EpisodeOfCare")) {
29529      return true;
29530    };
29531    if (json.has(prefix+"EventDefinition")) {
29532      return true;
29533    };
29534    if (json.has(prefix+"Evidence")) {
29535      return true;
29536    };
29537    if (json.has(prefix+"EvidenceReport")) {
29538      return true;
29539    };
29540    if (json.has(prefix+"EvidenceVariable")) {
29541      return true;
29542    };
29543    if (json.has(prefix+"ExampleScenario")) {
29544      return true;
29545    };
29546    if (json.has(prefix+"ExplanationOfBenefit")) {
29547      return true;
29548    };
29549    if (json.has(prefix+"FamilyMemberHistory")) {
29550      return true;
29551    };
29552    if (json.has(prefix+"Flag")) {
29553      return true;
29554    };
29555    if (json.has(prefix+"Goal")) {
29556      return true;
29557    };
29558    if (json.has(prefix+"GraphDefinition")) {
29559      return true;
29560    };
29561    if (json.has(prefix+"Group")) {
29562      return true;
29563    };
29564    if (json.has(prefix+"GuidanceResponse")) {
29565      return true;
29566    };
29567    if (json.has(prefix+"HealthcareService")) {
29568      return true;
29569    };
29570    if (json.has(prefix+"ImagingStudy")) {
29571      return true;
29572    };
29573    if (json.has(prefix+"Immunization")) {
29574      return true;
29575    };
29576    if (json.has(prefix+"ImmunizationEvaluation")) {
29577      return true;
29578    };
29579    if (json.has(prefix+"ImmunizationRecommendation")) {
29580      return true;
29581    };
29582    if (json.has(prefix+"ImplementationGuide")) {
29583      return true;
29584    };
29585    if (json.has(prefix+"Ingredient")) {
29586      return true;
29587    };
29588    if (json.has(prefix+"InsurancePlan")) {
29589      return true;
29590    };
29591    if (json.has(prefix+"Invoice")) {
29592      return true;
29593    };
29594    if (json.has(prefix+"Library")) {
29595      return true;
29596    };
29597    if (json.has(prefix+"Linkage")) {
29598      return true;
29599    };
29600    if (json.has(prefix+"List")) {
29601      return true;
29602    };
29603    if (json.has(prefix+"Location")) {
29604      return true;
29605    };
29606    if (json.has(prefix+"ManufacturedItemDefinition")) {
29607      return true;
29608    };
29609    if (json.has(prefix+"Measure")) {
29610      return true;
29611    };
29612    if (json.has(prefix+"MeasureReport")) {
29613      return true;
29614    };
29615    if (json.has(prefix+"Media")) {
29616      return true;
29617    };
29618    if (json.has(prefix+"Medication")) {
29619      return true;
29620    };
29621    if (json.has(prefix+"MedicationAdministration")) {
29622      return true;
29623    };
29624    if (json.has(prefix+"MedicationDispense")) {
29625      return true;
29626    };
29627    if (json.has(prefix+"MedicationKnowledge")) {
29628      return true;
29629    };
29630    if (json.has(prefix+"MedicationRequest")) {
29631      return true;
29632    };
29633    if (json.has(prefix+"MedicationStatement")) {
29634      return true;
29635    };
29636    if (json.has(prefix+"MedicinalProductDefinition")) {
29637      return true;
29638    };
29639    if (json.has(prefix+"MessageDefinition")) {
29640      return true;
29641    };
29642    if (json.has(prefix+"MessageHeader")) {
29643      return true;
29644    };
29645    if (json.has(prefix+"MolecularSequence")) {
29646      return true;
29647    };
29648    if (json.has(prefix+"NamingSystem")) {
29649      return true;
29650    };
29651    if (json.has(prefix+"NutritionOrder")) {
29652      return true;
29653    };
29654    if (json.has(prefix+"NutritionProduct")) {
29655      return true;
29656    };
29657    if (json.has(prefix+"Observation")) {
29658      return true;
29659    };
29660    if (json.has(prefix+"ObservationDefinition")) {
29661      return true;
29662    };
29663    if (json.has(prefix+"OperationDefinition")) {
29664      return true;
29665    };
29666    if (json.has(prefix+"OperationOutcome")) {
29667      return true;
29668    };
29669    if (json.has(prefix+"Organization")) {
29670      return true;
29671    };
29672    if (json.has(prefix+"OrganizationAffiliation")) {
29673      return true;
29674    };
29675    if (json.has(prefix+"PackagedProductDefinition")) {
29676      return true;
29677    };
29678    if (json.has(prefix+"Parameters")) {
29679      return true;
29680    };
29681    if (json.has(prefix+"Patient")) {
29682      return true;
29683    };
29684    if (json.has(prefix+"PaymentNotice")) {
29685      return true;
29686    };
29687    if (json.has(prefix+"PaymentReconciliation")) {
29688      return true;
29689    };
29690    if (json.has(prefix+"Person")) {
29691      return true;
29692    };
29693    if (json.has(prefix+"PlanDefinition")) {
29694      return true;
29695    };
29696    if (json.has(prefix+"Practitioner")) {
29697      return true;
29698    };
29699    if (json.has(prefix+"PractitionerRole")) {
29700      return true;
29701    };
29702    if (json.has(prefix+"Procedure")) {
29703      return true;
29704    };
29705    if (json.has(prefix+"Provenance")) {
29706      return true;
29707    };
29708    if (json.has(prefix+"Questionnaire")) {
29709      return true;
29710    };
29711    if (json.has(prefix+"QuestionnaireResponse")) {
29712      return true;
29713    };
29714    if (json.has(prefix+"RegulatedAuthorization")) {
29715      return true;
29716    };
29717    if (json.has(prefix+"RelatedPerson")) {
29718      return true;
29719    };
29720    if (json.has(prefix+"RequestGroup")) {
29721      return true;
29722    };
29723    if (json.has(prefix+"ResearchDefinition")) {
29724      return true;
29725    };
29726    if (json.has(prefix+"ResearchElementDefinition")) {
29727      return true;
29728    };
29729    if (json.has(prefix+"ResearchStudy")) {
29730      return true;
29731    };
29732    if (json.has(prefix+"ResearchSubject")) {
29733      return true;
29734    };
29735    if (json.has(prefix+"RiskAssessment")) {
29736      return true;
29737    };
29738    if (json.has(prefix+"Schedule")) {
29739      return true;
29740    };
29741    if (json.has(prefix+"SearchParameter")) {
29742      return true;
29743    };
29744    if (json.has(prefix+"ServiceRequest")) {
29745      return true;
29746    };
29747    if (json.has(prefix+"Slot")) {
29748      return true;
29749    };
29750    if (json.has(prefix+"Specimen")) {
29751      return true;
29752    };
29753    if (json.has(prefix+"SpecimenDefinition")) {
29754      return true;
29755    };
29756    if (json.has(prefix+"StructureDefinition")) {
29757      return true;
29758    };
29759    if (json.has(prefix+"StructureMap")) {
29760      return true;
29761    };
29762    if (json.has(prefix+"Subscription")) {
29763      return true;
29764    };
29765    if (json.has(prefix+"SubscriptionStatus")) {
29766      return true;
29767    };
29768    if (json.has(prefix+"SubscriptionTopic")) {
29769      return true;
29770    };
29771    if (json.has(prefix+"Substance")) {
29772      return true;
29773    };
29774    if (json.has(prefix+"SubstanceDefinition")) {
29775      return true;
29776    };
29777    if (json.has(prefix+"SupplyDelivery")) {
29778      return true;
29779    };
29780    if (json.has(prefix+"SupplyRequest")) {
29781      return true;
29782    };
29783    if (json.has(prefix+"Task")) {
29784      return true;
29785    };
29786    if (json.has(prefix+"TerminologyCapabilities")) {
29787      return true;
29788    };
29789    if (json.has(prefix+"TestReport")) {
29790      return true;
29791    };
29792    if (json.has(prefix+"TestScript")) {
29793      return true;
29794    };
29795    if (json.has(prefix+"ValueSet")) {
29796      return true;
29797    };
29798    if (json.has(prefix+"VerificationResult")) {
29799      return true;
29800    };
29801    if (json.has(prefix+"VisionPrescription")) {
29802      return true;
29803    };
29804
29805    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
29806      return true;
29807    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
29808      return true;
29809    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
29810      return true;
29811    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
29812      return true;
29813    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
29814      return true;
29815    if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64"))
29816      return true;
29817    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
29818      return true;
29819    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
29820      return true;
29821    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
29822      return true;
29823    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
29824      return true;
29825    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
29826      return true;
29827    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
29828      return true;
29829    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
29830      return true;
29831    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
29832      return true;
29833    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
29834      return true;
29835    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
29836      return true;
29837    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
29838      return true;
29839    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
29840      return true;
29841    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
29842      return true;
29843    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
29844      return true;
29845    return false;
29846  }
29847
29848// -- compose ---------------------------------------------------------------------------------------------------------------------
29849
29850  protected void composeBaseProperties(Base element) throws IOException {
29851  }
29852
29853
29854  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
29855    if (value != null && value.getValue() != null) {
29856      prop(name, e.toCode(value.getValue()));
29857    } else if (inArray)   
29858      writeNull(name);
29859  }    
29860
29861  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
29862    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29863      open(inArray ? null : "_"+name);
29864      composeElementProperties(value);
29865      close();
29866    } else if (inArray)   
29867      writeNull(name);
29868  }    
29869
29870  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
29871    if (value != null && value.hasValue()) {
29872        prop(name, value.asStringValue());
29873    }    
29874    else if (inArray) 
29875      writeNull(name); 
29876  }    
29877
29878  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
29879    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29880      open(inArray ? null : "_"+name);
29881      composeElementProperties(value);
29882      close();
29883    }
29884    else if (inArray) 
29885      writeNull(name); 
29886  }
29887
29888  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
29889    if (value != null && value.hasValue()) {
29890        prop(name, value.asStringValue());
29891    }    
29892    else if (inArray) 
29893      writeNull(name); 
29894  }    
29895
29896  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
29897    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29898      open(inArray ? null : "_"+name);
29899      composeElementProperties(value);
29900      close();
29901    }
29902    else if (inArray) 
29903      writeNull(name); 
29904  }
29905
29906  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
29907    if (value != null && value.hasValue()) {
29908        prop(name, toString(value.getValue()));
29909    }    
29910    else if (inArray) 
29911      writeNull(name); 
29912  }    
29913
29914  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
29915    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29916      open(inArray ? null : "_"+name);
29917      composeElementProperties(value);
29918      close();
29919    }
29920    else if (inArray) 
29921      writeNull(name); 
29922  }
29923
29924  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
29925    if (value != null && value.hasValue()) {
29926        prop(name, toString(value.getValue()));
29927    }    
29928    else if (inArray) 
29929      writeNull(name); 
29930  }    
29931
29932  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
29933    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29934      open(inArray ? null : "_"+name);
29935      composeElementProperties(value);
29936      close();
29937    }
29938    else if (inArray) 
29939      writeNull(name); 
29940  }
29941
29942  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
29943    if (value != null && value.hasValue()) {
29944        prop(name, Integer.valueOf(value.getValue()));
29945    }    
29946    else if (inArray) 
29947      writeNull(name); 
29948  }    
29949
29950  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
29951    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29952      open(inArray ? null : "_"+name);
29953      composeElementProperties(value);
29954      close();
29955    }
29956    else if (inArray) 
29957      writeNull(name); 
29958  }
29959
29960  protected void composeInteger64Core(String name, Integer64Type value, boolean inArray) throws IOException {
29961    if (value != null && value.hasValue()) {
29962        prop(name, value.getValue().toString());
29963    }    
29964    else if (inArray) 
29965      writeNull(name); 
29966  }    
29967
29968  protected void composeInteger64Extras(String name, Integer64Type value, boolean inArray) throws IOException {
29969    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29970      open(inArray ? null : "_"+name);
29971      composeElementProperties(value);
29972      close();
29973    }
29974    else if (inArray) 
29975      writeNull(name); 
29976  }
29977
29978  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
29979    if (value != null && value.hasValue()) {
29980        prop(name, toString(value.getValue()));
29981    }    
29982    else if (inArray) 
29983      writeNull(name); 
29984  }    
29985
29986  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
29987    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29988      open(inArray ? null : "_"+name);
29989      composeElementProperties(value);
29990      close();
29991    }
29992    else if (inArray) 
29993      writeNull(name); 
29994  }
29995
29996  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
29997    if (value != null && value.hasValue()) {
29998        prop(name, toString(value.getValue()));
29999    }    
30000    else if (inArray) 
30001      writeNull(name); 
30002  }    
30003
30004  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
30005    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30006      open(inArray ? null : "_"+name);
30007      composeElementProperties(value);
30008      close();
30009    }
30010    else if (inArray) 
30011      writeNull(name); 
30012  }
30013
30014  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
30015    if (value != null && value.hasValue()) {
30016        prop(name, toString(value.getValue()));
30017    }    
30018    else if (inArray) 
30019      writeNull(name); 
30020  }    
30021
30022  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
30023    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30024      open(inArray ? null : "_"+name);
30025      composeElementProperties(value);
30026      close();
30027    }
30028    else if (inArray) 
30029      writeNull(name); 
30030  }
30031
30032  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
30033    if (value != null && value.hasValue()) {
30034        prop(name, toString(value.getValue()));
30035    }    
30036    else if (inArray) 
30037      writeNull(name); 
30038  }    
30039
30040  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
30041    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30042      open(inArray ? null : "_"+name);
30043      composeElementProperties(value);
30044      close();
30045    }
30046    else if (inArray) 
30047      writeNull(name); 
30048  }
30049
30050  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
30051    if (value != null && value.hasValue()) {
30052        prop(name, toString(value.getValue()));
30053    }    
30054    else if (inArray) 
30055      writeNull(name); 
30056  }    
30057
30058  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
30059    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30060      open(inArray ? null : "_"+name);
30061      composeElementProperties(value);
30062      close();
30063    }
30064    else if (inArray) 
30065      writeNull(name); 
30066  }
30067
30068  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
30069    if (value != null && value.hasValue()) {
30070        prop(name, value.asStringValue());
30071    }    
30072    else if (inArray) 
30073      writeNull(name); 
30074  }    
30075
30076  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
30077    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30078      open(inArray ? null : "_"+name);
30079      composeElementProperties(value);
30080      close();
30081    }
30082    else if (inArray) 
30083      writeNull(name); 
30084  }
30085
30086  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
30087    if (value != null && value.hasValue()) {
30088        prop(name, value.getValue());
30089    }    
30090    else if (inArray) 
30091      writeNull(name); 
30092  }    
30093
30094  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
30095    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30096      open(inArray ? null : "_"+name);
30097      composeElementProperties(value);
30098      close();
30099    }
30100    else if (inArray) 
30101      writeNull(name); 
30102  }
30103
30104  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
30105    if (value != null && value.hasValue()) {
30106        prop(name, toString(value.getValue()));
30107    }    
30108    else if (inArray) 
30109      writeNull(name); 
30110  }    
30111
30112  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
30113    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30114      open(inArray ? null : "_"+name);
30115      composeElementProperties(value);
30116      close();
30117    }
30118    else if (inArray) 
30119      writeNull(name); 
30120  }
30121
30122  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
30123    if (value != null && value.hasValue()) {
30124        prop(name, Integer.valueOf(value.getValue()));
30125    }    
30126    else if (inArray) 
30127      writeNull(name); 
30128  }    
30129
30130  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
30131    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30132      open(inArray ? null : "_"+name);
30133      composeElementProperties(value);
30134      close();
30135    }
30136    else if (inArray) 
30137      writeNull(name); 
30138  }
30139
30140  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
30141    if (value != null && value.hasValue()) {
30142        prop(name, toString(value.getValue()));
30143    }    
30144    else if (inArray) 
30145      writeNull(name); 
30146  }    
30147
30148  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
30149    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30150      open(inArray ? null : "_"+name);
30151      composeElementProperties(value);
30152      close();
30153    }
30154    else if (inArray) 
30155      writeNull(name); 
30156  }
30157
30158  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
30159    if (value != null && value.hasValue()) {
30160        prop(name, value.asStringValue());
30161    }    
30162    else if (inArray) 
30163      writeNull(name); 
30164  }    
30165
30166  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
30167    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30168      open(inArray ? null : "_"+name);
30169      composeElementProperties(value);
30170      close();
30171    }
30172    else if (inArray) 
30173      writeNull(name); 
30174  }
30175
30176  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
30177    if (value != null && value.hasValue()) {
30178        prop(name, toString(value.getValue()));
30179    }    
30180    else if (inArray) 
30181      writeNull(name); 
30182  }    
30183
30184  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
30185    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30186      open(inArray ? null : "_"+name);
30187      composeElementProperties(value);
30188      close();
30189    }
30190    else if (inArray) 
30191      writeNull(name); 
30192  }
30193
30194  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
30195    if (value != null && value.hasValue()) {
30196        prop(name, Integer.valueOf(value.getValue()));
30197    }    
30198    else if (inArray) 
30199      writeNull(name); 
30200  }    
30201
30202  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
30203    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30204      open(inArray ? null : "_"+name);
30205      composeElementProperties(value);
30206      close();
30207    }
30208    else if (inArray) 
30209      writeNull(name); 
30210  }
30211
30212  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
30213    if (value != null && value.hasValue()) {
30214        prop(name, value.getValue());
30215    }    
30216    else if (inArray) 
30217      writeNull(name); 
30218  }    
30219
30220  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
30221    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30222      open(inArray ? null : "_"+name);
30223      composeElementProperties(value);
30224      close();
30225    }
30226    else if (inArray) 
30227      writeNull(name); 
30228  }
30229
30230  protected void composeElementProperties(Element element) throws IOException {
30231      if (element.hasIdElement()) {
30232        composeStringCore("id", element.getIdElement(), false);
30233        composeStringExtras("id", element.getIdElement(), false);
30234      }
30235      if (element.hasExtension()) {
30236        openArray("extension");
30237        for (Extension e : element.getExtension()) 
30238          composeExtension(null, e);
30239        closeArray();
30240      };
30241  }
30242
30243  protected void composeBackboneElementProperties(BackboneElement element) throws IOException {
30244      composeDataTypeProperties(element);
30245      if (element.hasModifierExtension()) {
30246        openArray("modifierExtension");
30247        for (Extension e : element.getModifierExtension()) 
30248          composeExtension(null, e);
30249        closeArray();
30250      };
30251  }
30252
30253  protected void composeDataTypeProperties(DataType element) throws IOException {
30254      composeElementProperties(element);
30255  }
30256
30257  protected void composeAddress(String name, Address element) throws IOException {
30258    if (element != null) {
30259      open(name);
30260      composeAddressProperties(element);
30261      close();
30262    }
30263  }
30264
30265  protected void composeAddressProperties(Address element) throws IOException {
30266    composeDataTypeProperties(element);
30267      if (element.hasUseElement()) {
30268        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30269        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30270      }
30271      if (element.hasTypeElement()) {
30272        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30273        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30274      }
30275      if (element.hasTextElement()) {
30276        composeStringCore("text", element.getTextElement(), false);
30277        composeStringExtras("text", element.getTextElement(), false);
30278      }
30279      if (element.hasLine()) {
30280        if (anyHasValue(element.getLine())) {
30281          openArray("line");
30282          for (StringType e : element.getLine()) 
30283            composeStringCore(null, e, e != element.getLine().get(element.getLine().size()-1));
30284          closeArray();
30285        }
30286        if (anyHasExtras(element.getLine())) {
30287          openArray("_line");
30288          for (StringType e : element.getLine()) 
30289            composeStringExtras(null, e, true);
30290          closeArray();
30291        }
30292      };
30293      if (element.hasCityElement()) {
30294        composeStringCore("city", element.getCityElement(), false);
30295        composeStringExtras("city", element.getCityElement(), false);
30296      }
30297      if (element.hasDistrictElement()) {
30298        composeStringCore("district", element.getDistrictElement(), false);
30299        composeStringExtras("district", element.getDistrictElement(), false);
30300      }
30301      if (element.hasStateElement()) {
30302        composeStringCore("state", element.getStateElement(), false);
30303        composeStringExtras("state", element.getStateElement(), false);
30304      }
30305      if (element.hasPostalCodeElement()) {
30306        composeStringCore("postalCode", element.getPostalCodeElement(), false);
30307        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
30308      }
30309      if (element.hasCountryElement()) {
30310        composeStringCore("country", element.getCountryElement(), false);
30311        composeStringExtras("country", element.getCountryElement(), false);
30312      }
30313      if (element.hasPeriod()) {
30314        composePeriod("period", element.getPeriod());
30315      }
30316  }
30317
30318  protected void composeAge(String name, Age element) throws IOException {
30319    if (element != null) {
30320      open(name);
30321      composeAgeProperties(element);
30322      close();
30323    }
30324  }
30325
30326  protected void composeAgeProperties(Age element) throws IOException {
30327    composeQuantityProperties(element);
30328  }
30329
30330  protected void composeAnnotation(String name, Annotation element) throws IOException {
30331    if (element != null) {
30332      open(name);
30333      composeAnnotationProperties(element);
30334      close();
30335    }
30336  }
30337
30338  protected void composeAnnotationProperties(Annotation element) throws IOException {
30339    composeDataTypeProperties(element);
30340      if (element.hasAuthor()) {
30341        composeType("author", element.getAuthor());
30342      }
30343      if (element.hasTimeElement()) {
30344        composeDateTimeCore("time", element.getTimeElement(), false);
30345        composeDateTimeExtras("time", element.getTimeElement(), false);
30346      }
30347      if (element.hasTextElement()) {
30348        composeMarkdownCore("text", element.getTextElement(), false);
30349        composeMarkdownExtras("text", element.getTextElement(), false);
30350      }
30351  }
30352
30353  protected void composeAttachment(String name, Attachment element) throws IOException {
30354    if (element != null) {
30355      open(name);
30356      composeAttachmentProperties(element);
30357      close();
30358    }
30359  }
30360
30361  protected void composeAttachmentProperties(Attachment element) throws IOException {
30362    composeDataTypeProperties(element);
30363      if (element.hasContentTypeElement()) {
30364        composeCodeCore("contentType", element.getContentTypeElement(), false);
30365        composeCodeExtras("contentType", element.getContentTypeElement(), false);
30366      }
30367      if (element.hasLanguageElement()) {
30368        composeCodeCore("language", element.getLanguageElement(), false);
30369        composeCodeExtras("language", element.getLanguageElement(), false);
30370      }
30371      if (element.hasDataElement()) {
30372        composeBase64BinaryCore("data", element.getDataElement(), false);
30373        composeBase64BinaryExtras("data", element.getDataElement(), false);
30374      }
30375      if (element.hasUrlElement()) {
30376        composeUrlCore("url", element.getUrlElement(), false);
30377        composeUrlExtras("url", element.getUrlElement(), false);
30378      }
30379      if (element.hasSizeElement()) {
30380        composeUnsignedIntCore("size", element.getSizeElement(), false);
30381        composeUnsignedIntExtras("size", element.getSizeElement(), false);
30382      }
30383      if (element.hasHashElement()) {
30384        composeBase64BinaryCore("hash", element.getHashElement(), false);
30385        composeBase64BinaryExtras("hash", element.getHashElement(), false);
30386      }
30387      if (element.hasTitleElement()) {
30388        composeStringCore("title", element.getTitleElement(), false);
30389        composeStringExtras("title", element.getTitleElement(), false);
30390      }
30391      if (element.hasCreationElement()) {
30392        composeDateTimeCore("creation", element.getCreationElement(), false);
30393        composeDateTimeExtras("creation", element.getCreationElement(), false);
30394      }
30395  }
30396
30397  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
30398    if (element != null) {
30399      open(name);
30400      composeCodeableConceptProperties(element);
30401      close();
30402    }
30403  }
30404
30405  protected void composeCodeableConceptProperties(CodeableConcept element) throws IOException {
30406    composeDataTypeProperties(element);
30407      if (element.hasCoding()) {
30408        openArray("coding");
30409        for (Coding e : element.getCoding()) 
30410          composeCoding(null, e);
30411        closeArray();
30412      };
30413      if (element.hasTextElement()) {
30414        composeStringCore("text", element.getTextElement(), false);
30415        composeStringExtras("text", element.getTextElement(), false);
30416      }
30417  }
30418
30419  protected void composeCodeableReference(String name, CodeableReference element) throws IOException {
30420    if (element != null) {
30421      open(name);
30422      composeCodeableReferenceProperties(element);
30423      close();
30424    }
30425  }
30426
30427  protected void composeCodeableReferenceProperties(CodeableReference element) throws IOException {
30428    composeDataTypeProperties(element);
30429      if (element.hasConcept()) {
30430        composeCodeableConcept("concept", element.getConcept());
30431      }
30432      if (element.hasReference()) {
30433        composeReference("reference", element.getReference());
30434      }
30435  }
30436
30437  protected void composeCoding(String name, Coding element) throws IOException {
30438    if (element != null) {
30439      open(name);
30440      composeCodingProperties(element);
30441      close();
30442    }
30443  }
30444
30445  protected void composeCodingProperties(Coding element) throws IOException {
30446    composeDataTypeProperties(element);
30447      if (element.hasSystemElement()) {
30448        composeUriCore("system", element.getSystemElement(), false);
30449        composeUriExtras("system", element.getSystemElement(), false);
30450      }
30451      if (element.hasVersionElement()) {
30452        composeStringCore("version", element.getVersionElement(), false);
30453        composeStringExtras("version", element.getVersionElement(), false);
30454      }
30455      if (element.hasCodeElement()) {
30456        composeCodeCore("code", element.getCodeElement(), false);
30457        composeCodeExtras("code", element.getCodeElement(), false);
30458      }
30459      if (element.hasDisplayElement()) {
30460        composeStringCore("display", element.getDisplayElement(), false);
30461        composeStringExtras("display", element.getDisplayElement(), false);
30462      }
30463      if (element.hasUserSelectedElement()) {
30464        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
30465        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
30466      }
30467  }
30468
30469  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
30470    if (element != null) {
30471      open(name);
30472      composeContactDetailProperties(element);
30473      close();
30474    }
30475  }
30476
30477  protected void composeContactDetailProperties(ContactDetail element) throws IOException {
30478    composeDataTypeProperties(element);
30479      if (element.hasNameElement()) {
30480        composeStringCore("name", element.getNameElement(), false);
30481        composeStringExtras("name", element.getNameElement(), false);
30482      }
30483      if (element.hasTelecom()) {
30484        openArray("telecom");
30485        for (ContactPoint e : element.getTelecom()) 
30486          composeContactPoint(null, e);
30487        closeArray();
30488      };
30489  }
30490
30491  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
30492    if (element != null) {
30493      open(name);
30494      composeContactPointProperties(element);
30495      close();
30496    }
30497  }
30498
30499  protected void composeContactPointProperties(ContactPoint element) throws IOException {
30500    composeDataTypeProperties(element);
30501      if (element.hasSystemElement()) {
30502        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30503        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30504      }
30505      if (element.hasValueElement()) {
30506        composeStringCore("value", element.getValueElement(), false);
30507        composeStringExtras("value", element.getValueElement(), false);
30508      }
30509      if (element.hasUseElement()) {
30510        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30511        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30512      }
30513      if (element.hasRankElement()) {
30514        composePositiveIntCore("rank", element.getRankElement(), false);
30515        composePositiveIntExtras("rank", element.getRankElement(), false);
30516      }
30517      if (element.hasPeriod()) {
30518        composePeriod("period", element.getPeriod());
30519      }
30520  }
30521
30522  protected void composeContributor(String name, Contributor element) throws IOException {
30523    if (element != null) {
30524      open(name);
30525      composeContributorProperties(element);
30526      close();
30527    }
30528  }
30529
30530  protected void composeContributorProperties(Contributor element) throws IOException {
30531    composeDataTypeProperties(element);
30532      if (element.hasTypeElement()) {
30533        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30534        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30535      }
30536      if (element.hasNameElement()) {
30537        composeStringCore("name", element.getNameElement(), false);
30538        composeStringExtras("name", element.getNameElement(), false);
30539      }
30540      if (element.hasContact()) {
30541        openArray("contact");
30542        for (ContactDetail e : element.getContact()) 
30543          composeContactDetail(null, e);
30544        closeArray();
30545      };
30546  }
30547
30548  protected void composeCount(String name, Count element) throws IOException {
30549    if (element != null) {
30550      open(name);
30551      composeCountProperties(element);
30552      close();
30553    }
30554  }
30555
30556  protected void composeCountProperties(Count element) throws IOException {
30557    composeQuantityProperties(element);
30558  }
30559
30560  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
30561    if (element != null) {
30562      open(name);
30563      composeDataRequirementProperties(element);
30564      close();
30565    }
30566  }
30567
30568  protected void composeDataRequirementProperties(DataRequirement element) throws IOException {
30569    composeDataTypeProperties(element);
30570      if (element.hasTypeElement()) {
30571        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
30572        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
30573      }
30574      if (element.hasProfile()) {
30575        if (anyHasValue(element.getProfile())) {
30576          openArray("profile");
30577          for (CanonicalType e : element.getProfile()) 
30578            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
30579          closeArray();
30580        }
30581        if (anyHasExtras(element.getProfile())) {
30582          openArray("_profile");
30583          for (CanonicalType e : element.getProfile()) 
30584            composeCanonicalExtras(null, e, true);
30585          closeArray();
30586        }
30587      };
30588      if (element.hasSubject()) {
30589        composeType("subject", element.getSubject());
30590      }
30591      if (element.hasMustSupport()) {
30592        if (anyHasValue(element.getMustSupport())) {
30593          openArray("mustSupport");
30594          for (StringType e : element.getMustSupport()) 
30595            composeStringCore(null, e, e != element.getMustSupport().get(element.getMustSupport().size()-1));
30596          closeArray();
30597        }
30598        if (anyHasExtras(element.getMustSupport())) {
30599          openArray("_mustSupport");
30600          for (StringType e : element.getMustSupport()) 
30601            composeStringExtras(null, e, true);
30602          closeArray();
30603        }
30604      };
30605      if (element.hasCodeFilter()) {
30606        openArray("codeFilter");
30607        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
30608          composeDataRequirementCodeFilterComponent(null, e);
30609        closeArray();
30610      };
30611      if (element.hasDateFilter()) {
30612        openArray("dateFilter");
30613        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
30614          composeDataRequirementDateFilterComponent(null, e);
30615        closeArray();
30616      };
30617      if (element.hasLimitElement()) {
30618        composePositiveIntCore("limit", element.getLimitElement(), false);
30619        composePositiveIntExtras("limit", element.getLimitElement(), false);
30620      }
30621      if (element.hasSort()) {
30622        openArray("sort");
30623        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
30624          composeDataRequirementSortComponent(null, e);
30625        closeArray();
30626      };
30627  }
30628
30629  protected void composeDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30630    if (element != null) {
30631      open(name);
30632      composeDataRequirementCodeFilterComponentProperties(element);
30633      close();
30634    }
30635  }
30636
30637  protected void composeDataRequirementCodeFilterComponentProperties(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30638    composeElementProperties(element);
30639      if (element.hasPathElement()) {
30640        composeStringCore("path", element.getPathElement(), false);
30641        composeStringExtras("path", element.getPathElement(), false);
30642      }
30643      if (element.hasSearchParamElement()) {
30644        composeStringCore("searchParam", element.getSearchParamElement(), false);
30645        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30646      }
30647      if (element.hasValueSetElement()) {
30648        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
30649        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
30650      }
30651      if (element.hasCode()) {
30652        openArray("code");
30653        for (Coding e : element.getCode()) 
30654          composeCoding(null, e);
30655        closeArray();
30656      };
30657  }
30658
30659  protected void composeDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30660    if (element != null) {
30661      open(name);
30662      composeDataRequirementDateFilterComponentProperties(element);
30663      close();
30664    }
30665  }
30666
30667  protected void composeDataRequirementDateFilterComponentProperties(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30668    composeElementProperties(element);
30669      if (element.hasPathElement()) {
30670        composeStringCore("path", element.getPathElement(), false);
30671        composeStringExtras("path", element.getPathElement(), false);
30672      }
30673      if (element.hasSearchParamElement()) {
30674        composeStringCore("searchParam", element.getSearchParamElement(), false);
30675        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30676      }
30677      if (element.hasValue()) {
30678        composeType("value", element.getValue());
30679      }
30680  }
30681
30682  protected void composeDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
30683    if (element != null) {
30684      open(name);
30685      composeDataRequirementSortComponentProperties(element);
30686      close();
30687    }
30688  }
30689
30690  protected void composeDataRequirementSortComponentProperties(DataRequirement.DataRequirementSortComponent element) throws IOException {
30691    composeElementProperties(element);
30692      if (element.hasPathElement()) {
30693        composeStringCore("path", element.getPathElement(), false);
30694        composeStringExtras("path", element.getPathElement(), false);
30695      }
30696      if (element.hasDirectionElement()) {
30697        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
30698        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
30699      }
30700  }
30701
30702  protected void composeDistance(String name, Distance element) throws IOException {
30703    if (element != null) {
30704      open(name);
30705      composeDistanceProperties(element);
30706      close();
30707    }
30708  }
30709
30710  protected void composeDistanceProperties(Distance element) throws IOException {
30711    composeQuantityProperties(element);
30712  }
30713
30714  protected void composeDosage(String name, Dosage element) throws IOException {
30715    if (element != null) {
30716      open(name);
30717      composeDosageProperties(element);
30718      close();
30719    }
30720  }
30721
30722  protected void composeDosageProperties(Dosage element) throws IOException {
30723    composeDataTypeProperties(element);
30724      if (element.hasSequenceElement()) {
30725        composeIntegerCore("sequence", element.getSequenceElement(), false);
30726        composeIntegerExtras("sequence", element.getSequenceElement(), false);
30727      }
30728      if (element.hasTextElement()) {
30729        composeStringCore("text", element.getTextElement(), false);
30730        composeStringExtras("text", element.getTextElement(), false);
30731      }
30732      if (element.hasAdditionalInstruction()) {
30733        openArray("additionalInstruction");
30734        for (CodeableConcept e : element.getAdditionalInstruction()) 
30735          composeCodeableConcept(null, e);
30736        closeArray();
30737      };
30738      if (element.hasPatientInstructionElement()) {
30739        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
30740        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
30741      }
30742      if (element.hasTiming()) {
30743        composeTiming("timing", element.getTiming());
30744      }
30745      if (element.hasAsNeeded()) {
30746        composeType("asNeeded", element.getAsNeeded());
30747      }
30748      if (element.hasSite()) {
30749        composeCodeableConcept("site", element.getSite());
30750      }
30751      if (element.hasRoute()) {
30752        composeCodeableConcept("route", element.getRoute());
30753      }
30754      if (element.hasMethod()) {
30755        composeCodeableConcept("method", element.getMethod());
30756      }
30757      if (element.hasDoseAndRate()) {
30758        openArray("doseAndRate");
30759        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
30760          composeDosageDoseAndRateComponent(null, e);
30761        closeArray();
30762      };
30763      if (element.hasMaxDosePerPeriod()) {
30764        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
30765      }
30766      if (element.hasMaxDosePerAdministration()) {
30767        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
30768      }
30769      if (element.hasMaxDosePerLifetime()) {
30770        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
30771      }
30772  }
30773
30774  protected void composeDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
30775    if (element != null) {
30776      open(name);
30777      composeDosageDoseAndRateComponentProperties(element);
30778      close();
30779    }
30780  }
30781
30782  protected void composeDosageDoseAndRateComponentProperties(Dosage.DosageDoseAndRateComponent element) throws IOException {
30783    composeElementProperties(element);
30784      if (element.hasType()) {
30785        composeCodeableConcept("type", element.getType());
30786      }
30787      if (element.hasDose()) {
30788        composeType("dose", element.getDose());
30789      }
30790      if (element.hasRate()) {
30791        composeType("rate", element.getRate());
30792      }
30793  }
30794
30795  protected void composeDuration(String name, Duration element) throws IOException {
30796    if (element != null) {
30797      open(name);
30798      composeDurationProperties(element);
30799      close();
30800    }
30801  }
30802
30803  protected void composeDurationProperties(Duration element) throws IOException {
30804    composeQuantityProperties(element);
30805  }
30806
30807  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
30808    if (element != null) {
30809      open(name);
30810      composeElementDefinitionProperties(element);
30811      close();
30812    }
30813  }
30814
30815  protected void composeElementDefinitionProperties(ElementDefinition element) throws IOException {
30816    composeDataTypeProperties(element);
30817      if (element.hasPathElement()) {
30818        composeStringCore("path", element.getPathElement(), false);
30819        composeStringExtras("path", element.getPathElement(), false);
30820      }
30821      if (element.hasRepresentation()) {
30822        openArray("representation");
30823        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30824          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30825        closeArray();
30826        if (anyHasExtras(element.getRepresentation())) {
30827          openArray("_representation");
30828          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30829            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30830          closeArray();
30831        }
30832      };
30833      if (element.hasSliceNameElement()) {
30834        composeStringCore("sliceName", element.getSliceNameElement(), false);
30835        composeStringExtras("sliceName", element.getSliceNameElement(), false);
30836      }
30837      if (element.hasSliceIsConstrainingElement()) {
30838        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30839        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30840      }
30841      if (element.hasLabelElement()) {
30842        composeStringCore("label", element.getLabelElement(), false);
30843        composeStringExtras("label", element.getLabelElement(), false);
30844      }
30845      if (element.hasCode()) {
30846        openArray("code");
30847        for (Coding e : element.getCode()) 
30848          composeCoding(null, e);
30849        closeArray();
30850      };
30851      if (element.hasSlicing()) {
30852        composeElementDefinitionSlicingComponent("slicing", element.getSlicing());
30853      }
30854      if (element.hasShortElement()) {
30855        composeStringCore("short", element.getShortElement(), false);
30856        composeStringExtras("short", element.getShortElement(), false);
30857      }
30858      if (element.hasDefinitionElement()) {
30859        composeMarkdownCore("definition", element.getDefinitionElement(), false);
30860        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
30861      }
30862      if (element.hasCommentElement()) {
30863        composeMarkdownCore("comment", element.getCommentElement(), false);
30864        composeMarkdownExtras("comment", element.getCommentElement(), false);
30865      }
30866      if (element.hasRequirementsElement()) {
30867        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
30868        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
30869      }
30870      if (element.hasAlias()) {
30871        if (anyHasValue(element.getAlias())) {
30872          openArray("alias");
30873          for (StringType e : element.getAlias()) 
30874            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
30875          closeArray();
30876        }
30877        if (anyHasExtras(element.getAlias())) {
30878          openArray("_alias");
30879          for (StringType e : element.getAlias()) 
30880            composeStringExtras(null, e, true);
30881          closeArray();
30882        }
30883      };
30884      if (element.hasMinElement()) {
30885        composeUnsignedIntCore("min", element.getMinElement(), false);
30886        composeUnsignedIntExtras("min", element.getMinElement(), false);
30887      }
30888      if (element.hasMaxElement()) {
30889        composeStringCore("max", element.getMaxElement(), false);
30890        composeStringExtras("max", element.getMaxElement(), false);
30891      }
30892      if (element.hasBase()) {
30893        composeElementDefinitionBaseComponent("base", element.getBase());
30894      }
30895      if (element.hasContentReferenceElement()) {
30896        composeUriCore("contentReference", element.getContentReferenceElement(), false);
30897        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
30898      }
30899      if (element.hasType()) {
30900        openArray("type");
30901        for (ElementDefinition.TypeRefComponent e : element.getType()) 
30902          composeTypeRefComponent(null, e);
30903        closeArray();
30904      };
30905      if (element.hasDefaultValue()) {
30906        composeType("defaultValue", element.getDefaultValue());
30907      }
30908      if (element.hasMeaningWhenMissingElement()) {
30909        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30910        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30911      }
30912      if (element.hasOrderMeaningElement()) {
30913        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
30914        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
30915      }
30916      if (element.hasFixed()) {
30917        composeType("fixed", element.getFixed());
30918      }
30919      if (element.hasPattern()) {
30920        composeType("pattern", element.getPattern());
30921      }
30922      if (element.hasExample()) {
30923        openArray("example");
30924        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
30925          composeElementDefinitionExampleComponent(null, e);
30926        closeArray();
30927      };
30928      if (element.hasMinValue()) {
30929        composeType("minValue", element.getMinValue());
30930      }
30931      if (element.hasMaxValue()) {
30932        composeType("maxValue", element.getMaxValue());
30933      }
30934      if (element.hasMaxLengthElement()) {
30935        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
30936        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
30937      }
30938      if (element.hasCondition()) {
30939        if (anyHasValue(element.getCondition())) {
30940          openArray("condition");
30941          for (IdType e : element.getCondition()) 
30942            composeIdCore(null, e, e != element.getCondition().get(element.getCondition().size()-1));
30943          closeArray();
30944        }
30945        if (anyHasExtras(element.getCondition())) {
30946          openArray("_condition");
30947          for (IdType e : element.getCondition()) 
30948            composeIdExtras(null, e, true);
30949          closeArray();
30950        }
30951      };
30952      if (element.hasConstraint()) {
30953        openArray("constraint");
30954        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
30955          composeElementDefinitionConstraintComponent(null, e);
30956        closeArray();
30957      };
30958      if (element.hasMustSupportElement()) {
30959        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
30960        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
30961      }
30962      if (element.hasIsModifierElement()) {
30963        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
30964        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
30965      }
30966      if (element.hasIsModifierReasonElement()) {
30967        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
30968        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
30969      }
30970      if (element.hasIsSummaryElement()) {
30971        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
30972        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
30973      }
30974      if (element.hasBinding()) {
30975        composeElementDefinitionBindingComponent("binding", element.getBinding());
30976      }
30977      if (element.hasMapping()) {
30978        openArray("mapping");
30979        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
30980          composeElementDefinitionMappingComponent(null, e);
30981        closeArray();
30982      };
30983  }
30984
30985  protected void composeElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30986    if (element != null) {
30987      open(name);
30988      composeElementDefinitionSlicingComponentProperties(element);
30989      close();
30990    }
30991  }
30992
30993  protected void composeElementDefinitionSlicingComponentProperties(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30994    composeElementProperties(element);
30995      if (element.hasDiscriminator()) {
30996        openArray("discriminator");
30997        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
30998          composeElementDefinitionSlicingDiscriminatorComponent(null, e);
30999        closeArray();
31000      };
31001      if (element.hasDescriptionElement()) {
31002        composeStringCore("description", element.getDescriptionElement(), false);
31003        composeStringExtras("description", element.getDescriptionElement(), false);
31004      }
31005      if (element.hasOrderedElement()) {
31006        composeBooleanCore("ordered", element.getOrderedElement(), false);
31007        composeBooleanExtras("ordered", element.getOrderedElement(), false);
31008      }
31009      if (element.hasRulesElement()) {
31010        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31011        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31012      }
31013  }
31014
31015  protected void composeElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31016    if (element != null) {
31017      open(name);
31018      composeElementDefinitionSlicingDiscriminatorComponentProperties(element);
31019      close();
31020    }
31021  }
31022
31023  protected void composeElementDefinitionSlicingDiscriminatorComponentProperties(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31024    composeElementProperties(element);
31025      if (element.hasTypeElement()) {
31026        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31027        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31028      }
31029      if (element.hasPathElement()) {
31030        composeStringCore("path", element.getPathElement(), false);
31031        composeStringExtras("path", element.getPathElement(), false);
31032      }
31033  }
31034
31035  protected void composeElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31036    if (element != null) {
31037      open(name);
31038      composeElementDefinitionBaseComponentProperties(element);
31039      close();
31040    }
31041  }
31042
31043  protected void composeElementDefinitionBaseComponentProperties(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31044    composeElementProperties(element);
31045      if (element.hasPathElement()) {
31046        composeStringCore("path", element.getPathElement(), false);
31047        composeStringExtras("path", element.getPathElement(), false);
31048      }
31049      if (element.hasMinElement()) {
31050        composeUnsignedIntCore("min", element.getMinElement(), false);
31051        composeUnsignedIntExtras("min", element.getMinElement(), false);
31052      }
31053      if (element.hasMaxElement()) {
31054        composeStringCore("max", element.getMaxElement(), false);
31055        composeStringExtras("max", element.getMaxElement(), false);
31056      }
31057  }
31058
31059  protected void composeTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
31060    if (element != null) {
31061      open(name);
31062      composeTypeRefComponentProperties(element);
31063      close();
31064    }
31065  }
31066
31067  protected void composeTypeRefComponentProperties(ElementDefinition.TypeRefComponent element) throws IOException {
31068    composeElementProperties(element);
31069      if (element.hasCodeElement()) {
31070        composeUriCore("code", element.getCodeElement(), false);
31071        composeUriExtras("code", element.getCodeElement(), false);
31072      }
31073      if (element.hasProfile()) {
31074        if (anyHasValue(element.getProfile())) {
31075          openArray("profile");
31076          for (CanonicalType e : element.getProfile()) 
31077            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
31078          closeArray();
31079        }
31080        if (anyHasExtras(element.getProfile())) {
31081          openArray("_profile");
31082          for (CanonicalType e : element.getProfile()) 
31083            composeCanonicalExtras(null, e, true);
31084          closeArray();
31085        }
31086      };
31087      if (element.hasTargetProfile()) {
31088        if (anyHasValue(element.getTargetProfile())) {
31089          openArray("targetProfile");
31090          for (CanonicalType e : element.getTargetProfile()) 
31091            composeCanonicalCore(null, e, e != element.getTargetProfile().get(element.getTargetProfile().size()-1));
31092          closeArray();
31093        }
31094        if (anyHasExtras(element.getTargetProfile())) {
31095          openArray("_targetProfile");
31096          for (CanonicalType e : element.getTargetProfile()) 
31097            composeCanonicalExtras(null, e, true);
31098          closeArray();
31099        }
31100      };
31101      if (element.hasAggregation()) {
31102        openArray("aggregation");
31103        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31104          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31105        closeArray();
31106        if (anyHasExtras(element.getAggregation())) {
31107          openArray("_aggregation");
31108          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31109            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31110          closeArray();
31111        }
31112      };
31113      if (element.hasVersioningElement()) {
31114        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31115        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31116      }
31117  }
31118
31119  protected void composeElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31120    if (element != null) {
31121      open(name);
31122      composeElementDefinitionExampleComponentProperties(element);
31123      close();
31124    }
31125  }
31126
31127  protected void composeElementDefinitionExampleComponentProperties(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31128    composeElementProperties(element);
31129      if (element.hasLabelElement()) {
31130        composeStringCore("label", element.getLabelElement(), false);
31131        composeStringExtras("label", element.getLabelElement(), false);
31132      }
31133      if (element.hasValue()) {
31134        composeType("value", element.getValue());
31135      }
31136  }
31137
31138  protected void composeElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31139    if (element != null) {
31140      open(name);
31141      composeElementDefinitionConstraintComponentProperties(element);
31142      close();
31143    }
31144  }
31145
31146  protected void composeElementDefinitionConstraintComponentProperties(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31147    composeElementProperties(element);
31148      if (element.hasKeyElement()) {
31149        composeIdCore("key", element.getKeyElement(), false);
31150        composeIdExtras("key", element.getKeyElement(), false);
31151      }
31152      if (element.hasRequirementsElement()) {
31153        composeStringCore("requirements", element.getRequirementsElement(), false);
31154        composeStringExtras("requirements", element.getRequirementsElement(), false);
31155      }
31156      if (element.hasSeverityElement()) {
31157        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31158        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31159      }
31160      if (element.hasHumanElement()) {
31161        composeStringCore("human", element.getHumanElement(), false);
31162        composeStringExtras("human", element.getHumanElement(), false);
31163      }
31164      if (element.hasExpressionElement()) {
31165        composeStringCore("expression", element.getExpressionElement(), false);
31166        composeStringExtras("expression", element.getExpressionElement(), false);
31167      }
31168      if (element.hasXpathElement()) {
31169        composeStringCore("xpath", element.getXpathElement(), false);
31170        composeStringExtras("xpath", element.getXpathElement(), false);
31171      }
31172      if (element.hasSourceElement()) {
31173        composeCanonicalCore("source", element.getSourceElement(), false);
31174        composeCanonicalExtras("source", element.getSourceElement(), false);
31175      }
31176  }
31177
31178  protected void composeElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31179    if (element != null) {
31180      open(name);
31181      composeElementDefinitionBindingComponentProperties(element);
31182      close();
31183    }
31184  }
31185
31186  protected void composeElementDefinitionBindingComponentProperties(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31187    composeElementProperties(element);
31188      if (element.hasStrengthElement()) {
31189        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31190        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31191      }
31192      if (element.hasDescriptionElement()) {
31193        composeStringCore("description", element.getDescriptionElement(), false);
31194        composeStringExtras("description", element.getDescriptionElement(), false);
31195      }
31196      if (element.hasValueSetElement()) {
31197        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
31198        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
31199      }
31200  }
31201
31202  protected void composeElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31203    if (element != null) {
31204      open(name);
31205      composeElementDefinitionMappingComponentProperties(element);
31206      close();
31207    }
31208  }
31209
31210  protected void composeElementDefinitionMappingComponentProperties(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31211    composeElementProperties(element);
31212      if (element.hasIdentityElement()) {
31213        composeIdCore("identity", element.getIdentityElement(), false);
31214        composeIdExtras("identity", element.getIdentityElement(), false);
31215      }
31216      if (element.hasLanguageElement()) {
31217        composeCodeCore("language", element.getLanguageElement(), false);
31218        composeCodeExtras("language", element.getLanguageElement(), false);
31219      }
31220      if (element.hasMapElement()) {
31221        composeStringCore("map", element.getMapElement(), false);
31222        composeStringExtras("map", element.getMapElement(), false);
31223      }
31224      if (element.hasCommentElement()) {
31225        composeStringCore("comment", element.getCommentElement(), false);
31226        composeStringExtras("comment", element.getCommentElement(), false);
31227      }
31228  }
31229
31230  protected void composeExpression(String name, Expression element) throws IOException {
31231    if (element != null) {
31232      open(name);
31233      composeExpressionProperties(element);
31234      close();
31235    }
31236  }
31237
31238  protected void composeExpressionProperties(Expression element) throws IOException {
31239    composeDataTypeProperties(element);
31240      if (element.hasDescriptionElement()) {
31241        composeStringCore("description", element.getDescriptionElement(), false);
31242        composeStringExtras("description", element.getDescriptionElement(), false);
31243      }
31244      if (element.hasNameElement()) {
31245        composeIdCore("name", element.getNameElement(), false);
31246        composeIdExtras("name", element.getNameElement(), false);
31247      }
31248      if (element.hasLanguageElement()) {
31249        composeCodeCore("language", element.getLanguageElement(), false);
31250        composeCodeExtras("language", element.getLanguageElement(), false);
31251      }
31252      if (element.hasExpressionElement()) {
31253        composeStringCore("expression", element.getExpressionElement(), false);
31254        composeStringExtras("expression", element.getExpressionElement(), false);
31255      }
31256      if (element.hasReferenceElement()) {
31257        composeUriCore("reference", element.getReferenceElement(), false);
31258        composeUriExtras("reference", element.getReferenceElement(), false);
31259      }
31260  }
31261
31262  protected void composeExtension(String name, Extension element) throws IOException {
31263    if (element != null) {
31264      open(name);
31265      composeExtensionProperties(element);
31266      close();
31267    }
31268  }
31269
31270  protected void composeExtensionProperties(Extension element) throws IOException {
31271    composeDataTypeProperties(element);
31272      if (element.hasUrlElement()) {
31273        composeUriCore("url", element.getUrlElement(), false);
31274        composeUriExtras("url", element.getUrlElement(), false);
31275      }
31276      if (element.hasValue()) {
31277        composeType("value", element.getValue());
31278      }
31279  }
31280
31281  protected void composeHumanName(String name, HumanName element) throws IOException {
31282    if (element != null) {
31283      open(name);
31284      composeHumanNameProperties(element);
31285      close();
31286    }
31287  }
31288
31289  protected void composeHumanNameProperties(HumanName element) throws IOException {
31290    composeDataTypeProperties(element);
31291      if (element.hasUseElement()) {
31292        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
31293        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
31294      }
31295      if (element.hasTextElement()) {
31296        composeStringCore("text", element.getTextElement(), false);
31297        composeStringExtras("text", element.getTextElement(), false);
31298      }
31299      if (element.hasFamilyElement()) {
31300        composeStringCore("family", element.getFamilyElement(), false);
31301        composeStringExtras("family", element.getFamilyElement(), false);
31302      }
31303      if (element.hasGiven()) {
31304        if (anyHasValue(element.getGiven())) {
31305          openArray("given");
31306          for (StringType e : element.getGiven()) 
31307            composeStringCore(null, e, e != element.getGiven().get(element.getGiven().size()-1));
31308          closeArray();
31309        }
31310        if (anyHasExtras(element.getGiven())) {
31311          openArray("_given");
31312          for (StringType e : element.getGiven()) 
31313            composeStringExtras(null, e, true);
31314          closeArray();
31315        }
31316      };
31317      if (element.hasPrefix()) {
31318        if (anyHasValue(element.getPrefix())) {
31319          openArray("prefix");
31320          for (StringType e : element.getPrefix()) 
31321            composeStringCore(null, e, e != element.getPrefix().get(element.getPrefix().size()-1));
31322          closeArray();
31323        }
31324        if (anyHasExtras(element.getPrefix())) {
31325          openArray("_prefix");
31326          for (StringType e : element.getPrefix()) 
31327            composeStringExtras(null, e, true);
31328          closeArray();
31329        }
31330      };
31331      if (element.hasSuffix()) {
31332        if (anyHasValue(element.getSuffix())) {
31333          openArray("suffix");
31334          for (StringType e : element.getSuffix()) 
31335            composeStringCore(null, e, e != element.getSuffix().get(element.getSuffix().size()-1));
31336          closeArray();
31337        }
31338        if (anyHasExtras(element.getSuffix())) {
31339          openArray("_suffix");
31340          for (StringType e : element.getSuffix()) 
31341            composeStringExtras(null, e, true);
31342          closeArray();
31343        }
31344      };
31345      if (element.hasPeriod()) {
31346        composePeriod("period", element.getPeriod());
31347      }
31348  }
31349
31350  protected void composeIdentifier(String name, Identifier element) throws IOException {
31351    if (element != null) {
31352      open(name);
31353      composeIdentifierProperties(element);
31354      close();
31355    }
31356  }
31357
31358  protected void composeIdentifierProperties(Identifier element) throws IOException {
31359    composeDataTypeProperties(element);
31360      if (element.hasUseElement()) {
31361        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
31362        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
31363      }
31364      if (element.hasType()) {
31365        composeCodeableConcept("type", element.getType());
31366      }
31367      if (element.hasSystemElement()) {
31368        composeUriCore("system", element.getSystemElement(), false);
31369        composeUriExtras("system", element.getSystemElement(), false);
31370      }
31371      if (element.hasValueElement()) {
31372        composeStringCore("value", element.getValueElement(), false);
31373        composeStringExtras("value", element.getValueElement(), false);
31374      }
31375      if (element.hasPeriod()) {
31376        composePeriod("period", element.getPeriod());
31377      }
31378      if (element.hasAssigner()) {
31379        composeReference("assigner", element.getAssigner());
31380      }
31381  }
31382
31383  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
31384    if (element != null) {
31385      open(name);
31386      composeMarketingStatusProperties(element);
31387      close();
31388    }
31389  }
31390
31391  protected void composeMarketingStatusProperties(MarketingStatus element) throws IOException {
31392    composeDataTypeProperties(element);
31393      if (element.hasCountry()) {
31394        composeCodeableConcept("country", element.getCountry());
31395      }
31396      if (element.hasJurisdiction()) {
31397        composeCodeableConcept("jurisdiction", element.getJurisdiction());
31398      }
31399      if (element.hasStatus()) {
31400        composeCodeableConcept("status", element.getStatus());
31401      }
31402      if (element.hasDateRange()) {
31403        composePeriod("dateRange", element.getDateRange());
31404      }
31405      if (element.hasRestoreDateElement()) {
31406        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
31407        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
31408      }
31409  }
31410
31411  protected void composeMeta(String name, Meta element) throws IOException {
31412    if (element != null) {
31413      open(name);
31414      composeMetaProperties(element);
31415      close();
31416    }
31417  }
31418
31419  protected void composeMetaProperties(Meta element) throws IOException {
31420    composeDataTypeProperties(element);
31421      if (element.hasVersionIdElement()) {
31422        composeIdCore("versionId", element.getVersionIdElement(), false);
31423        composeIdExtras("versionId", element.getVersionIdElement(), false);
31424      }
31425      if (element.hasLastUpdatedElement()) {
31426        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
31427        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
31428      }
31429      if (element.hasSourceElement()) {
31430        composeUriCore("source", element.getSourceElement(), false);
31431        composeUriExtras("source", element.getSourceElement(), false);
31432      }
31433      if (element.hasProfile()) {
31434        if (anyHasValue(element.getProfile())) {
31435          openArray("profile");
31436          for (CanonicalType e : element.getProfile()) 
31437            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
31438          closeArray();
31439        }
31440        if (anyHasExtras(element.getProfile())) {
31441          openArray("_profile");
31442          for (CanonicalType e : element.getProfile()) 
31443            composeCanonicalExtras(null, e, true);
31444          closeArray();
31445        }
31446      };
31447      if (element.hasSecurity()) {
31448        openArray("security");
31449        for (Coding e : element.getSecurity()) 
31450          composeCoding(null, e);
31451        closeArray();
31452      };
31453      if (element.hasTag()) {
31454        openArray("tag");
31455        for (Coding e : element.getTag()) 
31456          composeCoding(null, e);
31457        closeArray();
31458      };
31459  }
31460
31461  protected void composeMoney(String name, Money element) throws IOException {
31462    if (element != null) {
31463      open(name);
31464      composeMoneyProperties(element);
31465      close();
31466    }
31467  }
31468
31469  protected void composeMoneyProperties(Money element) throws IOException {
31470    composeDataTypeProperties(element);
31471      if (element.hasValueElement()) {
31472        composeDecimalCore("value", element.getValueElement(), false);
31473        composeDecimalExtras("value", element.getValueElement(), false);
31474      }
31475      if (element.hasCurrencyElement()) {
31476        composeCodeCore("currency", element.getCurrencyElement(), false);
31477        composeCodeExtras("currency", element.getCurrencyElement(), false);
31478      }
31479  }
31480
31481  protected void composeNarrative(String name, Narrative element) throws IOException {
31482    if (element != null) {
31483      open(name);
31484      composeNarrativeProperties(element);
31485      close();
31486    }
31487  }
31488
31489  protected void composeNarrativeProperties(Narrative element) throws IOException {
31490    composeDataTypeProperties(element);
31491      if (element.hasStatusElement()) {
31492        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
31493        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
31494      }
31495      if (element.hasDiv()) {
31496        XhtmlNode node = element.getDiv();
31497        if (node.getNsDecl() == null) {
31498          node.attribute("xmlns", XHTML_NS);
31499        }
31500        composeXhtml("div", node);
31501      }
31502  }
31503
31504  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
31505    if (element != null) {
31506      open(name);
31507      composeParameterDefinitionProperties(element);
31508      close();
31509    }
31510  }
31511
31512  protected void composeParameterDefinitionProperties(ParameterDefinition element) throws IOException {
31513    composeDataTypeProperties(element);
31514      if (element.hasNameElement()) {
31515        composeCodeCore("name", element.getNameElement(), false);
31516        composeCodeExtras("name", element.getNameElement(), false);
31517      }
31518      if (element.hasUseElement()) {
31519        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
31520        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
31521      }
31522      if (element.hasMinElement()) {
31523        composeIntegerCore("min", element.getMinElement(), false);
31524        composeIntegerExtras("min", element.getMinElement(), false);
31525      }
31526      if (element.hasMaxElement()) {
31527        composeStringCore("max", element.getMaxElement(), false);
31528        composeStringExtras("max", element.getMaxElement(), false);
31529      }
31530      if (element.hasDocumentationElement()) {
31531        composeStringCore("documentation", element.getDocumentationElement(), false);
31532        composeStringExtras("documentation", element.getDocumentationElement(), false);
31533      }
31534      if (element.hasTypeElement()) {
31535        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
31536        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
31537      }
31538      if (element.hasProfileElement()) {
31539        composeCanonicalCore("profile", element.getProfileElement(), false);
31540        composeCanonicalExtras("profile", element.getProfileElement(), false);
31541      }
31542  }
31543
31544  protected void composePeriod(String name, Period element) throws IOException {
31545    if (element != null) {
31546      open(name);
31547      composePeriodProperties(element);
31548      close();
31549    }
31550  }
31551
31552  protected void composePeriodProperties(Period element) throws IOException {
31553    composeDataTypeProperties(element);
31554      if (element.hasStartElement()) {
31555        composeDateTimeCore("start", element.getStartElement(), false);
31556        composeDateTimeExtras("start", element.getStartElement(), false);
31557      }
31558      if (element.hasEndElement()) {
31559        composeDateTimeCore("end", element.getEndElement(), false);
31560        composeDateTimeExtras("end", element.getEndElement(), false);
31561      }
31562  }
31563
31564  protected void composePopulation(String name, Population element) throws IOException {
31565    if (element != null) {
31566      open(name);
31567      composePopulationProperties(element);
31568      close();
31569    }
31570  }
31571
31572  protected void composePopulationProperties(Population element) throws IOException {
31573    composeDataTypeProperties(element);
31574      if (element.hasAge()) {
31575        composeType("age", element.getAge());
31576      }
31577      if (element.hasGender()) {
31578        composeCodeableConcept("gender", element.getGender());
31579      }
31580      if (element.hasRace()) {
31581        composeCodeableConcept("race", element.getRace());
31582      }
31583      if (element.hasPhysiologicalCondition()) {
31584        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
31585      }
31586  }
31587
31588  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
31589    if (element != null) {
31590      open(name);
31591      composeProdCharacteristicProperties(element);
31592      close();
31593    }
31594  }
31595
31596  protected void composeProdCharacteristicProperties(ProdCharacteristic element) throws IOException {
31597    composeDataTypeProperties(element);
31598      if (element.hasHeight()) {
31599        composeQuantity("height", element.getHeight());
31600      }
31601      if (element.hasWidth()) {
31602        composeQuantity("width", element.getWidth());
31603      }
31604      if (element.hasDepth()) {
31605        composeQuantity("depth", element.getDepth());
31606      }
31607      if (element.hasWeight()) {
31608        composeQuantity("weight", element.getWeight());
31609      }
31610      if (element.hasNominalVolume()) {
31611        composeQuantity("nominalVolume", element.getNominalVolume());
31612      }
31613      if (element.hasExternalDiameter()) {
31614        composeQuantity("externalDiameter", element.getExternalDiameter());
31615      }
31616      if (element.hasShapeElement()) {
31617        composeStringCore("shape", element.getShapeElement(), false);
31618        composeStringExtras("shape", element.getShapeElement(), false);
31619      }
31620      if (element.hasColor()) {
31621        if (anyHasValue(element.getColor())) {
31622          openArray("color");
31623          for (StringType e : element.getColor()) 
31624            composeStringCore(null, e, e != element.getColor().get(element.getColor().size()-1));
31625          closeArray();
31626        }
31627        if (anyHasExtras(element.getColor())) {
31628          openArray("_color");
31629          for (StringType e : element.getColor()) 
31630            composeStringExtras(null, e, true);
31631          closeArray();
31632        }
31633      };
31634      if (element.hasImprint()) {
31635        if (anyHasValue(element.getImprint())) {
31636          openArray("imprint");
31637          for (StringType e : element.getImprint()) 
31638            composeStringCore(null, e, e != element.getImprint().get(element.getImprint().size()-1));
31639          closeArray();
31640        }
31641        if (anyHasExtras(element.getImprint())) {
31642          openArray("_imprint");
31643          for (StringType e : element.getImprint()) 
31644            composeStringExtras(null, e, true);
31645          closeArray();
31646        }
31647      };
31648      if (element.hasImage()) {
31649        openArray("image");
31650        for (Attachment e : element.getImage()) 
31651          composeAttachment(null, e);
31652        closeArray();
31653      };
31654      if (element.hasScoring()) {
31655        composeCodeableConcept("scoring", element.getScoring());
31656      }
31657  }
31658
31659  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
31660    if (element != null) {
31661      open(name);
31662      composeProductShelfLifeProperties(element);
31663      close();
31664    }
31665  }
31666
31667  protected void composeProductShelfLifeProperties(ProductShelfLife element) throws IOException {
31668    composeDataTypeProperties(element);
31669      if (element.hasType()) {
31670        composeCodeableConcept("type", element.getType());
31671      }
31672      if (element.hasPeriod()) {
31673        composeType("period", element.getPeriod());
31674      }
31675      if (element.hasSpecialPrecautionsForStorage()) {
31676        openArray("specialPrecautionsForStorage");
31677        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
31678          composeCodeableConcept(null, e);
31679        closeArray();
31680      };
31681  }
31682
31683  protected void composeQuantity(String name, Quantity element) throws IOException {
31684    if (element != null) {
31685      open(name);
31686      composeQuantityProperties(element);
31687      close();
31688    }
31689  }
31690
31691  protected void composeQuantityProperties(Quantity element) throws IOException {
31692    composeDataTypeProperties(element);
31693      if (element.hasValueElement()) {
31694        composeDecimalCore("value", element.getValueElement(), false);
31695        composeDecimalExtras("value", element.getValueElement(), false);
31696      }
31697      if (element.hasComparatorElement()) {
31698        composeEnumerationCore("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
31699        composeEnumerationExtras("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
31700      }
31701      if (element.hasUnitElement()) {
31702        composeStringCore("unit", element.getUnitElement(), false);
31703        composeStringExtras("unit", element.getUnitElement(), false);
31704      }
31705      if (element.hasSystemElement()) {
31706        composeUriCore("system", element.getSystemElement(), false);
31707        composeUriExtras("system", element.getSystemElement(), false);
31708      }
31709      if (element.hasCodeElement()) {
31710        composeCodeCore("code", element.getCodeElement(), false);
31711        composeCodeExtras("code", element.getCodeElement(), false);
31712      }
31713  }
31714
31715  protected void composeRange(String name, Range element) throws IOException {
31716    if (element != null) {
31717      open(name);
31718      composeRangeProperties(element);
31719      close();
31720    }
31721  }
31722
31723  protected void composeRangeProperties(Range element) throws IOException {
31724    composeDataTypeProperties(element);
31725      if (element.hasLow()) {
31726        composeQuantity("low", element.getLow());
31727      }
31728      if (element.hasHigh()) {
31729        composeQuantity("high", element.getHigh());
31730      }
31731  }
31732
31733  protected void composeRatio(String name, Ratio element) throws IOException {
31734    if (element != null) {
31735      open(name);
31736      composeRatioProperties(element);
31737      close();
31738    }
31739  }
31740
31741  protected void composeRatioProperties(Ratio element) throws IOException {
31742    composeDataTypeProperties(element);
31743      if (element.hasNumerator()) {
31744        composeQuantity("numerator", element.getNumerator());
31745      }
31746      if (element.hasDenominator()) {
31747        composeQuantity("denominator", element.getDenominator());
31748      }
31749  }
31750
31751  protected void composeRatioRange(String name, RatioRange element) throws IOException {
31752    if (element != null) {
31753      open(name);
31754      composeRatioRangeProperties(element);
31755      close();
31756    }
31757  }
31758
31759  protected void composeRatioRangeProperties(RatioRange element) throws IOException {
31760    composeDataTypeProperties(element);
31761      if (element.hasLowNumerator()) {
31762        composeQuantity("lowNumerator", element.getLowNumerator());
31763      }
31764      if (element.hasHighNumerator()) {
31765        composeQuantity("highNumerator", element.getHighNumerator());
31766      }
31767      if (element.hasDenominator()) {
31768        composeQuantity("denominator", element.getDenominator());
31769      }
31770  }
31771
31772  protected void composeReference(String name, Reference element) throws IOException {
31773    if (element != null) {
31774      open(name);
31775      composeReferenceProperties(element);
31776      close();
31777    }
31778  }
31779
31780  protected void composeReferenceProperties(Reference element) throws IOException {
31781    composeDataTypeProperties(element);
31782      if (element.hasReferenceElement()) {
31783        composeStringCore("reference", element.getReferenceElement(), false);
31784        composeStringExtras("reference", element.getReferenceElement(), false);
31785      }
31786      if (element.hasTypeElement()) {
31787        composeUriCore("type", element.getTypeElement(), false);
31788        composeUriExtras("type", element.getTypeElement(), false);
31789      }
31790      if (element.hasIdentifier()) {
31791        composeIdentifier("identifier", element.getIdentifier());
31792      }
31793      if (element.hasDisplayElement()) {
31794        composeStringCore("display", element.getDisplayElement(), false);
31795        composeStringExtras("display", element.getDisplayElement(), false);
31796      }
31797  }
31798
31799  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
31800    if (element != null) {
31801      open(name);
31802      composeRelatedArtifactProperties(element);
31803      close();
31804    }
31805  }
31806
31807  protected void composeRelatedArtifactProperties(RelatedArtifact element) throws IOException {
31808    composeDataTypeProperties(element);
31809      if (element.hasTypeElement()) {
31810        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
31811        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
31812      }
31813      if (element.hasLabelElement()) {
31814        composeStringCore("label", element.getLabelElement(), false);
31815        composeStringExtras("label", element.getLabelElement(), false);
31816      }
31817      if (element.hasDisplayElement()) {
31818        composeStringCore("display", element.getDisplayElement(), false);
31819        composeStringExtras("display", element.getDisplayElement(), false);
31820      }
31821      if (element.hasCitationElement()) {
31822        composeMarkdownCore("citation", element.getCitationElement(), false);
31823        composeMarkdownExtras("citation", element.getCitationElement(), false);
31824      }
31825      if (element.hasUrlElement()) {
31826        composeUrlCore("url", element.getUrlElement(), false);
31827        composeUrlExtras("url", element.getUrlElement(), false);
31828      }
31829      if (element.hasDocument()) {
31830        composeAttachment("document", element.getDocument());
31831      }
31832      if (element.hasResourceElement()) {
31833        composeCanonicalCore("resource", element.getResourceElement(), false);
31834        composeCanonicalExtras("resource", element.getResourceElement(), false);
31835      }
31836  }
31837
31838  protected void composeSampledData(String name, SampledData element) throws IOException {
31839    if (element != null) {
31840      open(name);
31841      composeSampledDataProperties(element);
31842      close();
31843    }
31844  }
31845
31846  protected void composeSampledDataProperties(SampledData element) throws IOException {
31847    composeDataTypeProperties(element);
31848      if (element.hasOrigin()) {
31849        composeQuantity("origin", element.getOrigin());
31850      }
31851      if (element.hasPeriodElement()) {
31852        composeDecimalCore("period", element.getPeriodElement(), false);
31853        composeDecimalExtras("period", element.getPeriodElement(), false);
31854      }
31855      if (element.hasFactorElement()) {
31856        composeDecimalCore("factor", element.getFactorElement(), false);
31857        composeDecimalExtras("factor", element.getFactorElement(), false);
31858      }
31859      if (element.hasLowerLimitElement()) {
31860        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
31861        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
31862      }
31863      if (element.hasUpperLimitElement()) {
31864        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
31865        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
31866      }
31867      if (element.hasDimensionsElement()) {
31868        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
31869        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
31870      }
31871      if (element.hasDataElement()) {
31872        composeStringCore("data", element.getDataElement(), false);
31873        composeStringExtras("data", element.getDataElement(), false);
31874      }
31875  }
31876
31877  protected void composeSignature(String name, Signature element) throws IOException {
31878    if (element != null) {
31879      open(name);
31880      composeSignatureProperties(element);
31881      close();
31882    }
31883  }
31884
31885  protected void composeSignatureProperties(Signature element) throws IOException {
31886    composeDataTypeProperties(element);
31887      if (element.hasType()) {
31888        openArray("type");
31889        for (Coding e : element.getType()) 
31890          composeCoding(null, e);
31891        closeArray();
31892      };
31893      if (element.hasWhenElement()) {
31894        composeInstantCore("when", element.getWhenElement(), false);
31895        composeInstantExtras("when", element.getWhenElement(), false);
31896      }
31897      if (element.hasWho()) {
31898        composeReference("who", element.getWho());
31899      }
31900      if (element.hasOnBehalfOf()) {
31901        composeReference("onBehalfOf", element.getOnBehalfOf());
31902      }
31903      if (element.hasTargetFormatElement()) {
31904        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
31905        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
31906      }
31907      if (element.hasSigFormatElement()) {
31908        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
31909        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
31910      }
31911      if (element.hasDataElement()) {
31912        composeBase64BinaryCore("data", element.getDataElement(), false);
31913        composeBase64BinaryExtras("data", element.getDataElement(), false);
31914      }
31915  }
31916
31917  protected void composeTiming(String name, Timing element) throws IOException {
31918    if (element != null) {
31919      open(name);
31920      composeTimingProperties(element);
31921      close();
31922    }
31923  }
31924
31925  protected void composeTimingProperties(Timing element) throws IOException {
31926    composeDataTypeProperties(element);
31927      if (element.hasEvent()) {
31928        if (anyHasValue(element.getEvent())) {
31929          openArray("event");
31930          for (DateTimeType e : element.getEvent()) 
31931            composeDateTimeCore(null, e, e != element.getEvent().get(element.getEvent().size()-1));
31932          closeArray();
31933        }
31934        if (anyHasExtras(element.getEvent())) {
31935          openArray("_event");
31936          for (DateTimeType e : element.getEvent()) 
31937            composeDateTimeExtras(null, e, true);
31938          closeArray();
31939        }
31940      };
31941      if (element.hasRepeat()) {
31942        composeTimingRepeatComponent("repeat", element.getRepeat());
31943      }
31944      if (element.hasCode()) {
31945        composeCodeableConcept("code", element.getCode());
31946      }
31947  }
31948
31949  protected void composeTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
31950    if (element != null) {
31951      open(name);
31952      composeTimingRepeatComponentProperties(element);
31953      close();
31954    }
31955  }
31956
31957  protected void composeTimingRepeatComponentProperties(Timing.TimingRepeatComponent element) throws IOException {
31958    composeElementProperties(element);
31959      if (element.hasBounds()) {
31960        composeType("bounds", element.getBounds());
31961      }
31962      if (element.hasCountElement()) {
31963        composePositiveIntCore("count", element.getCountElement(), false);
31964        composePositiveIntExtras("count", element.getCountElement(), false);
31965      }
31966      if (element.hasCountMaxElement()) {
31967        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
31968        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
31969      }
31970      if (element.hasDurationElement()) {
31971        composeDecimalCore("duration", element.getDurationElement(), false);
31972        composeDecimalExtras("duration", element.getDurationElement(), false);
31973      }
31974      if (element.hasDurationMaxElement()) {
31975        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
31976        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
31977      }
31978      if (element.hasDurationUnitElement()) {
31979        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
31980        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
31981      }
31982      if (element.hasFrequencyElement()) {
31983        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
31984        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
31985      }
31986      if (element.hasFrequencyMaxElement()) {
31987        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
31988        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
31989      }
31990      if (element.hasPeriodElement()) {
31991        composeDecimalCore("period", element.getPeriodElement(), false);
31992        composeDecimalExtras("period", element.getPeriodElement(), false);
31993      }
31994      if (element.hasPeriodMaxElement()) {
31995        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
31996        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
31997      }
31998      if (element.hasPeriodUnitElement()) {
31999        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
32000        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
32001      }
32002      if (element.hasDayOfWeek()) {
32003        openArray("dayOfWeek");
32004        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
32005          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
32006        closeArray();
32007        if (anyHasExtras(element.getDayOfWeek())) {
32008          openArray("_dayOfWeek");
32009          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
32010            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
32011          closeArray();
32012        }
32013      };
32014      if (element.hasTimeOfDay()) {
32015        if (anyHasValue(element.getTimeOfDay())) {
32016          openArray("timeOfDay");
32017          for (TimeType e : element.getTimeOfDay()) 
32018            composeTimeCore(null, e, e != element.getTimeOfDay().get(element.getTimeOfDay().size()-1));
32019          closeArray();
32020        }
32021        if (anyHasExtras(element.getTimeOfDay())) {
32022          openArray("_timeOfDay");
32023          for (TimeType e : element.getTimeOfDay()) 
32024            composeTimeExtras(null, e, true);
32025          closeArray();
32026        }
32027      };
32028      if (element.hasWhen()) {
32029        openArray("when");
32030        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
32031          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
32032        closeArray();
32033        if (anyHasExtras(element.getWhen())) {
32034          openArray("_when");
32035          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
32036            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
32037          closeArray();
32038        }
32039      };
32040      if (element.hasOffsetElement()) {
32041        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
32042        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
32043      }
32044  }
32045
32046  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
32047    if (element != null) {
32048      open(name);
32049      composeTriggerDefinitionProperties(element);
32050      close();
32051    }
32052  }
32053
32054  protected void composeTriggerDefinitionProperties(TriggerDefinition element) throws IOException {
32055    composeDataTypeProperties(element);
32056      if (element.hasTypeElement()) {
32057        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
32058        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
32059      }
32060      if (element.hasNameElement()) {
32061        composeStringCore("name", element.getNameElement(), false);
32062        composeStringExtras("name", element.getNameElement(), false);
32063      }
32064      if (element.hasTiming()) {
32065        composeType("timing", element.getTiming());
32066      }
32067      if (element.hasData()) {
32068        openArray("data");
32069        for (DataRequirement e : element.getData()) 
32070          composeDataRequirement(null, e);
32071        closeArray();
32072      };
32073      if (element.hasCondition()) {
32074        composeExpression("condition", element.getCondition());
32075      }
32076  }
32077
32078  protected void composeUsageContext(String name, UsageContext element) throws IOException {
32079    if (element != null) {
32080      open(name);
32081      composeUsageContextProperties(element);
32082      close();
32083    }
32084  }
32085
32086  protected void composeUsageContextProperties(UsageContext element) throws IOException {
32087    composeDataTypeProperties(element);
32088      if (element.hasCode()) {
32089        composeCoding("code", element.getCode());
32090      }
32091      if (element.hasValue()) {
32092        composeType("value", element.getValue());
32093      }
32094  }
32095
32096  protected void composeResourceProperties(Resource element) throws IOException {
32097      if (element.hasIdElement()) {
32098        composeIdCore("id", element.getIdElement(), false);
32099        composeIdExtras("id", element.getIdElement(), false);
32100      }
32101      if (element.hasMeta()) {
32102        composeMeta("meta", element.getMeta());
32103      }
32104      if (element.hasImplicitRulesElement()) {
32105        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
32106        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
32107      }
32108      if (element.hasLanguageElement()) {
32109        composeCodeCore("language", element.getLanguageElement(), false);
32110        composeCodeExtras("language", element.getLanguageElement(), false);
32111      }
32112  }
32113
32114  protected void composeDomainResourceProperties(DomainResource element) throws IOException {
32115      composeResourceProperties(element);
32116      if (element.hasText()) {
32117        composeNarrative("text", element.getText());
32118      }
32119      if (element.hasContained()) {
32120        openArray("contained");
32121        for (Resource e : element.getContained()) {
32122          open(null);
32123          composeResource(e);
32124          close();
32125        }
32126        closeArray();
32127      };
32128      if (element.hasExtension()) {
32129        openArray("extension");
32130        for (Extension e : element.getExtension()) 
32131          composeExtension(null, e);
32132        closeArray();
32133      };
32134      if (element.hasModifierExtension()) {
32135        openArray("modifierExtension");
32136        for (Extension e : element.getModifierExtension()) 
32137          composeExtension(null, e);
32138        closeArray();
32139      };
32140  }
32141
32142  protected void composeAccount(String name, Account element) throws IOException {
32143    if (element != null) {
32144      prop("resourceType", name);
32145      composeAccountProperties(element);
32146    }
32147  }
32148
32149  protected void composeAccountProperties(Account element) throws IOException {
32150    composeDomainResourceProperties(element);
32151      if (element.hasIdentifier()) {
32152        openArray("identifier");
32153        for (Identifier e : element.getIdentifier()) 
32154          composeIdentifier(null, e);
32155        closeArray();
32156      };
32157      if (element.hasStatusElement()) {
32158        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
32159        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
32160      }
32161      if (element.hasType()) {
32162        composeCodeableConcept("type", element.getType());
32163      }
32164      if (element.hasNameElement()) {
32165        composeStringCore("name", element.getNameElement(), false);
32166        composeStringExtras("name", element.getNameElement(), false);
32167      }
32168      if (element.hasSubject()) {
32169        openArray("subject");
32170        for (Reference e : element.getSubject()) 
32171          composeReference(null, e);
32172        closeArray();
32173      };
32174      if (element.hasServicePeriod()) {
32175        composePeriod("servicePeriod", element.getServicePeriod());
32176      }
32177      if (element.hasCoverage()) {
32178        openArray("coverage");
32179        for (Account.CoverageComponent e : element.getCoverage()) 
32180          composeCoverageComponent(null, e);
32181        closeArray();
32182      };
32183      if (element.hasOwner()) {
32184        composeReference("owner", element.getOwner());
32185      }
32186      if (element.hasDescriptionElement()) {
32187        composeStringCore("description", element.getDescriptionElement(), false);
32188        composeStringExtras("description", element.getDescriptionElement(), false);
32189      }
32190      if (element.hasGuarantor()) {
32191        openArray("guarantor");
32192        for (Account.GuarantorComponent e : element.getGuarantor()) 
32193          composeGuarantorComponent(null, e);
32194        closeArray();
32195      };
32196      if (element.hasPartOf()) {
32197        composeReference("partOf", element.getPartOf());
32198      }
32199  }
32200
32201  protected void composeCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
32202    if (element != null) {
32203      open(name);
32204      composeCoverageComponentProperties(element);
32205      close();
32206    }
32207  }
32208
32209  protected void composeCoverageComponentProperties(Account.CoverageComponent element) throws IOException {
32210    composeBackboneElementProperties(element);
32211      if (element.hasCoverage()) {
32212        composeReference("coverage", element.getCoverage());
32213      }
32214      if (element.hasPriorityElement()) {
32215        composePositiveIntCore("priority", element.getPriorityElement(), false);
32216        composePositiveIntExtras("priority", element.getPriorityElement(), false);
32217      }
32218  }
32219
32220  protected void composeGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
32221    if (element != null) {
32222      open(name);
32223      composeGuarantorComponentProperties(element);
32224      close();
32225    }
32226  }
32227
32228  protected void composeGuarantorComponentProperties(Account.GuarantorComponent element) throws IOException {
32229    composeBackboneElementProperties(element);
32230      if (element.hasParty()) {
32231        composeReference("party", element.getParty());
32232      }
32233      if (element.hasOnHoldElement()) {
32234        composeBooleanCore("onHold", element.getOnHoldElement(), false);
32235        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
32236      }
32237      if (element.hasPeriod()) {
32238        composePeriod("period", element.getPeriod());
32239      }
32240  }
32241
32242  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
32243    if (element != null) {
32244      prop("resourceType", name);
32245      composeActivityDefinitionProperties(element);
32246    }
32247  }
32248
32249  protected void composeActivityDefinitionProperties(ActivityDefinition element) throws IOException {
32250    composeDomainResourceProperties(element);
32251      if (element.hasUrlElement()) {
32252        composeUriCore("url", element.getUrlElement(), false);
32253        composeUriExtras("url", element.getUrlElement(), false);
32254      }
32255      if (element.hasIdentifier()) {
32256        openArray("identifier");
32257        for (Identifier e : element.getIdentifier()) 
32258          composeIdentifier(null, e);
32259        closeArray();
32260      };
32261      if (element.hasVersionElement()) {
32262        composeStringCore("version", element.getVersionElement(), false);
32263        composeStringExtras("version", element.getVersionElement(), false);
32264      }
32265      if (element.hasNameElement()) {
32266        composeStringCore("name", element.getNameElement(), false);
32267        composeStringExtras("name", element.getNameElement(), false);
32268      }
32269      if (element.hasTitleElement()) {
32270        composeStringCore("title", element.getTitleElement(), false);
32271        composeStringExtras("title", element.getTitleElement(), false);
32272      }
32273      if (element.hasSubtitleElement()) {
32274        composeStringCore("subtitle", element.getSubtitleElement(), false);
32275        composeStringExtras("subtitle", element.getSubtitleElement(), false);
32276      }
32277      if (element.hasStatusElement()) {
32278        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32279        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32280      }
32281      if (element.hasExperimentalElement()) {
32282        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32283        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32284      }
32285      if (element.hasSubject()) {
32286        composeType("subject", element.getSubject());
32287      }
32288      if (element.hasDateElement()) {
32289        composeDateTimeCore("date", element.getDateElement(), false);
32290        composeDateTimeExtras("date", element.getDateElement(), false);
32291      }
32292      if (element.hasPublisherElement()) {
32293        composeStringCore("publisher", element.getPublisherElement(), false);
32294        composeStringExtras("publisher", element.getPublisherElement(), false);
32295      }
32296      if (element.hasContact()) {
32297        openArray("contact");
32298        for (ContactDetail e : element.getContact()) 
32299          composeContactDetail(null, e);
32300        closeArray();
32301      };
32302      if (element.hasDescriptionElement()) {
32303        composeMarkdownCore("description", element.getDescriptionElement(), false);
32304        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32305      }
32306      if (element.hasUseContext()) {
32307        openArray("useContext");
32308        for (UsageContext e : element.getUseContext()) 
32309          composeUsageContext(null, e);
32310        closeArray();
32311      };
32312      if (element.hasJurisdiction()) {
32313        openArray("jurisdiction");
32314        for (CodeableConcept e : element.getJurisdiction()) 
32315          composeCodeableConcept(null, e);
32316        closeArray();
32317      };
32318      if (element.hasPurposeElement()) {
32319        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32320        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32321      }
32322      if (element.hasUsageElement()) {
32323        composeStringCore("usage", element.getUsageElement(), false);
32324        composeStringExtras("usage", element.getUsageElement(), false);
32325      }
32326      if (element.hasCopyrightElement()) {
32327        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32328        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32329      }
32330      if (element.hasApprovalDateElement()) {
32331        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32332        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32333      }
32334      if (element.hasLastReviewDateElement()) {
32335        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32336        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32337      }
32338      if (element.hasEffectivePeriod()) {
32339        composePeriod("effectivePeriod", element.getEffectivePeriod());
32340      }
32341      if (element.hasTopic()) {
32342        openArray("topic");
32343        for (CodeableConcept e : element.getTopic()) 
32344          composeCodeableConcept(null, e);
32345        closeArray();
32346      };
32347      if (element.hasAuthor()) {
32348        openArray("author");
32349        for (ContactDetail e : element.getAuthor()) 
32350          composeContactDetail(null, e);
32351        closeArray();
32352      };
32353      if (element.hasEditor()) {
32354        openArray("editor");
32355        for (ContactDetail e : element.getEditor()) 
32356          composeContactDetail(null, e);
32357        closeArray();
32358      };
32359      if (element.hasReviewer()) {
32360        openArray("reviewer");
32361        for (ContactDetail e : element.getReviewer()) 
32362          composeContactDetail(null, e);
32363        closeArray();
32364      };
32365      if (element.hasEndorser()) {
32366        openArray("endorser");
32367        for (ContactDetail e : element.getEndorser()) 
32368          composeContactDetail(null, e);
32369        closeArray();
32370      };
32371      if (element.hasRelatedArtifact()) {
32372        openArray("relatedArtifact");
32373        for (RelatedArtifact e : element.getRelatedArtifact()) 
32374          composeRelatedArtifact(null, e);
32375        closeArray();
32376      };
32377      if (element.hasLibrary()) {
32378        if (anyHasValue(element.getLibrary())) {
32379          openArray("library");
32380          for (CanonicalType e : element.getLibrary()) 
32381            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
32382          closeArray();
32383        }
32384        if (anyHasExtras(element.getLibrary())) {
32385          openArray("_library");
32386          for (CanonicalType e : element.getLibrary()) 
32387            composeCanonicalExtras(null, e, true);
32388          closeArray();
32389        }
32390      };
32391      if (element.hasKindElement()) {
32392        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypeEnumFactory(), false);
32393        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypeEnumFactory(), false);
32394      }
32395      if (element.hasProfileElement()) {
32396        composeCanonicalCore("profile", element.getProfileElement(), false);
32397        composeCanonicalExtras("profile", element.getProfileElement(), false);
32398      }
32399      if (element.hasCode()) {
32400        composeCodeableConcept("code", element.getCode());
32401      }
32402      if (element.hasIntentElement()) {
32403        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
32404        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
32405      }
32406      if (element.hasPriorityElement()) {
32407        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
32408        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
32409      }
32410      if (element.hasDoNotPerformElement()) {
32411        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
32412        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
32413      }
32414      if (element.hasTiming()) {
32415        composeType("timing", element.getTiming());
32416      }
32417      if (element.hasLocation()) {
32418        composeReference("location", element.getLocation());
32419      }
32420      if (element.hasParticipant()) {
32421        openArray("participant");
32422        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
32423          composeActivityDefinitionParticipantComponent(null, e);
32424        closeArray();
32425      };
32426      if (element.hasProduct()) {
32427        composeType("product", element.getProduct());
32428      }
32429      if (element.hasQuantity()) {
32430        composeQuantity("quantity", element.getQuantity());
32431      }
32432      if (element.hasDosage()) {
32433        openArray("dosage");
32434        for (Dosage e : element.getDosage()) 
32435          composeDosage(null, e);
32436        closeArray();
32437      };
32438      if (element.hasBodySite()) {
32439        openArray("bodySite");
32440        for (CodeableConcept e : element.getBodySite()) 
32441          composeCodeableConcept(null, e);
32442        closeArray();
32443      };
32444      if (element.hasSpecimenRequirement()) {
32445        openArray("specimenRequirement");
32446        for (Reference e : element.getSpecimenRequirement()) 
32447          composeReference(null, e);
32448        closeArray();
32449      };
32450      if (element.hasObservationRequirement()) {
32451        openArray("observationRequirement");
32452        for (Reference e : element.getObservationRequirement()) 
32453          composeReference(null, e);
32454        closeArray();
32455      };
32456      if (element.hasObservationResultRequirement()) {
32457        openArray("observationResultRequirement");
32458        for (Reference e : element.getObservationResultRequirement()) 
32459          composeReference(null, e);
32460        closeArray();
32461      };
32462      if (element.hasTransformElement()) {
32463        composeCanonicalCore("transform", element.getTransformElement(), false);
32464        composeCanonicalExtras("transform", element.getTransformElement(), false);
32465      }
32466      if (element.hasDynamicValue()) {
32467        openArray("dynamicValue");
32468        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
32469          composeActivityDefinitionDynamicValueComponent(null, e);
32470        closeArray();
32471      };
32472  }
32473
32474  protected void composeActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
32475    if (element != null) {
32476      open(name);
32477      composeActivityDefinitionParticipantComponentProperties(element);
32478      close();
32479    }
32480  }
32481
32482  protected void composeActivityDefinitionParticipantComponentProperties(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
32483    composeBackboneElementProperties(element);
32484      if (element.hasTypeElement()) {
32485        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
32486        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
32487      }
32488      if (element.hasRole()) {
32489        composeCodeableConcept("role", element.getRole());
32490      }
32491  }
32492
32493  protected void composeActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
32494    if (element != null) {
32495      open(name);
32496      composeActivityDefinitionDynamicValueComponentProperties(element);
32497      close();
32498    }
32499  }
32500
32501  protected void composeActivityDefinitionDynamicValueComponentProperties(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
32502    composeBackboneElementProperties(element);
32503      if (element.hasPathElement()) {
32504        composeStringCore("path", element.getPathElement(), false);
32505        composeStringExtras("path", element.getPathElement(), false);
32506      }
32507      if (element.hasExpression()) {
32508        composeExpression("expression", element.getExpression());
32509      }
32510  }
32511
32512  protected void composeAdministrableProductDefinition(String name, AdministrableProductDefinition element) throws IOException {
32513    if (element != null) {
32514      prop("resourceType", name);
32515      composeAdministrableProductDefinitionProperties(element);
32516    }
32517  }
32518
32519  protected void composeAdministrableProductDefinitionProperties(AdministrableProductDefinition element) throws IOException {
32520    composeDomainResourceProperties(element);
32521      if (element.hasIdentifier()) {
32522        openArray("identifier");
32523        for (Identifier e : element.getIdentifier()) 
32524          composeIdentifier(null, e);
32525        closeArray();
32526      };
32527      if (element.hasStatusElement()) {
32528        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32529        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32530      }
32531      if (element.hasFormOf()) {
32532        openArray("formOf");
32533        for (Reference e : element.getFormOf()) 
32534          composeReference(null, e);
32535        closeArray();
32536      };
32537      if (element.hasAdministrableDoseForm()) {
32538        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
32539      }
32540      if (element.hasUnitOfPresentation()) {
32541        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
32542      }
32543      if (element.hasProducedFrom()) {
32544        openArray("producedFrom");
32545        for (Reference e : element.getProducedFrom()) 
32546          composeReference(null, e);
32547        closeArray();
32548      };
32549      if (element.hasIngredient()) {
32550        openArray("ingredient");
32551        for (CodeableConcept e : element.getIngredient()) 
32552          composeCodeableConcept(null, e);
32553        closeArray();
32554      };
32555      if (element.hasDevice()) {
32556        composeReference("device", element.getDevice());
32557      }
32558      if (element.hasProperty()) {
32559        openArray("property");
32560        for (AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent e : element.getProperty()) 
32561          composeAdministrableProductDefinitionPropertyComponent(null, e);
32562        closeArray();
32563      };
32564      if (element.hasRouteOfAdministration()) {
32565        openArray("routeOfAdministration");
32566        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
32567          composeAdministrableProductDefinitionRouteOfAdministrationComponent(null, e);
32568        closeArray();
32569      };
32570  }
32571
32572  protected void composeAdministrableProductDefinitionPropertyComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
32573    if (element != null) {
32574      open(name);
32575      composeAdministrableProductDefinitionPropertyComponentProperties(element);
32576      close();
32577    }
32578  }
32579
32580  protected void composeAdministrableProductDefinitionPropertyComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
32581    composeBackboneElementProperties(element);
32582      if (element.hasType()) {
32583        composeCodeableConcept("type", element.getType());
32584      }
32585      if (element.hasValue()) {
32586        composeType("value", element.getValue());
32587      }
32588      if (element.hasStatus()) {
32589        composeCodeableConcept("status", element.getStatus());
32590      }
32591  }
32592
32593  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
32594    if (element != null) {
32595      open(name);
32596      composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(element);
32597      close();
32598    }
32599  }
32600
32601  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
32602    composeBackboneElementProperties(element);
32603      if (element.hasCode()) {
32604        composeCodeableConcept("code", element.getCode());
32605      }
32606      if (element.hasFirstDose()) {
32607        composeQuantity("firstDose", element.getFirstDose());
32608      }
32609      if (element.hasMaxSingleDose()) {
32610        composeQuantity("maxSingleDose", element.getMaxSingleDose());
32611      }
32612      if (element.hasMaxDosePerDay()) {
32613        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
32614      }
32615      if (element.hasMaxDosePerTreatmentPeriod()) {
32616        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
32617      }
32618      if (element.hasMaxTreatmentPeriod()) {
32619        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
32620      }
32621      if (element.hasTargetSpecies()) {
32622        openArray("targetSpecies");
32623        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
32624          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(null, e);
32625        closeArray();
32626      };
32627  }
32628
32629  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
32630    if (element != null) {
32631      open(name);
32632      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(element);
32633      close();
32634    }
32635  }
32636
32637  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
32638    composeBackboneElementProperties(element);
32639      if (element.hasCode()) {
32640        composeCodeableConcept("code", element.getCode());
32641      }
32642      if (element.hasWithdrawalPeriod()) {
32643        openArray("withdrawalPeriod");
32644        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
32645          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
32646        closeArray();
32647      };
32648  }
32649
32650  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
32651    if (element != null) {
32652      open(name);
32653      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(element);
32654      close();
32655    }
32656  }
32657
32658  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
32659    composeBackboneElementProperties(element);
32660      if (element.hasTissue()) {
32661        composeCodeableConcept("tissue", element.getTissue());
32662      }
32663      if (element.hasValue()) {
32664        composeQuantity("value", element.getValue());
32665      }
32666      if (element.hasSupportingInformationElement()) {
32667        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
32668        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
32669      }
32670  }
32671
32672  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
32673    if (element != null) {
32674      prop("resourceType", name);
32675      composeAdverseEventProperties(element);
32676    }
32677  }
32678
32679  protected void composeAdverseEventProperties(AdverseEvent element) throws IOException {
32680    composeDomainResourceProperties(element);
32681      if (element.hasIdentifier()) {
32682        composeIdentifier("identifier", element.getIdentifier());
32683      }
32684      if (element.hasActualityElement()) {
32685        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
32686        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
32687      }
32688      if (element.hasCategory()) {
32689        openArray("category");
32690        for (CodeableConcept e : element.getCategory()) 
32691          composeCodeableConcept(null, e);
32692        closeArray();
32693      };
32694      if (element.hasEvent()) {
32695        composeCodeableConcept("event", element.getEvent());
32696      }
32697      if (element.hasSubject()) {
32698        composeReference("subject", element.getSubject());
32699      }
32700      if (element.hasEncounter()) {
32701        composeReference("encounter", element.getEncounter());
32702      }
32703      if (element.hasDateElement()) {
32704        composeDateTimeCore("date", element.getDateElement(), false);
32705        composeDateTimeExtras("date", element.getDateElement(), false);
32706      }
32707      if (element.hasDetectedElement()) {
32708        composeDateTimeCore("detected", element.getDetectedElement(), false);
32709        composeDateTimeExtras("detected", element.getDetectedElement(), false);
32710      }
32711      if (element.hasRecordedDateElement()) {
32712        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
32713        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
32714      }
32715      if (element.hasResultingCondition()) {
32716        openArray("resultingCondition");
32717        for (Reference e : element.getResultingCondition()) 
32718          composeReference(null, e);
32719        closeArray();
32720      };
32721      if (element.hasLocation()) {
32722        composeReference("location", element.getLocation());
32723      }
32724      if (element.hasSeriousness()) {
32725        composeCodeableConcept("seriousness", element.getSeriousness());
32726      }
32727      if (element.hasSeverity()) {
32728        composeCodeableConcept("severity", element.getSeverity());
32729      }
32730      if (element.hasOutcome()) {
32731        composeCodeableConcept("outcome", element.getOutcome());
32732      }
32733      if (element.hasRecorder()) {
32734        composeReference("recorder", element.getRecorder());
32735      }
32736      if (element.hasContributor()) {
32737        openArray("contributor");
32738        for (Reference e : element.getContributor()) 
32739          composeReference(null, e);
32740        closeArray();
32741      };
32742      if (element.hasSuspectEntity()) {
32743        openArray("suspectEntity");
32744        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
32745          composeAdverseEventSuspectEntityComponent(null, e);
32746        closeArray();
32747      };
32748      if (element.hasSubjectMedicalHistory()) {
32749        openArray("subjectMedicalHistory");
32750        for (Reference e : element.getSubjectMedicalHistory()) 
32751          composeReference(null, e);
32752        closeArray();
32753      };
32754      if (element.hasReferenceDocument()) {
32755        openArray("referenceDocument");
32756        for (Reference e : element.getReferenceDocument()) 
32757          composeReference(null, e);
32758        closeArray();
32759      };
32760      if (element.hasStudy()) {
32761        openArray("study");
32762        for (Reference e : element.getStudy()) 
32763          composeReference(null, e);
32764        closeArray();
32765      };
32766  }
32767
32768  protected void composeAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
32769    if (element != null) {
32770      open(name);
32771      composeAdverseEventSuspectEntityComponentProperties(element);
32772      close();
32773    }
32774  }
32775
32776  protected void composeAdverseEventSuspectEntityComponentProperties(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
32777    composeBackboneElementProperties(element);
32778      if (element.hasInstance()) {
32779        composeReference("instance", element.getInstance());
32780      }
32781      if (element.hasCausality()) {
32782        openArray("causality");
32783        for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality()) 
32784          composeAdverseEventSuspectEntityCausalityComponent(null, e);
32785        closeArray();
32786      };
32787  }
32788
32789  protected void composeAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
32790    if (element != null) {
32791      open(name);
32792      composeAdverseEventSuspectEntityCausalityComponentProperties(element);
32793      close();
32794    }
32795  }
32796
32797  protected void composeAdverseEventSuspectEntityCausalityComponentProperties(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
32798    composeBackboneElementProperties(element);
32799      if (element.hasAssessment()) {
32800        composeCodeableConcept("assessment", element.getAssessment());
32801      }
32802      if (element.hasProductRelatednessElement()) {
32803        composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
32804        composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
32805      }
32806      if (element.hasAuthor()) {
32807        composeReference("author", element.getAuthor());
32808      }
32809      if (element.hasMethod()) {
32810        composeCodeableConcept("method", element.getMethod());
32811      }
32812  }
32813
32814  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
32815    if (element != null) {
32816      prop("resourceType", name);
32817      composeAllergyIntoleranceProperties(element);
32818    }
32819  }
32820
32821  protected void composeAllergyIntoleranceProperties(AllergyIntolerance element) throws IOException {
32822    composeDomainResourceProperties(element);
32823      if (element.hasIdentifier()) {
32824        openArray("identifier");
32825        for (Identifier e : element.getIdentifier()) 
32826          composeIdentifier(null, e);
32827        closeArray();
32828      };
32829      if (element.hasClinicalStatus()) {
32830        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
32831      }
32832      if (element.hasVerificationStatus()) {
32833        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
32834      }
32835      if (element.hasTypeElement()) {
32836        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
32837        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
32838      }
32839      if (element.hasCategory()) {
32840        openArray("category");
32841        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
32842          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
32843        closeArray();
32844        if (anyHasExtras(element.getCategory())) {
32845          openArray("_category");
32846          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
32847            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
32848          closeArray();
32849        }
32850      };
32851      if (element.hasCriticalityElement()) {
32852        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
32853        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
32854      }
32855      if (element.hasCode()) {
32856        composeCodeableConcept("code", element.getCode());
32857      }
32858      if (element.hasPatient()) {
32859        composeReference("patient", element.getPatient());
32860      }
32861      if (element.hasEncounter()) {
32862        composeReference("encounter", element.getEncounter());
32863      }
32864      if (element.hasOnset()) {
32865        composeType("onset", element.getOnset());
32866      }
32867      if (element.hasRecordedDateElement()) {
32868        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
32869        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
32870      }
32871      if (element.hasRecorder()) {
32872        composeReference("recorder", element.getRecorder());
32873      }
32874      if (element.hasAsserter()) {
32875        composeReference("asserter", element.getAsserter());
32876      }
32877      if (element.hasLastOccurrenceElement()) {
32878        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
32879        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
32880      }
32881      if (element.hasNote()) {
32882        openArray("note");
32883        for (Annotation e : element.getNote()) 
32884          composeAnnotation(null, e);
32885        closeArray();
32886      };
32887      if (element.hasReaction()) {
32888        openArray("reaction");
32889        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
32890          composeAllergyIntoleranceReactionComponent(null, e);
32891        closeArray();
32892      };
32893  }
32894
32895  protected void composeAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
32896    if (element != null) {
32897      open(name);
32898      composeAllergyIntoleranceReactionComponentProperties(element);
32899      close();
32900    }
32901  }
32902
32903  protected void composeAllergyIntoleranceReactionComponentProperties(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
32904    composeBackboneElementProperties(element);
32905      if (element.hasSubstance()) {
32906        composeCodeableConcept("substance", element.getSubstance());
32907      }
32908      if (element.hasManifestation()) {
32909        openArray("manifestation");
32910        for (CodeableConcept e : element.getManifestation()) 
32911          composeCodeableConcept(null, e);
32912        closeArray();
32913      };
32914      if (element.hasDescriptionElement()) {
32915        composeStringCore("description", element.getDescriptionElement(), false);
32916        composeStringExtras("description", element.getDescriptionElement(), false);
32917      }
32918      if (element.hasOnsetElement()) {
32919        composeDateTimeCore("onset", element.getOnsetElement(), false);
32920        composeDateTimeExtras("onset", element.getOnsetElement(), false);
32921      }
32922      if (element.hasSeverityElement()) {
32923        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
32924        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
32925      }
32926      if (element.hasExposureRoute()) {
32927        composeCodeableConcept("exposureRoute", element.getExposureRoute());
32928      }
32929      if (element.hasNote()) {
32930        openArray("note");
32931        for (Annotation e : element.getNote()) 
32932          composeAnnotation(null, e);
32933        closeArray();
32934      };
32935  }
32936
32937  protected void composeAppointment(String name, Appointment element) throws IOException {
32938    if (element != null) {
32939      prop("resourceType", name);
32940      composeAppointmentProperties(element);
32941    }
32942  }
32943
32944  protected void composeAppointmentProperties(Appointment element) throws IOException {
32945    composeDomainResourceProperties(element);
32946      if (element.hasIdentifier()) {
32947        openArray("identifier");
32948        for (Identifier e : element.getIdentifier()) 
32949          composeIdentifier(null, e);
32950        closeArray();
32951      };
32952      if (element.hasStatusElement()) {
32953        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
32954        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
32955      }
32956      if (element.hasCancelationReason()) {
32957        composeCodeableConcept("cancelationReason", element.getCancelationReason());
32958      }
32959      if (element.hasServiceCategory()) {
32960        openArray("serviceCategory");
32961        for (CodeableConcept e : element.getServiceCategory()) 
32962          composeCodeableConcept(null, e);
32963        closeArray();
32964      };
32965      if (element.hasServiceType()) {
32966        openArray("serviceType");
32967        for (CodeableConcept e : element.getServiceType()) 
32968          composeCodeableConcept(null, e);
32969        closeArray();
32970      };
32971      if (element.hasSpecialty()) {
32972        openArray("specialty");
32973        for (CodeableConcept e : element.getSpecialty()) 
32974          composeCodeableConcept(null, e);
32975        closeArray();
32976      };
32977      if (element.hasAppointmentType()) {
32978        composeCodeableConcept("appointmentType", element.getAppointmentType());
32979      }
32980      if (element.hasReasonCode()) {
32981        openArray("reasonCode");
32982        for (CodeableConcept e : element.getReasonCode()) 
32983          composeCodeableConcept(null, e);
32984        closeArray();
32985      };
32986      if (element.hasReasonReference()) {
32987        openArray("reasonReference");
32988        for (Reference e : element.getReasonReference()) 
32989          composeReference(null, e);
32990        closeArray();
32991      };
32992      if (element.hasPriorityElement()) {
32993        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
32994        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
32995      }
32996      if (element.hasDescriptionElement()) {
32997        composeStringCore("description", element.getDescriptionElement(), false);
32998        composeStringExtras("description", element.getDescriptionElement(), false);
32999      }
33000      if (element.hasSupportingInformation()) {
33001        openArray("supportingInformation");
33002        for (Reference e : element.getSupportingInformation()) 
33003          composeReference(null, e);
33004        closeArray();
33005      };
33006      if (element.hasStartElement()) {
33007        composeInstantCore("start", element.getStartElement(), false);
33008        composeInstantExtras("start", element.getStartElement(), false);
33009      }
33010      if (element.hasEndElement()) {
33011        composeInstantCore("end", element.getEndElement(), false);
33012        composeInstantExtras("end", element.getEndElement(), false);
33013      }
33014      if (element.hasMinutesDurationElement()) {
33015        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
33016        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
33017      }
33018      if (element.hasSlot()) {
33019        openArray("slot");
33020        for (Reference e : element.getSlot()) 
33021          composeReference(null, e);
33022        closeArray();
33023      };
33024      if (element.hasCreatedElement()) {
33025        composeDateTimeCore("created", element.getCreatedElement(), false);
33026        composeDateTimeExtras("created", element.getCreatedElement(), false);
33027      }
33028      if (element.hasCommentElement()) {
33029        composeStringCore("comment", element.getCommentElement(), false);
33030        composeStringExtras("comment", element.getCommentElement(), false);
33031      }
33032      if (element.hasPatientInstructionElement()) {
33033        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
33034        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
33035      }
33036      if (element.hasBasedOn()) {
33037        openArray("basedOn");
33038        for (Reference e : element.getBasedOn()) 
33039          composeReference(null, e);
33040        closeArray();
33041      };
33042      if (element.hasParticipant()) {
33043        openArray("participant");
33044        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
33045          composeAppointmentParticipantComponent(null, e);
33046        closeArray();
33047      };
33048      if (element.hasRequestedPeriod()) {
33049        openArray("requestedPeriod");
33050        for (Period e : element.getRequestedPeriod()) 
33051          composePeriod(null, e);
33052        closeArray();
33053      };
33054  }
33055
33056  protected void composeAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
33057    if (element != null) {
33058      open(name);
33059      composeAppointmentParticipantComponentProperties(element);
33060      close();
33061    }
33062  }
33063
33064  protected void composeAppointmentParticipantComponentProperties(Appointment.AppointmentParticipantComponent element) throws IOException {
33065    composeBackboneElementProperties(element);
33066      if (element.hasType()) {
33067        openArray("type");
33068        for (CodeableConcept e : element.getType()) 
33069          composeCodeableConcept(null, e);
33070        closeArray();
33071      };
33072      if (element.hasActor()) {
33073        composeReference("actor", element.getActor());
33074      }
33075      if (element.hasRequiredElement()) {
33076        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
33077        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
33078      }
33079      if (element.hasStatusElement()) {
33080        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33081        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33082      }
33083      if (element.hasPeriod()) {
33084        composePeriod("period", element.getPeriod());
33085      }
33086  }
33087
33088  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
33089    if (element != null) {
33090      prop("resourceType", name);
33091      composeAppointmentResponseProperties(element);
33092    }
33093  }
33094
33095  protected void composeAppointmentResponseProperties(AppointmentResponse element) throws IOException {
33096    composeDomainResourceProperties(element);
33097      if (element.hasIdentifier()) {
33098        openArray("identifier");
33099        for (Identifier e : element.getIdentifier()) 
33100          composeIdentifier(null, e);
33101        closeArray();
33102      };
33103      if (element.hasAppointment()) {
33104        composeReference("appointment", element.getAppointment());
33105      }
33106      if (element.hasStartElement()) {
33107        composeInstantCore("start", element.getStartElement(), false);
33108        composeInstantExtras("start", element.getStartElement(), false);
33109      }
33110      if (element.hasEndElement()) {
33111        composeInstantCore("end", element.getEndElement(), false);
33112        composeInstantExtras("end", element.getEndElement(), false);
33113      }
33114      if (element.hasParticipantType()) {
33115        openArray("participantType");
33116        for (CodeableConcept e : element.getParticipantType()) 
33117          composeCodeableConcept(null, e);
33118        closeArray();
33119      };
33120      if (element.hasActor()) {
33121        composeReference("actor", element.getActor());
33122      }
33123      if (element.hasParticipantStatusElement()) {
33124        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33125        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33126      }
33127      if (element.hasCommentElement()) {
33128        composeStringCore("comment", element.getCommentElement(), false);
33129        composeStringExtras("comment", element.getCommentElement(), false);
33130      }
33131  }
33132
33133  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
33134    if (element != null) {
33135      prop("resourceType", name);
33136      composeAuditEventProperties(element);
33137    }
33138  }
33139
33140  protected void composeAuditEventProperties(AuditEvent element) throws IOException {
33141    composeDomainResourceProperties(element);
33142      if (element.hasType()) {
33143        composeCoding("type", element.getType());
33144      }
33145      if (element.hasSubtype()) {
33146        openArray("subtype");
33147        for (Coding e : element.getSubtype()) 
33148          composeCoding(null, e);
33149        closeArray();
33150      };
33151      if (element.hasActionElement()) {
33152        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
33153        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
33154      }
33155      if (element.hasPeriod()) {
33156        composePeriod("period", element.getPeriod());
33157      }
33158      if (element.hasRecordedElement()) {
33159        composeInstantCore("recorded", element.getRecordedElement(), false);
33160        composeInstantExtras("recorded", element.getRecordedElement(), false);
33161      }
33162      if (element.hasOutcomeElement()) {
33163        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
33164        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
33165      }
33166      if (element.hasOutcomeDescElement()) {
33167        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
33168        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
33169      }
33170      if (element.hasPurposeOfEvent()) {
33171        openArray("purposeOfEvent");
33172        for (CodeableConcept e : element.getPurposeOfEvent()) 
33173          composeCodeableConcept(null, e);
33174        closeArray();
33175      };
33176      if (element.hasAgent()) {
33177        openArray("agent");
33178        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
33179          composeAuditEventAgentComponent(null, e);
33180        closeArray();
33181      };
33182      if (element.hasSource()) {
33183        composeAuditEventSourceComponent("source", element.getSource());
33184      }
33185      if (element.hasEntity()) {
33186        openArray("entity");
33187        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
33188          composeAuditEventEntityComponent(null, e);
33189        closeArray();
33190      };
33191  }
33192
33193  protected void composeAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
33194    if (element != null) {
33195      open(name);
33196      composeAuditEventAgentComponentProperties(element);
33197      close();
33198    }
33199  }
33200
33201  protected void composeAuditEventAgentComponentProperties(AuditEvent.AuditEventAgentComponent element) throws IOException {
33202    composeBackboneElementProperties(element);
33203      if (element.hasType()) {
33204        composeCodeableConcept("type", element.getType());
33205      }
33206      if (element.hasRole()) {
33207        openArray("role");
33208        for (CodeableConcept e : element.getRole()) 
33209          composeCodeableConcept(null, e);
33210        closeArray();
33211      };
33212      if (element.hasWho()) {
33213        composeReference("who", element.getWho());
33214      }
33215      if (element.hasAltIdElement()) {
33216        composeStringCore("altId", element.getAltIdElement(), false);
33217        composeStringExtras("altId", element.getAltIdElement(), false);
33218      }
33219      if (element.hasNameElement()) {
33220        composeStringCore("name", element.getNameElement(), false);
33221        composeStringExtras("name", element.getNameElement(), false);
33222      }
33223      if (element.hasRequestorElement()) {
33224        composeBooleanCore("requestor", element.getRequestorElement(), false);
33225        composeBooleanExtras("requestor", element.getRequestorElement(), false);
33226      }
33227      if (element.hasLocation()) {
33228        composeReference("location", element.getLocation());
33229      }
33230      if (element.hasPolicy()) {
33231        if (anyHasValue(element.getPolicy())) {
33232          openArray("policy");
33233          for (UriType e : element.getPolicy()) 
33234            composeUriCore(null, e, e != element.getPolicy().get(element.getPolicy().size()-1));
33235          closeArray();
33236        }
33237        if (anyHasExtras(element.getPolicy())) {
33238          openArray("_policy");
33239          for (UriType e : element.getPolicy()) 
33240            composeUriExtras(null, e, true);
33241          closeArray();
33242        }
33243      };
33244      if (element.hasMedia()) {
33245        composeCoding("media", element.getMedia());
33246      }
33247      if (element.hasNetwork()) {
33248        composeAuditEventAgentNetworkComponent("network", element.getNetwork());
33249      }
33250      if (element.hasPurposeOfUse()) {
33251        openArray("purposeOfUse");
33252        for (CodeableConcept e : element.getPurposeOfUse()) 
33253          composeCodeableConcept(null, e);
33254        closeArray();
33255      };
33256  }
33257
33258  protected void composeAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
33259    if (element != null) {
33260      open(name);
33261      composeAuditEventAgentNetworkComponentProperties(element);
33262      close();
33263    }
33264  }
33265
33266  protected void composeAuditEventAgentNetworkComponentProperties(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
33267    composeBackboneElementProperties(element);
33268      if (element.hasAddressElement()) {
33269        composeStringCore("address", element.getAddressElement(), false);
33270        composeStringExtras("address", element.getAddressElement(), false);
33271      }
33272      if (element.hasTypeElement()) {
33273        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
33274        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
33275      }
33276  }
33277
33278  protected void composeAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
33279    if (element != null) {
33280      open(name);
33281      composeAuditEventSourceComponentProperties(element);
33282      close();
33283    }
33284  }
33285
33286  protected void composeAuditEventSourceComponentProperties(AuditEvent.AuditEventSourceComponent element) throws IOException {
33287    composeBackboneElementProperties(element);
33288      if (element.hasSiteElement()) {
33289        composeStringCore("site", element.getSiteElement(), false);
33290        composeStringExtras("site", element.getSiteElement(), false);
33291      }
33292      if (element.hasObserver()) {
33293        composeReference("observer", element.getObserver());
33294      }
33295      if (element.hasType()) {
33296        openArray("type");
33297        for (Coding e : element.getType()) 
33298          composeCoding(null, e);
33299        closeArray();
33300      };
33301  }
33302
33303  protected void composeAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
33304    if (element != null) {
33305      open(name);
33306      composeAuditEventEntityComponentProperties(element);
33307      close();
33308    }
33309  }
33310
33311  protected void composeAuditEventEntityComponentProperties(AuditEvent.AuditEventEntityComponent element) throws IOException {
33312    composeBackboneElementProperties(element);
33313      if (element.hasWhat()) {
33314        composeReference("what", element.getWhat());
33315      }
33316      if (element.hasType()) {
33317        composeCoding("type", element.getType());
33318      }
33319      if (element.hasRole()) {
33320        composeCoding("role", element.getRole());
33321      }
33322      if (element.hasLifecycle()) {
33323        composeCoding("lifecycle", element.getLifecycle());
33324      }
33325      if (element.hasSecurityLabel()) {
33326        openArray("securityLabel");
33327        for (Coding e : element.getSecurityLabel()) 
33328          composeCoding(null, e);
33329        closeArray();
33330      };
33331      if (element.hasNameElement()) {
33332        composeStringCore("name", element.getNameElement(), false);
33333        composeStringExtras("name", element.getNameElement(), false);
33334      }
33335      if (element.hasDescriptionElement()) {
33336        composeStringCore("description", element.getDescriptionElement(), false);
33337        composeStringExtras("description", element.getDescriptionElement(), false);
33338      }
33339      if (element.hasQueryElement()) {
33340        composeBase64BinaryCore("query", element.getQueryElement(), false);
33341        composeBase64BinaryExtras("query", element.getQueryElement(), false);
33342      }
33343      if (element.hasDetail()) {
33344        openArray("detail");
33345        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
33346          composeAuditEventEntityDetailComponent(null, e);
33347        closeArray();
33348      };
33349  }
33350
33351  protected void composeAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
33352    if (element != null) {
33353      open(name);
33354      composeAuditEventEntityDetailComponentProperties(element);
33355      close();
33356    }
33357  }
33358
33359  protected void composeAuditEventEntityDetailComponentProperties(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
33360    composeBackboneElementProperties(element);
33361      if (element.hasTypeElement()) {
33362        composeStringCore("type", element.getTypeElement(), false);
33363        composeStringExtras("type", element.getTypeElement(), false);
33364      }
33365      if (element.hasValue()) {
33366        composeType("value", element.getValue());
33367      }
33368  }
33369
33370  protected void composeBasic(String name, Basic element) throws IOException {
33371    if (element != null) {
33372      prop("resourceType", name);
33373      composeBasicProperties(element);
33374    }
33375  }
33376
33377  protected void composeBasicProperties(Basic element) throws IOException {
33378    composeDomainResourceProperties(element);
33379      if (element.hasIdentifier()) {
33380        openArray("identifier");
33381        for (Identifier e : element.getIdentifier()) 
33382          composeIdentifier(null, e);
33383        closeArray();
33384      };
33385      if (element.hasCode()) {
33386        composeCodeableConcept("code", element.getCode());
33387      }
33388      if (element.hasSubject()) {
33389        composeReference("subject", element.getSubject());
33390      }
33391      if (element.hasCreatedElement()) {
33392        composeDateCore("created", element.getCreatedElement(), false);
33393        composeDateExtras("created", element.getCreatedElement(), false);
33394      }
33395      if (element.hasAuthor()) {
33396        composeReference("author", element.getAuthor());
33397      }
33398  }
33399
33400  protected void composeBinary(String name, Binary element) throws IOException {
33401    if (element != null) {
33402      prop("resourceType", name);
33403      composeBinaryProperties(element);
33404    }
33405  }
33406
33407  protected void composeBinaryProperties(Binary element) throws IOException {
33408    composeResourceProperties(element);
33409      if (element.hasContentTypeElement()) {
33410        composeCodeCore("contentType", element.getContentTypeElement(), false);
33411        composeCodeExtras("contentType", element.getContentTypeElement(), false);
33412      }
33413      if (element.hasSecurityContext()) {
33414        composeReference("securityContext", element.getSecurityContext());
33415      }
33416      if (element.hasDataElement()) {
33417        composeBase64BinaryCore("data", element.getDataElement(), false);
33418        composeBase64BinaryExtras("data", element.getDataElement(), false);
33419      }
33420  }
33421
33422  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
33423    if (element != null) {
33424      prop("resourceType", name);
33425      composeBiologicallyDerivedProductProperties(element);
33426    }
33427  }
33428
33429  protected void composeBiologicallyDerivedProductProperties(BiologicallyDerivedProduct element) throws IOException {
33430    composeDomainResourceProperties(element);
33431      if (element.hasIdentifier()) {
33432        openArray("identifier");
33433        for (Identifier e : element.getIdentifier()) 
33434          composeIdentifier(null, e);
33435        closeArray();
33436      };
33437      if (element.hasProductCategoryElement()) {
33438        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
33439        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
33440      }
33441      if (element.hasProductCode()) {
33442        composeCodeableConcept("productCode", element.getProductCode());
33443      }
33444      if (element.hasStatusElement()) {
33445        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
33446        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
33447      }
33448      if (element.hasRequest()) {
33449        openArray("request");
33450        for (Reference e : element.getRequest()) 
33451          composeReference(null, e);
33452        closeArray();
33453      };
33454      if (element.hasQuantityElement()) {
33455        composeIntegerCore("quantity", element.getQuantityElement(), false);
33456        composeIntegerExtras("quantity", element.getQuantityElement(), false);
33457      }
33458      if (element.hasParent()) {
33459        openArray("parent");
33460        for (Reference e : element.getParent()) 
33461          composeReference(null, e);
33462        closeArray();
33463      };
33464      if (element.hasCollection()) {
33465        composeBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
33466      }
33467      if (element.hasProcessing()) {
33468        openArray("processing");
33469        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
33470          composeBiologicallyDerivedProductProcessingComponent(null, e);
33471        closeArray();
33472      };
33473      if (element.hasManipulation()) {
33474        composeBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
33475      }
33476      if (element.hasStorage()) {
33477        openArray("storage");
33478        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
33479          composeBiologicallyDerivedProductStorageComponent(null, e);
33480        closeArray();
33481      };
33482  }
33483
33484  protected void composeBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
33485    if (element != null) {
33486      open(name);
33487      composeBiologicallyDerivedProductCollectionComponentProperties(element);
33488      close();
33489    }
33490  }
33491
33492  protected void composeBiologicallyDerivedProductCollectionComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
33493    composeBackboneElementProperties(element);
33494      if (element.hasCollector()) {
33495        composeReference("collector", element.getCollector());
33496      }
33497      if (element.hasSource()) {
33498        composeReference("source", element.getSource());
33499      }
33500      if (element.hasCollected()) {
33501        composeType("collected", element.getCollected());
33502      }
33503  }
33504
33505  protected void composeBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
33506    if (element != null) {
33507      open(name);
33508      composeBiologicallyDerivedProductProcessingComponentProperties(element);
33509      close();
33510    }
33511  }
33512
33513  protected void composeBiologicallyDerivedProductProcessingComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
33514    composeBackboneElementProperties(element);
33515      if (element.hasDescriptionElement()) {
33516        composeStringCore("description", element.getDescriptionElement(), false);
33517        composeStringExtras("description", element.getDescriptionElement(), false);
33518      }
33519      if (element.hasProcedure()) {
33520        composeCodeableConcept("procedure", element.getProcedure());
33521      }
33522      if (element.hasAdditive()) {
33523        composeReference("additive", element.getAdditive());
33524      }
33525      if (element.hasTime()) {
33526        composeType("time", element.getTime());
33527      }
33528  }
33529
33530  protected void composeBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
33531    if (element != null) {
33532      open(name);
33533      composeBiologicallyDerivedProductManipulationComponentProperties(element);
33534      close();
33535    }
33536  }
33537
33538  protected void composeBiologicallyDerivedProductManipulationComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
33539    composeBackboneElementProperties(element);
33540      if (element.hasDescriptionElement()) {
33541        composeStringCore("description", element.getDescriptionElement(), false);
33542        composeStringExtras("description", element.getDescriptionElement(), false);
33543      }
33544      if (element.hasTime()) {
33545        composeType("time", element.getTime());
33546      }
33547  }
33548
33549  protected void composeBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
33550    if (element != null) {
33551      open(name);
33552      composeBiologicallyDerivedProductStorageComponentProperties(element);
33553      close();
33554    }
33555  }
33556
33557  protected void composeBiologicallyDerivedProductStorageComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
33558    composeBackboneElementProperties(element);
33559      if (element.hasDescriptionElement()) {
33560        composeStringCore("description", element.getDescriptionElement(), false);
33561        composeStringExtras("description", element.getDescriptionElement(), false);
33562      }
33563      if (element.hasTemperatureElement()) {
33564        composeDecimalCore("temperature", element.getTemperatureElement(), false);
33565        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
33566      }
33567      if (element.hasScaleElement()) {
33568        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
33569        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
33570      }
33571      if (element.hasDuration()) {
33572        composePeriod("duration", element.getDuration());
33573      }
33574  }
33575
33576  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
33577    if (element != null) {
33578      prop("resourceType", name);
33579      composeBodyStructureProperties(element);
33580    }
33581  }
33582
33583  protected void composeBodyStructureProperties(BodyStructure element) throws IOException {
33584    composeDomainResourceProperties(element);
33585      if (element.hasIdentifier()) {
33586        openArray("identifier");
33587        for (Identifier e : element.getIdentifier()) 
33588          composeIdentifier(null, e);
33589        closeArray();
33590      };
33591      if (element.hasActiveElement()) {
33592        composeBooleanCore("active", element.getActiveElement(), false);
33593        composeBooleanExtras("active", element.getActiveElement(), false);
33594      }
33595      if (element.hasMorphology()) {
33596        composeCodeableConcept("morphology", element.getMorphology());
33597      }
33598      if (element.hasLocation()) {
33599        composeCodeableConcept("location", element.getLocation());
33600      }
33601      if (element.hasLocationQualifier()) {
33602        openArray("locationQualifier");
33603        for (CodeableConcept e : element.getLocationQualifier()) 
33604          composeCodeableConcept(null, e);
33605        closeArray();
33606      };
33607      if (element.hasDescriptionElement()) {
33608        composeStringCore("description", element.getDescriptionElement(), false);
33609        composeStringExtras("description", element.getDescriptionElement(), false);
33610      }
33611      if (element.hasImage()) {
33612        openArray("image");
33613        for (Attachment e : element.getImage()) 
33614          composeAttachment(null, e);
33615        closeArray();
33616      };
33617      if (element.hasPatient()) {
33618        composeReference("patient", element.getPatient());
33619      }
33620  }
33621
33622  protected void composeBundle(String name, Bundle element) throws IOException {
33623    if (element != null) {
33624      prop("resourceType", name);
33625      composeBundleProperties(element);
33626    }
33627  }
33628
33629  protected void composeBundleProperties(Bundle element) throws IOException {
33630    composeResourceProperties(element);
33631      if (element.hasIdentifier()) {
33632        composeIdentifier("identifier", element.getIdentifier());
33633      }
33634      if (element.hasTypeElement()) {
33635        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
33636        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
33637      }
33638      if (element.hasTimestampElement()) {
33639        composeInstantCore("timestamp", element.getTimestampElement(), false);
33640        composeInstantExtras("timestamp", element.getTimestampElement(), false);
33641      }
33642      if (element.hasTotalElement()) {
33643        composeUnsignedIntCore("total", element.getTotalElement(), false);
33644        composeUnsignedIntExtras("total", element.getTotalElement(), false);
33645      }
33646      if (element.hasLink()) {
33647        openArray("link");
33648        for (Bundle.BundleLinkComponent e : element.getLink()) 
33649          composeBundleLinkComponent(null, e);
33650        closeArray();
33651      };
33652      if (element.hasEntry()) {
33653        openArray("entry");
33654        for (Bundle.BundleEntryComponent e : element.getEntry()) 
33655          composeBundleEntryComponent(null, e);
33656        closeArray();
33657      };
33658      if (element.hasSignature()) {
33659        composeSignature("signature", element.getSignature());
33660      }
33661  }
33662
33663  protected void composeBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
33664    if (element != null) {
33665      open(name);
33666      composeBundleLinkComponentProperties(element);
33667      close();
33668    }
33669  }
33670
33671  protected void composeBundleLinkComponentProperties(Bundle.BundleLinkComponent element) throws IOException {
33672    composeBackboneElementProperties(element);
33673      if (element.hasRelationElement()) {
33674        composeStringCore("relation", element.getRelationElement(), false);
33675        composeStringExtras("relation", element.getRelationElement(), false);
33676      }
33677      if (element.hasUrlElement()) {
33678        composeUriCore("url", element.getUrlElement(), false);
33679        composeUriExtras("url", element.getUrlElement(), false);
33680      }
33681  }
33682
33683  protected void composeBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
33684    if (element != null) {
33685      open(name);
33686      composeBundleEntryComponentProperties(element);
33687      close();
33688    }
33689  }
33690
33691  protected void composeBundleEntryComponentProperties(Bundle.BundleEntryComponent element) throws IOException {
33692    composeBackboneElementProperties(element);
33693      if (element.hasLink()) {
33694        openArray("link");
33695        for (Bundle.BundleLinkComponent e : element.getLink()) 
33696          composeBundleLinkComponent(null, e);
33697        closeArray();
33698      };
33699      if (element.hasFullUrlElement()) {
33700        composeUriCore("fullUrl", element.getFullUrlElement(), false);
33701        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
33702      }
33703        if (element.hasResource()) {
33704          open("resource");
33705          composeResource(element.getResource());
33706          close();
33707        }
33708      if (element.hasSearch()) {
33709        composeBundleEntrySearchComponent("search", element.getSearch());
33710      }
33711      if (element.hasRequest()) {
33712        composeBundleEntryRequestComponent("request", element.getRequest());
33713      }
33714      if (element.hasResponse()) {
33715        composeBundleEntryResponseComponent("response", element.getResponse());
33716      }
33717  }
33718
33719  protected void composeBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
33720    if (element != null) {
33721      open(name);
33722      composeBundleEntrySearchComponentProperties(element);
33723      close();
33724    }
33725  }
33726
33727  protected void composeBundleEntrySearchComponentProperties(Bundle.BundleEntrySearchComponent element) throws IOException {
33728    composeBackboneElementProperties(element);
33729      if (element.hasModeElement()) {
33730        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
33731        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
33732      }
33733      if (element.hasScoreElement()) {
33734        composeDecimalCore("score", element.getScoreElement(), false);
33735        composeDecimalExtras("score", element.getScoreElement(), false);
33736      }
33737  }
33738
33739  protected void composeBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
33740    if (element != null) {
33741      open(name);
33742      composeBundleEntryRequestComponentProperties(element);
33743      close();
33744    }
33745  }
33746
33747  protected void composeBundleEntryRequestComponentProperties(Bundle.BundleEntryRequestComponent element) throws IOException {
33748    composeBackboneElementProperties(element);
33749      if (element.hasMethodElement()) {
33750        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
33751        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
33752      }
33753      if (element.hasUrlElement()) {
33754        composeUriCore("url", element.getUrlElement(), false);
33755        composeUriExtras("url", element.getUrlElement(), false);
33756      }
33757      if (element.hasIfNoneMatchElement()) {
33758        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
33759        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
33760      }
33761      if (element.hasIfModifiedSinceElement()) {
33762        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
33763        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
33764      }
33765      if (element.hasIfMatchElement()) {
33766        composeStringCore("ifMatch", element.getIfMatchElement(), false);
33767        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
33768      }
33769      if (element.hasIfNoneExistElement()) {
33770        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
33771        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
33772      }
33773  }
33774
33775  protected void composeBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
33776    if (element != null) {
33777      open(name);
33778      composeBundleEntryResponseComponentProperties(element);
33779      close();
33780    }
33781  }
33782
33783  protected void composeBundleEntryResponseComponentProperties(Bundle.BundleEntryResponseComponent element) throws IOException {
33784    composeBackboneElementProperties(element);
33785      if (element.hasStatusElement()) {
33786        composeStringCore("status", element.getStatusElement(), false);
33787        composeStringExtras("status", element.getStatusElement(), false);
33788      }
33789      if (element.hasLocationElement()) {
33790        composeUriCore("location", element.getLocationElement(), false);
33791        composeUriExtras("location", element.getLocationElement(), false);
33792      }
33793      if (element.hasEtagElement()) {
33794        composeStringCore("etag", element.getEtagElement(), false);
33795        composeStringExtras("etag", element.getEtagElement(), false);
33796      }
33797      if (element.hasLastModifiedElement()) {
33798        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
33799        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
33800      }
33801        if (element.hasOutcome()) {
33802          open("outcome");
33803          composeResource(element.getOutcome());
33804          close();
33805        }
33806  }
33807
33808  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
33809    if (element != null) {
33810      prop("resourceType", name);
33811      composeCapabilityStatementProperties(element);
33812    }
33813  }
33814
33815  protected void composeCapabilityStatementProperties(CapabilityStatement element) throws IOException {
33816    composeDomainResourceProperties(element);
33817      if (element.hasUrlElement()) {
33818        composeUriCore("url", element.getUrlElement(), false);
33819        composeUriExtras("url", element.getUrlElement(), false);
33820      }
33821      if (element.hasVersionElement()) {
33822        composeStringCore("version", element.getVersionElement(), false);
33823        composeStringExtras("version", element.getVersionElement(), false);
33824      }
33825      if (element.hasNameElement()) {
33826        composeStringCore("name", element.getNameElement(), false);
33827        composeStringExtras("name", element.getNameElement(), false);
33828      }
33829      if (element.hasTitleElement()) {
33830        composeStringCore("title", element.getTitleElement(), false);
33831        composeStringExtras("title", element.getTitleElement(), false);
33832      }
33833      if (element.hasStatusElement()) {
33834        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33835        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33836      }
33837      if (element.hasExperimentalElement()) {
33838        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33839        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33840      }
33841      if (element.hasDateElement()) {
33842        composeDateTimeCore("date", element.getDateElement(), false);
33843        composeDateTimeExtras("date", element.getDateElement(), false);
33844      }
33845      if (element.hasPublisherElement()) {
33846        composeStringCore("publisher", element.getPublisherElement(), false);
33847        composeStringExtras("publisher", element.getPublisherElement(), false);
33848      }
33849      if (element.hasContact()) {
33850        openArray("contact");
33851        for (ContactDetail e : element.getContact()) 
33852          composeContactDetail(null, e);
33853        closeArray();
33854      };
33855      if (element.hasDescriptionElement()) {
33856        composeMarkdownCore("description", element.getDescriptionElement(), false);
33857        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33858      }
33859      if (element.hasUseContext()) {
33860        openArray("useContext");
33861        for (UsageContext e : element.getUseContext()) 
33862          composeUsageContext(null, e);
33863        closeArray();
33864      };
33865      if (element.hasJurisdiction()) {
33866        openArray("jurisdiction");
33867        for (CodeableConcept e : element.getJurisdiction()) 
33868          composeCodeableConcept(null, e);
33869        closeArray();
33870      };
33871      if (element.hasPurposeElement()) {
33872        composeMarkdownCore("purpose", element.getPurposeElement(), false);
33873        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
33874      }
33875      if (element.hasCopyrightElement()) {
33876        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
33877        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33878      }
33879      if (element.hasKindElement()) {
33880        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
33881        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
33882      }
33883      if (element.hasInstantiates()) {
33884        if (anyHasValue(element.getInstantiates())) {
33885          openArray("instantiates");
33886          for (CanonicalType e : element.getInstantiates()) 
33887            composeCanonicalCore(null, e, e != element.getInstantiates().get(element.getInstantiates().size()-1));
33888          closeArray();
33889        }
33890        if (anyHasExtras(element.getInstantiates())) {
33891          openArray("_instantiates");
33892          for (CanonicalType e : element.getInstantiates()) 
33893            composeCanonicalExtras(null, e, true);
33894          closeArray();
33895        }
33896      };
33897      if (element.hasImports()) {
33898        if (anyHasValue(element.getImports())) {
33899          openArray("imports");
33900          for (CanonicalType e : element.getImports()) 
33901            composeCanonicalCore(null, e, e != element.getImports().get(element.getImports().size()-1));
33902          closeArray();
33903        }
33904        if (anyHasExtras(element.getImports())) {
33905          openArray("_imports");
33906          for (CanonicalType e : element.getImports()) 
33907            composeCanonicalExtras(null, e, true);
33908          closeArray();
33909        }
33910      };
33911      if (element.hasSoftware()) {
33912        composeCapabilityStatementSoftwareComponent("software", element.getSoftware());
33913      }
33914      if (element.hasImplementation()) {
33915        composeCapabilityStatementImplementationComponent("implementation", element.getImplementation());
33916      }
33917      if (element.hasFhirVersionElement()) {
33918        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
33919        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
33920      }
33921      if (element.hasFormat()) {
33922        if (anyHasValue(element.getFormat())) {
33923          openArray("format");
33924          for (CodeType e : element.getFormat()) 
33925            composeCodeCore(null, e, e != element.getFormat().get(element.getFormat().size()-1));
33926          closeArray();
33927        }
33928        if (anyHasExtras(element.getFormat())) {
33929          openArray("_format");
33930          for (CodeType e : element.getFormat()) 
33931            composeCodeExtras(null, e, true);
33932          closeArray();
33933        }
33934      };
33935      if (element.hasPatchFormat()) {
33936        if (anyHasValue(element.getPatchFormat())) {
33937          openArray("patchFormat");
33938          for (CodeType e : element.getPatchFormat()) 
33939            composeCodeCore(null, e, e != element.getPatchFormat().get(element.getPatchFormat().size()-1));
33940          closeArray();
33941        }
33942        if (anyHasExtras(element.getPatchFormat())) {
33943          openArray("_patchFormat");
33944          for (CodeType e : element.getPatchFormat()) 
33945            composeCodeExtras(null, e, true);
33946          closeArray();
33947        }
33948      };
33949      if (element.hasImplementationGuide()) {
33950        if (anyHasValue(element.getImplementationGuide())) {
33951          openArray("implementationGuide");
33952          for (CanonicalType e : element.getImplementationGuide()) 
33953            composeCanonicalCore(null, e, e != element.getImplementationGuide().get(element.getImplementationGuide().size()-1));
33954          closeArray();
33955        }
33956        if (anyHasExtras(element.getImplementationGuide())) {
33957          openArray("_implementationGuide");
33958          for (CanonicalType e : element.getImplementationGuide()) 
33959            composeCanonicalExtras(null, e, true);
33960          closeArray();
33961        }
33962      };
33963      if (element.hasRest()) {
33964        openArray("rest");
33965        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
33966          composeCapabilityStatementRestComponent(null, e);
33967        closeArray();
33968      };
33969      if (element.hasMessaging()) {
33970        openArray("messaging");
33971        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
33972          composeCapabilityStatementMessagingComponent(null, e);
33973        closeArray();
33974      };
33975      if (element.hasDocument()) {
33976        openArray("document");
33977        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
33978          composeCapabilityStatementDocumentComponent(null, e);
33979        closeArray();
33980      };
33981  }
33982
33983  protected void composeCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
33984    if (element != null) {
33985      open(name);
33986      composeCapabilityStatementSoftwareComponentProperties(element);
33987      close();
33988    }
33989  }
33990
33991  protected void composeCapabilityStatementSoftwareComponentProperties(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
33992    composeBackboneElementProperties(element);
33993      if (element.hasNameElement()) {
33994        composeStringCore("name", element.getNameElement(), false);
33995        composeStringExtras("name", element.getNameElement(), false);
33996      }
33997      if (element.hasVersionElement()) {
33998        composeStringCore("version", element.getVersionElement(), false);
33999        composeStringExtras("version", element.getVersionElement(), false);
34000      }
34001      if (element.hasReleaseDateElement()) {
34002        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
34003        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
34004      }
34005  }
34006
34007  protected void composeCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
34008    if (element != null) {
34009      open(name);
34010      composeCapabilityStatementImplementationComponentProperties(element);
34011      close();
34012    }
34013  }
34014
34015  protected void composeCapabilityStatementImplementationComponentProperties(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
34016    composeBackboneElementProperties(element);
34017      if (element.hasDescriptionElement()) {
34018        composeStringCore("description", element.getDescriptionElement(), false);
34019        composeStringExtras("description", element.getDescriptionElement(), false);
34020      }
34021      if (element.hasUrlElement()) {
34022        composeUrlCore("url", element.getUrlElement(), false);
34023        composeUrlExtras("url", element.getUrlElement(), false);
34024      }
34025      if (element.hasCustodian()) {
34026        composeReference("custodian", element.getCustodian());
34027      }
34028  }
34029
34030  protected void composeCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
34031    if (element != null) {
34032      open(name);
34033      composeCapabilityStatementRestComponentProperties(element);
34034      close();
34035    }
34036  }
34037
34038  protected void composeCapabilityStatementRestComponentProperties(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
34039    composeBackboneElementProperties(element);
34040      if (element.hasModeElement()) {
34041        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
34042        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
34043      }
34044      if (element.hasDocumentationElement()) {
34045        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34046        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34047      }
34048      if (element.hasSecurity()) {
34049        composeCapabilityStatementRestSecurityComponent("security", element.getSecurity());
34050      }
34051      if (element.hasResource()) {
34052        openArray("resource");
34053        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
34054          composeCapabilityStatementRestResourceComponent(null, e);
34055        closeArray();
34056      };
34057      if (element.hasInteraction()) {
34058        openArray("interaction");
34059        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
34060          composeSystemInteractionComponent(null, e);
34061        closeArray();
34062      };
34063      if (element.hasSearchParam()) {
34064        openArray("searchParam");
34065        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
34066          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
34067        closeArray();
34068      };
34069      if (element.hasOperation()) {
34070        openArray("operation");
34071        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
34072          composeCapabilityStatementRestResourceOperationComponent(null, e);
34073        closeArray();
34074      };
34075      if (element.hasCompartment()) {
34076        if (anyHasValue(element.getCompartment())) {
34077          openArray("compartment");
34078          for (CanonicalType e : element.getCompartment()) 
34079            composeCanonicalCore(null, e, e != element.getCompartment().get(element.getCompartment().size()-1));
34080          closeArray();
34081        }
34082        if (anyHasExtras(element.getCompartment())) {
34083          openArray("_compartment");
34084          for (CanonicalType e : element.getCompartment()) 
34085            composeCanonicalExtras(null, e, true);
34086          closeArray();
34087        }
34088      };
34089  }
34090
34091  protected void composeCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
34092    if (element != null) {
34093      open(name);
34094      composeCapabilityStatementRestSecurityComponentProperties(element);
34095      close();
34096    }
34097  }
34098
34099  protected void composeCapabilityStatementRestSecurityComponentProperties(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
34100    composeBackboneElementProperties(element);
34101      if (element.hasCorsElement()) {
34102        composeBooleanCore("cors", element.getCorsElement(), false);
34103        composeBooleanExtras("cors", element.getCorsElement(), false);
34104      }
34105      if (element.hasService()) {
34106        openArray("service");
34107        for (CodeableConcept e : element.getService()) 
34108          composeCodeableConcept(null, e);
34109        closeArray();
34110      };
34111      if (element.hasDescriptionElement()) {
34112        composeMarkdownCore("description", element.getDescriptionElement(), false);
34113        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34114      }
34115  }
34116
34117  protected void composeCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
34118    if (element != null) {
34119      open(name);
34120      composeCapabilityStatementRestResourceComponentProperties(element);
34121      close();
34122    }
34123  }
34124
34125  protected void composeCapabilityStatementRestResourceComponentProperties(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
34126    composeBackboneElementProperties(element);
34127      if (element.hasTypeElement()) {
34128        composeCodeCore("type", element.getTypeElement(), false);
34129        composeCodeExtras("type", element.getTypeElement(), false);
34130      }
34131      if (element.hasProfileElement()) {
34132        composeCanonicalCore("profile", element.getProfileElement(), false);
34133        composeCanonicalExtras("profile", element.getProfileElement(), false);
34134      }
34135      if (element.hasSupportedProfile()) {
34136        if (anyHasValue(element.getSupportedProfile())) {
34137          openArray("supportedProfile");
34138          for (CanonicalType e : element.getSupportedProfile()) 
34139            composeCanonicalCore(null, e, e != element.getSupportedProfile().get(element.getSupportedProfile().size()-1));
34140          closeArray();
34141        }
34142        if (anyHasExtras(element.getSupportedProfile())) {
34143          openArray("_supportedProfile");
34144          for (CanonicalType e : element.getSupportedProfile()) 
34145            composeCanonicalExtras(null, e, true);
34146          closeArray();
34147        }
34148      };
34149      if (element.hasDocumentationElement()) {
34150        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34151        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34152      }
34153      if (element.hasInteraction()) {
34154        openArray("interaction");
34155        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
34156          composeResourceInteractionComponent(null, e);
34157        closeArray();
34158      };
34159      if (element.hasVersioningElement()) {
34160        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
34161        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
34162      }
34163      if (element.hasReadHistoryElement()) {
34164        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
34165        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
34166      }
34167      if (element.hasUpdateCreateElement()) {
34168        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
34169        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
34170      }
34171      if (element.hasConditionalCreateElement()) {
34172        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
34173        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
34174      }
34175      if (element.hasConditionalReadElement()) {
34176        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
34177        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
34178      }
34179      if (element.hasConditionalUpdateElement()) {
34180        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
34181        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
34182      }
34183      if (element.hasConditionalDeleteElement()) {
34184        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
34185        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
34186      }
34187      if (element.hasReferencePolicy()) {
34188        openArray("referencePolicy");
34189        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
34190          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
34191        closeArray();
34192        if (anyHasExtras(element.getReferencePolicy())) {
34193          openArray("_referencePolicy");
34194          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
34195            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
34196          closeArray();
34197        }
34198      };
34199      if (element.hasSearchInclude()) {
34200        if (anyHasValue(element.getSearchInclude())) {
34201          openArray("searchInclude");
34202          for (StringType e : element.getSearchInclude()) 
34203            composeStringCore(null, e, e != element.getSearchInclude().get(element.getSearchInclude().size()-1));
34204          closeArray();
34205        }
34206        if (anyHasExtras(element.getSearchInclude())) {
34207          openArray("_searchInclude");
34208          for (StringType e : element.getSearchInclude()) 
34209            composeStringExtras(null, e, true);
34210          closeArray();
34211        }
34212      };
34213      if (element.hasSearchRevInclude()) {
34214        if (anyHasValue(element.getSearchRevInclude())) {
34215          openArray("searchRevInclude");
34216          for (StringType e : element.getSearchRevInclude()) 
34217            composeStringCore(null, e, e != element.getSearchRevInclude().get(element.getSearchRevInclude().size()-1));
34218          closeArray();
34219        }
34220        if (anyHasExtras(element.getSearchRevInclude())) {
34221          openArray("_searchRevInclude");
34222          for (StringType e : element.getSearchRevInclude()) 
34223            composeStringExtras(null, e, true);
34224          closeArray();
34225        }
34226      };
34227      if (element.hasSearchParam()) {
34228        openArray("searchParam");
34229        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
34230          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
34231        closeArray();
34232      };
34233      if (element.hasOperation()) {
34234        openArray("operation");
34235        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
34236          composeCapabilityStatementRestResourceOperationComponent(null, e);
34237        closeArray();
34238      };
34239  }
34240
34241  protected void composeResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
34242    if (element != null) {
34243      open(name);
34244      composeResourceInteractionComponentProperties(element);
34245      close();
34246    }
34247  }
34248
34249  protected void composeResourceInteractionComponentProperties(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
34250    composeBackboneElementProperties(element);
34251      if (element.hasCodeElement()) {
34252        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
34253        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
34254      }
34255      if (element.hasDocumentationElement()) {
34256        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34257        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34258      }
34259  }
34260
34261  protected void composeCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
34262    if (element != null) {
34263      open(name);
34264      composeCapabilityStatementRestResourceSearchParamComponentProperties(element);
34265      close();
34266    }
34267  }
34268
34269  protected void composeCapabilityStatementRestResourceSearchParamComponentProperties(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
34270    composeBackboneElementProperties(element);
34271      if (element.hasNameElement()) {
34272        composeStringCore("name", element.getNameElement(), false);
34273        composeStringExtras("name", element.getNameElement(), false);
34274      }
34275      if (element.hasDefinitionElement()) {
34276        composeCanonicalCore("definition", element.getDefinitionElement(), false);
34277        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
34278      }
34279      if (element.hasTypeElement()) {
34280        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
34281        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
34282      }
34283      if (element.hasDocumentationElement()) {
34284        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34285        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34286      }
34287  }
34288
34289  protected void composeCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
34290    if (element != null) {
34291      open(name);
34292      composeCapabilityStatementRestResourceOperationComponentProperties(element);
34293      close();
34294    }
34295  }
34296
34297  protected void composeCapabilityStatementRestResourceOperationComponentProperties(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
34298    composeBackboneElementProperties(element);
34299      if (element.hasNameElement()) {
34300        composeStringCore("name", element.getNameElement(), false);
34301        composeStringExtras("name", element.getNameElement(), false);
34302      }
34303      if (element.hasDefinitionElement()) {
34304        composeCanonicalCore("definition", element.getDefinitionElement(), false);
34305        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
34306      }
34307      if (element.hasDocumentationElement()) {
34308        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34309        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34310      }
34311  }
34312
34313  protected void composeSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
34314    if (element != null) {
34315      open(name);
34316      composeSystemInteractionComponentProperties(element);
34317      close();
34318    }
34319  }
34320
34321  protected void composeSystemInteractionComponentProperties(CapabilityStatement.SystemInteractionComponent element) throws IOException {
34322    composeBackboneElementProperties(element);
34323      if (element.hasCodeElement()) {
34324        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
34325        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
34326      }
34327      if (element.hasDocumentationElement()) {
34328        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34329        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34330      }
34331  }
34332
34333  protected void composeCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
34334    if (element != null) {
34335      open(name);
34336      composeCapabilityStatementMessagingComponentProperties(element);
34337      close();
34338    }
34339  }
34340
34341  protected void composeCapabilityStatementMessagingComponentProperties(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
34342    composeBackboneElementProperties(element);
34343      if (element.hasEndpoint()) {
34344        openArray("endpoint");
34345        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
34346          composeCapabilityStatementMessagingEndpointComponent(null, e);
34347        closeArray();
34348      };
34349      if (element.hasReliableCacheElement()) {
34350        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
34351        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
34352      }
34353      if (element.hasDocumentationElement()) {
34354        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34355        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34356      }
34357      if (element.hasSupportedMessage()) {
34358        openArray("supportedMessage");
34359        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
34360          composeCapabilityStatementMessagingSupportedMessageComponent(null, e);
34361        closeArray();
34362      };
34363  }
34364
34365  protected void composeCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
34366    if (element != null) {
34367      open(name);
34368      composeCapabilityStatementMessagingEndpointComponentProperties(element);
34369      close();
34370    }
34371  }
34372
34373  protected void composeCapabilityStatementMessagingEndpointComponentProperties(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
34374    composeBackboneElementProperties(element);
34375      if (element.hasProtocol()) {
34376        composeCoding("protocol", element.getProtocol());
34377      }
34378      if (element.hasAddressElement()) {
34379        composeUrlCore("address", element.getAddressElement(), false);
34380        composeUrlExtras("address", element.getAddressElement(), false);
34381      }
34382  }
34383
34384  protected void composeCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
34385    if (element != null) {
34386      open(name);
34387      composeCapabilityStatementMessagingSupportedMessageComponentProperties(element);
34388      close();
34389    }
34390  }
34391
34392  protected void composeCapabilityStatementMessagingSupportedMessageComponentProperties(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
34393    composeBackboneElementProperties(element);
34394      if (element.hasModeElement()) {
34395        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
34396        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
34397      }
34398      if (element.hasDefinitionElement()) {
34399        composeCanonicalCore("definition", element.getDefinitionElement(), false);
34400        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
34401      }
34402  }
34403
34404  protected void composeCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
34405    if (element != null) {
34406      open(name);
34407      composeCapabilityStatementDocumentComponentProperties(element);
34408      close();
34409    }
34410  }
34411
34412  protected void composeCapabilityStatementDocumentComponentProperties(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
34413    composeBackboneElementProperties(element);
34414      if (element.hasModeElement()) {
34415        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
34416        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
34417      }
34418      if (element.hasDocumentationElement()) {
34419        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34420        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34421      }
34422      if (element.hasProfileElement()) {
34423        composeCanonicalCore("profile", element.getProfileElement(), false);
34424        composeCanonicalExtras("profile", element.getProfileElement(), false);
34425      }
34426  }
34427
34428  protected void composeCarePlan(String name, CarePlan element) throws IOException {
34429    if (element != null) {
34430      prop("resourceType", name);
34431      composeCarePlanProperties(element);
34432    }
34433  }
34434
34435  protected void composeCarePlanProperties(CarePlan element) throws IOException {
34436    composeDomainResourceProperties(element);
34437      if (element.hasIdentifier()) {
34438        openArray("identifier");
34439        for (Identifier e : element.getIdentifier()) 
34440          composeIdentifier(null, e);
34441        closeArray();
34442      };
34443      if (element.hasInstantiatesCanonical()) {
34444        if (anyHasValue(element.getInstantiatesCanonical())) {
34445          openArray("instantiatesCanonical");
34446          for (CanonicalType e : element.getInstantiatesCanonical()) 
34447            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
34448          closeArray();
34449        }
34450        if (anyHasExtras(element.getInstantiatesCanonical())) {
34451          openArray("_instantiatesCanonical");
34452          for (CanonicalType e : element.getInstantiatesCanonical()) 
34453            composeCanonicalExtras(null, e, true);
34454          closeArray();
34455        }
34456      };
34457      if (element.hasInstantiatesUri()) {
34458        if (anyHasValue(element.getInstantiatesUri())) {
34459          openArray("instantiatesUri");
34460          for (UriType e : element.getInstantiatesUri()) 
34461            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
34462          closeArray();
34463        }
34464        if (anyHasExtras(element.getInstantiatesUri())) {
34465          openArray("_instantiatesUri");
34466          for (UriType e : element.getInstantiatesUri()) 
34467            composeUriExtras(null, e, true);
34468          closeArray();
34469        }
34470      };
34471      if (element.hasBasedOn()) {
34472        openArray("basedOn");
34473        for (Reference e : element.getBasedOn()) 
34474          composeReference(null, e);
34475        closeArray();
34476      };
34477      if (element.hasReplaces()) {
34478        openArray("replaces");
34479        for (Reference e : element.getReplaces()) 
34480          composeReference(null, e);
34481        closeArray();
34482      };
34483      if (element.hasPartOf()) {
34484        openArray("partOf");
34485        for (Reference e : element.getPartOf()) 
34486          composeReference(null, e);
34487        closeArray();
34488      };
34489      if (element.hasStatusElement()) {
34490        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
34491        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
34492      }
34493      if (element.hasIntentElement()) {
34494        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
34495        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
34496      }
34497      if (element.hasCategory()) {
34498        openArray("category");
34499        for (CodeableConcept e : element.getCategory()) 
34500          composeCodeableConcept(null, e);
34501        closeArray();
34502      };
34503      if (element.hasTitleElement()) {
34504        composeStringCore("title", element.getTitleElement(), false);
34505        composeStringExtras("title", element.getTitleElement(), false);
34506      }
34507      if (element.hasDescriptionElement()) {
34508        composeStringCore("description", element.getDescriptionElement(), false);
34509        composeStringExtras("description", element.getDescriptionElement(), false);
34510      }
34511      if (element.hasSubject()) {
34512        composeReference("subject", element.getSubject());
34513      }
34514      if (element.hasEncounter()) {
34515        composeReference("encounter", element.getEncounter());
34516      }
34517      if (element.hasPeriod()) {
34518        composePeriod("period", element.getPeriod());
34519      }
34520      if (element.hasCreatedElement()) {
34521        composeDateTimeCore("created", element.getCreatedElement(), false);
34522        composeDateTimeExtras("created", element.getCreatedElement(), false);
34523      }
34524      if (element.hasAuthor()) {
34525        composeReference("author", element.getAuthor());
34526      }
34527      if (element.hasContributor()) {
34528        openArray("contributor");
34529        for (Reference e : element.getContributor()) 
34530          composeReference(null, e);
34531        closeArray();
34532      };
34533      if (element.hasCareTeam()) {
34534        openArray("careTeam");
34535        for (Reference e : element.getCareTeam()) 
34536          composeReference(null, e);
34537        closeArray();
34538      };
34539      if (element.hasAddresses()) {
34540        openArray("addresses");
34541        for (Reference e : element.getAddresses()) 
34542          composeReference(null, e);
34543        closeArray();
34544      };
34545      if (element.hasSupportingInfo()) {
34546        openArray("supportingInfo");
34547        for (Reference e : element.getSupportingInfo()) 
34548          composeReference(null, e);
34549        closeArray();
34550      };
34551      if (element.hasGoal()) {
34552        openArray("goal");
34553        for (Reference e : element.getGoal()) 
34554          composeReference(null, e);
34555        closeArray();
34556      };
34557      if (element.hasActivity()) {
34558        openArray("activity");
34559        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
34560          composeCarePlanActivityComponent(null, e);
34561        closeArray();
34562      };
34563      if (element.hasNote()) {
34564        openArray("note");
34565        for (Annotation e : element.getNote()) 
34566          composeAnnotation(null, e);
34567        closeArray();
34568      };
34569  }
34570
34571  protected void composeCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
34572    if (element != null) {
34573      open(name);
34574      composeCarePlanActivityComponentProperties(element);
34575      close();
34576    }
34577  }
34578
34579  protected void composeCarePlanActivityComponentProperties(CarePlan.CarePlanActivityComponent element) throws IOException {
34580    composeBackboneElementProperties(element);
34581      if (element.hasOutcomeCodeableConcept()) {
34582        openArray("outcomeCodeableConcept");
34583        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
34584          composeCodeableConcept(null, e);
34585        closeArray();
34586      };
34587      if (element.hasOutcomeReference()) {
34588        openArray("outcomeReference");
34589        for (Reference e : element.getOutcomeReference()) 
34590          composeReference(null, e);
34591        closeArray();
34592      };
34593      if (element.hasProgress()) {
34594        openArray("progress");
34595        for (Annotation e : element.getProgress()) 
34596          composeAnnotation(null, e);
34597        closeArray();
34598      };
34599      if (element.hasReference()) {
34600        composeReference("reference", element.getReference());
34601      }
34602      if (element.hasDetail()) {
34603        composeCarePlanActivityDetailComponent("detail", element.getDetail());
34604      }
34605  }
34606
34607  protected void composeCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
34608    if (element != null) {
34609      open(name);
34610      composeCarePlanActivityDetailComponentProperties(element);
34611      close();
34612    }
34613  }
34614
34615  protected void composeCarePlanActivityDetailComponentProperties(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
34616    composeBackboneElementProperties(element);
34617      if (element.hasKindElement()) {
34618        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
34619        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
34620      }
34621      if (element.hasInstantiatesCanonical()) {
34622        if (anyHasValue(element.getInstantiatesCanonical())) {
34623          openArray("instantiatesCanonical");
34624          for (CanonicalType e : element.getInstantiatesCanonical()) 
34625            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
34626          closeArray();
34627        }
34628        if (anyHasExtras(element.getInstantiatesCanonical())) {
34629          openArray("_instantiatesCanonical");
34630          for (CanonicalType e : element.getInstantiatesCanonical()) 
34631            composeCanonicalExtras(null, e, true);
34632          closeArray();
34633        }
34634      };
34635      if (element.hasInstantiatesUri()) {
34636        if (anyHasValue(element.getInstantiatesUri())) {
34637          openArray("instantiatesUri");
34638          for (UriType e : element.getInstantiatesUri()) 
34639            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
34640          closeArray();
34641        }
34642        if (anyHasExtras(element.getInstantiatesUri())) {
34643          openArray("_instantiatesUri");
34644          for (UriType e : element.getInstantiatesUri()) 
34645            composeUriExtras(null, e, true);
34646          closeArray();
34647        }
34648      };
34649      if (element.hasCode()) {
34650        composeCodeableConcept("code", element.getCode());
34651      }
34652      if (element.hasReasonCode()) {
34653        openArray("reasonCode");
34654        for (CodeableConcept e : element.getReasonCode()) 
34655          composeCodeableConcept(null, e);
34656        closeArray();
34657      };
34658      if (element.hasReasonReference()) {
34659        openArray("reasonReference");
34660        for (Reference e : element.getReasonReference()) 
34661          composeReference(null, e);
34662        closeArray();
34663      };
34664      if (element.hasGoal()) {
34665        openArray("goal");
34666        for (Reference e : element.getGoal()) 
34667          composeReference(null, e);
34668        closeArray();
34669      };
34670      if (element.hasStatusElement()) {
34671        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
34672        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
34673      }
34674      if (element.hasStatusReason()) {
34675        composeCodeableConcept("statusReason", element.getStatusReason());
34676      }
34677      if (element.hasDoNotPerformElement()) {
34678        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
34679        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
34680      }
34681      if (element.hasScheduled()) {
34682        composeType("scheduled", element.getScheduled());
34683      }
34684      if (element.hasLocation()) {
34685        composeReference("location", element.getLocation());
34686      }
34687      if (element.hasPerformer()) {
34688        openArray("performer");
34689        for (Reference e : element.getPerformer()) 
34690          composeReference(null, e);
34691        closeArray();
34692      };
34693      if (element.hasProduct()) {
34694        composeType("product", element.getProduct());
34695      }
34696      if (element.hasDailyAmount()) {
34697        composeQuantity("dailyAmount", element.getDailyAmount());
34698      }
34699      if (element.hasQuantity()) {
34700        composeQuantity("quantity", element.getQuantity());
34701      }
34702      if (element.hasDescriptionElement()) {
34703        composeStringCore("description", element.getDescriptionElement(), false);
34704        composeStringExtras("description", element.getDescriptionElement(), false);
34705      }
34706  }
34707
34708  protected void composeCareTeam(String name, CareTeam element) throws IOException {
34709    if (element != null) {
34710      prop("resourceType", name);
34711      composeCareTeamProperties(element);
34712    }
34713  }
34714
34715  protected void composeCareTeamProperties(CareTeam element) throws IOException {
34716    composeDomainResourceProperties(element);
34717      if (element.hasIdentifier()) {
34718        openArray("identifier");
34719        for (Identifier e : element.getIdentifier()) 
34720          composeIdentifier(null, e);
34721        closeArray();
34722      };
34723      if (element.hasStatusElement()) {
34724        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
34725        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
34726      }
34727      if (element.hasCategory()) {
34728        openArray("category");
34729        for (CodeableConcept e : element.getCategory()) 
34730          composeCodeableConcept(null, e);
34731        closeArray();
34732      };
34733      if (element.hasNameElement()) {
34734        composeStringCore("name", element.getNameElement(), false);
34735        composeStringExtras("name", element.getNameElement(), false);
34736      }
34737      if (element.hasSubject()) {
34738        composeReference("subject", element.getSubject());
34739      }
34740      if (element.hasEncounter()) {
34741        composeReference("encounter", element.getEncounter());
34742      }
34743      if (element.hasPeriod()) {
34744        composePeriod("period", element.getPeriod());
34745      }
34746      if (element.hasParticipant()) {
34747        openArray("participant");
34748        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
34749          composeCareTeamParticipantComponent(null, e);
34750        closeArray();
34751      };
34752      if (element.hasReasonCode()) {
34753        openArray("reasonCode");
34754        for (CodeableConcept e : element.getReasonCode()) 
34755          composeCodeableConcept(null, e);
34756        closeArray();
34757      };
34758      if (element.hasReasonReference()) {
34759        openArray("reasonReference");
34760        for (Reference e : element.getReasonReference()) 
34761          composeReference(null, e);
34762        closeArray();
34763      };
34764      if (element.hasManagingOrganization()) {
34765        openArray("managingOrganization");
34766        for (Reference e : element.getManagingOrganization()) 
34767          composeReference(null, e);
34768        closeArray();
34769      };
34770      if (element.hasTelecom()) {
34771        openArray("telecom");
34772        for (ContactPoint e : element.getTelecom()) 
34773          composeContactPoint(null, e);
34774        closeArray();
34775      };
34776      if (element.hasNote()) {
34777        openArray("note");
34778        for (Annotation e : element.getNote()) 
34779          composeAnnotation(null, e);
34780        closeArray();
34781      };
34782  }
34783
34784  protected void composeCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
34785    if (element != null) {
34786      open(name);
34787      composeCareTeamParticipantComponentProperties(element);
34788      close();
34789    }
34790  }
34791
34792  protected void composeCareTeamParticipantComponentProperties(CareTeam.CareTeamParticipantComponent element) throws IOException {
34793    composeBackboneElementProperties(element);
34794      if (element.hasRole()) {
34795        openArray("role");
34796        for (CodeableConcept e : element.getRole()) 
34797          composeCodeableConcept(null, e);
34798        closeArray();
34799      };
34800      if (element.hasMember()) {
34801        composeReference("member", element.getMember());
34802      }
34803      if (element.hasOnBehalfOf()) {
34804        composeReference("onBehalfOf", element.getOnBehalfOf());
34805      }
34806      if (element.hasPeriod()) {
34807        composePeriod("period", element.getPeriod());
34808      }
34809  }
34810
34811  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
34812    if (element != null) {
34813      prop("resourceType", name);
34814      composeCatalogEntryProperties(element);
34815    }
34816  }
34817
34818  protected void composeCatalogEntryProperties(CatalogEntry element) throws IOException {
34819    composeDomainResourceProperties(element);
34820      if (element.hasIdentifier()) {
34821        openArray("identifier");
34822        for (Identifier e : element.getIdentifier()) 
34823          composeIdentifier(null, e);
34824        closeArray();
34825      };
34826      if (element.hasType()) {
34827        composeCodeableConcept("type", element.getType());
34828      }
34829      if (element.hasOrderableElement()) {
34830        composeBooleanCore("orderable", element.getOrderableElement(), false);
34831        composeBooleanExtras("orderable", element.getOrderableElement(), false);
34832      }
34833      if (element.hasReferencedItem()) {
34834        composeReference("referencedItem", element.getReferencedItem());
34835      }
34836      if (element.hasAdditionalIdentifier()) {
34837        openArray("additionalIdentifier");
34838        for (Identifier e : element.getAdditionalIdentifier()) 
34839          composeIdentifier(null, e);
34840        closeArray();
34841      };
34842      if (element.hasClassification()) {
34843        openArray("classification");
34844        for (CodeableConcept e : element.getClassification()) 
34845          composeCodeableConcept(null, e);
34846        closeArray();
34847      };
34848      if (element.hasStatusElement()) {
34849        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34850        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34851      }
34852      if (element.hasValidityPeriod()) {
34853        composePeriod("validityPeriod", element.getValidityPeriod());
34854      }
34855      if (element.hasValidToElement()) {
34856        composeDateTimeCore("validTo", element.getValidToElement(), false);
34857        composeDateTimeExtras("validTo", element.getValidToElement(), false);
34858      }
34859      if (element.hasLastUpdatedElement()) {
34860        composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
34861        composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
34862      }
34863      if (element.hasAdditionalCharacteristic()) {
34864        openArray("additionalCharacteristic");
34865        for (CodeableConcept e : element.getAdditionalCharacteristic()) 
34866          composeCodeableConcept(null, e);
34867        closeArray();
34868      };
34869      if (element.hasAdditionalClassification()) {
34870        openArray("additionalClassification");
34871        for (CodeableConcept e : element.getAdditionalClassification()) 
34872          composeCodeableConcept(null, e);
34873        closeArray();
34874      };
34875      if (element.hasRelatedEntry()) {
34876        openArray("relatedEntry");
34877        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
34878          composeCatalogEntryRelatedEntryComponent(null, e);
34879        closeArray();
34880      };
34881  }
34882
34883  protected void composeCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
34884    if (element != null) {
34885      open(name);
34886      composeCatalogEntryRelatedEntryComponentProperties(element);
34887      close();
34888    }
34889  }
34890
34891  protected void composeCatalogEntryRelatedEntryComponentProperties(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
34892    composeBackboneElementProperties(element);
34893      if (element.hasRelationtypeElement()) {
34894        composeEnumerationCore("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
34895        composeEnumerationExtras("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
34896      }
34897      if (element.hasItem()) {
34898        composeReference("item", element.getItem());
34899      }
34900  }
34901
34902  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
34903    if (element != null) {
34904      prop("resourceType", name);
34905      composeChargeItemProperties(element);
34906    }
34907  }
34908
34909  protected void composeChargeItemProperties(ChargeItem element) throws IOException {
34910    composeDomainResourceProperties(element);
34911      if (element.hasIdentifier()) {
34912        openArray("identifier");
34913        for (Identifier e : element.getIdentifier()) 
34914          composeIdentifier(null, e);
34915        closeArray();
34916      };
34917      if (element.hasDefinitionUri()) {
34918        if (anyHasValue(element.getDefinitionUri())) {
34919          openArray("definitionUri");
34920          for (UriType e : element.getDefinitionUri()) 
34921            composeUriCore(null, e, e != element.getDefinitionUri().get(element.getDefinitionUri().size()-1));
34922          closeArray();
34923        }
34924        if (anyHasExtras(element.getDefinitionUri())) {
34925          openArray("_definitionUri");
34926          for (UriType e : element.getDefinitionUri()) 
34927            composeUriExtras(null, e, true);
34928          closeArray();
34929        }
34930      };
34931      if (element.hasDefinitionCanonical()) {
34932        if (anyHasValue(element.getDefinitionCanonical())) {
34933          openArray("definitionCanonical");
34934          for (CanonicalType e : element.getDefinitionCanonical()) 
34935            composeCanonicalCore(null, e, e != element.getDefinitionCanonical().get(element.getDefinitionCanonical().size()-1));
34936          closeArray();
34937        }
34938        if (anyHasExtras(element.getDefinitionCanonical())) {
34939          openArray("_definitionCanonical");
34940          for (CanonicalType e : element.getDefinitionCanonical()) 
34941            composeCanonicalExtras(null, e, true);
34942          closeArray();
34943        }
34944      };
34945      if (element.hasStatusElement()) {
34946        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
34947        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
34948      }
34949      if (element.hasPartOf()) {
34950        openArray("partOf");
34951        for (Reference e : element.getPartOf()) 
34952          composeReference(null, e);
34953        closeArray();
34954      };
34955      if (element.hasCode()) {
34956        composeCodeableConcept("code", element.getCode());
34957      }
34958      if (element.hasSubject()) {
34959        composeReference("subject", element.getSubject());
34960      }
34961      if (element.hasContext()) {
34962        composeReference("context", element.getContext());
34963      }
34964      if (element.hasOccurrence()) {
34965        composeType("occurrence", element.getOccurrence());
34966      }
34967      if (element.hasPerformer()) {
34968        openArray("performer");
34969        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
34970          composeChargeItemPerformerComponent(null, e);
34971        closeArray();
34972      };
34973      if (element.hasPerformingOrganization()) {
34974        composeReference("performingOrganization", element.getPerformingOrganization());
34975      }
34976      if (element.hasRequestingOrganization()) {
34977        composeReference("requestingOrganization", element.getRequestingOrganization());
34978      }
34979      if (element.hasCostCenter()) {
34980        composeReference("costCenter", element.getCostCenter());
34981      }
34982      if (element.hasQuantity()) {
34983        composeQuantity("quantity", element.getQuantity());
34984      }
34985      if (element.hasBodysite()) {
34986        openArray("bodysite");
34987        for (CodeableConcept e : element.getBodysite()) 
34988          composeCodeableConcept(null, e);
34989        closeArray();
34990      };
34991      if (element.hasFactorOverrideElement()) {
34992        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
34993        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
34994      }
34995      if (element.hasPriceOverride()) {
34996        composeMoney("priceOverride", element.getPriceOverride());
34997      }
34998      if (element.hasOverrideReasonElement()) {
34999        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
35000        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
35001      }
35002      if (element.hasEnterer()) {
35003        composeReference("enterer", element.getEnterer());
35004      }
35005      if (element.hasEnteredDateElement()) {
35006        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
35007        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
35008      }
35009      if (element.hasReason()) {
35010        openArray("reason");
35011        for (CodeableConcept e : element.getReason()) 
35012          composeCodeableConcept(null, e);
35013        closeArray();
35014      };
35015      if (element.hasService()) {
35016        openArray("service");
35017        for (Reference e : element.getService()) 
35018          composeReference(null, e);
35019        closeArray();
35020      };
35021      if (element.hasProduct()) {
35022        composeType("product", element.getProduct());
35023      }
35024      if (element.hasAccount()) {
35025        openArray("account");
35026        for (Reference e : element.getAccount()) 
35027          composeReference(null, e);
35028        closeArray();
35029      };
35030      if (element.hasNote()) {
35031        openArray("note");
35032        for (Annotation e : element.getNote()) 
35033          composeAnnotation(null, e);
35034        closeArray();
35035      };
35036      if (element.hasSupportingInformation()) {
35037        openArray("supportingInformation");
35038        for (Reference e : element.getSupportingInformation()) 
35039          composeReference(null, e);
35040        closeArray();
35041      };
35042  }
35043
35044  protected void composeChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
35045    if (element != null) {
35046      open(name);
35047      composeChargeItemPerformerComponentProperties(element);
35048      close();
35049    }
35050  }
35051
35052  protected void composeChargeItemPerformerComponentProperties(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
35053    composeBackboneElementProperties(element);
35054      if (element.hasFunction()) {
35055        composeCodeableConcept("function", element.getFunction());
35056      }
35057      if (element.hasActor()) {
35058        composeReference("actor", element.getActor());
35059      }
35060  }
35061
35062  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
35063    if (element != null) {
35064      prop("resourceType", name);
35065      composeChargeItemDefinitionProperties(element);
35066    }
35067  }
35068
35069  protected void composeChargeItemDefinitionProperties(ChargeItemDefinition element) throws IOException {
35070    composeDomainResourceProperties(element);
35071      if (element.hasUrlElement()) {
35072        composeUriCore("url", element.getUrlElement(), false);
35073        composeUriExtras("url", element.getUrlElement(), false);
35074      }
35075      if (element.hasIdentifier()) {
35076        openArray("identifier");
35077        for (Identifier e : element.getIdentifier()) 
35078          composeIdentifier(null, e);
35079        closeArray();
35080      };
35081      if (element.hasVersionElement()) {
35082        composeStringCore("version", element.getVersionElement(), false);
35083        composeStringExtras("version", element.getVersionElement(), false);
35084      }
35085      if (element.hasTitleElement()) {
35086        composeStringCore("title", element.getTitleElement(), false);
35087        composeStringExtras("title", element.getTitleElement(), false);
35088      }
35089      if (element.hasDerivedFromUri()) {
35090        if (anyHasValue(element.getDerivedFromUri())) {
35091          openArray("derivedFromUri");
35092          for (UriType e : element.getDerivedFromUri()) 
35093            composeUriCore(null, e, e != element.getDerivedFromUri().get(element.getDerivedFromUri().size()-1));
35094          closeArray();
35095        }
35096        if (anyHasExtras(element.getDerivedFromUri())) {
35097          openArray("_derivedFromUri");
35098          for (UriType e : element.getDerivedFromUri()) 
35099            composeUriExtras(null, e, true);
35100          closeArray();
35101        }
35102      };
35103      if (element.hasPartOf()) {
35104        if (anyHasValue(element.getPartOf())) {
35105          openArray("partOf");
35106          for (CanonicalType e : element.getPartOf()) 
35107            composeCanonicalCore(null, e, e != element.getPartOf().get(element.getPartOf().size()-1));
35108          closeArray();
35109        }
35110        if (anyHasExtras(element.getPartOf())) {
35111          openArray("_partOf");
35112          for (CanonicalType e : element.getPartOf()) 
35113            composeCanonicalExtras(null, e, true);
35114          closeArray();
35115        }
35116      };
35117      if (element.hasReplaces()) {
35118        if (anyHasValue(element.getReplaces())) {
35119          openArray("replaces");
35120          for (CanonicalType e : element.getReplaces()) 
35121            composeCanonicalCore(null, e, e != element.getReplaces().get(element.getReplaces().size()-1));
35122          closeArray();
35123        }
35124        if (anyHasExtras(element.getReplaces())) {
35125          openArray("_replaces");
35126          for (CanonicalType e : element.getReplaces()) 
35127            composeCanonicalExtras(null, e, true);
35128          closeArray();
35129        }
35130      };
35131      if (element.hasStatusElement()) {
35132        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35133        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35134      }
35135      if (element.hasExperimentalElement()) {
35136        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35137        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35138      }
35139      if (element.hasDateElement()) {
35140        composeDateTimeCore("date", element.getDateElement(), false);
35141        composeDateTimeExtras("date", element.getDateElement(), false);
35142      }
35143      if (element.hasPublisherElement()) {
35144        composeStringCore("publisher", element.getPublisherElement(), false);
35145        composeStringExtras("publisher", element.getPublisherElement(), false);
35146      }
35147      if (element.hasContact()) {
35148        openArray("contact");
35149        for (ContactDetail e : element.getContact()) 
35150          composeContactDetail(null, e);
35151        closeArray();
35152      };
35153      if (element.hasDescriptionElement()) {
35154        composeMarkdownCore("description", element.getDescriptionElement(), false);
35155        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35156      }
35157      if (element.hasUseContext()) {
35158        openArray("useContext");
35159        for (UsageContext e : element.getUseContext()) 
35160          composeUsageContext(null, e);
35161        closeArray();
35162      };
35163      if (element.hasJurisdiction()) {
35164        openArray("jurisdiction");
35165        for (CodeableConcept e : element.getJurisdiction()) 
35166          composeCodeableConcept(null, e);
35167        closeArray();
35168      };
35169      if (element.hasCopyrightElement()) {
35170        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35171        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35172      }
35173      if (element.hasApprovalDateElement()) {
35174        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
35175        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
35176      }
35177      if (element.hasLastReviewDateElement()) {
35178        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
35179        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
35180      }
35181      if (element.hasEffectivePeriod()) {
35182        composePeriod("effectivePeriod", element.getEffectivePeriod());
35183      }
35184      if (element.hasCode()) {
35185        composeCodeableConcept("code", element.getCode());
35186      }
35187      if (element.hasInstance()) {
35188        openArray("instance");
35189        for (Reference e : element.getInstance()) 
35190          composeReference(null, e);
35191        closeArray();
35192      };
35193      if (element.hasApplicability()) {
35194        openArray("applicability");
35195        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
35196          composeChargeItemDefinitionApplicabilityComponent(null, e);
35197        closeArray();
35198      };
35199      if (element.hasPropertyGroup()) {
35200        openArray("propertyGroup");
35201        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
35202          composeChargeItemDefinitionPropertyGroupComponent(null, e);
35203        closeArray();
35204      };
35205  }
35206
35207  protected void composeChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
35208    if (element != null) {
35209      open(name);
35210      composeChargeItemDefinitionApplicabilityComponentProperties(element);
35211      close();
35212    }
35213  }
35214
35215  protected void composeChargeItemDefinitionApplicabilityComponentProperties(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
35216    composeBackboneElementProperties(element);
35217      if (element.hasDescriptionElement()) {
35218        composeStringCore("description", element.getDescriptionElement(), false);
35219        composeStringExtras("description", element.getDescriptionElement(), false);
35220      }
35221      if (element.hasLanguageElement()) {
35222        composeStringCore("language", element.getLanguageElement(), false);
35223        composeStringExtras("language", element.getLanguageElement(), false);
35224      }
35225      if (element.hasExpressionElement()) {
35226        composeStringCore("expression", element.getExpressionElement(), false);
35227        composeStringExtras("expression", element.getExpressionElement(), false);
35228      }
35229  }
35230
35231  protected void composeChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
35232    if (element != null) {
35233      open(name);
35234      composeChargeItemDefinitionPropertyGroupComponentProperties(element);
35235      close();
35236    }
35237  }
35238
35239  protected void composeChargeItemDefinitionPropertyGroupComponentProperties(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
35240    composeBackboneElementProperties(element);
35241      if (element.hasApplicability()) {
35242        openArray("applicability");
35243        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
35244          composeChargeItemDefinitionApplicabilityComponent(null, e);
35245        closeArray();
35246      };
35247      if (element.hasPriceComponent()) {
35248        openArray("priceComponent");
35249        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
35250          composeChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
35251        closeArray();
35252      };
35253  }
35254
35255  protected void composeChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
35256    if (element != null) {
35257      open(name);
35258      composeChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(element);
35259      close();
35260    }
35261  }
35262
35263  protected void composeChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
35264    composeBackboneElementProperties(element);
35265      if (element.hasTypeElement()) {
35266        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
35267        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
35268      }
35269      if (element.hasCode()) {
35270        composeCodeableConcept("code", element.getCode());
35271      }
35272      if (element.hasFactorElement()) {
35273        composeDecimalCore("factor", element.getFactorElement(), false);
35274        composeDecimalExtras("factor", element.getFactorElement(), false);
35275      }
35276      if (element.hasAmount()) {
35277        composeMoney("amount", element.getAmount());
35278      }
35279  }
35280
35281  protected void composeCitation(String name, Citation element) throws IOException {
35282    if (element != null) {
35283      prop("resourceType", name);
35284      composeCitationProperties(element);
35285    }
35286  }
35287
35288  protected void composeCitationProperties(Citation element) throws IOException {
35289    composeDomainResourceProperties(element);
35290      if (element.hasUrlElement()) {
35291        composeUriCore("url", element.getUrlElement(), false);
35292        composeUriExtras("url", element.getUrlElement(), false);
35293      }
35294      if (element.hasIdentifier()) {
35295        openArray("identifier");
35296        for (Identifier e : element.getIdentifier()) 
35297          composeIdentifier(null, e);
35298        closeArray();
35299      };
35300      if (element.hasVersionElement()) {
35301        composeStringCore("version", element.getVersionElement(), false);
35302        composeStringExtras("version", element.getVersionElement(), false);
35303      }
35304      if (element.hasNameElement()) {
35305        composeStringCore("name", element.getNameElement(), false);
35306        composeStringExtras("name", element.getNameElement(), false);
35307      }
35308      if (element.hasTitleElement()) {
35309        composeStringCore("title", element.getTitleElement(), false);
35310        composeStringExtras("title", element.getTitleElement(), false);
35311      }
35312      if (element.hasStatusElement()) {
35313        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35314        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35315      }
35316      if (element.hasExperimentalElement()) {
35317        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35318        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35319      }
35320      if (element.hasDateElement()) {
35321        composeDateTimeCore("date", element.getDateElement(), false);
35322        composeDateTimeExtras("date", element.getDateElement(), false);
35323      }
35324      if (element.hasPublisherElement()) {
35325        composeStringCore("publisher", element.getPublisherElement(), false);
35326        composeStringExtras("publisher", element.getPublisherElement(), false);
35327      }
35328      if (element.hasContact()) {
35329        openArray("contact");
35330        for (ContactDetail e : element.getContact()) 
35331          composeContactDetail(null, e);
35332        closeArray();
35333      };
35334      if (element.hasDescriptionElement()) {
35335        composeMarkdownCore("description", element.getDescriptionElement(), false);
35336        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35337      }
35338      if (element.hasUseContext()) {
35339        openArray("useContext");
35340        for (UsageContext e : element.getUseContext()) 
35341          composeUsageContext(null, e);
35342        closeArray();
35343      };
35344      if (element.hasJurisdiction()) {
35345        openArray("jurisdiction");
35346        for (CodeableConcept e : element.getJurisdiction()) 
35347          composeCodeableConcept(null, e);
35348        closeArray();
35349      };
35350      if (element.hasPurposeElement()) {
35351        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35352        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35353      }
35354      if (element.hasCopyrightElement()) {
35355        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35356        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35357      }
35358      if (element.hasApprovalDateElement()) {
35359        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
35360        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
35361      }
35362      if (element.hasLastReviewDateElement()) {
35363        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
35364        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
35365      }
35366      if (element.hasEffectivePeriod()) {
35367        composePeriod("effectivePeriod", element.getEffectivePeriod());
35368      }
35369      if (element.hasAuthor()) {
35370        openArray("author");
35371        for (ContactDetail e : element.getAuthor()) 
35372          composeContactDetail(null, e);
35373        closeArray();
35374      };
35375      if (element.hasEditor()) {
35376        openArray("editor");
35377        for (ContactDetail e : element.getEditor()) 
35378          composeContactDetail(null, e);
35379        closeArray();
35380      };
35381      if (element.hasReviewer()) {
35382        openArray("reviewer");
35383        for (ContactDetail e : element.getReviewer()) 
35384          composeContactDetail(null, e);
35385        closeArray();
35386      };
35387      if (element.hasEndorser()) {
35388        openArray("endorser");
35389        for (ContactDetail e : element.getEndorser()) 
35390          composeContactDetail(null, e);
35391        closeArray();
35392      };
35393      if (element.hasSummary()) {
35394        openArray("summary");
35395        for (ContactDetail e : element.getSummary()) 
35396          composeContactDetail(null, e);
35397        closeArray();
35398      };
35399      if (element.hasClassification()) {
35400        openArray("classification");
35401        for (Citation.CitationClassificationComponent e : element.getClassification()) 
35402          composeCitationClassificationComponent(null, e);
35403        closeArray();
35404      };
35405      if (element.hasNote()) {
35406        openArray("note");
35407        for (Annotation e : element.getNote()) 
35408          composeAnnotation(null, e);
35409        closeArray();
35410      };
35411      if (element.hasCurrentState()) {
35412        openArray("currentState");
35413        for (CodeableConcept e : element.getCurrentState()) 
35414          composeCodeableConcept(null, e);
35415        closeArray();
35416      };
35417      if (element.hasStatusDate()) {
35418        openArray("statusDate");
35419        for (Citation.CitationStatusDateComponent e : element.getStatusDate()) 
35420          composeCitationStatusDateComponent(null, e);
35421        closeArray();
35422      };
35423      if (element.hasRelatesTo()) {
35424        openArray("relatesTo");
35425        for (Citation.CitationRelatesToComponent e : element.getRelatesTo()) 
35426          composeCitationRelatesToComponent(null, e);
35427        closeArray();
35428      };
35429      if (element.hasCitedArtifact()) {
35430        composeCitationCitedArtifactComponent("citedArtifact", element.getCitedArtifact());
35431      }
35432  }
35433
35434  protected void composeCitationClassificationComponent(String name, Citation.CitationClassificationComponent element) throws IOException {
35435    if (element != null) {
35436      open(name);
35437      composeCitationClassificationComponentProperties(element);
35438      close();
35439    }
35440  }
35441
35442  protected void composeCitationClassificationComponentProperties(Citation.CitationClassificationComponent element) throws IOException {
35443    composeBackboneElementProperties(element);
35444      if (element.hasType()) {
35445        composeCodeableConcept("type", element.getType());
35446      }
35447      if (element.hasClassifier()) {
35448        openArray("classifier");
35449        for (CodeableConcept e : element.getClassifier()) 
35450          composeCodeableConcept(null, e);
35451        closeArray();
35452      };
35453  }
35454
35455  protected void composeCitationStatusDateComponent(String name, Citation.CitationStatusDateComponent element) throws IOException {
35456    if (element != null) {
35457      open(name);
35458      composeCitationStatusDateComponentProperties(element);
35459      close();
35460    }
35461  }
35462
35463  protected void composeCitationStatusDateComponentProperties(Citation.CitationStatusDateComponent element) throws IOException {
35464    composeBackboneElementProperties(element);
35465      if (element.hasActivity()) {
35466        composeCodeableConcept("activity", element.getActivity());
35467      }
35468      if (element.hasActualElement()) {
35469        composeBooleanCore("actual", element.getActualElement(), false);
35470        composeBooleanExtras("actual", element.getActualElement(), false);
35471      }
35472      if (element.hasPeriod()) {
35473        composePeriod("period", element.getPeriod());
35474      }
35475  }
35476
35477  protected void composeCitationRelatesToComponent(String name, Citation.CitationRelatesToComponent element) throws IOException {
35478    if (element != null) {
35479      open(name);
35480      composeCitationRelatesToComponentProperties(element);
35481      close();
35482    }
35483  }
35484
35485  protected void composeCitationRelatesToComponentProperties(Citation.CitationRelatesToComponent element) throws IOException {
35486    composeBackboneElementProperties(element);
35487      if (element.hasRelationshipType()) {
35488        composeCodeableConcept("relationshipType", element.getRelationshipType());
35489      }
35490      if (element.hasTargetClassifier()) {
35491        openArray("targetClassifier");
35492        for (CodeableConcept e : element.getTargetClassifier()) 
35493          composeCodeableConcept(null, e);
35494        closeArray();
35495      };
35496      if (element.hasTarget()) {
35497        composeType("target", element.getTarget());
35498      }
35499  }
35500
35501  protected void composeCitationCitedArtifactComponent(String name, Citation.CitationCitedArtifactComponent element) throws IOException {
35502    if (element != null) {
35503      open(name);
35504      composeCitationCitedArtifactComponentProperties(element);
35505      close();
35506    }
35507  }
35508
35509  protected void composeCitationCitedArtifactComponentProperties(Citation.CitationCitedArtifactComponent element) throws IOException {
35510    composeBackboneElementProperties(element);
35511      if (element.hasIdentifier()) {
35512        openArray("identifier");
35513        for (Identifier e : element.getIdentifier()) 
35514          composeIdentifier(null, e);
35515        closeArray();
35516      };
35517      if (element.hasRelatedIdentifier()) {
35518        openArray("relatedIdentifier");
35519        for (Identifier e : element.getRelatedIdentifier()) 
35520          composeIdentifier(null, e);
35521        closeArray();
35522      };
35523      if (element.hasDateAccessedElement()) {
35524        composeDateTimeCore("dateAccessed", element.getDateAccessedElement(), false);
35525        composeDateTimeExtras("dateAccessed", element.getDateAccessedElement(), false);
35526      }
35527      if (element.hasVersion()) {
35528        composeCitationCitedArtifactVersionComponent("version", element.getVersion());
35529      }
35530      if (element.hasCurrentState()) {
35531        openArray("currentState");
35532        for (CodeableConcept e : element.getCurrentState()) 
35533          composeCodeableConcept(null, e);
35534        closeArray();
35535      };
35536      if (element.hasStatusDate()) {
35537        openArray("statusDate");
35538        for (Citation.CitationCitedArtifactStatusDateComponent e : element.getStatusDate()) 
35539          composeCitationCitedArtifactStatusDateComponent(null, e);
35540        closeArray();
35541      };
35542      if (element.hasTitle()) {
35543        openArray("title");
35544        for (Citation.CitationCitedArtifactTitleComponent e : element.getTitle()) 
35545          composeCitationCitedArtifactTitleComponent(null, e);
35546        closeArray();
35547      };
35548      if (element.hasAbstract()) {
35549        openArray("abstract");
35550        for (Citation.CitationCitedArtifactAbstractComponent e : element.getAbstract()) 
35551          composeCitationCitedArtifactAbstractComponent(null, e);
35552        closeArray();
35553      };
35554      if (element.hasPart()) {
35555        composeCitationCitedArtifactPartComponent("part", element.getPart());
35556      }
35557      if (element.hasRelatesTo()) {
35558        openArray("relatesTo");
35559        for (Citation.CitationCitedArtifactRelatesToComponent e : element.getRelatesTo()) 
35560          composeCitationCitedArtifactRelatesToComponent(null, e);
35561        closeArray();
35562      };
35563      if (element.hasPublicationForm()) {
35564        openArray("publicationForm");
35565        for (Citation.CitationCitedArtifactPublicationFormComponent e : element.getPublicationForm()) 
35566          composeCitationCitedArtifactPublicationFormComponent(null, e);
35567        closeArray();
35568      };
35569      if (element.hasWebLocation()) {
35570        openArray("webLocation");
35571        for (Citation.CitationCitedArtifactWebLocationComponent e : element.getWebLocation()) 
35572          composeCitationCitedArtifactWebLocationComponent(null, e);
35573        closeArray();
35574      };
35575      if (element.hasClassification()) {
35576        openArray("classification");
35577        for (Citation.CitationCitedArtifactClassificationComponent e : element.getClassification()) 
35578          composeCitationCitedArtifactClassificationComponent(null, e);
35579        closeArray();
35580      };
35581      if (element.hasContributorship()) {
35582        composeCitationCitedArtifactContributorshipComponent("contributorship", element.getContributorship());
35583      }
35584      if (element.hasNote()) {
35585        openArray("note");
35586        for (Annotation e : element.getNote()) 
35587          composeAnnotation(null, e);
35588        closeArray();
35589      };
35590  }
35591
35592  protected void composeCitationCitedArtifactVersionComponent(String name, Citation.CitationCitedArtifactVersionComponent element) throws IOException {
35593    if (element != null) {
35594      open(name);
35595      composeCitationCitedArtifactVersionComponentProperties(element);
35596      close();
35597    }
35598  }
35599
35600  protected void composeCitationCitedArtifactVersionComponentProperties(Citation.CitationCitedArtifactVersionComponent element) throws IOException {
35601    composeBackboneElementProperties(element);
35602      if (element.hasValueElement()) {
35603        composeStringCore("value", element.getValueElement(), false);
35604        composeStringExtras("value", element.getValueElement(), false);
35605      }
35606      if (element.hasBaseCitation()) {
35607        composeReference("baseCitation", element.getBaseCitation());
35608      }
35609  }
35610
35611  protected void composeCitationCitedArtifactStatusDateComponent(String name, Citation.CitationCitedArtifactStatusDateComponent element) throws IOException {
35612    if (element != null) {
35613      open(name);
35614      composeCitationCitedArtifactStatusDateComponentProperties(element);
35615      close();
35616    }
35617  }
35618
35619  protected void composeCitationCitedArtifactStatusDateComponentProperties(Citation.CitationCitedArtifactStatusDateComponent element) throws IOException {
35620    composeBackboneElementProperties(element);
35621      if (element.hasActivity()) {
35622        composeCodeableConcept("activity", element.getActivity());
35623      }
35624      if (element.hasActualElement()) {
35625        composeBooleanCore("actual", element.getActualElement(), false);
35626        composeBooleanExtras("actual", element.getActualElement(), false);
35627      }
35628      if (element.hasPeriod()) {
35629        composePeriod("period", element.getPeriod());
35630      }
35631  }
35632
35633  protected void composeCitationCitedArtifactTitleComponent(String name, Citation.CitationCitedArtifactTitleComponent element) throws IOException {
35634    if (element != null) {
35635      open(name);
35636      composeCitationCitedArtifactTitleComponentProperties(element);
35637      close();
35638    }
35639  }
35640
35641  protected void composeCitationCitedArtifactTitleComponentProperties(Citation.CitationCitedArtifactTitleComponent element) throws IOException {
35642    composeBackboneElementProperties(element);
35643      if (element.hasType()) {
35644        openArray("type");
35645        for (CodeableConcept e : element.getType()) 
35646          composeCodeableConcept(null, e);
35647        closeArray();
35648      };
35649      if (element.hasLanguage()) {
35650        composeCodeableConcept("language", element.getLanguage());
35651      }
35652      if (element.hasTextElement()) {
35653        composeMarkdownCore("text", element.getTextElement(), false);
35654        composeMarkdownExtras("text", element.getTextElement(), false);
35655      }
35656  }
35657
35658  protected void composeCitationCitedArtifactAbstractComponent(String name, Citation.CitationCitedArtifactAbstractComponent element) throws IOException {
35659    if (element != null) {
35660      open(name);
35661      composeCitationCitedArtifactAbstractComponentProperties(element);
35662      close();
35663    }
35664  }
35665
35666  protected void composeCitationCitedArtifactAbstractComponentProperties(Citation.CitationCitedArtifactAbstractComponent element) throws IOException {
35667    composeBackboneElementProperties(element);
35668      if (element.hasType()) {
35669        composeCodeableConcept("type", element.getType());
35670      }
35671      if (element.hasLanguage()) {
35672        composeCodeableConcept("language", element.getLanguage());
35673      }
35674      if (element.hasTextElement()) {
35675        composeMarkdownCore("text", element.getTextElement(), false);
35676        composeMarkdownExtras("text", element.getTextElement(), false);
35677      }
35678      if (element.hasCopyrightElement()) {
35679        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35680        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35681      }
35682  }
35683
35684  protected void composeCitationCitedArtifactPartComponent(String name, Citation.CitationCitedArtifactPartComponent element) throws IOException {
35685    if (element != null) {
35686      open(name);
35687      composeCitationCitedArtifactPartComponentProperties(element);
35688      close();
35689    }
35690  }
35691
35692  protected void composeCitationCitedArtifactPartComponentProperties(Citation.CitationCitedArtifactPartComponent element) throws IOException {
35693    composeBackboneElementProperties(element);
35694      if (element.hasType()) {
35695        composeCodeableConcept("type", element.getType());
35696      }
35697      if (element.hasValueElement()) {
35698        composeStringCore("value", element.getValueElement(), false);
35699        composeStringExtras("value", element.getValueElement(), false);
35700      }
35701      if (element.hasBaseCitation()) {
35702        composeReference("baseCitation", element.getBaseCitation());
35703      }
35704  }
35705
35706  protected void composeCitationCitedArtifactRelatesToComponent(String name, Citation.CitationCitedArtifactRelatesToComponent element) throws IOException {
35707    if (element != null) {
35708      open(name);
35709      composeCitationCitedArtifactRelatesToComponentProperties(element);
35710      close();
35711    }
35712  }
35713
35714  protected void composeCitationCitedArtifactRelatesToComponentProperties(Citation.CitationCitedArtifactRelatesToComponent element) throws IOException {
35715    composeBackboneElementProperties(element);
35716      if (element.hasRelationshipType()) {
35717        composeCodeableConcept("relationshipType", element.getRelationshipType());
35718      }
35719      if (element.hasTargetClassifier()) {
35720        openArray("targetClassifier");
35721        for (CodeableConcept e : element.getTargetClassifier()) 
35722          composeCodeableConcept(null, e);
35723        closeArray();
35724      };
35725      if (element.hasTarget()) {
35726        composeType("target", element.getTarget());
35727      }
35728  }
35729
35730  protected void composeCitationCitedArtifactPublicationFormComponent(String name, Citation.CitationCitedArtifactPublicationFormComponent element) throws IOException {
35731    if (element != null) {
35732      open(name);
35733      composeCitationCitedArtifactPublicationFormComponentProperties(element);
35734      close();
35735    }
35736  }
35737
35738  protected void composeCitationCitedArtifactPublicationFormComponentProperties(Citation.CitationCitedArtifactPublicationFormComponent element) throws IOException {
35739    composeBackboneElementProperties(element);
35740      if (element.hasPublishedIn()) {
35741        composeCitationCitedArtifactPublicationFormPublishedInComponent("publishedIn", element.getPublishedIn());
35742      }
35743      if (element.hasPeriodicRelease()) {
35744        composeCitationCitedArtifactPublicationFormPeriodicReleaseComponent("periodicRelease", element.getPeriodicRelease());
35745      }
35746      if (element.hasArticleDateElement()) {
35747        composeDateTimeCore("articleDate", element.getArticleDateElement(), false);
35748        composeDateTimeExtras("articleDate", element.getArticleDateElement(), false);
35749      }
35750      if (element.hasLastRevisionDateElement()) {
35751        composeDateTimeCore("lastRevisionDate", element.getLastRevisionDateElement(), false);
35752        composeDateTimeExtras("lastRevisionDate", element.getLastRevisionDateElement(), false);
35753      }
35754      if (element.hasLanguage()) {
35755        openArray("language");
35756        for (CodeableConcept e : element.getLanguage()) 
35757          composeCodeableConcept(null, e);
35758        closeArray();
35759      };
35760      if (element.hasAccessionNumberElement()) {
35761        composeStringCore("accessionNumber", element.getAccessionNumberElement(), false);
35762        composeStringExtras("accessionNumber", element.getAccessionNumberElement(), false);
35763      }
35764      if (element.hasPageStringElement()) {
35765        composeStringCore("pageString", element.getPageStringElement(), false);
35766        composeStringExtras("pageString", element.getPageStringElement(), false);
35767      }
35768      if (element.hasFirstPageElement()) {
35769        composeStringCore("firstPage", element.getFirstPageElement(), false);
35770        composeStringExtras("firstPage", element.getFirstPageElement(), false);
35771      }
35772      if (element.hasLastPageElement()) {
35773        composeStringCore("lastPage", element.getLastPageElement(), false);
35774        composeStringExtras("lastPage", element.getLastPageElement(), false);
35775      }
35776      if (element.hasPageCountElement()) {
35777        composeStringCore("pageCount", element.getPageCountElement(), false);
35778        composeStringExtras("pageCount", element.getPageCountElement(), false);
35779      }
35780      if (element.hasCopyrightElement()) {
35781        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35782        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35783      }
35784  }
35785
35786  protected void composeCitationCitedArtifactPublicationFormPublishedInComponent(String name, Citation.CitationCitedArtifactPublicationFormPublishedInComponent element) throws IOException {
35787    if (element != null) {
35788      open(name);
35789      composeCitationCitedArtifactPublicationFormPublishedInComponentProperties(element);
35790      close();
35791    }
35792  }
35793
35794  protected void composeCitationCitedArtifactPublicationFormPublishedInComponentProperties(Citation.CitationCitedArtifactPublicationFormPublishedInComponent element) throws IOException {
35795    composeBackboneElementProperties(element);
35796      if (element.hasType()) {
35797        composeCodeableConcept("type", element.getType());
35798      }
35799      if (element.hasIdentifier()) {
35800        openArray("identifier");
35801        for (Identifier e : element.getIdentifier()) 
35802          composeIdentifier(null, e);
35803        closeArray();
35804      };
35805      if (element.hasTitleElement()) {
35806        composeStringCore("title", element.getTitleElement(), false);
35807        composeStringExtras("title", element.getTitleElement(), false);
35808      }
35809      if (element.hasPublisher()) {
35810        composeReference("publisher", element.getPublisher());
35811      }
35812      if (element.hasPublisherLocationElement()) {
35813        composeStringCore("publisherLocation", element.getPublisherLocationElement(), false);
35814        composeStringExtras("publisherLocation", element.getPublisherLocationElement(), false);
35815      }
35816  }
35817
35818  protected void composeCitationCitedArtifactPublicationFormPeriodicReleaseComponent(String name, Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent element) throws IOException {
35819    if (element != null) {
35820      open(name);
35821      composeCitationCitedArtifactPublicationFormPeriodicReleaseComponentProperties(element);
35822      close();
35823    }
35824  }
35825
35826  protected void composeCitationCitedArtifactPublicationFormPeriodicReleaseComponentProperties(Citation.CitationCitedArtifactPublicationFormPeriodicReleaseComponent element) throws IOException {
35827    composeBackboneElementProperties(element);
35828      if (element.hasCitedMedium()) {
35829        composeCodeableConcept("citedMedium", element.getCitedMedium());
35830      }
35831      if (element.hasVolumeElement()) {
35832        composeStringCore("volume", element.getVolumeElement(), false);
35833        composeStringExtras("volume", element.getVolumeElement(), false);
35834      }
35835      if (element.hasIssueElement()) {
35836        composeStringCore("issue", element.getIssueElement(), false);
35837        composeStringExtras("issue", element.getIssueElement(), false);
35838      }
35839      if (element.hasDateOfPublication()) {
35840        composeCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent("dateOfPublication", element.getDateOfPublication());
35841      }
35842  }
35843
35844  protected void composeCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent(String name, Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent element) throws IOException {
35845    if (element != null) {
35846      open(name);
35847      composeCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponentProperties(element);
35848      close();
35849    }
35850  }
35851
35852  protected void composeCitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponentProperties(Citation.CitationCitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent element) throws IOException {
35853    composeBackboneElementProperties(element);
35854      if (element.hasDateElement()) {
35855        composeDateCore("date", element.getDateElement(), false);
35856        composeDateExtras("date", element.getDateElement(), false);
35857      }
35858      if (element.hasYearElement()) {
35859        composeStringCore("year", element.getYearElement(), false);
35860        composeStringExtras("year", element.getYearElement(), false);
35861      }
35862      if (element.hasMonthElement()) {
35863        composeStringCore("month", element.getMonthElement(), false);
35864        composeStringExtras("month", element.getMonthElement(), false);
35865      }
35866      if (element.hasDayElement()) {
35867        composeStringCore("day", element.getDayElement(), false);
35868        composeStringExtras("day", element.getDayElement(), false);
35869      }
35870      if (element.hasSeasonElement()) {
35871        composeStringCore("season", element.getSeasonElement(), false);
35872        composeStringExtras("season", element.getSeasonElement(), false);
35873      }
35874      if (element.hasTextElement()) {
35875        composeStringCore("text", element.getTextElement(), false);
35876        composeStringExtras("text", element.getTextElement(), false);
35877      }
35878  }
35879
35880  protected void composeCitationCitedArtifactWebLocationComponent(String name, Citation.CitationCitedArtifactWebLocationComponent element) throws IOException {
35881    if (element != null) {
35882      open(name);
35883      composeCitationCitedArtifactWebLocationComponentProperties(element);
35884      close();
35885    }
35886  }
35887
35888  protected void composeCitationCitedArtifactWebLocationComponentProperties(Citation.CitationCitedArtifactWebLocationComponent element) throws IOException {
35889    composeBackboneElementProperties(element);
35890      if (element.hasType()) {
35891        composeCodeableConcept("type", element.getType());
35892      }
35893      if (element.hasUrlElement()) {
35894        composeUriCore("url", element.getUrlElement(), false);
35895        composeUriExtras("url", element.getUrlElement(), false);
35896      }
35897  }
35898
35899  protected void composeCitationCitedArtifactClassificationComponent(String name, Citation.CitationCitedArtifactClassificationComponent element) throws IOException {
35900    if (element != null) {
35901      open(name);
35902      composeCitationCitedArtifactClassificationComponentProperties(element);
35903      close();
35904    }
35905  }
35906
35907  protected void composeCitationCitedArtifactClassificationComponentProperties(Citation.CitationCitedArtifactClassificationComponent element) throws IOException {
35908    composeBackboneElementProperties(element);
35909      if (element.hasType()) {
35910        composeCodeableConcept("type", element.getType());
35911      }
35912      if (element.hasClassifier()) {
35913        openArray("classifier");
35914        for (CodeableConcept e : element.getClassifier()) 
35915          composeCodeableConcept(null, e);
35916        closeArray();
35917      };
35918      if (element.hasWhoClassified()) {
35919        composeCitationCitedArtifactClassificationWhoClassifiedComponent("whoClassified", element.getWhoClassified());
35920      }
35921  }
35922
35923  protected void composeCitationCitedArtifactClassificationWhoClassifiedComponent(String name, Citation.CitationCitedArtifactClassificationWhoClassifiedComponent element) throws IOException {
35924    if (element != null) {
35925      open(name);
35926      composeCitationCitedArtifactClassificationWhoClassifiedComponentProperties(element);
35927      close();
35928    }
35929  }
35930
35931  protected void composeCitationCitedArtifactClassificationWhoClassifiedComponentProperties(Citation.CitationCitedArtifactClassificationWhoClassifiedComponent element) throws IOException {
35932    composeBackboneElementProperties(element);
35933      if (element.hasPerson()) {
35934        composeReference("person", element.getPerson());
35935      }
35936      if (element.hasOrganization()) {
35937        composeReference("organization", element.getOrganization());
35938      }
35939      if (element.hasPublisher()) {
35940        composeReference("publisher", element.getPublisher());
35941      }
35942      if (element.hasClassifierCopyrightElement()) {
35943        composeStringCore("classifierCopyright", element.getClassifierCopyrightElement(), false);
35944        composeStringExtras("classifierCopyright", element.getClassifierCopyrightElement(), false);
35945      }
35946      if (element.hasFreeToShareElement()) {
35947        composeBooleanCore("freeToShare", element.getFreeToShareElement(), false);
35948        composeBooleanExtras("freeToShare", element.getFreeToShareElement(), false);
35949      }
35950  }
35951
35952  protected void composeCitationCitedArtifactContributorshipComponent(String name, Citation.CitationCitedArtifactContributorshipComponent element) throws IOException {
35953    if (element != null) {
35954      open(name);
35955      composeCitationCitedArtifactContributorshipComponentProperties(element);
35956      close();
35957    }
35958  }
35959
35960  protected void composeCitationCitedArtifactContributorshipComponentProperties(Citation.CitationCitedArtifactContributorshipComponent element) throws IOException {
35961    composeBackboneElementProperties(element);
35962      if (element.hasCompleteElement()) {
35963        composeBooleanCore("complete", element.getCompleteElement(), false);
35964        composeBooleanExtras("complete", element.getCompleteElement(), false);
35965      }
35966      if (element.hasEntry()) {
35967        openArray("entry");
35968        for (Citation.CitationCitedArtifactContributorshipEntryComponent e : element.getEntry()) 
35969          composeCitationCitedArtifactContributorshipEntryComponent(null, e);
35970        closeArray();
35971      };
35972      if (element.hasSummary()) {
35973        openArray("summary");
35974        for (Citation.CitationCitedArtifactContributorshipSummaryComponent e : element.getSummary()) 
35975          composeCitationCitedArtifactContributorshipSummaryComponent(null, e);
35976        closeArray();
35977      };
35978  }
35979
35980  protected void composeCitationCitedArtifactContributorshipEntryComponent(String name, Citation.CitationCitedArtifactContributorshipEntryComponent element) throws IOException {
35981    if (element != null) {
35982      open(name);
35983      composeCitationCitedArtifactContributorshipEntryComponentProperties(element);
35984      close();
35985    }
35986  }
35987
35988  protected void composeCitationCitedArtifactContributorshipEntryComponentProperties(Citation.CitationCitedArtifactContributorshipEntryComponent element) throws IOException {
35989    composeBackboneElementProperties(element);
35990      if (element.hasName()) {
35991        composeHumanName("name", element.getName());
35992      }
35993      if (element.hasInitialsElement()) {
35994        composeStringCore("initials", element.getInitialsElement(), false);
35995        composeStringExtras("initials", element.getInitialsElement(), false);
35996      }
35997      if (element.hasCollectiveNameElement()) {
35998        composeStringCore("collectiveName", element.getCollectiveNameElement(), false);
35999        composeStringExtras("collectiveName", element.getCollectiveNameElement(), false);
36000      }
36001      if (element.hasIdentifier()) {
36002        openArray("identifier");
36003        for (Identifier e : element.getIdentifier()) 
36004          composeIdentifier(null, e);
36005        closeArray();
36006      };
36007      if (element.hasAffiliationInfo()) {
36008        openArray("affiliationInfo");
36009        for (Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent e : element.getAffiliationInfo()) 
36010          composeCitationCitedArtifactContributorshipEntryAffiliationInfoComponent(null, e);
36011        closeArray();
36012      };
36013      if (element.hasAddress()) {
36014        openArray("address");
36015        for (Address e : element.getAddress()) 
36016          composeAddress(null, e);
36017        closeArray();
36018      };
36019      if (element.hasTelecom()) {
36020        openArray("telecom");
36021        for (ContactPoint e : element.getTelecom()) 
36022          composeContactPoint(null, e);
36023        closeArray();
36024      };
36025      if (element.hasContributionType()) {
36026        openArray("contributionType");
36027        for (CodeableConcept e : element.getContributionType()) 
36028          composeCodeableConcept(null, e);
36029        closeArray();
36030      };
36031      if (element.hasRole()) {
36032        composeCodeableConcept("role", element.getRole());
36033      }
36034      if (element.hasContributionInstance()) {
36035        openArray("contributionInstance");
36036        for (Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent e : element.getContributionInstance()) 
36037          composeCitationCitedArtifactContributorshipEntryContributionInstanceComponent(null, e);
36038        closeArray();
36039      };
36040      if (element.hasCorrespondingContactElement()) {
36041        composeBooleanCore("correspondingContact", element.getCorrespondingContactElement(), false);
36042        composeBooleanExtras("correspondingContact", element.getCorrespondingContactElement(), false);
36043      }
36044      if (element.hasListOrderElement()) {
36045        composePositiveIntCore("listOrder", element.getListOrderElement(), false);
36046        composePositiveIntExtras("listOrder", element.getListOrderElement(), false);
36047      }
36048  }
36049
36050  protected void composeCitationCitedArtifactContributorshipEntryAffiliationInfoComponent(String name, Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent element) throws IOException {
36051    if (element != null) {
36052      open(name);
36053      composeCitationCitedArtifactContributorshipEntryAffiliationInfoComponentProperties(element);
36054      close();
36055    }
36056  }
36057
36058  protected void composeCitationCitedArtifactContributorshipEntryAffiliationInfoComponentProperties(Citation.CitationCitedArtifactContributorshipEntryAffiliationInfoComponent element) throws IOException {
36059    composeBackboneElementProperties(element);
36060      if (element.hasAffiliationElement()) {
36061        composeStringCore("affiliation", element.getAffiliationElement(), false);
36062        composeStringExtras("affiliation", element.getAffiliationElement(), false);
36063      }
36064      if (element.hasRoleElement()) {
36065        composeStringCore("role", element.getRoleElement(), false);
36066        composeStringExtras("role", element.getRoleElement(), false);
36067      }
36068      if (element.hasIdentifier()) {
36069        openArray("identifier");
36070        for (Identifier e : element.getIdentifier()) 
36071          composeIdentifier(null, e);
36072        closeArray();
36073      };
36074  }
36075
36076  protected void composeCitationCitedArtifactContributorshipEntryContributionInstanceComponent(String name, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent element) throws IOException {
36077    if (element != null) {
36078      open(name);
36079      composeCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(element);
36080      close();
36081    }
36082  }
36083
36084  protected void composeCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent element) throws IOException {
36085    composeBackboneElementProperties(element);
36086      if (element.hasType()) {
36087        composeCodeableConcept("type", element.getType());
36088      }
36089      if (element.hasTimeElement()) {
36090        composeDateTimeCore("time", element.getTimeElement(), false);
36091        composeDateTimeExtras("time", element.getTimeElement(), false);
36092      }
36093  }
36094
36095  protected void composeCitationCitedArtifactContributorshipSummaryComponent(String name, Citation.CitationCitedArtifactContributorshipSummaryComponent element) throws IOException {
36096    if (element != null) {
36097      open(name);
36098      composeCitationCitedArtifactContributorshipSummaryComponentProperties(element);
36099      close();
36100    }
36101  }
36102
36103  protected void composeCitationCitedArtifactContributorshipSummaryComponentProperties(Citation.CitationCitedArtifactContributorshipSummaryComponent element) throws IOException {
36104    composeBackboneElementProperties(element);
36105      if (element.hasType()) {
36106        composeCodeableConcept("type", element.getType());
36107      }
36108      if (element.hasStyle()) {
36109        composeCodeableConcept("style", element.getStyle());
36110      }
36111      if (element.hasSource()) {
36112        composeCodeableConcept("source", element.getSource());
36113      }
36114      if (element.hasValueElement()) {
36115        composeMarkdownCore("value", element.getValueElement(), false);
36116        composeMarkdownExtras("value", element.getValueElement(), false);
36117      }
36118  }
36119
36120  protected void composeClaim(String name, Claim element) throws IOException {
36121    if (element != null) {
36122      prop("resourceType", name);
36123      composeClaimProperties(element);
36124    }
36125  }
36126
36127  protected void composeClaimProperties(Claim element) throws IOException {
36128    composeDomainResourceProperties(element);
36129      if (element.hasIdentifier()) {
36130        openArray("identifier");
36131        for (Identifier e : element.getIdentifier()) 
36132          composeIdentifier(null, e);
36133        closeArray();
36134      };
36135      if (element.hasStatusElement()) {
36136        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36137        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36138      }
36139      if (element.hasType()) {
36140        composeCodeableConcept("type", element.getType());
36141      }
36142      if (element.hasSubType()) {
36143        composeCodeableConcept("subType", element.getSubType());
36144      }
36145      if (element.hasUseElement()) {
36146        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36147        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36148      }
36149      if (element.hasPatient()) {
36150        composeReference("patient", element.getPatient());
36151      }
36152      if (element.hasBillablePeriod()) {
36153        composePeriod("billablePeriod", element.getBillablePeriod());
36154      }
36155      if (element.hasCreatedElement()) {
36156        composeDateTimeCore("created", element.getCreatedElement(), false);
36157        composeDateTimeExtras("created", element.getCreatedElement(), false);
36158      }
36159      if (element.hasEnterer()) {
36160        composeReference("enterer", element.getEnterer());
36161      }
36162      if (element.hasInsurer()) {
36163        composeReference("insurer", element.getInsurer());
36164      }
36165      if (element.hasProvider()) {
36166        composeReference("provider", element.getProvider());
36167      }
36168      if (element.hasPriority()) {
36169        composeCodeableConcept("priority", element.getPriority());
36170      }
36171      if (element.hasFundsReserve()) {
36172        composeCodeableConcept("fundsReserve", element.getFundsReserve());
36173      }
36174      if (element.hasRelated()) {
36175        openArray("related");
36176        for (Claim.RelatedClaimComponent e : element.getRelated()) 
36177          composeRelatedClaimComponent(null, e);
36178        closeArray();
36179      };
36180      if (element.hasPrescription()) {
36181        composeReference("prescription", element.getPrescription());
36182      }
36183      if (element.hasOriginalPrescription()) {
36184        composeReference("originalPrescription", element.getOriginalPrescription());
36185      }
36186      if (element.hasPayee()) {
36187        composePayeeComponent("payee", element.getPayee());
36188      }
36189      if (element.hasReferral()) {
36190        composeReference("referral", element.getReferral());
36191      }
36192      if (element.hasFacility()) {
36193        composeReference("facility", element.getFacility());
36194      }
36195      if (element.hasCareTeam()) {
36196        openArray("careTeam");
36197        for (Claim.CareTeamComponent e : element.getCareTeam()) 
36198          composeCareTeamComponent(null, e);
36199        closeArray();
36200      };
36201      if (element.hasSupportingInfo()) {
36202        openArray("supportingInfo");
36203        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
36204          composeSupportingInformationComponent(null, e);
36205        closeArray();
36206      };
36207      if (element.hasDiagnosis()) {
36208        openArray("diagnosis");
36209        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
36210          composeDiagnosisComponent(null, e);
36211        closeArray();
36212      };
36213      if (element.hasProcedure()) {
36214        openArray("procedure");
36215        for (Claim.ProcedureComponent e : element.getProcedure()) 
36216          composeProcedureComponent(null, e);
36217        closeArray();
36218      };
36219      if (element.hasInsurance()) {
36220        openArray("insurance");
36221        for (Claim.InsuranceComponent e : element.getInsurance()) 
36222          composeInsuranceComponent(null, e);
36223        closeArray();
36224      };
36225      if (element.hasAccident()) {
36226        composeAccidentComponent("accident", element.getAccident());
36227      }
36228      if (element.hasItem()) {
36229        openArray("item");
36230        for (Claim.ItemComponent e : element.getItem()) 
36231          composeItemComponent(null, e);
36232        closeArray();
36233      };
36234      if (element.hasTotal()) {
36235        composeMoney("total", element.getTotal());
36236      }
36237  }
36238
36239  protected void composeRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
36240    if (element != null) {
36241      open(name);
36242      composeRelatedClaimComponentProperties(element);
36243      close();
36244    }
36245  }
36246
36247  protected void composeRelatedClaimComponentProperties(Claim.RelatedClaimComponent element) throws IOException {
36248    composeBackboneElementProperties(element);
36249      if (element.hasClaim()) {
36250        composeReference("claim", element.getClaim());
36251      }
36252      if (element.hasRelationship()) {
36253        composeCodeableConcept("relationship", element.getRelationship());
36254      }
36255      if (element.hasReference()) {
36256        composeIdentifier("reference", element.getReference());
36257      }
36258  }
36259
36260  protected void composePayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
36261    if (element != null) {
36262      open(name);
36263      composePayeeComponentProperties(element);
36264      close();
36265    }
36266  }
36267
36268  protected void composePayeeComponentProperties(Claim.PayeeComponent element) throws IOException {
36269    composeBackboneElementProperties(element);
36270      if (element.hasType()) {
36271        composeCodeableConcept("type", element.getType());
36272      }
36273      if (element.hasParty()) {
36274        composeReference("party", element.getParty());
36275      }
36276  }
36277
36278  protected void composeCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
36279    if (element != null) {
36280      open(name);
36281      composeCareTeamComponentProperties(element);
36282      close();
36283    }
36284  }
36285
36286  protected void composeCareTeamComponentProperties(Claim.CareTeamComponent element) throws IOException {
36287    composeBackboneElementProperties(element);
36288      if (element.hasSequenceElement()) {
36289        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36290        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36291      }
36292      if (element.hasProvider()) {
36293        composeReference("provider", element.getProvider());
36294      }
36295      if (element.hasResponsibleElement()) {
36296        composeBooleanCore("responsible", element.getResponsibleElement(), false);
36297        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
36298      }
36299      if (element.hasRole()) {
36300        composeCodeableConcept("role", element.getRole());
36301      }
36302      if (element.hasQualification()) {
36303        composeCodeableConcept("qualification", element.getQualification());
36304      }
36305  }
36306
36307  protected void composeSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
36308    if (element != null) {
36309      open(name);
36310      composeSupportingInformationComponentProperties(element);
36311      close();
36312    }
36313  }
36314
36315  protected void composeSupportingInformationComponentProperties(Claim.SupportingInformationComponent element) throws IOException {
36316    composeBackboneElementProperties(element);
36317      if (element.hasSequenceElement()) {
36318        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36319        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36320      }
36321      if (element.hasCategory()) {
36322        composeCodeableConcept("category", element.getCategory());
36323      }
36324      if (element.hasCode()) {
36325        composeCodeableConcept("code", element.getCode());
36326      }
36327      if (element.hasTiming()) {
36328        composeType("timing", element.getTiming());
36329      }
36330      if (element.hasValue()) {
36331        composeType("value", element.getValue());
36332      }
36333      if (element.hasReason()) {
36334        composeCodeableConcept("reason", element.getReason());
36335      }
36336  }
36337
36338  protected void composeDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
36339    if (element != null) {
36340      open(name);
36341      composeDiagnosisComponentProperties(element);
36342      close();
36343    }
36344  }
36345
36346  protected void composeDiagnosisComponentProperties(Claim.DiagnosisComponent element) throws IOException {
36347    composeBackboneElementProperties(element);
36348      if (element.hasSequenceElement()) {
36349        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36350        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36351      }
36352      if (element.hasDiagnosis()) {
36353        composeType("diagnosis", element.getDiagnosis());
36354      }
36355      if (element.hasType()) {
36356        openArray("type");
36357        for (CodeableConcept e : element.getType()) 
36358          composeCodeableConcept(null, e);
36359        closeArray();
36360      };
36361      if (element.hasOnAdmission()) {
36362        composeCodeableConcept("onAdmission", element.getOnAdmission());
36363      }
36364      if (element.hasPackageCode()) {
36365        composeCodeableConcept("packageCode", element.getPackageCode());
36366      }
36367  }
36368
36369  protected void composeProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
36370    if (element != null) {
36371      open(name);
36372      composeProcedureComponentProperties(element);
36373      close();
36374    }
36375  }
36376
36377  protected void composeProcedureComponentProperties(Claim.ProcedureComponent element) throws IOException {
36378    composeBackboneElementProperties(element);
36379      if (element.hasSequenceElement()) {
36380        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36381        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36382      }
36383      if (element.hasType()) {
36384        openArray("type");
36385        for (CodeableConcept e : element.getType()) 
36386          composeCodeableConcept(null, e);
36387        closeArray();
36388      };
36389      if (element.hasDateElement()) {
36390        composeDateTimeCore("date", element.getDateElement(), false);
36391        composeDateTimeExtras("date", element.getDateElement(), false);
36392      }
36393      if (element.hasProcedure()) {
36394        composeType("procedure", element.getProcedure());
36395      }
36396      if (element.hasUdi()) {
36397        openArray("udi");
36398        for (Reference e : element.getUdi()) 
36399          composeReference(null, e);
36400        closeArray();
36401      };
36402  }
36403
36404  protected void composeInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
36405    if (element != null) {
36406      open(name);
36407      composeInsuranceComponentProperties(element);
36408      close();
36409    }
36410  }
36411
36412  protected void composeInsuranceComponentProperties(Claim.InsuranceComponent element) throws IOException {
36413    composeBackboneElementProperties(element);
36414      if (element.hasSequenceElement()) {
36415        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36416        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36417      }
36418      if (element.hasFocalElement()) {
36419        composeBooleanCore("focal", element.getFocalElement(), false);
36420        composeBooleanExtras("focal", element.getFocalElement(), false);
36421      }
36422      if (element.hasIdentifier()) {
36423        composeIdentifier("identifier", element.getIdentifier());
36424      }
36425      if (element.hasCoverage()) {
36426        composeReference("coverage", element.getCoverage());
36427      }
36428      if (element.hasBusinessArrangementElement()) {
36429        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
36430        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
36431      }
36432      if (element.hasPreAuthRef()) {
36433        if (anyHasValue(element.getPreAuthRef())) {
36434          openArray("preAuthRef");
36435          for (StringType e : element.getPreAuthRef()) 
36436            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
36437          closeArray();
36438        }
36439        if (anyHasExtras(element.getPreAuthRef())) {
36440          openArray("_preAuthRef");
36441          for (StringType e : element.getPreAuthRef()) 
36442            composeStringExtras(null, e, true);
36443          closeArray();
36444        }
36445      };
36446      if (element.hasClaimResponse()) {
36447        composeReference("claimResponse", element.getClaimResponse());
36448      }
36449  }
36450
36451  protected void composeAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
36452    if (element != null) {
36453      open(name);
36454      composeAccidentComponentProperties(element);
36455      close();
36456    }
36457  }
36458
36459  protected void composeAccidentComponentProperties(Claim.AccidentComponent element) throws IOException {
36460    composeBackboneElementProperties(element);
36461      if (element.hasDateElement()) {
36462        composeDateCore("date", element.getDateElement(), false);
36463        composeDateExtras("date", element.getDateElement(), false);
36464      }
36465      if (element.hasType()) {
36466        composeCodeableConcept("type", element.getType());
36467      }
36468      if (element.hasLocation()) {
36469        composeType("location", element.getLocation());
36470      }
36471  }
36472
36473  protected void composeItemComponent(String name, Claim.ItemComponent element) throws IOException {
36474    if (element != null) {
36475      open(name);
36476      composeItemComponentProperties(element);
36477      close();
36478    }
36479  }
36480
36481  protected void composeItemComponentProperties(Claim.ItemComponent element) throws IOException {
36482    composeBackboneElementProperties(element);
36483      if (element.hasSequenceElement()) {
36484        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36485        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36486      }
36487      if (element.hasCareTeamSequence()) {
36488        if (anyHasValue(element.getCareTeamSequence())) {
36489          openArray("careTeamSequence");
36490          for (PositiveIntType e : element.getCareTeamSequence()) 
36491            composePositiveIntCore(null, e, e != element.getCareTeamSequence().get(element.getCareTeamSequence().size()-1));
36492          closeArray();
36493        }
36494        if (anyHasExtras(element.getCareTeamSequence())) {
36495          openArray("_careTeamSequence");
36496          for (PositiveIntType e : element.getCareTeamSequence()) 
36497            composePositiveIntExtras(null, e, true);
36498          closeArray();
36499        }
36500      };
36501      if (element.hasDiagnosisSequence()) {
36502        if (anyHasValue(element.getDiagnosisSequence())) {
36503          openArray("diagnosisSequence");
36504          for (PositiveIntType e : element.getDiagnosisSequence()) 
36505            composePositiveIntCore(null, e, e != element.getDiagnosisSequence().get(element.getDiagnosisSequence().size()-1));
36506          closeArray();
36507        }
36508        if (anyHasExtras(element.getDiagnosisSequence())) {
36509          openArray("_diagnosisSequence");
36510          for (PositiveIntType e : element.getDiagnosisSequence()) 
36511            composePositiveIntExtras(null, e, true);
36512          closeArray();
36513        }
36514      };
36515      if (element.hasProcedureSequence()) {
36516        if (anyHasValue(element.getProcedureSequence())) {
36517          openArray("procedureSequence");
36518          for (PositiveIntType e : element.getProcedureSequence()) 
36519            composePositiveIntCore(null, e, e != element.getProcedureSequence().get(element.getProcedureSequence().size()-1));
36520          closeArray();
36521        }
36522        if (anyHasExtras(element.getProcedureSequence())) {
36523          openArray("_procedureSequence");
36524          for (PositiveIntType e : element.getProcedureSequence()) 
36525            composePositiveIntExtras(null, e, true);
36526          closeArray();
36527        }
36528      };
36529      if (element.hasInformationSequence()) {
36530        if (anyHasValue(element.getInformationSequence())) {
36531          openArray("informationSequence");
36532          for (PositiveIntType e : element.getInformationSequence()) 
36533            composePositiveIntCore(null, e, e != element.getInformationSequence().get(element.getInformationSequence().size()-1));
36534          closeArray();
36535        }
36536        if (anyHasExtras(element.getInformationSequence())) {
36537          openArray("_informationSequence");
36538          for (PositiveIntType e : element.getInformationSequence()) 
36539            composePositiveIntExtras(null, e, true);
36540          closeArray();
36541        }
36542      };
36543      if (element.hasRevenue()) {
36544        composeCodeableConcept("revenue", element.getRevenue());
36545      }
36546      if (element.hasCategory()) {
36547        composeCodeableConcept("category", element.getCategory());
36548      }
36549      if (element.hasProductOrService()) {
36550        composeCodeableConcept("productOrService", element.getProductOrService());
36551      }
36552      if (element.hasModifier()) {
36553        openArray("modifier");
36554        for (CodeableConcept e : element.getModifier()) 
36555          composeCodeableConcept(null, e);
36556        closeArray();
36557      };
36558      if (element.hasProgramCode()) {
36559        openArray("programCode");
36560        for (CodeableConcept e : element.getProgramCode()) 
36561          composeCodeableConcept(null, e);
36562        closeArray();
36563      };
36564      if (element.hasServiced()) {
36565        composeType("serviced", element.getServiced());
36566      }
36567      if (element.hasLocation()) {
36568        composeType("location", element.getLocation());
36569      }
36570      if (element.hasQuantity()) {
36571        composeQuantity("quantity", element.getQuantity());
36572      }
36573      if (element.hasUnitPrice()) {
36574        composeMoney("unitPrice", element.getUnitPrice());
36575      }
36576      if (element.hasFactorElement()) {
36577        composeDecimalCore("factor", element.getFactorElement(), false);
36578        composeDecimalExtras("factor", element.getFactorElement(), false);
36579      }
36580      if (element.hasNet()) {
36581        composeMoney("net", element.getNet());
36582      }
36583      if (element.hasUdi()) {
36584        openArray("udi");
36585        for (Reference e : element.getUdi()) 
36586          composeReference(null, e);
36587        closeArray();
36588      };
36589      if (element.hasBodySite()) {
36590        composeCodeableConcept("bodySite", element.getBodySite());
36591      }
36592      if (element.hasSubSite()) {
36593        openArray("subSite");
36594        for (CodeableConcept e : element.getSubSite()) 
36595          composeCodeableConcept(null, e);
36596        closeArray();
36597      };
36598      if (element.hasEncounter()) {
36599        openArray("encounter");
36600        for (Reference e : element.getEncounter()) 
36601          composeReference(null, e);
36602        closeArray();
36603      };
36604      if (element.hasDetail()) {
36605        openArray("detail");
36606        for (Claim.DetailComponent e : element.getDetail()) 
36607          composeDetailComponent(null, e);
36608        closeArray();
36609      };
36610  }
36611
36612  protected void composeDetailComponent(String name, Claim.DetailComponent element) throws IOException {
36613    if (element != null) {
36614      open(name);
36615      composeDetailComponentProperties(element);
36616      close();
36617    }
36618  }
36619
36620  protected void composeDetailComponentProperties(Claim.DetailComponent element) throws IOException {
36621    composeBackboneElementProperties(element);
36622      if (element.hasSequenceElement()) {
36623        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36624        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36625      }
36626      if (element.hasRevenue()) {
36627        composeCodeableConcept("revenue", element.getRevenue());
36628      }
36629      if (element.hasCategory()) {
36630        composeCodeableConcept("category", element.getCategory());
36631      }
36632      if (element.hasProductOrService()) {
36633        composeCodeableConcept("productOrService", element.getProductOrService());
36634      }
36635      if (element.hasModifier()) {
36636        openArray("modifier");
36637        for (CodeableConcept e : element.getModifier()) 
36638          composeCodeableConcept(null, e);
36639        closeArray();
36640      };
36641      if (element.hasProgramCode()) {
36642        openArray("programCode");
36643        for (CodeableConcept e : element.getProgramCode()) 
36644          composeCodeableConcept(null, e);
36645        closeArray();
36646      };
36647      if (element.hasQuantity()) {
36648        composeQuantity("quantity", element.getQuantity());
36649      }
36650      if (element.hasUnitPrice()) {
36651        composeMoney("unitPrice", element.getUnitPrice());
36652      }
36653      if (element.hasFactorElement()) {
36654        composeDecimalCore("factor", element.getFactorElement(), false);
36655        composeDecimalExtras("factor", element.getFactorElement(), false);
36656      }
36657      if (element.hasNet()) {
36658        composeMoney("net", element.getNet());
36659      }
36660      if (element.hasUdi()) {
36661        openArray("udi");
36662        for (Reference e : element.getUdi()) 
36663          composeReference(null, e);
36664        closeArray();
36665      };
36666      if (element.hasSubDetail()) {
36667        openArray("subDetail");
36668        for (Claim.SubDetailComponent e : element.getSubDetail()) 
36669          composeSubDetailComponent(null, e);
36670        closeArray();
36671      };
36672  }
36673
36674  protected void composeSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
36675    if (element != null) {
36676      open(name);
36677      composeSubDetailComponentProperties(element);
36678      close();
36679    }
36680  }
36681
36682  protected void composeSubDetailComponentProperties(Claim.SubDetailComponent element) throws IOException {
36683    composeBackboneElementProperties(element);
36684      if (element.hasSequenceElement()) {
36685        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36686        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36687      }
36688      if (element.hasRevenue()) {
36689        composeCodeableConcept("revenue", element.getRevenue());
36690      }
36691      if (element.hasCategory()) {
36692        composeCodeableConcept("category", element.getCategory());
36693      }
36694      if (element.hasProductOrService()) {
36695        composeCodeableConcept("productOrService", element.getProductOrService());
36696      }
36697      if (element.hasModifier()) {
36698        openArray("modifier");
36699        for (CodeableConcept e : element.getModifier()) 
36700          composeCodeableConcept(null, e);
36701        closeArray();
36702      };
36703      if (element.hasProgramCode()) {
36704        openArray("programCode");
36705        for (CodeableConcept e : element.getProgramCode()) 
36706          composeCodeableConcept(null, e);
36707        closeArray();
36708      };
36709      if (element.hasQuantity()) {
36710        composeQuantity("quantity", element.getQuantity());
36711      }
36712      if (element.hasUnitPrice()) {
36713        composeMoney("unitPrice", element.getUnitPrice());
36714      }
36715      if (element.hasFactorElement()) {
36716        composeDecimalCore("factor", element.getFactorElement(), false);
36717        composeDecimalExtras("factor", element.getFactorElement(), false);
36718      }
36719      if (element.hasNet()) {
36720        composeMoney("net", element.getNet());
36721      }
36722      if (element.hasUdi()) {
36723        openArray("udi");
36724        for (Reference e : element.getUdi()) 
36725          composeReference(null, e);
36726        closeArray();
36727      };
36728  }
36729
36730  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
36731    if (element != null) {
36732      prop("resourceType", name);
36733      composeClaimResponseProperties(element);
36734    }
36735  }
36736
36737  protected void composeClaimResponseProperties(ClaimResponse element) throws IOException {
36738    composeDomainResourceProperties(element);
36739      if (element.hasIdentifier()) {
36740        openArray("identifier");
36741        for (Identifier e : element.getIdentifier()) 
36742          composeIdentifier(null, e);
36743        closeArray();
36744      };
36745      if (element.hasStatusElement()) {
36746        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36747        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36748      }
36749      if (element.hasType()) {
36750        composeCodeableConcept("type", element.getType());
36751      }
36752      if (element.hasSubType()) {
36753        composeCodeableConcept("subType", element.getSubType());
36754      }
36755      if (element.hasUseElement()) {
36756        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36757        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36758      }
36759      if (element.hasPatient()) {
36760        composeReference("patient", element.getPatient());
36761      }
36762      if (element.hasCreatedElement()) {
36763        composeDateTimeCore("created", element.getCreatedElement(), false);
36764        composeDateTimeExtras("created", element.getCreatedElement(), false);
36765      }
36766      if (element.hasInsurer()) {
36767        composeReference("insurer", element.getInsurer());
36768      }
36769      if (element.hasRequestor()) {
36770        composeReference("requestor", element.getRequestor());
36771      }
36772      if (element.hasRequest()) {
36773        composeReference("request", element.getRequest());
36774      }
36775      if (element.hasOutcomeElement()) {
36776        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
36777        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
36778      }
36779      if (element.hasDispositionElement()) {
36780        composeStringCore("disposition", element.getDispositionElement(), false);
36781        composeStringExtras("disposition", element.getDispositionElement(), false);
36782      }
36783      if (element.hasPreAuthRefElement()) {
36784        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
36785        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
36786      }
36787      if (element.hasPreAuthPeriod()) {
36788        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
36789      }
36790      if (element.hasPayeeType()) {
36791        composeCodeableConcept("payeeType", element.getPayeeType());
36792      }
36793      if (element.hasItem()) {
36794        openArray("item");
36795        for (ClaimResponse.ItemComponent e : element.getItem()) 
36796          composeItemComponent(null, e);
36797        closeArray();
36798      };
36799      if (element.hasAddItem()) {
36800        openArray("addItem");
36801        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
36802          composeAddedItemComponent(null, e);
36803        closeArray();
36804      };
36805      if (element.hasAdjudication()) {
36806        openArray("adjudication");
36807        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36808          composeAdjudicationComponent(null, e);
36809        closeArray();
36810      };
36811      if (element.hasTotal()) {
36812        openArray("total");
36813        for (ClaimResponse.TotalComponent e : element.getTotal()) 
36814          composeTotalComponent(null, e);
36815        closeArray();
36816      };
36817      if (element.hasPayment()) {
36818        composePaymentComponent("payment", element.getPayment());
36819      }
36820      if (element.hasFundsReserve()) {
36821        composeCodeableConcept("fundsReserve", element.getFundsReserve());
36822      }
36823      if (element.hasFormCode()) {
36824        composeCodeableConcept("formCode", element.getFormCode());
36825      }
36826      if (element.hasForm()) {
36827        composeAttachment("form", element.getForm());
36828      }
36829      if (element.hasProcessNote()) {
36830        openArray("processNote");
36831        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
36832          composeNoteComponent(null, e);
36833        closeArray();
36834      };
36835      if (element.hasCommunicationRequest()) {
36836        openArray("communicationRequest");
36837        for (Reference e : element.getCommunicationRequest()) 
36838          composeReference(null, e);
36839        closeArray();
36840      };
36841      if (element.hasInsurance()) {
36842        openArray("insurance");
36843        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
36844          composeInsuranceComponent(null, e);
36845        closeArray();
36846      };
36847      if (element.hasError()) {
36848        openArray("error");
36849        for (ClaimResponse.ErrorComponent e : element.getError()) 
36850          composeErrorComponent(null, e);
36851        closeArray();
36852      };
36853  }
36854
36855  protected void composeItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
36856    if (element != null) {
36857      open(name);
36858      composeItemComponentProperties(element);
36859      close();
36860    }
36861  }
36862
36863  protected void composeItemComponentProperties(ClaimResponse.ItemComponent element) throws IOException {
36864    composeBackboneElementProperties(element);
36865      if (element.hasItemSequenceElement()) {
36866        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
36867        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
36868      }
36869      if (element.hasNoteNumber()) {
36870        if (anyHasValue(element.getNoteNumber())) {
36871          openArray("noteNumber");
36872          for (PositiveIntType e : element.getNoteNumber()) 
36873            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
36874          closeArray();
36875        }
36876        if (anyHasExtras(element.getNoteNumber())) {
36877          openArray("_noteNumber");
36878          for (PositiveIntType e : element.getNoteNumber()) 
36879            composePositiveIntExtras(null, e, true);
36880          closeArray();
36881        }
36882      };
36883      if (element.hasAdjudication()) {
36884        openArray("adjudication");
36885        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36886          composeAdjudicationComponent(null, e);
36887        closeArray();
36888      };
36889      if (element.hasDetail()) {
36890        openArray("detail");
36891        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
36892          composeItemDetailComponent(null, e);
36893        closeArray();
36894      };
36895  }
36896
36897  protected void composeAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
36898    if (element != null) {
36899      open(name);
36900      composeAdjudicationComponentProperties(element);
36901      close();
36902    }
36903  }
36904
36905  protected void composeAdjudicationComponentProperties(ClaimResponse.AdjudicationComponent element) throws IOException {
36906    composeBackboneElementProperties(element);
36907      if (element.hasCategory()) {
36908        composeCodeableConcept("category", element.getCategory());
36909      }
36910      if (element.hasReason()) {
36911        composeCodeableConcept("reason", element.getReason());
36912      }
36913      if (element.hasAmount()) {
36914        composeMoney("amount", element.getAmount());
36915      }
36916      if (element.hasValueElement()) {
36917        composeDecimalCore("value", element.getValueElement(), false);
36918        composeDecimalExtras("value", element.getValueElement(), false);
36919      }
36920  }
36921
36922  protected void composeItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
36923    if (element != null) {
36924      open(name);
36925      composeItemDetailComponentProperties(element);
36926      close();
36927    }
36928  }
36929
36930  protected void composeItemDetailComponentProperties(ClaimResponse.ItemDetailComponent element) throws IOException {
36931    composeBackboneElementProperties(element);
36932      if (element.hasDetailSequenceElement()) {
36933        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
36934        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
36935      }
36936      if (element.hasNoteNumber()) {
36937        if (anyHasValue(element.getNoteNumber())) {
36938          openArray("noteNumber");
36939          for (PositiveIntType e : element.getNoteNumber()) 
36940            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
36941          closeArray();
36942        }
36943        if (anyHasExtras(element.getNoteNumber())) {
36944          openArray("_noteNumber");
36945          for (PositiveIntType e : element.getNoteNumber()) 
36946            composePositiveIntExtras(null, e, true);
36947          closeArray();
36948        }
36949      };
36950      if (element.hasAdjudication()) {
36951        openArray("adjudication");
36952        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36953          composeAdjudicationComponent(null, e);
36954        closeArray();
36955      };
36956      if (element.hasSubDetail()) {
36957        openArray("subDetail");
36958        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
36959          composeSubDetailComponent(null, e);
36960        closeArray();
36961      };
36962  }
36963
36964  protected void composeSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
36965    if (element != null) {
36966      open(name);
36967      composeSubDetailComponentProperties(element);
36968      close();
36969    }
36970  }
36971
36972  protected void composeSubDetailComponentProperties(ClaimResponse.SubDetailComponent element) throws IOException {
36973    composeBackboneElementProperties(element);
36974      if (element.hasSubDetailSequenceElement()) {
36975        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
36976        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
36977      }
36978      if (element.hasNoteNumber()) {
36979        if (anyHasValue(element.getNoteNumber())) {
36980          openArray("noteNumber");
36981          for (PositiveIntType e : element.getNoteNumber()) 
36982            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
36983          closeArray();
36984        }
36985        if (anyHasExtras(element.getNoteNumber())) {
36986          openArray("_noteNumber");
36987          for (PositiveIntType e : element.getNoteNumber()) 
36988            composePositiveIntExtras(null, e, true);
36989          closeArray();
36990        }
36991      };
36992      if (element.hasAdjudication()) {
36993        openArray("adjudication");
36994        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36995          composeAdjudicationComponent(null, e);
36996        closeArray();
36997      };
36998  }
36999
37000  protected void composeAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
37001    if (element != null) {
37002      open(name);
37003      composeAddedItemComponentProperties(element);
37004      close();
37005    }
37006  }
37007
37008  protected void composeAddedItemComponentProperties(ClaimResponse.AddedItemComponent element) throws IOException {
37009    composeBackboneElementProperties(element);
37010      if (element.hasItemSequence()) {
37011        if (anyHasValue(element.getItemSequence())) {
37012          openArray("itemSequence");
37013          for (PositiveIntType e : element.getItemSequence()) 
37014            composePositiveIntCore(null, e, e != element.getItemSequence().get(element.getItemSequence().size()-1));
37015          closeArray();
37016        }
37017        if (anyHasExtras(element.getItemSequence())) {
37018          openArray("_itemSequence");
37019          for (PositiveIntType e : element.getItemSequence()) 
37020            composePositiveIntExtras(null, e, true);
37021          closeArray();
37022        }
37023      };
37024      if (element.hasDetailSequence()) {
37025        if (anyHasValue(element.getDetailSequence())) {
37026          openArray("detailSequence");
37027          for (PositiveIntType e : element.getDetailSequence()) 
37028            composePositiveIntCore(null, e, e != element.getDetailSequence().get(element.getDetailSequence().size()-1));
37029          closeArray();
37030        }
37031        if (anyHasExtras(element.getDetailSequence())) {
37032          openArray("_detailSequence");
37033          for (PositiveIntType e : element.getDetailSequence()) 
37034            composePositiveIntExtras(null, e, true);
37035          closeArray();
37036        }
37037      };
37038      if (element.hasSubdetailSequence()) {
37039        if (anyHasValue(element.getSubdetailSequence())) {
37040          openArray("subdetailSequence");
37041          for (PositiveIntType e : element.getSubdetailSequence()) 
37042            composePositiveIntCore(null, e, e != element.getSubdetailSequence().get(element.getSubdetailSequence().size()-1));
37043          closeArray();
37044        }
37045        if (anyHasExtras(element.getSubdetailSequence())) {
37046          openArray("_subdetailSequence");
37047          for (PositiveIntType e : element.getSubdetailSequence()) 
37048            composePositiveIntExtras(null, e, true);
37049          closeArray();
37050        }
37051      };
37052      if (element.hasProvider()) {
37053        openArray("provider");
37054        for (Reference e : element.getProvider()) 
37055          composeReference(null, e);
37056        closeArray();
37057      };
37058      if (element.hasProductOrService()) {
37059        composeCodeableConcept("productOrService", element.getProductOrService());
37060      }
37061      if (element.hasModifier()) {
37062        openArray("modifier");
37063        for (CodeableConcept e : element.getModifier()) 
37064          composeCodeableConcept(null, e);
37065        closeArray();
37066      };
37067      if (element.hasProgramCode()) {
37068        openArray("programCode");
37069        for (CodeableConcept e : element.getProgramCode()) 
37070          composeCodeableConcept(null, e);
37071        closeArray();
37072      };
37073      if (element.hasServiced()) {
37074        composeType("serviced", element.getServiced());
37075      }
37076      if (element.hasLocation()) {
37077        composeType("location", element.getLocation());
37078      }
37079      if (element.hasQuantity()) {
37080        composeQuantity("quantity", element.getQuantity());
37081      }
37082      if (element.hasUnitPrice()) {
37083        composeMoney("unitPrice", element.getUnitPrice());
37084      }
37085      if (element.hasFactorElement()) {
37086        composeDecimalCore("factor", element.getFactorElement(), false);
37087        composeDecimalExtras("factor", element.getFactorElement(), false);
37088      }
37089      if (element.hasNet()) {
37090        composeMoney("net", element.getNet());
37091      }
37092      if (element.hasBodySite()) {
37093        composeCodeableConcept("bodySite", element.getBodySite());
37094      }
37095      if (element.hasSubSite()) {
37096        openArray("subSite");
37097        for (CodeableConcept e : element.getSubSite()) 
37098          composeCodeableConcept(null, e);
37099        closeArray();
37100      };
37101      if (element.hasNoteNumber()) {
37102        if (anyHasValue(element.getNoteNumber())) {
37103          openArray("noteNumber");
37104          for (PositiveIntType e : element.getNoteNumber()) 
37105            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
37106          closeArray();
37107        }
37108        if (anyHasExtras(element.getNoteNumber())) {
37109          openArray("_noteNumber");
37110          for (PositiveIntType e : element.getNoteNumber()) 
37111            composePositiveIntExtras(null, e, true);
37112          closeArray();
37113        }
37114      };
37115      if (element.hasAdjudication()) {
37116        openArray("adjudication");
37117        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37118          composeAdjudicationComponent(null, e);
37119        closeArray();
37120      };
37121      if (element.hasDetail()) {
37122        openArray("detail");
37123        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
37124          composeAddedItemDetailComponent(null, e);
37125        closeArray();
37126      };
37127  }
37128
37129  protected void composeAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
37130    if (element != null) {
37131      open(name);
37132      composeAddedItemDetailComponentProperties(element);
37133      close();
37134    }
37135  }
37136
37137  protected void composeAddedItemDetailComponentProperties(ClaimResponse.AddedItemDetailComponent element) throws IOException {
37138    composeBackboneElementProperties(element);
37139      if (element.hasProductOrService()) {
37140        composeCodeableConcept("productOrService", element.getProductOrService());
37141      }
37142      if (element.hasModifier()) {
37143        openArray("modifier");
37144        for (CodeableConcept e : element.getModifier()) 
37145          composeCodeableConcept(null, e);
37146        closeArray();
37147      };
37148      if (element.hasQuantity()) {
37149        composeQuantity("quantity", element.getQuantity());
37150      }
37151      if (element.hasUnitPrice()) {
37152        composeMoney("unitPrice", element.getUnitPrice());
37153      }
37154      if (element.hasFactorElement()) {
37155        composeDecimalCore("factor", element.getFactorElement(), false);
37156        composeDecimalExtras("factor", element.getFactorElement(), false);
37157      }
37158      if (element.hasNet()) {
37159        composeMoney("net", element.getNet());
37160      }
37161      if (element.hasNoteNumber()) {
37162        if (anyHasValue(element.getNoteNumber())) {
37163          openArray("noteNumber");
37164          for (PositiveIntType e : element.getNoteNumber()) 
37165            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
37166          closeArray();
37167        }
37168        if (anyHasExtras(element.getNoteNumber())) {
37169          openArray("_noteNumber");
37170          for (PositiveIntType e : element.getNoteNumber()) 
37171            composePositiveIntExtras(null, e, true);
37172          closeArray();
37173        }
37174      };
37175      if (element.hasAdjudication()) {
37176        openArray("adjudication");
37177        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37178          composeAdjudicationComponent(null, e);
37179        closeArray();
37180      };
37181      if (element.hasSubDetail()) {
37182        openArray("subDetail");
37183        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
37184          composeAddedItemSubDetailComponent(null, e);
37185        closeArray();
37186      };
37187  }
37188
37189  protected void composeAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
37190    if (element != null) {
37191      open(name);
37192      composeAddedItemSubDetailComponentProperties(element);
37193      close();
37194    }
37195  }
37196
37197  protected void composeAddedItemSubDetailComponentProperties(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
37198    composeBackboneElementProperties(element);
37199      if (element.hasProductOrService()) {
37200        composeCodeableConcept("productOrService", element.getProductOrService());
37201      }
37202      if (element.hasModifier()) {
37203        openArray("modifier");
37204        for (CodeableConcept e : element.getModifier()) 
37205          composeCodeableConcept(null, e);
37206        closeArray();
37207      };
37208      if (element.hasQuantity()) {
37209        composeQuantity("quantity", element.getQuantity());
37210      }
37211      if (element.hasUnitPrice()) {
37212        composeMoney("unitPrice", element.getUnitPrice());
37213      }
37214      if (element.hasFactorElement()) {
37215        composeDecimalCore("factor", element.getFactorElement(), false);
37216        composeDecimalExtras("factor", element.getFactorElement(), false);
37217      }
37218      if (element.hasNet()) {
37219        composeMoney("net", element.getNet());
37220      }
37221      if (element.hasNoteNumber()) {
37222        if (anyHasValue(element.getNoteNumber())) {
37223          openArray("noteNumber");
37224          for (PositiveIntType e : element.getNoteNumber()) 
37225            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
37226          closeArray();
37227        }
37228        if (anyHasExtras(element.getNoteNumber())) {
37229          openArray("_noteNumber");
37230          for (PositiveIntType e : element.getNoteNumber()) 
37231            composePositiveIntExtras(null, e, true);
37232          closeArray();
37233        }
37234      };
37235      if (element.hasAdjudication()) {
37236        openArray("adjudication");
37237        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37238          composeAdjudicationComponent(null, e);
37239        closeArray();
37240      };
37241  }
37242
37243  protected void composeTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
37244    if (element != null) {
37245      open(name);
37246      composeTotalComponentProperties(element);
37247      close();
37248    }
37249  }
37250
37251  protected void composeTotalComponentProperties(ClaimResponse.TotalComponent element) throws IOException {
37252    composeBackboneElementProperties(element);
37253      if (element.hasCategory()) {
37254        composeCodeableConcept("category", element.getCategory());
37255      }
37256      if (element.hasAmount()) {
37257        composeMoney("amount", element.getAmount());
37258      }
37259  }
37260
37261  protected void composePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
37262    if (element != null) {
37263      open(name);
37264      composePaymentComponentProperties(element);
37265      close();
37266    }
37267  }
37268
37269  protected void composePaymentComponentProperties(ClaimResponse.PaymentComponent element) throws IOException {
37270    composeBackboneElementProperties(element);
37271      if (element.hasType()) {
37272        composeCodeableConcept("type", element.getType());
37273      }
37274      if (element.hasAdjustment()) {
37275        composeMoney("adjustment", element.getAdjustment());
37276      }
37277      if (element.hasAdjustmentReason()) {
37278        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
37279      }
37280      if (element.hasDateElement()) {
37281        composeDateCore("date", element.getDateElement(), false);
37282        composeDateExtras("date", element.getDateElement(), false);
37283      }
37284      if (element.hasAmount()) {
37285        composeMoney("amount", element.getAmount());
37286      }
37287      if (element.hasIdentifier()) {
37288        composeIdentifier("identifier", element.getIdentifier());
37289      }
37290  }
37291
37292  protected void composeNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
37293    if (element != null) {
37294      open(name);
37295      composeNoteComponentProperties(element);
37296      close();
37297    }
37298  }
37299
37300  protected void composeNoteComponentProperties(ClaimResponse.NoteComponent element) throws IOException {
37301    composeBackboneElementProperties(element);
37302      if (element.hasNumberElement()) {
37303        composePositiveIntCore("number", element.getNumberElement(), false);
37304        composePositiveIntExtras("number", element.getNumberElement(), false);
37305      }
37306      if (element.hasTypeElement()) {
37307        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
37308        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
37309      }
37310      if (element.hasTextElement()) {
37311        composeStringCore("text", element.getTextElement(), false);
37312        composeStringExtras("text", element.getTextElement(), false);
37313      }
37314      if (element.hasLanguage()) {
37315        composeCodeableConcept("language", element.getLanguage());
37316      }
37317  }
37318
37319  protected void composeInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
37320    if (element != null) {
37321      open(name);
37322      composeInsuranceComponentProperties(element);
37323      close();
37324    }
37325  }
37326
37327  protected void composeInsuranceComponentProperties(ClaimResponse.InsuranceComponent element) throws IOException {
37328    composeBackboneElementProperties(element);
37329      if (element.hasSequenceElement()) {
37330        composePositiveIntCore("sequence", element.getSequenceElement(), false);
37331        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
37332      }
37333      if (element.hasFocalElement()) {
37334        composeBooleanCore("focal", element.getFocalElement(), false);
37335        composeBooleanExtras("focal", element.getFocalElement(), false);
37336      }
37337      if (element.hasCoverage()) {
37338        composeReference("coverage", element.getCoverage());
37339      }
37340      if (element.hasBusinessArrangementElement()) {
37341        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
37342        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
37343      }
37344      if (element.hasClaimResponse()) {
37345        composeReference("claimResponse", element.getClaimResponse());
37346      }
37347  }
37348
37349  protected void composeErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
37350    if (element != null) {
37351      open(name);
37352      composeErrorComponentProperties(element);
37353      close();
37354    }
37355  }
37356
37357  protected void composeErrorComponentProperties(ClaimResponse.ErrorComponent element) throws IOException {
37358    composeBackboneElementProperties(element);
37359      if (element.hasItemSequenceElement()) {
37360        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
37361        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
37362      }
37363      if (element.hasDetailSequenceElement()) {
37364        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
37365        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
37366      }
37367      if (element.hasSubDetailSequenceElement()) {
37368        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
37369        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
37370      }
37371      if (element.hasCode()) {
37372        composeCodeableConcept("code", element.getCode());
37373      }
37374  }
37375
37376  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
37377    if (element != null) {
37378      prop("resourceType", name);
37379      composeClinicalImpressionProperties(element);
37380    }
37381  }
37382
37383  protected void composeClinicalImpressionProperties(ClinicalImpression element) throws IOException {
37384    composeDomainResourceProperties(element);
37385      if (element.hasIdentifier()) {
37386        openArray("identifier");
37387        for (Identifier e : element.getIdentifier()) 
37388          composeIdentifier(null, e);
37389        closeArray();
37390      };
37391      if (element.hasStatusElement()) {
37392        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
37393        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
37394      }
37395      if (element.hasStatusReason()) {
37396        composeCodeableConcept("statusReason", element.getStatusReason());
37397      }
37398      if (element.hasCode()) {
37399        composeCodeableConcept("code", element.getCode());
37400      }
37401      if (element.hasDescriptionElement()) {
37402        composeStringCore("description", element.getDescriptionElement(), false);
37403        composeStringExtras("description", element.getDescriptionElement(), false);
37404      }
37405      if (element.hasSubject()) {
37406        composeReference("subject", element.getSubject());
37407      }
37408      if (element.hasEncounter()) {
37409        composeReference("encounter", element.getEncounter());
37410      }
37411      if (element.hasEffective()) {
37412        composeType("effective", element.getEffective());
37413      }
37414      if (element.hasDateElement()) {
37415        composeDateTimeCore("date", element.getDateElement(), false);
37416        composeDateTimeExtras("date", element.getDateElement(), false);
37417      }
37418      if (element.hasAssessor()) {
37419        composeReference("assessor", element.getAssessor());
37420      }
37421      if (element.hasPrevious()) {
37422        composeReference("previous", element.getPrevious());
37423      }
37424      if (element.hasProblem()) {
37425        openArray("problem");
37426        for (Reference e : element.getProblem()) 
37427          composeReference(null, e);
37428        closeArray();
37429      };
37430      if (element.hasInvestigation()) {
37431        openArray("investigation");
37432        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
37433          composeClinicalImpressionInvestigationComponent(null, e);
37434        closeArray();
37435      };
37436      if (element.hasProtocol()) {
37437        if (anyHasValue(element.getProtocol())) {
37438          openArray("protocol");
37439          for (UriType e : element.getProtocol()) 
37440            composeUriCore(null, e, e != element.getProtocol().get(element.getProtocol().size()-1));
37441          closeArray();
37442        }
37443        if (anyHasExtras(element.getProtocol())) {
37444          openArray("_protocol");
37445          for (UriType e : element.getProtocol()) 
37446            composeUriExtras(null, e, true);
37447          closeArray();
37448        }
37449      };
37450      if (element.hasSummaryElement()) {
37451        composeStringCore("summary", element.getSummaryElement(), false);
37452        composeStringExtras("summary", element.getSummaryElement(), false);
37453      }
37454      if (element.hasFinding()) {
37455        openArray("finding");
37456        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
37457          composeClinicalImpressionFindingComponent(null, e);
37458        closeArray();
37459      };
37460      if (element.hasPrognosisCodeableConcept()) {
37461        openArray("prognosisCodeableConcept");
37462        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
37463          composeCodeableConcept(null, e);
37464        closeArray();
37465      };
37466      if (element.hasPrognosisReference()) {
37467        openArray("prognosisReference");
37468        for (Reference e : element.getPrognosisReference()) 
37469          composeReference(null, e);
37470        closeArray();
37471      };
37472      if (element.hasSupportingInfo()) {
37473        openArray("supportingInfo");
37474        for (Reference e : element.getSupportingInfo()) 
37475          composeReference(null, e);
37476        closeArray();
37477      };
37478      if (element.hasNote()) {
37479        openArray("note");
37480        for (Annotation e : element.getNote()) 
37481          composeAnnotation(null, e);
37482        closeArray();
37483      };
37484  }
37485
37486  protected void composeClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
37487    if (element != null) {
37488      open(name);
37489      composeClinicalImpressionInvestigationComponentProperties(element);
37490      close();
37491    }
37492  }
37493
37494  protected void composeClinicalImpressionInvestigationComponentProperties(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
37495    composeBackboneElementProperties(element);
37496      if (element.hasCode()) {
37497        composeCodeableConcept("code", element.getCode());
37498      }
37499      if (element.hasItem()) {
37500        openArray("item");
37501        for (Reference e : element.getItem()) 
37502          composeReference(null, e);
37503        closeArray();
37504      };
37505  }
37506
37507  protected void composeClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
37508    if (element != null) {
37509      open(name);
37510      composeClinicalImpressionFindingComponentProperties(element);
37511      close();
37512    }
37513  }
37514
37515  protected void composeClinicalImpressionFindingComponentProperties(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
37516    composeBackboneElementProperties(element);
37517      if (element.hasItemCodeableConcept()) {
37518        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
37519      }
37520      if (element.hasItemReference()) {
37521        composeReference("itemReference", element.getItemReference());
37522      }
37523      if (element.hasBasisElement()) {
37524        composeStringCore("basis", element.getBasisElement(), false);
37525        composeStringExtras("basis", element.getBasisElement(), false);
37526      }
37527  }
37528
37529  protected void composeClinicalUseDefinition(String name, ClinicalUseDefinition element) throws IOException {
37530    if (element != null) {
37531      prop("resourceType", name);
37532      composeClinicalUseDefinitionProperties(element);
37533    }
37534  }
37535
37536  protected void composeClinicalUseDefinitionProperties(ClinicalUseDefinition element) throws IOException {
37537    composeDomainResourceProperties(element);
37538      if (element.hasIdentifier()) {
37539        openArray("identifier");
37540        for (Identifier e : element.getIdentifier()) 
37541          composeIdentifier(null, e);
37542        closeArray();
37543      };
37544      if (element.hasTypeElement()) {
37545        composeEnumerationCore("type", element.getTypeElement(), new ClinicalUseDefinition.ClinicalUseIssueTypeEnumFactory(), false);
37546        composeEnumerationExtras("type", element.getTypeElement(), new ClinicalUseDefinition.ClinicalUseIssueTypeEnumFactory(), false);
37547      }
37548      if (element.hasCategory()) {
37549        openArray("category");
37550        for (CodeableConcept e : element.getCategory()) 
37551          composeCodeableConcept(null, e);
37552        closeArray();
37553      };
37554      if (element.hasSubject()) {
37555        openArray("subject");
37556        for (Reference e : element.getSubject()) 
37557          composeReference(null, e);
37558        closeArray();
37559      };
37560      if (element.hasStatus()) {
37561        composeCodeableConcept("status", element.getStatus());
37562      }
37563      if (element.hasContraindication()) {
37564        composeClinicalUseDefinitionContraindicationComponent("contraindication", element.getContraindication());
37565      }
37566      if (element.hasIndication()) {
37567        composeClinicalUseDefinitionIndicationComponent("indication", element.getIndication());
37568      }
37569      if (element.hasInteraction()) {
37570        composeClinicalUseDefinitionInteractionComponent("interaction", element.getInteraction());
37571      }
37572      if (element.hasPopulation()) {
37573        openArray("population");
37574        for (Reference e : element.getPopulation()) 
37575          composeReference(null, e);
37576        closeArray();
37577      };
37578      if (element.hasUndesirableEffect()) {
37579        composeClinicalUseDefinitionUndesirableEffectComponent("undesirableEffect", element.getUndesirableEffect());
37580      }
37581      if (element.hasWarning()) {
37582        composeClinicalUseDefinitionWarningComponent("warning", element.getWarning());
37583      }
37584  }
37585
37586  protected void composeClinicalUseDefinitionContraindicationComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent element) throws IOException {
37587    if (element != null) {
37588      open(name);
37589      composeClinicalUseDefinitionContraindicationComponentProperties(element);
37590      close();
37591    }
37592  }
37593
37594  protected void composeClinicalUseDefinitionContraindicationComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent element) throws IOException {
37595    composeBackboneElementProperties(element);
37596      if (element.hasDiseaseSymptomProcedure()) {
37597        composeCodeableReference("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
37598      }
37599      if (element.hasDiseaseStatus()) {
37600        composeCodeableReference("diseaseStatus", element.getDiseaseStatus());
37601      }
37602      if (element.hasComorbidity()) {
37603        openArray("comorbidity");
37604        for (CodeableReference e : element.getComorbidity()) 
37605          composeCodeableReference(null, e);
37606        closeArray();
37607      };
37608      if (element.hasIndication()) {
37609        openArray("indication");
37610        for (Reference e : element.getIndication()) 
37611          composeReference(null, e);
37612        closeArray();
37613      };
37614      if (element.hasOtherTherapy()) {
37615        openArray("otherTherapy");
37616        for (ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
37617          composeClinicalUseDefinitionContraindicationOtherTherapyComponent(null, e);
37618        closeArray();
37619      };
37620  }
37621
37622  protected void composeClinicalUseDefinitionContraindicationOtherTherapyComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent element) throws IOException {
37623    if (element != null) {
37624      open(name);
37625      composeClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(element);
37626      close();
37627    }
37628  }
37629
37630  protected void composeClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent element) throws IOException {
37631    composeBackboneElementProperties(element);
37632      if (element.hasRelationshipType()) {
37633        composeCodeableConcept("relationshipType", element.getRelationshipType());
37634      }
37635      if (element.hasTherapy()) {
37636        composeCodeableReference("therapy", element.getTherapy());
37637      }
37638  }
37639
37640  protected void composeClinicalUseDefinitionIndicationComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent element) throws IOException {
37641    if (element != null) {
37642      open(name);
37643      composeClinicalUseDefinitionIndicationComponentProperties(element);
37644      close();
37645    }
37646  }
37647
37648  protected void composeClinicalUseDefinitionIndicationComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent element) throws IOException {
37649    composeBackboneElementProperties(element);
37650      if (element.hasDiseaseSymptomProcedure()) {
37651        composeCodeableReference("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
37652      }
37653      if (element.hasDiseaseStatus()) {
37654        composeCodeableReference("diseaseStatus", element.getDiseaseStatus());
37655      }
37656      if (element.hasComorbidity()) {
37657        openArray("comorbidity");
37658        for (CodeableReference e : element.getComorbidity()) 
37659          composeCodeableReference(null, e);
37660        closeArray();
37661      };
37662      if (element.hasIntendedEffect()) {
37663        composeCodeableReference("intendedEffect", element.getIntendedEffect());
37664      }
37665      if (element.hasDuration()) {
37666        composeQuantity("duration", element.getDuration());
37667      }
37668      if (element.hasUndesirableEffect()) {
37669        openArray("undesirableEffect");
37670        for (Reference e : element.getUndesirableEffect()) 
37671          composeReference(null, e);
37672        closeArray();
37673      };
37674      if (element.hasOtherTherapy()) {
37675        openArray("otherTherapy");
37676        for (ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
37677          composeClinicalUseDefinitionContraindicationOtherTherapyComponent(null, e);
37678        closeArray();
37679      };
37680  }
37681
37682  protected void composeClinicalUseDefinitionInteractionComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent element) throws IOException {
37683    if (element != null) {
37684      open(name);
37685      composeClinicalUseDefinitionInteractionComponentProperties(element);
37686      close();
37687    }
37688  }
37689
37690  protected void composeClinicalUseDefinitionInteractionComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent element) throws IOException {
37691    composeBackboneElementProperties(element);
37692      if (element.hasInteractant()) {
37693        openArray("interactant");
37694        for (ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent e : element.getInteractant()) 
37695          composeClinicalUseDefinitionInteractionInteractantComponent(null, e);
37696        closeArray();
37697      };
37698      if (element.hasType()) {
37699        composeCodeableConcept("type", element.getType());
37700      }
37701      if (element.hasEffect()) {
37702        composeCodeableReference("effect", element.getEffect());
37703      }
37704      if (element.hasIncidence()) {
37705        composeCodeableConcept("incidence", element.getIncidence());
37706      }
37707      if (element.hasManagement()) {
37708        openArray("management");
37709        for (CodeableConcept e : element.getManagement()) 
37710          composeCodeableConcept(null, e);
37711        closeArray();
37712      };
37713  }
37714
37715  protected void composeClinicalUseDefinitionInteractionInteractantComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent element) throws IOException {
37716    if (element != null) {
37717      open(name);
37718      composeClinicalUseDefinitionInteractionInteractantComponentProperties(element);
37719      close();
37720    }
37721  }
37722
37723  protected void composeClinicalUseDefinitionInteractionInteractantComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent element) throws IOException {
37724    composeBackboneElementProperties(element);
37725      if (element.hasItem()) {
37726        composeType("item", element.getItem());
37727      }
37728  }
37729
37730  protected void composeClinicalUseDefinitionUndesirableEffectComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent element) throws IOException {
37731    if (element != null) {
37732      open(name);
37733      composeClinicalUseDefinitionUndesirableEffectComponentProperties(element);
37734      close();
37735    }
37736  }
37737
37738  protected void composeClinicalUseDefinitionUndesirableEffectComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent element) throws IOException {
37739    composeBackboneElementProperties(element);
37740      if (element.hasSymptomConditionEffect()) {
37741        composeCodeableReference("symptomConditionEffect", element.getSymptomConditionEffect());
37742      }
37743      if (element.hasClassification()) {
37744        composeCodeableConcept("classification", element.getClassification());
37745      }
37746      if (element.hasFrequencyOfOccurrence()) {
37747        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
37748      }
37749  }
37750
37751  protected void composeClinicalUseDefinitionWarningComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent element) throws IOException {
37752    if (element != null) {
37753      open(name);
37754      composeClinicalUseDefinitionWarningComponentProperties(element);
37755      close();
37756    }
37757  }
37758
37759  protected void composeClinicalUseDefinitionWarningComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent element) throws IOException {
37760    composeBackboneElementProperties(element);
37761      if (element.hasDescriptionElement()) {
37762        composeMarkdownCore("description", element.getDescriptionElement(), false);
37763        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37764      }
37765      if (element.hasCode()) {
37766        composeCodeableConcept("code", element.getCode());
37767      }
37768  }
37769
37770  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
37771    if (element != null) {
37772      prop("resourceType", name);
37773      composeCodeSystemProperties(element);
37774    }
37775  }
37776
37777  protected void composeCodeSystemProperties(CodeSystem element) throws IOException {
37778    composeDomainResourceProperties(element);
37779      if (element.hasUrlElement()) {
37780        composeUriCore("url", element.getUrlElement(), false);
37781        composeUriExtras("url", element.getUrlElement(), false);
37782      }
37783      if (element.hasIdentifier()) {
37784        openArray("identifier");
37785        for (Identifier e : element.getIdentifier()) 
37786          composeIdentifier(null, e);
37787        closeArray();
37788      };
37789      if (element.hasVersionElement()) {
37790        composeStringCore("version", element.getVersionElement(), false);
37791        composeStringExtras("version", element.getVersionElement(), false);
37792      }
37793      if (element.hasNameElement()) {
37794        composeStringCore("name", element.getNameElement(), false);
37795        composeStringExtras("name", element.getNameElement(), false);
37796      }
37797      if (element.hasTitleElement()) {
37798        composeStringCore("title", element.getTitleElement(), false);
37799        composeStringExtras("title", element.getTitleElement(), false);
37800      }
37801      if (element.hasStatusElement()) {
37802        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37803        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37804      }
37805      if (element.hasExperimentalElement()) {
37806        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37807        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37808      }
37809      if (element.hasDateElement()) {
37810        composeDateTimeCore("date", element.getDateElement(), false);
37811        composeDateTimeExtras("date", element.getDateElement(), false);
37812      }
37813      if (element.hasPublisherElement()) {
37814        composeStringCore("publisher", element.getPublisherElement(), false);
37815        composeStringExtras("publisher", element.getPublisherElement(), false);
37816      }
37817      if (element.hasContact()) {
37818        openArray("contact");
37819        for (ContactDetail e : element.getContact()) 
37820          composeContactDetail(null, e);
37821        closeArray();
37822      };
37823      if (element.hasDescriptionElement()) {
37824        composeMarkdownCore("description", element.getDescriptionElement(), false);
37825        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37826      }
37827      if (element.hasUseContext()) {
37828        openArray("useContext");
37829        for (UsageContext e : element.getUseContext()) 
37830          composeUsageContext(null, e);
37831        closeArray();
37832      };
37833      if (element.hasJurisdiction()) {
37834        openArray("jurisdiction");
37835        for (CodeableConcept e : element.getJurisdiction()) 
37836          composeCodeableConcept(null, e);
37837        closeArray();
37838      };
37839      if (element.hasPurposeElement()) {
37840        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37841        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37842      }
37843      if (element.hasCopyrightElement()) {
37844        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
37845        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
37846      }
37847      if (element.hasCaseSensitiveElement()) {
37848        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
37849        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
37850      }
37851      if (element.hasValueSetElement()) {
37852        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37853        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37854      }
37855      if (element.hasHierarchyMeaningElement()) {
37856        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
37857        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
37858      }
37859      if (element.hasCompositionalElement()) {
37860        composeBooleanCore("compositional", element.getCompositionalElement(), false);
37861        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
37862      }
37863      if (element.hasVersionNeededElement()) {
37864        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
37865        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
37866      }
37867      if (element.hasContentElement()) {
37868        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
37869        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
37870      }
37871      if (element.hasSupplementsElement()) {
37872        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
37873        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
37874      }
37875      if (element.hasCountElement()) {
37876        composeUnsignedIntCore("count", element.getCountElement(), false);
37877        composeUnsignedIntExtras("count", element.getCountElement(), false);
37878      }
37879      if (element.hasFilter()) {
37880        openArray("filter");
37881        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
37882          composeCodeSystemFilterComponent(null, e);
37883        closeArray();
37884      };
37885      if (element.hasProperty()) {
37886        openArray("property");
37887        for (CodeSystem.PropertyComponent e : element.getProperty()) 
37888          composePropertyComponent(null, e);
37889        closeArray();
37890      };
37891      if (element.hasConcept()) {
37892        openArray("concept");
37893        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
37894          composeConceptDefinitionComponent(null, e);
37895        closeArray();
37896      };
37897  }
37898
37899  protected void composeCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
37900    if (element != null) {
37901      open(name);
37902      composeCodeSystemFilterComponentProperties(element);
37903      close();
37904    }
37905  }
37906
37907  protected void composeCodeSystemFilterComponentProperties(CodeSystem.CodeSystemFilterComponent element) throws IOException {
37908    composeBackboneElementProperties(element);
37909      if (element.hasCodeElement()) {
37910        composeCodeCore("code", element.getCodeElement(), false);
37911        composeCodeExtras("code", element.getCodeElement(), false);
37912      }
37913      if (element.hasDescriptionElement()) {
37914        composeStringCore("description", element.getDescriptionElement(), false);
37915        composeStringExtras("description", element.getDescriptionElement(), false);
37916      }
37917      if (element.hasOperator()) {
37918        openArray("operator");
37919        for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
37920          composeEnumerationCore(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
37921        closeArray();
37922        if (anyHasExtras(element.getOperator())) {
37923          openArray("_operator");
37924          for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
37925            composeEnumerationExtras(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
37926          closeArray();
37927        }
37928      };
37929      if (element.hasValueElement()) {
37930        composeStringCore("value", element.getValueElement(), false);
37931        composeStringExtras("value", element.getValueElement(), false);
37932      }
37933  }
37934
37935  protected void composePropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
37936    if (element != null) {
37937      open(name);
37938      composePropertyComponentProperties(element);
37939      close();
37940    }
37941  }
37942
37943  protected void composePropertyComponentProperties(CodeSystem.PropertyComponent element) throws IOException {
37944    composeBackboneElementProperties(element);
37945      if (element.hasCodeElement()) {
37946        composeCodeCore("code", element.getCodeElement(), false);
37947        composeCodeExtras("code", element.getCodeElement(), false);
37948      }
37949      if (element.hasUriElement()) {
37950        composeUriCore("uri", element.getUriElement(), false);
37951        composeUriExtras("uri", element.getUriElement(), false);
37952      }
37953      if (element.hasDescriptionElement()) {
37954        composeStringCore("description", element.getDescriptionElement(), false);
37955        composeStringExtras("description", element.getDescriptionElement(), false);
37956      }
37957      if (element.hasTypeElement()) {
37958        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
37959        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
37960      }
37961  }
37962
37963  protected void composeConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
37964    if (element != null) {
37965      open(name);
37966      composeConceptDefinitionComponentProperties(element);
37967      close();
37968    }
37969  }
37970
37971  protected void composeConceptDefinitionComponentProperties(CodeSystem.ConceptDefinitionComponent element) throws IOException {
37972    composeBackboneElementProperties(element);
37973      if (element.hasCodeElement()) {
37974        composeCodeCore("code", element.getCodeElement(), false);
37975        composeCodeExtras("code", element.getCodeElement(), false);
37976      }
37977      if (element.hasDisplayElement()) {
37978        composeStringCore("display", element.getDisplayElement(), false);
37979        composeStringExtras("display", element.getDisplayElement(), false);
37980      }
37981      if (element.hasDefinitionElement()) {
37982        composeStringCore("definition", element.getDefinitionElement(), false);
37983        composeStringExtras("definition", element.getDefinitionElement(), false);
37984      }
37985      if (element.hasDesignation()) {
37986        openArray("designation");
37987        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
37988          composeConceptDefinitionDesignationComponent(null, e);
37989        closeArray();
37990      };
37991      if (element.hasProperty()) {
37992        openArray("property");
37993        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
37994          composeConceptPropertyComponent(null, e);
37995        closeArray();
37996      };
37997      if (element.hasConcept()) {
37998        openArray("concept");
37999        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
38000          composeConceptDefinitionComponent(null, e);
38001        closeArray();
38002      };
38003  }
38004
38005  protected void composeConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
38006    if (element != null) {
38007      open(name);
38008      composeConceptDefinitionDesignationComponentProperties(element);
38009      close();
38010    }
38011  }
38012
38013  protected void composeConceptDefinitionDesignationComponentProperties(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
38014    composeBackboneElementProperties(element);
38015      if (element.hasLanguageElement()) {
38016        composeCodeCore("language", element.getLanguageElement(), false);
38017        composeCodeExtras("language", element.getLanguageElement(), false);
38018      }
38019      if (element.hasUse()) {
38020        composeCoding("use", element.getUse());
38021      }
38022      if (element.hasValueElement()) {
38023        composeStringCore("value", element.getValueElement(), false);
38024        composeStringExtras("value", element.getValueElement(), false);
38025      }
38026  }
38027
38028  protected void composeConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
38029    if (element != null) {
38030      open(name);
38031      composeConceptPropertyComponentProperties(element);
38032      close();
38033    }
38034  }
38035
38036  protected void composeConceptPropertyComponentProperties(CodeSystem.ConceptPropertyComponent element) throws IOException {
38037    composeBackboneElementProperties(element);
38038      if (element.hasCodeElement()) {
38039        composeCodeCore("code", element.getCodeElement(), false);
38040        composeCodeExtras("code", element.getCodeElement(), false);
38041      }
38042      if (element.hasValue()) {
38043        composeType("value", element.getValue());
38044      }
38045  }
38046
38047  protected void composeCommunication(String name, Communication element) throws IOException {
38048    if (element != null) {
38049      prop("resourceType", name);
38050      composeCommunicationProperties(element);
38051    }
38052  }
38053
38054  protected void composeCommunicationProperties(Communication element) throws IOException {
38055    composeDomainResourceProperties(element);
38056      if (element.hasIdentifier()) {
38057        openArray("identifier");
38058        for (Identifier e : element.getIdentifier()) 
38059          composeIdentifier(null, e);
38060        closeArray();
38061      };
38062      if (element.hasInstantiatesCanonical()) {
38063        if (anyHasValue(element.getInstantiatesCanonical())) {
38064          openArray("instantiatesCanonical");
38065          for (CanonicalType e : element.getInstantiatesCanonical()) 
38066            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
38067          closeArray();
38068        }
38069        if (anyHasExtras(element.getInstantiatesCanonical())) {
38070          openArray("_instantiatesCanonical");
38071          for (CanonicalType e : element.getInstantiatesCanonical()) 
38072            composeCanonicalExtras(null, e, true);
38073          closeArray();
38074        }
38075      };
38076      if (element.hasInstantiatesUri()) {
38077        if (anyHasValue(element.getInstantiatesUri())) {
38078          openArray("instantiatesUri");
38079          for (UriType e : element.getInstantiatesUri()) 
38080            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
38081          closeArray();
38082        }
38083        if (anyHasExtras(element.getInstantiatesUri())) {
38084          openArray("_instantiatesUri");
38085          for (UriType e : element.getInstantiatesUri()) 
38086            composeUriExtras(null, e, true);
38087          closeArray();
38088        }
38089      };
38090      if (element.hasBasedOn()) {
38091        openArray("basedOn");
38092        for (Reference e : element.getBasedOn()) 
38093          composeReference(null, e);
38094        closeArray();
38095      };
38096      if (element.hasPartOf()) {
38097        openArray("partOf");
38098        for (Reference e : element.getPartOf()) 
38099          composeReference(null, e);
38100        closeArray();
38101      };
38102      if (element.hasInResponseTo()) {
38103        openArray("inResponseTo");
38104        for (Reference e : element.getInResponseTo()) 
38105          composeReference(null, e);
38106        closeArray();
38107      };
38108      if (element.hasStatusElement()) {
38109        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
38110        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
38111      }
38112      if (element.hasStatusReason()) {
38113        composeCodeableConcept("statusReason", element.getStatusReason());
38114      }
38115      if (element.hasCategory()) {
38116        openArray("category");
38117        for (CodeableConcept e : element.getCategory()) 
38118          composeCodeableConcept(null, e);
38119        closeArray();
38120      };
38121      if (element.hasPriorityElement()) {
38122        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38123        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38124      }
38125      if (element.hasMedium()) {
38126        openArray("medium");
38127        for (CodeableConcept e : element.getMedium()) 
38128          composeCodeableConcept(null, e);
38129        closeArray();
38130      };
38131      if (element.hasSubject()) {
38132        composeReference("subject", element.getSubject());
38133      }
38134      if (element.hasTopic()) {
38135        composeCodeableConcept("topic", element.getTopic());
38136      }
38137      if (element.hasAbout()) {
38138        openArray("about");
38139        for (Reference e : element.getAbout()) 
38140          composeReference(null, e);
38141        closeArray();
38142      };
38143      if (element.hasEncounter()) {
38144        composeReference("encounter", element.getEncounter());
38145      }
38146      if (element.hasSentElement()) {
38147        composeDateTimeCore("sent", element.getSentElement(), false);
38148        composeDateTimeExtras("sent", element.getSentElement(), false);
38149      }
38150      if (element.hasReceivedElement()) {
38151        composeDateTimeCore("received", element.getReceivedElement(), false);
38152        composeDateTimeExtras("received", element.getReceivedElement(), false);
38153      }
38154      if (element.hasRecipient()) {
38155        openArray("recipient");
38156        for (Reference e : element.getRecipient()) 
38157          composeReference(null, e);
38158        closeArray();
38159      };
38160      if (element.hasSender()) {
38161        composeReference("sender", element.getSender());
38162      }
38163      if (element.hasReasonCode()) {
38164        openArray("reasonCode");
38165        for (CodeableConcept e : element.getReasonCode()) 
38166          composeCodeableConcept(null, e);
38167        closeArray();
38168      };
38169      if (element.hasReasonReference()) {
38170        openArray("reasonReference");
38171        for (Reference e : element.getReasonReference()) 
38172          composeReference(null, e);
38173        closeArray();
38174      };
38175      if (element.hasPayload()) {
38176        openArray("payload");
38177        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
38178          composeCommunicationPayloadComponent(null, e);
38179        closeArray();
38180      };
38181      if (element.hasNote()) {
38182        openArray("note");
38183        for (Annotation e : element.getNote()) 
38184          composeAnnotation(null, e);
38185        closeArray();
38186      };
38187  }
38188
38189  protected void composeCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
38190    if (element != null) {
38191      open(name);
38192      composeCommunicationPayloadComponentProperties(element);
38193      close();
38194    }
38195  }
38196
38197  protected void composeCommunicationPayloadComponentProperties(Communication.CommunicationPayloadComponent element) throws IOException {
38198    composeBackboneElementProperties(element);
38199      if (element.hasContent()) {
38200        composeType("content", element.getContent());
38201      }
38202  }
38203
38204  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
38205    if (element != null) {
38206      prop("resourceType", name);
38207      composeCommunicationRequestProperties(element);
38208    }
38209  }
38210
38211  protected void composeCommunicationRequestProperties(CommunicationRequest element) throws IOException {
38212    composeDomainResourceProperties(element);
38213      if (element.hasIdentifier()) {
38214        openArray("identifier");
38215        for (Identifier e : element.getIdentifier()) 
38216          composeIdentifier(null, e);
38217        closeArray();
38218      };
38219      if (element.hasBasedOn()) {
38220        openArray("basedOn");
38221        for (Reference e : element.getBasedOn()) 
38222          composeReference(null, e);
38223        closeArray();
38224      };
38225      if (element.hasReplaces()) {
38226        openArray("replaces");
38227        for (Reference e : element.getReplaces()) 
38228          composeReference(null, e);
38229        closeArray();
38230      };
38231      if (element.hasGroupIdentifier()) {
38232        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
38233      }
38234      if (element.hasStatusElement()) {
38235        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
38236        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
38237      }
38238      if (element.hasStatusReason()) {
38239        composeCodeableConcept("statusReason", element.getStatusReason());
38240      }
38241      if (element.hasCategory()) {
38242        openArray("category");
38243        for (CodeableConcept e : element.getCategory()) 
38244          composeCodeableConcept(null, e);
38245        closeArray();
38246      };
38247      if (element.hasPriorityElement()) {
38248        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38249        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38250      }
38251      if (element.hasDoNotPerformElement()) {
38252        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
38253        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
38254      }
38255      if (element.hasMedium()) {
38256        openArray("medium");
38257        for (CodeableConcept e : element.getMedium()) 
38258          composeCodeableConcept(null, e);
38259        closeArray();
38260      };
38261      if (element.hasSubject()) {
38262        composeReference("subject", element.getSubject());
38263      }
38264      if (element.hasAbout()) {
38265        openArray("about");
38266        for (Reference e : element.getAbout()) 
38267          composeReference(null, e);
38268        closeArray();
38269      };
38270      if (element.hasEncounter()) {
38271        composeReference("encounter", element.getEncounter());
38272      }
38273      if (element.hasPayload()) {
38274        openArray("payload");
38275        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
38276          composeCommunicationRequestPayloadComponent(null, e);
38277        closeArray();
38278      };
38279      if (element.hasOccurrence()) {
38280        composeType("occurrence", element.getOccurrence());
38281      }
38282      if (element.hasAuthoredOnElement()) {
38283        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
38284        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
38285      }
38286      if (element.hasRequester()) {
38287        composeReference("requester", element.getRequester());
38288      }
38289      if (element.hasRecipient()) {
38290        openArray("recipient");
38291        for (Reference e : element.getRecipient()) 
38292          composeReference(null, e);
38293        closeArray();
38294      };
38295      if (element.hasSender()) {
38296        composeReference("sender", element.getSender());
38297      }
38298      if (element.hasReasonCode()) {
38299        openArray("reasonCode");
38300        for (CodeableConcept e : element.getReasonCode()) 
38301          composeCodeableConcept(null, e);
38302        closeArray();
38303      };
38304      if (element.hasReasonReference()) {
38305        openArray("reasonReference");
38306        for (Reference e : element.getReasonReference()) 
38307          composeReference(null, e);
38308        closeArray();
38309      };
38310      if (element.hasNote()) {
38311        openArray("note");
38312        for (Annotation e : element.getNote()) 
38313          composeAnnotation(null, e);
38314        closeArray();
38315      };
38316  }
38317
38318  protected void composeCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
38319    if (element != null) {
38320      open(name);
38321      composeCommunicationRequestPayloadComponentProperties(element);
38322      close();
38323    }
38324  }
38325
38326  protected void composeCommunicationRequestPayloadComponentProperties(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
38327    composeBackboneElementProperties(element);
38328      if (element.hasContent()) {
38329        composeType("content", element.getContent());
38330      }
38331  }
38332
38333  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
38334    if (element != null) {
38335      prop("resourceType", name);
38336      composeCompartmentDefinitionProperties(element);
38337    }
38338  }
38339
38340  protected void composeCompartmentDefinitionProperties(CompartmentDefinition element) throws IOException {
38341    composeDomainResourceProperties(element);
38342      if (element.hasUrlElement()) {
38343        composeUriCore("url", element.getUrlElement(), false);
38344        composeUriExtras("url", element.getUrlElement(), false);
38345      }
38346      if (element.hasVersionElement()) {
38347        composeStringCore("version", element.getVersionElement(), false);
38348        composeStringExtras("version", element.getVersionElement(), false);
38349      }
38350      if (element.hasNameElement()) {
38351        composeStringCore("name", element.getNameElement(), false);
38352        composeStringExtras("name", element.getNameElement(), false);
38353      }
38354      if (element.hasStatusElement()) {
38355        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38356        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38357      }
38358      if (element.hasExperimentalElement()) {
38359        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38360        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38361      }
38362      if (element.hasDateElement()) {
38363        composeDateTimeCore("date", element.getDateElement(), false);
38364        composeDateTimeExtras("date", element.getDateElement(), false);
38365      }
38366      if (element.hasPublisherElement()) {
38367        composeStringCore("publisher", element.getPublisherElement(), false);
38368        composeStringExtras("publisher", element.getPublisherElement(), false);
38369      }
38370      if (element.hasContact()) {
38371        openArray("contact");
38372        for (ContactDetail e : element.getContact()) 
38373          composeContactDetail(null, e);
38374        closeArray();
38375      };
38376      if (element.hasDescriptionElement()) {
38377        composeMarkdownCore("description", element.getDescriptionElement(), false);
38378        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38379      }
38380      if (element.hasUseContext()) {
38381        openArray("useContext");
38382        for (UsageContext e : element.getUseContext()) 
38383          composeUsageContext(null, e);
38384        closeArray();
38385      };
38386      if (element.hasPurposeElement()) {
38387        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38388        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38389      }
38390      if (element.hasCodeElement()) {
38391        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
38392        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
38393      }
38394      if (element.hasSearchElement()) {
38395        composeBooleanCore("search", element.getSearchElement(), false);
38396        composeBooleanExtras("search", element.getSearchElement(), false);
38397      }
38398      if (element.hasResource()) {
38399        openArray("resource");
38400        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
38401          composeCompartmentDefinitionResourceComponent(null, e);
38402        closeArray();
38403      };
38404  }
38405
38406  protected void composeCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
38407    if (element != null) {
38408      open(name);
38409      composeCompartmentDefinitionResourceComponentProperties(element);
38410      close();
38411    }
38412  }
38413
38414  protected void composeCompartmentDefinitionResourceComponentProperties(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
38415    composeBackboneElementProperties(element);
38416      if (element.hasCodeElement()) {
38417        composeCodeCore("code", element.getCodeElement(), false);
38418        composeCodeExtras("code", element.getCodeElement(), false);
38419      }
38420      if (element.hasParam()) {
38421        if (anyHasValue(element.getParam())) {
38422          openArray("param");
38423          for (StringType e : element.getParam()) 
38424            composeStringCore(null, e, e != element.getParam().get(element.getParam().size()-1));
38425          closeArray();
38426        }
38427        if (anyHasExtras(element.getParam())) {
38428          openArray("_param");
38429          for (StringType e : element.getParam()) 
38430            composeStringExtras(null, e, true);
38431          closeArray();
38432        }
38433      };
38434      if (element.hasDocumentationElement()) {
38435        composeStringCore("documentation", element.getDocumentationElement(), false);
38436        composeStringExtras("documentation", element.getDocumentationElement(), false);
38437      }
38438  }
38439
38440  protected void composeComposition(String name, Composition element) throws IOException {
38441    if (element != null) {
38442      prop("resourceType", name);
38443      composeCompositionProperties(element);
38444    }
38445  }
38446
38447  protected void composeCompositionProperties(Composition element) throws IOException {
38448    composeDomainResourceProperties(element);
38449      if (element.hasIdentifier()) {
38450        composeIdentifier("identifier", element.getIdentifier());
38451      }
38452      if (element.hasStatusElement()) {
38453        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
38454        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
38455      }
38456      if (element.hasType()) {
38457        composeCodeableConcept("type", element.getType());
38458      }
38459      if (element.hasCategory()) {
38460        openArray("category");
38461        for (CodeableConcept e : element.getCategory()) 
38462          composeCodeableConcept(null, e);
38463        closeArray();
38464      };
38465      if (element.hasSubject()) {
38466        composeReference("subject", element.getSubject());
38467      }
38468      if (element.hasEncounter()) {
38469        composeReference("encounter", element.getEncounter());
38470      }
38471      if (element.hasDateElement()) {
38472        composeDateTimeCore("date", element.getDateElement(), false);
38473        composeDateTimeExtras("date", element.getDateElement(), false);
38474      }
38475      if (element.hasAuthor()) {
38476        openArray("author");
38477        for (Reference e : element.getAuthor()) 
38478          composeReference(null, e);
38479        closeArray();
38480      };
38481      if (element.hasTitleElement()) {
38482        composeStringCore("title", element.getTitleElement(), false);
38483        composeStringExtras("title", element.getTitleElement(), false);
38484      }
38485      if (element.hasConfidentialityElement()) {
38486        composeCodeCore("confidentiality", element.getConfidentialityElement(), false);
38487        composeCodeExtras("confidentiality", element.getConfidentialityElement(), false);
38488      }
38489      if (element.hasAttester()) {
38490        openArray("attester");
38491        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
38492          composeCompositionAttesterComponent(null, e);
38493        closeArray();
38494      };
38495      if (element.hasCustodian()) {
38496        composeReference("custodian", element.getCustodian());
38497      }
38498      if (element.hasRelatesTo()) {
38499        openArray("relatesTo");
38500        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
38501          composeCompositionRelatesToComponent(null, e);
38502        closeArray();
38503      };
38504      if (element.hasEvent()) {
38505        openArray("event");
38506        for (Composition.CompositionEventComponent e : element.getEvent()) 
38507          composeCompositionEventComponent(null, e);
38508        closeArray();
38509      };
38510      if (element.hasSection()) {
38511        openArray("section");
38512        for (Composition.SectionComponent e : element.getSection()) 
38513          composeSectionComponent(null, e);
38514        closeArray();
38515      };
38516  }
38517
38518  protected void composeCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
38519    if (element != null) {
38520      open(name);
38521      composeCompositionAttesterComponentProperties(element);
38522      close();
38523    }
38524  }
38525
38526  protected void composeCompositionAttesterComponentProperties(Composition.CompositionAttesterComponent element) throws IOException {
38527    composeBackboneElementProperties(element);
38528      if (element.hasModeElement()) {
38529        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
38530        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
38531      }
38532      if (element.hasTimeElement()) {
38533        composeDateTimeCore("time", element.getTimeElement(), false);
38534        composeDateTimeExtras("time", element.getTimeElement(), false);
38535      }
38536      if (element.hasParty()) {
38537        composeReference("party", element.getParty());
38538      }
38539  }
38540
38541  protected void composeCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
38542    if (element != null) {
38543      open(name);
38544      composeCompositionRelatesToComponentProperties(element);
38545      close();
38546    }
38547  }
38548
38549  protected void composeCompositionRelatesToComponentProperties(Composition.CompositionRelatesToComponent element) throws IOException {
38550    composeBackboneElementProperties(element);
38551      if (element.hasCodeElement()) {
38552        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
38553        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
38554      }
38555      if (element.hasTarget()) {
38556        composeType("target", element.getTarget());
38557      }
38558  }
38559
38560  protected void composeCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
38561    if (element != null) {
38562      open(name);
38563      composeCompositionEventComponentProperties(element);
38564      close();
38565    }
38566  }
38567
38568  protected void composeCompositionEventComponentProperties(Composition.CompositionEventComponent element) throws IOException {
38569    composeBackboneElementProperties(element);
38570      if (element.hasCode()) {
38571        openArray("code");
38572        for (CodeableConcept e : element.getCode()) 
38573          composeCodeableConcept(null, e);
38574        closeArray();
38575      };
38576      if (element.hasPeriod()) {
38577        composePeriod("period", element.getPeriod());
38578      }
38579      if (element.hasDetail()) {
38580        openArray("detail");
38581        for (Reference e : element.getDetail()) 
38582          composeReference(null, e);
38583        closeArray();
38584      };
38585  }
38586
38587  protected void composeSectionComponent(String name, Composition.SectionComponent element) throws IOException {
38588    if (element != null) {
38589      open(name);
38590      composeSectionComponentProperties(element);
38591      close();
38592    }
38593  }
38594
38595  protected void composeSectionComponentProperties(Composition.SectionComponent element) throws IOException {
38596    composeBackboneElementProperties(element);
38597      if (element.hasTitleElement()) {
38598        composeStringCore("title", element.getTitleElement(), false);
38599        composeStringExtras("title", element.getTitleElement(), false);
38600      }
38601      if (element.hasCode()) {
38602        composeCodeableConcept("code", element.getCode());
38603      }
38604      if (element.hasAuthor()) {
38605        openArray("author");
38606        for (Reference e : element.getAuthor()) 
38607          composeReference(null, e);
38608        closeArray();
38609      };
38610      if (element.hasFocus()) {
38611        composeReference("focus", element.getFocus());
38612      }
38613      if (element.hasText()) {
38614        composeNarrative("text", element.getText());
38615      }
38616      if (element.hasModeElement()) {
38617        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
38618        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
38619      }
38620      if (element.hasOrderedBy()) {
38621        composeCodeableConcept("orderedBy", element.getOrderedBy());
38622      }
38623      if (element.hasEntry()) {
38624        openArray("entry");
38625        for (Reference e : element.getEntry()) 
38626          composeReference(null, e);
38627        closeArray();
38628      };
38629      if (element.hasEmptyReason()) {
38630        composeCodeableConcept("emptyReason", element.getEmptyReason());
38631      }
38632      if (element.hasSection()) {
38633        openArray("section");
38634        for (Composition.SectionComponent e : element.getSection()) 
38635          composeSectionComponent(null, e);
38636        closeArray();
38637      };
38638  }
38639
38640  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
38641    if (element != null) {
38642      prop("resourceType", name);
38643      composeConceptMapProperties(element);
38644    }
38645  }
38646
38647  protected void composeConceptMapProperties(ConceptMap element) throws IOException {
38648    composeDomainResourceProperties(element);
38649      if (element.hasUrlElement()) {
38650        composeUriCore("url", element.getUrlElement(), false);
38651        composeUriExtras("url", element.getUrlElement(), false);
38652      }
38653      if (element.hasIdentifier()) {
38654        composeIdentifier("identifier", element.getIdentifierFirstRep());
38655      }
38656      if (element.hasVersionElement()) {
38657        composeStringCore("version", element.getVersionElement(), false);
38658        composeStringExtras("version", element.getVersionElement(), false);
38659      }
38660      if (element.hasNameElement()) {
38661        composeStringCore("name", element.getNameElement(), false);
38662        composeStringExtras("name", element.getNameElement(), false);
38663      }
38664      if (element.hasTitleElement()) {
38665        composeStringCore("title", element.getTitleElement(), false);
38666        composeStringExtras("title", element.getTitleElement(), false);
38667      }
38668      if (element.hasStatusElement()) {
38669        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38670        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38671      }
38672      if (element.hasExperimentalElement()) {
38673        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38674        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38675      }
38676      if (element.hasDateElement()) {
38677        composeDateTimeCore("date", element.getDateElement(), false);
38678        composeDateTimeExtras("date", element.getDateElement(), false);
38679      }
38680      if (element.hasPublisherElement()) {
38681        composeStringCore("publisher", element.getPublisherElement(), false);
38682        composeStringExtras("publisher", element.getPublisherElement(), false);
38683      }
38684      if (element.hasContact()) {
38685        openArray("contact");
38686        for (ContactDetail e : element.getContact()) 
38687          composeContactDetail(null, e);
38688        closeArray();
38689      };
38690      if (element.hasDescriptionElement()) {
38691        composeMarkdownCore("description", element.getDescriptionElement(), false);
38692        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38693      }
38694      if (element.hasUseContext()) {
38695        openArray("useContext");
38696        for (UsageContext e : element.getUseContext()) 
38697          composeUsageContext(null, e);
38698        closeArray();
38699      };
38700      if (element.hasJurisdiction()) {
38701        openArray("jurisdiction");
38702        for (CodeableConcept e : element.getJurisdiction()) 
38703          composeCodeableConcept(null, e);
38704        closeArray();
38705      };
38706      if (element.hasPurposeElement()) {
38707        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38708        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38709      }
38710      if (element.hasCopyrightElement()) {
38711        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38712        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38713      }
38714      if (element.hasSource()) {
38715        composeType("source", element.getSource());
38716      }
38717      if (element.hasTarget()) {
38718        composeType("target", element.getTarget());
38719      }
38720      if (element.hasGroup()) {
38721        openArray("group");
38722        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
38723          composeConceptMapGroupComponent(null, e);
38724        closeArray();
38725      };
38726  }
38727
38728  protected void composeConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
38729    if (element != null) {
38730      open(name);
38731      composeConceptMapGroupComponentProperties(element);
38732      close();
38733    }
38734  }
38735
38736  protected void composeConceptMapGroupComponentProperties(ConceptMap.ConceptMapGroupComponent element) throws IOException {
38737    composeBackboneElementProperties(element);
38738      if (element.hasSourceElement()) {
38739        composeUriCore("source", element.getSourceElement(), false);
38740        composeUriExtras("source", element.getSourceElement(), false);
38741      }
38742      if (element.hasSourceVersionElement()) {
38743        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
38744        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
38745      }
38746      if (element.hasTargetElement()) {
38747        composeUriCore("target", element.getTargetElement(), false);
38748        composeUriExtras("target", element.getTargetElement(), false);
38749      }
38750      if (element.hasTargetVersionElement()) {
38751        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
38752        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
38753      }
38754      if (element.hasElement()) {
38755        openArray("element");
38756        for (ConceptMap.SourceElementComponent e : element.getElement()) 
38757          composeSourceElementComponent(null, e);
38758        closeArray();
38759      };
38760      if (element.hasUnmapped()) {
38761        composeConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
38762      }
38763  }
38764
38765  protected void composeSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
38766    if (element != null) {
38767      open(name);
38768      composeSourceElementComponentProperties(element);
38769      close();
38770    }
38771  }
38772
38773  protected void composeSourceElementComponentProperties(ConceptMap.SourceElementComponent element) throws IOException {
38774    composeBackboneElementProperties(element);
38775      if (element.hasCodeElement()) {
38776        composeCodeCore("code", element.getCodeElement(), false);
38777        composeCodeExtras("code", element.getCodeElement(), false);
38778      }
38779      if (element.hasDisplayElement()) {
38780        composeStringCore("display", element.getDisplayElement(), false);
38781        composeStringExtras("display", element.getDisplayElement(), false);
38782      }
38783      if (element.hasTarget()) {
38784        openArray("target");
38785        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
38786          composeTargetElementComponent(null, e);
38787        closeArray();
38788      };
38789  }
38790
38791  protected void composeTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
38792    if (element != null) {
38793      open(name);
38794      composeTargetElementComponentProperties(element);
38795      close();
38796    }
38797  }
38798
38799  protected void composeTargetElementComponentProperties(ConceptMap.TargetElementComponent element) throws IOException {
38800    composeBackboneElementProperties(element);
38801      if (element.hasCodeElement()) {
38802        composeCodeCore("code", element.getCodeElement(), false);
38803        composeCodeExtras("code", element.getCodeElement(), false);
38804      }
38805      if (element.hasDisplayElement()) {
38806        composeStringCore("display", element.getDisplayElement(), false);
38807        composeStringExtras("display", element.getDisplayElement(), false);
38808      }
38809      if (element.hasEquivalenceElement()) {
38810        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new ConceptMap.ConceptMapEquivalenceEnumFactory(), false);
38811        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new ConceptMap.ConceptMapEquivalenceEnumFactory(), false);
38812      }
38813      if (element.hasCommentElement()) {
38814        composeStringCore("comment", element.getCommentElement(), false);
38815        composeStringExtras("comment", element.getCommentElement(), false);
38816      }
38817      if (element.hasDependsOn()) {
38818        openArray("dependsOn");
38819        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
38820          composeOtherElementComponent(null, e);
38821        closeArray();
38822      };
38823      if (element.hasProduct()) {
38824        openArray("product");
38825        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
38826          composeOtherElementComponent(null, e);
38827        closeArray();
38828      };
38829  }
38830
38831  protected void composeOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
38832    if (element != null) {
38833      open(name);
38834      composeOtherElementComponentProperties(element);
38835      close();
38836    }
38837  }
38838
38839  protected void composeOtherElementComponentProperties(ConceptMap.OtherElementComponent element) throws IOException {
38840    composeBackboneElementProperties(element);
38841      if (element.hasPropertyElement()) {
38842        composeUriCore("property", element.getPropertyElement(), false);
38843        composeUriExtras("property", element.getPropertyElement(), false);
38844      }
38845      if (element.hasSystemElement()) {
38846        composeCanonicalCore("system", element.getSystemElement(), false);
38847        composeCanonicalExtras("system", element.getSystemElement(), false);
38848      }
38849      if (element.hasValueElement()) {
38850        composeStringCore("value", element.getValueElement(), false);
38851        composeStringExtras("value", element.getValueElement(), false);
38852      }
38853      if (element.hasDisplayElement()) {
38854        composeStringCore("display", element.getDisplayElement(), false);
38855        composeStringExtras("display", element.getDisplayElement(), false);
38856      }
38857  }
38858
38859  protected void composeConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
38860    if (element != null) {
38861      open(name);
38862      composeConceptMapGroupUnmappedComponentProperties(element);
38863      close();
38864    }
38865  }
38866
38867  protected void composeConceptMapGroupUnmappedComponentProperties(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
38868    composeBackboneElementProperties(element);
38869      if (element.hasModeElement()) {
38870        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
38871        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
38872      }
38873      if (element.hasCodeElement()) {
38874        composeCodeCore("code", element.getCodeElement(), false);
38875        composeCodeExtras("code", element.getCodeElement(), false);
38876      }
38877      if (element.hasDisplayElement()) {
38878        composeStringCore("display", element.getDisplayElement(), false);
38879        composeStringExtras("display", element.getDisplayElement(), false);
38880      }
38881      if (element.hasUrlElement()) {
38882        composeCanonicalCore("url", element.getUrlElement(), false);
38883        composeCanonicalExtras("url", element.getUrlElement(), false);
38884      }
38885  }
38886
38887  protected void composeCondition(String name, Condition element) throws IOException {
38888    if (element != null) {
38889      prop("resourceType", name);
38890      composeConditionProperties(element);
38891    }
38892  }
38893
38894  protected void composeConditionProperties(Condition element) throws IOException {
38895    composeDomainResourceProperties(element);
38896      if (element.hasIdentifier()) {
38897        openArray("identifier");
38898        for (Identifier e : element.getIdentifier()) 
38899          composeIdentifier(null, e);
38900        closeArray();
38901      };
38902      if (element.hasClinicalStatus()) {
38903        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
38904      }
38905      if (element.hasVerificationStatus()) {
38906        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
38907      }
38908      if (element.hasCategory()) {
38909        openArray("category");
38910        for (CodeableConcept e : element.getCategory()) 
38911          composeCodeableConcept(null, e);
38912        closeArray();
38913      };
38914      if (element.hasSeverity()) {
38915        composeCodeableConcept("severity", element.getSeverity());
38916      }
38917      if (element.hasCode()) {
38918        composeCodeableConcept("code", element.getCode());
38919      }
38920      if (element.hasBodySite()) {
38921        openArray("bodySite");
38922        for (CodeableConcept e : element.getBodySite()) 
38923          composeCodeableConcept(null, e);
38924        closeArray();
38925      };
38926      if (element.hasSubject()) {
38927        composeReference("subject", element.getSubject());
38928      }
38929      if (element.hasEncounter()) {
38930        composeReference("encounter", element.getEncounter());
38931      }
38932      if (element.hasOnset()) {
38933        composeType("onset", element.getOnset());
38934      }
38935      if (element.hasAbatement()) {
38936        composeType("abatement", element.getAbatement());
38937      }
38938      if (element.hasRecordedDateElement()) {
38939        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
38940        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
38941      }
38942      if (element.hasRecorder()) {
38943        composeReference("recorder", element.getRecorder());
38944      }
38945      if (element.hasAsserter()) {
38946        composeReference("asserter", element.getAsserter());
38947      }
38948      if (element.hasStage()) {
38949        openArray("stage");
38950        for (Condition.ConditionStageComponent e : element.getStage()) 
38951          composeConditionStageComponent(null, e);
38952        closeArray();
38953      };
38954      if (element.hasEvidence()) {
38955        openArray("evidence");
38956        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
38957          composeConditionEvidenceComponent(null, e);
38958        closeArray();
38959      };
38960      if (element.hasNote()) {
38961        openArray("note");
38962        for (Annotation e : element.getNote()) 
38963          composeAnnotation(null, e);
38964        closeArray();
38965      };
38966  }
38967
38968  protected void composeConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
38969    if (element != null) {
38970      open(name);
38971      composeConditionStageComponentProperties(element);
38972      close();
38973    }
38974  }
38975
38976  protected void composeConditionStageComponentProperties(Condition.ConditionStageComponent element) throws IOException {
38977    composeBackboneElementProperties(element);
38978      if (element.hasSummary()) {
38979        composeCodeableConcept("summary", element.getSummary());
38980      }
38981      if (element.hasAssessment()) {
38982        openArray("assessment");
38983        for (Reference e : element.getAssessment()) 
38984          composeReference(null, e);
38985        closeArray();
38986      };
38987      if (element.hasType()) {
38988        composeCodeableConcept("type", element.getType());
38989      }
38990  }
38991
38992  protected void composeConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
38993    if (element != null) {
38994      open(name);
38995      composeConditionEvidenceComponentProperties(element);
38996      close();
38997    }
38998  }
38999
39000  protected void composeConditionEvidenceComponentProperties(Condition.ConditionEvidenceComponent element) throws IOException {
39001    composeBackboneElementProperties(element);
39002      if (element.hasCode()) {
39003        openArray("code");
39004        for (CodeableConcept e : element.getCode()) 
39005          composeCodeableConcept(null, e);
39006        closeArray();
39007      };
39008      if (element.hasDetail()) {
39009        openArray("detail");
39010        for (Reference e : element.getDetail()) 
39011          composeReference(null, e);
39012        closeArray();
39013      };
39014  }
39015
39016  protected void composeConsent(String name, Consent element) throws IOException {
39017    if (element != null) {
39018      prop("resourceType", name);
39019      composeConsentProperties(element);
39020    }
39021  }
39022
39023  protected void composeConsentProperties(Consent element) throws IOException {
39024    composeDomainResourceProperties(element);
39025      if (element.hasIdentifier()) {
39026        openArray("identifier");
39027        for (Identifier e : element.getIdentifier()) 
39028          composeIdentifier(null, e);
39029        closeArray();
39030      };
39031      if (element.hasStatusElement()) {
39032        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
39033        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
39034      }
39035      if (element.hasScope()) {
39036        composeCodeableConcept("scope", element.getScope());
39037      }
39038      if (element.hasCategory()) {
39039        openArray("category");
39040        for (CodeableConcept e : element.getCategory()) 
39041          composeCodeableConcept(null, e);
39042        closeArray();
39043      };
39044      if (element.hasPatient()) {
39045        composeReference("patient", element.getPatient());
39046      }
39047      if (element.hasDateTimeElement()) {
39048        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
39049        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
39050      }
39051      if (element.hasPerformer()) {
39052        openArray("performer");
39053        for (Reference e : element.getPerformer()) 
39054          composeReference(null, e);
39055        closeArray();
39056      };
39057      if (element.hasOrganization()) {
39058        openArray("organization");
39059        for (Reference e : element.getOrganization()) 
39060          composeReference(null, e);
39061        closeArray();
39062      };
39063      if (element.hasSource()) {
39064        composeType("source", element.getSource());
39065      }
39066      if (element.hasPolicy()) {
39067        openArray("policy");
39068        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
39069          composeConsentPolicyComponent(null, e);
39070        closeArray();
39071      };
39072      if (element.hasPolicyRule()) {
39073        composeCodeableConcept("policyRule", element.getPolicyRule());
39074      }
39075      if (element.hasVerification()) {
39076        openArray("verification");
39077        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
39078          composeConsentVerificationComponent(null, e);
39079        closeArray();
39080      };
39081      if (element.hasProvision()) {
39082        composeProvisionComponent("provision", element.getProvision());
39083      }
39084  }
39085
39086  protected void composeConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
39087    if (element != null) {
39088      open(name);
39089      composeConsentPolicyComponentProperties(element);
39090      close();
39091    }
39092  }
39093
39094  protected void composeConsentPolicyComponentProperties(Consent.ConsentPolicyComponent element) throws IOException {
39095    composeBackboneElementProperties(element);
39096      if (element.hasAuthorityElement()) {
39097        composeUriCore("authority", element.getAuthorityElement(), false);
39098        composeUriExtras("authority", element.getAuthorityElement(), false);
39099      }
39100      if (element.hasUriElement()) {
39101        composeUriCore("uri", element.getUriElement(), false);
39102        composeUriExtras("uri", element.getUriElement(), false);
39103      }
39104  }
39105
39106  protected void composeConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
39107    if (element != null) {
39108      open(name);
39109      composeConsentVerificationComponentProperties(element);
39110      close();
39111    }
39112  }
39113
39114  protected void composeConsentVerificationComponentProperties(Consent.ConsentVerificationComponent element) throws IOException {
39115    composeBackboneElementProperties(element);
39116      if (element.hasVerifiedElement()) {
39117        composeBooleanCore("verified", element.getVerifiedElement(), false);
39118        composeBooleanExtras("verified", element.getVerifiedElement(), false);
39119      }
39120      if (element.hasVerifiedWith()) {
39121        composeReference("verifiedWith", element.getVerifiedWith());
39122      }
39123      if (element.hasVerificationDateElement()) {
39124        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
39125        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
39126      }
39127  }
39128
39129  protected void composeProvisionComponent(String name, Consent.ProvisionComponent element) throws IOException {
39130    if (element != null) {
39131      open(name);
39132      composeProvisionComponentProperties(element);
39133      close();
39134    }
39135  }
39136
39137  protected void composeProvisionComponentProperties(Consent.ProvisionComponent element) throws IOException {
39138    composeBackboneElementProperties(element);
39139      if (element.hasTypeElement()) {
39140        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
39141        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
39142      }
39143      if (element.hasPeriod()) {
39144        composePeriod("period", element.getPeriod());
39145      }
39146      if (element.hasActor()) {
39147        openArray("actor");
39148        for (Consent.ProvisionActorComponent e : element.getActor()) 
39149          composeProvisionActorComponent(null, e);
39150        closeArray();
39151      };
39152      if (element.hasAction()) {
39153        openArray("action");
39154        for (CodeableConcept e : element.getAction()) 
39155          composeCodeableConcept(null, e);
39156        closeArray();
39157      };
39158      if (element.hasSecurityLabel()) {
39159        openArray("securityLabel");
39160        for (Coding e : element.getSecurityLabel()) 
39161          composeCoding(null, e);
39162        closeArray();
39163      };
39164      if (element.hasPurpose()) {
39165        openArray("purpose");
39166        for (Coding e : element.getPurpose()) 
39167          composeCoding(null, e);
39168        closeArray();
39169      };
39170      if (element.hasClass_()) {
39171        openArray("class");
39172        for (Coding e : element.getClass_()) 
39173          composeCoding(null, e);
39174        closeArray();
39175      };
39176      if (element.hasCode()) {
39177        openArray("code");
39178        for (CodeableConcept e : element.getCode()) 
39179          composeCodeableConcept(null, e);
39180        closeArray();
39181      };
39182      if (element.hasDataPeriod()) {
39183        composePeriod("dataPeriod", element.getDataPeriod());
39184      }
39185      if (element.hasData()) {
39186        openArray("data");
39187        for (Consent.ProvisionDataComponent e : element.getData()) 
39188          composeProvisionDataComponent(null, e);
39189        closeArray();
39190      };
39191      if (element.hasProvision()) {
39192        openArray("provision");
39193        for (Consent.ProvisionComponent e : element.getProvision()) 
39194          composeProvisionComponent(null, e);
39195        closeArray();
39196      };
39197  }
39198
39199  protected void composeProvisionActorComponent(String name, Consent.ProvisionActorComponent element) throws IOException {
39200    if (element != null) {
39201      open(name);
39202      composeProvisionActorComponentProperties(element);
39203      close();
39204    }
39205  }
39206
39207  protected void composeProvisionActorComponentProperties(Consent.ProvisionActorComponent element) throws IOException {
39208    composeBackboneElementProperties(element);
39209      if (element.hasRole()) {
39210        composeCodeableConcept("role", element.getRole());
39211      }
39212      if (element.hasReference()) {
39213        composeReference("reference", element.getReference());
39214      }
39215  }
39216
39217  protected void composeProvisionDataComponent(String name, Consent.ProvisionDataComponent element) throws IOException {
39218    if (element != null) {
39219      open(name);
39220      composeProvisionDataComponentProperties(element);
39221      close();
39222    }
39223  }
39224
39225  protected void composeProvisionDataComponentProperties(Consent.ProvisionDataComponent element) throws IOException {
39226    composeBackboneElementProperties(element);
39227      if (element.hasMeaningElement()) {
39228        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
39229        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
39230      }
39231      if (element.hasReference()) {
39232        composeReference("reference", element.getReference());
39233      }
39234  }
39235
39236  protected void composeContract(String name, Contract element) throws IOException {
39237    if (element != null) {
39238      prop("resourceType", name);
39239      composeContractProperties(element);
39240    }
39241  }
39242
39243  protected void composeContractProperties(Contract element) throws IOException {
39244    composeDomainResourceProperties(element);
39245      if (element.hasIdentifier()) {
39246        openArray("identifier");
39247        for (Identifier e : element.getIdentifier()) 
39248          composeIdentifier(null, e);
39249        closeArray();
39250      };
39251      if (element.hasUrlElement()) {
39252        composeUriCore("url", element.getUrlElement(), false);
39253        composeUriExtras("url", element.getUrlElement(), false);
39254      }
39255      if (element.hasVersionElement()) {
39256        composeStringCore("version", element.getVersionElement(), false);
39257        composeStringExtras("version", element.getVersionElement(), false);
39258      }
39259      if (element.hasStatusElement()) {
39260        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
39261        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
39262      }
39263      if (element.hasLegalState()) {
39264        composeCodeableConcept("legalState", element.getLegalState());
39265      }
39266      if (element.hasInstantiatesCanonical()) {
39267        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
39268      }
39269      if (element.hasInstantiatesUriElement()) {
39270        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
39271        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
39272      }
39273      if (element.hasContentDerivative()) {
39274        composeCodeableConcept("contentDerivative", element.getContentDerivative());
39275      }
39276      if (element.hasIssuedElement()) {
39277        composeDateTimeCore("issued", element.getIssuedElement(), false);
39278        composeDateTimeExtras("issued", element.getIssuedElement(), false);
39279      }
39280      if (element.hasApplies()) {
39281        composePeriod("applies", element.getApplies());
39282      }
39283      if (element.hasExpirationType()) {
39284        composeCodeableConcept("expirationType", element.getExpirationType());
39285      }
39286      if (element.hasSubject()) {
39287        openArray("subject");
39288        for (Reference e : element.getSubject()) 
39289          composeReference(null, e);
39290        closeArray();
39291      };
39292      if (element.hasAuthority()) {
39293        openArray("authority");
39294        for (Reference e : element.getAuthority()) 
39295          composeReference(null, e);
39296        closeArray();
39297      };
39298      if (element.hasDomain()) {
39299        openArray("domain");
39300        for (Reference e : element.getDomain()) 
39301          composeReference(null, e);
39302        closeArray();
39303      };
39304      if (element.hasSite()) {
39305        openArray("site");
39306        for (Reference e : element.getSite()) 
39307          composeReference(null, e);
39308        closeArray();
39309      };
39310      if (element.hasNameElement()) {
39311        composeStringCore("name", element.getNameElement(), false);
39312        composeStringExtras("name", element.getNameElement(), false);
39313      }
39314      if (element.hasTitleElement()) {
39315        composeStringCore("title", element.getTitleElement(), false);
39316        composeStringExtras("title", element.getTitleElement(), false);
39317      }
39318      if (element.hasSubtitleElement()) {
39319        composeStringCore("subtitle", element.getSubtitleElement(), false);
39320        composeStringExtras("subtitle", element.getSubtitleElement(), false);
39321      }
39322      if (element.hasAlias()) {
39323        if (anyHasValue(element.getAlias())) {
39324          openArray("alias");
39325          for (StringType e : element.getAlias()) 
39326            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
39327          closeArray();
39328        }
39329        if (anyHasExtras(element.getAlias())) {
39330          openArray("_alias");
39331          for (StringType e : element.getAlias()) 
39332            composeStringExtras(null, e, true);
39333          closeArray();
39334        }
39335      };
39336      if (element.hasAuthor()) {
39337        composeReference("author", element.getAuthor());
39338      }
39339      if (element.hasScope()) {
39340        composeCodeableConcept("scope", element.getScope());
39341      }
39342      if (element.hasTopic()) {
39343        composeType("topic", element.getTopic());
39344      }
39345      if (element.hasType()) {
39346        composeCodeableConcept("type", element.getType());
39347      }
39348      if (element.hasSubType()) {
39349        openArray("subType");
39350        for (CodeableConcept e : element.getSubType()) 
39351          composeCodeableConcept(null, e);
39352        closeArray();
39353      };
39354      if (element.hasContentDefinition()) {
39355        composeContentDefinitionComponent("contentDefinition", element.getContentDefinition());
39356      }
39357      if (element.hasTerm()) {
39358        openArray("term");
39359        for (Contract.TermComponent e : element.getTerm()) 
39360          composeTermComponent(null, e);
39361        closeArray();
39362      };
39363      if (element.hasSupportingInfo()) {
39364        openArray("supportingInfo");
39365        for (Reference e : element.getSupportingInfo()) 
39366          composeReference(null, e);
39367        closeArray();
39368      };
39369      if (element.hasRelevantHistory()) {
39370        openArray("relevantHistory");
39371        for (Reference e : element.getRelevantHistory()) 
39372          composeReference(null, e);
39373        closeArray();
39374      };
39375      if (element.hasSigner()) {
39376        openArray("signer");
39377        for (Contract.SignatoryComponent e : element.getSigner()) 
39378          composeSignatoryComponent(null, e);
39379        closeArray();
39380      };
39381      if (element.hasFriendly()) {
39382        openArray("friendly");
39383        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
39384          composeFriendlyLanguageComponent(null, e);
39385        closeArray();
39386      };
39387      if (element.hasLegal()) {
39388        openArray("legal");
39389        for (Contract.LegalLanguageComponent e : element.getLegal()) 
39390          composeLegalLanguageComponent(null, e);
39391        closeArray();
39392      };
39393      if (element.hasRule()) {
39394        openArray("rule");
39395        for (Contract.ComputableLanguageComponent e : element.getRule()) 
39396          composeComputableLanguageComponent(null, e);
39397        closeArray();
39398      };
39399      if (element.hasLegallyBinding()) {
39400        composeType("legallyBinding", element.getLegallyBinding());
39401      }
39402  }
39403
39404  protected void composeContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
39405    if (element != null) {
39406      open(name);
39407      composeContentDefinitionComponentProperties(element);
39408      close();
39409    }
39410  }
39411
39412  protected void composeContentDefinitionComponentProperties(Contract.ContentDefinitionComponent element) throws IOException {
39413    composeBackboneElementProperties(element);
39414      if (element.hasType()) {
39415        composeCodeableConcept("type", element.getType());
39416      }
39417      if (element.hasSubType()) {
39418        composeCodeableConcept("subType", element.getSubType());
39419      }
39420      if (element.hasPublisher()) {
39421        composeReference("publisher", element.getPublisher());
39422      }
39423      if (element.hasPublicationDateElement()) {
39424        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
39425        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
39426      }
39427      if (element.hasPublicationStatusElement()) {
39428        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
39429        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
39430      }
39431      if (element.hasCopyrightElement()) {
39432        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39433        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39434      }
39435  }
39436
39437  protected void composeTermComponent(String name, Contract.TermComponent element) throws IOException {
39438    if (element != null) {
39439      open(name);
39440      composeTermComponentProperties(element);
39441      close();
39442    }
39443  }
39444
39445  protected void composeTermComponentProperties(Contract.TermComponent element) throws IOException {
39446    composeBackboneElementProperties(element);
39447      if (element.hasIdentifier()) {
39448        composeIdentifier("identifier", element.getIdentifier());
39449      }
39450      if (element.hasIssuedElement()) {
39451        composeDateTimeCore("issued", element.getIssuedElement(), false);
39452        composeDateTimeExtras("issued", element.getIssuedElement(), false);
39453      }
39454      if (element.hasApplies()) {
39455        composePeriod("applies", element.getApplies());
39456      }
39457      if (element.hasTopic()) {
39458        composeType("topic", element.getTopic());
39459      }
39460      if (element.hasType()) {
39461        composeCodeableConcept("type", element.getType());
39462      }
39463      if (element.hasSubType()) {
39464        composeCodeableConcept("subType", element.getSubType());
39465      }
39466      if (element.hasTextElement()) {
39467        composeStringCore("text", element.getTextElement(), false);
39468        composeStringExtras("text", element.getTextElement(), false);
39469      }
39470      if (element.hasSecurityLabel()) {
39471        openArray("securityLabel");
39472        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
39473          composeSecurityLabelComponent(null, e);
39474        closeArray();
39475      };
39476      if (element.hasOffer()) {
39477        composeContractOfferComponent("offer", element.getOffer());
39478      }
39479      if (element.hasAsset()) {
39480        openArray("asset");
39481        for (Contract.ContractAssetComponent e : element.getAsset()) 
39482          composeContractAssetComponent(null, e);
39483        closeArray();
39484      };
39485      if (element.hasAction()) {
39486        openArray("action");
39487        for (Contract.ActionComponent e : element.getAction()) 
39488          composeActionComponent(null, e);
39489        closeArray();
39490      };
39491      if (element.hasGroup()) {
39492        openArray("group");
39493        for (Contract.TermComponent e : element.getGroup()) 
39494          composeTermComponent(null, e);
39495        closeArray();
39496      };
39497  }
39498
39499  protected void composeSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
39500    if (element != null) {
39501      open(name);
39502      composeSecurityLabelComponentProperties(element);
39503      close();
39504    }
39505  }
39506
39507  protected void composeSecurityLabelComponentProperties(Contract.SecurityLabelComponent element) throws IOException {
39508    composeBackboneElementProperties(element);
39509      if (element.hasNumber()) {
39510        if (anyHasValue(element.getNumber())) {
39511          openArray("number");
39512          for (UnsignedIntType e : element.getNumber()) 
39513            composeUnsignedIntCore(null, e, e != element.getNumber().get(element.getNumber().size()-1));
39514          closeArray();
39515        }
39516        if (anyHasExtras(element.getNumber())) {
39517          openArray("_number");
39518          for (UnsignedIntType e : element.getNumber()) 
39519            composeUnsignedIntExtras(null, e, true);
39520          closeArray();
39521        }
39522      };
39523      if (element.hasClassification()) {
39524        composeCoding("classification", element.getClassification());
39525      }
39526      if (element.hasCategory()) {
39527        openArray("category");
39528        for (Coding e : element.getCategory()) 
39529          composeCoding(null, e);
39530        closeArray();
39531      };
39532      if (element.hasControl()) {
39533        openArray("control");
39534        for (Coding e : element.getControl()) 
39535          composeCoding(null, e);
39536        closeArray();
39537      };
39538  }
39539
39540  protected void composeContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
39541    if (element != null) {
39542      open(name);
39543      composeContractOfferComponentProperties(element);
39544      close();
39545    }
39546  }
39547
39548  protected void composeContractOfferComponentProperties(Contract.ContractOfferComponent element) throws IOException {
39549    composeBackboneElementProperties(element);
39550      if (element.hasIdentifier()) {
39551        openArray("identifier");
39552        for (Identifier e : element.getIdentifier()) 
39553          composeIdentifier(null, e);
39554        closeArray();
39555      };
39556      if (element.hasParty()) {
39557        openArray("party");
39558        for (Contract.ContractPartyComponent e : element.getParty()) 
39559          composeContractPartyComponent(null, e);
39560        closeArray();
39561      };
39562      if (element.hasTopic()) {
39563        composeReference("topic", element.getTopic());
39564      }
39565      if (element.hasType()) {
39566        composeCodeableConcept("type", element.getType());
39567      }
39568      if (element.hasDecision()) {
39569        composeCodeableConcept("decision", element.getDecision());
39570      }
39571      if (element.hasDecisionMode()) {
39572        openArray("decisionMode");
39573        for (CodeableConcept e : element.getDecisionMode()) 
39574          composeCodeableConcept(null, e);
39575        closeArray();
39576      };
39577      if (element.hasAnswer()) {
39578        openArray("answer");
39579        for (Contract.AnswerComponent e : element.getAnswer()) 
39580          composeAnswerComponent(null, e);
39581        closeArray();
39582      };
39583      if (element.hasTextElement()) {
39584        composeStringCore("text", element.getTextElement(), false);
39585        composeStringExtras("text", element.getTextElement(), false);
39586      }
39587      if (element.hasLinkId()) {
39588        if (anyHasValue(element.getLinkId())) {
39589          openArray("linkId");
39590          for (StringType e : element.getLinkId()) 
39591            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
39592          closeArray();
39593        }
39594        if (anyHasExtras(element.getLinkId())) {
39595          openArray("_linkId");
39596          for (StringType e : element.getLinkId()) 
39597            composeStringExtras(null, e, true);
39598          closeArray();
39599        }
39600      };
39601      if (element.hasSecurityLabelNumber()) {
39602        if (anyHasValue(element.getSecurityLabelNumber())) {
39603          openArray("securityLabelNumber");
39604          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39605            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
39606          closeArray();
39607        }
39608        if (anyHasExtras(element.getSecurityLabelNumber())) {
39609          openArray("_securityLabelNumber");
39610          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39611            composeUnsignedIntExtras(null, e, true);
39612          closeArray();
39613        }
39614      };
39615  }
39616
39617  protected void composeContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
39618    if (element != null) {
39619      open(name);
39620      composeContractPartyComponentProperties(element);
39621      close();
39622    }
39623  }
39624
39625  protected void composeContractPartyComponentProperties(Contract.ContractPartyComponent element) throws IOException {
39626    composeBackboneElementProperties(element);
39627      if (element.hasReference()) {
39628        openArray("reference");
39629        for (Reference e : element.getReference()) 
39630          composeReference(null, e);
39631        closeArray();
39632      };
39633      if (element.hasRole()) {
39634        composeCodeableConcept("role", element.getRole());
39635      }
39636  }
39637
39638  protected void composeAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
39639    if (element != null) {
39640      open(name);
39641      composeAnswerComponentProperties(element);
39642      close();
39643    }
39644  }
39645
39646  protected void composeAnswerComponentProperties(Contract.AnswerComponent element) throws IOException {
39647    composeBackboneElementProperties(element);
39648      if (element.hasValue()) {
39649        composeType("value", element.getValue());
39650      }
39651  }
39652
39653  protected void composeContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
39654    if (element != null) {
39655      open(name);
39656      composeContractAssetComponentProperties(element);
39657      close();
39658    }
39659  }
39660
39661  protected void composeContractAssetComponentProperties(Contract.ContractAssetComponent element) throws IOException {
39662    composeBackboneElementProperties(element);
39663      if (element.hasScope()) {
39664        composeCodeableConcept("scope", element.getScope());
39665      }
39666      if (element.hasType()) {
39667        openArray("type");
39668        for (CodeableConcept e : element.getType()) 
39669          composeCodeableConcept(null, e);
39670        closeArray();
39671      };
39672      if (element.hasTypeReference()) {
39673        openArray("typeReference");
39674        for (Reference e : element.getTypeReference()) 
39675          composeReference(null, e);
39676        closeArray();
39677      };
39678      if (element.hasSubtype()) {
39679        openArray("subtype");
39680        for (CodeableConcept e : element.getSubtype()) 
39681          composeCodeableConcept(null, e);
39682        closeArray();
39683      };
39684      if (element.hasRelationship()) {
39685        composeCoding("relationship", element.getRelationship());
39686      }
39687      if (element.hasContext()) {
39688        openArray("context");
39689        for (Contract.AssetContextComponent e : element.getContext()) 
39690          composeAssetContextComponent(null, e);
39691        closeArray();
39692      };
39693      if (element.hasConditionElement()) {
39694        composeStringCore("condition", element.getConditionElement(), false);
39695        composeStringExtras("condition", element.getConditionElement(), false);
39696      }
39697      if (element.hasPeriodType()) {
39698        openArray("periodType");
39699        for (CodeableConcept e : element.getPeriodType()) 
39700          composeCodeableConcept(null, e);
39701        closeArray();
39702      };
39703      if (element.hasPeriod()) {
39704        openArray("period");
39705        for (Period e : element.getPeriod()) 
39706          composePeriod(null, e);
39707        closeArray();
39708      };
39709      if (element.hasUsePeriod()) {
39710        openArray("usePeriod");
39711        for (Period e : element.getUsePeriod()) 
39712          composePeriod(null, e);
39713        closeArray();
39714      };
39715      if (element.hasTextElement()) {
39716        composeStringCore("text", element.getTextElement(), false);
39717        composeStringExtras("text", element.getTextElement(), false);
39718      }
39719      if (element.hasLinkId()) {
39720        if (anyHasValue(element.getLinkId())) {
39721          openArray("linkId");
39722          for (StringType e : element.getLinkId()) 
39723            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
39724          closeArray();
39725        }
39726        if (anyHasExtras(element.getLinkId())) {
39727          openArray("_linkId");
39728          for (StringType e : element.getLinkId()) 
39729            composeStringExtras(null, e, true);
39730          closeArray();
39731        }
39732      };
39733      if (element.hasAnswer()) {
39734        openArray("answer");
39735        for (Contract.AnswerComponent e : element.getAnswer()) 
39736          composeAnswerComponent(null, e);
39737        closeArray();
39738      };
39739      if (element.hasSecurityLabelNumber()) {
39740        if (anyHasValue(element.getSecurityLabelNumber())) {
39741          openArray("securityLabelNumber");
39742          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39743            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
39744          closeArray();
39745        }
39746        if (anyHasExtras(element.getSecurityLabelNumber())) {
39747          openArray("_securityLabelNumber");
39748          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39749            composeUnsignedIntExtras(null, e, true);
39750          closeArray();
39751        }
39752      };
39753      if (element.hasValuedItem()) {
39754        openArray("valuedItem");
39755        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
39756          composeValuedItemComponent(null, e);
39757        closeArray();
39758      };
39759  }
39760
39761  protected void composeAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
39762    if (element != null) {
39763      open(name);
39764      composeAssetContextComponentProperties(element);
39765      close();
39766    }
39767  }
39768
39769  protected void composeAssetContextComponentProperties(Contract.AssetContextComponent element) throws IOException {
39770    composeBackboneElementProperties(element);
39771      if (element.hasReference()) {
39772        composeReference("reference", element.getReference());
39773      }
39774      if (element.hasCode()) {
39775        openArray("code");
39776        for (CodeableConcept e : element.getCode()) 
39777          composeCodeableConcept(null, e);
39778        closeArray();
39779      };
39780      if (element.hasTextElement()) {
39781        composeStringCore("text", element.getTextElement(), false);
39782        composeStringExtras("text", element.getTextElement(), false);
39783      }
39784  }
39785
39786  protected void composeValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
39787    if (element != null) {
39788      open(name);
39789      composeValuedItemComponentProperties(element);
39790      close();
39791    }
39792  }
39793
39794  protected void composeValuedItemComponentProperties(Contract.ValuedItemComponent element) throws IOException {
39795    composeBackboneElementProperties(element);
39796      if (element.hasEntity()) {
39797        composeType("entity", element.getEntity());
39798      }
39799      if (element.hasIdentifier()) {
39800        composeIdentifier("identifier", element.getIdentifier());
39801      }
39802      if (element.hasEffectiveTimeElement()) {
39803        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
39804        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
39805      }
39806      if (element.hasQuantity()) {
39807        composeQuantity("quantity", element.getQuantity());
39808      }
39809      if (element.hasUnitPrice()) {
39810        composeMoney("unitPrice", element.getUnitPrice());
39811      }
39812      if (element.hasFactorElement()) {
39813        composeDecimalCore("factor", element.getFactorElement(), false);
39814        composeDecimalExtras("factor", element.getFactorElement(), false);
39815      }
39816      if (element.hasPointsElement()) {
39817        composeDecimalCore("points", element.getPointsElement(), false);
39818        composeDecimalExtras("points", element.getPointsElement(), false);
39819      }
39820      if (element.hasNet()) {
39821        composeMoney("net", element.getNet());
39822      }
39823      if (element.hasPaymentElement()) {
39824        composeStringCore("payment", element.getPaymentElement(), false);
39825        composeStringExtras("payment", element.getPaymentElement(), false);
39826      }
39827      if (element.hasPaymentDateElement()) {
39828        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
39829        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
39830      }
39831      if (element.hasResponsible()) {
39832        composeReference("responsible", element.getResponsible());
39833      }
39834      if (element.hasRecipient()) {
39835        composeReference("recipient", element.getRecipient());
39836      }
39837      if (element.hasLinkId()) {
39838        if (anyHasValue(element.getLinkId())) {
39839          openArray("linkId");
39840          for (StringType e : element.getLinkId()) 
39841            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
39842          closeArray();
39843        }
39844        if (anyHasExtras(element.getLinkId())) {
39845          openArray("_linkId");
39846          for (StringType e : element.getLinkId()) 
39847            composeStringExtras(null, e, true);
39848          closeArray();
39849        }
39850      };
39851      if (element.hasSecurityLabelNumber()) {
39852        if (anyHasValue(element.getSecurityLabelNumber())) {
39853          openArray("securityLabelNumber");
39854          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39855            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
39856          closeArray();
39857        }
39858        if (anyHasExtras(element.getSecurityLabelNumber())) {
39859          openArray("_securityLabelNumber");
39860          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39861            composeUnsignedIntExtras(null, e, true);
39862          closeArray();
39863        }
39864      };
39865  }
39866
39867  protected void composeActionComponent(String name, Contract.ActionComponent element) throws IOException {
39868    if (element != null) {
39869      open(name);
39870      composeActionComponentProperties(element);
39871      close();
39872    }
39873  }
39874
39875  protected void composeActionComponentProperties(Contract.ActionComponent element) throws IOException {
39876    composeBackboneElementProperties(element);
39877      if (element.hasDoNotPerformElement()) {
39878        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
39879        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
39880      }
39881      if (element.hasType()) {
39882        composeCodeableConcept("type", element.getType());
39883      }
39884      if (element.hasSubject()) {
39885        openArray("subject");
39886        for (Contract.ActionSubjectComponent e : element.getSubject()) 
39887          composeActionSubjectComponent(null, e);
39888        closeArray();
39889      };
39890      if (element.hasIntent()) {
39891        composeCodeableConcept("intent", element.getIntent());
39892      }
39893      if (element.hasLinkId()) {
39894        if (anyHasValue(element.getLinkId())) {
39895          openArray("linkId");
39896          for (StringType e : element.getLinkId()) 
39897            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
39898          closeArray();
39899        }
39900        if (anyHasExtras(element.getLinkId())) {
39901          openArray("_linkId");
39902          for (StringType e : element.getLinkId()) 
39903            composeStringExtras(null, e, true);
39904          closeArray();
39905        }
39906      };
39907      if (element.hasStatus()) {
39908        composeCodeableConcept("status", element.getStatus());
39909      }
39910      if (element.hasContext()) {
39911        composeReference("context", element.getContext());
39912      }
39913      if (element.hasContextLinkId()) {
39914        if (anyHasValue(element.getContextLinkId())) {
39915          openArray("contextLinkId");
39916          for (StringType e : element.getContextLinkId()) 
39917            composeStringCore(null, e, e != element.getContextLinkId().get(element.getContextLinkId().size()-1));
39918          closeArray();
39919        }
39920        if (anyHasExtras(element.getContextLinkId())) {
39921          openArray("_contextLinkId");
39922          for (StringType e : element.getContextLinkId()) 
39923            composeStringExtras(null, e, true);
39924          closeArray();
39925        }
39926      };
39927      if (element.hasOccurrence()) {
39928        composeType("occurrence", element.getOccurrence());
39929      }
39930      if (element.hasRequester()) {
39931        openArray("requester");
39932        for (Reference e : element.getRequester()) 
39933          composeReference(null, e);
39934        closeArray();
39935      };
39936      if (element.hasRequesterLinkId()) {
39937        if (anyHasValue(element.getRequesterLinkId())) {
39938          openArray("requesterLinkId");
39939          for (StringType e : element.getRequesterLinkId()) 
39940            composeStringCore(null, e, e != element.getRequesterLinkId().get(element.getRequesterLinkId().size()-1));
39941          closeArray();
39942        }
39943        if (anyHasExtras(element.getRequesterLinkId())) {
39944          openArray("_requesterLinkId");
39945          for (StringType e : element.getRequesterLinkId()) 
39946            composeStringExtras(null, e, true);
39947          closeArray();
39948        }
39949      };
39950      if (element.hasPerformerType()) {
39951        openArray("performerType");
39952        for (CodeableConcept e : element.getPerformerType()) 
39953          composeCodeableConcept(null, e);
39954        closeArray();
39955      };
39956      if (element.hasPerformerRole()) {
39957        composeCodeableConcept("performerRole", element.getPerformerRole());
39958      }
39959      if (element.hasPerformer()) {
39960        composeReference("performer", element.getPerformer());
39961      }
39962      if (element.hasPerformerLinkId()) {
39963        if (anyHasValue(element.getPerformerLinkId())) {
39964          openArray("performerLinkId");
39965          for (StringType e : element.getPerformerLinkId()) 
39966            composeStringCore(null, e, e != element.getPerformerLinkId().get(element.getPerformerLinkId().size()-1));
39967          closeArray();
39968        }
39969        if (anyHasExtras(element.getPerformerLinkId())) {
39970          openArray("_performerLinkId");
39971          for (StringType e : element.getPerformerLinkId()) 
39972            composeStringExtras(null, e, true);
39973          closeArray();
39974        }
39975      };
39976      if (element.hasReasonCode()) {
39977        openArray("reasonCode");
39978        for (CodeableConcept e : element.getReasonCode()) 
39979          composeCodeableConcept(null, e);
39980        closeArray();
39981      };
39982      if (element.hasReasonReference()) {
39983        openArray("reasonReference");
39984        for (Reference e : element.getReasonReference()) 
39985          composeReference(null, e);
39986        closeArray();
39987      };
39988      if (element.hasReason()) {
39989        if (anyHasValue(element.getReason())) {
39990          openArray("reason");
39991          for (StringType e : element.getReason()) 
39992            composeStringCore(null, e, e != element.getReason().get(element.getReason().size()-1));
39993          closeArray();
39994        }
39995        if (anyHasExtras(element.getReason())) {
39996          openArray("_reason");
39997          for (StringType e : element.getReason()) 
39998            composeStringExtras(null, e, true);
39999          closeArray();
40000        }
40001      };
40002      if (element.hasReasonLinkId()) {
40003        if (anyHasValue(element.getReasonLinkId())) {
40004          openArray("reasonLinkId");
40005          for (StringType e : element.getReasonLinkId()) 
40006            composeStringCore(null, e, e != element.getReasonLinkId().get(element.getReasonLinkId().size()-1));
40007          closeArray();
40008        }
40009        if (anyHasExtras(element.getReasonLinkId())) {
40010          openArray("_reasonLinkId");
40011          for (StringType e : element.getReasonLinkId()) 
40012            composeStringExtras(null, e, true);
40013          closeArray();
40014        }
40015      };
40016      if (element.hasNote()) {
40017        openArray("note");
40018        for (Annotation e : element.getNote()) 
40019          composeAnnotation(null, e);
40020        closeArray();
40021      };
40022      if (element.hasSecurityLabelNumber()) {
40023        if (anyHasValue(element.getSecurityLabelNumber())) {
40024          openArray("securityLabelNumber");
40025          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40026            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
40027          closeArray();
40028        }
40029        if (anyHasExtras(element.getSecurityLabelNumber())) {
40030          openArray("_securityLabelNumber");
40031          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40032            composeUnsignedIntExtras(null, e, true);
40033          closeArray();
40034        }
40035      };
40036  }
40037
40038  protected void composeActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
40039    if (element != null) {
40040      open(name);
40041      composeActionSubjectComponentProperties(element);
40042      close();
40043    }
40044  }
40045
40046  protected void composeActionSubjectComponentProperties(Contract.ActionSubjectComponent element) throws IOException {
40047    composeBackboneElementProperties(element);
40048      if (element.hasReference()) {
40049        openArray("reference");
40050        for (Reference e : element.getReference()) 
40051          composeReference(null, e);
40052        closeArray();
40053      };
40054      if (element.hasRole()) {
40055        composeCodeableConcept("role", element.getRole());
40056      }
40057  }
40058
40059  protected void composeSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
40060    if (element != null) {
40061      open(name);
40062      composeSignatoryComponentProperties(element);
40063      close();
40064    }
40065  }
40066
40067  protected void composeSignatoryComponentProperties(Contract.SignatoryComponent element) throws IOException {
40068    composeBackboneElementProperties(element);
40069      if (element.hasType()) {
40070        composeCoding("type", element.getType());
40071      }
40072      if (element.hasParty()) {
40073        composeReference("party", element.getParty());
40074      }
40075      if (element.hasSignature()) {
40076        openArray("signature");
40077        for (Signature e : element.getSignature()) 
40078          composeSignature(null, e);
40079        closeArray();
40080      };
40081  }
40082
40083  protected void composeFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
40084    if (element != null) {
40085      open(name);
40086      composeFriendlyLanguageComponentProperties(element);
40087      close();
40088    }
40089  }
40090
40091  protected void composeFriendlyLanguageComponentProperties(Contract.FriendlyLanguageComponent element) throws IOException {
40092    composeBackboneElementProperties(element);
40093      if (element.hasContent()) {
40094        composeType("content", element.getContent());
40095      }
40096  }
40097
40098  protected void composeLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
40099    if (element != null) {
40100      open(name);
40101      composeLegalLanguageComponentProperties(element);
40102      close();
40103    }
40104  }
40105
40106  protected void composeLegalLanguageComponentProperties(Contract.LegalLanguageComponent element) throws IOException {
40107    composeBackboneElementProperties(element);
40108      if (element.hasContent()) {
40109        composeType("content", element.getContent());
40110      }
40111  }
40112
40113  protected void composeComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
40114    if (element != null) {
40115      open(name);
40116      composeComputableLanguageComponentProperties(element);
40117      close();
40118    }
40119  }
40120
40121  protected void composeComputableLanguageComponentProperties(Contract.ComputableLanguageComponent element) throws IOException {
40122    composeBackboneElementProperties(element);
40123      if (element.hasContent()) {
40124        composeType("content", element.getContent());
40125      }
40126  }
40127
40128  protected void composeCoverage(String name, Coverage element) throws IOException {
40129    if (element != null) {
40130      prop("resourceType", name);
40131      composeCoverageProperties(element);
40132    }
40133  }
40134
40135  protected void composeCoverageProperties(Coverage element) throws IOException {
40136    composeDomainResourceProperties(element);
40137      if (element.hasIdentifier()) {
40138        openArray("identifier");
40139        for (Identifier e : element.getIdentifier()) 
40140          composeIdentifier(null, e);
40141        closeArray();
40142      };
40143      if (element.hasStatusElement()) {
40144        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40145        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40146      }
40147      if (element.hasType()) {
40148        composeCodeableConcept("type", element.getType());
40149      }
40150      if (element.hasPolicyHolder()) {
40151        composeReference("policyHolder", element.getPolicyHolder());
40152      }
40153      if (element.hasSubscriber()) {
40154        composeReference("subscriber", element.getSubscriber());
40155      }
40156      if (element.hasSubscriberIdElement()) {
40157        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
40158        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
40159      }
40160      if (element.hasBeneficiary()) {
40161        composeReference("beneficiary", element.getBeneficiary());
40162      }
40163      if (element.hasDependentElement()) {
40164        composeStringCore("dependent", element.getDependentElement(), false);
40165        composeStringExtras("dependent", element.getDependentElement(), false);
40166      }
40167      if (element.hasRelationship()) {
40168        composeCodeableConcept("relationship", element.getRelationship());
40169      }
40170      if (element.hasPeriod()) {
40171        composePeriod("period", element.getPeriod());
40172      }
40173      if (element.hasPayor()) {
40174        openArray("payor");
40175        for (Reference e : element.getPayor()) 
40176          composeReference(null, e);
40177        closeArray();
40178      };
40179      if (element.hasClass_()) {
40180        openArray("class");
40181        for (Coverage.ClassComponent e : element.getClass_()) 
40182          composeClassComponent(null, e);
40183        closeArray();
40184      };
40185      if (element.hasOrderElement()) {
40186        composePositiveIntCore("order", element.getOrderElement(), false);
40187        composePositiveIntExtras("order", element.getOrderElement(), false);
40188      }
40189      if (element.hasNetworkElement()) {
40190        composeStringCore("network", element.getNetworkElement(), false);
40191        composeStringExtras("network", element.getNetworkElement(), false);
40192      }
40193      if (element.hasCostToBeneficiary()) {
40194        openArray("costToBeneficiary");
40195        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
40196          composeCostToBeneficiaryComponent(null, e);
40197        closeArray();
40198      };
40199      if (element.hasSubrogationElement()) {
40200        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
40201        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
40202      }
40203      if (element.hasContract()) {
40204        openArray("contract");
40205        for (Reference e : element.getContract()) 
40206          composeReference(null, e);
40207        closeArray();
40208      };
40209  }
40210
40211  protected void composeClassComponent(String name, Coverage.ClassComponent element) throws IOException {
40212    if (element != null) {
40213      open(name);
40214      composeClassComponentProperties(element);
40215      close();
40216    }
40217  }
40218
40219  protected void composeClassComponentProperties(Coverage.ClassComponent element) throws IOException {
40220    composeBackboneElementProperties(element);
40221      if (element.hasType()) {
40222        composeCodeableConcept("type", element.getType());
40223      }
40224      if (element.hasValueElement()) {
40225        composeStringCore("value", element.getValueElement(), false);
40226        composeStringExtras("value", element.getValueElement(), false);
40227      }
40228      if (element.hasNameElement()) {
40229        composeStringCore("name", element.getNameElement(), false);
40230        composeStringExtras("name", element.getNameElement(), false);
40231      }
40232  }
40233
40234  protected void composeCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
40235    if (element != null) {
40236      open(name);
40237      composeCostToBeneficiaryComponentProperties(element);
40238      close();
40239    }
40240  }
40241
40242  protected void composeCostToBeneficiaryComponentProperties(Coverage.CostToBeneficiaryComponent element) throws IOException {
40243    composeBackboneElementProperties(element);
40244      if (element.hasType()) {
40245        composeCodeableConcept("type", element.getType());
40246      }
40247      if (element.hasValue()) {
40248        composeType("value", element.getValue());
40249      }
40250      if (element.hasException()) {
40251        openArray("exception");
40252        for (Coverage.ExemptionComponent e : element.getException()) 
40253          composeExemptionComponent(null, e);
40254        closeArray();
40255      };
40256  }
40257
40258  protected void composeExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
40259    if (element != null) {
40260      open(name);
40261      composeExemptionComponentProperties(element);
40262      close();
40263    }
40264  }
40265
40266  protected void composeExemptionComponentProperties(Coverage.ExemptionComponent element) throws IOException {
40267    composeBackboneElementProperties(element);
40268      if (element.hasType()) {
40269        composeCodeableConcept("type", element.getType());
40270      }
40271      if (element.hasPeriod()) {
40272        composePeriod("period", element.getPeriod());
40273      }
40274  }
40275
40276  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
40277    if (element != null) {
40278      prop("resourceType", name);
40279      composeCoverageEligibilityRequestProperties(element);
40280    }
40281  }
40282
40283  protected void composeCoverageEligibilityRequestProperties(CoverageEligibilityRequest element) throws IOException {
40284    composeDomainResourceProperties(element);
40285      if (element.hasIdentifier()) {
40286        openArray("identifier");
40287        for (Identifier e : element.getIdentifier()) 
40288          composeIdentifier(null, e);
40289        closeArray();
40290      };
40291      if (element.hasStatusElement()) {
40292        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40293        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40294      }
40295      if (element.hasPriority()) {
40296        composeCodeableConcept("priority", element.getPriority());
40297      }
40298      if (element.hasPurpose()) {
40299        openArray("purpose");
40300        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
40301          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
40302        closeArray();
40303        if (anyHasExtras(element.getPurpose())) {
40304          openArray("_purpose");
40305          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
40306            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
40307          closeArray();
40308        }
40309      };
40310      if (element.hasPatient()) {
40311        composeReference("patient", element.getPatient());
40312      }
40313      if (element.hasServiced()) {
40314        composeType("serviced", element.getServiced());
40315      }
40316      if (element.hasCreatedElement()) {
40317        composeDateTimeCore("created", element.getCreatedElement(), false);
40318        composeDateTimeExtras("created", element.getCreatedElement(), false);
40319      }
40320      if (element.hasEnterer()) {
40321        composeReference("enterer", element.getEnterer());
40322      }
40323      if (element.hasProvider()) {
40324        composeReference("provider", element.getProvider());
40325      }
40326      if (element.hasInsurer()) {
40327        composeReference("insurer", element.getInsurer());
40328      }
40329      if (element.hasFacility()) {
40330        composeReference("facility", element.getFacility());
40331      }
40332      if (element.hasSupportingInfo()) {
40333        openArray("supportingInfo");
40334        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
40335          composeSupportingInformationComponent(null, e);
40336        closeArray();
40337      };
40338      if (element.hasInsurance()) {
40339        openArray("insurance");
40340        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
40341          composeInsuranceComponent(null, e);
40342        closeArray();
40343      };
40344      if (element.hasItem()) {
40345        openArray("item");
40346        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
40347          composeDetailsComponent(null, e);
40348        closeArray();
40349      };
40350  }
40351
40352  protected void composeSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
40353    if (element != null) {
40354      open(name);
40355      composeSupportingInformationComponentProperties(element);
40356      close();
40357    }
40358  }
40359
40360  protected void composeSupportingInformationComponentProperties(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
40361    composeBackboneElementProperties(element);
40362      if (element.hasSequenceElement()) {
40363        composePositiveIntCore("sequence", element.getSequenceElement(), false);
40364        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
40365      }
40366      if (element.hasInformation()) {
40367        composeReference("information", element.getInformation());
40368      }
40369      if (element.hasAppliesToAllElement()) {
40370        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
40371        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
40372      }
40373  }
40374
40375  protected void composeInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
40376    if (element != null) {
40377      open(name);
40378      composeInsuranceComponentProperties(element);
40379      close();
40380    }
40381  }
40382
40383  protected void composeInsuranceComponentProperties(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
40384    composeBackboneElementProperties(element);
40385      if (element.hasFocalElement()) {
40386        composeBooleanCore("focal", element.getFocalElement(), false);
40387        composeBooleanExtras("focal", element.getFocalElement(), false);
40388      }
40389      if (element.hasCoverage()) {
40390        composeReference("coverage", element.getCoverage());
40391      }
40392      if (element.hasBusinessArrangementElement()) {
40393        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
40394        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
40395      }
40396  }
40397
40398  protected void composeDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
40399    if (element != null) {
40400      open(name);
40401      composeDetailsComponentProperties(element);
40402      close();
40403    }
40404  }
40405
40406  protected void composeDetailsComponentProperties(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
40407    composeBackboneElementProperties(element);
40408      if (element.hasSupportingInfoSequence()) {
40409        if (anyHasValue(element.getSupportingInfoSequence())) {
40410          openArray("supportingInfoSequence");
40411          for (PositiveIntType e : element.getSupportingInfoSequence()) 
40412            composePositiveIntCore(null, e, e != element.getSupportingInfoSequence().get(element.getSupportingInfoSequence().size()-1));
40413          closeArray();
40414        }
40415        if (anyHasExtras(element.getSupportingInfoSequence())) {
40416          openArray("_supportingInfoSequence");
40417          for (PositiveIntType e : element.getSupportingInfoSequence()) 
40418            composePositiveIntExtras(null, e, true);
40419          closeArray();
40420        }
40421      };
40422      if (element.hasCategory()) {
40423        composeCodeableConcept("category", element.getCategory());
40424      }
40425      if (element.hasProductOrService()) {
40426        composeCodeableConcept("productOrService", element.getProductOrService());
40427      }
40428      if (element.hasModifier()) {
40429        openArray("modifier");
40430        for (CodeableConcept e : element.getModifier()) 
40431          composeCodeableConcept(null, e);
40432        closeArray();
40433      };
40434      if (element.hasProvider()) {
40435        composeReference("provider", element.getProvider());
40436      }
40437      if (element.hasQuantity()) {
40438        composeQuantity("quantity", element.getQuantity());
40439      }
40440      if (element.hasUnitPrice()) {
40441        composeMoney("unitPrice", element.getUnitPrice());
40442      }
40443      if (element.hasFacility()) {
40444        composeReference("facility", element.getFacility());
40445      }
40446      if (element.hasDiagnosis()) {
40447        openArray("diagnosis");
40448        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
40449          composeDiagnosisComponent(null, e);
40450        closeArray();
40451      };
40452      if (element.hasDetail()) {
40453        openArray("detail");
40454        for (Reference e : element.getDetail()) 
40455          composeReference(null, e);
40456        closeArray();
40457      };
40458  }
40459
40460  protected void composeDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
40461    if (element != null) {
40462      open(name);
40463      composeDiagnosisComponentProperties(element);
40464      close();
40465    }
40466  }
40467
40468  protected void composeDiagnosisComponentProperties(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
40469    composeBackboneElementProperties(element);
40470      if (element.hasDiagnosis()) {
40471        composeType("diagnosis", element.getDiagnosis());
40472      }
40473  }
40474
40475  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
40476    if (element != null) {
40477      prop("resourceType", name);
40478      composeCoverageEligibilityResponseProperties(element);
40479    }
40480  }
40481
40482  protected void composeCoverageEligibilityResponseProperties(CoverageEligibilityResponse element) throws IOException {
40483    composeDomainResourceProperties(element);
40484      if (element.hasIdentifier()) {
40485        openArray("identifier");
40486        for (Identifier e : element.getIdentifier()) 
40487          composeIdentifier(null, e);
40488        closeArray();
40489      };
40490      if (element.hasStatusElement()) {
40491        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40492        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40493      }
40494      if (element.hasPurpose()) {
40495        openArray("purpose");
40496        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
40497          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
40498        closeArray();
40499        if (anyHasExtras(element.getPurpose())) {
40500          openArray("_purpose");
40501          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
40502            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
40503          closeArray();
40504        }
40505      };
40506      if (element.hasPatient()) {
40507        composeReference("patient", element.getPatient());
40508      }
40509      if (element.hasServiced()) {
40510        composeType("serviced", element.getServiced());
40511      }
40512      if (element.hasCreatedElement()) {
40513        composeDateTimeCore("created", element.getCreatedElement(), false);
40514        composeDateTimeExtras("created", element.getCreatedElement(), false);
40515      }
40516      if (element.hasRequestor()) {
40517        composeReference("requestor", element.getRequestor());
40518      }
40519      if (element.hasRequest()) {
40520        composeReference("request", element.getRequest());
40521      }
40522      if (element.hasOutcomeElement()) {
40523        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
40524        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
40525      }
40526      if (element.hasDispositionElement()) {
40527        composeStringCore("disposition", element.getDispositionElement(), false);
40528        composeStringExtras("disposition", element.getDispositionElement(), false);
40529      }
40530      if (element.hasInsurer()) {
40531        composeReference("insurer", element.getInsurer());
40532      }
40533      if (element.hasInsurance()) {
40534        openArray("insurance");
40535        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
40536          composeInsuranceComponent(null, e);
40537        closeArray();
40538      };
40539      if (element.hasPreAuthRefElement()) {
40540        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
40541        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
40542      }
40543      if (element.hasForm()) {
40544        composeCodeableConcept("form", element.getForm());
40545      }
40546      if (element.hasError()) {
40547        openArray("error");
40548        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
40549          composeErrorsComponent(null, e);
40550        closeArray();
40551      };
40552  }
40553
40554  protected void composeInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
40555    if (element != null) {
40556      open(name);
40557      composeInsuranceComponentProperties(element);
40558      close();
40559    }
40560  }
40561
40562  protected void composeInsuranceComponentProperties(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
40563    composeBackboneElementProperties(element);
40564      if (element.hasCoverage()) {
40565        composeReference("coverage", element.getCoverage());
40566      }
40567      if (element.hasInforceElement()) {
40568        composeBooleanCore("inforce", element.getInforceElement(), false);
40569        composeBooleanExtras("inforce", element.getInforceElement(), false);
40570      }
40571      if (element.hasBenefitPeriod()) {
40572        composePeriod("benefitPeriod", element.getBenefitPeriod());
40573      }
40574      if (element.hasItem()) {
40575        openArray("item");
40576        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
40577          composeItemsComponent(null, e);
40578        closeArray();
40579      };
40580  }
40581
40582  protected void composeItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
40583    if (element != null) {
40584      open(name);
40585      composeItemsComponentProperties(element);
40586      close();
40587    }
40588  }
40589
40590  protected void composeItemsComponentProperties(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
40591    composeBackboneElementProperties(element);
40592      if (element.hasCategory()) {
40593        composeCodeableConcept("category", element.getCategory());
40594      }
40595      if (element.hasProductOrService()) {
40596        composeCodeableConcept("productOrService", element.getProductOrService());
40597      }
40598      if (element.hasModifier()) {
40599        openArray("modifier");
40600        for (CodeableConcept e : element.getModifier()) 
40601          composeCodeableConcept(null, e);
40602        closeArray();
40603      };
40604      if (element.hasProvider()) {
40605        composeReference("provider", element.getProvider());
40606      }
40607      if (element.hasExcludedElement()) {
40608        composeBooleanCore("excluded", element.getExcludedElement(), false);
40609        composeBooleanExtras("excluded", element.getExcludedElement(), false);
40610      }
40611      if (element.hasNameElement()) {
40612        composeStringCore("name", element.getNameElement(), false);
40613        composeStringExtras("name", element.getNameElement(), false);
40614      }
40615      if (element.hasDescriptionElement()) {
40616        composeStringCore("description", element.getDescriptionElement(), false);
40617        composeStringExtras("description", element.getDescriptionElement(), false);
40618      }
40619      if (element.hasNetwork()) {
40620        composeCodeableConcept("network", element.getNetwork());
40621      }
40622      if (element.hasUnit()) {
40623        composeCodeableConcept("unit", element.getUnit());
40624      }
40625      if (element.hasTerm()) {
40626        composeCodeableConcept("term", element.getTerm());
40627      }
40628      if (element.hasBenefit()) {
40629        openArray("benefit");
40630        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
40631          composeBenefitComponent(null, e);
40632        closeArray();
40633      };
40634      if (element.hasAuthorizationRequiredElement()) {
40635        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
40636        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
40637      }
40638      if (element.hasAuthorizationSupporting()) {
40639        openArray("authorizationSupporting");
40640        for (CodeableConcept e : element.getAuthorizationSupporting()) 
40641          composeCodeableConcept(null, e);
40642        closeArray();
40643      };
40644      if (element.hasAuthorizationUrlElement()) {
40645        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
40646        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
40647      }
40648  }
40649
40650  protected void composeBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
40651    if (element != null) {
40652      open(name);
40653      composeBenefitComponentProperties(element);
40654      close();
40655    }
40656  }
40657
40658  protected void composeBenefitComponentProperties(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
40659    composeBackboneElementProperties(element);
40660      if (element.hasType()) {
40661        composeCodeableConcept("type", element.getType());
40662      }
40663      if (element.hasAllowed()) {
40664        composeType("allowed", element.getAllowed());
40665      }
40666      if (element.hasUsed()) {
40667        composeType("used", element.getUsed());
40668      }
40669  }
40670
40671  protected void composeErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
40672    if (element != null) {
40673      open(name);
40674      composeErrorsComponentProperties(element);
40675      close();
40676    }
40677  }
40678
40679  protected void composeErrorsComponentProperties(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
40680    composeBackboneElementProperties(element);
40681      if (element.hasCode()) {
40682        composeCodeableConcept("code", element.getCode());
40683      }
40684  }
40685
40686  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
40687    if (element != null) {
40688      prop("resourceType", name);
40689      composeDetectedIssueProperties(element);
40690    }
40691  }
40692
40693  protected void composeDetectedIssueProperties(DetectedIssue element) throws IOException {
40694    composeDomainResourceProperties(element);
40695      if (element.hasIdentifier()) {
40696        openArray("identifier");
40697        for (Identifier e : element.getIdentifier()) 
40698          composeIdentifier(null, e);
40699        closeArray();
40700      };
40701      if (element.hasStatusElement()) {
40702        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
40703        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
40704      }
40705      if (element.hasCode()) {
40706        composeCodeableConcept("code", element.getCode());
40707      }
40708      if (element.hasSeverityElement()) {
40709        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
40710        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
40711      }
40712      if (element.hasPatient()) {
40713        composeReference("patient", element.getPatient());
40714      }
40715      if (element.hasIdentified()) {
40716        composeType("identified", element.getIdentified());
40717      }
40718      if (element.hasAuthor()) {
40719        composeReference("author", element.getAuthor());
40720      }
40721      if (element.hasImplicated()) {
40722        openArray("implicated");
40723        for (Reference e : element.getImplicated()) 
40724          composeReference(null, e);
40725        closeArray();
40726      };
40727      if (element.hasEvidence()) {
40728        openArray("evidence");
40729        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
40730          composeDetectedIssueEvidenceComponent(null, e);
40731        closeArray();
40732      };
40733      if (element.hasDetailElement()) {
40734        composeStringCore("detail", element.getDetailElement(), false);
40735        composeStringExtras("detail", element.getDetailElement(), false);
40736      }
40737      if (element.hasReferenceElement()) {
40738        composeUriCore("reference", element.getReferenceElement(), false);
40739        composeUriExtras("reference", element.getReferenceElement(), false);
40740      }
40741      if (element.hasMitigation()) {
40742        openArray("mitigation");
40743        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
40744          composeDetectedIssueMitigationComponent(null, e);
40745        closeArray();
40746      };
40747  }
40748
40749  protected void composeDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
40750    if (element != null) {
40751      open(name);
40752      composeDetectedIssueEvidenceComponentProperties(element);
40753      close();
40754    }
40755  }
40756
40757  protected void composeDetectedIssueEvidenceComponentProperties(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
40758    composeBackboneElementProperties(element);
40759      if (element.hasCode()) {
40760        openArray("code");
40761        for (CodeableConcept e : element.getCode()) 
40762          composeCodeableConcept(null, e);
40763        closeArray();
40764      };
40765      if (element.hasDetail()) {
40766        openArray("detail");
40767        for (Reference e : element.getDetail()) 
40768          composeReference(null, e);
40769        closeArray();
40770      };
40771  }
40772
40773  protected void composeDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
40774    if (element != null) {
40775      open(name);
40776      composeDetectedIssueMitigationComponentProperties(element);
40777      close();
40778    }
40779  }
40780
40781  protected void composeDetectedIssueMitigationComponentProperties(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
40782    composeBackboneElementProperties(element);
40783      if (element.hasAction()) {
40784        composeCodeableConcept("action", element.getAction());
40785      }
40786      if (element.hasDateElement()) {
40787        composeDateTimeCore("date", element.getDateElement(), false);
40788        composeDateTimeExtras("date", element.getDateElement(), false);
40789      }
40790      if (element.hasAuthor()) {
40791        composeReference("author", element.getAuthor());
40792      }
40793  }
40794
40795  protected void composeDevice(String name, Device element) throws IOException {
40796    if (element != null) {
40797      prop("resourceType", name);
40798      composeDeviceProperties(element);
40799    }
40800  }
40801
40802  protected void composeDeviceProperties(Device element) throws IOException {
40803    composeDomainResourceProperties(element);
40804      if (element.hasIdentifier()) {
40805        openArray("identifier");
40806        for (Identifier e : element.getIdentifier()) 
40807          composeIdentifier(null, e);
40808        closeArray();
40809      };
40810      if (element.hasDefinition()) {
40811        composeReference("definition", element.getDefinition());
40812      }
40813      if (element.hasUdiCarrier()) {
40814        openArray("udiCarrier");
40815        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
40816          composeDeviceUdiCarrierComponent(null, e);
40817        closeArray();
40818      };
40819      if (element.hasStatusElement()) {
40820        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
40821        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
40822      }
40823      if (element.hasStatusReason()) {
40824        openArray("statusReason");
40825        for (CodeableConcept e : element.getStatusReason()) 
40826          composeCodeableConcept(null, e);
40827        closeArray();
40828      };
40829      if (element.hasDistinctIdentifierElement()) {
40830        composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
40831        composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
40832      }
40833      if (element.hasManufacturerElement()) {
40834        composeStringCore("manufacturer", element.getManufacturerElement(), false);
40835        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
40836      }
40837      if (element.hasManufactureDateElement()) {
40838        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
40839        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
40840      }
40841      if (element.hasExpirationDateElement()) {
40842        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
40843        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
40844      }
40845      if (element.hasLotNumberElement()) {
40846        composeStringCore("lotNumber", element.getLotNumberElement(), false);
40847        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
40848      }
40849      if (element.hasSerialNumberElement()) {
40850        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
40851        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
40852      }
40853      if (element.hasDeviceName()) {
40854        openArray("deviceName");
40855        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
40856          composeDeviceDeviceNameComponent(null, e);
40857        closeArray();
40858      };
40859      if (element.hasModelNumberElement()) {
40860        composeStringCore("modelNumber", element.getModelNumberElement(), false);
40861        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
40862      }
40863      if (element.hasPartNumberElement()) {
40864        composeStringCore("partNumber", element.getPartNumberElement(), false);
40865        composeStringExtras("partNumber", element.getPartNumberElement(), false);
40866      }
40867      if (element.hasType()) {
40868        composeCodeableConcept("type", element.getType());
40869      }
40870      if (element.hasSpecialization()) {
40871        openArray("specialization");
40872        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
40873          composeDeviceSpecializationComponent(null, e);
40874        closeArray();
40875      };
40876      if (element.hasVersion()) {
40877        openArray("version");
40878        for (Device.DeviceVersionComponent e : element.getVersion()) 
40879          composeDeviceVersionComponent(null, e);
40880        closeArray();
40881      };
40882      if (element.hasProperty()) {
40883        openArray("property");
40884        for (Device.DevicePropertyComponent e : element.getProperty()) 
40885          composeDevicePropertyComponent(null, e);
40886        closeArray();
40887      };
40888      if (element.hasPatient()) {
40889        composeReference("patient", element.getPatient());
40890      }
40891      if (element.hasOwner()) {
40892        composeReference("owner", element.getOwner());
40893      }
40894      if (element.hasContact()) {
40895        openArray("contact");
40896        for (ContactPoint e : element.getContact()) 
40897          composeContactPoint(null, e);
40898        closeArray();
40899      };
40900      if (element.hasLocation()) {
40901        composeReference("location", element.getLocation());
40902      }
40903      if (element.hasUrlElement()) {
40904        composeUriCore("url", element.getUrlElement(), false);
40905        composeUriExtras("url", element.getUrlElement(), false);
40906      }
40907      if (element.hasNote()) {
40908        openArray("note");
40909        for (Annotation e : element.getNote()) 
40910          composeAnnotation(null, e);
40911        closeArray();
40912      };
40913      if (element.hasSafety()) {
40914        openArray("safety");
40915        for (CodeableConcept e : element.getSafety()) 
40916          composeCodeableConcept(null, e);
40917        closeArray();
40918      };
40919      if (element.hasParent()) {
40920        composeReference("parent", element.getParent());
40921      }
40922  }
40923
40924  protected void composeDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
40925    if (element != null) {
40926      open(name);
40927      composeDeviceUdiCarrierComponentProperties(element);
40928      close();
40929    }
40930  }
40931
40932  protected void composeDeviceUdiCarrierComponentProperties(Device.DeviceUdiCarrierComponent element) throws IOException {
40933    composeBackboneElementProperties(element);
40934      if (element.hasDeviceIdentifierElement()) {
40935        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
40936        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
40937      }
40938      if (element.hasIssuerElement()) {
40939        composeUriCore("issuer", element.getIssuerElement(), false);
40940        composeUriExtras("issuer", element.getIssuerElement(), false);
40941      }
40942      if (element.hasJurisdictionElement()) {
40943        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
40944        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
40945      }
40946      if (element.hasCarrierAIDCElement()) {
40947        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
40948        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
40949      }
40950      if (element.hasCarrierHRFElement()) {
40951        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
40952        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
40953      }
40954      if (element.hasEntryTypeElement()) {
40955        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
40956        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
40957      }
40958  }
40959
40960  protected void composeDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
40961    if (element != null) {
40962      open(name);
40963      composeDeviceDeviceNameComponentProperties(element);
40964      close();
40965    }
40966  }
40967
40968  protected void composeDeviceDeviceNameComponentProperties(Device.DeviceDeviceNameComponent element) throws IOException {
40969    composeBackboneElementProperties(element);
40970      if (element.hasNameElement()) {
40971        composeStringCore("name", element.getNameElement(), false);
40972        composeStringExtras("name", element.getNameElement(), false);
40973      }
40974      if (element.hasTypeElement()) {
40975        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
40976        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
40977      }
40978  }
40979
40980  protected void composeDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
40981    if (element != null) {
40982      open(name);
40983      composeDeviceSpecializationComponentProperties(element);
40984      close();
40985    }
40986  }
40987
40988  protected void composeDeviceSpecializationComponentProperties(Device.DeviceSpecializationComponent element) throws IOException {
40989    composeBackboneElementProperties(element);
40990      if (element.hasSystemType()) {
40991        composeCodeableConcept("systemType", element.getSystemType());
40992      }
40993      if (element.hasVersionElement()) {
40994        composeStringCore("version", element.getVersionElement(), false);
40995        composeStringExtras("version", element.getVersionElement(), false);
40996      }
40997  }
40998
40999  protected void composeDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
41000    if (element != null) {
41001      open(name);
41002      composeDeviceVersionComponentProperties(element);
41003      close();
41004    }
41005  }
41006
41007  protected void composeDeviceVersionComponentProperties(Device.DeviceVersionComponent element) throws IOException {
41008    composeBackboneElementProperties(element);
41009      if (element.hasType()) {
41010        composeCodeableConcept("type", element.getType());
41011      }
41012      if (element.hasComponent()) {
41013        composeIdentifier("component", element.getComponent());
41014      }
41015      if (element.hasValueElement()) {
41016        composeStringCore("value", element.getValueElement(), false);
41017        composeStringExtras("value", element.getValueElement(), false);
41018      }
41019  }
41020
41021  protected void composeDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
41022    if (element != null) {
41023      open(name);
41024      composeDevicePropertyComponentProperties(element);
41025      close();
41026    }
41027  }
41028
41029  protected void composeDevicePropertyComponentProperties(Device.DevicePropertyComponent element) throws IOException {
41030    composeBackboneElementProperties(element);
41031      if (element.hasType()) {
41032        composeCodeableConcept("type", element.getType());
41033      }
41034      if (element.hasValueQuantity()) {
41035        openArray("valueQuantity");
41036        for (Quantity e : element.getValueQuantity()) 
41037          composeQuantity(null, e);
41038        closeArray();
41039      };
41040      if (element.hasValueCode()) {
41041        openArray("valueCode");
41042        for (CodeableConcept e : element.getValueCode()) 
41043          composeCodeableConcept(null, e);
41044        closeArray();
41045      };
41046  }
41047
41048  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
41049    if (element != null) {
41050      prop("resourceType", name);
41051      composeDeviceDefinitionProperties(element);
41052    }
41053  }
41054
41055  protected void composeDeviceDefinitionProperties(DeviceDefinition element) throws IOException {
41056    composeDomainResourceProperties(element);
41057      if (element.hasIdentifier()) {
41058        openArray("identifier");
41059        for (Identifier e : element.getIdentifier()) 
41060          composeIdentifier(null, e);
41061        closeArray();
41062      };
41063      if (element.hasUdiDeviceIdentifier()) {
41064        openArray("udiDeviceIdentifier");
41065        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
41066          composeDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
41067        closeArray();
41068      };
41069      if (element.hasManufacturer()) {
41070        composeType("manufacturer", element.getManufacturer());
41071      }
41072      if (element.hasDeviceName()) {
41073        openArray("deviceName");
41074        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
41075          composeDeviceDefinitionDeviceNameComponent(null, e);
41076        closeArray();
41077      };
41078      if (element.hasModelNumberElement()) {
41079        composeStringCore("modelNumber", element.getModelNumberElement(), false);
41080        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
41081      }
41082      if (element.hasType()) {
41083        composeCodeableConcept("type", element.getType());
41084      }
41085      if (element.hasSpecialization()) {
41086        openArray("specialization");
41087        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
41088          composeDeviceDefinitionSpecializationComponent(null, e);
41089        closeArray();
41090      };
41091      if (element.hasVersion()) {
41092        if (anyHasValue(element.getVersion())) {
41093          openArray("version");
41094          for (StringType e : element.getVersion()) 
41095            composeStringCore(null, e, e != element.getVersion().get(element.getVersion().size()-1));
41096          closeArray();
41097        }
41098        if (anyHasExtras(element.getVersion())) {
41099          openArray("_version");
41100          for (StringType e : element.getVersion()) 
41101            composeStringExtras(null, e, true);
41102          closeArray();
41103        }
41104      };
41105      if (element.hasSafety()) {
41106        openArray("safety");
41107        for (CodeableConcept e : element.getSafety()) 
41108          composeCodeableConcept(null, e);
41109        closeArray();
41110      };
41111      if (element.hasShelfLifeStorage()) {
41112        openArray("shelfLifeStorage");
41113        for (ProductShelfLife e : element.getShelfLifeStorage()) 
41114          composeProductShelfLife(null, e);
41115        closeArray();
41116      };
41117      if (element.hasPhysicalCharacteristics()) {
41118        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
41119      }
41120      if (element.hasLanguageCode()) {
41121        openArray("languageCode");
41122        for (CodeableConcept e : element.getLanguageCode()) 
41123          composeCodeableConcept(null, e);
41124        closeArray();
41125      };
41126      if (element.hasCapability()) {
41127        openArray("capability");
41128        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
41129          composeDeviceDefinitionCapabilityComponent(null, e);
41130        closeArray();
41131      };
41132      if (element.hasProperty()) {
41133        openArray("property");
41134        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
41135          composeDeviceDefinitionPropertyComponent(null, e);
41136        closeArray();
41137      };
41138      if (element.hasOwner()) {
41139        composeReference("owner", element.getOwner());
41140      }
41141      if (element.hasContact()) {
41142        openArray("contact");
41143        for (ContactPoint e : element.getContact()) 
41144          composeContactPoint(null, e);
41145        closeArray();
41146      };
41147      if (element.hasUrlElement()) {
41148        composeUriCore("url", element.getUrlElement(), false);
41149        composeUriExtras("url", element.getUrlElement(), false);
41150      }
41151      if (element.hasOnlineInformationElement()) {
41152        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
41153        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
41154      }
41155      if (element.hasNote()) {
41156        openArray("note");
41157        for (Annotation e : element.getNote()) 
41158          composeAnnotation(null, e);
41159        closeArray();
41160      };
41161      if (element.hasQuantity()) {
41162        composeQuantity("quantity", element.getQuantity());
41163      }
41164      if (element.hasParentDevice()) {
41165        composeReference("parentDevice", element.getParentDevice());
41166      }
41167      if (element.hasMaterial()) {
41168        openArray("material");
41169        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
41170          composeDeviceDefinitionMaterialComponent(null, e);
41171        closeArray();
41172      };
41173  }
41174
41175  protected void composeDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
41176    if (element != null) {
41177      open(name);
41178      composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(element);
41179      close();
41180    }
41181  }
41182
41183  protected void composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
41184    composeBackboneElementProperties(element);
41185      if (element.hasDeviceIdentifierElement()) {
41186        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
41187        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
41188      }
41189      if (element.hasIssuerElement()) {
41190        composeUriCore("issuer", element.getIssuerElement(), false);
41191        composeUriExtras("issuer", element.getIssuerElement(), false);
41192      }
41193      if (element.hasJurisdictionElement()) {
41194        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
41195        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
41196      }
41197  }
41198
41199  protected void composeDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
41200    if (element != null) {
41201      open(name);
41202      composeDeviceDefinitionDeviceNameComponentProperties(element);
41203      close();
41204    }
41205  }
41206
41207  protected void composeDeviceDefinitionDeviceNameComponentProperties(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
41208    composeBackboneElementProperties(element);
41209      if (element.hasNameElement()) {
41210        composeStringCore("name", element.getNameElement(), false);
41211        composeStringExtras("name", element.getNameElement(), false);
41212      }
41213      if (element.hasTypeElement()) {
41214        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
41215        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
41216      }
41217  }
41218
41219  protected void composeDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
41220    if (element != null) {
41221      open(name);
41222      composeDeviceDefinitionSpecializationComponentProperties(element);
41223      close();
41224    }
41225  }
41226
41227  protected void composeDeviceDefinitionSpecializationComponentProperties(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
41228    composeBackboneElementProperties(element);
41229      if (element.hasSystemTypeElement()) {
41230        composeStringCore("systemType", element.getSystemTypeElement(), false);
41231        composeStringExtras("systemType", element.getSystemTypeElement(), false);
41232      }
41233      if (element.hasVersionElement()) {
41234        composeStringCore("version", element.getVersionElement(), false);
41235        composeStringExtras("version", element.getVersionElement(), false);
41236      }
41237  }
41238
41239  protected void composeDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
41240    if (element != null) {
41241      open(name);
41242      composeDeviceDefinitionCapabilityComponentProperties(element);
41243      close();
41244    }
41245  }
41246
41247  protected void composeDeviceDefinitionCapabilityComponentProperties(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
41248    composeBackboneElementProperties(element);
41249      if (element.hasType()) {
41250        composeCodeableConcept("type", element.getType());
41251      }
41252      if (element.hasDescription()) {
41253        openArray("description");
41254        for (CodeableConcept e : element.getDescription()) 
41255          composeCodeableConcept(null, e);
41256        closeArray();
41257      };
41258  }
41259
41260  protected void composeDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
41261    if (element != null) {
41262      open(name);
41263      composeDeviceDefinitionPropertyComponentProperties(element);
41264      close();
41265    }
41266  }
41267
41268  protected void composeDeviceDefinitionPropertyComponentProperties(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
41269    composeBackboneElementProperties(element);
41270      if (element.hasType()) {
41271        composeCodeableConcept("type", element.getType());
41272      }
41273      if (element.hasValueQuantity()) {
41274        openArray("valueQuantity");
41275        for (Quantity e : element.getValueQuantity()) 
41276          composeQuantity(null, e);
41277        closeArray();
41278      };
41279      if (element.hasValueCode()) {
41280        openArray("valueCode");
41281        for (CodeableConcept e : element.getValueCode()) 
41282          composeCodeableConcept(null, e);
41283        closeArray();
41284      };
41285  }
41286
41287  protected void composeDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
41288    if (element != null) {
41289      open(name);
41290      composeDeviceDefinitionMaterialComponentProperties(element);
41291      close();
41292    }
41293  }
41294
41295  protected void composeDeviceDefinitionMaterialComponentProperties(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
41296    composeBackboneElementProperties(element);
41297      if (element.hasSubstance()) {
41298        composeCodeableConcept("substance", element.getSubstance());
41299      }
41300      if (element.hasAlternateElement()) {
41301        composeBooleanCore("alternate", element.getAlternateElement(), false);
41302        composeBooleanExtras("alternate", element.getAlternateElement(), false);
41303      }
41304      if (element.hasAllergenicIndicatorElement()) {
41305        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41306        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41307      }
41308  }
41309
41310  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
41311    if (element != null) {
41312      prop("resourceType", name);
41313      composeDeviceMetricProperties(element);
41314    }
41315  }
41316
41317  protected void composeDeviceMetricProperties(DeviceMetric element) throws IOException {
41318    composeDomainResourceProperties(element);
41319      if (element.hasIdentifier()) {
41320        openArray("identifier");
41321        for (Identifier e : element.getIdentifier()) 
41322          composeIdentifier(null, e);
41323        closeArray();
41324      };
41325      if (element.hasType()) {
41326        composeCodeableConcept("type", element.getType());
41327      }
41328      if (element.hasUnit()) {
41329        composeCodeableConcept("unit", element.getUnit());
41330      }
41331      if (element.hasSource()) {
41332        composeReference("source", element.getSource());
41333      }
41334      if (element.hasParent()) {
41335        composeReference("parent", element.getParent());
41336      }
41337      if (element.hasOperationalStatusElement()) {
41338        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
41339        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
41340      }
41341      if (element.hasColorElement()) {
41342        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
41343        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
41344      }
41345      if (element.hasCategoryElement()) {
41346        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
41347        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
41348      }
41349      if (element.hasMeasurementPeriod()) {
41350        composeTiming("measurementPeriod", element.getMeasurementPeriod());
41351      }
41352      if (element.hasCalibration()) {
41353        openArray("calibration");
41354        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
41355          composeDeviceMetricCalibrationComponent(null, e);
41356        closeArray();
41357      };
41358  }
41359
41360  protected void composeDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
41361    if (element != null) {
41362      open(name);
41363      composeDeviceMetricCalibrationComponentProperties(element);
41364      close();
41365    }
41366  }
41367
41368  protected void composeDeviceMetricCalibrationComponentProperties(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
41369    composeBackboneElementProperties(element);
41370      if (element.hasTypeElement()) {
41371        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
41372        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
41373      }
41374      if (element.hasStateElement()) {
41375        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
41376        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
41377      }
41378      if (element.hasTimeElement()) {
41379        composeInstantCore("time", element.getTimeElement(), false);
41380        composeInstantExtras("time", element.getTimeElement(), false);
41381      }
41382  }
41383
41384  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
41385    if (element != null) {
41386      prop("resourceType", name);
41387      composeDeviceRequestProperties(element);
41388    }
41389  }
41390
41391  protected void composeDeviceRequestProperties(DeviceRequest element) throws IOException {
41392    composeDomainResourceProperties(element);
41393      if (element.hasIdentifier()) {
41394        openArray("identifier");
41395        for (Identifier e : element.getIdentifier()) 
41396          composeIdentifier(null, e);
41397        closeArray();
41398      };
41399      if (element.hasInstantiatesCanonical()) {
41400        if (anyHasValue(element.getInstantiatesCanonical())) {
41401          openArray("instantiatesCanonical");
41402          for (CanonicalType e : element.getInstantiatesCanonical()) 
41403            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
41404          closeArray();
41405        }
41406        if (anyHasExtras(element.getInstantiatesCanonical())) {
41407          openArray("_instantiatesCanonical");
41408          for (CanonicalType e : element.getInstantiatesCanonical()) 
41409            composeCanonicalExtras(null, e, true);
41410          closeArray();
41411        }
41412      };
41413      if (element.hasInstantiatesUri()) {
41414        if (anyHasValue(element.getInstantiatesUri())) {
41415          openArray("instantiatesUri");
41416          for (UriType e : element.getInstantiatesUri()) 
41417            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
41418          closeArray();
41419        }
41420        if (anyHasExtras(element.getInstantiatesUri())) {
41421          openArray("_instantiatesUri");
41422          for (UriType e : element.getInstantiatesUri()) 
41423            composeUriExtras(null, e, true);
41424          closeArray();
41425        }
41426      };
41427      if (element.hasBasedOn()) {
41428        openArray("basedOn");
41429        for (Reference e : element.getBasedOn()) 
41430          composeReference(null, e);
41431        closeArray();
41432      };
41433      if (element.hasPriorRequest()) {
41434        openArray("priorRequest");
41435        for (Reference e : element.getPriorRequest()) 
41436          composeReference(null, e);
41437        closeArray();
41438      };
41439      if (element.hasGroupIdentifier()) {
41440        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
41441      }
41442      if (element.hasStatusElement()) {
41443        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
41444        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
41445      }
41446      if (element.hasIntentElement()) {
41447        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
41448        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
41449      }
41450      if (element.hasPriorityElement()) {
41451        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
41452        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
41453      }
41454      if (element.hasCode()) {
41455        composeType("code", element.getCode());
41456      }
41457      if (element.hasParameter()) {
41458        openArray("parameter");
41459        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
41460          composeDeviceRequestParameterComponent(null, e);
41461        closeArray();
41462      };
41463      if (element.hasSubject()) {
41464        composeReference("subject", element.getSubject());
41465      }
41466      if (element.hasEncounter()) {
41467        composeReference("encounter", element.getEncounter());
41468      }
41469      if (element.hasOccurrence()) {
41470        composeType("occurrence", element.getOccurrence());
41471      }
41472      if (element.hasAuthoredOnElement()) {
41473        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
41474        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
41475      }
41476      if (element.hasRequester()) {
41477        composeReference("requester", element.getRequester());
41478      }
41479      if (element.hasPerformerType()) {
41480        composeCodeableConcept("performerType", element.getPerformerType());
41481      }
41482      if (element.hasPerformer()) {
41483        composeReference("performer", element.getPerformer());
41484      }
41485      if (element.hasReasonCode()) {
41486        openArray("reasonCode");
41487        for (CodeableConcept e : element.getReasonCode()) 
41488          composeCodeableConcept(null, e);
41489        closeArray();
41490      };
41491      if (element.hasReasonReference()) {
41492        openArray("reasonReference");
41493        for (Reference e : element.getReasonReference()) 
41494          composeReference(null, e);
41495        closeArray();
41496      };
41497      if (element.hasInsurance()) {
41498        openArray("insurance");
41499        for (Reference e : element.getInsurance()) 
41500          composeReference(null, e);
41501        closeArray();
41502      };
41503      if (element.hasSupportingInfo()) {
41504        openArray("supportingInfo");
41505        for (Reference e : element.getSupportingInfo()) 
41506          composeReference(null, e);
41507        closeArray();
41508      };
41509      if (element.hasNote()) {
41510        openArray("note");
41511        for (Annotation e : element.getNote()) 
41512          composeAnnotation(null, e);
41513        closeArray();
41514      };
41515      if (element.hasRelevantHistory()) {
41516        openArray("relevantHistory");
41517        for (Reference e : element.getRelevantHistory()) 
41518          composeReference(null, e);
41519        closeArray();
41520      };
41521  }
41522
41523  protected void composeDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
41524    if (element != null) {
41525      open(name);
41526      composeDeviceRequestParameterComponentProperties(element);
41527      close();
41528    }
41529  }
41530
41531  protected void composeDeviceRequestParameterComponentProperties(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
41532    composeBackboneElementProperties(element);
41533      if (element.hasCode()) {
41534        composeCodeableConcept("code", element.getCode());
41535      }
41536      if (element.hasValue()) {
41537        composeType("value", element.getValue());
41538      }
41539  }
41540
41541  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
41542    if (element != null) {
41543      prop("resourceType", name);
41544      composeDeviceUseStatementProperties(element);
41545    }
41546  }
41547
41548  protected void composeDeviceUseStatementProperties(DeviceUseStatement element) throws IOException {
41549    composeDomainResourceProperties(element);
41550      if (element.hasIdentifier()) {
41551        openArray("identifier");
41552        for (Identifier e : element.getIdentifier()) 
41553          composeIdentifier(null, e);
41554        closeArray();
41555      };
41556      if (element.hasBasedOn()) {
41557        openArray("basedOn");
41558        for (Reference e : element.getBasedOn()) 
41559          composeReference(null, e);
41560        closeArray();
41561      };
41562      if (element.hasStatusElement()) {
41563        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
41564        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
41565      }
41566      if (element.hasSubject()) {
41567        composeReference("subject", element.getSubject());
41568      }
41569      if (element.hasDerivedFrom()) {
41570        openArray("derivedFrom");
41571        for (Reference e : element.getDerivedFrom()) 
41572          composeReference(null, e);
41573        closeArray();
41574      };
41575      if (element.hasTiming()) {
41576        composeType("timing", element.getTiming());
41577      }
41578      if (element.hasRecordedOnElement()) {
41579        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
41580        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
41581      }
41582      if (element.hasSource()) {
41583        composeReference("source", element.getSource());
41584      }
41585      if (element.hasDevice()) {
41586        composeReference("device", element.getDevice());
41587      }
41588      if (element.hasReasonCode()) {
41589        openArray("reasonCode");
41590        for (CodeableConcept e : element.getReasonCode()) 
41591          composeCodeableConcept(null, e);
41592        closeArray();
41593      };
41594      if (element.hasReasonReference()) {
41595        openArray("reasonReference");
41596        for (Reference e : element.getReasonReference()) 
41597          composeReference(null, e);
41598        closeArray();
41599      };
41600      if (element.hasBodySite()) {
41601        composeCodeableConcept("bodySite", element.getBodySite());
41602      }
41603      if (element.hasNote()) {
41604        openArray("note");
41605        for (Annotation e : element.getNote()) 
41606          composeAnnotation(null, e);
41607        closeArray();
41608      };
41609  }
41610
41611  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
41612    if (element != null) {
41613      prop("resourceType", name);
41614      composeDiagnosticReportProperties(element);
41615    }
41616  }
41617
41618  protected void composeDiagnosticReportProperties(DiagnosticReport element) throws IOException {
41619    composeDomainResourceProperties(element);
41620      if (element.hasIdentifier()) {
41621        openArray("identifier");
41622        for (Identifier e : element.getIdentifier()) 
41623          composeIdentifier(null, e);
41624        closeArray();
41625      };
41626      if (element.hasBasedOn()) {
41627        openArray("basedOn");
41628        for (Reference e : element.getBasedOn()) 
41629          composeReference(null, e);
41630        closeArray();
41631      };
41632      if (element.hasStatusElement()) {
41633        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
41634        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
41635      }
41636      if (element.hasCategory()) {
41637        openArray("category");
41638        for (CodeableConcept e : element.getCategory()) 
41639          composeCodeableConcept(null, e);
41640        closeArray();
41641      };
41642      if (element.hasCode()) {
41643        composeCodeableConcept("code", element.getCode());
41644      }
41645      if (element.hasSubject()) {
41646        composeReference("subject", element.getSubject());
41647      }
41648      if (element.hasEncounter()) {
41649        composeReference("encounter", element.getEncounter());
41650      }
41651      if (element.hasEffective()) {
41652        composeType("effective", element.getEffective());
41653      }
41654      if (element.hasIssuedElement()) {
41655        composeInstantCore("issued", element.getIssuedElement(), false);
41656        composeInstantExtras("issued", element.getIssuedElement(), false);
41657      }
41658      if (element.hasPerformer()) {
41659        openArray("performer");
41660        for (Reference e : element.getPerformer()) 
41661          composeReference(null, e);
41662        closeArray();
41663      };
41664      if (element.hasResultsInterpreter()) {
41665        openArray("resultsInterpreter");
41666        for (Reference e : element.getResultsInterpreter()) 
41667          composeReference(null, e);
41668        closeArray();
41669      };
41670      if (element.hasSpecimen()) {
41671        openArray("specimen");
41672        for (Reference e : element.getSpecimen()) 
41673          composeReference(null, e);
41674        closeArray();
41675      };
41676      if (element.hasResult()) {
41677        openArray("result");
41678        for (Reference e : element.getResult()) 
41679          composeReference(null, e);
41680        closeArray();
41681      };
41682      if (element.hasImagingStudy()) {
41683        openArray("imagingStudy");
41684        for (Reference e : element.getImagingStudy()) 
41685          composeReference(null, e);
41686        closeArray();
41687      };
41688      if (element.hasMedia()) {
41689        openArray("media");
41690        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
41691          composeDiagnosticReportMediaComponent(null, e);
41692        closeArray();
41693      };
41694      if (element.hasConclusionElement()) {
41695        composeStringCore("conclusion", element.getConclusionElement(), false);
41696        composeStringExtras("conclusion", element.getConclusionElement(), false);
41697      }
41698      if (element.hasConclusionCode()) {
41699        openArray("conclusionCode");
41700        for (CodeableConcept e : element.getConclusionCode()) 
41701          composeCodeableConcept(null, e);
41702        closeArray();
41703      };
41704      if (element.hasPresentedForm()) {
41705        openArray("presentedForm");
41706        for (Attachment e : element.getPresentedForm()) 
41707          composeAttachment(null, e);
41708        closeArray();
41709      };
41710  }
41711
41712  protected void composeDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
41713    if (element != null) {
41714      open(name);
41715      composeDiagnosticReportMediaComponentProperties(element);
41716      close();
41717    }
41718  }
41719
41720  protected void composeDiagnosticReportMediaComponentProperties(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
41721    composeBackboneElementProperties(element);
41722      if (element.hasCommentElement()) {
41723        composeStringCore("comment", element.getCommentElement(), false);
41724        composeStringExtras("comment", element.getCommentElement(), false);
41725      }
41726      if (element.hasLink()) {
41727        composeReference("link", element.getLink());
41728      }
41729  }
41730
41731  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
41732    if (element != null) {
41733      prop("resourceType", name);
41734      composeDocumentManifestProperties(element);
41735    }
41736  }
41737
41738  protected void composeDocumentManifestProperties(DocumentManifest element) throws IOException {
41739    composeDomainResourceProperties(element);
41740      if (element.hasMasterIdentifier()) {
41741        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
41742      }
41743      if (element.hasIdentifier()) {
41744        openArray("identifier");
41745        for (Identifier e : element.getIdentifier()) 
41746          composeIdentifier(null, e);
41747        closeArray();
41748      };
41749      if (element.hasStatusElement()) {
41750        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41751        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41752      }
41753      if (element.hasType()) {
41754        composeCodeableConcept("type", element.getType());
41755      }
41756      if (element.hasSubject()) {
41757        composeReference("subject", element.getSubject());
41758      }
41759      if (element.hasCreatedElement()) {
41760        composeDateTimeCore("created", element.getCreatedElement(), false);
41761        composeDateTimeExtras("created", element.getCreatedElement(), false);
41762      }
41763      if (element.hasAuthor()) {
41764        openArray("author");
41765        for (Reference e : element.getAuthor()) 
41766          composeReference(null, e);
41767        closeArray();
41768      };
41769      if (element.hasRecipient()) {
41770        openArray("recipient");
41771        for (Reference e : element.getRecipient()) 
41772          composeReference(null, e);
41773        closeArray();
41774      };
41775      if (element.hasSourceElement()) {
41776        composeUriCore("source", element.getSourceElement(), false);
41777        composeUriExtras("source", element.getSourceElement(), false);
41778      }
41779      if (element.hasDescriptionElement()) {
41780        composeStringCore("description", element.getDescriptionElement(), false);
41781        composeStringExtras("description", element.getDescriptionElement(), false);
41782      }
41783      if (element.hasContent()) {
41784        openArray("content");
41785        for (Reference e : element.getContent()) 
41786          composeReference(null, e);
41787        closeArray();
41788      };
41789      if (element.hasRelated()) {
41790        openArray("related");
41791        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
41792          composeDocumentManifestRelatedComponent(null, e);
41793        closeArray();
41794      };
41795  }
41796
41797  protected void composeDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
41798    if (element != null) {
41799      open(name);
41800      composeDocumentManifestRelatedComponentProperties(element);
41801      close();
41802    }
41803  }
41804
41805  protected void composeDocumentManifestRelatedComponentProperties(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
41806    composeBackboneElementProperties(element);
41807      if (element.hasIdentifier()) {
41808        composeIdentifier("identifier", element.getIdentifier());
41809      }
41810      if (element.hasRef()) {
41811        composeReference("ref", element.getRef());
41812      }
41813  }
41814
41815  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
41816    if (element != null) {
41817      prop("resourceType", name);
41818      composeDocumentReferenceProperties(element);
41819    }
41820  }
41821
41822  protected void composeDocumentReferenceProperties(DocumentReference element) throws IOException {
41823    composeDomainResourceProperties(element);
41824      if (element.hasMasterIdentifier()) {
41825        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
41826      }
41827      if (element.hasIdentifier()) {
41828        openArray("identifier");
41829        for (Identifier e : element.getIdentifier()) 
41830          composeIdentifier(null, e);
41831        closeArray();
41832      };
41833      if (element.hasStatusElement()) {
41834        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41835        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41836      }
41837      if (element.hasDocStatusElement()) {
41838        composeEnumerationCore("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
41839        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
41840      }
41841      if (element.hasType()) {
41842        composeCodeableConcept("type", element.getType());
41843      }
41844      if (element.hasCategory()) {
41845        openArray("category");
41846        for (CodeableConcept e : element.getCategory()) 
41847          composeCodeableConcept(null, e);
41848        closeArray();
41849      };
41850      if (element.hasSubject()) {
41851        composeReference("subject", element.getSubject());
41852      }
41853      if (element.hasDateElement()) {
41854        composeInstantCore("date", element.getDateElement(), false);
41855        composeInstantExtras("date", element.getDateElement(), false);
41856      }
41857      if (element.hasAuthor()) {
41858        openArray("author");
41859        for (Reference e : element.getAuthor()) 
41860          composeReference(null, e);
41861        closeArray();
41862      };
41863      if (element.hasAuthenticator()) {
41864        composeReference("authenticator", element.getAuthenticator());
41865      }
41866      if (element.hasCustodian()) {
41867        composeReference("custodian", element.getCustodian());
41868      }
41869      if (element.hasRelatesTo()) {
41870        openArray("relatesTo");
41871        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
41872          composeDocumentReferenceRelatesToComponent(null, e);
41873        closeArray();
41874      };
41875      if (element.hasDescriptionElement()) {
41876        composeStringCore("description", element.getDescriptionElement(), false);
41877        composeStringExtras("description", element.getDescriptionElement(), false);
41878      }
41879      if (element.hasSecurityLabel()) {
41880        openArray("securityLabel");
41881        for (CodeableConcept e : element.getSecurityLabel()) 
41882          composeCodeableConcept(null, e);
41883        closeArray();
41884      };
41885      if (element.hasContent()) {
41886        openArray("content");
41887        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
41888          composeDocumentReferenceContentComponent(null, e);
41889        closeArray();
41890      };
41891      if (element.hasContext()) {
41892        composeDocumentReferenceContextComponent("context", element.getContext());
41893      }
41894  }
41895
41896  protected void composeDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
41897    if (element != null) {
41898      open(name);
41899      composeDocumentReferenceRelatesToComponentProperties(element);
41900      close();
41901    }
41902  }
41903
41904  protected void composeDocumentReferenceRelatesToComponentProperties(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
41905    composeBackboneElementProperties(element);
41906      if (element.hasCodeElement()) {
41907        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
41908        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
41909      }
41910      if (element.hasTarget()) {
41911        composeReference("target", element.getTarget());
41912      }
41913  }
41914
41915  protected void composeDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
41916    if (element != null) {
41917      open(name);
41918      composeDocumentReferenceContentComponentProperties(element);
41919      close();
41920    }
41921  }
41922
41923  protected void composeDocumentReferenceContentComponentProperties(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
41924    composeBackboneElementProperties(element);
41925      if (element.hasAttachment()) {
41926        composeAttachment("attachment", element.getAttachment());
41927      }
41928      if (element.hasFormat()) {
41929        composeCoding("format", element.getFormat());
41930      }
41931  }
41932
41933  protected void composeDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
41934    if (element != null) {
41935      open(name);
41936      composeDocumentReferenceContextComponentProperties(element);
41937      close();
41938    }
41939  }
41940
41941  protected void composeDocumentReferenceContextComponentProperties(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
41942    composeBackboneElementProperties(element);
41943      if (element.hasEncounter()) {
41944        openArray("encounter");
41945        for (Reference e : element.getEncounter()) 
41946          composeReference(null, e);
41947        closeArray();
41948      };
41949      if (element.hasEvent()) {
41950        openArray("event");
41951        for (CodeableConcept e : element.getEvent()) 
41952          composeCodeableConcept(null, e);
41953        closeArray();
41954      };
41955      if (element.hasPeriod()) {
41956        composePeriod("period", element.getPeriod());
41957      }
41958      if (element.hasFacilityType()) {
41959        composeCodeableConcept("facilityType", element.getFacilityType());
41960      }
41961      if (element.hasPracticeSetting()) {
41962        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
41963      }
41964      if (element.hasSourcePatientInfo()) {
41965        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
41966      }
41967      if (element.hasRelated()) {
41968        openArray("related");
41969        for (Reference e : element.getRelated()) 
41970          composeReference(null, e);
41971        closeArray();
41972      };
41973  }
41974
41975  protected void composeEncounter(String name, Encounter element) throws IOException {
41976    if (element != null) {
41977      prop("resourceType", name);
41978      composeEncounterProperties(element);
41979    }
41980  }
41981
41982  protected void composeEncounterProperties(Encounter element) throws IOException {
41983    composeDomainResourceProperties(element);
41984      if (element.hasIdentifier()) {
41985        openArray("identifier");
41986        for (Identifier e : element.getIdentifier()) 
41987          composeIdentifier(null, e);
41988        closeArray();
41989      };
41990      if (element.hasStatusElement()) {
41991        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
41992        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
41993      }
41994      if (element.hasStatusHistory()) {
41995        openArray("statusHistory");
41996        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
41997          composeStatusHistoryComponent(null, e);
41998        closeArray();
41999      };
42000      if (element.hasClass_()) {
42001        composeCoding("class", element.getClass_());
42002      }
42003      if (element.hasClassHistory()) {
42004        openArray("classHistory");
42005        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
42006          composeClassHistoryComponent(null, e);
42007        closeArray();
42008      };
42009      if (element.hasType()) {
42010        openArray("type");
42011        for (CodeableConcept e : element.getType()) 
42012          composeCodeableConcept(null, e);
42013        closeArray();
42014      };
42015      if (element.hasServiceType()) {
42016        composeCodeableConcept("serviceType", element.getServiceType());
42017      }
42018      if (element.hasPriority()) {
42019        composeCodeableConcept("priority", element.getPriority());
42020      }
42021      if (element.hasSubject()) {
42022        composeReference("subject", element.getSubject());
42023      }
42024      if (element.hasEpisodeOfCare()) {
42025        openArray("episodeOfCare");
42026        for (Reference e : element.getEpisodeOfCare()) 
42027          composeReference(null, e);
42028        closeArray();
42029      };
42030      if (element.hasBasedOn()) {
42031        openArray("basedOn");
42032        for (Reference e : element.getBasedOn()) 
42033          composeReference(null, e);
42034        closeArray();
42035      };
42036      if (element.hasParticipant()) {
42037        openArray("participant");
42038        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
42039          composeEncounterParticipantComponent(null, e);
42040        closeArray();
42041      };
42042      if (element.hasAppointment()) {
42043        openArray("appointment");
42044        for (Reference e : element.getAppointment()) 
42045          composeReference(null, e);
42046        closeArray();
42047      };
42048      if (element.hasPeriod()) {
42049        composePeriod("period", element.getPeriod());
42050      }
42051      if (element.hasLength()) {
42052        composeDuration("length", element.getLength());
42053      }
42054      if (element.hasReasonCode()) {
42055        openArray("reasonCode");
42056        for (CodeableConcept e : element.getReasonCode()) 
42057          composeCodeableConcept(null, e);
42058        closeArray();
42059      };
42060      if (element.hasReasonReference()) {
42061        openArray("reasonReference");
42062        for (Reference e : element.getReasonReference()) 
42063          composeReference(null, e);
42064        closeArray();
42065      };
42066      if (element.hasDiagnosis()) {
42067        openArray("diagnosis");
42068        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
42069          composeDiagnosisComponent(null, e);
42070        closeArray();
42071      };
42072      if (element.hasAccount()) {
42073        openArray("account");
42074        for (Reference e : element.getAccount()) 
42075          composeReference(null, e);
42076        closeArray();
42077      };
42078      if (element.hasHospitalization()) {
42079        composeEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
42080      }
42081      if (element.hasLocation()) {
42082        openArray("location");
42083        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
42084          composeEncounterLocationComponent(null, e);
42085        closeArray();
42086      };
42087      if (element.hasServiceProvider()) {
42088        composeReference("serviceProvider", element.getServiceProvider());
42089      }
42090      if (element.hasPartOf()) {
42091        composeReference("partOf", element.getPartOf());
42092      }
42093  }
42094
42095  protected void composeStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
42096    if (element != null) {
42097      open(name);
42098      composeStatusHistoryComponentProperties(element);
42099      close();
42100    }
42101  }
42102
42103  protected void composeStatusHistoryComponentProperties(Encounter.StatusHistoryComponent element) throws IOException {
42104    composeBackboneElementProperties(element);
42105      if (element.hasStatusElement()) {
42106        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
42107        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
42108      }
42109      if (element.hasPeriod()) {
42110        composePeriod("period", element.getPeriod());
42111      }
42112  }
42113
42114  protected void composeClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
42115    if (element != null) {
42116      open(name);
42117      composeClassHistoryComponentProperties(element);
42118      close();
42119    }
42120  }
42121
42122  protected void composeClassHistoryComponentProperties(Encounter.ClassHistoryComponent element) throws IOException {
42123    composeBackboneElementProperties(element);
42124      if (element.hasClass_()) {
42125        composeCoding("class", element.getClass_());
42126      }
42127      if (element.hasPeriod()) {
42128        composePeriod("period", element.getPeriod());
42129      }
42130  }
42131
42132  protected void composeEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
42133    if (element != null) {
42134      open(name);
42135      composeEncounterParticipantComponentProperties(element);
42136      close();
42137    }
42138  }
42139
42140  protected void composeEncounterParticipantComponentProperties(Encounter.EncounterParticipantComponent element) throws IOException {
42141    composeBackboneElementProperties(element);
42142      if (element.hasType()) {
42143        openArray("type");
42144        for (CodeableConcept e : element.getType()) 
42145          composeCodeableConcept(null, e);
42146        closeArray();
42147      };
42148      if (element.hasPeriod()) {
42149        composePeriod("period", element.getPeriod());
42150      }
42151      if (element.hasIndividual()) {
42152        composeReference("individual", element.getIndividual());
42153      }
42154  }
42155
42156  protected void composeDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
42157    if (element != null) {
42158      open(name);
42159      composeDiagnosisComponentProperties(element);
42160      close();
42161    }
42162  }
42163
42164  protected void composeDiagnosisComponentProperties(Encounter.DiagnosisComponent element) throws IOException {
42165    composeBackboneElementProperties(element);
42166      if (element.hasCondition()) {
42167        composeReference("condition", element.getCondition());
42168      }
42169      if (element.hasUse()) {
42170        composeCodeableConcept("use", element.getUse());
42171      }
42172      if (element.hasRankElement()) {
42173        composePositiveIntCore("rank", element.getRankElement(), false);
42174        composePositiveIntExtras("rank", element.getRankElement(), false);
42175      }
42176  }
42177
42178  protected void composeEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
42179    if (element != null) {
42180      open(name);
42181      composeEncounterHospitalizationComponentProperties(element);
42182      close();
42183    }
42184  }
42185
42186  protected void composeEncounterHospitalizationComponentProperties(Encounter.EncounterHospitalizationComponent element) throws IOException {
42187    composeBackboneElementProperties(element);
42188      if (element.hasPreAdmissionIdentifier()) {
42189        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
42190      }
42191      if (element.hasOrigin()) {
42192        composeReference("origin", element.getOrigin());
42193      }
42194      if (element.hasAdmitSource()) {
42195        composeCodeableConcept("admitSource", element.getAdmitSource());
42196      }
42197      if (element.hasReAdmission()) {
42198        composeCodeableConcept("reAdmission", element.getReAdmission());
42199      }
42200      if (element.hasDietPreference()) {
42201        openArray("dietPreference");
42202        for (CodeableConcept e : element.getDietPreference()) 
42203          composeCodeableConcept(null, e);
42204        closeArray();
42205      };
42206      if (element.hasSpecialCourtesy()) {
42207        openArray("specialCourtesy");
42208        for (CodeableConcept e : element.getSpecialCourtesy()) 
42209          composeCodeableConcept(null, e);
42210        closeArray();
42211      };
42212      if (element.hasSpecialArrangement()) {
42213        openArray("specialArrangement");
42214        for (CodeableConcept e : element.getSpecialArrangement()) 
42215          composeCodeableConcept(null, e);
42216        closeArray();
42217      };
42218      if (element.hasDestination()) {
42219        composeReference("destination", element.getDestination());
42220      }
42221      if (element.hasDischargeDisposition()) {
42222        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
42223      }
42224  }
42225
42226  protected void composeEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
42227    if (element != null) {
42228      open(name);
42229      composeEncounterLocationComponentProperties(element);
42230      close();
42231    }
42232  }
42233
42234  protected void composeEncounterLocationComponentProperties(Encounter.EncounterLocationComponent element) throws IOException {
42235    composeBackboneElementProperties(element);
42236      if (element.hasLocation()) {
42237        composeReference("location", element.getLocation());
42238      }
42239      if (element.hasStatusElement()) {
42240        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
42241        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
42242      }
42243      if (element.hasPhysicalType()) {
42244        composeCodeableConcept("physicalType", element.getPhysicalType());
42245      }
42246      if (element.hasPeriod()) {
42247        composePeriod("period", element.getPeriod());
42248      }
42249  }
42250
42251  protected void composeEndpoint(String name, Endpoint element) throws IOException {
42252    if (element != null) {
42253      prop("resourceType", name);
42254      composeEndpointProperties(element);
42255    }
42256  }
42257
42258  protected void composeEndpointProperties(Endpoint element) throws IOException {
42259    composeDomainResourceProperties(element);
42260      if (element.hasIdentifier()) {
42261        openArray("identifier");
42262        for (Identifier e : element.getIdentifier()) 
42263          composeIdentifier(null, e);
42264        closeArray();
42265      };
42266      if (element.hasStatusElement()) {
42267        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
42268        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
42269      }
42270      if (element.hasConnectionType()) {
42271        composeCoding("connectionType", element.getConnectionType());
42272      }
42273      if (element.hasNameElement()) {
42274        composeStringCore("name", element.getNameElement(), false);
42275        composeStringExtras("name", element.getNameElement(), false);
42276      }
42277      if (element.hasManagingOrganization()) {
42278        composeReference("managingOrganization", element.getManagingOrganization());
42279      }
42280      if (element.hasContact()) {
42281        openArray("contact");
42282        for (ContactPoint e : element.getContact()) 
42283          composeContactPoint(null, e);
42284        closeArray();
42285      };
42286      if (element.hasPeriod()) {
42287        composePeriod("period", element.getPeriod());
42288      }
42289      if (element.hasPayloadType()) {
42290        openArray("payloadType");
42291        for (CodeableConcept e : element.getPayloadType()) 
42292          composeCodeableConcept(null, e);
42293        closeArray();
42294      };
42295      if (element.hasPayloadMimeType()) {
42296        if (anyHasValue(element.getPayloadMimeType())) {
42297          openArray("payloadMimeType");
42298          for (CodeType e : element.getPayloadMimeType()) 
42299            composeCodeCore(null, e, e != element.getPayloadMimeType().get(element.getPayloadMimeType().size()-1));
42300          closeArray();
42301        }
42302        if (anyHasExtras(element.getPayloadMimeType())) {
42303          openArray("_payloadMimeType");
42304          for (CodeType e : element.getPayloadMimeType()) 
42305            composeCodeExtras(null, e, true);
42306          closeArray();
42307        }
42308      };
42309      if (element.hasAddressElement()) {
42310        composeUrlCore("address", element.getAddressElement(), false);
42311        composeUrlExtras("address", element.getAddressElement(), false);
42312      }
42313      if (element.hasHeader()) {
42314        if (anyHasValue(element.getHeader())) {
42315          openArray("header");
42316          for (StringType e : element.getHeader()) 
42317            composeStringCore(null, e, e != element.getHeader().get(element.getHeader().size()-1));
42318          closeArray();
42319        }
42320        if (anyHasExtras(element.getHeader())) {
42321          openArray("_header");
42322          for (StringType e : element.getHeader()) 
42323            composeStringExtras(null, e, true);
42324          closeArray();
42325        }
42326      };
42327  }
42328
42329  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
42330    if (element != null) {
42331      prop("resourceType", name);
42332      composeEnrollmentRequestProperties(element);
42333    }
42334  }
42335
42336  protected void composeEnrollmentRequestProperties(EnrollmentRequest element) throws IOException {
42337    composeDomainResourceProperties(element);
42338      if (element.hasIdentifier()) {
42339        openArray("identifier");
42340        for (Identifier e : element.getIdentifier()) 
42341          composeIdentifier(null, e);
42342        closeArray();
42343      };
42344      if (element.hasStatusElement()) {
42345        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42346        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42347      }
42348      if (element.hasCreatedElement()) {
42349        composeDateTimeCore("created", element.getCreatedElement(), false);
42350        composeDateTimeExtras("created", element.getCreatedElement(), false);
42351      }
42352      if (element.hasInsurer()) {
42353        composeReference("insurer", element.getInsurer());
42354      }
42355      if (element.hasProvider()) {
42356        composeReference("provider", element.getProvider());
42357      }
42358      if (element.hasCandidate()) {
42359        composeReference("candidate", element.getCandidate());
42360      }
42361      if (element.hasCoverage()) {
42362        composeReference("coverage", element.getCoverage());
42363      }
42364  }
42365
42366  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
42367    if (element != null) {
42368      prop("resourceType", name);
42369      composeEnrollmentResponseProperties(element);
42370    }
42371  }
42372
42373  protected void composeEnrollmentResponseProperties(EnrollmentResponse element) throws IOException {
42374    composeDomainResourceProperties(element);
42375      if (element.hasIdentifier()) {
42376        openArray("identifier");
42377        for (Identifier e : element.getIdentifier()) 
42378          composeIdentifier(null, e);
42379        closeArray();
42380      };
42381      if (element.hasStatusElement()) {
42382        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42383        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42384      }
42385      if (element.hasRequest()) {
42386        composeReference("request", element.getRequest());
42387      }
42388      if (element.hasOutcomeElement()) {
42389        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
42390        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
42391      }
42392      if (element.hasDispositionElement()) {
42393        composeStringCore("disposition", element.getDispositionElement(), false);
42394        composeStringExtras("disposition", element.getDispositionElement(), false);
42395      }
42396      if (element.hasCreatedElement()) {
42397        composeDateTimeCore("created", element.getCreatedElement(), false);
42398        composeDateTimeExtras("created", element.getCreatedElement(), false);
42399      }
42400      if (element.hasOrganization()) {
42401        composeReference("organization", element.getOrganization());
42402      }
42403      if (element.hasRequestProvider()) {
42404        composeReference("requestProvider", element.getRequestProvider());
42405      }
42406  }
42407
42408  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
42409    if (element != null) {
42410      prop("resourceType", name);
42411      composeEpisodeOfCareProperties(element);
42412    }
42413  }
42414
42415  protected void composeEpisodeOfCareProperties(EpisodeOfCare element) throws IOException {
42416    composeDomainResourceProperties(element);
42417      if (element.hasIdentifier()) {
42418        openArray("identifier");
42419        for (Identifier e : element.getIdentifier()) 
42420          composeIdentifier(null, e);
42421        closeArray();
42422      };
42423      if (element.hasStatusElement()) {
42424        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42425        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42426      }
42427      if (element.hasStatusHistory()) {
42428        openArray("statusHistory");
42429        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
42430          composeEpisodeOfCareStatusHistoryComponent(null, e);
42431        closeArray();
42432      };
42433      if (element.hasType()) {
42434        openArray("type");
42435        for (CodeableConcept e : element.getType()) 
42436          composeCodeableConcept(null, e);
42437        closeArray();
42438      };
42439      if (element.hasDiagnosis()) {
42440        openArray("diagnosis");
42441        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
42442          composeDiagnosisComponent(null, e);
42443        closeArray();
42444      };
42445      if (element.hasPatient()) {
42446        composeReference("patient", element.getPatient());
42447      }
42448      if (element.hasManagingOrganization()) {
42449        composeReference("managingOrganization", element.getManagingOrganization());
42450      }
42451      if (element.hasPeriod()) {
42452        composePeriod("period", element.getPeriod());
42453      }
42454      if (element.hasReferralRequest()) {
42455        openArray("referralRequest");
42456        for (Reference e : element.getReferralRequest()) 
42457          composeReference(null, e);
42458        closeArray();
42459      };
42460      if (element.hasCareManager()) {
42461        composeReference("careManager", element.getCareManager());
42462      }
42463      if (element.hasTeam()) {
42464        openArray("team");
42465        for (Reference e : element.getTeam()) 
42466          composeReference(null, e);
42467        closeArray();
42468      };
42469      if (element.hasAccount()) {
42470        openArray("account");
42471        for (Reference e : element.getAccount()) 
42472          composeReference(null, e);
42473        closeArray();
42474      };
42475  }
42476
42477  protected void composeEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
42478    if (element != null) {
42479      open(name);
42480      composeEpisodeOfCareStatusHistoryComponentProperties(element);
42481      close();
42482    }
42483  }
42484
42485  protected void composeEpisodeOfCareStatusHistoryComponentProperties(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
42486    composeBackboneElementProperties(element);
42487      if (element.hasStatusElement()) {
42488        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42489        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42490      }
42491      if (element.hasPeriod()) {
42492        composePeriod("period", element.getPeriod());
42493      }
42494  }
42495
42496  protected void composeDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
42497    if (element != null) {
42498      open(name);
42499      composeDiagnosisComponentProperties(element);
42500      close();
42501    }
42502  }
42503
42504  protected void composeDiagnosisComponentProperties(EpisodeOfCare.DiagnosisComponent element) throws IOException {
42505    composeBackboneElementProperties(element);
42506      if (element.hasCondition()) {
42507        composeReference("condition", element.getCondition());
42508      }
42509      if (element.hasRole()) {
42510        composeCodeableConcept("role", element.getRole());
42511      }
42512      if (element.hasRankElement()) {
42513        composePositiveIntCore("rank", element.getRankElement(), false);
42514        composePositiveIntExtras("rank", element.getRankElement(), false);
42515      }
42516  }
42517
42518  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
42519    if (element != null) {
42520      prop("resourceType", name);
42521      composeEventDefinitionProperties(element);
42522    }
42523  }
42524
42525  protected void composeEventDefinitionProperties(EventDefinition element) throws IOException {
42526    composeDomainResourceProperties(element);
42527      if (element.hasUrlElement()) {
42528        composeUriCore("url", element.getUrlElement(), false);
42529        composeUriExtras("url", element.getUrlElement(), false);
42530      }
42531      if (element.hasIdentifier()) {
42532        openArray("identifier");
42533        for (Identifier e : element.getIdentifier()) 
42534          composeIdentifier(null, e);
42535        closeArray();
42536      };
42537      if (element.hasVersionElement()) {
42538        composeStringCore("version", element.getVersionElement(), false);
42539        composeStringExtras("version", element.getVersionElement(), false);
42540      }
42541      if (element.hasNameElement()) {
42542        composeStringCore("name", element.getNameElement(), false);
42543        composeStringExtras("name", element.getNameElement(), false);
42544      }
42545      if (element.hasTitleElement()) {
42546        composeStringCore("title", element.getTitleElement(), false);
42547        composeStringExtras("title", element.getTitleElement(), false);
42548      }
42549      if (element.hasSubtitleElement()) {
42550        composeStringCore("subtitle", element.getSubtitleElement(), false);
42551        composeStringExtras("subtitle", element.getSubtitleElement(), false);
42552      }
42553      if (element.hasStatusElement()) {
42554        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42555        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42556      }
42557      if (element.hasExperimentalElement()) {
42558        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42559        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42560      }
42561      if (element.hasSubject()) {
42562        composeType("subject", element.getSubject());
42563      }
42564      if (element.hasDateElement()) {
42565        composeDateTimeCore("date", element.getDateElement(), false);
42566        composeDateTimeExtras("date", element.getDateElement(), false);
42567      }
42568      if (element.hasPublisherElement()) {
42569        composeStringCore("publisher", element.getPublisherElement(), false);
42570        composeStringExtras("publisher", element.getPublisherElement(), false);
42571      }
42572      if (element.hasContact()) {
42573        openArray("contact");
42574        for (ContactDetail e : element.getContact()) 
42575          composeContactDetail(null, e);
42576        closeArray();
42577      };
42578      if (element.hasDescriptionElement()) {
42579        composeMarkdownCore("description", element.getDescriptionElement(), false);
42580        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42581      }
42582      if (element.hasUseContext()) {
42583        openArray("useContext");
42584        for (UsageContext e : element.getUseContext()) 
42585          composeUsageContext(null, e);
42586        closeArray();
42587      };
42588      if (element.hasJurisdiction()) {
42589        openArray("jurisdiction");
42590        for (CodeableConcept e : element.getJurisdiction()) 
42591          composeCodeableConcept(null, e);
42592        closeArray();
42593      };
42594      if (element.hasPurposeElement()) {
42595        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42596        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42597      }
42598      if (element.hasUsageElement()) {
42599        composeStringCore("usage", element.getUsageElement(), false);
42600        composeStringExtras("usage", element.getUsageElement(), false);
42601      }
42602      if (element.hasCopyrightElement()) {
42603        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42604        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42605      }
42606      if (element.hasApprovalDateElement()) {
42607        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42608        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42609      }
42610      if (element.hasLastReviewDateElement()) {
42611        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42612        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42613      }
42614      if (element.hasEffectivePeriod()) {
42615        composePeriod("effectivePeriod", element.getEffectivePeriod());
42616      }
42617      if (element.hasTopic()) {
42618        openArray("topic");
42619        for (CodeableConcept e : element.getTopic()) 
42620          composeCodeableConcept(null, e);
42621        closeArray();
42622      };
42623      if (element.hasAuthor()) {
42624        openArray("author");
42625        for (ContactDetail e : element.getAuthor()) 
42626          composeContactDetail(null, e);
42627        closeArray();
42628      };
42629      if (element.hasEditor()) {
42630        openArray("editor");
42631        for (ContactDetail e : element.getEditor()) 
42632          composeContactDetail(null, e);
42633        closeArray();
42634      };
42635      if (element.hasReviewer()) {
42636        openArray("reviewer");
42637        for (ContactDetail e : element.getReviewer()) 
42638          composeContactDetail(null, e);
42639        closeArray();
42640      };
42641      if (element.hasEndorser()) {
42642        openArray("endorser");
42643        for (ContactDetail e : element.getEndorser()) 
42644          composeContactDetail(null, e);
42645        closeArray();
42646      };
42647      if (element.hasRelatedArtifact()) {
42648        openArray("relatedArtifact");
42649        for (RelatedArtifact e : element.getRelatedArtifact()) 
42650          composeRelatedArtifact(null, e);
42651        closeArray();
42652      };
42653      if (element.hasTrigger()) {
42654        openArray("trigger");
42655        for (TriggerDefinition e : element.getTrigger()) 
42656          composeTriggerDefinition(null, e);
42657        closeArray();
42658      };
42659  }
42660
42661  protected void composeEvidence(String name, Evidence element) throws IOException {
42662    if (element != null) {
42663      prop("resourceType", name);
42664      composeEvidenceProperties(element);
42665    }
42666  }
42667
42668  protected void composeEvidenceProperties(Evidence element) throws IOException {
42669    composeDomainResourceProperties(element);
42670      if (element.hasUrlElement()) {
42671        composeUriCore("url", element.getUrlElement(), false);
42672        composeUriExtras("url", element.getUrlElement(), false);
42673      }
42674      if (element.hasIdentifier()) {
42675        openArray("identifier");
42676        for (Identifier e : element.getIdentifier()) 
42677          composeIdentifier(null, e);
42678        closeArray();
42679      };
42680      if (element.hasVersionElement()) {
42681        composeStringCore("version", element.getVersionElement(), false);
42682        composeStringExtras("version", element.getVersionElement(), false);
42683      }
42684      if (element.hasTitleElement()) {
42685        composeStringCore("title", element.getTitleElement(), false);
42686        composeStringExtras("title", element.getTitleElement(), false);
42687      }
42688      if (element.hasCiteAs()) {
42689        composeType("citeAs", element.getCiteAs());
42690      }
42691      if (element.hasStatusElement()) {
42692        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42693        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42694      }
42695      if (element.hasDateElement()) {
42696        composeDateTimeCore("date", element.getDateElement(), false);
42697        composeDateTimeExtras("date", element.getDateElement(), false);
42698      }
42699      if (element.hasUseContext()) {
42700        openArray("useContext");
42701        for (UsageContext e : element.getUseContext()) 
42702          composeUsageContext(null, e);
42703        closeArray();
42704      };
42705      if (element.hasApprovalDateElement()) {
42706        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42707        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42708      }
42709      if (element.hasLastReviewDateElement()) {
42710        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42711        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42712      }
42713      if (element.hasPublisherElement()) {
42714        composeStringCore("publisher", element.getPublisherElement(), false);
42715        composeStringExtras("publisher", element.getPublisherElement(), false);
42716      }
42717      if (element.hasContact()) {
42718        openArray("contact");
42719        for (ContactDetail e : element.getContact()) 
42720          composeContactDetail(null, e);
42721        closeArray();
42722      };
42723      if (element.hasAuthor()) {
42724        openArray("author");
42725        for (ContactDetail e : element.getAuthor()) 
42726          composeContactDetail(null, e);
42727        closeArray();
42728      };
42729      if (element.hasEditor()) {
42730        openArray("editor");
42731        for (ContactDetail e : element.getEditor()) 
42732          composeContactDetail(null, e);
42733        closeArray();
42734      };
42735      if (element.hasReviewer()) {
42736        openArray("reviewer");
42737        for (ContactDetail e : element.getReviewer()) 
42738          composeContactDetail(null, e);
42739        closeArray();
42740      };
42741      if (element.hasEndorser()) {
42742        openArray("endorser");
42743        for (ContactDetail e : element.getEndorser()) 
42744          composeContactDetail(null, e);
42745        closeArray();
42746      };
42747      if (element.hasRelatedArtifact()) {
42748        openArray("relatedArtifact");
42749        for (RelatedArtifact e : element.getRelatedArtifact()) 
42750          composeRelatedArtifact(null, e);
42751        closeArray();
42752      };
42753      if (element.hasDescriptionElement()) {
42754        composeMarkdownCore("description", element.getDescriptionElement(), false);
42755        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42756      }
42757      if (element.hasAssertionElement()) {
42758        composeMarkdownCore("assertion", element.getAssertionElement(), false);
42759        composeMarkdownExtras("assertion", element.getAssertionElement(), false);
42760      }
42761      if (element.hasNote()) {
42762        openArray("note");
42763        for (Annotation e : element.getNote()) 
42764          composeAnnotation(null, e);
42765        closeArray();
42766      };
42767      if (element.hasVariableDefinition()) {
42768        openArray("variableDefinition");
42769        for (Evidence.EvidenceVariableDefinitionComponent e : element.getVariableDefinition()) 
42770          composeEvidenceVariableDefinitionComponent(null, e);
42771        closeArray();
42772      };
42773      if (element.hasSynthesisType()) {
42774        composeCodeableConcept("synthesisType", element.getSynthesisType());
42775      }
42776      if (element.hasStudyType()) {
42777        composeCodeableConcept("studyType", element.getStudyType());
42778      }
42779      if (element.hasStatistic()) {
42780        openArray("statistic");
42781        for (Evidence.EvidenceStatisticComponent e : element.getStatistic()) 
42782          composeEvidenceStatisticComponent(null, e);
42783        closeArray();
42784      };
42785      if (element.hasCertainty()) {
42786        openArray("certainty");
42787        for (Evidence.EvidenceCertaintyComponent e : element.getCertainty()) 
42788          composeEvidenceCertaintyComponent(null, e);
42789        closeArray();
42790      };
42791  }
42792
42793  protected void composeEvidenceVariableDefinitionComponent(String name, Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
42794    if (element != null) {
42795      open(name);
42796      composeEvidenceVariableDefinitionComponentProperties(element);
42797      close();
42798    }
42799  }
42800
42801  protected void composeEvidenceVariableDefinitionComponentProperties(Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
42802    composeBackboneElementProperties(element);
42803      if (element.hasDescriptionElement()) {
42804        composeMarkdownCore("description", element.getDescriptionElement(), false);
42805        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42806      }
42807      if (element.hasNote()) {
42808        openArray("note");
42809        for (Annotation e : element.getNote()) 
42810          composeAnnotation(null, e);
42811        closeArray();
42812      };
42813      if (element.hasVariableRole()) {
42814        composeCodeableConcept("variableRole", element.getVariableRole());
42815      }
42816      if (element.hasObserved()) {
42817        composeReference("observed", element.getObserved());
42818      }
42819      if (element.hasIntended()) {
42820        composeReference("intended", element.getIntended());
42821      }
42822      if (element.hasDirectnessMatch()) {
42823        composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
42824      }
42825  }
42826
42827  protected void composeEvidenceStatisticComponent(String name, Evidence.EvidenceStatisticComponent element) throws IOException {
42828    if (element != null) {
42829      open(name);
42830      composeEvidenceStatisticComponentProperties(element);
42831      close();
42832    }
42833  }
42834
42835  protected void composeEvidenceStatisticComponentProperties(Evidence.EvidenceStatisticComponent element) throws IOException {
42836    composeBackboneElementProperties(element);
42837      if (element.hasDescriptionElement()) {
42838        composeStringCore("description", element.getDescriptionElement(), false);
42839        composeStringExtras("description", element.getDescriptionElement(), false);
42840      }
42841      if (element.hasNote()) {
42842        openArray("note");
42843        for (Annotation e : element.getNote()) 
42844          composeAnnotation(null, e);
42845        closeArray();
42846      };
42847      if (element.hasStatisticType()) {
42848        composeCodeableConcept("statisticType", element.getStatisticType());
42849      }
42850      if (element.hasCategory()) {
42851        composeCodeableConcept("category", element.getCategory());
42852      }
42853      if (element.hasQuantity()) {
42854        composeQuantity("quantity", element.getQuantity());
42855      }
42856      if (element.hasNumberOfEventsElement()) {
42857        composeUnsignedIntCore("numberOfEvents", element.getNumberOfEventsElement(), false);
42858        composeUnsignedIntExtras("numberOfEvents", element.getNumberOfEventsElement(), false);
42859      }
42860      if (element.hasNumberAffectedElement()) {
42861        composeUnsignedIntCore("numberAffected", element.getNumberAffectedElement(), false);
42862        composeUnsignedIntExtras("numberAffected", element.getNumberAffectedElement(), false);
42863      }
42864      if (element.hasSampleSize()) {
42865        composeEvidenceStatisticSampleSizeComponent("sampleSize", element.getSampleSize());
42866      }
42867      if (element.hasAttributeEstimate()) {
42868        openArray("attributeEstimate");
42869        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
42870          composeEvidenceStatisticAttributeEstimateComponent(null, e);
42871        closeArray();
42872      };
42873      if (element.hasModelCharacteristic()) {
42874        openArray("modelCharacteristic");
42875        for (Evidence.EvidenceStatisticModelCharacteristicComponent e : element.getModelCharacteristic()) 
42876          composeEvidenceStatisticModelCharacteristicComponent(null, e);
42877        closeArray();
42878      };
42879  }
42880
42881  protected void composeEvidenceStatisticSampleSizeComponent(String name, Evidence.EvidenceStatisticSampleSizeComponent element) throws IOException {
42882    if (element != null) {
42883      open(name);
42884      composeEvidenceStatisticSampleSizeComponentProperties(element);
42885      close();
42886    }
42887  }
42888
42889  protected void composeEvidenceStatisticSampleSizeComponentProperties(Evidence.EvidenceStatisticSampleSizeComponent element) throws IOException {
42890    composeBackboneElementProperties(element);
42891      if (element.hasDescriptionElement()) {
42892        composeStringCore("description", element.getDescriptionElement(), false);
42893        composeStringExtras("description", element.getDescriptionElement(), false);
42894      }
42895      if (element.hasNote()) {
42896        openArray("note");
42897        for (Annotation e : element.getNote()) 
42898          composeAnnotation(null, e);
42899        closeArray();
42900      };
42901      if (element.hasNumberOfStudiesElement()) {
42902        composeUnsignedIntCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
42903        composeUnsignedIntExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
42904      }
42905      if (element.hasNumberOfParticipantsElement()) {
42906        composeUnsignedIntCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
42907        composeUnsignedIntExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
42908      }
42909      if (element.hasKnownDataCountElement()) {
42910        composeUnsignedIntCore("knownDataCount", element.getKnownDataCountElement(), false);
42911        composeUnsignedIntExtras("knownDataCount", element.getKnownDataCountElement(), false);
42912      }
42913  }
42914
42915  protected void composeEvidenceStatisticAttributeEstimateComponent(String name, Evidence.EvidenceStatisticAttributeEstimateComponent element) throws IOException {
42916    if (element != null) {
42917      open(name);
42918      composeEvidenceStatisticAttributeEstimateComponentProperties(element);
42919      close();
42920    }
42921  }
42922
42923  protected void composeEvidenceStatisticAttributeEstimateComponentProperties(Evidence.EvidenceStatisticAttributeEstimateComponent element) throws IOException {
42924    composeBackboneElementProperties(element);
42925      if (element.hasDescriptionElement()) {
42926        composeStringCore("description", element.getDescriptionElement(), false);
42927        composeStringExtras("description", element.getDescriptionElement(), false);
42928      }
42929      if (element.hasNote()) {
42930        openArray("note");
42931        for (Annotation e : element.getNote()) 
42932          composeAnnotation(null, e);
42933        closeArray();
42934      };
42935      if (element.hasType()) {
42936        composeCodeableConcept("type", element.getType());
42937      }
42938      if (element.hasQuantity()) {
42939        composeQuantity("quantity", element.getQuantity());
42940      }
42941      if (element.hasLevelElement()) {
42942        composeDecimalCore("level", element.getLevelElement(), false);
42943        composeDecimalExtras("level", element.getLevelElement(), false);
42944      }
42945      if (element.hasRange()) {
42946        composeRange("range", element.getRange());
42947      }
42948      if (element.hasAttributeEstimate()) {
42949        openArray("attributeEstimate");
42950        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
42951          composeEvidenceStatisticAttributeEstimateComponent(null, e);
42952        closeArray();
42953      };
42954  }
42955
42956  protected void composeEvidenceStatisticModelCharacteristicComponent(String name, Evidence.EvidenceStatisticModelCharacteristicComponent element) throws IOException {
42957    if (element != null) {
42958      open(name);
42959      composeEvidenceStatisticModelCharacteristicComponentProperties(element);
42960      close();
42961    }
42962  }
42963
42964  protected void composeEvidenceStatisticModelCharacteristicComponentProperties(Evidence.EvidenceStatisticModelCharacteristicComponent element) throws IOException {
42965    composeBackboneElementProperties(element);
42966      if (element.hasCode()) {
42967        composeCodeableConcept("code", element.getCode());
42968      }
42969      if (element.hasValue()) {
42970        composeQuantity("value", element.getValue());
42971      }
42972      if (element.hasVariable()) {
42973        openArray("variable");
42974        for (Evidence.EvidenceStatisticModelCharacteristicVariableComponent e : element.getVariable()) 
42975          composeEvidenceStatisticModelCharacteristicVariableComponent(null, e);
42976        closeArray();
42977      };
42978      if (element.hasAttributeEstimate()) {
42979        openArray("attributeEstimate");
42980        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
42981          composeEvidenceStatisticAttributeEstimateComponent(null, e);
42982        closeArray();
42983      };
42984  }
42985
42986  protected void composeEvidenceStatisticModelCharacteristicVariableComponent(String name, Evidence.EvidenceStatisticModelCharacteristicVariableComponent element) throws IOException {
42987    if (element != null) {
42988      open(name);
42989      composeEvidenceStatisticModelCharacteristicVariableComponentProperties(element);
42990      close();
42991    }
42992  }
42993
42994  protected void composeEvidenceStatisticModelCharacteristicVariableComponentProperties(Evidence.EvidenceStatisticModelCharacteristicVariableComponent element) throws IOException {
42995    composeBackboneElementProperties(element);
42996      if (element.hasVariableDefinition()) {
42997        composeReference("variableDefinition", element.getVariableDefinition());
42998      }
42999      if (element.hasHandlingElement()) {
43000        composeEnumerationCore("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
43001        composeEnumerationExtras("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
43002      }
43003      if (element.hasValueCategory()) {
43004        openArray("valueCategory");
43005        for (CodeableConcept e : element.getValueCategory()) 
43006          composeCodeableConcept(null, e);
43007        closeArray();
43008      };
43009      if (element.hasValueQuantity()) {
43010        openArray("valueQuantity");
43011        for (Quantity e : element.getValueQuantity()) 
43012          composeQuantity(null, e);
43013        closeArray();
43014      };
43015      if (element.hasValueRange()) {
43016        openArray("valueRange");
43017        for (Range e : element.getValueRange()) 
43018          composeRange(null, e);
43019        closeArray();
43020      };
43021  }
43022
43023  protected void composeEvidenceCertaintyComponent(String name, Evidence.EvidenceCertaintyComponent element) throws IOException {
43024    if (element != null) {
43025      open(name);
43026      composeEvidenceCertaintyComponentProperties(element);
43027      close();
43028    }
43029  }
43030
43031  protected void composeEvidenceCertaintyComponentProperties(Evidence.EvidenceCertaintyComponent element) throws IOException {
43032    composeBackboneElementProperties(element);
43033      if (element.hasDescriptionElement()) {
43034        composeStringCore("description", element.getDescriptionElement(), false);
43035        composeStringExtras("description", element.getDescriptionElement(), false);
43036      }
43037      if (element.hasNote()) {
43038        openArray("note");
43039        for (Annotation e : element.getNote()) 
43040          composeAnnotation(null, e);
43041        closeArray();
43042      };
43043      if (element.hasType()) {
43044        composeCodeableConcept("type", element.getType());
43045      }
43046      if (element.hasRating()) {
43047        composeCodeableConcept("rating", element.getRating());
43048      }
43049      if (element.hasRaterElement()) {
43050        composeStringCore("rater", element.getRaterElement(), false);
43051        composeStringExtras("rater", element.getRaterElement(), false);
43052      }
43053      if (element.hasSubcomponent()) {
43054        openArray("subcomponent");
43055        for (Evidence.EvidenceCertaintyComponent e : element.getSubcomponent()) 
43056          composeEvidenceCertaintyComponent(null, e);
43057        closeArray();
43058      };
43059  }
43060
43061  protected void composeEvidenceReport(String name, EvidenceReport element) throws IOException {
43062    if (element != null) {
43063      prop("resourceType", name);
43064      composeEvidenceReportProperties(element);
43065    }
43066  }
43067
43068  protected void composeEvidenceReportProperties(EvidenceReport element) throws IOException {
43069    composeDomainResourceProperties(element);
43070      if (element.hasUrlElement()) {
43071        composeUriCore("url", element.getUrlElement(), false);
43072        composeUriExtras("url", element.getUrlElement(), false);
43073      }
43074      if (element.hasStatusElement()) {
43075        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43076        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43077      }
43078      if (element.hasUseContext()) {
43079        openArray("useContext");
43080        for (UsageContext e : element.getUseContext()) 
43081          composeUsageContext(null, e);
43082        closeArray();
43083      };
43084      if (element.hasIdentifier()) {
43085        openArray("identifier");
43086        for (Identifier e : element.getIdentifier()) 
43087          composeIdentifier(null, e);
43088        closeArray();
43089      };
43090      if (element.hasRelatedIdentifier()) {
43091        openArray("relatedIdentifier");
43092        for (Identifier e : element.getRelatedIdentifier()) 
43093          composeIdentifier(null, e);
43094        closeArray();
43095      };
43096      if (element.hasCiteAs()) {
43097        composeType("citeAs", element.getCiteAs());
43098      }
43099      if (element.hasType()) {
43100        composeCodeableConcept("type", element.getType());
43101      }
43102      if (element.hasNote()) {
43103        openArray("note");
43104        for (Annotation e : element.getNote()) 
43105          composeAnnotation(null, e);
43106        closeArray();
43107      };
43108      if (element.hasRelatedArtifact()) {
43109        openArray("relatedArtifact");
43110        for (RelatedArtifact e : element.getRelatedArtifact()) 
43111          composeRelatedArtifact(null, e);
43112        closeArray();
43113      };
43114      if (element.hasSubject()) {
43115        composeEvidenceReportSubjectComponent("subject", element.getSubject());
43116      }
43117      if (element.hasPublisherElement()) {
43118        composeStringCore("publisher", element.getPublisherElement(), false);
43119        composeStringExtras("publisher", element.getPublisherElement(), false);
43120      }
43121      if (element.hasContact()) {
43122        openArray("contact");
43123        for (ContactDetail e : element.getContact()) 
43124          composeContactDetail(null, e);
43125        closeArray();
43126      };
43127      if (element.hasAuthor()) {
43128        openArray("author");
43129        for (ContactDetail e : element.getAuthor()) 
43130          composeContactDetail(null, e);
43131        closeArray();
43132      };
43133      if (element.hasEditor()) {
43134        openArray("editor");
43135        for (ContactDetail e : element.getEditor()) 
43136          composeContactDetail(null, e);
43137        closeArray();
43138      };
43139      if (element.hasReviewer()) {
43140        openArray("reviewer");
43141        for (ContactDetail e : element.getReviewer()) 
43142          composeContactDetail(null, e);
43143        closeArray();
43144      };
43145      if (element.hasEndorser()) {
43146        openArray("endorser");
43147        for (ContactDetail e : element.getEndorser()) 
43148          composeContactDetail(null, e);
43149        closeArray();
43150      };
43151      if (element.hasRelatesTo()) {
43152        openArray("relatesTo");
43153        for (EvidenceReport.EvidenceReportRelatesToComponent e : element.getRelatesTo()) 
43154          composeEvidenceReportRelatesToComponent(null, e);
43155        closeArray();
43156      };
43157      if (element.hasSection()) {
43158        openArray("section");
43159        for (EvidenceReport.SectionComponent e : element.getSection()) 
43160          composeSectionComponent(null, e);
43161        closeArray();
43162      };
43163  }
43164
43165  protected void composeEvidenceReportSubjectComponent(String name, EvidenceReport.EvidenceReportSubjectComponent element) throws IOException {
43166    if (element != null) {
43167      open(name);
43168      composeEvidenceReportSubjectComponentProperties(element);
43169      close();
43170    }
43171  }
43172
43173  protected void composeEvidenceReportSubjectComponentProperties(EvidenceReport.EvidenceReportSubjectComponent element) throws IOException {
43174    composeBackboneElementProperties(element);
43175      if (element.hasCharacteristic()) {
43176        openArray("characteristic");
43177        for (EvidenceReport.EvidenceReportSubjectCharacteristicComponent e : element.getCharacteristic()) 
43178          composeEvidenceReportSubjectCharacteristicComponent(null, e);
43179        closeArray();
43180      };
43181      if (element.hasNote()) {
43182        openArray("note");
43183        for (Annotation e : element.getNote()) 
43184          composeAnnotation(null, e);
43185        closeArray();
43186      };
43187  }
43188
43189  protected void composeEvidenceReportSubjectCharacteristicComponent(String name, EvidenceReport.EvidenceReportSubjectCharacteristicComponent element) throws IOException {
43190    if (element != null) {
43191      open(name);
43192      composeEvidenceReportSubjectCharacteristicComponentProperties(element);
43193      close();
43194    }
43195  }
43196
43197  protected void composeEvidenceReportSubjectCharacteristicComponentProperties(EvidenceReport.EvidenceReportSubjectCharacteristicComponent element) throws IOException {
43198    composeBackboneElementProperties(element);
43199      if (element.hasCode()) {
43200        composeCodeableConcept("code", element.getCode());
43201      }
43202      if (element.hasValue()) {
43203        composeType("value", element.getValue());
43204      }
43205      if (element.hasExcludeElement()) {
43206        composeBooleanCore("exclude", element.getExcludeElement(), false);
43207        composeBooleanExtras("exclude", element.getExcludeElement(), false);
43208      }
43209      if (element.hasPeriod()) {
43210        composePeriod("period", element.getPeriod());
43211      }
43212  }
43213
43214  protected void composeEvidenceReportRelatesToComponent(String name, EvidenceReport.EvidenceReportRelatesToComponent element) throws IOException {
43215    if (element != null) {
43216      open(name);
43217      composeEvidenceReportRelatesToComponentProperties(element);
43218      close();
43219    }
43220  }
43221
43222  protected void composeEvidenceReportRelatesToComponentProperties(EvidenceReport.EvidenceReportRelatesToComponent element) throws IOException {
43223    composeBackboneElementProperties(element);
43224      if (element.hasCodeElement()) {
43225        composeEnumerationCore("code", element.getCodeElement(), new EvidenceReport.ReportRelationshipTypeEnumFactory(), false);
43226        composeEnumerationExtras("code", element.getCodeElement(), new EvidenceReport.ReportRelationshipTypeEnumFactory(), false);
43227      }
43228      if (element.hasTarget()) {
43229        composeType("target", element.getTarget());
43230      }
43231  }
43232
43233  protected void composeSectionComponent(String name, EvidenceReport.SectionComponent element) throws IOException {
43234    if (element != null) {
43235      open(name);
43236      composeSectionComponentProperties(element);
43237      close();
43238    }
43239  }
43240
43241  protected void composeSectionComponentProperties(EvidenceReport.SectionComponent element) throws IOException {
43242    composeBackboneElementProperties(element);
43243      if (element.hasTitleElement()) {
43244        composeStringCore("title", element.getTitleElement(), false);
43245        composeStringExtras("title", element.getTitleElement(), false);
43246      }
43247      if (element.hasFocus()) {
43248        composeCodeableConcept("focus", element.getFocus());
43249      }
43250      if (element.hasFocusReference()) {
43251        composeReference("focusReference", element.getFocusReference());
43252      }
43253      if (element.hasAuthor()) {
43254        openArray("author");
43255        for (Reference e : element.getAuthor()) 
43256          composeReference(null, e);
43257        closeArray();
43258      };
43259      if (element.hasText()) {
43260        composeNarrative("text", element.getText());
43261      }
43262      if (element.hasModeElement()) {
43263        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
43264        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
43265      }
43266      if (element.hasOrderedBy()) {
43267        composeCodeableConcept("orderedBy", element.getOrderedBy());
43268      }
43269      if (element.hasEntryClassifier()) {
43270        openArray("entryClassifier");
43271        for (CodeableConcept e : element.getEntryClassifier()) 
43272          composeCodeableConcept(null, e);
43273        closeArray();
43274      };
43275      if (element.hasEntryReference()) {
43276        openArray("entryReference");
43277        for (Reference e : element.getEntryReference()) 
43278          composeReference(null, e);
43279        closeArray();
43280      };
43281      if (element.hasEntryQuantity()) {
43282        openArray("entryQuantity");
43283        for (Quantity e : element.getEntryQuantity()) 
43284          composeQuantity(null, e);
43285        closeArray();
43286      };
43287      if (element.hasEmptyReason()) {
43288        composeCodeableConcept("emptyReason", element.getEmptyReason());
43289      }
43290      if (element.hasSection()) {
43291        openArray("section");
43292        for (EvidenceReport.SectionComponent e : element.getSection()) 
43293          composeSectionComponent(null, e);
43294        closeArray();
43295      };
43296  }
43297
43298  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
43299    if (element != null) {
43300      prop("resourceType", name);
43301      composeEvidenceVariableProperties(element);
43302    }
43303  }
43304
43305  protected void composeEvidenceVariableProperties(EvidenceVariable element) throws IOException {
43306    composeDomainResourceProperties(element);
43307      if (element.hasUrlElement()) {
43308        composeUriCore("url", element.getUrlElement(), false);
43309        composeUriExtras("url", element.getUrlElement(), false);
43310      }
43311      if (element.hasIdentifier()) {
43312        openArray("identifier");
43313        for (Identifier e : element.getIdentifier()) 
43314          composeIdentifier(null, e);
43315        closeArray();
43316      };
43317      if (element.hasVersionElement()) {
43318        composeStringCore("version", element.getVersionElement(), false);
43319        composeStringExtras("version", element.getVersionElement(), false);
43320      }
43321      if (element.hasNameElement()) {
43322        composeStringCore("name", element.getNameElement(), false);
43323        composeStringExtras("name", element.getNameElement(), false);
43324      }
43325      if (element.hasTitleElement()) {
43326        composeStringCore("title", element.getTitleElement(), false);
43327        composeStringExtras("title", element.getTitleElement(), false);
43328      }
43329      if (element.hasShortTitleElement()) {
43330        composeStringCore("shortTitle", element.getShortTitleElement(), false);
43331        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
43332      }
43333      if (element.hasSubtitleElement()) {
43334        composeStringCore("subtitle", element.getSubtitleElement(), false);
43335        composeStringExtras("subtitle", element.getSubtitleElement(), false);
43336      }
43337      if (element.hasStatusElement()) {
43338        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43339        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43340      }
43341      if (element.hasDateElement()) {
43342        composeDateTimeCore("date", element.getDateElement(), false);
43343        composeDateTimeExtras("date", element.getDateElement(), false);
43344      }
43345      if (element.hasDescriptionElement()) {
43346        composeMarkdownCore("description", element.getDescriptionElement(), false);
43347        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43348      }
43349      if (element.hasNote()) {
43350        openArray("note");
43351        for (Annotation e : element.getNote()) 
43352          composeAnnotation(null, e);
43353        closeArray();
43354      };
43355      if (element.hasUseContext()) {
43356        openArray("useContext");
43357        for (UsageContext e : element.getUseContext()) 
43358          composeUsageContext(null, e);
43359        closeArray();
43360      };
43361      if (element.hasPublisherElement()) {
43362        composeStringCore("publisher", element.getPublisherElement(), false);
43363        composeStringExtras("publisher", element.getPublisherElement(), false);
43364      }
43365      if (element.hasContact()) {
43366        openArray("contact");
43367        for (ContactDetail e : element.getContact()) 
43368          composeContactDetail(null, e);
43369        closeArray();
43370      };
43371      if (element.hasAuthor()) {
43372        openArray("author");
43373        for (ContactDetail e : element.getAuthor()) 
43374          composeContactDetail(null, e);
43375        closeArray();
43376      };
43377      if (element.hasEditor()) {
43378        openArray("editor");
43379        for (ContactDetail e : element.getEditor()) 
43380          composeContactDetail(null, e);
43381        closeArray();
43382      };
43383      if (element.hasReviewer()) {
43384        openArray("reviewer");
43385        for (ContactDetail e : element.getReviewer()) 
43386          composeContactDetail(null, e);
43387        closeArray();
43388      };
43389      if (element.hasEndorser()) {
43390        openArray("endorser");
43391        for (ContactDetail e : element.getEndorser()) 
43392          composeContactDetail(null, e);
43393        closeArray();
43394      };
43395      if (element.hasRelatedArtifact()) {
43396        openArray("relatedArtifact");
43397        for (RelatedArtifact e : element.getRelatedArtifact()) 
43398          composeRelatedArtifact(null, e);
43399        closeArray();
43400      };
43401      if (element.hasActualElement()) {
43402        composeBooleanCore("actual", element.getActualElement(), false);
43403        composeBooleanExtras("actual", element.getActualElement(), false);
43404      }
43405      if (element.hasCharacteristicCombinationElement()) {
43406        composeEnumerationCore("characteristicCombination", element.getCharacteristicCombinationElement(), new EvidenceVariable.CharacteristicCombinationEnumFactory(), false);
43407        composeEnumerationExtras("characteristicCombination", element.getCharacteristicCombinationElement(), new EvidenceVariable.CharacteristicCombinationEnumFactory(), false);
43408      }
43409      if (element.hasCharacteristic()) {
43410        openArray("characteristic");
43411        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
43412          composeEvidenceVariableCharacteristicComponent(null, e);
43413        closeArray();
43414      };
43415      if (element.hasHandlingElement()) {
43416        composeEnumerationCore("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
43417        composeEnumerationExtras("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
43418      }
43419      if (element.hasCategory()) {
43420        openArray("category");
43421        for (EvidenceVariable.EvidenceVariableCategoryComponent e : element.getCategory()) 
43422          composeEvidenceVariableCategoryComponent(null, e);
43423        closeArray();
43424      };
43425  }
43426
43427  protected void composeEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
43428    if (element != null) {
43429      open(name);
43430      composeEvidenceVariableCharacteristicComponentProperties(element);
43431      close();
43432    }
43433  }
43434
43435  protected void composeEvidenceVariableCharacteristicComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
43436    composeBackboneElementProperties(element);
43437      if (element.hasDescriptionElement()) {
43438        composeStringCore("description", element.getDescriptionElement(), false);
43439        composeStringExtras("description", element.getDescriptionElement(), false);
43440      }
43441      if (element.hasDefinition()) {
43442        composeType("definition", element.getDefinition());
43443      }
43444      if (element.hasMethod()) {
43445        composeCodeableConcept("method", element.getMethod());
43446      }
43447      if (element.hasDevice()) {
43448        composeReference("device", element.getDevice());
43449      }
43450      if (element.hasExcludeElement()) {
43451        composeBooleanCore("exclude", element.getExcludeElement(), false);
43452        composeBooleanExtras("exclude", element.getExcludeElement(), false);
43453      }
43454      if (element.hasTimeFromStart()) {
43455        composeEvidenceVariableCharacteristicTimeFromStartComponent("timeFromStart", element.getTimeFromStart());
43456      }
43457      if (element.hasGroupMeasureElement()) {
43458        composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(), new Enumerations.GroupMeasureEnumFactory(), false);
43459        composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(), new Enumerations.GroupMeasureEnumFactory(), false);
43460      }
43461  }
43462
43463  protected void composeEvidenceVariableCharacteristicTimeFromStartComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent element) throws IOException {
43464    if (element != null) {
43465      open(name);
43466      composeEvidenceVariableCharacteristicTimeFromStartComponentProperties(element);
43467      close();
43468    }
43469  }
43470
43471  protected void composeEvidenceVariableCharacteristicTimeFromStartComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent element) throws IOException {
43472    composeBackboneElementProperties(element);
43473      if (element.hasDescriptionElement()) {
43474        composeStringCore("description", element.getDescriptionElement(), false);
43475        composeStringExtras("description", element.getDescriptionElement(), false);
43476      }
43477      if (element.hasQuantity()) {
43478        composeQuantity("quantity", element.getQuantity());
43479      }
43480      if (element.hasRange()) {
43481        composeRange("range", element.getRange());
43482      }
43483      if (element.hasNote()) {
43484        openArray("note");
43485        for (Annotation e : element.getNote()) 
43486          composeAnnotation(null, e);
43487        closeArray();
43488      };
43489  }
43490
43491  protected void composeEvidenceVariableCategoryComponent(String name, EvidenceVariable.EvidenceVariableCategoryComponent element) throws IOException {
43492    if (element != null) {
43493      open(name);
43494      composeEvidenceVariableCategoryComponentProperties(element);
43495      close();
43496    }
43497  }
43498
43499  protected void composeEvidenceVariableCategoryComponentProperties(EvidenceVariable.EvidenceVariableCategoryComponent element) throws IOException {
43500    composeBackboneElementProperties(element);
43501      if (element.hasNameElement()) {
43502        composeStringCore("name", element.getNameElement(), false);
43503        composeStringExtras("name", element.getNameElement(), false);
43504      }
43505      if (element.hasValue()) {
43506        composeType("value", element.getValue());
43507      }
43508  }
43509
43510  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
43511    if (element != null) {
43512      prop("resourceType", name);
43513      composeExampleScenarioProperties(element);
43514    }
43515  }
43516
43517  protected void composeExampleScenarioProperties(ExampleScenario element) throws IOException {
43518    composeDomainResourceProperties(element);
43519      if (element.hasUrlElement()) {
43520        composeUriCore("url", element.getUrlElement(), false);
43521        composeUriExtras("url", element.getUrlElement(), false);
43522      }
43523      if (element.hasIdentifier()) {
43524        openArray("identifier");
43525        for (Identifier e : element.getIdentifier()) 
43526          composeIdentifier(null, e);
43527        closeArray();
43528      };
43529      if (element.hasVersionElement()) {
43530        composeStringCore("version", element.getVersionElement(), false);
43531        composeStringExtras("version", element.getVersionElement(), false);
43532      }
43533      if (element.hasNameElement()) {
43534        composeStringCore("name", element.getNameElement(), false);
43535        composeStringExtras("name", element.getNameElement(), false);
43536      }
43537      if (element.hasStatusElement()) {
43538        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43539        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43540      }
43541      if (element.hasExperimentalElement()) {
43542        composeBooleanCore("experimental", element.getExperimentalElement(), false);
43543        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
43544      }
43545      if (element.hasDateElement()) {
43546        composeDateTimeCore("date", element.getDateElement(), false);
43547        composeDateTimeExtras("date", element.getDateElement(), false);
43548      }
43549      if (element.hasPublisherElement()) {
43550        composeStringCore("publisher", element.getPublisherElement(), false);
43551        composeStringExtras("publisher", element.getPublisherElement(), false);
43552      }
43553      if (element.hasContact()) {
43554        openArray("contact");
43555        for (ContactDetail e : element.getContact()) 
43556          composeContactDetail(null, e);
43557        closeArray();
43558      };
43559      if (element.hasUseContext()) {
43560        openArray("useContext");
43561        for (UsageContext e : element.getUseContext()) 
43562          composeUsageContext(null, e);
43563        closeArray();
43564      };
43565      if (element.hasJurisdiction()) {
43566        openArray("jurisdiction");
43567        for (CodeableConcept e : element.getJurisdiction()) 
43568          composeCodeableConcept(null, e);
43569        closeArray();
43570      };
43571      if (element.hasCopyrightElement()) {
43572        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43573        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43574      }
43575      if (element.hasPurposeElement()) {
43576        composeMarkdownCore("purpose", element.getPurposeElement(), false);
43577        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
43578      }
43579      if (element.hasActor()) {
43580        openArray("actor");
43581        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
43582          composeExampleScenarioActorComponent(null, e);
43583        closeArray();
43584      };
43585      if (element.hasInstance()) {
43586        openArray("instance");
43587        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
43588          composeExampleScenarioInstanceComponent(null, e);
43589        closeArray();
43590      };
43591      if (element.hasProcess()) {
43592        openArray("process");
43593        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
43594          composeExampleScenarioProcessComponent(null, e);
43595        closeArray();
43596      };
43597      if (element.hasWorkflow()) {
43598        if (anyHasValue(element.getWorkflow())) {
43599          openArray("workflow");
43600          for (CanonicalType e : element.getWorkflow()) 
43601            composeCanonicalCore(null, e, e != element.getWorkflow().get(element.getWorkflow().size()-1));
43602          closeArray();
43603        }
43604        if (anyHasExtras(element.getWorkflow())) {
43605          openArray("_workflow");
43606          for (CanonicalType e : element.getWorkflow()) 
43607            composeCanonicalExtras(null, e, true);
43608          closeArray();
43609        }
43610      };
43611  }
43612
43613  protected void composeExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
43614    if (element != null) {
43615      open(name);
43616      composeExampleScenarioActorComponentProperties(element);
43617      close();
43618    }
43619  }
43620
43621  protected void composeExampleScenarioActorComponentProperties(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
43622    composeBackboneElementProperties(element);
43623      if (element.hasActorIdElement()) {
43624        composeStringCore("actorId", element.getActorIdElement(), false);
43625        composeStringExtras("actorId", element.getActorIdElement(), false);
43626      }
43627      if (element.hasTypeElement()) {
43628        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
43629        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
43630      }
43631      if (element.hasNameElement()) {
43632        composeStringCore("name", element.getNameElement(), false);
43633        composeStringExtras("name", element.getNameElement(), false);
43634      }
43635      if (element.hasDescriptionElement()) {
43636        composeMarkdownCore("description", element.getDescriptionElement(), false);
43637        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43638      }
43639  }
43640
43641  protected void composeExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
43642    if (element != null) {
43643      open(name);
43644      composeExampleScenarioInstanceComponentProperties(element);
43645      close();
43646    }
43647  }
43648
43649  protected void composeExampleScenarioInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
43650    composeBackboneElementProperties(element);
43651      if (element.hasResourceIdElement()) {
43652        composeStringCore("resourceId", element.getResourceIdElement(), false);
43653        composeStringExtras("resourceId", element.getResourceIdElement(), false);
43654      }
43655      if (element.hasResourceTypeElement()) {
43656        composeCodeCore("resourceType", element.getResourceTypeElement(), false);
43657        composeCodeExtras("resourceType", element.getResourceTypeElement(), false);
43658      }
43659      if (element.hasNameElement()) {
43660        composeStringCore("name", element.getNameElement(), false);
43661        composeStringExtras("name", element.getNameElement(), false);
43662      }
43663      if (element.hasDescriptionElement()) {
43664        composeMarkdownCore("description", element.getDescriptionElement(), false);
43665        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43666      }
43667      if (element.hasVersion()) {
43668        openArray("version");
43669        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
43670          composeExampleScenarioInstanceVersionComponent(null, e);
43671        closeArray();
43672      };
43673      if (element.hasContainedInstance()) {
43674        openArray("containedInstance");
43675        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
43676          composeExampleScenarioInstanceContainedInstanceComponent(null, e);
43677        closeArray();
43678      };
43679  }
43680
43681  protected void composeExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
43682    if (element != null) {
43683      open(name);
43684      composeExampleScenarioInstanceVersionComponentProperties(element);
43685      close();
43686    }
43687  }
43688
43689  protected void composeExampleScenarioInstanceVersionComponentProperties(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
43690    composeBackboneElementProperties(element);
43691      if (element.hasVersionIdElement()) {
43692        composeStringCore("versionId", element.getVersionIdElement(), false);
43693        composeStringExtras("versionId", element.getVersionIdElement(), false);
43694      }
43695      if (element.hasDescriptionElement()) {
43696        composeMarkdownCore("description", element.getDescriptionElement(), false);
43697        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43698      }
43699  }
43700
43701  protected void composeExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
43702    if (element != null) {
43703      open(name);
43704      composeExampleScenarioInstanceContainedInstanceComponentProperties(element);
43705      close();
43706    }
43707  }
43708
43709  protected void composeExampleScenarioInstanceContainedInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
43710    composeBackboneElementProperties(element);
43711      if (element.hasResourceIdElement()) {
43712        composeStringCore("resourceId", element.getResourceIdElement(), false);
43713        composeStringExtras("resourceId", element.getResourceIdElement(), false);
43714      }
43715      if (element.hasVersionIdElement()) {
43716        composeStringCore("versionId", element.getVersionIdElement(), false);
43717        composeStringExtras("versionId", element.getVersionIdElement(), false);
43718      }
43719  }
43720
43721  protected void composeExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
43722    if (element != null) {
43723      open(name);
43724      composeExampleScenarioProcessComponentProperties(element);
43725      close();
43726    }
43727  }
43728
43729  protected void composeExampleScenarioProcessComponentProperties(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
43730    composeBackboneElementProperties(element);
43731      if (element.hasTitleElement()) {
43732        composeStringCore("title", element.getTitleElement(), false);
43733        composeStringExtras("title", element.getTitleElement(), false);
43734      }
43735      if (element.hasDescriptionElement()) {
43736        composeMarkdownCore("description", element.getDescriptionElement(), false);
43737        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43738      }
43739      if (element.hasPreConditionsElement()) {
43740        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
43741        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
43742      }
43743      if (element.hasPostConditionsElement()) {
43744        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
43745        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
43746      }
43747      if (element.hasStep()) {
43748        openArray("step");
43749        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
43750          composeExampleScenarioProcessStepComponent(null, e);
43751        closeArray();
43752      };
43753  }
43754
43755  protected void composeExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
43756    if (element != null) {
43757      open(name);
43758      composeExampleScenarioProcessStepComponentProperties(element);
43759      close();
43760    }
43761  }
43762
43763  protected void composeExampleScenarioProcessStepComponentProperties(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
43764    composeBackboneElementProperties(element);
43765      if (element.hasProcess()) {
43766        openArray("process");
43767        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
43768          composeExampleScenarioProcessComponent(null, e);
43769        closeArray();
43770      };
43771      if (element.hasPauseElement()) {
43772        composeBooleanCore("pause", element.getPauseElement(), false);
43773        composeBooleanExtras("pause", element.getPauseElement(), false);
43774      }
43775      if (element.hasOperation()) {
43776        composeExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
43777      }
43778      if (element.hasAlternative()) {
43779        openArray("alternative");
43780        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
43781          composeExampleScenarioProcessStepAlternativeComponent(null, e);
43782        closeArray();
43783      };
43784  }
43785
43786  protected void composeExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
43787    if (element != null) {
43788      open(name);
43789      composeExampleScenarioProcessStepOperationComponentProperties(element);
43790      close();
43791    }
43792  }
43793
43794  protected void composeExampleScenarioProcessStepOperationComponentProperties(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
43795    composeBackboneElementProperties(element);
43796      if (element.hasNumberElement()) {
43797        composeStringCore("number", element.getNumberElement(), false);
43798        composeStringExtras("number", element.getNumberElement(), false);
43799      }
43800      if (element.hasTypeElement()) {
43801        composeStringCore("type", element.getTypeElement(), false);
43802        composeStringExtras("type", element.getTypeElement(), false);
43803      }
43804      if (element.hasNameElement()) {
43805        composeStringCore("name", element.getNameElement(), false);
43806        composeStringExtras("name", element.getNameElement(), false);
43807      }
43808      if (element.hasInitiatorElement()) {
43809        composeStringCore("initiator", element.getInitiatorElement(), false);
43810        composeStringExtras("initiator", element.getInitiatorElement(), false);
43811      }
43812      if (element.hasReceiverElement()) {
43813        composeStringCore("receiver", element.getReceiverElement(), false);
43814        composeStringExtras("receiver", element.getReceiverElement(), false);
43815      }
43816      if (element.hasDescriptionElement()) {
43817        composeMarkdownCore("description", element.getDescriptionElement(), false);
43818        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43819      }
43820      if (element.hasInitiatorActiveElement()) {
43821        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
43822        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
43823      }
43824      if (element.hasReceiverActiveElement()) {
43825        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
43826        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
43827      }
43828      if (element.hasRequest()) {
43829        composeExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
43830      }
43831      if (element.hasResponse()) {
43832        composeExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
43833      }
43834  }
43835
43836  protected void composeExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
43837    if (element != null) {
43838      open(name);
43839      composeExampleScenarioProcessStepAlternativeComponentProperties(element);
43840      close();
43841    }
43842  }
43843
43844  protected void composeExampleScenarioProcessStepAlternativeComponentProperties(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
43845    composeBackboneElementProperties(element);
43846      if (element.hasTitleElement()) {
43847        composeStringCore("title", element.getTitleElement(), false);
43848        composeStringExtras("title", element.getTitleElement(), false);
43849      }
43850      if (element.hasDescriptionElement()) {
43851        composeMarkdownCore("description", element.getDescriptionElement(), false);
43852        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43853      }
43854      if (element.hasStep()) {
43855        openArray("step");
43856        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
43857          composeExampleScenarioProcessStepComponent(null, e);
43858        closeArray();
43859      };
43860  }
43861
43862  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
43863    if (element != null) {
43864      prop("resourceType", name);
43865      composeExplanationOfBenefitProperties(element);
43866    }
43867  }
43868
43869  protected void composeExplanationOfBenefitProperties(ExplanationOfBenefit element) throws IOException {
43870    composeDomainResourceProperties(element);
43871      if (element.hasIdentifier()) {
43872        openArray("identifier");
43873        for (Identifier e : element.getIdentifier()) 
43874          composeIdentifier(null, e);
43875        closeArray();
43876      };
43877      if (element.hasStatusElement()) {
43878        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
43879        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
43880      }
43881      if (element.hasType()) {
43882        composeCodeableConcept("type", element.getType());
43883      }
43884      if (element.hasSubType()) {
43885        composeCodeableConcept("subType", element.getSubType());
43886      }
43887      if (element.hasUseElement()) {
43888        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43889        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43890      }
43891      if (element.hasPatient()) {
43892        composeReference("patient", element.getPatient());
43893      }
43894      if (element.hasBillablePeriod()) {
43895        composePeriod("billablePeriod", element.getBillablePeriod());
43896      }
43897      if (element.hasCreatedElement()) {
43898        composeDateTimeCore("created", element.getCreatedElement(), false);
43899        composeDateTimeExtras("created", element.getCreatedElement(), false);
43900      }
43901      if (element.hasEnterer()) {
43902        composeReference("enterer", element.getEnterer());
43903      }
43904      if (element.hasInsurer()) {
43905        composeReference("insurer", element.getInsurer());
43906      }
43907      if (element.hasProvider()) {
43908        composeReference("provider", element.getProvider());
43909      }
43910      if (element.hasPriority()) {
43911        composeCodeableConcept("priority", element.getPriority());
43912      }
43913      if (element.hasFundsReserveRequested()) {
43914        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
43915      }
43916      if (element.hasFundsReserve()) {
43917        composeCodeableConcept("fundsReserve", element.getFundsReserve());
43918      }
43919      if (element.hasRelated()) {
43920        openArray("related");
43921        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
43922          composeRelatedClaimComponent(null, e);
43923        closeArray();
43924      };
43925      if (element.hasPrescription()) {
43926        composeReference("prescription", element.getPrescription());
43927      }
43928      if (element.hasOriginalPrescription()) {
43929        composeReference("originalPrescription", element.getOriginalPrescription());
43930      }
43931      if (element.hasPayee()) {
43932        composePayeeComponent("payee", element.getPayee());
43933      }
43934      if (element.hasReferral()) {
43935        composeReference("referral", element.getReferral());
43936      }
43937      if (element.hasFacility()) {
43938        composeReference("facility", element.getFacility());
43939      }
43940      if (element.hasClaim()) {
43941        composeReference("claim", element.getClaim());
43942      }
43943      if (element.hasClaimResponse()) {
43944        composeReference("claimResponse", element.getClaimResponse());
43945      }
43946      if (element.hasOutcomeElement()) {
43947        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
43948        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
43949      }
43950      if (element.hasDispositionElement()) {
43951        composeStringCore("disposition", element.getDispositionElement(), false);
43952        composeStringExtras("disposition", element.getDispositionElement(), false);
43953      }
43954      if (element.hasPreAuthRef()) {
43955        if (anyHasValue(element.getPreAuthRef())) {
43956          openArray("preAuthRef");
43957          for (StringType e : element.getPreAuthRef()) 
43958            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
43959          closeArray();
43960        }
43961        if (anyHasExtras(element.getPreAuthRef())) {
43962          openArray("_preAuthRef");
43963          for (StringType e : element.getPreAuthRef()) 
43964            composeStringExtras(null, e, true);
43965          closeArray();
43966        }
43967      };
43968      if (element.hasPreAuthRefPeriod()) {
43969        openArray("preAuthRefPeriod");
43970        for (Period e : element.getPreAuthRefPeriod()) 
43971          composePeriod(null, e);
43972        closeArray();
43973      };
43974      if (element.hasCareTeam()) {
43975        openArray("careTeam");
43976        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
43977          composeCareTeamComponent(null, e);
43978        closeArray();
43979      };
43980      if (element.hasSupportingInfo()) {
43981        openArray("supportingInfo");
43982        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
43983          composeSupportingInformationComponent(null, e);
43984        closeArray();
43985      };
43986      if (element.hasDiagnosis()) {
43987        openArray("diagnosis");
43988        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
43989          composeDiagnosisComponent(null, e);
43990        closeArray();
43991      };
43992      if (element.hasProcedure()) {
43993        openArray("procedure");
43994        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
43995          composeProcedureComponent(null, e);
43996        closeArray();
43997      };
43998      if (element.hasPrecedenceElement()) {
43999        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
44000        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
44001      }
44002      if (element.hasInsurance()) {
44003        openArray("insurance");
44004        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
44005          composeInsuranceComponent(null, e);
44006        closeArray();
44007      };
44008      if (element.hasAccident()) {
44009        composeAccidentComponent("accident", element.getAccident());
44010      }
44011      if (element.hasItem()) {
44012        openArray("item");
44013        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
44014          composeItemComponent(null, e);
44015        closeArray();
44016      };
44017      if (element.hasAddItem()) {
44018        openArray("addItem");
44019        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
44020          composeAddedItemComponent(null, e);
44021        closeArray();
44022      };
44023      if (element.hasAdjudication()) {
44024        openArray("adjudication");
44025        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44026          composeAdjudicationComponent(null, e);
44027        closeArray();
44028      };
44029      if (element.hasTotal()) {
44030        openArray("total");
44031        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
44032          composeTotalComponent(null, e);
44033        closeArray();
44034      };
44035      if (element.hasPayment()) {
44036        composePaymentComponent("payment", element.getPayment());
44037      }
44038      if (element.hasFormCode()) {
44039        composeCodeableConcept("formCode", element.getFormCode());
44040      }
44041      if (element.hasForm()) {
44042        composeAttachment("form", element.getForm());
44043      }
44044      if (element.hasProcessNote()) {
44045        openArray("processNote");
44046        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
44047          composeNoteComponent(null, e);
44048        closeArray();
44049      };
44050      if (element.hasBenefitPeriod()) {
44051        composePeriod("benefitPeriod", element.getBenefitPeriod());
44052      }
44053      if (element.hasBenefitBalance()) {
44054        openArray("benefitBalance");
44055        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
44056          composeBenefitBalanceComponent(null, e);
44057        closeArray();
44058      };
44059  }
44060
44061  protected void composeRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
44062    if (element != null) {
44063      open(name);
44064      composeRelatedClaimComponentProperties(element);
44065      close();
44066    }
44067  }
44068
44069  protected void composeRelatedClaimComponentProperties(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
44070    composeBackboneElementProperties(element);
44071      if (element.hasClaim()) {
44072        composeReference("claim", element.getClaim());
44073      }
44074      if (element.hasRelationship()) {
44075        composeCodeableConcept("relationship", element.getRelationship());
44076      }
44077      if (element.hasReference()) {
44078        composeIdentifier("reference", element.getReference());
44079      }
44080  }
44081
44082  protected void composePayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
44083    if (element != null) {
44084      open(name);
44085      composePayeeComponentProperties(element);
44086      close();
44087    }
44088  }
44089
44090  protected void composePayeeComponentProperties(ExplanationOfBenefit.PayeeComponent element) throws IOException {
44091    composeBackboneElementProperties(element);
44092      if (element.hasType()) {
44093        composeCodeableConcept("type", element.getType());
44094      }
44095      if (element.hasParty()) {
44096        composeReference("party", element.getParty());
44097      }
44098  }
44099
44100  protected void composeCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
44101    if (element != null) {
44102      open(name);
44103      composeCareTeamComponentProperties(element);
44104      close();
44105    }
44106  }
44107
44108  protected void composeCareTeamComponentProperties(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
44109    composeBackboneElementProperties(element);
44110      if (element.hasSequenceElement()) {
44111        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44112        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44113      }
44114      if (element.hasProvider()) {
44115        composeReference("provider", element.getProvider());
44116      }
44117      if (element.hasResponsibleElement()) {
44118        composeBooleanCore("responsible", element.getResponsibleElement(), false);
44119        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
44120      }
44121      if (element.hasRole()) {
44122        composeCodeableConcept("role", element.getRole());
44123      }
44124      if (element.hasQualification()) {
44125        composeCodeableConcept("qualification", element.getQualification());
44126      }
44127  }
44128
44129  protected void composeSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
44130    if (element != null) {
44131      open(name);
44132      composeSupportingInformationComponentProperties(element);
44133      close();
44134    }
44135  }
44136
44137  protected void composeSupportingInformationComponentProperties(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
44138    composeBackboneElementProperties(element);
44139      if (element.hasSequenceElement()) {
44140        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44141        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44142      }
44143      if (element.hasCategory()) {
44144        composeCodeableConcept("category", element.getCategory());
44145      }
44146      if (element.hasCode()) {
44147        composeCodeableConcept("code", element.getCode());
44148      }
44149      if (element.hasTiming()) {
44150        composeType("timing", element.getTiming());
44151      }
44152      if (element.hasValue()) {
44153        composeType("value", element.getValue());
44154      }
44155      if (element.hasReason()) {
44156        composeCoding("reason", element.getReason());
44157      }
44158  }
44159
44160  protected void composeDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
44161    if (element != null) {
44162      open(name);
44163      composeDiagnosisComponentProperties(element);
44164      close();
44165    }
44166  }
44167
44168  protected void composeDiagnosisComponentProperties(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
44169    composeBackboneElementProperties(element);
44170      if (element.hasSequenceElement()) {
44171        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44172        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44173      }
44174      if (element.hasDiagnosis()) {
44175        composeType("diagnosis", element.getDiagnosis());
44176      }
44177      if (element.hasType()) {
44178        openArray("type");
44179        for (CodeableConcept e : element.getType()) 
44180          composeCodeableConcept(null, e);
44181        closeArray();
44182      };
44183      if (element.hasOnAdmission()) {
44184        composeCodeableConcept("onAdmission", element.getOnAdmission());
44185      }
44186      if (element.hasPackageCode()) {
44187        composeCodeableConcept("packageCode", element.getPackageCode());
44188      }
44189  }
44190
44191  protected void composeProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
44192    if (element != null) {
44193      open(name);
44194      composeProcedureComponentProperties(element);
44195      close();
44196    }
44197  }
44198
44199  protected void composeProcedureComponentProperties(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
44200    composeBackboneElementProperties(element);
44201      if (element.hasSequenceElement()) {
44202        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44203        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44204      }
44205      if (element.hasType()) {
44206        openArray("type");
44207        for (CodeableConcept e : element.getType()) 
44208          composeCodeableConcept(null, e);
44209        closeArray();
44210      };
44211      if (element.hasDateElement()) {
44212        composeDateTimeCore("date", element.getDateElement(), false);
44213        composeDateTimeExtras("date", element.getDateElement(), false);
44214      }
44215      if (element.hasProcedure()) {
44216        composeType("procedure", element.getProcedure());
44217      }
44218      if (element.hasUdi()) {
44219        openArray("udi");
44220        for (Reference e : element.getUdi()) 
44221          composeReference(null, e);
44222        closeArray();
44223      };
44224  }
44225
44226  protected void composeInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
44227    if (element != null) {
44228      open(name);
44229      composeInsuranceComponentProperties(element);
44230      close();
44231    }
44232  }
44233
44234  protected void composeInsuranceComponentProperties(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
44235    composeBackboneElementProperties(element);
44236      if (element.hasFocalElement()) {
44237        composeBooleanCore("focal", element.getFocalElement(), false);
44238        composeBooleanExtras("focal", element.getFocalElement(), false);
44239      }
44240      if (element.hasCoverage()) {
44241        composeReference("coverage", element.getCoverage());
44242      }
44243      if (element.hasPreAuthRef()) {
44244        if (anyHasValue(element.getPreAuthRef())) {
44245          openArray("preAuthRef");
44246          for (StringType e : element.getPreAuthRef()) 
44247            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
44248          closeArray();
44249        }
44250        if (anyHasExtras(element.getPreAuthRef())) {
44251          openArray("_preAuthRef");
44252          for (StringType e : element.getPreAuthRef()) 
44253            composeStringExtras(null, e, true);
44254          closeArray();
44255        }
44256      };
44257  }
44258
44259  protected void composeAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
44260    if (element != null) {
44261      open(name);
44262      composeAccidentComponentProperties(element);
44263      close();
44264    }
44265  }
44266
44267  protected void composeAccidentComponentProperties(ExplanationOfBenefit.AccidentComponent element) throws IOException {
44268    composeBackboneElementProperties(element);
44269      if (element.hasDateElement()) {
44270        composeDateCore("date", element.getDateElement(), false);
44271        composeDateExtras("date", element.getDateElement(), false);
44272      }
44273      if (element.hasType()) {
44274        composeCodeableConcept("type", element.getType());
44275      }
44276      if (element.hasLocation()) {
44277        composeType("location", element.getLocation());
44278      }
44279  }
44280
44281  protected void composeItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
44282    if (element != null) {
44283      open(name);
44284      composeItemComponentProperties(element);
44285      close();
44286    }
44287  }
44288
44289  protected void composeItemComponentProperties(ExplanationOfBenefit.ItemComponent element) throws IOException {
44290    composeBackboneElementProperties(element);
44291      if (element.hasSequenceElement()) {
44292        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44293        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44294      }
44295      if (element.hasCareTeamSequence()) {
44296        if (anyHasValue(element.getCareTeamSequence())) {
44297          openArray("careTeamSequence");
44298          for (PositiveIntType e : element.getCareTeamSequence()) 
44299            composePositiveIntCore(null, e, e != element.getCareTeamSequence().get(element.getCareTeamSequence().size()-1));
44300          closeArray();
44301        }
44302        if (anyHasExtras(element.getCareTeamSequence())) {
44303          openArray("_careTeamSequence");
44304          for (PositiveIntType e : element.getCareTeamSequence()) 
44305            composePositiveIntExtras(null, e, true);
44306          closeArray();
44307        }
44308      };
44309      if (element.hasDiagnosisSequence()) {
44310        if (anyHasValue(element.getDiagnosisSequence())) {
44311          openArray("diagnosisSequence");
44312          for (PositiveIntType e : element.getDiagnosisSequence()) 
44313            composePositiveIntCore(null, e, e != element.getDiagnosisSequence().get(element.getDiagnosisSequence().size()-1));
44314          closeArray();
44315        }
44316        if (anyHasExtras(element.getDiagnosisSequence())) {
44317          openArray("_diagnosisSequence");
44318          for (PositiveIntType e : element.getDiagnosisSequence()) 
44319            composePositiveIntExtras(null, e, true);
44320          closeArray();
44321        }
44322      };
44323      if (element.hasProcedureSequence()) {
44324        if (anyHasValue(element.getProcedureSequence())) {
44325          openArray("procedureSequence");
44326          for (PositiveIntType e : element.getProcedureSequence()) 
44327            composePositiveIntCore(null, e, e != element.getProcedureSequence().get(element.getProcedureSequence().size()-1));
44328          closeArray();
44329        }
44330        if (anyHasExtras(element.getProcedureSequence())) {
44331          openArray("_procedureSequence");
44332          for (PositiveIntType e : element.getProcedureSequence()) 
44333            composePositiveIntExtras(null, e, true);
44334          closeArray();
44335        }
44336      };
44337      if (element.hasInformationSequence()) {
44338        if (anyHasValue(element.getInformationSequence())) {
44339          openArray("informationSequence");
44340          for (PositiveIntType e : element.getInformationSequence()) 
44341            composePositiveIntCore(null, e, e != element.getInformationSequence().get(element.getInformationSequence().size()-1));
44342          closeArray();
44343        }
44344        if (anyHasExtras(element.getInformationSequence())) {
44345          openArray("_informationSequence");
44346          for (PositiveIntType e : element.getInformationSequence()) 
44347            composePositiveIntExtras(null, e, true);
44348          closeArray();
44349        }
44350      };
44351      if (element.hasRevenue()) {
44352        composeCodeableConcept("revenue", element.getRevenue());
44353      }
44354      if (element.hasCategory()) {
44355        composeCodeableConcept("category", element.getCategory());
44356      }
44357      if (element.hasProductOrService()) {
44358        composeCodeableConcept("productOrService", element.getProductOrService());
44359      }
44360      if (element.hasModifier()) {
44361        openArray("modifier");
44362        for (CodeableConcept e : element.getModifier()) 
44363          composeCodeableConcept(null, e);
44364        closeArray();
44365      };
44366      if (element.hasProgramCode()) {
44367        openArray("programCode");
44368        for (CodeableConcept e : element.getProgramCode()) 
44369          composeCodeableConcept(null, e);
44370        closeArray();
44371      };
44372      if (element.hasServiced()) {
44373        composeType("serviced", element.getServiced());
44374      }
44375      if (element.hasLocation()) {
44376        composeType("location", element.getLocation());
44377      }
44378      if (element.hasQuantity()) {
44379        composeQuantity("quantity", element.getQuantity());
44380      }
44381      if (element.hasUnitPrice()) {
44382        composeMoney("unitPrice", element.getUnitPrice());
44383      }
44384      if (element.hasFactorElement()) {
44385        composeDecimalCore("factor", element.getFactorElement(), false);
44386        composeDecimalExtras("factor", element.getFactorElement(), false);
44387      }
44388      if (element.hasNet()) {
44389        composeMoney("net", element.getNet());
44390      }
44391      if (element.hasUdi()) {
44392        openArray("udi");
44393        for (Reference e : element.getUdi()) 
44394          composeReference(null, e);
44395        closeArray();
44396      };
44397      if (element.hasBodySite()) {
44398        composeCodeableConcept("bodySite", element.getBodySite());
44399      }
44400      if (element.hasSubSite()) {
44401        openArray("subSite");
44402        for (CodeableConcept e : element.getSubSite()) 
44403          composeCodeableConcept(null, e);
44404        closeArray();
44405      };
44406      if (element.hasEncounter()) {
44407        openArray("encounter");
44408        for (Reference e : element.getEncounter()) 
44409          composeReference(null, e);
44410        closeArray();
44411      };
44412      if (element.hasNoteNumber()) {
44413        if (anyHasValue(element.getNoteNumber())) {
44414          openArray("noteNumber");
44415          for (PositiveIntType e : element.getNoteNumber()) 
44416            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44417          closeArray();
44418        }
44419        if (anyHasExtras(element.getNoteNumber())) {
44420          openArray("_noteNumber");
44421          for (PositiveIntType e : element.getNoteNumber()) 
44422            composePositiveIntExtras(null, e, true);
44423          closeArray();
44424        }
44425      };
44426      if (element.hasAdjudication()) {
44427        openArray("adjudication");
44428        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44429          composeAdjudicationComponent(null, e);
44430        closeArray();
44431      };
44432      if (element.hasDetail()) {
44433        openArray("detail");
44434        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
44435          composeDetailComponent(null, e);
44436        closeArray();
44437      };
44438  }
44439
44440  protected void composeAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
44441    if (element != null) {
44442      open(name);
44443      composeAdjudicationComponentProperties(element);
44444      close();
44445    }
44446  }
44447
44448  protected void composeAdjudicationComponentProperties(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
44449    composeBackboneElementProperties(element);
44450      if (element.hasCategory()) {
44451        composeCodeableConcept("category", element.getCategory());
44452      }
44453      if (element.hasReason()) {
44454        composeCodeableConcept("reason", element.getReason());
44455      }
44456      if (element.hasAmount()) {
44457        composeMoney("amount", element.getAmount());
44458      }
44459      if (element.hasValueElement()) {
44460        composeDecimalCore("value", element.getValueElement(), false);
44461        composeDecimalExtras("value", element.getValueElement(), false);
44462      }
44463  }
44464
44465  protected void composeDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
44466    if (element != null) {
44467      open(name);
44468      composeDetailComponentProperties(element);
44469      close();
44470    }
44471  }
44472
44473  protected void composeDetailComponentProperties(ExplanationOfBenefit.DetailComponent element) throws IOException {
44474    composeBackboneElementProperties(element);
44475      if (element.hasSequenceElement()) {
44476        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44477        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44478      }
44479      if (element.hasRevenue()) {
44480        composeCodeableConcept("revenue", element.getRevenue());
44481      }
44482      if (element.hasCategory()) {
44483        composeCodeableConcept("category", element.getCategory());
44484      }
44485      if (element.hasProductOrService()) {
44486        composeCodeableConcept("productOrService", element.getProductOrService());
44487      }
44488      if (element.hasModifier()) {
44489        openArray("modifier");
44490        for (CodeableConcept e : element.getModifier()) 
44491          composeCodeableConcept(null, e);
44492        closeArray();
44493      };
44494      if (element.hasProgramCode()) {
44495        openArray("programCode");
44496        for (CodeableConcept e : element.getProgramCode()) 
44497          composeCodeableConcept(null, e);
44498        closeArray();
44499      };
44500      if (element.hasQuantity()) {
44501        composeQuantity("quantity", element.getQuantity());
44502      }
44503      if (element.hasUnitPrice()) {
44504        composeMoney("unitPrice", element.getUnitPrice());
44505      }
44506      if (element.hasFactorElement()) {
44507        composeDecimalCore("factor", element.getFactorElement(), false);
44508        composeDecimalExtras("factor", element.getFactorElement(), false);
44509      }
44510      if (element.hasNet()) {
44511        composeMoney("net", element.getNet());
44512      }
44513      if (element.hasUdi()) {
44514        openArray("udi");
44515        for (Reference e : element.getUdi()) 
44516          composeReference(null, e);
44517        closeArray();
44518      };
44519      if (element.hasNoteNumber()) {
44520        if (anyHasValue(element.getNoteNumber())) {
44521          openArray("noteNumber");
44522          for (PositiveIntType e : element.getNoteNumber()) 
44523            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44524          closeArray();
44525        }
44526        if (anyHasExtras(element.getNoteNumber())) {
44527          openArray("_noteNumber");
44528          for (PositiveIntType e : element.getNoteNumber()) 
44529            composePositiveIntExtras(null, e, true);
44530          closeArray();
44531        }
44532      };
44533      if (element.hasAdjudication()) {
44534        openArray("adjudication");
44535        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44536          composeAdjudicationComponent(null, e);
44537        closeArray();
44538      };
44539      if (element.hasSubDetail()) {
44540        openArray("subDetail");
44541        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
44542          composeSubDetailComponent(null, e);
44543        closeArray();
44544      };
44545  }
44546
44547  protected void composeSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
44548    if (element != null) {
44549      open(name);
44550      composeSubDetailComponentProperties(element);
44551      close();
44552    }
44553  }
44554
44555  protected void composeSubDetailComponentProperties(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
44556    composeBackboneElementProperties(element);
44557      if (element.hasSequenceElement()) {
44558        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44559        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44560      }
44561      if (element.hasRevenue()) {
44562        composeCodeableConcept("revenue", element.getRevenue());
44563      }
44564      if (element.hasCategory()) {
44565        composeCodeableConcept("category", element.getCategory());
44566      }
44567      if (element.hasProductOrService()) {
44568        composeCodeableConcept("productOrService", element.getProductOrService());
44569      }
44570      if (element.hasModifier()) {
44571        openArray("modifier");
44572        for (CodeableConcept e : element.getModifier()) 
44573          composeCodeableConcept(null, e);
44574        closeArray();
44575      };
44576      if (element.hasProgramCode()) {
44577        openArray("programCode");
44578        for (CodeableConcept e : element.getProgramCode()) 
44579          composeCodeableConcept(null, e);
44580        closeArray();
44581      };
44582      if (element.hasQuantity()) {
44583        composeQuantity("quantity", element.getQuantity());
44584      }
44585      if (element.hasUnitPrice()) {
44586        composeMoney("unitPrice", element.getUnitPrice());
44587      }
44588      if (element.hasFactorElement()) {
44589        composeDecimalCore("factor", element.getFactorElement(), false);
44590        composeDecimalExtras("factor", element.getFactorElement(), false);
44591      }
44592      if (element.hasNet()) {
44593        composeMoney("net", element.getNet());
44594      }
44595      if (element.hasUdi()) {
44596        openArray("udi");
44597        for (Reference e : element.getUdi()) 
44598          composeReference(null, e);
44599        closeArray();
44600      };
44601      if (element.hasNoteNumber()) {
44602        if (anyHasValue(element.getNoteNumber())) {
44603          openArray("noteNumber");
44604          for (PositiveIntType e : element.getNoteNumber()) 
44605            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44606          closeArray();
44607        }
44608        if (anyHasExtras(element.getNoteNumber())) {
44609          openArray("_noteNumber");
44610          for (PositiveIntType e : element.getNoteNumber()) 
44611            composePositiveIntExtras(null, e, true);
44612          closeArray();
44613        }
44614      };
44615      if (element.hasAdjudication()) {
44616        openArray("adjudication");
44617        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44618          composeAdjudicationComponent(null, e);
44619        closeArray();
44620      };
44621  }
44622
44623  protected void composeAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
44624    if (element != null) {
44625      open(name);
44626      composeAddedItemComponentProperties(element);
44627      close();
44628    }
44629  }
44630
44631  protected void composeAddedItemComponentProperties(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
44632    composeBackboneElementProperties(element);
44633      if (element.hasItemSequence()) {
44634        if (anyHasValue(element.getItemSequence())) {
44635          openArray("itemSequence");
44636          for (PositiveIntType e : element.getItemSequence()) 
44637            composePositiveIntCore(null, e, e != element.getItemSequence().get(element.getItemSequence().size()-1));
44638          closeArray();
44639        }
44640        if (anyHasExtras(element.getItemSequence())) {
44641          openArray("_itemSequence");
44642          for (PositiveIntType e : element.getItemSequence()) 
44643            composePositiveIntExtras(null, e, true);
44644          closeArray();
44645        }
44646      };
44647      if (element.hasDetailSequence()) {
44648        if (anyHasValue(element.getDetailSequence())) {
44649          openArray("detailSequence");
44650          for (PositiveIntType e : element.getDetailSequence()) 
44651            composePositiveIntCore(null, e, e != element.getDetailSequence().get(element.getDetailSequence().size()-1));
44652          closeArray();
44653        }
44654        if (anyHasExtras(element.getDetailSequence())) {
44655          openArray("_detailSequence");
44656          for (PositiveIntType e : element.getDetailSequence()) 
44657            composePositiveIntExtras(null, e, true);
44658          closeArray();
44659        }
44660      };
44661      if (element.hasSubDetailSequence()) {
44662        if (anyHasValue(element.getSubDetailSequence())) {
44663          openArray("subDetailSequence");
44664          for (PositiveIntType e : element.getSubDetailSequence()) 
44665            composePositiveIntCore(null, e, e != element.getSubDetailSequence().get(element.getSubDetailSequence().size()-1));
44666          closeArray();
44667        }
44668        if (anyHasExtras(element.getSubDetailSequence())) {
44669          openArray("_subDetailSequence");
44670          for (PositiveIntType e : element.getSubDetailSequence()) 
44671            composePositiveIntExtras(null, e, true);
44672          closeArray();
44673        }
44674      };
44675      if (element.hasProvider()) {
44676        openArray("provider");
44677        for (Reference e : element.getProvider()) 
44678          composeReference(null, e);
44679        closeArray();
44680      };
44681      if (element.hasProductOrService()) {
44682        composeCodeableConcept("productOrService", element.getProductOrService());
44683      }
44684      if (element.hasModifier()) {
44685        openArray("modifier");
44686        for (CodeableConcept e : element.getModifier()) 
44687          composeCodeableConcept(null, e);
44688        closeArray();
44689      };
44690      if (element.hasProgramCode()) {
44691        openArray("programCode");
44692        for (CodeableConcept e : element.getProgramCode()) 
44693          composeCodeableConcept(null, e);
44694        closeArray();
44695      };
44696      if (element.hasServiced()) {
44697        composeType("serviced", element.getServiced());
44698      }
44699      if (element.hasLocation()) {
44700        composeType("location", element.getLocation());
44701      }
44702      if (element.hasQuantity()) {
44703        composeQuantity("quantity", element.getQuantity());
44704      }
44705      if (element.hasUnitPrice()) {
44706        composeMoney("unitPrice", element.getUnitPrice());
44707      }
44708      if (element.hasFactorElement()) {
44709        composeDecimalCore("factor", element.getFactorElement(), false);
44710        composeDecimalExtras("factor", element.getFactorElement(), false);
44711      }
44712      if (element.hasNet()) {
44713        composeMoney("net", element.getNet());
44714      }
44715      if (element.hasBodySite()) {
44716        composeCodeableConcept("bodySite", element.getBodySite());
44717      }
44718      if (element.hasSubSite()) {
44719        openArray("subSite");
44720        for (CodeableConcept e : element.getSubSite()) 
44721          composeCodeableConcept(null, e);
44722        closeArray();
44723      };
44724      if (element.hasNoteNumber()) {
44725        if (anyHasValue(element.getNoteNumber())) {
44726          openArray("noteNumber");
44727          for (PositiveIntType e : element.getNoteNumber()) 
44728            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44729          closeArray();
44730        }
44731        if (anyHasExtras(element.getNoteNumber())) {
44732          openArray("_noteNumber");
44733          for (PositiveIntType e : element.getNoteNumber()) 
44734            composePositiveIntExtras(null, e, true);
44735          closeArray();
44736        }
44737      };
44738      if (element.hasAdjudication()) {
44739        openArray("adjudication");
44740        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44741          composeAdjudicationComponent(null, e);
44742        closeArray();
44743      };
44744      if (element.hasDetail()) {
44745        openArray("detail");
44746        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
44747          composeAddedItemDetailComponent(null, e);
44748        closeArray();
44749      };
44750  }
44751
44752  protected void composeAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
44753    if (element != null) {
44754      open(name);
44755      composeAddedItemDetailComponentProperties(element);
44756      close();
44757    }
44758  }
44759
44760  protected void composeAddedItemDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
44761    composeBackboneElementProperties(element);
44762      if (element.hasProductOrService()) {
44763        composeCodeableConcept("productOrService", element.getProductOrService());
44764      }
44765      if (element.hasModifier()) {
44766        openArray("modifier");
44767        for (CodeableConcept e : element.getModifier()) 
44768          composeCodeableConcept(null, e);
44769        closeArray();
44770      };
44771      if (element.hasQuantity()) {
44772        composeQuantity("quantity", element.getQuantity());
44773      }
44774      if (element.hasUnitPrice()) {
44775        composeMoney("unitPrice", element.getUnitPrice());
44776      }
44777      if (element.hasFactorElement()) {
44778        composeDecimalCore("factor", element.getFactorElement(), false);
44779        composeDecimalExtras("factor", element.getFactorElement(), false);
44780      }
44781      if (element.hasNet()) {
44782        composeMoney("net", element.getNet());
44783      }
44784      if (element.hasNoteNumber()) {
44785        if (anyHasValue(element.getNoteNumber())) {
44786          openArray("noteNumber");
44787          for (PositiveIntType e : element.getNoteNumber()) 
44788            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44789          closeArray();
44790        }
44791        if (anyHasExtras(element.getNoteNumber())) {
44792          openArray("_noteNumber");
44793          for (PositiveIntType e : element.getNoteNumber()) 
44794            composePositiveIntExtras(null, e, true);
44795          closeArray();
44796        }
44797      };
44798      if (element.hasAdjudication()) {
44799        openArray("adjudication");
44800        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44801          composeAdjudicationComponent(null, e);
44802        closeArray();
44803      };
44804      if (element.hasSubDetail()) {
44805        openArray("subDetail");
44806        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
44807          composeAddedItemDetailSubDetailComponent(null, e);
44808        closeArray();
44809      };
44810  }
44811
44812  protected void composeAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
44813    if (element != null) {
44814      open(name);
44815      composeAddedItemDetailSubDetailComponentProperties(element);
44816      close();
44817    }
44818  }
44819
44820  protected void composeAddedItemDetailSubDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
44821    composeBackboneElementProperties(element);
44822      if (element.hasProductOrService()) {
44823        composeCodeableConcept("productOrService", element.getProductOrService());
44824      }
44825      if (element.hasModifier()) {
44826        openArray("modifier");
44827        for (CodeableConcept e : element.getModifier()) 
44828          composeCodeableConcept(null, e);
44829        closeArray();
44830      };
44831      if (element.hasQuantity()) {
44832        composeQuantity("quantity", element.getQuantity());
44833      }
44834      if (element.hasUnitPrice()) {
44835        composeMoney("unitPrice", element.getUnitPrice());
44836      }
44837      if (element.hasFactorElement()) {
44838        composeDecimalCore("factor", element.getFactorElement(), false);
44839        composeDecimalExtras("factor", element.getFactorElement(), false);
44840      }
44841      if (element.hasNet()) {
44842        composeMoney("net", element.getNet());
44843      }
44844      if (element.hasNoteNumber()) {
44845        if (anyHasValue(element.getNoteNumber())) {
44846          openArray("noteNumber");
44847          for (PositiveIntType e : element.getNoteNumber()) 
44848            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44849          closeArray();
44850        }
44851        if (anyHasExtras(element.getNoteNumber())) {
44852          openArray("_noteNumber");
44853          for (PositiveIntType e : element.getNoteNumber()) 
44854            composePositiveIntExtras(null, e, true);
44855          closeArray();
44856        }
44857      };
44858      if (element.hasAdjudication()) {
44859        openArray("adjudication");
44860        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44861          composeAdjudicationComponent(null, e);
44862        closeArray();
44863      };
44864  }
44865
44866  protected void composeTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
44867    if (element != null) {
44868      open(name);
44869      composeTotalComponentProperties(element);
44870      close();
44871    }
44872  }
44873
44874  protected void composeTotalComponentProperties(ExplanationOfBenefit.TotalComponent element) throws IOException {
44875    composeBackboneElementProperties(element);
44876      if (element.hasCategory()) {
44877        composeCodeableConcept("category", element.getCategory());
44878      }
44879      if (element.hasAmount()) {
44880        composeMoney("amount", element.getAmount());
44881      }
44882  }
44883
44884  protected void composePaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
44885    if (element != null) {
44886      open(name);
44887      composePaymentComponentProperties(element);
44888      close();
44889    }
44890  }
44891
44892  protected void composePaymentComponentProperties(ExplanationOfBenefit.PaymentComponent element) throws IOException {
44893    composeBackboneElementProperties(element);
44894      if (element.hasType()) {
44895        composeCodeableConcept("type", element.getType());
44896      }
44897      if (element.hasAdjustment()) {
44898        composeMoney("adjustment", element.getAdjustment());
44899      }
44900      if (element.hasAdjustmentReason()) {
44901        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
44902      }
44903      if (element.hasDateElement()) {
44904        composeDateCore("date", element.getDateElement(), false);
44905        composeDateExtras("date", element.getDateElement(), false);
44906      }
44907      if (element.hasAmount()) {
44908        composeMoney("amount", element.getAmount());
44909      }
44910      if (element.hasIdentifier()) {
44911        composeIdentifier("identifier", element.getIdentifier());
44912      }
44913  }
44914
44915  protected void composeNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
44916    if (element != null) {
44917      open(name);
44918      composeNoteComponentProperties(element);
44919      close();
44920    }
44921  }
44922
44923  protected void composeNoteComponentProperties(ExplanationOfBenefit.NoteComponent element) throws IOException {
44924    composeBackboneElementProperties(element);
44925      if (element.hasNumberElement()) {
44926        composePositiveIntCore("number", element.getNumberElement(), false);
44927        composePositiveIntExtras("number", element.getNumberElement(), false);
44928      }
44929      if (element.hasTypeElement()) {
44930        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
44931        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
44932      }
44933      if (element.hasTextElement()) {
44934        composeStringCore("text", element.getTextElement(), false);
44935        composeStringExtras("text", element.getTextElement(), false);
44936      }
44937      if (element.hasLanguage()) {
44938        composeCodeableConcept("language", element.getLanguage());
44939      }
44940  }
44941
44942  protected void composeBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
44943    if (element != null) {
44944      open(name);
44945      composeBenefitBalanceComponentProperties(element);
44946      close();
44947    }
44948  }
44949
44950  protected void composeBenefitBalanceComponentProperties(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
44951    composeBackboneElementProperties(element);
44952      if (element.hasCategory()) {
44953        composeCodeableConcept("category", element.getCategory());
44954      }
44955      if (element.hasExcludedElement()) {
44956        composeBooleanCore("excluded", element.getExcludedElement(), false);
44957        composeBooleanExtras("excluded", element.getExcludedElement(), false);
44958      }
44959      if (element.hasNameElement()) {
44960        composeStringCore("name", element.getNameElement(), false);
44961        composeStringExtras("name", element.getNameElement(), false);
44962      }
44963      if (element.hasDescriptionElement()) {
44964        composeStringCore("description", element.getDescriptionElement(), false);
44965        composeStringExtras("description", element.getDescriptionElement(), false);
44966      }
44967      if (element.hasNetwork()) {
44968        composeCodeableConcept("network", element.getNetwork());
44969      }
44970      if (element.hasUnit()) {
44971        composeCodeableConcept("unit", element.getUnit());
44972      }
44973      if (element.hasTerm()) {
44974        composeCodeableConcept("term", element.getTerm());
44975      }
44976      if (element.hasFinancial()) {
44977        openArray("financial");
44978        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
44979          composeBenefitComponent(null, e);
44980        closeArray();
44981      };
44982  }
44983
44984  protected void composeBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
44985    if (element != null) {
44986      open(name);
44987      composeBenefitComponentProperties(element);
44988      close();
44989    }
44990  }
44991
44992  protected void composeBenefitComponentProperties(ExplanationOfBenefit.BenefitComponent element) throws IOException {
44993    composeBackboneElementProperties(element);
44994      if (element.hasType()) {
44995        composeCodeableConcept("type", element.getType());
44996      }
44997      if (element.hasAllowed()) {
44998        composeType("allowed", element.getAllowed());
44999      }
45000      if (element.hasUsed()) {
45001        composeType("used", element.getUsed());
45002      }
45003  }
45004
45005  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
45006    if (element != null) {
45007      prop("resourceType", name);
45008      composeFamilyMemberHistoryProperties(element);
45009    }
45010  }
45011
45012  protected void composeFamilyMemberHistoryProperties(FamilyMemberHistory element) throws IOException {
45013    composeDomainResourceProperties(element);
45014      if (element.hasIdentifier()) {
45015        openArray("identifier");
45016        for (Identifier e : element.getIdentifier()) 
45017          composeIdentifier(null, e);
45018        closeArray();
45019      };
45020      if (element.hasInstantiatesCanonical()) {
45021        if (anyHasValue(element.getInstantiatesCanonical())) {
45022          openArray("instantiatesCanonical");
45023          for (CanonicalType e : element.getInstantiatesCanonical()) 
45024            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
45025          closeArray();
45026        }
45027        if (anyHasExtras(element.getInstantiatesCanonical())) {
45028          openArray("_instantiatesCanonical");
45029          for (CanonicalType e : element.getInstantiatesCanonical()) 
45030            composeCanonicalExtras(null, e, true);
45031          closeArray();
45032        }
45033      };
45034      if (element.hasInstantiatesUri()) {
45035        if (anyHasValue(element.getInstantiatesUri())) {
45036          openArray("instantiatesUri");
45037          for (UriType e : element.getInstantiatesUri()) 
45038            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
45039          closeArray();
45040        }
45041        if (anyHasExtras(element.getInstantiatesUri())) {
45042          openArray("_instantiatesUri");
45043          for (UriType e : element.getInstantiatesUri()) 
45044            composeUriExtras(null, e, true);
45045          closeArray();
45046        }
45047      };
45048      if (element.hasStatusElement()) {
45049        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
45050        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
45051      }
45052      if (element.hasDataAbsentReason()) {
45053        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
45054      }
45055      if (element.hasPatient()) {
45056        composeReference("patient", element.getPatient());
45057      }
45058      if (element.hasDateElement()) {
45059        composeDateTimeCore("date", element.getDateElement(), false);
45060        composeDateTimeExtras("date", element.getDateElement(), false);
45061      }
45062      if (element.hasNameElement()) {
45063        composeStringCore("name", element.getNameElement(), false);
45064        composeStringExtras("name", element.getNameElement(), false);
45065      }
45066      if (element.hasRelationship()) {
45067        composeCodeableConcept("relationship", element.getRelationship());
45068      }
45069      if (element.hasSex()) {
45070        composeCodeableConcept("sex", element.getSex());
45071      }
45072      if (element.hasBorn()) {
45073        composeType("born", element.getBorn());
45074      }
45075      if (element.hasAge()) {
45076        composeType("age", element.getAge());
45077      }
45078      if (element.hasEstimatedAgeElement()) {
45079        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
45080        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
45081      }
45082      if (element.hasDeceased()) {
45083        composeType("deceased", element.getDeceased());
45084      }
45085      if (element.hasReasonCode()) {
45086        openArray("reasonCode");
45087        for (CodeableConcept e : element.getReasonCode()) 
45088          composeCodeableConcept(null, e);
45089        closeArray();
45090      };
45091      if (element.hasReasonReference()) {
45092        openArray("reasonReference");
45093        for (Reference e : element.getReasonReference()) 
45094          composeReference(null, e);
45095        closeArray();
45096      };
45097      if (element.hasNote()) {
45098        openArray("note");
45099        for (Annotation e : element.getNote()) 
45100          composeAnnotation(null, e);
45101        closeArray();
45102      };
45103      if (element.hasCondition()) {
45104        openArray("condition");
45105        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
45106          composeFamilyMemberHistoryConditionComponent(null, e);
45107        closeArray();
45108      };
45109  }
45110
45111  protected void composeFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
45112    if (element != null) {
45113      open(name);
45114      composeFamilyMemberHistoryConditionComponentProperties(element);
45115      close();
45116    }
45117  }
45118
45119  protected void composeFamilyMemberHistoryConditionComponentProperties(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
45120    composeBackboneElementProperties(element);
45121      if (element.hasCode()) {
45122        composeCodeableConcept("code", element.getCode());
45123      }
45124      if (element.hasOutcome()) {
45125        composeCodeableConcept("outcome", element.getOutcome());
45126      }
45127      if (element.hasContributedToDeathElement()) {
45128        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
45129        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
45130      }
45131      if (element.hasOnset()) {
45132        composeType("onset", element.getOnset());
45133      }
45134      if (element.hasNote()) {
45135        openArray("note");
45136        for (Annotation e : element.getNote()) 
45137          composeAnnotation(null, e);
45138        closeArray();
45139      };
45140  }
45141
45142  protected void composeFlag(String name, Flag element) throws IOException {
45143    if (element != null) {
45144      prop("resourceType", name);
45145      composeFlagProperties(element);
45146    }
45147  }
45148
45149  protected void composeFlagProperties(Flag element) throws IOException {
45150    composeDomainResourceProperties(element);
45151      if (element.hasIdentifier()) {
45152        openArray("identifier");
45153        for (Identifier e : element.getIdentifier()) 
45154          composeIdentifier(null, e);
45155        closeArray();
45156      };
45157      if (element.hasStatusElement()) {
45158        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
45159        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
45160      }
45161      if (element.hasCategory()) {
45162        openArray("category");
45163        for (CodeableConcept e : element.getCategory()) 
45164          composeCodeableConcept(null, e);
45165        closeArray();
45166      };
45167      if (element.hasCode()) {
45168        composeCodeableConcept("code", element.getCode());
45169      }
45170      if (element.hasSubject()) {
45171        composeReference("subject", element.getSubject());
45172      }
45173      if (element.hasPeriod()) {
45174        composePeriod("period", element.getPeriod());
45175      }
45176      if (element.hasEncounter()) {
45177        composeReference("encounter", element.getEncounter());
45178      }
45179      if (element.hasAuthor()) {
45180        composeReference("author", element.getAuthor());
45181      }
45182  }
45183
45184  protected void composeGoal(String name, Goal element) throws IOException {
45185    if (element != null) {
45186      prop("resourceType", name);
45187      composeGoalProperties(element);
45188    }
45189  }
45190
45191  protected void composeGoalProperties(Goal element) throws IOException {
45192    composeDomainResourceProperties(element);
45193      if (element.hasIdentifier()) {
45194        openArray("identifier");
45195        for (Identifier e : element.getIdentifier()) 
45196          composeIdentifier(null, e);
45197        closeArray();
45198      };
45199      if (element.hasLifecycleStatusElement()) {
45200        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
45201        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
45202      }
45203      if (element.hasAchievementStatus()) {
45204        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
45205      }
45206      if (element.hasCategory()) {
45207        openArray("category");
45208        for (CodeableConcept e : element.getCategory()) 
45209          composeCodeableConcept(null, e);
45210        closeArray();
45211      };
45212      if (element.hasPriority()) {
45213        composeCodeableConcept("priority", element.getPriority());
45214      }
45215      if (element.hasDescription()) {
45216        composeCodeableConcept("description", element.getDescription());
45217      }
45218      if (element.hasSubject()) {
45219        composeReference("subject", element.getSubject());
45220      }
45221      if (element.hasStart()) {
45222        composeType("start", element.getStart());
45223      }
45224      if (element.hasTarget()) {
45225        openArray("target");
45226        for (Goal.GoalTargetComponent e : element.getTarget()) 
45227          composeGoalTargetComponent(null, e);
45228        closeArray();
45229      };
45230      if (element.hasStatusDateElement()) {
45231        composeDateCore("statusDate", element.getStatusDateElement(), false);
45232        composeDateExtras("statusDate", element.getStatusDateElement(), false);
45233      }
45234      if (element.hasStatusReasonElement()) {
45235        composeStringCore("statusReason", element.getStatusReasonElement(), false);
45236        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
45237      }
45238      if (element.hasExpressedBy()) {
45239        composeReference("expressedBy", element.getExpressedBy());
45240      }
45241      if (element.hasAddresses()) {
45242        openArray("addresses");
45243        for (Reference e : element.getAddresses()) 
45244          composeReference(null, e);
45245        closeArray();
45246      };
45247      if (element.hasNote()) {
45248        openArray("note");
45249        for (Annotation e : element.getNote()) 
45250          composeAnnotation(null, e);
45251        closeArray();
45252      };
45253      if (element.hasOutcomeCode()) {
45254        openArray("outcomeCode");
45255        for (CodeableConcept e : element.getOutcomeCode()) 
45256          composeCodeableConcept(null, e);
45257        closeArray();
45258      };
45259      if (element.hasOutcomeReference()) {
45260        openArray("outcomeReference");
45261        for (Reference e : element.getOutcomeReference()) 
45262          composeReference(null, e);
45263        closeArray();
45264      };
45265  }
45266
45267  protected void composeGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
45268    if (element != null) {
45269      open(name);
45270      composeGoalTargetComponentProperties(element);
45271      close();
45272    }
45273  }
45274
45275  protected void composeGoalTargetComponentProperties(Goal.GoalTargetComponent element) throws IOException {
45276    composeBackboneElementProperties(element);
45277      if (element.hasMeasure()) {
45278        composeCodeableConcept("measure", element.getMeasure());
45279      }
45280      if (element.hasDetail()) {
45281        composeType("detail", element.getDetail());
45282      }
45283      if (element.hasDue()) {
45284        composeType("due", element.getDue());
45285      }
45286  }
45287
45288  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
45289    if (element != null) {
45290      prop("resourceType", name);
45291      composeGraphDefinitionProperties(element);
45292    }
45293  }
45294
45295  protected void composeGraphDefinitionProperties(GraphDefinition element) throws IOException {
45296    composeDomainResourceProperties(element);
45297      if (element.hasUrlElement()) {
45298        composeUriCore("url", element.getUrlElement(), false);
45299        composeUriExtras("url", element.getUrlElement(), false);
45300      }
45301      if (element.hasVersionElement()) {
45302        composeStringCore("version", element.getVersionElement(), false);
45303        composeStringExtras("version", element.getVersionElement(), false);
45304      }
45305      if (element.hasNameElement()) {
45306        composeStringCore("name", element.getNameElement(), false);
45307        composeStringExtras("name", element.getNameElement(), false);
45308      }
45309      if (element.hasStatusElement()) {
45310        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45311        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45312      }
45313      if (element.hasExperimentalElement()) {
45314        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45315        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45316      }
45317      if (element.hasDateElement()) {
45318        composeDateTimeCore("date", element.getDateElement(), false);
45319        composeDateTimeExtras("date", element.getDateElement(), false);
45320      }
45321      if (element.hasPublisherElement()) {
45322        composeStringCore("publisher", element.getPublisherElement(), false);
45323        composeStringExtras("publisher", element.getPublisherElement(), false);
45324      }
45325      if (element.hasContact()) {
45326        openArray("contact");
45327        for (ContactDetail e : element.getContact()) 
45328          composeContactDetail(null, e);
45329        closeArray();
45330      };
45331      if (element.hasDescriptionElement()) {
45332        composeMarkdownCore("description", element.getDescriptionElement(), false);
45333        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45334      }
45335      if (element.hasUseContext()) {
45336        openArray("useContext");
45337        for (UsageContext e : element.getUseContext()) 
45338          composeUsageContext(null, e);
45339        closeArray();
45340      };
45341      if (element.hasJurisdiction()) {
45342        openArray("jurisdiction");
45343        for (CodeableConcept e : element.getJurisdiction()) 
45344          composeCodeableConcept(null, e);
45345        closeArray();
45346      };
45347      if (element.hasPurposeElement()) {
45348        composeMarkdownCore("purpose", element.getPurposeElement(), false);
45349        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45350      }
45351      if (element.hasStartElement()) {
45352        composeCodeCore("start", element.getStartElement(), false);
45353        composeCodeExtras("start", element.getStartElement(), false);
45354      }
45355      if (element.hasProfileElement()) {
45356        composeCanonicalCore("profile", element.getProfileElement(), false);
45357        composeCanonicalExtras("profile", element.getProfileElement(), false);
45358      }
45359      if (element.hasLink()) {
45360        openArray("link");
45361        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
45362          composeGraphDefinitionLinkComponent(null, e);
45363        closeArray();
45364      };
45365  }
45366
45367  protected void composeGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
45368    if (element != null) {
45369      open(name);
45370      composeGraphDefinitionLinkComponentProperties(element);
45371      close();
45372    }
45373  }
45374
45375  protected void composeGraphDefinitionLinkComponentProperties(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
45376    composeBackboneElementProperties(element);
45377      if (element.hasPathElement()) {
45378        composeStringCore("path", element.getPathElement(), false);
45379        composeStringExtras("path", element.getPathElement(), false);
45380      }
45381      if (element.hasSliceNameElement()) {
45382        composeStringCore("sliceName", element.getSliceNameElement(), false);
45383        composeStringExtras("sliceName", element.getSliceNameElement(), false);
45384      }
45385      if (element.hasMinElement()) {
45386        composeIntegerCore("min", element.getMinElement(), false);
45387        composeIntegerExtras("min", element.getMinElement(), false);
45388      }
45389      if (element.hasMaxElement()) {
45390        composeStringCore("max", element.getMaxElement(), false);
45391        composeStringExtras("max", element.getMaxElement(), false);
45392      }
45393      if (element.hasDescriptionElement()) {
45394        composeStringCore("description", element.getDescriptionElement(), false);
45395        composeStringExtras("description", element.getDescriptionElement(), false);
45396      }
45397      if (element.hasTarget()) {
45398        openArray("target");
45399        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
45400          composeGraphDefinitionLinkTargetComponent(null, e);
45401        closeArray();
45402      };
45403  }
45404
45405  protected void composeGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
45406    if (element != null) {
45407      open(name);
45408      composeGraphDefinitionLinkTargetComponentProperties(element);
45409      close();
45410    }
45411  }
45412
45413  protected void composeGraphDefinitionLinkTargetComponentProperties(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
45414    composeBackboneElementProperties(element);
45415      if (element.hasTypeElement()) {
45416        composeCodeCore("type", element.getTypeElement(), false);
45417        composeCodeExtras("type", element.getTypeElement(), false);
45418      }
45419      if (element.hasParamsElement()) {
45420        composeStringCore("params", element.getParamsElement(), false);
45421        composeStringExtras("params", element.getParamsElement(), false);
45422      }
45423      if (element.hasProfileElement()) {
45424        composeCanonicalCore("profile", element.getProfileElement(), false);
45425        composeCanonicalExtras("profile", element.getProfileElement(), false);
45426      }
45427      if (element.hasCompartment()) {
45428        openArray("compartment");
45429        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
45430          composeGraphDefinitionLinkTargetCompartmentComponent(null, e);
45431        closeArray();
45432      };
45433      if (element.hasLink()) {
45434        openArray("link");
45435        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
45436          composeGraphDefinitionLinkComponent(null, e);
45437        closeArray();
45438      };
45439  }
45440
45441  protected void composeGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
45442    if (element != null) {
45443      open(name);
45444      composeGraphDefinitionLinkTargetCompartmentComponentProperties(element);
45445      close();
45446    }
45447  }
45448
45449  protected void composeGraphDefinitionLinkTargetCompartmentComponentProperties(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
45450    composeBackboneElementProperties(element);
45451      if (element.hasUseElement()) {
45452        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
45453        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
45454      }
45455      if (element.hasCodeElement()) {
45456        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
45457        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
45458      }
45459      if (element.hasRuleElement()) {
45460        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
45461        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
45462      }
45463      if (element.hasExpressionElement()) {
45464        composeStringCore("expression", element.getExpressionElement(), false);
45465        composeStringExtras("expression", element.getExpressionElement(), false);
45466      }
45467      if (element.hasDescriptionElement()) {
45468        composeStringCore("description", element.getDescriptionElement(), false);
45469        composeStringExtras("description", element.getDescriptionElement(), false);
45470      }
45471  }
45472
45473  protected void composeGroup(String name, Group element) throws IOException {
45474    if (element != null) {
45475      prop("resourceType", name);
45476      composeGroupProperties(element);
45477    }
45478  }
45479
45480  protected void composeGroupProperties(Group element) throws IOException {
45481    composeDomainResourceProperties(element);
45482      if (element.hasIdentifier()) {
45483        openArray("identifier");
45484        for (Identifier e : element.getIdentifier()) 
45485          composeIdentifier(null, e);
45486        closeArray();
45487      };
45488      if (element.hasActiveElement()) {
45489        composeBooleanCore("active", element.getActiveElement(), false);
45490        composeBooleanExtras("active", element.getActiveElement(), false);
45491      }
45492      if (element.hasTypeElement()) {
45493        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
45494        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
45495      }
45496      if (element.hasActualElement()) {
45497        composeBooleanCore("actual", element.getActualElement(), false);
45498        composeBooleanExtras("actual", element.getActualElement(), false);
45499      }
45500      if (element.hasCode()) {
45501        composeCodeableConcept("code", element.getCode());
45502      }
45503      if (element.hasNameElement()) {
45504        composeStringCore("name", element.getNameElement(), false);
45505        composeStringExtras("name", element.getNameElement(), false);
45506      }
45507      if (element.hasQuantityElement()) {
45508        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
45509        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
45510      }
45511      if (element.hasManagingEntity()) {
45512        composeReference("managingEntity", element.getManagingEntity());
45513      }
45514      if (element.hasCharacteristic()) {
45515        openArray("characteristic");
45516        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
45517          composeGroupCharacteristicComponent(null, e);
45518        closeArray();
45519      };
45520      if (element.hasMember()) {
45521        openArray("member");
45522        for (Group.GroupMemberComponent e : element.getMember()) 
45523          composeGroupMemberComponent(null, e);
45524        closeArray();
45525      };
45526  }
45527
45528  protected void composeGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
45529    if (element != null) {
45530      open(name);
45531      composeGroupCharacteristicComponentProperties(element);
45532      close();
45533    }
45534  }
45535
45536  protected void composeGroupCharacteristicComponentProperties(Group.GroupCharacteristicComponent element) throws IOException {
45537    composeBackboneElementProperties(element);
45538      if (element.hasCode()) {
45539        composeCodeableConcept("code", element.getCode());
45540      }
45541      if (element.hasValue()) {
45542        composeType("value", element.getValue());
45543      }
45544      if (element.hasExcludeElement()) {
45545        composeBooleanCore("exclude", element.getExcludeElement(), false);
45546        composeBooleanExtras("exclude", element.getExcludeElement(), false);
45547      }
45548      if (element.hasPeriod()) {
45549        composePeriod("period", element.getPeriod());
45550      }
45551  }
45552
45553  protected void composeGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
45554    if (element != null) {
45555      open(name);
45556      composeGroupMemberComponentProperties(element);
45557      close();
45558    }
45559  }
45560
45561  protected void composeGroupMemberComponentProperties(Group.GroupMemberComponent element) throws IOException {
45562    composeBackboneElementProperties(element);
45563      if (element.hasEntity()) {
45564        composeReference("entity", element.getEntity());
45565      }
45566      if (element.hasPeriod()) {
45567        composePeriod("period", element.getPeriod());
45568      }
45569      if (element.hasInactiveElement()) {
45570        composeBooleanCore("inactive", element.getInactiveElement(), false);
45571        composeBooleanExtras("inactive", element.getInactiveElement(), false);
45572      }
45573  }
45574
45575  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
45576    if (element != null) {
45577      prop("resourceType", name);
45578      composeGuidanceResponseProperties(element);
45579    }
45580  }
45581
45582  protected void composeGuidanceResponseProperties(GuidanceResponse element) throws IOException {
45583    composeDomainResourceProperties(element);
45584      if (element.hasRequestIdentifier()) {
45585        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
45586      }
45587      if (element.hasIdentifier()) {
45588        openArray("identifier");
45589        for (Identifier e : element.getIdentifier()) 
45590          composeIdentifier(null, e);
45591        closeArray();
45592      };
45593      if (element.hasModule()) {
45594        composeType("module", element.getModule());
45595      }
45596      if (element.hasStatusElement()) {
45597        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
45598        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
45599      }
45600      if (element.hasSubject()) {
45601        composeReference("subject", element.getSubject());
45602      }
45603      if (element.hasEncounter()) {
45604        composeReference("encounter", element.getEncounter());
45605      }
45606      if (element.hasOccurrenceDateTimeElement()) {
45607        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
45608        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
45609      }
45610      if (element.hasPerformer()) {
45611        composeReference("performer", element.getPerformer());
45612      }
45613      if (element.hasReasonCode()) {
45614        openArray("reasonCode");
45615        for (CodeableConcept e : element.getReasonCode()) 
45616          composeCodeableConcept(null, e);
45617        closeArray();
45618      };
45619      if (element.hasReasonReference()) {
45620        openArray("reasonReference");
45621        for (Reference e : element.getReasonReference()) 
45622          composeReference(null, e);
45623        closeArray();
45624      };
45625      if (element.hasNote()) {
45626        openArray("note");
45627        for (Annotation e : element.getNote()) 
45628          composeAnnotation(null, e);
45629        closeArray();
45630      };
45631      if (element.hasEvaluationMessage()) {
45632        openArray("evaluationMessage");
45633        for (Reference e : element.getEvaluationMessage()) 
45634          composeReference(null, e);
45635        closeArray();
45636      };
45637      if (element.hasOutputParameters()) {
45638        composeReference("outputParameters", element.getOutputParameters());
45639      }
45640      if (element.hasResult()) {
45641        composeReference("result", element.getResult());
45642      }
45643      if (element.hasDataRequirement()) {
45644        openArray("dataRequirement");
45645        for (DataRequirement e : element.getDataRequirement()) 
45646          composeDataRequirement(null, e);
45647        closeArray();
45648      };
45649  }
45650
45651  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
45652    if (element != null) {
45653      prop("resourceType", name);
45654      composeHealthcareServiceProperties(element);
45655    }
45656  }
45657
45658  protected void composeHealthcareServiceProperties(HealthcareService element) throws IOException {
45659    composeDomainResourceProperties(element);
45660      if (element.hasIdentifier()) {
45661        openArray("identifier");
45662        for (Identifier e : element.getIdentifier()) 
45663          composeIdentifier(null, e);
45664        closeArray();
45665      };
45666      if (element.hasActiveElement()) {
45667        composeBooleanCore("active", element.getActiveElement(), false);
45668        composeBooleanExtras("active", element.getActiveElement(), false);
45669      }
45670      if (element.hasProvidedBy()) {
45671        composeReference("providedBy", element.getProvidedBy());
45672      }
45673      if (element.hasCategory()) {
45674        openArray("category");
45675        for (CodeableConcept e : element.getCategory()) 
45676          composeCodeableConcept(null, e);
45677        closeArray();
45678      };
45679      if (element.hasType()) {
45680        openArray("type");
45681        for (CodeableConcept e : element.getType()) 
45682          composeCodeableConcept(null, e);
45683        closeArray();
45684      };
45685      if (element.hasSpecialty()) {
45686        openArray("specialty");
45687        for (CodeableConcept e : element.getSpecialty()) 
45688          composeCodeableConcept(null, e);
45689        closeArray();
45690      };
45691      if (element.hasLocation()) {
45692        openArray("location");
45693        for (Reference e : element.getLocation()) 
45694          composeReference(null, e);
45695        closeArray();
45696      };
45697      if (element.hasNameElement()) {
45698        composeStringCore("name", element.getNameElement(), false);
45699        composeStringExtras("name", element.getNameElement(), false);
45700      }
45701      if (element.hasCommentElement()) {
45702        composeStringCore("comment", element.getCommentElement(), false);
45703        composeStringExtras("comment", element.getCommentElement(), false);
45704      }
45705      if (element.hasExtraDetailsElement()) {
45706        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
45707        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
45708      }
45709      if (element.hasPhoto()) {
45710        composeAttachment("photo", element.getPhoto());
45711      }
45712      if (element.hasTelecom()) {
45713        openArray("telecom");
45714        for (ContactPoint e : element.getTelecom()) 
45715          composeContactPoint(null, e);
45716        closeArray();
45717      };
45718      if (element.hasCoverageArea()) {
45719        openArray("coverageArea");
45720        for (Reference e : element.getCoverageArea()) 
45721          composeReference(null, e);
45722        closeArray();
45723      };
45724      if (element.hasServiceProvisionCode()) {
45725        openArray("serviceProvisionCode");
45726        for (CodeableConcept e : element.getServiceProvisionCode()) 
45727          composeCodeableConcept(null, e);
45728        closeArray();
45729      };
45730      if (element.hasEligibility()) {
45731        openArray("eligibility");
45732        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
45733          composeHealthcareServiceEligibilityComponent(null, e);
45734        closeArray();
45735      };
45736      if (element.hasProgram()) {
45737        openArray("program");
45738        for (CodeableConcept e : element.getProgram()) 
45739          composeCodeableConcept(null, e);
45740        closeArray();
45741      };
45742      if (element.hasCharacteristic()) {
45743        openArray("characteristic");
45744        for (CodeableConcept e : element.getCharacteristic()) 
45745          composeCodeableConcept(null, e);
45746        closeArray();
45747      };
45748      if (element.hasCommunication()) {
45749        openArray("communication");
45750        for (CodeableConcept e : element.getCommunication()) 
45751          composeCodeableConcept(null, e);
45752        closeArray();
45753      };
45754      if (element.hasReferralMethod()) {
45755        openArray("referralMethod");
45756        for (CodeableConcept e : element.getReferralMethod()) 
45757          composeCodeableConcept(null, e);
45758        closeArray();
45759      };
45760      if (element.hasAppointmentRequiredElement()) {
45761        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
45762        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
45763      }
45764      if (element.hasAvailableTime()) {
45765        openArray("availableTime");
45766        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
45767          composeHealthcareServiceAvailableTimeComponent(null, e);
45768        closeArray();
45769      };
45770      if (element.hasNotAvailable()) {
45771        openArray("notAvailable");
45772        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
45773          composeHealthcareServiceNotAvailableComponent(null, e);
45774        closeArray();
45775      };
45776      if (element.hasAvailabilityExceptionsElement()) {
45777        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
45778        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
45779      }
45780      if (element.hasEndpoint()) {
45781        openArray("endpoint");
45782        for (Reference e : element.getEndpoint()) 
45783          composeReference(null, e);
45784        closeArray();
45785      };
45786  }
45787
45788  protected void composeHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
45789    if (element != null) {
45790      open(name);
45791      composeHealthcareServiceEligibilityComponentProperties(element);
45792      close();
45793    }
45794  }
45795
45796  protected void composeHealthcareServiceEligibilityComponentProperties(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
45797    composeBackboneElementProperties(element);
45798      if (element.hasCode()) {
45799        composeCodeableConcept("code", element.getCode());
45800      }
45801      if (element.hasCommentElement()) {
45802        composeMarkdownCore("comment", element.getCommentElement(), false);
45803        composeMarkdownExtras("comment", element.getCommentElement(), false);
45804      }
45805  }
45806
45807  protected void composeHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
45808    if (element != null) {
45809      open(name);
45810      composeHealthcareServiceAvailableTimeComponentProperties(element);
45811      close();
45812    }
45813  }
45814
45815  protected void composeHealthcareServiceAvailableTimeComponentProperties(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
45816    composeBackboneElementProperties(element);
45817      if (element.hasDaysOfWeek()) {
45818        openArray("daysOfWeek");
45819        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
45820          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
45821        closeArray();
45822        if (anyHasExtras(element.getDaysOfWeek())) {
45823          openArray("_daysOfWeek");
45824          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
45825            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
45826          closeArray();
45827        }
45828      };
45829      if (element.hasAllDayElement()) {
45830        composeBooleanCore("allDay", element.getAllDayElement(), false);
45831        composeBooleanExtras("allDay", element.getAllDayElement(), false);
45832      }
45833      if (element.hasAvailableStartTimeElement()) {
45834        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
45835        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
45836      }
45837      if (element.hasAvailableEndTimeElement()) {
45838        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
45839        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
45840      }
45841  }
45842
45843  protected void composeHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
45844    if (element != null) {
45845      open(name);
45846      composeHealthcareServiceNotAvailableComponentProperties(element);
45847      close();
45848    }
45849  }
45850
45851  protected void composeHealthcareServiceNotAvailableComponentProperties(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
45852    composeBackboneElementProperties(element);
45853      if (element.hasDescriptionElement()) {
45854        composeStringCore("description", element.getDescriptionElement(), false);
45855        composeStringExtras("description", element.getDescriptionElement(), false);
45856      }
45857      if (element.hasDuring()) {
45858        composePeriod("during", element.getDuring());
45859      }
45860  }
45861
45862  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
45863    if (element != null) {
45864      prop("resourceType", name);
45865      composeImagingStudyProperties(element);
45866    }
45867  }
45868
45869  protected void composeImagingStudyProperties(ImagingStudy element) throws IOException {
45870    composeDomainResourceProperties(element);
45871      if (element.hasIdentifier()) {
45872        openArray("identifier");
45873        for (Identifier e : element.getIdentifier()) 
45874          composeIdentifier(null, e);
45875        closeArray();
45876      };
45877      if (element.hasStatusElement()) {
45878        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
45879        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
45880      }
45881      if (element.hasModality()) {
45882        openArray("modality");
45883        for (Coding e : element.getModality()) 
45884          composeCoding(null, e);
45885        closeArray();
45886      };
45887      if (element.hasSubject()) {
45888        composeReference("subject", element.getSubject());
45889      }
45890      if (element.hasEncounter()) {
45891        composeReference("encounter", element.getEncounter());
45892      }
45893      if (element.hasStartedElement()) {
45894        composeDateTimeCore("started", element.getStartedElement(), false);
45895        composeDateTimeExtras("started", element.getStartedElement(), false);
45896      }
45897      if (element.hasBasedOn()) {
45898        openArray("basedOn");
45899        for (Reference e : element.getBasedOn()) 
45900          composeReference(null, e);
45901        closeArray();
45902      };
45903      if (element.hasReferrer()) {
45904        composeReference("referrer", element.getReferrer());
45905      }
45906      if (element.hasInterpreter()) {
45907        openArray("interpreter");
45908        for (Reference e : element.getInterpreter()) 
45909          composeReference(null, e);
45910        closeArray();
45911      };
45912      if (element.hasEndpoint()) {
45913        openArray("endpoint");
45914        for (Reference e : element.getEndpoint()) 
45915          composeReference(null, e);
45916        closeArray();
45917      };
45918      if (element.hasNumberOfSeriesElement()) {
45919        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
45920        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
45921      }
45922      if (element.hasNumberOfInstancesElement()) {
45923        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
45924        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
45925      }
45926      if (element.hasProcedureReference()) {
45927        composeReference("procedureReference", element.getProcedureReference());
45928      }
45929      if (element.hasProcedureCode()) {
45930        openArray("procedureCode");
45931        for (CodeableConcept e : element.getProcedureCode()) 
45932          composeCodeableConcept(null, e);
45933        closeArray();
45934      };
45935      if (element.hasLocation()) {
45936        composeReference("location", element.getLocation());
45937      }
45938      if (element.hasReasonCode()) {
45939        openArray("reasonCode");
45940        for (CodeableConcept e : element.getReasonCode()) 
45941          composeCodeableConcept(null, e);
45942        closeArray();
45943      };
45944      if (element.hasReasonReference()) {
45945        openArray("reasonReference");
45946        for (Reference e : element.getReasonReference()) 
45947          composeReference(null, e);
45948        closeArray();
45949      };
45950      if (element.hasNote()) {
45951        openArray("note");
45952        for (Annotation e : element.getNote()) 
45953          composeAnnotation(null, e);
45954        closeArray();
45955      };
45956      if (element.hasDescriptionElement()) {
45957        composeStringCore("description", element.getDescriptionElement(), false);
45958        composeStringExtras("description", element.getDescriptionElement(), false);
45959      }
45960      if (element.hasSeries()) {
45961        openArray("series");
45962        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
45963          composeImagingStudySeriesComponent(null, e);
45964        closeArray();
45965      };
45966  }
45967
45968  protected void composeImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
45969    if (element != null) {
45970      open(name);
45971      composeImagingStudySeriesComponentProperties(element);
45972      close();
45973    }
45974  }
45975
45976  protected void composeImagingStudySeriesComponentProperties(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
45977    composeBackboneElementProperties(element);
45978      if (element.hasUidElement()) {
45979        composeIdCore("uid", element.getUidElement(), false);
45980        composeIdExtras("uid", element.getUidElement(), false);
45981      }
45982      if (element.hasNumberElement()) {
45983        composeUnsignedIntCore("number", element.getNumberElement(), false);
45984        composeUnsignedIntExtras("number", element.getNumberElement(), false);
45985      }
45986      if (element.hasModality()) {
45987        composeCoding("modality", element.getModality());
45988      }
45989      if (element.hasDescriptionElement()) {
45990        composeStringCore("description", element.getDescriptionElement(), false);
45991        composeStringExtras("description", element.getDescriptionElement(), false);
45992      }
45993      if (element.hasNumberOfInstancesElement()) {
45994        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
45995        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
45996      }
45997      if (element.hasEndpoint()) {
45998        openArray("endpoint");
45999        for (Reference e : element.getEndpoint()) 
46000          composeReference(null, e);
46001        closeArray();
46002      };
46003      if (element.hasBodySite()) {
46004        composeCoding("bodySite", element.getBodySite());
46005      }
46006      if (element.hasLaterality()) {
46007        composeCoding("laterality", element.getLaterality());
46008      }
46009      if (element.hasSpecimen()) {
46010        openArray("specimen");
46011        for (Reference e : element.getSpecimen()) 
46012          composeReference(null, e);
46013        closeArray();
46014      };
46015      if (element.hasStartedElement()) {
46016        composeDateTimeCore("started", element.getStartedElement(), false);
46017        composeDateTimeExtras("started", element.getStartedElement(), false);
46018      }
46019      if (element.hasPerformer()) {
46020        openArray("performer");
46021        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
46022          composeImagingStudySeriesPerformerComponent(null, e);
46023        closeArray();
46024      };
46025      if (element.hasInstance()) {
46026        openArray("instance");
46027        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
46028          composeImagingStudySeriesInstanceComponent(null, e);
46029        closeArray();
46030      };
46031  }
46032
46033  protected void composeImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
46034    if (element != null) {
46035      open(name);
46036      composeImagingStudySeriesPerformerComponentProperties(element);
46037      close();
46038    }
46039  }
46040
46041  protected void composeImagingStudySeriesPerformerComponentProperties(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
46042    composeBackboneElementProperties(element);
46043      if (element.hasFunction()) {
46044        composeCodeableConcept("function", element.getFunction());
46045      }
46046      if (element.hasActor()) {
46047        composeReference("actor", element.getActor());
46048      }
46049  }
46050
46051  protected void composeImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
46052    if (element != null) {
46053      open(name);
46054      composeImagingStudySeriesInstanceComponentProperties(element);
46055      close();
46056    }
46057  }
46058
46059  protected void composeImagingStudySeriesInstanceComponentProperties(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
46060    composeBackboneElementProperties(element);
46061      if (element.hasUidElement()) {
46062        composeIdCore("uid", element.getUidElement(), false);
46063        composeIdExtras("uid", element.getUidElement(), false);
46064      }
46065      if (element.hasSopClass()) {
46066        composeCoding("sopClass", element.getSopClass());
46067      }
46068      if (element.hasNumberElement()) {
46069        composeUnsignedIntCore("number", element.getNumberElement(), false);
46070        composeUnsignedIntExtras("number", element.getNumberElement(), false);
46071      }
46072      if (element.hasTitleElement()) {
46073        composeStringCore("title", element.getTitleElement(), false);
46074        composeStringExtras("title", element.getTitleElement(), false);
46075      }
46076  }
46077
46078  protected void composeImmunization(String name, Immunization element) throws IOException {
46079    if (element != null) {
46080      prop("resourceType", name);
46081      composeImmunizationProperties(element);
46082    }
46083  }
46084
46085  protected void composeImmunizationProperties(Immunization element) throws IOException {
46086    composeDomainResourceProperties(element);
46087      if (element.hasIdentifier()) {
46088        openArray("identifier");
46089        for (Identifier e : element.getIdentifier()) 
46090          composeIdentifier(null, e);
46091        closeArray();
46092      };
46093      if (element.hasStatusElement()) {
46094        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
46095        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
46096      }
46097      if (element.hasStatusReason()) {
46098        composeCodeableConcept("statusReason", element.getStatusReason());
46099      }
46100      if (element.hasVaccineCode()) {
46101        composeCodeableConcept("vaccineCode", element.getVaccineCode());
46102      }
46103      if (element.hasPatient()) {
46104        composeReference("patient", element.getPatient());
46105      }
46106      if (element.hasEncounter()) {
46107        composeReference("encounter", element.getEncounter());
46108      }
46109      if (element.hasOccurrence()) {
46110        composeType("occurrence", element.getOccurrence());
46111      }
46112      if (element.hasRecordedElement()) {
46113        composeDateTimeCore("recorded", element.getRecordedElement(), false);
46114        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
46115      }
46116      if (element.hasPrimarySourceElement()) {
46117        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
46118        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
46119      }
46120      if (element.hasReportOrigin()) {
46121        composeCodeableConcept("reportOrigin", element.getReportOrigin());
46122      }
46123      if (element.hasLocation()) {
46124        composeReference("location", element.getLocation());
46125      }
46126      if (element.hasManufacturer()) {
46127        composeReference("manufacturer", element.getManufacturer());
46128      }
46129      if (element.hasLotNumberElement()) {
46130        composeStringCore("lotNumber", element.getLotNumberElement(), false);
46131        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
46132      }
46133      if (element.hasExpirationDateElement()) {
46134        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
46135        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
46136      }
46137      if (element.hasSite()) {
46138        composeCodeableConcept("site", element.getSite());
46139      }
46140      if (element.hasRoute()) {
46141        composeCodeableConcept("route", element.getRoute());
46142      }
46143      if (element.hasDoseQuantity()) {
46144        composeQuantity("doseQuantity", element.getDoseQuantity());
46145      }
46146      if (element.hasPerformer()) {
46147        openArray("performer");
46148        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
46149          composeImmunizationPerformerComponent(null, e);
46150        closeArray();
46151      };
46152      if (element.hasNote()) {
46153        openArray("note");
46154        for (Annotation e : element.getNote()) 
46155          composeAnnotation(null, e);
46156        closeArray();
46157      };
46158      if (element.hasReasonCode()) {
46159        openArray("reasonCode");
46160        for (CodeableConcept e : element.getReasonCode()) 
46161          composeCodeableConcept(null, e);
46162        closeArray();
46163      };
46164      if (element.hasReasonReference()) {
46165        openArray("reasonReference");
46166        for (Reference e : element.getReasonReference()) 
46167          composeReference(null, e);
46168        closeArray();
46169      };
46170      if (element.hasIsSubpotentElement()) {
46171        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
46172        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
46173      }
46174      if (element.hasSubpotentReason()) {
46175        openArray("subpotentReason");
46176        for (CodeableConcept e : element.getSubpotentReason()) 
46177          composeCodeableConcept(null, e);
46178        closeArray();
46179      };
46180      if (element.hasEducation()) {
46181        openArray("education");
46182        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
46183          composeImmunizationEducationComponent(null, e);
46184        closeArray();
46185      };
46186      if (element.hasProgramEligibility()) {
46187        openArray("programEligibility");
46188        for (CodeableConcept e : element.getProgramEligibility()) 
46189          composeCodeableConcept(null, e);
46190        closeArray();
46191      };
46192      if (element.hasFundingSource()) {
46193        composeCodeableConcept("fundingSource", element.getFundingSource());
46194      }
46195      if (element.hasReaction()) {
46196        openArray("reaction");
46197        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
46198          composeImmunizationReactionComponent(null, e);
46199        closeArray();
46200      };
46201      if (element.hasProtocolApplied()) {
46202        openArray("protocolApplied");
46203        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
46204          composeImmunizationProtocolAppliedComponent(null, e);
46205        closeArray();
46206      };
46207  }
46208
46209  protected void composeImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
46210    if (element != null) {
46211      open(name);
46212      composeImmunizationPerformerComponentProperties(element);
46213      close();
46214    }
46215  }
46216
46217  protected void composeImmunizationPerformerComponentProperties(Immunization.ImmunizationPerformerComponent element) throws IOException {
46218    composeBackboneElementProperties(element);
46219      if (element.hasFunction()) {
46220        composeCodeableConcept("function", element.getFunction());
46221      }
46222      if (element.hasActor()) {
46223        composeReference("actor", element.getActor());
46224      }
46225  }
46226
46227  protected void composeImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
46228    if (element != null) {
46229      open(name);
46230      composeImmunizationEducationComponentProperties(element);
46231      close();
46232    }
46233  }
46234
46235  protected void composeImmunizationEducationComponentProperties(Immunization.ImmunizationEducationComponent element) throws IOException {
46236    composeBackboneElementProperties(element);
46237      if (element.hasDocumentTypeElement()) {
46238        composeStringCore("documentType", element.getDocumentTypeElement(), false);
46239        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
46240      }
46241      if (element.hasReferenceElement()) {
46242        composeUriCore("reference", element.getReferenceElement(), false);
46243        composeUriExtras("reference", element.getReferenceElement(), false);
46244      }
46245      if (element.hasPublicationDateElement()) {
46246        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
46247        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
46248      }
46249      if (element.hasPresentationDateElement()) {
46250        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
46251        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
46252      }
46253  }
46254
46255  protected void composeImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
46256    if (element != null) {
46257      open(name);
46258      composeImmunizationReactionComponentProperties(element);
46259      close();
46260    }
46261  }
46262
46263  protected void composeImmunizationReactionComponentProperties(Immunization.ImmunizationReactionComponent element) throws IOException {
46264    composeBackboneElementProperties(element);
46265      if (element.hasDateElement()) {
46266        composeDateTimeCore("date", element.getDateElement(), false);
46267        composeDateTimeExtras("date", element.getDateElement(), false);
46268      }
46269      if (element.hasDetail()) {
46270        composeReference("detail", element.getDetail());
46271      }
46272      if (element.hasReportedElement()) {
46273        composeBooleanCore("reported", element.getReportedElement(), false);
46274        composeBooleanExtras("reported", element.getReportedElement(), false);
46275      }
46276  }
46277
46278  protected void composeImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
46279    if (element != null) {
46280      open(name);
46281      composeImmunizationProtocolAppliedComponentProperties(element);
46282      close();
46283    }
46284  }
46285
46286  protected void composeImmunizationProtocolAppliedComponentProperties(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
46287    composeBackboneElementProperties(element);
46288      if (element.hasSeriesElement()) {
46289        composeStringCore("series", element.getSeriesElement(), false);
46290        composeStringExtras("series", element.getSeriesElement(), false);
46291      }
46292      if (element.hasAuthority()) {
46293        composeReference("authority", element.getAuthority());
46294      }
46295      if (element.hasTargetDisease()) {
46296        openArray("targetDisease");
46297        for (CodeableConcept e : element.getTargetDisease()) 
46298          composeCodeableConcept(null, e);
46299        closeArray();
46300      };
46301      if (element.hasDoseNumber()) {
46302        composeType("doseNumber", element.getDoseNumber());
46303      }
46304      if (element.hasSeriesDoses()) {
46305        composeType("seriesDoses", element.getSeriesDoses());
46306      }
46307  }
46308
46309  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
46310    if (element != null) {
46311      prop("resourceType", name);
46312      composeImmunizationEvaluationProperties(element);
46313    }
46314  }
46315
46316  protected void composeImmunizationEvaluationProperties(ImmunizationEvaluation element) throws IOException {
46317    composeDomainResourceProperties(element);
46318      if (element.hasIdentifier()) {
46319        openArray("identifier");
46320        for (Identifier e : element.getIdentifier()) 
46321          composeIdentifier(null, e);
46322        closeArray();
46323      };
46324      if (element.hasStatusElement()) {
46325        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
46326        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
46327      }
46328      if (element.hasPatient()) {
46329        composeReference("patient", element.getPatient());
46330      }
46331      if (element.hasDateElement()) {
46332        composeDateTimeCore("date", element.getDateElement(), false);
46333        composeDateTimeExtras("date", element.getDateElement(), false);
46334      }
46335      if (element.hasAuthority()) {
46336        composeReference("authority", element.getAuthority());
46337      }
46338      if (element.hasTargetDisease()) {
46339        composeCodeableConcept("targetDisease", element.getTargetDisease());
46340      }
46341      if (element.hasImmunizationEvent()) {
46342        composeReference("immunizationEvent", element.getImmunizationEvent());
46343      }
46344      if (element.hasDoseStatus()) {
46345        composeCodeableConcept("doseStatus", element.getDoseStatus());
46346      }
46347      if (element.hasDoseStatusReason()) {
46348        openArray("doseStatusReason");
46349        for (CodeableConcept e : element.getDoseStatusReason()) 
46350          composeCodeableConcept(null, e);
46351        closeArray();
46352      };
46353      if (element.hasDescriptionElement()) {
46354        composeStringCore("description", element.getDescriptionElement(), false);
46355        composeStringExtras("description", element.getDescriptionElement(), false);
46356      }
46357      if (element.hasSeriesElement()) {
46358        composeStringCore("series", element.getSeriesElement(), false);
46359        composeStringExtras("series", element.getSeriesElement(), false);
46360      }
46361      if (element.hasDoseNumber()) {
46362        composeType("doseNumber", element.getDoseNumber());
46363      }
46364      if (element.hasSeriesDoses()) {
46365        composeType("seriesDoses", element.getSeriesDoses());
46366      }
46367  }
46368
46369  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
46370    if (element != null) {
46371      prop("resourceType", name);
46372      composeImmunizationRecommendationProperties(element);
46373    }
46374  }
46375
46376  protected void composeImmunizationRecommendationProperties(ImmunizationRecommendation element) throws IOException {
46377    composeDomainResourceProperties(element);
46378      if (element.hasIdentifier()) {
46379        openArray("identifier");
46380        for (Identifier e : element.getIdentifier()) 
46381          composeIdentifier(null, e);
46382        closeArray();
46383      };
46384      if (element.hasPatient()) {
46385        composeReference("patient", element.getPatient());
46386      }
46387      if (element.hasDateElement()) {
46388        composeDateTimeCore("date", element.getDateElement(), false);
46389        composeDateTimeExtras("date", element.getDateElement(), false);
46390      }
46391      if (element.hasAuthority()) {
46392        composeReference("authority", element.getAuthority());
46393      }
46394      if (element.hasRecommendation()) {
46395        openArray("recommendation");
46396        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
46397          composeImmunizationRecommendationRecommendationComponent(null, e);
46398        closeArray();
46399      };
46400  }
46401
46402  protected void composeImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
46403    if (element != null) {
46404      open(name);
46405      composeImmunizationRecommendationRecommendationComponentProperties(element);
46406      close();
46407    }
46408  }
46409
46410  protected void composeImmunizationRecommendationRecommendationComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
46411    composeBackboneElementProperties(element);
46412      if (element.hasVaccineCode()) {
46413        openArray("vaccineCode");
46414        for (CodeableConcept e : element.getVaccineCode()) 
46415          composeCodeableConcept(null, e);
46416        closeArray();
46417      };
46418      if (element.hasTargetDisease()) {
46419        composeCodeableConcept("targetDisease", element.getTargetDisease());
46420      }
46421      if (element.hasContraindicatedVaccineCode()) {
46422        openArray("contraindicatedVaccineCode");
46423        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
46424          composeCodeableConcept(null, e);
46425        closeArray();
46426      };
46427      if (element.hasForecastStatus()) {
46428        composeCodeableConcept("forecastStatus", element.getForecastStatus());
46429      }
46430      if (element.hasForecastReason()) {
46431        openArray("forecastReason");
46432        for (CodeableConcept e : element.getForecastReason()) 
46433          composeCodeableConcept(null, e);
46434        closeArray();
46435      };
46436      if (element.hasDateCriterion()) {
46437        openArray("dateCriterion");
46438        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
46439          composeImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
46440        closeArray();
46441      };
46442      if (element.hasDescriptionElement()) {
46443        composeStringCore("description", element.getDescriptionElement(), false);
46444        composeStringExtras("description", element.getDescriptionElement(), false);
46445      }
46446      if (element.hasSeriesElement()) {
46447        composeStringCore("series", element.getSeriesElement(), false);
46448        composeStringExtras("series", element.getSeriesElement(), false);
46449      }
46450      if (element.hasDoseNumber()) {
46451        composeType("doseNumber", element.getDoseNumber());
46452      }
46453      if (element.hasSeriesDoses()) {
46454        composeType("seriesDoses", element.getSeriesDoses());
46455      }
46456      if (element.hasSupportingImmunization()) {
46457        openArray("supportingImmunization");
46458        for (Reference e : element.getSupportingImmunization()) 
46459          composeReference(null, e);
46460        closeArray();
46461      };
46462      if (element.hasSupportingPatientInformation()) {
46463        openArray("supportingPatientInformation");
46464        for (Reference e : element.getSupportingPatientInformation()) 
46465          composeReference(null, e);
46466        closeArray();
46467      };
46468  }
46469
46470  protected void composeImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
46471    if (element != null) {
46472      open(name);
46473      composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(element);
46474      close();
46475    }
46476  }
46477
46478  protected void composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
46479    composeBackboneElementProperties(element);
46480      if (element.hasCode()) {
46481        composeCodeableConcept("code", element.getCode());
46482      }
46483      if (element.hasValueElement()) {
46484        composeDateTimeCore("value", element.getValueElement(), false);
46485        composeDateTimeExtras("value", element.getValueElement(), false);
46486      }
46487  }
46488
46489  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
46490    if (element != null) {
46491      prop("resourceType", name);
46492      composeImplementationGuideProperties(element);
46493    }
46494  }
46495
46496  protected void composeImplementationGuideProperties(ImplementationGuide element) throws IOException {
46497    composeDomainResourceProperties(element);
46498      if (element.hasUrlElement()) {
46499        composeUriCore("url", element.getUrlElement(), false);
46500        composeUriExtras("url", element.getUrlElement(), false);
46501      }
46502      if (element.hasVersionElement()) {
46503        composeStringCore("version", element.getVersionElement(), false);
46504        composeStringExtras("version", element.getVersionElement(), false);
46505      }
46506      if (element.hasNameElement()) {
46507        composeStringCore("name", element.getNameElement(), false);
46508        composeStringExtras("name", element.getNameElement(), false);
46509      }
46510      if (element.hasTitleElement()) {
46511        composeStringCore("title", element.getTitleElement(), false);
46512        composeStringExtras("title", element.getTitleElement(), false);
46513      }
46514      if (element.hasStatusElement()) {
46515        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46516        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46517      }
46518      if (element.hasExperimentalElement()) {
46519        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46520        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46521      }
46522      if (element.hasDateElement()) {
46523        composeDateTimeCore("date", element.getDateElement(), false);
46524        composeDateTimeExtras("date", element.getDateElement(), false);
46525      }
46526      if (element.hasPublisherElement()) {
46527        composeStringCore("publisher", element.getPublisherElement(), false);
46528        composeStringExtras("publisher", element.getPublisherElement(), false);
46529      }
46530      if (element.hasContact()) {
46531        openArray("contact");
46532        for (ContactDetail e : element.getContact()) 
46533          composeContactDetail(null, e);
46534        closeArray();
46535      };
46536      if (element.hasDescriptionElement()) {
46537        composeMarkdownCore("description", element.getDescriptionElement(), false);
46538        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46539      }
46540      if (element.hasUseContext()) {
46541        openArray("useContext");
46542        for (UsageContext e : element.getUseContext()) 
46543          composeUsageContext(null, e);
46544        closeArray();
46545      };
46546      if (element.hasJurisdiction()) {
46547        openArray("jurisdiction");
46548        for (CodeableConcept e : element.getJurisdiction()) 
46549          composeCodeableConcept(null, e);
46550        closeArray();
46551      };
46552      if (element.hasCopyrightElement()) {
46553        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46554        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46555      }
46556      if (element.hasPackageIdElement()) {
46557        composeIdCore("packageId", element.getPackageIdElement(), false);
46558        composeIdExtras("packageId", element.getPackageIdElement(), false);
46559      }
46560      if (element.hasLicenseElement()) {
46561        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
46562        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
46563      }
46564      if (element.hasFhirVersion()) {
46565        openArray("fhirVersion");
46566        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46567          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46568        closeArray();
46569        if (anyHasExtras(element.getFhirVersion())) {
46570          openArray("_fhirVersion");
46571          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46572            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46573          closeArray();
46574        }
46575      };
46576      if (element.hasDependsOn()) {
46577        openArray("dependsOn");
46578        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
46579          composeImplementationGuideDependsOnComponent(null, e);
46580        closeArray();
46581      };
46582      if (element.hasGlobal()) {
46583        openArray("global");
46584        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
46585          composeImplementationGuideGlobalComponent(null, e);
46586        closeArray();
46587      };
46588      if (element.hasDefinition()) {
46589        composeImplementationGuideDefinitionComponent("definition", element.getDefinition());
46590      }
46591      if (element.hasManifest()) {
46592        composeImplementationGuideManifestComponent("manifest", element.getManifest());
46593      }
46594  }
46595
46596  protected void composeImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
46597    if (element != null) {
46598      open(name);
46599      composeImplementationGuideDependsOnComponentProperties(element);
46600      close();
46601    }
46602  }
46603
46604  protected void composeImplementationGuideDependsOnComponentProperties(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
46605    composeBackboneElementProperties(element);
46606      if (element.hasUriElement()) {
46607        composeCanonicalCore("uri", element.getUriElement(), false);
46608        composeCanonicalExtras("uri", element.getUriElement(), false);
46609      }
46610      if (element.hasPackageIdElement()) {
46611        composeIdCore("packageId", element.getPackageIdElement(), false);
46612        composeIdExtras("packageId", element.getPackageIdElement(), false);
46613      }
46614      if (element.hasVersionElement()) {
46615        composeStringCore("version", element.getVersionElement(), false);
46616        composeStringExtras("version", element.getVersionElement(), false);
46617      }
46618  }
46619
46620  protected void composeImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
46621    if (element != null) {
46622      open(name);
46623      composeImplementationGuideGlobalComponentProperties(element);
46624      close();
46625    }
46626  }
46627
46628  protected void composeImplementationGuideGlobalComponentProperties(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
46629    composeBackboneElementProperties(element);
46630      if (element.hasTypeElement()) {
46631        composeCodeCore("type", element.getTypeElement(), false);
46632        composeCodeExtras("type", element.getTypeElement(), false);
46633      }
46634      if (element.hasProfileElement()) {
46635        composeCanonicalCore("profile", element.getProfileElement(), false);
46636        composeCanonicalExtras("profile", element.getProfileElement(), false);
46637      }
46638  }
46639
46640  protected void composeImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
46641    if (element != null) {
46642      open(name);
46643      composeImplementationGuideDefinitionComponentProperties(element);
46644      close();
46645    }
46646  }
46647
46648  protected void composeImplementationGuideDefinitionComponentProperties(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
46649    composeBackboneElementProperties(element);
46650      if (element.hasGrouping()) {
46651        openArray("grouping");
46652        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
46653          composeImplementationGuideDefinitionGroupingComponent(null, e);
46654        closeArray();
46655      };
46656      if (element.hasResource()) {
46657        openArray("resource");
46658        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
46659          composeImplementationGuideDefinitionResourceComponent(null, e);
46660        closeArray();
46661      };
46662      if (element.hasPage()) {
46663        composeImplementationGuideDefinitionPageComponent("page", element.getPage());
46664      }
46665      if (element.hasParameter()) {
46666        openArray("parameter");
46667        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
46668          composeImplementationGuideDefinitionParameterComponent(null, e);
46669        closeArray();
46670      };
46671      if (element.hasTemplate()) {
46672        openArray("template");
46673        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
46674          composeImplementationGuideDefinitionTemplateComponent(null, e);
46675        closeArray();
46676      };
46677  }
46678
46679  protected void composeImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
46680    if (element != null) {
46681      open(name);
46682      composeImplementationGuideDefinitionGroupingComponentProperties(element);
46683      close();
46684    }
46685  }
46686
46687  protected void composeImplementationGuideDefinitionGroupingComponentProperties(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
46688    composeBackboneElementProperties(element);
46689      if (element.hasNameElement()) {
46690        composeStringCore("name", element.getNameElement(), false);
46691        composeStringExtras("name", element.getNameElement(), false);
46692      }
46693      if (element.hasDescriptionElement()) {
46694        composeStringCore("description", element.getDescriptionElement(), false);
46695        composeStringExtras("description", element.getDescriptionElement(), false);
46696      }
46697  }
46698
46699  protected void composeImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
46700    if (element != null) {
46701      open(name);
46702      composeImplementationGuideDefinitionResourceComponentProperties(element);
46703      close();
46704    }
46705  }
46706
46707  protected void composeImplementationGuideDefinitionResourceComponentProperties(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
46708    composeBackboneElementProperties(element);
46709      if (element.hasReference()) {
46710        composeReference("reference", element.getReference());
46711      }
46712      if (element.hasFhirVersion()) {
46713        openArray("fhirVersion");
46714        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46715          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46716        closeArray();
46717        if (anyHasExtras(element.getFhirVersion())) {
46718          openArray("_fhirVersion");
46719          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46720            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46721          closeArray();
46722        }
46723      };
46724      if (element.hasNameElement()) {
46725        composeStringCore("name", element.getNameElement(), false);
46726        composeStringExtras("name", element.getNameElement(), false);
46727      }
46728      if (element.hasDescriptionElement()) {
46729        composeStringCore("description", element.getDescriptionElement(), false);
46730        composeStringExtras("description", element.getDescriptionElement(), false);
46731      }
46732      if (element.hasExample()) {
46733        composeType("example", element.getExample());
46734      }
46735      if (element.hasGroupingIdElement()) {
46736        composeIdCore("groupingId", element.getGroupingIdElement(), false);
46737        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
46738      }
46739  }
46740
46741  protected void composeImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
46742    if (element != null) {
46743      open(name);
46744      composeImplementationGuideDefinitionPageComponentProperties(element);
46745      close();
46746    }
46747  }
46748
46749  protected void composeImplementationGuideDefinitionPageComponentProperties(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
46750    composeBackboneElementProperties(element);
46751      if (element.hasName()) {
46752        composeType("name", element.getName());
46753      }
46754      if (element.hasTitleElement()) {
46755        composeStringCore("title", element.getTitleElement(), false);
46756        composeStringExtras("title", element.getTitleElement(), false);
46757      }
46758      if (element.hasGenerationElement()) {
46759        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
46760        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
46761      }
46762      if (element.hasPage()) {
46763        openArray("page");
46764        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
46765          composeImplementationGuideDefinitionPageComponent(null, e);
46766        closeArray();
46767      };
46768  }
46769
46770  protected void composeImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
46771    if (element != null) {
46772      open(name);
46773      composeImplementationGuideDefinitionParameterComponentProperties(element);
46774      close();
46775    }
46776  }
46777
46778  protected void composeImplementationGuideDefinitionParameterComponentProperties(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
46779    composeBackboneElementProperties(element);
46780      if (element.hasCodeElement()) {
46781        composeEnumerationCore("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
46782        composeEnumerationExtras("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
46783      }
46784      if (element.hasValueElement()) {
46785        composeStringCore("value", element.getValueElement(), false);
46786        composeStringExtras("value", element.getValueElement(), false);
46787      }
46788  }
46789
46790  protected void composeImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
46791    if (element != null) {
46792      open(name);
46793      composeImplementationGuideDefinitionTemplateComponentProperties(element);
46794      close();
46795    }
46796  }
46797
46798  protected void composeImplementationGuideDefinitionTemplateComponentProperties(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
46799    composeBackboneElementProperties(element);
46800      if (element.hasCodeElement()) {
46801        composeCodeCore("code", element.getCodeElement(), false);
46802        composeCodeExtras("code", element.getCodeElement(), false);
46803      }
46804      if (element.hasSourceElement()) {
46805        composeStringCore("source", element.getSourceElement(), false);
46806        composeStringExtras("source", element.getSourceElement(), false);
46807      }
46808      if (element.hasScopeElement()) {
46809        composeStringCore("scope", element.getScopeElement(), false);
46810        composeStringExtras("scope", element.getScopeElement(), false);
46811      }
46812  }
46813
46814  protected void composeImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
46815    if (element != null) {
46816      open(name);
46817      composeImplementationGuideManifestComponentProperties(element);
46818      close();
46819    }
46820  }
46821
46822  protected void composeImplementationGuideManifestComponentProperties(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
46823    composeBackboneElementProperties(element);
46824      if (element.hasRenderingElement()) {
46825        composeUrlCore("rendering", element.getRenderingElement(), false);
46826        composeUrlExtras("rendering", element.getRenderingElement(), false);
46827      }
46828      if (element.hasResource()) {
46829        openArray("resource");
46830        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
46831          composeManifestResourceComponent(null, e);
46832        closeArray();
46833      };
46834      if (element.hasPage()) {
46835        openArray("page");
46836        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
46837          composeManifestPageComponent(null, e);
46838        closeArray();
46839      };
46840      if (element.hasImage()) {
46841        if (anyHasValue(element.getImage())) {
46842          openArray("image");
46843          for (StringType e : element.getImage()) 
46844            composeStringCore(null, e, e != element.getImage().get(element.getImage().size()-1));
46845          closeArray();
46846        }
46847        if (anyHasExtras(element.getImage())) {
46848          openArray("_image");
46849          for (StringType e : element.getImage()) 
46850            composeStringExtras(null, e, true);
46851          closeArray();
46852        }
46853      };
46854      if (element.hasOther()) {
46855        if (anyHasValue(element.getOther())) {
46856          openArray("other");
46857          for (StringType e : element.getOther()) 
46858            composeStringCore(null, e, e != element.getOther().get(element.getOther().size()-1));
46859          closeArray();
46860        }
46861        if (anyHasExtras(element.getOther())) {
46862          openArray("_other");
46863          for (StringType e : element.getOther()) 
46864            composeStringExtras(null, e, true);
46865          closeArray();
46866        }
46867      };
46868  }
46869
46870  protected void composeManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
46871    if (element != null) {
46872      open(name);
46873      composeManifestResourceComponentProperties(element);
46874      close();
46875    }
46876  }
46877
46878  protected void composeManifestResourceComponentProperties(ImplementationGuide.ManifestResourceComponent element) throws IOException {
46879    composeBackboneElementProperties(element);
46880      if (element.hasReference()) {
46881        composeReference("reference", element.getReference());
46882      }
46883      if (element.hasExample()) {
46884        composeType("example", element.getExample());
46885      }
46886      if (element.hasRelativePathElement()) {
46887        composeUrlCore("relativePath", element.getRelativePathElement(), false);
46888        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
46889      }
46890  }
46891
46892  protected void composeManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
46893    if (element != null) {
46894      open(name);
46895      composeManifestPageComponentProperties(element);
46896      close();
46897    }
46898  }
46899
46900  protected void composeManifestPageComponentProperties(ImplementationGuide.ManifestPageComponent element) throws IOException {
46901    composeBackboneElementProperties(element);
46902      if (element.hasNameElement()) {
46903        composeStringCore("name", element.getNameElement(), false);
46904        composeStringExtras("name", element.getNameElement(), false);
46905      }
46906      if (element.hasTitleElement()) {
46907        composeStringCore("title", element.getTitleElement(), false);
46908        composeStringExtras("title", element.getTitleElement(), false);
46909      }
46910      if (element.hasAnchor()) {
46911        if (anyHasValue(element.getAnchor())) {
46912          openArray("anchor");
46913          for (StringType e : element.getAnchor()) 
46914            composeStringCore(null, e, e != element.getAnchor().get(element.getAnchor().size()-1));
46915          closeArray();
46916        }
46917        if (anyHasExtras(element.getAnchor())) {
46918          openArray("_anchor");
46919          for (StringType e : element.getAnchor()) 
46920            composeStringExtras(null, e, true);
46921          closeArray();
46922        }
46923      };
46924  }
46925
46926  protected void composeIngredient(String name, Ingredient element) throws IOException {
46927    if (element != null) {
46928      prop("resourceType", name);
46929      composeIngredientProperties(element);
46930    }
46931  }
46932
46933  protected void composeIngredientProperties(Ingredient element) throws IOException {
46934    composeDomainResourceProperties(element);
46935      if (element.hasIdentifier()) {
46936        composeIdentifier("identifier", element.getIdentifier());
46937      }
46938      if (element.hasStatusElement()) {
46939        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46940        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46941      }
46942      if (element.hasFor()) {
46943        openArray("for");
46944        for (Reference e : element.getFor()) 
46945          composeReference(null, e);
46946        closeArray();
46947      };
46948      if (element.hasRole()) {
46949        composeCodeableConcept("role", element.getRole());
46950      }
46951      if (element.hasFunction()) {
46952        openArray("function");
46953        for (CodeableConcept e : element.getFunction()) 
46954          composeCodeableConcept(null, e);
46955        closeArray();
46956      };
46957      if (element.hasAllergenicIndicatorElement()) {
46958        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
46959        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
46960      }
46961      if (element.hasManufacturer()) {
46962        openArray("manufacturer");
46963        for (Ingredient.IngredientManufacturerComponent e : element.getManufacturer()) 
46964          composeIngredientManufacturerComponent(null, e);
46965        closeArray();
46966      };
46967      if (element.hasSubstance()) {
46968        composeIngredientSubstanceComponent("substance", element.getSubstance());
46969      }
46970  }
46971
46972  protected void composeIngredientManufacturerComponent(String name, Ingredient.IngredientManufacturerComponent element) throws IOException {
46973    if (element != null) {
46974      open(name);
46975      composeIngredientManufacturerComponentProperties(element);
46976      close();
46977    }
46978  }
46979
46980  protected void composeIngredientManufacturerComponentProperties(Ingredient.IngredientManufacturerComponent element) throws IOException {
46981    composeBackboneElementProperties(element);
46982      if (element.hasRole()) {
46983        composeCoding("role", element.getRole());
46984      }
46985      if (element.hasManufacturer()) {
46986        composeReference("manufacturer", element.getManufacturer());
46987      }
46988  }
46989
46990  protected void composeIngredientSubstanceComponent(String name, Ingredient.IngredientSubstanceComponent element) throws IOException {
46991    if (element != null) {
46992      open(name);
46993      composeIngredientSubstanceComponentProperties(element);
46994      close();
46995    }
46996  }
46997
46998  protected void composeIngredientSubstanceComponentProperties(Ingredient.IngredientSubstanceComponent element) throws IOException {
46999    composeBackboneElementProperties(element);
47000      if (element.hasCode()) {
47001        composeCodeableReference("code", element.getCode());
47002      }
47003      if (element.hasStrength()) {
47004        openArray("strength");
47005        for (Ingredient.IngredientSubstanceStrengthComponent e : element.getStrength()) 
47006          composeIngredientSubstanceStrengthComponent(null, e);
47007        closeArray();
47008      };
47009  }
47010
47011  protected void composeIngredientSubstanceStrengthComponent(String name, Ingredient.IngredientSubstanceStrengthComponent element) throws IOException {
47012    if (element != null) {
47013      open(name);
47014      composeIngredientSubstanceStrengthComponentProperties(element);
47015      close();
47016    }
47017  }
47018
47019  protected void composeIngredientSubstanceStrengthComponentProperties(Ingredient.IngredientSubstanceStrengthComponent element) throws IOException {
47020    composeBackboneElementProperties(element);
47021      if (element.hasPresentation()) {
47022        composeType("presentation", element.getPresentation());
47023      }
47024      if (element.hasPresentationTextElement()) {
47025        composeStringCore("presentationText", element.getPresentationTextElement(), false);
47026        composeStringExtras("presentationText", element.getPresentationTextElement(), false);
47027      }
47028      if (element.hasConcentration()) {
47029        composeType("concentration", element.getConcentration());
47030      }
47031      if (element.hasConcentrationTextElement()) {
47032        composeStringCore("concentrationText", element.getConcentrationTextElement(), false);
47033        composeStringExtras("concentrationText", element.getConcentrationTextElement(), false);
47034      }
47035      if (element.hasMeasurementPointElement()) {
47036        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47037        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47038      }
47039      if (element.hasCountry()) {
47040        openArray("country");
47041        for (CodeableConcept e : element.getCountry()) 
47042          composeCodeableConcept(null, e);
47043        closeArray();
47044      };
47045      if (element.hasReferenceStrength()) {
47046        openArray("referenceStrength");
47047        for (Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
47048          composeIngredientSubstanceStrengthReferenceStrengthComponent(null, e);
47049        closeArray();
47050      };
47051  }
47052
47053  protected void composeIngredientSubstanceStrengthReferenceStrengthComponent(String name, Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47054    if (element != null) {
47055      open(name);
47056      composeIngredientSubstanceStrengthReferenceStrengthComponentProperties(element);
47057      close();
47058    }
47059  }
47060
47061  protected void composeIngredientSubstanceStrengthReferenceStrengthComponentProperties(Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47062    composeBackboneElementProperties(element);
47063      if (element.hasSubstance()) {
47064        composeCodeableReference("substance", element.getSubstance());
47065      }
47066      if (element.hasStrength()) {
47067        composeType("strength", element.getStrength());
47068      }
47069      if (element.hasMeasurementPointElement()) {
47070        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47071        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47072      }
47073      if (element.hasCountry()) {
47074        openArray("country");
47075        for (CodeableConcept e : element.getCountry()) 
47076          composeCodeableConcept(null, e);
47077        closeArray();
47078      };
47079  }
47080
47081  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
47082    if (element != null) {
47083      prop("resourceType", name);
47084      composeInsurancePlanProperties(element);
47085    }
47086  }
47087
47088  protected void composeInsurancePlanProperties(InsurancePlan element) throws IOException {
47089    composeDomainResourceProperties(element);
47090      if (element.hasIdentifier()) {
47091        openArray("identifier");
47092        for (Identifier e : element.getIdentifier()) 
47093          composeIdentifier(null, e);
47094        closeArray();
47095      };
47096      if (element.hasStatusElement()) {
47097        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47098        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47099      }
47100      if (element.hasType()) {
47101        openArray("type");
47102        for (CodeableConcept e : element.getType()) 
47103          composeCodeableConcept(null, e);
47104        closeArray();
47105      };
47106      if (element.hasNameElement()) {
47107        composeStringCore("name", element.getNameElement(), false);
47108        composeStringExtras("name", element.getNameElement(), false);
47109      }
47110      if (element.hasAlias()) {
47111        if (anyHasValue(element.getAlias())) {
47112          openArray("alias");
47113          for (StringType e : element.getAlias()) 
47114            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
47115          closeArray();
47116        }
47117        if (anyHasExtras(element.getAlias())) {
47118          openArray("_alias");
47119          for (StringType e : element.getAlias()) 
47120            composeStringExtras(null, e, true);
47121          closeArray();
47122        }
47123      };
47124      if (element.hasPeriod()) {
47125        composePeriod("period", element.getPeriod());
47126      }
47127      if (element.hasOwnedBy()) {
47128        composeReference("ownedBy", element.getOwnedBy());
47129      }
47130      if (element.hasAdministeredBy()) {
47131        composeReference("administeredBy", element.getAdministeredBy());
47132      }
47133      if (element.hasCoverageArea()) {
47134        openArray("coverageArea");
47135        for (Reference e : element.getCoverageArea()) 
47136          composeReference(null, e);
47137        closeArray();
47138      };
47139      if (element.hasContact()) {
47140        openArray("contact");
47141        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
47142          composeInsurancePlanContactComponent(null, e);
47143        closeArray();
47144      };
47145      if (element.hasEndpoint()) {
47146        openArray("endpoint");
47147        for (Reference e : element.getEndpoint()) 
47148          composeReference(null, e);
47149        closeArray();
47150      };
47151      if (element.hasNetwork()) {
47152        openArray("network");
47153        for (Reference e : element.getNetwork()) 
47154          composeReference(null, e);
47155        closeArray();
47156      };
47157      if (element.hasCoverage()) {
47158        openArray("coverage");
47159        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
47160          composeInsurancePlanCoverageComponent(null, e);
47161        closeArray();
47162      };
47163      if (element.hasPlan()) {
47164        openArray("plan");
47165        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
47166          composeInsurancePlanPlanComponent(null, e);
47167        closeArray();
47168      };
47169  }
47170
47171  protected void composeInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
47172    if (element != null) {
47173      open(name);
47174      composeInsurancePlanContactComponentProperties(element);
47175      close();
47176    }
47177  }
47178
47179  protected void composeInsurancePlanContactComponentProperties(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
47180    composeBackboneElementProperties(element);
47181      if (element.hasPurpose()) {
47182        composeCodeableConcept("purpose", element.getPurpose());
47183      }
47184      if (element.hasName()) {
47185        composeHumanName("name", element.getName());
47186      }
47187      if (element.hasTelecom()) {
47188        openArray("telecom");
47189        for (ContactPoint e : element.getTelecom()) 
47190          composeContactPoint(null, e);
47191        closeArray();
47192      };
47193      if (element.hasAddress()) {
47194        composeAddress("address", element.getAddress());
47195      }
47196  }
47197
47198  protected void composeInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
47199    if (element != null) {
47200      open(name);
47201      composeInsurancePlanCoverageComponentProperties(element);
47202      close();
47203    }
47204  }
47205
47206  protected void composeInsurancePlanCoverageComponentProperties(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
47207    composeBackboneElementProperties(element);
47208      if (element.hasType()) {
47209        composeCodeableConcept("type", element.getType());
47210      }
47211      if (element.hasNetwork()) {
47212        openArray("network");
47213        for (Reference e : element.getNetwork()) 
47214          composeReference(null, e);
47215        closeArray();
47216      };
47217      if (element.hasBenefit()) {
47218        openArray("benefit");
47219        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
47220          composeCoverageBenefitComponent(null, e);
47221        closeArray();
47222      };
47223  }
47224
47225  protected void composeCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
47226    if (element != null) {
47227      open(name);
47228      composeCoverageBenefitComponentProperties(element);
47229      close();
47230    }
47231  }
47232
47233  protected void composeCoverageBenefitComponentProperties(InsurancePlan.CoverageBenefitComponent element) throws IOException {
47234    composeBackboneElementProperties(element);
47235      if (element.hasType()) {
47236        composeCodeableConcept("type", element.getType());
47237      }
47238      if (element.hasRequirementElement()) {
47239        composeStringCore("requirement", element.getRequirementElement(), false);
47240        composeStringExtras("requirement", element.getRequirementElement(), false);
47241      }
47242      if (element.hasLimit()) {
47243        openArray("limit");
47244        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
47245          composeCoverageBenefitLimitComponent(null, e);
47246        closeArray();
47247      };
47248  }
47249
47250  protected void composeCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
47251    if (element != null) {
47252      open(name);
47253      composeCoverageBenefitLimitComponentProperties(element);
47254      close();
47255    }
47256  }
47257
47258  protected void composeCoverageBenefitLimitComponentProperties(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
47259    composeBackboneElementProperties(element);
47260      if (element.hasValue()) {
47261        composeQuantity("value", element.getValue());
47262      }
47263      if (element.hasCode()) {
47264        composeCodeableConcept("code", element.getCode());
47265      }
47266  }
47267
47268  protected void composeInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
47269    if (element != null) {
47270      open(name);
47271      composeInsurancePlanPlanComponentProperties(element);
47272      close();
47273    }
47274  }
47275
47276  protected void composeInsurancePlanPlanComponentProperties(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
47277    composeBackboneElementProperties(element);
47278      if (element.hasIdentifier()) {
47279        openArray("identifier");
47280        for (Identifier e : element.getIdentifier()) 
47281          composeIdentifier(null, e);
47282        closeArray();
47283      };
47284      if (element.hasType()) {
47285        composeCodeableConcept("type", element.getType());
47286      }
47287      if (element.hasCoverageArea()) {
47288        openArray("coverageArea");
47289        for (Reference e : element.getCoverageArea()) 
47290          composeReference(null, e);
47291        closeArray();
47292      };
47293      if (element.hasNetwork()) {
47294        openArray("network");
47295        for (Reference e : element.getNetwork()) 
47296          composeReference(null, e);
47297        closeArray();
47298      };
47299      if (element.hasGeneralCost()) {
47300        openArray("generalCost");
47301        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
47302          composeInsurancePlanPlanGeneralCostComponent(null, e);
47303        closeArray();
47304      };
47305      if (element.hasSpecificCost()) {
47306        openArray("specificCost");
47307        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
47308          composeInsurancePlanPlanSpecificCostComponent(null, e);
47309        closeArray();
47310      };
47311  }
47312
47313  protected void composeInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
47314    if (element != null) {
47315      open(name);
47316      composeInsurancePlanPlanGeneralCostComponentProperties(element);
47317      close();
47318    }
47319  }
47320
47321  protected void composeInsurancePlanPlanGeneralCostComponentProperties(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
47322    composeBackboneElementProperties(element);
47323      if (element.hasType()) {
47324        composeCodeableConcept("type", element.getType());
47325      }
47326      if (element.hasGroupSizeElement()) {
47327        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
47328        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
47329      }
47330      if (element.hasCost()) {
47331        composeMoney("cost", element.getCost());
47332      }
47333      if (element.hasCommentElement()) {
47334        composeStringCore("comment", element.getCommentElement(), false);
47335        composeStringExtras("comment", element.getCommentElement(), false);
47336      }
47337  }
47338
47339  protected void composeInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
47340    if (element != null) {
47341      open(name);
47342      composeInsurancePlanPlanSpecificCostComponentProperties(element);
47343      close();
47344    }
47345  }
47346
47347  protected void composeInsurancePlanPlanSpecificCostComponentProperties(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
47348    composeBackboneElementProperties(element);
47349      if (element.hasCategory()) {
47350        composeCodeableConcept("category", element.getCategory());
47351      }
47352      if (element.hasBenefit()) {
47353        openArray("benefit");
47354        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
47355          composePlanBenefitComponent(null, e);
47356        closeArray();
47357      };
47358  }
47359
47360  protected void composePlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
47361    if (element != null) {
47362      open(name);
47363      composePlanBenefitComponentProperties(element);
47364      close();
47365    }
47366  }
47367
47368  protected void composePlanBenefitComponentProperties(InsurancePlan.PlanBenefitComponent element) throws IOException {
47369    composeBackboneElementProperties(element);
47370      if (element.hasType()) {
47371        composeCodeableConcept("type", element.getType());
47372      }
47373      if (element.hasCost()) {
47374        openArray("cost");
47375        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
47376          composePlanBenefitCostComponent(null, e);
47377        closeArray();
47378      };
47379  }
47380
47381  protected void composePlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
47382    if (element != null) {
47383      open(name);
47384      composePlanBenefitCostComponentProperties(element);
47385      close();
47386    }
47387  }
47388
47389  protected void composePlanBenefitCostComponentProperties(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
47390    composeBackboneElementProperties(element);
47391      if (element.hasType()) {
47392        composeCodeableConcept("type", element.getType());
47393      }
47394      if (element.hasApplicability()) {
47395        composeCodeableConcept("applicability", element.getApplicability());
47396      }
47397      if (element.hasQualifiers()) {
47398        openArray("qualifiers");
47399        for (CodeableConcept e : element.getQualifiers()) 
47400          composeCodeableConcept(null, e);
47401        closeArray();
47402      };
47403      if (element.hasValue()) {
47404        composeQuantity("value", element.getValue());
47405      }
47406  }
47407
47408  protected void composeInvoice(String name, Invoice element) throws IOException {
47409    if (element != null) {
47410      prop("resourceType", name);
47411      composeInvoiceProperties(element);
47412    }
47413  }
47414
47415  protected void composeInvoiceProperties(Invoice element) throws IOException {
47416    composeDomainResourceProperties(element);
47417      if (element.hasIdentifier()) {
47418        openArray("identifier");
47419        for (Identifier e : element.getIdentifier()) 
47420          composeIdentifier(null, e);
47421        closeArray();
47422      };
47423      if (element.hasStatusElement()) {
47424        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
47425        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
47426      }
47427      if (element.hasCancelledReasonElement()) {
47428        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
47429        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
47430      }
47431      if (element.hasType()) {
47432        composeCodeableConcept("type", element.getType());
47433      }
47434      if (element.hasSubject()) {
47435        composeReference("subject", element.getSubject());
47436      }
47437      if (element.hasRecipient()) {
47438        composeReference("recipient", element.getRecipient());
47439      }
47440      if (element.hasDateElement()) {
47441        composeDateTimeCore("date", element.getDateElement(), false);
47442        composeDateTimeExtras("date", element.getDateElement(), false);
47443      }
47444      if (element.hasParticipant()) {
47445        openArray("participant");
47446        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
47447          composeInvoiceParticipantComponent(null, e);
47448        closeArray();
47449      };
47450      if (element.hasIssuer()) {
47451        composeReference("issuer", element.getIssuer());
47452      }
47453      if (element.hasAccount()) {
47454        composeReference("account", element.getAccount());
47455      }
47456      if (element.hasLineItem()) {
47457        openArray("lineItem");
47458        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
47459          composeInvoiceLineItemComponent(null, e);
47460        closeArray();
47461      };
47462      if (element.hasTotalPriceComponent()) {
47463        openArray("totalPriceComponent");
47464        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
47465          composeInvoiceLineItemPriceComponentComponent(null, e);
47466        closeArray();
47467      };
47468      if (element.hasTotalNet()) {
47469        composeMoney("totalNet", element.getTotalNet());
47470      }
47471      if (element.hasTotalGross()) {
47472        composeMoney("totalGross", element.getTotalGross());
47473      }
47474      if (element.hasPaymentTermsElement()) {
47475        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
47476        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
47477      }
47478      if (element.hasNote()) {
47479        openArray("note");
47480        for (Annotation e : element.getNote()) 
47481          composeAnnotation(null, e);
47482        closeArray();
47483      };
47484  }
47485
47486  protected void composeInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
47487    if (element != null) {
47488      open(name);
47489      composeInvoiceParticipantComponentProperties(element);
47490      close();
47491    }
47492  }
47493
47494  protected void composeInvoiceParticipantComponentProperties(Invoice.InvoiceParticipantComponent element) throws IOException {
47495    composeBackboneElementProperties(element);
47496      if (element.hasRole()) {
47497        composeCodeableConcept("role", element.getRole());
47498      }
47499      if (element.hasActor()) {
47500        composeReference("actor", element.getActor());
47501      }
47502  }
47503
47504  protected void composeInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
47505    if (element != null) {
47506      open(name);
47507      composeInvoiceLineItemComponentProperties(element);
47508      close();
47509    }
47510  }
47511
47512  protected void composeInvoiceLineItemComponentProperties(Invoice.InvoiceLineItemComponent element) throws IOException {
47513    composeBackboneElementProperties(element);
47514      if (element.hasSequenceElement()) {
47515        composePositiveIntCore("sequence", element.getSequenceElement(), false);
47516        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
47517      }
47518      if (element.hasChargeItem()) {
47519        composeType("chargeItem", element.getChargeItem());
47520      }
47521      if (element.hasPriceComponent()) {
47522        openArray("priceComponent");
47523        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
47524          composeInvoiceLineItemPriceComponentComponent(null, e);
47525        closeArray();
47526      };
47527  }
47528
47529  protected void composeInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
47530    if (element != null) {
47531      open(name);
47532      composeInvoiceLineItemPriceComponentComponentProperties(element);
47533      close();
47534    }
47535  }
47536
47537  protected void composeInvoiceLineItemPriceComponentComponentProperties(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
47538    composeBackboneElementProperties(element);
47539      if (element.hasTypeElement()) {
47540        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
47541        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
47542      }
47543      if (element.hasCode()) {
47544        composeCodeableConcept("code", element.getCode());
47545      }
47546      if (element.hasFactorElement()) {
47547        composeDecimalCore("factor", element.getFactorElement(), false);
47548        composeDecimalExtras("factor", element.getFactorElement(), false);
47549      }
47550      if (element.hasAmount()) {
47551        composeMoney("amount", element.getAmount());
47552      }
47553  }
47554
47555  protected void composeLibrary(String name, Library element) throws IOException {
47556    if (element != null) {
47557      prop("resourceType", name);
47558      composeLibraryProperties(element);
47559    }
47560  }
47561
47562  protected void composeLibraryProperties(Library element) throws IOException {
47563    composeDomainResourceProperties(element);
47564      if (element.hasUrlElement()) {
47565        composeUriCore("url", element.getUrlElement(), false);
47566        composeUriExtras("url", element.getUrlElement(), false);
47567      }
47568      if (element.hasIdentifier()) {
47569        openArray("identifier");
47570        for (Identifier e : element.getIdentifier()) 
47571          composeIdentifier(null, e);
47572        closeArray();
47573      };
47574      if (element.hasVersionElement()) {
47575        composeStringCore("version", element.getVersionElement(), false);
47576        composeStringExtras("version", element.getVersionElement(), false);
47577      }
47578      if (element.hasNameElement()) {
47579        composeStringCore("name", element.getNameElement(), false);
47580        composeStringExtras("name", element.getNameElement(), false);
47581      }
47582      if (element.hasTitleElement()) {
47583        composeStringCore("title", element.getTitleElement(), false);
47584        composeStringExtras("title", element.getTitleElement(), false);
47585      }
47586      if (element.hasSubtitleElement()) {
47587        composeStringCore("subtitle", element.getSubtitleElement(), false);
47588        composeStringExtras("subtitle", element.getSubtitleElement(), false);
47589      }
47590      if (element.hasStatusElement()) {
47591        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47592        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47593      }
47594      if (element.hasExperimentalElement()) {
47595        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47596        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47597      }
47598      if (element.hasType()) {
47599        composeCodeableConcept("type", element.getType());
47600      }
47601      if (element.hasSubject()) {
47602        composeType("subject", element.getSubject());
47603      }
47604      if (element.hasDateElement()) {
47605        composeDateTimeCore("date", element.getDateElement(), false);
47606        composeDateTimeExtras("date", element.getDateElement(), false);
47607      }
47608      if (element.hasPublisherElement()) {
47609        composeStringCore("publisher", element.getPublisherElement(), false);
47610        composeStringExtras("publisher", element.getPublisherElement(), false);
47611      }
47612      if (element.hasContact()) {
47613        openArray("contact");
47614        for (ContactDetail e : element.getContact()) 
47615          composeContactDetail(null, e);
47616        closeArray();
47617      };
47618      if (element.hasDescriptionElement()) {
47619        composeMarkdownCore("description", element.getDescriptionElement(), false);
47620        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47621      }
47622      if (element.hasUseContext()) {
47623        openArray("useContext");
47624        for (UsageContext e : element.getUseContext()) 
47625          composeUsageContext(null, e);
47626        closeArray();
47627      };
47628      if (element.hasJurisdiction()) {
47629        openArray("jurisdiction");
47630        for (CodeableConcept e : element.getJurisdiction()) 
47631          composeCodeableConcept(null, e);
47632        closeArray();
47633      };
47634      if (element.hasPurposeElement()) {
47635        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47636        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47637      }
47638      if (element.hasUsageElement()) {
47639        composeStringCore("usage", element.getUsageElement(), false);
47640        composeStringExtras("usage", element.getUsageElement(), false);
47641      }
47642      if (element.hasCopyrightElement()) {
47643        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47644        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47645      }
47646      if (element.hasApprovalDateElement()) {
47647        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
47648        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
47649      }
47650      if (element.hasLastReviewDateElement()) {
47651        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
47652        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
47653      }
47654      if (element.hasEffectivePeriod()) {
47655        composePeriod("effectivePeriod", element.getEffectivePeriod());
47656      }
47657      if (element.hasTopic()) {
47658        openArray("topic");
47659        for (CodeableConcept e : element.getTopic()) 
47660          composeCodeableConcept(null, e);
47661        closeArray();
47662      };
47663      if (element.hasAuthor()) {
47664        openArray("author");
47665        for (ContactDetail e : element.getAuthor()) 
47666          composeContactDetail(null, e);
47667        closeArray();
47668      };
47669      if (element.hasEditor()) {
47670        openArray("editor");
47671        for (ContactDetail e : element.getEditor()) 
47672          composeContactDetail(null, e);
47673        closeArray();
47674      };
47675      if (element.hasReviewer()) {
47676        openArray("reviewer");
47677        for (ContactDetail e : element.getReviewer()) 
47678          composeContactDetail(null, e);
47679        closeArray();
47680      };
47681      if (element.hasEndorser()) {
47682        openArray("endorser");
47683        for (ContactDetail e : element.getEndorser()) 
47684          composeContactDetail(null, e);
47685        closeArray();
47686      };
47687      if (element.hasRelatedArtifact()) {
47688        openArray("relatedArtifact");
47689        for (RelatedArtifact e : element.getRelatedArtifact()) 
47690          composeRelatedArtifact(null, e);
47691        closeArray();
47692      };
47693      if (element.hasParameter()) {
47694        openArray("parameter");
47695        for (ParameterDefinition e : element.getParameter()) 
47696          composeParameterDefinition(null, e);
47697        closeArray();
47698      };
47699      if (element.hasDataRequirement()) {
47700        openArray("dataRequirement");
47701        for (DataRequirement e : element.getDataRequirement()) 
47702          composeDataRequirement(null, e);
47703        closeArray();
47704      };
47705      if (element.hasContent()) {
47706        openArray("content");
47707        for (Attachment e : element.getContent()) 
47708          composeAttachment(null, e);
47709        closeArray();
47710      };
47711  }
47712
47713  protected void composeLinkage(String name, Linkage element) throws IOException {
47714    if (element != null) {
47715      prop("resourceType", name);
47716      composeLinkageProperties(element);
47717    }
47718  }
47719
47720  protected void composeLinkageProperties(Linkage element) throws IOException {
47721    composeDomainResourceProperties(element);
47722      if (element.hasActiveElement()) {
47723        composeBooleanCore("active", element.getActiveElement(), false);
47724        composeBooleanExtras("active", element.getActiveElement(), false);
47725      }
47726      if (element.hasAuthor()) {
47727        composeReference("author", element.getAuthor());
47728      }
47729      if (element.hasItem()) {
47730        openArray("item");
47731        for (Linkage.LinkageItemComponent e : element.getItem()) 
47732          composeLinkageItemComponent(null, e);
47733        closeArray();
47734      };
47735  }
47736
47737  protected void composeLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
47738    if (element != null) {
47739      open(name);
47740      composeLinkageItemComponentProperties(element);
47741      close();
47742    }
47743  }
47744
47745  protected void composeLinkageItemComponentProperties(Linkage.LinkageItemComponent element) throws IOException {
47746    composeBackboneElementProperties(element);
47747      if (element.hasTypeElement()) {
47748        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
47749        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
47750      }
47751      if (element.hasResource()) {
47752        composeReference("resource", element.getResource());
47753      }
47754  }
47755
47756  protected void composeListResource(String name, ListResource element) throws IOException {
47757    if (element != null) {
47758      prop("resourceType", name);
47759      composeListResourceProperties(element);
47760    }
47761  }
47762
47763  protected void composeListResourceProperties(ListResource element) throws IOException {
47764    composeDomainResourceProperties(element);
47765      if (element.hasIdentifier()) {
47766        openArray("identifier");
47767        for (Identifier e : element.getIdentifier()) 
47768          composeIdentifier(null, e);
47769        closeArray();
47770      };
47771      if (element.hasStatusElement()) {
47772        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
47773        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
47774      }
47775      if (element.hasModeElement()) {
47776        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
47777        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
47778      }
47779      if (element.hasTitleElement()) {
47780        composeStringCore("title", element.getTitleElement(), false);
47781        composeStringExtras("title", element.getTitleElement(), false);
47782      }
47783      if (element.hasCode()) {
47784        composeCodeableConcept("code", element.getCode());
47785      }
47786      if (element.hasSubject()) {
47787        composeReference("subject", element.getSubject());
47788      }
47789      if (element.hasEncounter()) {
47790        composeReference("encounter", element.getEncounter());
47791      }
47792      if (element.hasDateElement()) {
47793        composeDateTimeCore("date", element.getDateElement(), false);
47794        composeDateTimeExtras("date", element.getDateElement(), false);
47795      }
47796      if (element.hasSource()) {
47797        composeReference("source", element.getSource());
47798      }
47799      if (element.hasOrderedBy()) {
47800        composeCodeableConcept("orderedBy", element.getOrderedBy());
47801      }
47802      if (element.hasNote()) {
47803        openArray("note");
47804        for (Annotation e : element.getNote()) 
47805          composeAnnotation(null, e);
47806        closeArray();
47807      };
47808      if (element.hasEntry()) {
47809        openArray("entry");
47810        for (ListResource.ListResourceEntryComponent e : element.getEntry()) 
47811          composeListResourceEntryComponent(null, e);
47812        closeArray();
47813      };
47814      if (element.hasEmptyReason()) {
47815        composeCodeableConcept("emptyReason", element.getEmptyReason());
47816      }
47817  }
47818
47819  protected void composeListResourceEntryComponent(String name, ListResource.ListResourceEntryComponent element) throws IOException {
47820    if (element != null) {
47821      open(name);
47822      composeListResourceEntryComponentProperties(element);
47823      close();
47824    }
47825  }
47826
47827  protected void composeListResourceEntryComponentProperties(ListResource.ListResourceEntryComponent element) throws IOException {
47828    composeBackboneElementProperties(element);
47829      if (element.hasFlag()) {
47830        composeCodeableConcept("flag", element.getFlag());
47831      }
47832      if (element.hasDeletedElement()) {
47833        composeBooleanCore("deleted", element.getDeletedElement(), false);
47834        composeBooleanExtras("deleted", element.getDeletedElement(), false);
47835      }
47836      if (element.hasDateElement()) {
47837        composeDateTimeCore("date", element.getDateElement(), false);
47838        composeDateTimeExtras("date", element.getDateElement(), false);
47839      }
47840      if (element.hasItem()) {
47841        composeReference("item", element.getItem());
47842      }
47843  }
47844
47845  protected void composeLocation(String name, Location element) throws IOException {
47846    if (element != null) {
47847      prop("resourceType", name);
47848      composeLocationProperties(element);
47849    }
47850  }
47851
47852  protected void composeLocationProperties(Location element) throws IOException {
47853    composeDomainResourceProperties(element);
47854      if (element.hasIdentifier()) {
47855        openArray("identifier");
47856        for (Identifier e : element.getIdentifier()) 
47857          composeIdentifier(null, e);
47858        closeArray();
47859      };
47860      if (element.hasStatusElement()) {
47861        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
47862        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
47863      }
47864      if (element.hasOperationalStatus()) {
47865        composeCoding("operationalStatus", element.getOperationalStatus());
47866      }
47867      if (element.hasNameElement()) {
47868        composeStringCore("name", element.getNameElement(), false);
47869        composeStringExtras("name", element.getNameElement(), false);
47870      }
47871      if (element.hasAlias()) {
47872        if (anyHasValue(element.getAlias())) {
47873          openArray("alias");
47874          for (StringType e : element.getAlias()) 
47875            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
47876          closeArray();
47877        }
47878        if (anyHasExtras(element.getAlias())) {
47879          openArray("_alias");
47880          for (StringType e : element.getAlias()) 
47881            composeStringExtras(null, e, true);
47882          closeArray();
47883        }
47884      };
47885      if (element.hasDescriptionElement()) {
47886        composeStringCore("description", element.getDescriptionElement(), false);
47887        composeStringExtras("description", element.getDescriptionElement(), false);
47888      }
47889      if (element.hasModeElement()) {
47890        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
47891        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
47892      }
47893      if (element.hasType()) {
47894        openArray("type");
47895        for (CodeableConcept e : element.getType()) 
47896          composeCodeableConcept(null, e);
47897        closeArray();
47898      };
47899      if (element.hasTelecom()) {
47900        openArray("telecom");
47901        for (ContactPoint e : element.getTelecom()) 
47902          composeContactPoint(null, e);
47903        closeArray();
47904      };
47905      if (element.hasAddress()) {
47906        composeAddress("address", element.getAddress());
47907      }
47908      if (element.hasPhysicalType()) {
47909        composeCodeableConcept("physicalType", element.getPhysicalType());
47910      }
47911      if (element.hasPosition()) {
47912        composeLocationPositionComponent("position", element.getPosition());
47913      }
47914      if (element.hasManagingOrganization()) {
47915        composeReference("managingOrganization", element.getManagingOrganization());
47916      }
47917      if (element.hasPartOf()) {
47918        composeReference("partOf", element.getPartOf());
47919      }
47920      if (element.hasHoursOfOperation()) {
47921        openArray("hoursOfOperation");
47922        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
47923          composeLocationHoursOfOperationComponent(null, e);
47924        closeArray();
47925      };
47926      if (element.hasAvailabilityExceptionsElement()) {
47927        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
47928        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
47929      }
47930      if (element.hasEndpoint()) {
47931        openArray("endpoint");
47932        for (Reference e : element.getEndpoint()) 
47933          composeReference(null, e);
47934        closeArray();
47935      };
47936  }
47937
47938  protected void composeLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
47939    if (element != null) {
47940      open(name);
47941      composeLocationPositionComponentProperties(element);
47942      close();
47943    }
47944  }
47945
47946  protected void composeLocationPositionComponentProperties(Location.LocationPositionComponent element) throws IOException {
47947    composeBackboneElementProperties(element);
47948      if (element.hasLongitudeElement()) {
47949        composeDecimalCore("longitude", element.getLongitudeElement(), false);
47950        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
47951      }
47952      if (element.hasLatitudeElement()) {
47953        composeDecimalCore("latitude", element.getLatitudeElement(), false);
47954        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
47955      }
47956      if (element.hasAltitudeElement()) {
47957        composeDecimalCore("altitude", element.getAltitudeElement(), false);
47958        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
47959      }
47960  }
47961
47962  protected void composeLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
47963    if (element != null) {
47964      open(name);
47965      composeLocationHoursOfOperationComponentProperties(element);
47966      close();
47967    }
47968  }
47969
47970  protected void composeLocationHoursOfOperationComponentProperties(Location.LocationHoursOfOperationComponent element) throws IOException {
47971    composeBackboneElementProperties(element);
47972      if (element.hasDaysOfWeek()) {
47973        openArray("daysOfWeek");
47974        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
47975          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
47976        closeArray();
47977        if (anyHasExtras(element.getDaysOfWeek())) {
47978          openArray("_daysOfWeek");
47979          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
47980            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
47981          closeArray();
47982        }
47983      };
47984      if (element.hasAllDayElement()) {
47985        composeBooleanCore("allDay", element.getAllDayElement(), false);
47986        composeBooleanExtras("allDay", element.getAllDayElement(), false);
47987      }
47988      if (element.hasOpeningTimeElement()) {
47989        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
47990        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
47991      }
47992      if (element.hasClosingTimeElement()) {
47993        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
47994        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
47995      }
47996  }
47997
47998  protected void composeManufacturedItemDefinition(String name, ManufacturedItemDefinition element) throws IOException {
47999    if (element != null) {
48000      prop("resourceType", name);
48001      composeManufacturedItemDefinitionProperties(element);
48002    }
48003  }
48004
48005  protected void composeManufacturedItemDefinitionProperties(ManufacturedItemDefinition element) throws IOException {
48006    composeDomainResourceProperties(element);
48007      if (element.hasIdentifier()) {
48008        openArray("identifier");
48009        for (Identifier e : element.getIdentifier()) 
48010          composeIdentifier(null, e);
48011        closeArray();
48012      };
48013      if (element.hasStatusElement()) {
48014        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48015        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48016      }
48017      if (element.hasManufacturedDoseForm()) {
48018        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
48019      }
48020      if (element.hasUnitOfPresentation()) {
48021        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
48022      }
48023      if (element.hasManufacturer()) {
48024        openArray("manufacturer");
48025        for (Reference e : element.getManufacturer()) 
48026          composeReference(null, e);
48027        closeArray();
48028      };
48029      if (element.hasIngredient()) {
48030        openArray("ingredient");
48031        for (CodeableConcept e : element.getIngredient()) 
48032          composeCodeableConcept(null, e);
48033        closeArray();
48034      };
48035      if (element.hasProperty()) {
48036        openArray("property");
48037        for (ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent e : element.getProperty()) 
48038          composeManufacturedItemDefinitionPropertyComponent(null, e);
48039        closeArray();
48040      };
48041  }
48042
48043  protected void composeManufacturedItemDefinitionPropertyComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
48044    if (element != null) {
48045      open(name);
48046      composeManufacturedItemDefinitionPropertyComponentProperties(element);
48047      close();
48048    }
48049  }
48050
48051  protected void composeManufacturedItemDefinitionPropertyComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
48052    composeBackboneElementProperties(element);
48053      if (element.hasType()) {
48054        composeCodeableConcept("type", element.getType());
48055      }
48056      if (element.hasValue()) {
48057        composeType("value", element.getValue());
48058      }
48059  }
48060
48061  protected void composeMeasure(String name, Measure element) throws IOException {
48062    if (element != null) {
48063      prop("resourceType", name);
48064      composeMeasureProperties(element);
48065    }
48066  }
48067
48068  protected void composeMeasureProperties(Measure element) throws IOException {
48069    composeDomainResourceProperties(element);
48070      if (element.hasUrlElement()) {
48071        composeUriCore("url", element.getUrlElement(), false);
48072        composeUriExtras("url", element.getUrlElement(), false);
48073      }
48074      if (element.hasIdentifier()) {
48075        openArray("identifier");
48076        for (Identifier e : element.getIdentifier()) 
48077          composeIdentifier(null, e);
48078        closeArray();
48079      };
48080      if (element.hasVersionElement()) {
48081        composeStringCore("version", element.getVersionElement(), false);
48082        composeStringExtras("version", element.getVersionElement(), false);
48083      }
48084      if (element.hasNameElement()) {
48085        composeStringCore("name", element.getNameElement(), false);
48086        composeStringExtras("name", element.getNameElement(), false);
48087      }
48088      if (element.hasTitleElement()) {
48089        composeStringCore("title", element.getTitleElement(), false);
48090        composeStringExtras("title", element.getTitleElement(), false);
48091      }
48092      if (element.hasSubtitleElement()) {
48093        composeStringCore("subtitle", element.getSubtitleElement(), false);
48094        composeStringExtras("subtitle", element.getSubtitleElement(), false);
48095      }
48096      if (element.hasStatusElement()) {
48097        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48098        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48099      }
48100      if (element.hasExperimentalElement()) {
48101        composeBooleanCore("experimental", element.getExperimentalElement(), false);
48102        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
48103      }
48104      if (element.hasSubject()) {
48105        composeType("subject", element.getSubject());
48106      }
48107      if (element.hasDateElement()) {
48108        composeDateTimeCore("date", element.getDateElement(), false);
48109        composeDateTimeExtras("date", element.getDateElement(), false);
48110      }
48111      if (element.hasPublisherElement()) {
48112        composeStringCore("publisher", element.getPublisherElement(), false);
48113        composeStringExtras("publisher", element.getPublisherElement(), false);
48114      }
48115      if (element.hasContact()) {
48116        openArray("contact");
48117        for (ContactDetail e : element.getContact()) 
48118          composeContactDetail(null, e);
48119        closeArray();
48120      };
48121      if (element.hasDescriptionElement()) {
48122        composeMarkdownCore("description", element.getDescriptionElement(), false);
48123        composeMarkdownExtras("description", element.getDescriptionElement(), false);
48124      }
48125      if (element.hasUseContext()) {
48126        openArray("useContext");
48127        for (UsageContext e : element.getUseContext()) 
48128          composeUsageContext(null, e);
48129        closeArray();
48130      };
48131      if (element.hasJurisdiction()) {
48132        openArray("jurisdiction");
48133        for (CodeableConcept e : element.getJurisdiction()) 
48134          composeCodeableConcept(null, e);
48135        closeArray();
48136      };
48137      if (element.hasPurposeElement()) {
48138        composeMarkdownCore("purpose", element.getPurposeElement(), false);
48139        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
48140      }
48141      if (element.hasUsageElement()) {
48142        composeStringCore("usage", element.getUsageElement(), false);
48143        composeStringExtras("usage", element.getUsageElement(), false);
48144      }
48145      if (element.hasCopyrightElement()) {
48146        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
48147        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
48148      }
48149      if (element.hasApprovalDateElement()) {
48150        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
48151        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
48152      }
48153      if (element.hasLastReviewDateElement()) {
48154        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
48155        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
48156      }
48157      if (element.hasEffectivePeriod()) {
48158        composePeriod("effectivePeriod", element.getEffectivePeriod());
48159      }
48160      if (element.hasTopic()) {
48161        openArray("topic");
48162        for (CodeableConcept e : element.getTopic()) 
48163          composeCodeableConcept(null, e);
48164        closeArray();
48165      };
48166      if (element.hasAuthor()) {
48167        openArray("author");
48168        for (ContactDetail e : element.getAuthor()) 
48169          composeContactDetail(null, e);
48170        closeArray();
48171      };
48172      if (element.hasEditor()) {
48173        openArray("editor");
48174        for (ContactDetail e : element.getEditor()) 
48175          composeContactDetail(null, e);
48176        closeArray();
48177      };
48178      if (element.hasReviewer()) {
48179        openArray("reviewer");
48180        for (ContactDetail e : element.getReviewer()) 
48181          composeContactDetail(null, e);
48182        closeArray();
48183      };
48184      if (element.hasEndorser()) {
48185        openArray("endorser");
48186        for (ContactDetail e : element.getEndorser()) 
48187          composeContactDetail(null, e);
48188        closeArray();
48189      };
48190      if (element.hasRelatedArtifact()) {
48191        openArray("relatedArtifact");
48192        for (RelatedArtifact e : element.getRelatedArtifact()) 
48193          composeRelatedArtifact(null, e);
48194        closeArray();
48195      };
48196      if (element.hasLibrary()) {
48197        if (anyHasValue(element.getLibrary())) {
48198          openArray("library");
48199          for (CanonicalType e : element.getLibrary()) 
48200            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
48201          closeArray();
48202        }
48203        if (anyHasExtras(element.getLibrary())) {
48204          openArray("_library");
48205          for (CanonicalType e : element.getLibrary()) 
48206            composeCanonicalExtras(null, e, true);
48207          closeArray();
48208        }
48209      };
48210      if (element.hasDisclaimerElement()) {
48211        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
48212        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
48213      }
48214      if (element.hasScoring()) {
48215        composeCodeableConcept("scoring", element.getScoring());
48216      }
48217      if (element.hasCompositeScoring()) {
48218        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
48219      }
48220      if (element.hasType()) {
48221        openArray("type");
48222        for (CodeableConcept e : element.getType()) 
48223          composeCodeableConcept(null, e);
48224        closeArray();
48225      };
48226      if (element.hasRiskAdjustmentElement()) {
48227        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
48228        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
48229      }
48230      if (element.hasRateAggregationElement()) {
48231        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
48232        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
48233      }
48234      if (element.hasRationaleElement()) {
48235        composeMarkdownCore("rationale", element.getRationaleElement(), false);
48236        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
48237      }
48238      if (element.hasClinicalRecommendationStatementElement()) {
48239        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
48240        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
48241      }
48242      if (element.hasImprovementNotation()) {
48243        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
48244      }
48245      if (element.hasDefinition()) {
48246        if (anyHasValue(element.getDefinition())) {
48247          openArray("definition");
48248          for (MarkdownType e : element.getDefinition()) 
48249            composeMarkdownCore(null, e, e != element.getDefinition().get(element.getDefinition().size()-1));
48250          closeArray();
48251        }
48252        if (anyHasExtras(element.getDefinition())) {
48253          openArray("_definition");
48254          for (MarkdownType e : element.getDefinition()) 
48255            composeMarkdownExtras(null, e, true);
48256          closeArray();
48257        }
48258      };
48259      if (element.hasGuidanceElement()) {
48260        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
48261        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
48262      }
48263      if (element.hasGroup()) {
48264        openArray("group");
48265        for (Measure.MeasureGroupComponent e : element.getGroup()) 
48266          composeMeasureGroupComponent(null, e);
48267        closeArray();
48268      };
48269      if (element.hasSupplementalData()) {
48270        openArray("supplementalData");
48271        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
48272          composeMeasureSupplementalDataComponent(null, e);
48273        closeArray();
48274      };
48275  }
48276
48277  protected void composeMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
48278    if (element != null) {
48279      open(name);
48280      composeMeasureGroupComponentProperties(element);
48281      close();
48282    }
48283  }
48284
48285  protected void composeMeasureGroupComponentProperties(Measure.MeasureGroupComponent element) throws IOException {
48286    composeBackboneElementProperties(element);
48287      if (element.hasCode()) {
48288        composeCodeableConcept("code", element.getCode());
48289      }
48290      if (element.hasDescriptionElement()) {
48291        composeStringCore("description", element.getDescriptionElement(), false);
48292        composeStringExtras("description", element.getDescriptionElement(), false);
48293      }
48294      if (element.hasPopulation()) {
48295        openArray("population");
48296        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
48297          composeMeasureGroupPopulationComponent(null, e);
48298        closeArray();
48299      };
48300      if (element.hasStratifier()) {
48301        openArray("stratifier");
48302        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
48303          composeMeasureGroupStratifierComponent(null, e);
48304        closeArray();
48305      };
48306  }
48307
48308  protected void composeMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
48309    if (element != null) {
48310      open(name);
48311      composeMeasureGroupPopulationComponentProperties(element);
48312      close();
48313    }
48314  }
48315
48316  protected void composeMeasureGroupPopulationComponentProperties(Measure.MeasureGroupPopulationComponent element) throws IOException {
48317    composeBackboneElementProperties(element);
48318      if (element.hasCode()) {
48319        composeCodeableConcept("code", element.getCode());
48320      }
48321      if (element.hasDescriptionElement()) {
48322        composeStringCore("description", element.getDescriptionElement(), false);
48323        composeStringExtras("description", element.getDescriptionElement(), false);
48324      }
48325      if (element.hasCriteria()) {
48326        composeExpression("criteria", element.getCriteria());
48327      }
48328  }
48329
48330  protected void composeMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
48331    if (element != null) {
48332      open(name);
48333      composeMeasureGroupStratifierComponentProperties(element);
48334      close();
48335    }
48336  }
48337
48338  protected void composeMeasureGroupStratifierComponentProperties(Measure.MeasureGroupStratifierComponent element) throws IOException {
48339    composeBackboneElementProperties(element);
48340      if (element.hasCode()) {
48341        composeCodeableConcept("code", element.getCode());
48342      }
48343      if (element.hasDescriptionElement()) {
48344        composeStringCore("description", element.getDescriptionElement(), false);
48345        composeStringExtras("description", element.getDescriptionElement(), false);
48346      }
48347      if (element.hasCriteria()) {
48348        composeExpression("criteria", element.getCriteria());
48349      }
48350      if (element.hasComponent()) {
48351        openArray("component");
48352        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
48353          composeMeasureGroupStratifierComponentComponent(null, e);
48354        closeArray();
48355      };
48356  }
48357
48358  protected void composeMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
48359    if (element != null) {
48360      open(name);
48361      composeMeasureGroupStratifierComponentComponentProperties(element);
48362      close();
48363    }
48364  }
48365
48366  protected void composeMeasureGroupStratifierComponentComponentProperties(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
48367    composeBackboneElementProperties(element);
48368      if (element.hasCode()) {
48369        composeCodeableConcept("code", element.getCode());
48370      }
48371      if (element.hasDescriptionElement()) {
48372        composeStringCore("description", element.getDescriptionElement(), false);
48373        composeStringExtras("description", element.getDescriptionElement(), false);
48374      }
48375      if (element.hasCriteria()) {
48376        composeExpression("criteria", element.getCriteria());
48377      }
48378  }
48379
48380  protected void composeMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
48381    if (element != null) {
48382      open(name);
48383      composeMeasureSupplementalDataComponentProperties(element);
48384      close();
48385    }
48386  }
48387
48388  protected void composeMeasureSupplementalDataComponentProperties(Measure.MeasureSupplementalDataComponent element) throws IOException {
48389    composeBackboneElementProperties(element);
48390      if (element.hasCode()) {
48391        composeCodeableConcept("code", element.getCode());
48392      }
48393      if (element.hasUsage()) {
48394        openArray("usage");
48395        for (CodeableConcept e : element.getUsage()) 
48396          composeCodeableConcept(null, e);
48397        closeArray();
48398      };
48399      if (element.hasDescriptionElement()) {
48400        composeStringCore("description", element.getDescriptionElement(), false);
48401        composeStringExtras("description", element.getDescriptionElement(), false);
48402      }
48403      if (element.hasCriteria()) {
48404        composeExpression("criteria", element.getCriteria());
48405      }
48406  }
48407
48408  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
48409    if (element != null) {
48410      prop("resourceType", name);
48411      composeMeasureReportProperties(element);
48412    }
48413  }
48414
48415  protected void composeMeasureReportProperties(MeasureReport element) throws IOException {
48416    composeDomainResourceProperties(element);
48417      if (element.hasIdentifier()) {
48418        openArray("identifier");
48419        for (Identifier e : element.getIdentifier()) 
48420          composeIdentifier(null, e);
48421        closeArray();
48422      };
48423      if (element.hasStatusElement()) {
48424        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
48425        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
48426      }
48427      if (element.hasTypeElement()) {
48428        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
48429        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
48430      }
48431      if (element.hasMeasureElement()) {
48432        composeCanonicalCore("measure", element.getMeasureElement(), false);
48433        composeCanonicalExtras("measure", element.getMeasureElement(), false);
48434      }
48435      if (element.hasSubject()) {
48436        composeReference("subject", element.getSubject());
48437      }
48438      if (element.hasDateElement()) {
48439        composeDateTimeCore("date", element.getDateElement(), false);
48440        composeDateTimeExtras("date", element.getDateElement(), false);
48441      }
48442      if (element.hasReporter()) {
48443        composeReference("reporter", element.getReporter());
48444      }
48445      if (element.hasPeriod()) {
48446        composePeriod("period", element.getPeriod());
48447      }
48448      if (element.hasImprovementNotation()) {
48449        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
48450      }
48451      if (element.hasGroup()) {
48452        openArray("group");
48453        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
48454          composeMeasureReportGroupComponent(null, e);
48455        closeArray();
48456      };
48457      if (element.hasEvaluatedResource()) {
48458        openArray("evaluatedResource");
48459        for (Reference e : element.getEvaluatedResource()) 
48460          composeReference(null, e);
48461        closeArray();
48462      };
48463  }
48464
48465  protected void composeMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
48466    if (element != null) {
48467      open(name);
48468      composeMeasureReportGroupComponentProperties(element);
48469      close();
48470    }
48471  }
48472
48473  protected void composeMeasureReportGroupComponentProperties(MeasureReport.MeasureReportGroupComponent element) throws IOException {
48474    composeBackboneElementProperties(element);
48475      if (element.hasCode()) {
48476        composeCodeableConcept("code", element.getCode());
48477      }
48478      if (element.hasPopulation()) {
48479        openArray("population");
48480        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
48481          composeMeasureReportGroupPopulationComponent(null, e);
48482        closeArray();
48483      };
48484      if (element.hasMeasureScore()) {
48485        composeQuantity("measureScore", element.getMeasureScore());
48486      }
48487      if (element.hasStratifier()) {
48488        openArray("stratifier");
48489        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
48490          composeMeasureReportGroupStratifierComponent(null, e);
48491        closeArray();
48492      };
48493  }
48494
48495  protected void composeMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
48496    if (element != null) {
48497      open(name);
48498      composeMeasureReportGroupPopulationComponentProperties(element);
48499      close();
48500    }
48501  }
48502
48503  protected void composeMeasureReportGroupPopulationComponentProperties(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
48504    composeBackboneElementProperties(element);
48505      if (element.hasCode()) {
48506        composeCodeableConcept("code", element.getCode());
48507      }
48508      if (element.hasCountElement()) {
48509        composeIntegerCore("count", element.getCountElement(), false);
48510        composeIntegerExtras("count", element.getCountElement(), false);
48511      }
48512      if (element.hasSubjectResults()) {
48513        composeReference("subjectResults", element.getSubjectResults());
48514      }
48515  }
48516
48517  protected void composeMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
48518    if (element != null) {
48519      open(name);
48520      composeMeasureReportGroupStratifierComponentProperties(element);
48521      close();
48522    }
48523  }
48524
48525  protected void composeMeasureReportGroupStratifierComponentProperties(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
48526    composeBackboneElementProperties(element);
48527      if (element.hasCode()) {
48528        openArray("code");
48529        for (CodeableConcept e : element.getCode()) 
48530          composeCodeableConcept(null, e);
48531        closeArray();
48532      };
48533      if (element.hasStratum()) {
48534        openArray("stratum");
48535        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
48536          composeStratifierGroupComponent(null, e);
48537        closeArray();
48538      };
48539  }
48540
48541  protected void composeStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
48542    if (element != null) {
48543      open(name);
48544      composeStratifierGroupComponentProperties(element);
48545      close();
48546    }
48547  }
48548
48549  protected void composeStratifierGroupComponentProperties(MeasureReport.StratifierGroupComponent element) throws IOException {
48550    composeBackboneElementProperties(element);
48551      if (element.hasValue()) {
48552        composeCodeableConcept("value", element.getValue());
48553      }
48554      if (element.hasComponent()) {
48555        openArray("component");
48556        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
48557          composeStratifierGroupComponentComponent(null, e);
48558        closeArray();
48559      };
48560      if (element.hasPopulation()) {
48561        openArray("population");
48562        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
48563          composeStratifierGroupPopulationComponent(null, e);
48564        closeArray();
48565      };
48566      if (element.hasMeasureScore()) {
48567        composeQuantity("measureScore", element.getMeasureScore());
48568      }
48569  }
48570
48571  protected void composeStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
48572    if (element != null) {
48573      open(name);
48574      composeStratifierGroupComponentComponentProperties(element);
48575      close();
48576    }
48577  }
48578
48579  protected void composeStratifierGroupComponentComponentProperties(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
48580    composeBackboneElementProperties(element);
48581      if (element.hasCode()) {
48582        composeCodeableConcept("code", element.getCode());
48583      }
48584      if (element.hasValue()) {
48585        composeCodeableConcept("value", element.getValue());
48586      }
48587  }
48588
48589  protected void composeStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
48590    if (element != null) {
48591      open(name);
48592      composeStratifierGroupPopulationComponentProperties(element);
48593      close();
48594    }
48595  }
48596
48597  protected void composeStratifierGroupPopulationComponentProperties(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
48598    composeBackboneElementProperties(element);
48599      if (element.hasCode()) {
48600        composeCodeableConcept("code", element.getCode());
48601      }
48602      if (element.hasCountElement()) {
48603        composeIntegerCore("count", element.getCountElement(), false);
48604        composeIntegerExtras("count", element.getCountElement(), false);
48605      }
48606      if (element.hasSubjectResults()) {
48607        composeReference("subjectResults", element.getSubjectResults());
48608      }
48609  }
48610
48611  protected void composeMedia(String name, Media element) throws IOException {
48612    if (element != null) {
48613      prop("resourceType", name);
48614      composeMediaProperties(element);
48615    }
48616  }
48617
48618  protected void composeMediaProperties(Media element) throws IOException {
48619    composeDomainResourceProperties(element);
48620      if (element.hasIdentifier()) {
48621        openArray("identifier");
48622        for (Identifier e : element.getIdentifier()) 
48623          composeIdentifier(null, e);
48624        closeArray();
48625      };
48626      if (element.hasBasedOn()) {
48627        openArray("basedOn");
48628        for (Reference e : element.getBasedOn()) 
48629          composeReference(null, e);
48630        closeArray();
48631      };
48632      if (element.hasPartOf()) {
48633        openArray("partOf");
48634        for (Reference e : element.getPartOf()) 
48635          composeReference(null, e);
48636        closeArray();
48637      };
48638      if (element.hasStatusElement()) {
48639        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
48640        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
48641      }
48642      if (element.hasType()) {
48643        composeCodeableConcept("type", element.getType());
48644      }
48645      if (element.hasModality()) {
48646        composeCodeableConcept("modality", element.getModality());
48647      }
48648      if (element.hasView()) {
48649        composeCodeableConcept("view", element.getView());
48650      }
48651      if (element.hasSubject()) {
48652        composeReference("subject", element.getSubject());
48653      }
48654      if (element.hasEncounter()) {
48655        composeReference("encounter", element.getEncounter());
48656      }
48657      if (element.hasCreated()) {
48658        composeType("created", element.getCreated());
48659      }
48660      if (element.hasIssuedElement()) {
48661        composeInstantCore("issued", element.getIssuedElement(), false);
48662        composeInstantExtras("issued", element.getIssuedElement(), false);
48663      }
48664      if (element.hasOperator()) {
48665        composeReference("operator", element.getOperator());
48666      }
48667      if (element.hasReasonCode()) {
48668        openArray("reasonCode");
48669        for (CodeableConcept e : element.getReasonCode()) 
48670          composeCodeableConcept(null, e);
48671        closeArray();
48672      };
48673      if (element.hasBodySite()) {
48674        composeCodeableConcept("bodySite", element.getBodySite());
48675      }
48676      if (element.hasDeviceNameElement()) {
48677        composeStringCore("deviceName", element.getDeviceNameElement(), false);
48678        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
48679      }
48680      if (element.hasDevice()) {
48681        composeReference("device", element.getDevice());
48682      }
48683      if (element.hasHeightElement()) {
48684        composePositiveIntCore("height", element.getHeightElement(), false);
48685        composePositiveIntExtras("height", element.getHeightElement(), false);
48686      }
48687      if (element.hasWidthElement()) {
48688        composePositiveIntCore("width", element.getWidthElement(), false);
48689        composePositiveIntExtras("width", element.getWidthElement(), false);
48690      }
48691      if (element.hasFramesElement()) {
48692        composePositiveIntCore("frames", element.getFramesElement(), false);
48693        composePositiveIntExtras("frames", element.getFramesElement(), false);
48694      }
48695      if (element.hasDurationElement()) {
48696        composeDecimalCore("duration", element.getDurationElement(), false);
48697        composeDecimalExtras("duration", element.getDurationElement(), false);
48698      }
48699      if (element.hasContent()) {
48700        composeAttachment("content", element.getContent());
48701      }
48702      if (element.hasNote()) {
48703        openArray("note");
48704        for (Annotation e : element.getNote()) 
48705          composeAnnotation(null, e);
48706        closeArray();
48707      };
48708  }
48709
48710  protected void composeMedication(String name, Medication element) throws IOException {
48711    if (element != null) {
48712      prop("resourceType", name);
48713      composeMedicationProperties(element);
48714    }
48715  }
48716
48717  protected void composeMedicationProperties(Medication element) throws IOException {
48718    composeDomainResourceProperties(element);
48719      if (element.hasIdentifier()) {
48720        openArray("identifier");
48721        for (Identifier e : element.getIdentifier()) 
48722          composeIdentifier(null, e);
48723        closeArray();
48724      };
48725      if (element.hasCode()) {
48726        composeCodeableConcept("code", element.getCode());
48727      }
48728      if (element.hasStatusElement()) {
48729        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
48730        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
48731      }
48732      if (element.hasManufacturer()) {
48733        composeReference("manufacturer", element.getManufacturer());
48734      }
48735      if (element.hasForm()) {
48736        composeCodeableConcept("form", element.getForm());
48737      }
48738      if (element.hasAmount()) {
48739        composeRatio("amount", element.getAmount());
48740      }
48741      if (element.hasIngredient()) {
48742        openArray("ingredient");
48743        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
48744          composeMedicationIngredientComponent(null, e);
48745        closeArray();
48746      };
48747      if (element.hasBatch()) {
48748        composeMedicationBatchComponent("batch", element.getBatch());
48749      }
48750  }
48751
48752  protected void composeMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
48753    if (element != null) {
48754      open(name);
48755      composeMedicationIngredientComponentProperties(element);
48756      close();
48757    }
48758  }
48759
48760  protected void composeMedicationIngredientComponentProperties(Medication.MedicationIngredientComponent element) throws IOException {
48761    composeBackboneElementProperties(element);
48762      if (element.hasItem()) {
48763        composeType("item", element.getItem());
48764      }
48765      if (element.hasIsActiveElement()) {
48766        composeBooleanCore("isActive", element.getIsActiveElement(), false);
48767        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
48768      }
48769      if (element.hasStrength()) {
48770        composeRatio("strength", element.getStrength());
48771      }
48772  }
48773
48774  protected void composeMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
48775    if (element != null) {
48776      open(name);
48777      composeMedicationBatchComponentProperties(element);
48778      close();
48779    }
48780  }
48781
48782  protected void composeMedicationBatchComponentProperties(Medication.MedicationBatchComponent element) throws IOException {
48783    composeBackboneElementProperties(element);
48784      if (element.hasLotNumberElement()) {
48785        composeStringCore("lotNumber", element.getLotNumberElement(), false);
48786        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
48787      }
48788      if (element.hasExpirationDateElement()) {
48789        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
48790        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
48791      }
48792  }
48793
48794  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
48795    if (element != null) {
48796      prop("resourceType", name);
48797      composeMedicationAdministrationProperties(element);
48798    }
48799  }
48800
48801  protected void composeMedicationAdministrationProperties(MedicationAdministration element) throws IOException {
48802    composeDomainResourceProperties(element);
48803      if (element.hasIdentifier()) {
48804        openArray("identifier");
48805        for (Identifier e : element.getIdentifier()) 
48806          composeIdentifier(null, e);
48807        closeArray();
48808      };
48809      if (element.hasInstantiates()) {
48810        if (anyHasValue(element.getInstantiates())) {
48811          openArray("instantiates");
48812          for (UriType e : element.getInstantiates()) 
48813            composeUriCore(null, e, e != element.getInstantiates().get(element.getInstantiates().size()-1));
48814          closeArray();
48815        }
48816        if (anyHasExtras(element.getInstantiates())) {
48817          openArray("_instantiates");
48818          for (UriType e : element.getInstantiates()) 
48819            composeUriExtras(null, e, true);
48820          closeArray();
48821        }
48822      };
48823      if (element.hasPartOf()) {
48824        openArray("partOf");
48825        for (Reference e : element.getPartOf()) 
48826          composeReference(null, e);
48827        closeArray();
48828      };
48829      if (element.hasStatusElement()) {
48830        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
48831        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
48832      }
48833      if (element.hasStatusReason()) {
48834        openArray("statusReason");
48835        for (CodeableConcept e : element.getStatusReason()) 
48836          composeCodeableConcept(null, e);
48837        closeArray();
48838      };
48839      if (element.hasCategory()) {
48840        composeCodeableConcept("category", element.getCategory());
48841      }
48842      if (element.hasMedication()) {
48843        composeType("medication", element.getMedication());
48844      }
48845      if (element.hasSubject()) {
48846        composeReference("subject", element.getSubject());
48847      }
48848      if (element.hasContext()) {
48849        composeReference("context", element.getContext());
48850      }
48851      if (element.hasSupportingInformation()) {
48852        openArray("supportingInformation");
48853        for (Reference e : element.getSupportingInformation()) 
48854          composeReference(null, e);
48855        closeArray();
48856      };
48857      if (element.hasEffective()) {
48858        composeType("effective", element.getEffective());
48859      }
48860      if (element.hasPerformer()) {
48861        openArray("performer");
48862        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
48863          composeMedicationAdministrationPerformerComponent(null, e);
48864        closeArray();
48865      };
48866      if (element.hasReasonCode()) {
48867        openArray("reasonCode");
48868        for (CodeableConcept e : element.getReasonCode()) 
48869          composeCodeableConcept(null, e);
48870        closeArray();
48871      };
48872      if (element.hasReasonReference()) {
48873        openArray("reasonReference");
48874        for (Reference e : element.getReasonReference()) 
48875          composeReference(null, e);
48876        closeArray();
48877      };
48878      if (element.hasRequest()) {
48879        composeReference("request", element.getRequest());
48880      }
48881      if (element.hasDevice()) {
48882        openArray("device");
48883        for (Reference e : element.getDevice()) 
48884          composeReference(null, e);
48885        closeArray();
48886      };
48887      if (element.hasNote()) {
48888        openArray("note");
48889        for (Annotation e : element.getNote()) 
48890          composeAnnotation(null, e);
48891        closeArray();
48892      };
48893      if (element.hasDosage()) {
48894        composeMedicationAdministrationDosageComponent("dosage", element.getDosage());
48895      }
48896      if (element.hasEventHistory()) {
48897        openArray("eventHistory");
48898        for (Reference e : element.getEventHistory()) 
48899          composeReference(null, e);
48900        closeArray();
48901      };
48902  }
48903
48904  protected void composeMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
48905    if (element != null) {
48906      open(name);
48907      composeMedicationAdministrationPerformerComponentProperties(element);
48908      close();
48909    }
48910  }
48911
48912  protected void composeMedicationAdministrationPerformerComponentProperties(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
48913    composeBackboneElementProperties(element);
48914      if (element.hasFunction()) {
48915        composeCodeableConcept("function", element.getFunction());
48916      }
48917      if (element.hasActor()) {
48918        composeReference("actor", element.getActor());
48919      }
48920  }
48921
48922  protected void composeMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
48923    if (element != null) {
48924      open(name);
48925      composeMedicationAdministrationDosageComponentProperties(element);
48926      close();
48927    }
48928  }
48929
48930  protected void composeMedicationAdministrationDosageComponentProperties(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
48931    composeBackboneElementProperties(element);
48932      if (element.hasTextElement()) {
48933        composeStringCore("text", element.getTextElement(), false);
48934        composeStringExtras("text", element.getTextElement(), false);
48935      }
48936      if (element.hasSite()) {
48937        composeCodeableConcept("site", element.getSite());
48938      }
48939      if (element.hasRoute()) {
48940        composeCodeableConcept("route", element.getRoute());
48941      }
48942      if (element.hasMethod()) {
48943        composeCodeableConcept("method", element.getMethod());
48944      }
48945      if (element.hasDose()) {
48946        composeQuantity("dose", element.getDose());
48947      }
48948      if (element.hasRate()) {
48949        composeType("rate", element.getRate());
48950      }
48951  }
48952
48953  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
48954    if (element != null) {
48955      prop("resourceType", name);
48956      composeMedicationDispenseProperties(element);
48957    }
48958  }
48959
48960  protected void composeMedicationDispenseProperties(MedicationDispense element) throws IOException {
48961    composeDomainResourceProperties(element);
48962      if (element.hasIdentifier()) {
48963        openArray("identifier");
48964        for (Identifier e : element.getIdentifier()) 
48965          composeIdentifier(null, e);
48966        closeArray();
48967      };
48968      if (element.hasPartOf()) {
48969        openArray("partOf");
48970        for (Reference e : element.getPartOf()) 
48971          composeReference(null, e);
48972        closeArray();
48973      };
48974      if (element.hasStatusElement()) {
48975        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
48976        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
48977      }
48978      if (element.hasStatusReason()) {
48979        composeType("statusReason", element.getStatusReason());
48980      }
48981      if (element.hasCategory()) {
48982        composeCodeableConcept("category", element.getCategory());
48983      }
48984      if (element.hasMedication()) {
48985        composeType("medication", element.getMedication());
48986      }
48987      if (element.hasSubject()) {
48988        composeReference("subject", element.getSubject());
48989      }
48990      if (element.hasContext()) {
48991        composeReference("context", element.getContext());
48992      }
48993      if (element.hasSupportingInformation()) {
48994        openArray("supportingInformation");
48995        for (Reference e : element.getSupportingInformation()) 
48996          composeReference(null, e);
48997        closeArray();
48998      };
48999      if (element.hasPerformer()) {
49000        openArray("performer");
49001        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
49002          composeMedicationDispensePerformerComponent(null, e);
49003        closeArray();
49004      };
49005      if (element.hasLocation()) {
49006        composeReference("location", element.getLocation());
49007      }
49008      if (element.hasAuthorizingPrescription()) {
49009        openArray("authorizingPrescription");
49010        for (Reference e : element.getAuthorizingPrescription()) 
49011          composeReference(null, e);
49012        closeArray();
49013      };
49014      if (element.hasType()) {
49015        composeCodeableConcept("type", element.getType());
49016      }
49017      if (element.hasQuantity()) {
49018        composeQuantity("quantity", element.getQuantity());
49019      }
49020      if (element.hasDaysSupply()) {
49021        composeQuantity("daysSupply", element.getDaysSupply());
49022      }
49023      if (element.hasWhenPreparedElement()) {
49024        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
49025        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
49026      }
49027      if (element.hasWhenHandedOverElement()) {
49028        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
49029        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
49030      }
49031      if (element.hasDestination()) {
49032        composeReference("destination", element.getDestination());
49033      }
49034      if (element.hasReceiver()) {
49035        openArray("receiver");
49036        for (Reference e : element.getReceiver()) 
49037          composeReference(null, e);
49038        closeArray();
49039      };
49040      if (element.hasNote()) {
49041        openArray("note");
49042        for (Annotation e : element.getNote()) 
49043          composeAnnotation(null, e);
49044        closeArray();
49045      };
49046      if (element.hasDosageInstruction()) {
49047        openArray("dosageInstruction");
49048        for (Dosage e : element.getDosageInstruction()) 
49049          composeDosage(null, e);
49050        closeArray();
49051      };
49052      if (element.hasSubstitution()) {
49053        composeMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
49054      }
49055      if (element.hasDetectedIssue()) {
49056        openArray("detectedIssue");
49057        for (Reference e : element.getDetectedIssue()) 
49058          composeReference(null, e);
49059        closeArray();
49060      };
49061      if (element.hasEventHistory()) {
49062        openArray("eventHistory");
49063        for (Reference e : element.getEventHistory()) 
49064          composeReference(null, e);
49065        closeArray();
49066      };
49067  }
49068
49069  protected void composeMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
49070    if (element != null) {
49071      open(name);
49072      composeMedicationDispensePerformerComponentProperties(element);
49073      close();
49074    }
49075  }
49076
49077  protected void composeMedicationDispensePerformerComponentProperties(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
49078    composeBackboneElementProperties(element);
49079      if (element.hasFunction()) {
49080        composeCodeableConcept("function", element.getFunction());
49081      }
49082      if (element.hasActor()) {
49083        composeReference("actor", element.getActor());
49084      }
49085  }
49086
49087  protected void composeMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
49088    if (element != null) {
49089      open(name);
49090      composeMedicationDispenseSubstitutionComponentProperties(element);
49091      close();
49092    }
49093  }
49094
49095  protected void composeMedicationDispenseSubstitutionComponentProperties(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
49096    composeBackboneElementProperties(element);
49097      if (element.hasWasSubstitutedElement()) {
49098        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
49099        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
49100      }
49101      if (element.hasType()) {
49102        composeCodeableConcept("type", element.getType());
49103      }
49104      if (element.hasReason()) {
49105        openArray("reason");
49106        for (CodeableConcept e : element.getReason()) 
49107          composeCodeableConcept(null, e);
49108        closeArray();
49109      };
49110      if (element.hasResponsibleParty()) {
49111        openArray("responsibleParty");
49112        for (Reference e : element.getResponsibleParty()) 
49113          composeReference(null, e);
49114        closeArray();
49115      };
49116  }
49117
49118  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
49119    if (element != null) {
49120      prop("resourceType", name);
49121      composeMedicationKnowledgeProperties(element);
49122    }
49123  }
49124
49125  protected void composeMedicationKnowledgeProperties(MedicationKnowledge element) throws IOException {
49126    composeDomainResourceProperties(element);
49127      if (element.hasCode()) {
49128        composeCodeableConcept("code", element.getCode());
49129      }
49130      if (element.hasStatusElement()) {
49131        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
49132        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
49133      }
49134      if (element.hasManufacturer()) {
49135        composeReference("manufacturer", element.getManufacturer());
49136      }
49137      if (element.hasDoseForm()) {
49138        composeCodeableConcept("doseForm", element.getDoseForm());
49139      }
49140      if (element.hasAmount()) {
49141        composeQuantity("amount", element.getAmount());
49142      }
49143      if (element.hasSynonym()) {
49144        if (anyHasValue(element.getSynonym())) {
49145          openArray("synonym");
49146          for (StringType e : element.getSynonym()) 
49147            composeStringCore(null, e, e != element.getSynonym().get(element.getSynonym().size()-1));
49148          closeArray();
49149        }
49150        if (anyHasExtras(element.getSynonym())) {
49151          openArray("_synonym");
49152          for (StringType e : element.getSynonym()) 
49153            composeStringExtras(null, e, true);
49154          closeArray();
49155        }
49156      };
49157      if (element.hasRelatedMedicationKnowledge()) {
49158        openArray("relatedMedicationKnowledge");
49159        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
49160          composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
49161        closeArray();
49162      };
49163      if (element.hasAssociatedMedication()) {
49164        openArray("associatedMedication");
49165        for (Reference e : element.getAssociatedMedication()) 
49166          composeReference(null, e);
49167        closeArray();
49168      };
49169      if (element.hasProductType()) {
49170        openArray("productType");
49171        for (CodeableConcept e : element.getProductType()) 
49172          composeCodeableConcept(null, e);
49173        closeArray();
49174      };
49175      if (element.hasMonograph()) {
49176        openArray("monograph");
49177        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
49178          composeMedicationKnowledgeMonographComponent(null, e);
49179        closeArray();
49180      };
49181      if (element.hasIngredient()) {
49182        openArray("ingredient");
49183        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
49184          composeMedicationKnowledgeIngredientComponent(null, e);
49185        closeArray();
49186      };
49187      if (element.hasPreparationInstructionElement()) {
49188        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
49189        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
49190      }
49191      if (element.hasIntendedRoute()) {
49192        openArray("intendedRoute");
49193        for (CodeableConcept e : element.getIntendedRoute()) 
49194          composeCodeableConcept(null, e);
49195        closeArray();
49196      };
49197      if (element.hasCost()) {
49198        openArray("cost");
49199        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
49200          composeMedicationKnowledgeCostComponent(null, e);
49201        closeArray();
49202      };
49203      if (element.hasMonitoringProgram()) {
49204        openArray("monitoringProgram");
49205        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
49206          composeMedicationKnowledgeMonitoringProgramComponent(null, e);
49207        closeArray();
49208      };
49209      if (element.hasAdministrationGuidelines()) {
49210        openArray("administrationGuidelines");
49211        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element.getAdministrationGuidelines()) 
49212          composeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
49213        closeArray();
49214      };
49215      if (element.hasMedicineClassification()) {
49216        openArray("medicineClassification");
49217        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
49218          composeMedicationKnowledgeMedicineClassificationComponent(null, e);
49219        closeArray();
49220      };
49221      if (element.hasPackaging()) {
49222        composeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
49223      }
49224      if (element.hasDrugCharacteristic()) {
49225        openArray("drugCharacteristic");
49226        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
49227          composeMedicationKnowledgeDrugCharacteristicComponent(null, e);
49228        closeArray();
49229      };
49230      if (element.hasContraindication()) {
49231        openArray("contraindication");
49232        for (Reference e : element.getContraindication()) 
49233          composeReference(null, e);
49234        closeArray();
49235      };
49236      if (element.hasRegulatory()) {
49237        openArray("regulatory");
49238        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
49239          composeMedicationKnowledgeRegulatoryComponent(null, e);
49240        closeArray();
49241      };
49242      if (element.hasKinetics()) {
49243        openArray("kinetics");
49244        for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics()) 
49245          composeMedicationKnowledgeKineticsComponent(null, e);
49246        closeArray();
49247      };
49248  }
49249
49250  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
49251    if (element != null) {
49252      open(name);
49253      composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(element);
49254      close();
49255    }
49256  }
49257
49258  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
49259    composeBackboneElementProperties(element);
49260      if (element.hasType()) {
49261        composeCodeableConcept("type", element.getType());
49262      }
49263      if (element.hasReference()) {
49264        openArray("reference");
49265        for (Reference e : element.getReference()) 
49266          composeReference(null, e);
49267        closeArray();
49268      };
49269  }
49270
49271  protected void composeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
49272    if (element != null) {
49273      open(name);
49274      composeMedicationKnowledgeMonographComponentProperties(element);
49275      close();
49276    }
49277  }
49278
49279  protected void composeMedicationKnowledgeMonographComponentProperties(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
49280    composeBackboneElementProperties(element);
49281      if (element.hasType()) {
49282        composeCodeableConcept("type", element.getType());
49283      }
49284      if (element.hasSource()) {
49285        composeReference("source", element.getSource());
49286      }
49287  }
49288
49289  protected void composeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
49290    if (element != null) {
49291      open(name);
49292      composeMedicationKnowledgeIngredientComponentProperties(element);
49293      close();
49294    }
49295  }
49296
49297  protected void composeMedicationKnowledgeIngredientComponentProperties(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
49298    composeBackboneElementProperties(element);
49299      if (element.hasItem()) {
49300        composeType("item", element.getItem());
49301      }
49302      if (element.hasIsActiveElement()) {
49303        composeBooleanCore("isActive", element.getIsActiveElement(), false);
49304        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
49305      }
49306      if (element.hasStrength()) {
49307        composeRatio("strength", element.getStrength());
49308      }
49309  }
49310
49311  protected void composeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
49312    if (element != null) {
49313      open(name);
49314      composeMedicationKnowledgeCostComponentProperties(element);
49315      close();
49316    }
49317  }
49318
49319  protected void composeMedicationKnowledgeCostComponentProperties(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
49320    composeBackboneElementProperties(element);
49321      if (element.hasType()) {
49322        composeCodeableConcept("type", element.getType());
49323      }
49324      if (element.hasSourceElement()) {
49325        composeStringCore("source", element.getSourceElement(), false);
49326        composeStringExtras("source", element.getSourceElement(), false);
49327      }
49328      if (element.hasCost()) {
49329        composeMoney("cost", element.getCost());
49330      }
49331  }
49332
49333  protected void composeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
49334    if (element != null) {
49335      open(name);
49336      composeMedicationKnowledgeMonitoringProgramComponentProperties(element);
49337      close();
49338    }
49339  }
49340
49341  protected void composeMedicationKnowledgeMonitoringProgramComponentProperties(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
49342    composeBackboneElementProperties(element);
49343      if (element.hasType()) {
49344        composeCodeableConcept("type", element.getType());
49345      }
49346      if (element.hasNameElement()) {
49347        composeStringCore("name", element.getNameElement(), false);
49348        composeStringExtras("name", element.getNameElement(), false);
49349      }
49350  }
49351
49352  protected void composeMedicationKnowledgeAdministrationGuidelinesComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
49353    if (element != null) {
49354      open(name);
49355      composeMedicationKnowledgeAdministrationGuidelinesComponentProperties(element);
49356      close();
49357    }
49358  }
49359
49360  protected void composeMedicationKnowledgeAdministrationGuidelinesComponentProperties(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
49361    composeBackboneElementProperties(element);
49362      if (element.hasDosage()) {
49363        openArray("dosage");
49364        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage()) 
49365          composeMedicationKnowledgeAdministrationGuidelinesDosageComponent(null, e);
49366        closeArray();
49367      };
49368      if (element.hasIndication()) {
49369        composeType("indication", element.getIndication());
49370      }
49371      if (element.hasPatientCharacteristics()) {
49372        openArray("patientCharacteristics");
49373        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element.getPatientCharacteristics()) 
49374          composeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
49375        closeArray();
49376      };
49377  }
49378
49379  protected void composeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
49380    if (element != null) {
49381      open(name);
49382      composeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(element);
49383      close();
49384    }
49385  }
49386
49387  protected void composeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
49388    composeBackboneElementProperties(element);
49389      if (element.hasType()) {
49390        composeCodeableConcept("type", element.getType());
49391      }
49392      if (element.hasDosage()) {
49393        openArray("dosage");
49394        for (Dosage e : element.getDosage()) 
49395          composeDosage(null, e);
49396        closeArray();
49397      };
49398  }
49399
49400  protected void composeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
49401    if (element != null) {
49402      open(name);
49403      composeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(element);
49404      close();
49405    }
49406  }
49407
49408  protected void composeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
49409    composeBackboneElementProperties(element);
49410      if (element.hasCharacteristic()) {
49411        composeType("characteristic", element.getCharacteristic());
49412      }
49413      if (element.hasValue()) {
49414        if (anyHasValue(element.getValue())) {
49415          openArray("value");
49416          for (StringType e : element.getValue()) 
49417            composeStringCore(null, e, e != element.getValue().get(element.getValue().size()-1));
49418          closeArray();
49419        }
49420        if (anyHasExtras(element.getValue())) {
49421          openArray("_value");
49422          for (StringType e : element.getValue()) 
49423            composeStringExtras(null, e, true);
49424          closeArray();
49425        }
49426      };
49427  }
49428
49429  protected void composeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
49430    if (element != null) {
49431      open(name);
49432      composeMedicationKnowledgeMedicineClassificationComponentProperties(element);
49433      close();
49434    }
49435  }
49436
49437  protected void composeMedicationKnowledgeMedicineClassificationComponentProperties(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
49438    composeBackboneElementProperties(element);
49439      if (element.hasType()) {
49440        composeCodeableConcept("type", element.getType());
49441      }
49442      if (element.hasClassification()) {
49443        openArray("classification");
49444        for (CodeableConcept e : element.getClassification()) 
49445          composeCodeableConcept(null, e);
49446        closeArray();
49447      };
49448  }
49449
49450  protected void composeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
49451    if (element != null) {
49452      open(name);
49453      composeMedicationKnowledgePackagingComponentProperties(element);
49454      close();
49455    }
49456  }
49457
49458  protected void composeMedicationKnowledgePackagingComponentProperties(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
49459    composeBackboneElementProperties(element);
49460      if (element.hasType()) {
49461        composeCodeableConcept("type", element.getType());
49462      }
49463      if (element.hasQuantity()) {
49464        composeQuantity("quantity", element.getQuantity());
49465      }
49466  }
49467
49468  protected void composeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
49469    if (element != null) {
49470      open(name);
49471      composeMedicationKnowledgeDrugCharacteristicComponentProperties(element);
49472      close();
49473    }
49474  }
49475
49476  protected void composeMedicationKnowledgeDrugCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
49477    composeBackboneElementProperties(element);
49478      if (element.hasType()) {
49479        composeCodeableConcept("type", element.getType());
49480      }
49481      if (element.hasValue()) {
49482        composeType("value", element.getValue());
49483      }
49484  }
49485
49486  protected void composeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
49487    if (element != null) {
49488      open(name);
49489      composeMedicationKnowledgeRegulatoryComponentProperties(element);
49490      close();
49491    }
49492  }
49493
49494  protected void composeMedicationKnowledgeRegulatoryComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
49495    composeBackboneElementProperties(element);
49496      if (element.hasRegulatoryAuthority()) {
49497        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
49498      }
49499      if (element.hasSubstitution()) {
49500        openArray("substitution");
49501        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
49502          composeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
49503        closeArray();
49504      };
49505      if (element.hasSchedule()) {
49506        openArray("schedule");
49507        for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule()) 
49508          composeMedicationKnowledgeRegulatoryScheduleComponent(null, e);
49509        closeArray();
49510      };
49511      if (element.hasMaxDispense()) {
49512        composeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
49513      }
49514  }
49515
49516  protected void composeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
49517    if (element != null) {
49518      open(name);
49519      composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(element);
49520      close();
49521    }
49522  }
49523
49524  protected void composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
49525    composeBackboneElementProperties(element);
49526      if (element.hasType()) {
49527        composeCodeableConcept("type", element.getType());
49528      }
49529      if (element.hasAllowedElement()) {
49530        composeBooleanCore("allowed", element.getAllowedElement(), false);
49531        composeBooleanExtras("allowed", element.getAllowedElement(), false);
49532      }
49533  }
49534
49535  protected void composeMedicationKnowledgeRegulatoryScheduleComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
49536    if (element != null) {
49537      open(name);
49538      composeMedicationKnowledgeRegulatoryScheduleComponentProperties(element);
49539      close();
49540    }
49541  }
49542
49543  protected void composeMedicationKnowledgeRegulatoryScheduleComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
49544    composeBackboneElementProperties(element);
49545      if (element.hasSchedule()) {
49546        composeCodeableConcept("schedule", element.getSchedule());
49547      }
49548  }
49549
49550  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
49551    if (element != null) {
49552      open(name);
49553      composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(element);
49554      close();
49555    }
49556  }
49557
49558  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
49559    composeBackboneElementProperties(element);
49560      if (element.hasQuantity()) {
49561        composeQuantity("quantity", element.getQuantity());
49562      }
49563      if (element.hasPeriod()) {
49564        composeDuration("period", element.getPeriod());
49565      }
49566  }
49567
49568  protected void composeMedicationKnowledgeKineticsComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
49569    if (element != null) {
49570      open(name);
49571      composeMedicationKnowledgeKineticsComponentProperties(element);
49572      close();
49573    }
49574  }
49575
49576  protected void composeMedicationKnowledgeKineticsComponentProperties(MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
49577    composeBackboneElementProperties(element);
49578      if (element.hasAreaUnderCurve()) {
49579        openArray("areaUnderCurve");
49580        for (Quantity e : element.getAreaUnderCurve()) 
49581          composeQuantity(null, e);
49582        closeArray();
49583      };
49584      if (element.hasLethalDose50()) {
49585        openArray("lethalDose50");
49586        for (Quantity e : element.getLethalDose50()) 
49587          composeQuantity(null, e);
49588        closeArray();
49589      };
49590      if (element.hasHalfLifePeriod()) {
49591        composeDuration("halfLifePeriod", element.getHalfLifePeriod());
49592      }
49593  }
49594
49595  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
49596    if (element != null) {
49597      prop("resourceType", name);
49598      composeMedicationRequestProperties(element);
49599    }
49600  }
49601
49602  protected void composeMedicationRequestProperties(MedicationRequest element) throws IOException {
49603    composeDomainResourceProperties(element);
49604      if (element.hasIdentifier()) {
49605        openArray("identifier");
49606        for (Identifier e : element.getIdentifier()) 
49607          composeIdentifier(null, e);
49608        closeArray();
49609      };
49610      if (element.hasStatusElement()) {
49611        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
49612        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
49613      }
49614      if (element.hasStatusReason()) {
49615        composeCodeableConcept("statusReason", element.getStatusReason());
49616      }
49617      if (element.hasIntentElement()) {
49618        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
49619        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
49620      }
49621      if (element.hasCategory()) {
49622        openArray("category");
49623        for (CodeableConcept e : element.getCategory()) 
49624          composeCodeableConcept(null, e);
49625        closeArray();
49626      };
49627      if (element.hasPriorityElement()) {
49628        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
49629        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
49630      }
49631      if (element.hasDoNotPerformElement()) {
49632        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
49633        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
49634      }
49635      if (element.hasReported()) {
49636        composeType("reported", element.getReported());
49637      }
49638      if (element.hasMedication()) {
49639        composeType("medication", element.getMedication());
49640      }
49641      if (element.hasSubject()) {
49642        composeReference("subject", element.getSubject());
49643      }
49644      if (element.hasEncounter()) {
49645        composeReference("encounter", element.getEncounter());
49646      }
49647      if (element.hasSupportingInformation()) {
49648        openArray("supportingInformation");
49649        for (Reference e : element.getSupportingInformation()) 
49650          composeReference(null, e);
49651        closeArray();
49652      };
49653      if (element.hasAuthoredOnElement()) {
49654        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
49655        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
49656      }
49657      if (element.hasRequester()) {
49658        composeReference("requester", element.getRequester());
49659      }
49660      if (element.hasPerformer()) {
49661        composeReference("performer", element.getPerformer());
49662      }
49663      if (element.hasPerformerType()) {
49664        composeCodeableConcept("performerType", element.getPerformerType());
49665      }
49666      if (element.hasRecorder()) {
49667        composeReference("recorder", element.getRecorder());
49668      }
49669      if (element.hasReasonCode()) {
49670        openArray("reasonCode");
49671        for (CodeableConcept e : element.getReasonCode()) 
49672          composeCodeableConcept(null, e);
49673        closeArray();
49674      };
49675      if (element.hasReasonReference()) {
49676        openArray("reasonReference");
49677        for (Reference e : element.getReasonReference()) 
49678          composeReference(null, e);
49679        closeArray();
49680      };
49681      if (element.hasInstantiatesCanonical()) {
49682        if (anyHasValue(element.getInstantiatesCanonical())) {
49683          openArray("instantiatesCanonical");
49684          for (CanonicalType e : element.getInstantiatesCanonical()) 
49685            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
49686          closeArray();
49687        }
49688        if (anyHasExtras(element.getInstantiatesCanonical())) {
49689          openArray("_instantiatesCanonical");
49690          for (CanonicalType e : element.getInstantiatesCanonical()) 
49691            composeCanonicalExtras(null, e, true);
49692          closeArray();
49693        }
49694      };
49695      if (element.hasInstantiatesUri()) {
49696        if (anyHasValue(element.getInstantiatesUri())) {
49697          openArray("instantiatesUri");
49698          for (UriType e : element.getInstantiatesUri()) 
49699            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
49700          closeArray();
49701        }
49702        if (anyHasExtras(element.getInstantiatesUri())) {
49703          openArray("_instantiatesUri");
49704          for (UriType e : element.getInstantiatesUri()) 
49705            composeUriExtras(null, e, true);
49706          closeArray();
49707        }
49708      };
49709      if (element.hasBasedOn()) {
49710        openArray("basedOn");
49711        for (Reference e : element.getBasedOn()) 
49712          composeReference(null, e);
49713        closeArray();
49714      };
49715      if (element.hasGroupIdentifier()) {
49716        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
49717      }
49718      if (element.hasCourseOfTherapyType()) {
49719        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
49720      }
49721      if (element.hasInsurance()) {
49722        openArray("insurance");
49723        for (Reference e : element.getInsurance()) 
49724          composeReference(null, e);
49725        closeArray();
49726      };
49727      if (element.hasNote()) {
49728        openArray("note");
49729        for (Annotation e : element.getNote()) 
49730          composeAnnotation(null, e);
49731        closeArray();
49732      };
49733      if (element.hasDosageInstruction()) {
49734        openArray("dosageInstruction");
49735        for (Dosage e : element.getDosageInstruction()) 
49736          composeDosage(null, e);
49737        closeArray();
49738      };
49739      if (element.hasDispenseRequest()) {
49740        composeMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
49741      }
49742      if (element.hasSubstitution()) {
49743        composeMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
49744      }
49745      if (element.hasPriorPrescription()) {
49746        composeReference("priorPrescription", element.getPriorPrescription());
49747      }
49748      if (element.hasDetectedIssue()) {
49749        openArray("detectedIssue");
49750        for (Reference e : element.getDetectedIssue()) 
49751          composeReference(null, e);
49752        closeArray();
49753      };
49754      if (element.hasEventHistory()) {
49755        openArray("eventHistory");
49756        for (Reference e : element.getEventHistory()) 
49757          composeReference(null, e);
49758        closeArray();
49759      };
49760  }
49761
49762  protected void composeMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
49763    if (element != null) {
49764      open(name);
49765      composeMedicationRequestDispenseRequestComponentProperties(element);
49766      close();
49767    }
49768  }
49769
49770  protected void composeMedicationRequestDispenseRequestComponentProperties(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
49771    composeBackboneElementProperties(element);
49772      if (element.hasInitialFill()) {
49773        composeMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
49774      }
49775      if (element.hasDispenseInterval()) {
49776        composeDuration("dispenseInterval", element.getDispenseInterval());
49777      }
49778      if (element.hasValidityPeriod()) {
49779        composePeriod("validityPeriod", element.getValidityPeriod());
49780      }
49781      if (element.hasNumberOfRepeatsAllowedElement()) {
49782        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
49783        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
49784      }
49785      if (element.hasQuantity()) {
49786        composeQuantity("quantity", element.getQuantity());
49787      }
49788      if (element.hasExpectedSupplyDuration()) {
49789        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
49790      }
49791      if (element.hasPerformer()) {
49792        composeReference("performer", element.getPerformer());
49793      }
49794  }
49795
49796  protected void composeMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
49797    if (element != null) {
49798      open(name);
49799      composeMedicationRequestDispenseRequestInitialFillComponentProperties(element);
49800      close();
49801    }
49802  }
49803
49804  protected void composeMedicationRequestDispenseRequestInitialFillComponentProperties(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
49805    composeBackboneElementProperties(element);
49806      if (element.hasQuantity()) {
49807        composeQuantity("quantity", element.getQuantity());
49808      }
49809      if (element.hasDuration()) {
49810        composeDuration("duration", element.getDuration());
49811      }
49812  }
49813
49814  protected void composeMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
49815    if (element != null) {
49816      open(name);
49817      composeMedicationRequestSubstitutionComponentProperties(element);
49818      close();
49819    }
49820  }
49821
49822  protected void composeMedicationRequestSubstitutionComponentProperties(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
49823    composeBackboneElementProperties(element);
49824      if (element.hasAllowed()) {
49825        composeType("allowed", element.getAllowed());
49826      }
49827      if (element.hasReason()) {
49828        composeCodeableConcept("reason", element.getReason());
49829      }
49830  }
49831
49832  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
49833    if (element != null) {
49834      prop("resourceType", name);
49835      composeMedicationStatementProperties(element);
49836    }
49837  }
49838
49839  protected void composeMedicationStatementProperties(MedicationStatement element) throws IOException {
49840    composeDomainResourceProperties(element);
49841      if (element.hasIdentifier()) {
49842        openArray("identifier");
49843        for (Identifier e : element.getIdentifier()) 
49844          composeIdentifier(null, e);
49845        closeArray();
49846      };
49847      if (element.hasBasedOn()) {
49848        openArray("basedOn");
49849        for (Reference e : element.getBasedOn()) 
49850          composeReference(null, e);
49851        closeArray();
49852      };
49853      if (element.hasPartOf()) {
49854        openArray("partOf");
49855        for (Reference e : element.getPartOf()) 
49856          composeReference(null, e);
49857        closeArray();
49858      };
49859      if (element.hasStatusElement()) {
49860        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatusCodesEnumFactory(), false);
49861        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatusCodesEnumFactory(), false);
49862      }
49863      if (element.hasStatusReason()) {
49864        openArray("statusReason");
49865        for (CodeableConcept e : element.getStatusReason()) 
49866          composeCodeableConcept(null, e);
49867        closeArray();
49868      };
49869      if (element.hasCategory()) {
49870        composeCodeableConcept("category", element.getCategory());
49871      }
49872      if (element.hasMedication()) {
49873        composeType("medication", element.getMedication());
49874      }
49875      if (element.hasSubject()) {
49876        composeReference("subject", element.getSubject());
49877      }
49878      if (element.hasContext()) {
49879        composeReference("context", element.getContext());
49880      }
49881      if (element.hasEffective()) {
49882        composeType("effective", element.getEffective());
49883      }
49884      if (element.hasDateAssertedElement()) {
49885        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
49886        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
49887      }
49888      if (element.hasInformationSource()) {
49889        composeReference("informationSource", element.getInformationSource());
49890      }
49891      if (element.hasDerivedFrom()) {
49892        openArray("derivedFrom");
49893        for (Reference e : element.getDerivedFrom()) 
49894          composeReference(null, e);
49895        closeArray();
49896      };
49897      if (element.hasReasonCode()) {
49898        openArray("reasonCode");
49899        for (CodeableConcept e : element.getReasonCode()) 
49900          composeCodeableConcept(null, e);
49901        closeArray();
49902      };
49903      if (element.hasReasonReference()) {
49904        openArray("reasonReference");
49905        for (Reference e : element.getReasonReference()) 
49906          composeReference(null, e);
49907        closeArray();
49908      };
49909      if (element.hasNote()) {
49910        openArray("note");
49911        for (Annotation e : element.getNote()) 
49912          composeAnnotation(null, e);
49913        closeArray();
49914      };
49915      if (element.hasDosage()) {
49916        openArray("dosage");
49917        for (Dosage e : element.getDosage()) 
49918          composeDosage(null, e);
49919        closeArray();
49920      };
49921  }
49922
49923  protected void composeMedicinalProductDefinition(String name, MedicinalProductDefinition element) throws IOException {
49924    if (element != null) {
49925      prop("resourceType", name);
49926      composeMedicinalProductDefinitionProperties(element);
49927    }
49928  }
49929
49930  protected void composeMedicinalProductDefinitionProperties(MedicinalProductDefinition element) throws IOException {
49931    composeDomainResourceProperties(element);
49932      if (element.hasIdentifier()) {
49933        openArray("identifier");
49934        for (Identifier e : element.getIdentifier()) 
49935          composeIdentifier(null, e);
49936        closeArray();
49937      };
49938      if (element.hasType()) {
49939        composeCodeableConcept("type", element.getType());
49940      }
49941      if (element.hasDomain()) {
49942        composeCodeableConcept("domain", element.getDomain());
49943      }
49944      if (element.hasVersionElement()) {
49945        composeStringCore("version", element.getVersionElement(), false);
49946        composeStringExtras("version", element.getVersionElement(), false);
49947      }
49948      if (element.hasStatus()) {
49949        composeCodeableConcept("status", element.getStatus());
49950      }
49951      if (element.hasStatusDateElement()) {
49952        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
49953        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
49954      }
49955      if (element.hasDescriptionElement()) {
49956        composeMarkdownCore("description", element.getDescriptionElement(), false);
49957        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49958      }
49959      if (element.hasCombinedPharmaceuticalDoseForm()) {
49960        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
49961      }
49962      if (element.hasRoute()) {
49963        openArray("route");
49964        for (CodeableConcept e : element.getRoute()) 
49965          composeCodeableConcept(null, e);
49966        closeArray();
49967      };
49968      if (element.hasIndicationElement()) {
49969        composeMarkdownCore("indication", element.getIndicationElement(), false);
49970        composeMarkdownExtras("indication", element.getIndicationElement(), false);
49971      }
49972      if (element.hasLegalStatusOfSupply()) {
49973        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
49974      }
49975      if (element.hasAdditionalMonitoringIndicator()) {
49976        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
49977      }
49978      if (element.hasSpecialMeasures()) {
49979        openArray("specialMeasures");
49980        for (CodeableConcept e : element.getSpecialMeasures()) 
49981          composeCodeableConcept(null, e);
49982        closeArray();
49983      };
49984      if (element.hasPediatricUseIndicator()) {
49985        composeCodeableConcept("pediatricUseIndicator", element.getPediatricUseIndicator());
49986      }
49987      if (element.hasClassification()) {
49988        openArray("classification");
49989        for (CodeableConcept e : element.getClassification()) 
49990          composeCodeableConcept(null, e);
49991        closeArray();
49992      };
49993      if (element.hasMarketingStatus()) {
49994        openArray("marketingStatus");
49995        for (MarketingStatus e : element.getMarketingStatus()) 
49996          composeMarketingStatus(null, e);
49997        closeArray();
49998      };
49999      if (element.hasPackagedMedicinalProduct()) {
50000        openArray("packagedMedicinalProduct");
50001        for (CodeableConcept e : element.getPackagedMedicinalProduct()) 
50002          composeCodeableConcept(null, e);
50003        closeArray();
50004      };
50005      if (element.hasIngredient()) {
50006        openArray("ingredient");
50007        for (CodeableConcept e : element.getIngredient()) 
50008          composeCodeableConcept(null, e);
50009        closeArray();
50010      };
50011      if (element.hasImpurity()) {
50012        openArray("impurity");
50013        for (CodeableReference e : element.getImpurity()) 
50014          composeCodeableReference(null, e);
50015        closeArray();
50016      };
50017      if (element.hasAttachedDocument()) {
50018        openArray("attachedDocument");
50019        for (Reference e : element.getAttachedDocument()) 
50020          composeReference(null, e);
50021        closeArray();
50022      };
50023      if (element.hasMasterFile()) {
50024        openArray("masterFile");
50025        for (Reference e : element.getMasterFile()) 
50026          composeReference(null, e);
50027        closeArray();
50028      };
50029      if (element.hasContact()) {
50030        openArray("contact");
50031        for (MedicinalProductDefinition.MedicinalProductDefinitionContactComponent e : element.getContact()) 
50032          composeMedicinalProductDefinitionContactComponent(null, e);
50033        closeArray();
50034      };
50035      if (element.hasClinicalTrial()) {
50036        openArray("clinicalTrial");
50037        for (Reference e : element.getClinicalTrial()) 
50038          composeReference(null, e);
50039        closeArray();
50040      };
50041      if (element.hasCode()) {
50042        openArray("code");
50043        for (Coding e : element.getCode()) 
50044          composeCoding(null, e);
50045        closeArray();
50046      };
50047      if (element.hasName()) {
50048        openArray("name");
50049        for (MedicinalProductDefinition.MedicinalProductDefinitionNameComponent e : element.getName()) 
50050          composeMedicinalProductDefinitionNameComponent(null, e);
50051        closeArray();
50052      };
50053      if (element.hasCrossReference()) {
50054        openArray("crossReference");
50055        for (MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent e : element.getCrossReference()) 
50056          composeMedicinalProductDefinitionCrossReferenceComponent(null, e);
50057        closeArray();
50058      };
50059      if (element.hasOperation()) {
50060        openArray("operation");
50061        for (MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent e : element.getOperation()) 
50062          composeMedicinalProductDefinitionOperationComponent(null, e);
50063        closeArray();
50064      };
50065      if (element.hasCharacteristic()) {
50066        openArray("characteristic");
50067        for (MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent e : element.getCharacteristic()) 
50068          composeMedicinalProductDefinitionCharacteristicComponent(null, e);
50069        closeArray();
50070      };
50071  }
50072
50073  protected void composeMedicinalProductDefinitionContactComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
50074    if (element != null) {
50075      open(name);
50076      composeMedicinalProductDefinitionContactComponentProperties(element);
50077      close();
50078    }
50079  }
50080
50081  protected void composeMedicinalProductDefinitionContactComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
50082    composeBackboneElementProperties(element);
50083      if (element.hasType()) {
50084        composeCodeableConcept("type", element.getType());
50085      }
50086      if (element.hasContact()) {
50087        composeReference("contact", element.getContact());
50088      }
50089  }
50090
50091  protected void composeMedicinalProductDefinitionNameComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
50092    if (element != null) {
50093      open(name);
50094      composeMedicinalProductDefinitionNameComponentProperties(element);
50095      close();
50096    }
50097  }
50098
50099  protected void composeMedicinalProductDefinitionNameComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
50100    composeBackboneElementProperties(element);
50101      if (element.hasProductNameElement()) {
50102        composeStringCore("productName", element.getProductNameElement(), false);
50103        composeStringExtras("productName", element.getProductNameElement(), false);
50104      }
50105      if (element.hasType()) {
50106        composeCodeableConcept("type", element.getType());
50107      }
50108      if (element.hasNamePart()) {
50109        openArray("namePart");
50110        for (MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent e : element.getNamePart()) 
50111          composeMedicinalProductDefinitionNameNamePartComponent(null, e);
50112        closeArray();
50113      };
50114      if (element.hasCountryLanguage()) {
50115        openArray("countryLanguage");
50116        for (MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent e : element.getCountryLanguage()) 
50117          composeMedicinalProductDefinitionNameCountryLanguageComponent(null, e);
50118        closeArray();
50119      };
50120  }
50121
50122  protected void composeMedicinalProductDefinitionNameNamePartComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
50123    if (element != null) {
50124      open(name);
50125      composeMedicinalProductDefinitionNameNamePartComponentProperties(element);
50126      close();
50127    }
50128  }
50129
50130  protected void composeMedicinalProductDefinitionNameNamePartComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
50131    composeBackboneElementProperties(element);
50132      if (element.hasPartElement()) {
50133        composeStringCore("part", element.getPartElement(), false);
50134        composeStringExtras("part", element.getPartElement(), false);
50135      }
50136      if (element.hasType()) {
50137        composeCodeableConcept("type", element.getType());
50138      }
50139  }
50140
50141  protected void composeMedicinalProductDefinitionNameCountryLanguageComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent element) throws IOException {
50142    if (element != null) {
50143      open(name);
50144      composeMedicinalProductDefinitionNameCountryLanguageComponentProperties(element);
50145      close();
50146    }
50147  }
50148
50149  protected void composeMedicinalProductDefinitionNameCountryLanguageComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent element) throws IOException {
50150    composeBackboneElementProperties(element);
50151      if (element.hasCountry()) {
50152        composeCodeableConcept("country", element.getCountry());
50153      }
50154      if (element.hasJurisdiction()) {
50155        composeCodeableConcept("jurisdiction", element.getJurisdiction());
50156      }
50157      if (element.hasLanguage()) {
50158        composeCodeableConcept("language", element.getLanguage());
50159      }
50160  }
50161
50162  protected void composeMedicinalProductDefinitionCrossReferenceComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
50163    if (element != null) {
50164      open(name);
50165      composeMedicinalProductDefinitionCrossReferenceComponentProperties(element);
50166      close();
50167    }
50168  }
50169
50170  protected void composeMedicinalProductDefinitionCrossReferenceComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
50171    composeBackboneElementProperties(element);
50172      if (element.hasProduct()) {
50173        composeCodeableReference("product", element.getProduct());
50174      }
50175      if (element.hasType()) {
50176        composeCodeableConcept("type", element.getType());
50177      }
50178  }
50179
50180  protected void composeMedicinalProductDefinitionOperationComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent element) throws IOException {
50181    if (element != null) {
50182      open(name);
50183      composeMedicinalProductDefinitionOperationComponentProperties(element);
50184      close();
50185    }
50186  }
50187
50188  protected void composeMedicinalProductDefinitionOperationComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent element) throws IOException {
50189    composeBackboneElementProperties(element);
50190      if (element.hasType()) {
50191        composeCodeableReference("type", element.getType());
50192      }
50193      if (element.hasEffectiveDate()) {
50194        composePeriod("effectiveDate", element.getEffectiveDate());
50195      }
50196      if (element.hasOrganization()) {
50197        openArray("organization");
50198        for (Reference e : element.getOrganization()) 
50199          composeReference(null, e);
50200        closeArray();
50201      };
50202      if (element.hasConfidentialityIndicator()) {
50203        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
50204      }
50205  }
50206
50207  protected void composeMedicinalProductDefinitionCharacteristicComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent element) throws IOException {
50208    if (element != null) {
50209      open(name);
50210      composeMedicinalProductDefinitionCharacteristicComponentProperties(element);
50211      close();
50212    }
50213  }
50214
50215  protected void composeMedicinalProductDefinitionCharacteristicComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent element) throws IOException {
50216    composeBackboneElementProperties(element);
50217      if (element.hasType()) {
50218        composeCodeableConcept("type", element.getType());
50219      }
50220      if (element.hasValue()) {
50221        composeType("value", element.getValue());
50222      }
50223  }
50224
50225  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
50226    if (element != null) {
50227      prop("resourceType", name);
50228      composeMessageDefinitionProperties(element);
50229    }
50230  }
50231
50232  protected void composeMessageDefinitionProperties(MessageDefinition element) throws IOException {
50233    composeDomainResourceProperties(element);
50234      if (element.hasUrlElement()) {
50235        composeUriCore("url", element.getUrlElement(), false);
50236        composeUriExtras("url", element.getUrlElement(), false);
50237      }
50238      if (element.hasIdentifier()) {
50239        openArray("identifier");
50240        for (Identifier e : element.getIdentifier()) 
50241          composeIdentifier(null, e);
50242        closeArray();
50243      };
50244      if (element.hasVersionElement()) {
50245        composeStringCore("version", element.getVersionElement(), false);
50246        composeStringExtras("version", element.getVersionElement(), false);
50247      }
50248      if (element.hasNameElement()) {
50249        composeStringCore("name", element.getNameElement(), false);
50250        composeStringExtras("name", element.getNameElement(), false);
50251      }
50252      if (element.hasTitleElement()) {
50253        composeStringCore("title", element.getTitleElement(), false);
50254        composeStringExtras("title", element.getTitleElement(), false);
50255      }
50256      if (element.hasReplaces()) {
50257        if (anyHasValue(element.getReplaces())) {
50258          openArray("replaces");
50259          for (CanonicalType e : element.getReplaces()) 
50260            composeCanonicalCore(null, e, e != element.getReplaces().get(element.getReplaces().size()-1));
50261          closeArray();
50262        }
50263        if (anyHasExtras(element.getReplaces())) {
50264          openArray("_replaces");
50265          for (CanonicalType e : element.getReplaces()) 
50266            composeCanonicalExtras(null, e, true);
50267          closeArray();
50268        }
50269      };
50270      if (element.hasStatusElement()) {
50271        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50272        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50273      }
50274      if (element.hasExperimentalElement()) {
50275        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50276        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50277      }
50278      if (element.hasDateElement()) {
50279        composeDateTimeCore("date", element.getDateElement(), false);
50280        composeDateTimeExtras("date", element.getDateElement(), false);
50281      }
50282      if (element.hasPublisherElement()) {
50283        composeStringCore("publisher", element.getPublisherElement(), false);
50284        composeStringExtras("publisher", element.getPublisherElement(), false);
50285      }
50286      if (element.hasContact()) {
50287        openArray("contact");
50288        for (ContactDetail e : element.getContact()) 
50289          composeContactDetail(null, e);
50290        closeArray();
50291      };
50292      if (element.hasDescriptionElement()) {
50293        composeMarkdownCore("description", element.getDescriptionElement(), false);
50294        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50295      }
50296      if (element.hasUseContext()) {
50297        openArray("useContext");
50298        for (UsageContext e : element.getUseContext()) 
50299          composeUsageContext(null, e);
50300        closeArray();
50301      };
50302      if (element.hasJurisdiction()) {
50303        openArray("jurisdiction");
50304        for (CodeableConcept e : element.getJurisdiction()) 
50305          composeCodeableConcept(null, e);
50306        closeArray();
50307      };
50308      if (element.hasPurposeElement()) {
50309        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50310        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50311      }
50312      if (element.hasCopyrightElement()) {
50313        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50314        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50315      }
50316      if (element.hasBaseElement()) {
50317        composeCanonicalCore("base", element.getBaseElement(), false);
50318        composeCanonicalExtras("base", element.getBaseElement(), false);
50319      }
50320      if (element.hasParent()) {
50321        if (anyHasValue(element.getParent())) {
50322          openArray("parent");
50323          for (CanonicalType e : element.getParent()) 
50324            composeCanonicalCore(null, e, e != element.getParent().get(element.getParent().size()-1));
50325          closeArray();
50326        }
50327        if (anyHasExtras(element.getParent())) {
50328          openArray("_parent");
50329          for (CanonicalType e : element.getParent()) 
50330            composeCanonicalExtras(null, e, true);
50331          closeArray();
50332        }
50333      };
50334      if (element.hasEvent()) {
50335        composeType("event", element.getEvent());
50336      }
50337      if (element.hasCategoryElement()) {
50338        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
50339        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
50340      }
50341      if (element.hasFocus()) {
50342        openArray("focus");
50343        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
50344          composeMessageDefinitionFocusComponent(null, e);
50345        closeArray();
50346      };
50347      if (element.hasResponseRequiredElement()) {
50348        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
50349        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
50350      }
50351      if (element.hasAllowedResponse()) {
50352        openArray("allowedResponse");
50353        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
50354          composeMessageDefinitionAllowedResponseComponent(null, e);
50355        closeArray();
50356      };
50357      if (element.hasGraph()) {
50358        if (anyHasValue(element.getGraph())) {
50359          openArray("graph");
50360          for (CanonicalType e : element.getGraph()) 
50361            composeCanonicalCore(null, e, e != element.getGraph().get(element.getGraph().size()-1));
50362          closeArray();
50363        }
50364        if (anyHasExtras(element.getGraph())) {
50365          openArray("_graph");
50366          for (CanonicalType e : element.getGraph()) 
50367            composeCanonicalExtras(null, e, true);
50368          closeArray();
50369        }
50370      };
50371  }
50372
50373  protected void composeMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
50374    if (element != null) {
50375      open(name);
50376      composeMessageDefinitionFocusComponentProperties(element);
50377      close();
50378    }
50379  }
50380
50381  protected void composeMessageDefinitionFocusComponentProperties(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
50382    composeBackboneElementProperties(element);
50383      if (element.hasCodeElement()) {
50384        composeCodeCore("code", element.getCodeElement(), false);
50385        composeCodeExtras("code", element.getCodeElement(), false);
50386      }
50387      if (element.hasProfileElement()) {
50388        composeCanonicalCore("profile", element.getProfileElement(), false);
50389        composeCanonicalExtras("profile", element.getProfileElement(), false);
50390      }
50391      if (element.hasMinElement()) {
50392        composeUnsignedIntCore("min", element.getMinElement(), false);
50393        composeUnsignedIntExtras("min", element.getMinElement(), false);
50394      }
50395      if (element.hasMaxElement()) {
50396        composeStringCore("max", element.getMaxElement(), false);
50397        composeStringExtras("max", element.getMaxElement(), false);
50398      }
50399  }
50400
50401  protected void composeMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
50402    if (element != null) {
50403      open(name);
50404      composeMessageDefinitionAllowedResponseComponentProperties(element);
50405      close();
50406    }
50407  }
50408
50409  protected void composeMessageDefinitionAllowedResponseComponentProperties(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
50410    composeBackboneElementProperties(element);
50411      if (element.hasMessageElement()) {
50412        composeCanonicalCore("message", element.getMessageElement(), false);
50413        composeCanonicalExtras("message", element.getMessageElement(), false);
50414      }
50415      if (element.hasSituationElement()) {
50416        composeMarkdownCore("situation", element.getSituationElement(), false);
50417        composeMarkdownExtras("situation", element.getSituationElement(), false);
50418      }
50419  }
50420
50421  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
50422    if (element != null) {
50423      prop("resourceType", name);
50424      composeMessageHeaderProperties(element);
50425    }
50426  }
50427
50428  protected void composeMessageHeaderProperties(MessageHeader element) throws IOException {
50429    composeDomainResourceProperties(element);
50430      if (element.hasEvent()) {
50431        composeType("event", element.getEvent());
50432      }
50433      if (element.hasDestination()) {
50434        openArray("destination");
50435        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
50436          composeMessageDestinationComponent(null, e);
50437        closeArray();
50438      };
50439      if (element.hasSender()) {
50440        composeReference("sender", element.getSender());
50441      }
50442      if (element.hasEnterer()) {
50443        composeReference("enterer", element.getEnterer());
50444      }
50445      if (element.hasAuthor()) {
50446        composeReference("author", element.getAuthor());
50447      }
50448      if (element.hasSource()) {
50449        composeMessageSourceComponent("source", element.getSource());
50450      }
50451      if (element.hasResponsible()) {
50452        composeReference("responsible", element.getResponsible());
50453      }
50454      if (element.hasReason()) {
50455        composeCodeableConcept("reason", element.getReason());
50456      }
50457      if (element.hasResponse()) {
50458        composeMessageHeaderResponseComponent("response", element.getResponse());
50459      }
50460      if (element.hasFocus()) {
50461        openArray("focus");
50462        for (Reference e : element.getFocus()) 
50463          composeReference(null, e);
50464        closeArray();
50465      };
50466      if (element.hasDefinitionElement()) {
50467        composeCanonicalCore("definition", element.getDefinitionElement(), false);
50468        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
50469      }
50470  }
50471
50472  protected void composeMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
50473    if (element != null) {
50474      open(name);
50475      composeMessageDestinationComponentProperties(element);
50476      close();
50477    }
50478  }
50479
50480  protected void composeMessageDestinationComponentProperties(MessageHeader.MessageDestinationComponent element) throws IOException {
50481    composeBackboneElementProperties(element);
50482      if (element.hasNameElement()) {
50483        composeStringCore("name", element.getNameElement(), false);
50484        composeStringExtras("name", element.getNameElement(), false);
50485      }
50486      if (element.hasTarget()) {
50487        composeReference("target", element.getTarget());
50488      }
50489      if (element.hasEndpointElement()) {
50490        composeUrlCore("endpoint", element.getEndpointElement(), false);
50491        composeUrlExtras("endpoint", element.getEndpointElement(), false);
50492      }
50493      if (element.hasReceiver()) {
50494        composeReference("receiver", element.getReceiver());
50495      }
50496  }
50497
50498  protected void composeMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
50499    if (element != null) {
50500      open(name);
50501      composeMessageSourceComponentProperties(element);
50502      close();
50503    }
50504  }
50505
50506  protected void composeMessageSourceComponentProperties(MessageHeader.MessageSourceComponent element) throws IOException {
50507    composeBackboneElementProperties(element);
50508      if (element.hasNameElement()) {
50509        composeStringCore("name", element.getNameElement(), false);
50510        composeStringExtras("name", element.getNameElement(), false);
50511      }
50512      if (element.hasSoftwareElement()) {
50513        composeStringCore("software", element.getSoftwareElement(), false);
50514        composeStringExtras("software", element.getSoftwareElement(), false);
50515      }
50516      if (element.hasVersionElement()) {
50517        composeStringCore("version", element.getVersionElement(), false);
50518        composeStringExtras("version", element.getVersionElement(), false);
50519      }
50520      if (element.hasContact()) {
50521        composeContactPoint("contact", element.getContact());
50522      }
50523      if (element.hasEndpointElement()) {
50524        composeUrlCore("endpoint", element.getEndpointElement(), false);
50525        composeUrlExtras("endpoint", element.getEndpointElement(), false);
50526      }
50527  }
50528
50529  protected void composeMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
50530    if (element != null) {
50531      open(name);
50532      composeMessageHeaderResponseComponentProperties(element);
50533      close();
50534    }
50535  }
50536
50537  protected void composeMessageHeaderResponseComponentProperties(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
50538    composeBackboneElementProperties(element);
50539      if (element.hasIdentifierElement()) {
50540        composeIdCore("identifier", element.getIdentifierElement(), false);
50541        composeIdExtras("identifier", element.getIdentifierElement(), false);
50542      }
50543      if (element.hasCodeElement()) {
50544        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
50545        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
50546      }
50547      if (element.hasDetails()) {
50548        composeReference("details", element.getDetails());
50549      }
50550  }
50551
50552  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
50553    if (element != null) {
50554      prop("resourceType", name);
50555      composeMolecularSequenceProperties(element);
50556    }
50557  }
50558
50559  protected void composeMolecularSequenceProperties(MolecularSequence element) throws IOException {
50560    composeDomainResourceProperties(element);
50561      if (element.hasIdentifier()) {
50562        openArray("identifier");
50563        for (Identifier e : element.getIdentifier()) 
50564          composeIdentifier(null, e);
50565        closeArray();
50566      };
50567      if (element.hasTypeElement()) {
50568        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
50569        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
50570      }
50571      if (element.hasCoordinateSystemElement()) {
50572        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
50573        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
50574      }
50575      if (element.hasPatient()) {
50576        composeReference("patient", element.getPatient());
50577      }
50578      if (element.hasSpecimen()) {
50579        composeReference("specimen", element.getSpecimen());
50580      }
50581      if (element.hasDevice()) {
50582        composeReference("device", element.getDevice());
50583      }
50584      if (element.hasPerformer()) {
50585        composeReference("performer", element.getPerformer());
50586      }
50587      if (element.hasQuantity()) {
50588        composeQuantity("quantity", element.getQuantity());
50589      }
50590      if (element.hasReferenceSeq()) {
50591        composeMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
50592      }
50593      if (element.hasVariant()) {
50594        openArray("variant");
50595        for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
50596          composeMolecularSequenceVariantComponent(null, e);
50597        closeArray();
50598      };
50599      if (element.hasObservedSeqElement()) {
50600        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
50601        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
50602      }
50603      if (element.hasQuality()) {
50604        openArray("quality");
50605        for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
50606          composeMolecularSequenceQualityComponent(null, e);
50607        closeArray();
50608      };
50609      if (element.hasReadCoverageElement()) {
50610        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
50611        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
50612      }
50613      if (element.hasRepository()) {
50614        openArray("repository");
50615        for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
50616          composeMolecularSequenceRepositoryComponent(null, e);
50617        closeArray();
50618      };
50619      if (element.hasPointer()) {
50620        openArray("pointer");
50621        for (Reference e : element.getPointer()) 
50622          composeReference(null, e);
50623        closeArray();
50624      };
50625      if (element.hasStructureVariant()) {
50626        openArray("structureVariant");
50627        for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
50628          composeMolecularSequenceStructureVariantComponent(null, e);
50629        closeArray();
50630      };
50631  }
50632
50633  protected void composeMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
50634    if (element != null) {
50635      open(name);
50636      composeMolecularSequenceReferenceSeqComponentProperties(element);
50637      close();
50638    }
50639  }
50640
50641  protected void composeMolecularSequenceReferenceSeqComponentProperties(MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
50642    composeBackboneElementProperties(element);
50643      if (element.hasChromosome()) {
50644        composeCodeableConcept("chromosome", element.getChromosome());
50645      }
50646      if (element.hasGenomeBuildElement()) {
50647        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
50648        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
50649      }
50650      if (element.hasOrientationElement()) {
50651        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
50652        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
50653      }
50654      if (element.hasReferenceSeqId()) {
50655        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
50656      }
50657      if (element.hasReferenceSeqPointer()) {
50658        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
50659      }
50660      if (element.hasReferenceSeqStringElement()) {
50661        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
50662        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
50663      }
50664      if (element.hasStrandElement()) {
50665        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
50666        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
50667      }
50668      if (element.hasWindowStartElement()) {
50669        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
50670        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
50671      }
50672      if (element.hasWindowEndElement()) {
50673        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
50674        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
50675      }
50676  }
50677
50678  protected void composeMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
50679    if (element != null) {
50680      open(name);
50681      composeMolecularSequenceVariantComponentProperties(element);
50682      close();
50683    }
50684  }
50685
50686  protected void composeMolecularSequenceVariantComponentProperties(MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
50687    composeBackboneElementProperties(element);
50688      if (element.hasStartElement()) {
50689        composeIntegerCore("start", element.getStartElement(), false);
50690        composeIntegerExtras("start", element.getStartElement(), false);
50691      }
50692      if (element.hasEndElement()) {
50693        composeIntegerCore("end", element.getEndElement(), false);
50694        composeIntegerExtras("end", element.getEndElement(), false);
50695      }
50696      if (element.hasObservedAlleleElement()) {
50697        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
50698        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
50699      }
50700      if (element.hasReferenceAlleleElement()) {
50701        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
50702        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
50703      }
50704      if (element.hasCigarElement()) {
50705        composeStringCore("cigar", element.getCigarElement(), false);
50706        composeStringExtras("cigar", element.getCigarElement(), false);
50707      }
50708      if (element.hasVariantPointer()) {
50709        composeReference("variantPointer", element.getVariantPointer());
50710      }
50711  }
50712
50713  protected void composeMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
50714    if (element != null) {
50715      open(name);
50716      composeMolecularSequenceQualityComponentProperties(element);
50717      close();
50718    }
50719  }
50720
50721  protected void composeMolecularSequenceQualityComponentProperties(MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
50722    composeBackboneElementProperties(element);
50723      if (element.hasTypeElement()) {
50724        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
50725        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
50726      }
50727      if (element.hasStandardSequence()) {
50728        composeCodeableConcept("standardSequence", element.getStandardSequence());
50729      }
50730      if (element.hasStartElement()) {
50731        composeIntegerCore("start", element.getStartElement(), false);
50732        composeIntegerExtras("start", element.getStartElement(), false);
50733      }
50734      if (element.hasEndElement()) {
50735        composeIntegerCore("end", element.getEndElement(), false);
50736        composeIntegerExtras("end", element.getEndElement(), false);
50737      }
50738      if (element.hasScore()) {
50739        composeQuantity("score", element.getScore());
50740      }
50741      if (element.hasMethod()) {
50742        composeCodeableConcept("method", element.getMethod());
50743      }
50744      if (element.hasTruthTPElement()) {
50745        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
50746        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
50747      }
50748      if (element.hasQueryTPElement()) {
50749        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
50750        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
50751      }
50752      if (element.hasTruthFNElement()) {
50753        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
50754        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
50755      }
50756      if (element.hasQueryFPElement()) {
50757        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
50758        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
50759      }
50760      if (element.hasGtFPElement()) {
50761        composeDecimalCore("gtFP", element.getGtFPElement(), false);
50762        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
50763      }
50764      if (element.hasPrecisionElement()) {
50765        composeDecimalCore("precision", element.getPrecisionElement(), false);
50766        composeDecimalExtras("precision", element.getPrecisionElement(), false);
50767      }
50768      if (element.hasRecallElement()) {
50769        composeDecimalCore("recall", element.getRecallElement(), false);
50770        composeDecimalExtras("recall", element.getRecallElement(), false);
50771      }
50772      if (element.hasFScoreElement()) {
50773        composeDecimalCore("fScore", element.getFScoreElement(), false);
50774        composeDecimalExtras("fScore", element.getFScoreElement(), false);
50775      }
50776      if (element.hasRoc()) {
50777        composeMolecularSequenceQualityRocComponent("roc", element.getRoc());
50778      }
50779  }
50780
50781  protected void composeMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
50782    if (element != null) {
50783      open(name);
50784      composeMolecularSequenceQualityRocComponentProperties(element);
50785      close();
50786    }
50787  }
50788
50789  protected void composeMolecularSequenceQualityRocComponentProperties(MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
50790    composeBackboneElementProperties(element);
50791      if (element.hasScore()) {
50792        if (anyHasValue(element.getScore())) {
50793          openArray("score");
50794          for (IntegerType e : element.getScore()) 
50795            composeIntegerCore(null, e, e != element.getScore().get(element.getScore().size()-1));
50796          closeArray();
50797        }
50798        if (anyHasExtras(element.getScore())) {
50799          openArray("_score");
50800          for (IntegerType e : element.getScore()) 
50801            composeIntegerExtras(null, e, true);
50802          closeArray();
50803        }
50804      };
50805      if (element.hasNumTP()) {
50806        if (anyHasValue(element.getNumTP())) {
50807          openArray("numTP");
50808          for (IntegerType e : element.getNumTP()) 
50809            composeIntegerCore(null, e, e != element.getNumTP().get(element.getNumTP().size()-1));
50810          closeArray();
50811        }
50812        if (anyHasExtras(element.getNumTP())) {
50813          openArray("_numTP");
50814          for (IntegerType e : element.getNumTP()) 
50815            composeIntegerExtras(null, e, true);
50816          closeArray();
50817        }
50818      };
50819      if (element.hasNumFP()) {
50820        if (anyHasValue(element.getNumFP())) {
50821          openArray("numFP");
50822          for (IntegerType e : element.getNumFP()) 
50823            composeIntegerCore(null, e, e != element.getNumFP().get(element.getNumFP().size()-1));
50824          closeArray();
50825        }
50826        if (anyHasExtras(element.getNumFP())) {
50827          openArray("_numFP");
50828          for (IntegerType e : element.getNumFP()) 
50829            composeIntegerExtras(null, e, true);
50830          closeArray();
50831        }
50832      };
50833      if (element.hasNumFN()) {
50834        if (anyHasValue(element.getNumFN())) {
50835          openArray("numFN");
50836          for (IntegerType e : element.getNumFN()) 
50837            composeIntegerCore(null, e, e != element.getNumFN().get(element.getNumFN().size()-1));
50838          closeArray();
50839        }
50840        if (anyHasExtras(element.getNumFN())) {
50841          openArray("_numFN");
50842          for (IntegerType e : element.getNumFN()) 
50843            composeIntegerExtras(null, e, true);
50844          closeArray();
50845        }
50846      };
50847      if (element.hasPrecision()) {
50848        if (anyHasValue(element.getPrecision())) {
50849          openArray("precision");
50850          for (DecimalType e : element.getPrecision()) 
50851            composeDecimalCore(null, e, e != element.getPrecision().get(element.getPrecision().size()-1));
50852          closeArray();
50853        }
50854        if (anyHasExtras(element.getPrecision())) {
50855          openArray("_precision");
50856          for (DecimalType e : element.getPrecision()) 
50857            composeDecimalExtras(null, e, true);
50858          closeArray();
50859        }
50860      };
50861      if (element.hasSensitivity()) {
50862        if (anyHasValue(element.getSensitivity())) {
50863          openArray("sensitivity");
50864          for (DecimalType e : element.getSensitivity()) 
50865            composeDecimalCore(null, e, e != element.getSensitivity().get(element.getSensitivity().size()-1));
50866          closeArray();
50867        }
50868        if (anyHasExtras(element.getSensitivity())) {
50869          openArray("_sensitivity");
50870          for (DecimalType e : element.getSensitivity()) 
50871            composeDecimalExtras(null, e, true);
50872          closeArray();
50873        }
50874      };
50875      if (element.hasFMeasure()) {
50876        if (anyHasValue(element.getFMeasure())) {
50877          openArray("fMeasure");
50878          for (DecimalType e : element.getFMeasure()) 
50879            composeDecimalCore(null, e, e != element.getFMeasure().get(element.getFMeasure().size()-1));
50880          closeArray();
50881        }
50882        if (anyHasExtras(element.getFMeasure())) {
50883          openArray("_fMeasure");
50884          for (DecimalType e : element.getFMeasure()) 
50885            composeDecimalExtras(null, e, true);
50886          closeArray();
50887        }
50888      };
50889  }
50890
50891  protected void composeMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
50892    if (element != null) {
50893      open(name);
50894      composeMolecularSequenceRepositoryComponentProperties(element);
50895      close();
50896    }
50897  }
50898
50899  protected void composeMolecularSequenceRepositoryComponentProperties(MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
50900    composeBackboneElementProperties(element);
50901      if (element.hasTypeElement()) {
50902        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
50903        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
50904      }
50905      if (element.hasUrlElement()) {
50906        composeUriCore("url", element.getUrlElement(), false);
50907        composeUriExtras("url", element.getUrlElement(), false);
50908      }
50909      if (element.hasNameElement()) {
50910        composeStringCore("name", element.getNameElement(), false);
50911        composeStringExtras("name", element.getNameElement(), false);
50912      }
50913      if (element.hasDatasetIdElement()) {
50914        composeStringCore("datasetId", element.getDatasetIdElement(), false);
50915        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
50916      }
50917      if (element.hasVariantsetIdElement()) {
50918        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
50919        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
50920      }
50921      if (element.hasReadsetIdElement()) {
50922        composeStringCore("readsetId", element.getReadsetIdElement(), false);
50923        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
50924      }
50925  }
50926
50927  protected void composeMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
50928    if (element != null) {
50929      open(name);
50930      composeMolecularSequenceStructureVariantComponentProperties(element);
50931      close();
50932    }
50933  }
50934
50935  protected void composeMolecularSequenceStructureVariantComponentProperties(MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
50936    composeBackboneElementProperties(element);
50937      if (element.hasVariantType()) {
50938        composeCodeableConcept("variantType", element.getVariantType());
50939      }
50940      if (element.hasExactElement()) {
50941        composeBooleanCore("exact", element.getExactElement(), false);
50942        composeBooleanExtras("exact", element.getExactElement(), false);
50943      }
50944      if (element.hasLengthElement()) {
50945        composeIntegerCore("length", element.getLengthElement(), false);
50946        composeIntegerExtras("length", element.getLengthElement(), false);
50947      }
50948      if (element.hasOuter()) {
50949        composeMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
50950      }
50951      if (element.hasInner()) {
50952        composeMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
50953      }
50954  }
50955
50956  protected void composeMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
50957    if (element != null) {
50958      open(name);
50959      composeMolecularSequenceStructureVariantOuterComponentProperties(element);
50960      close();
50961    }
50962  }
50963
50964  protected void composeMolecularSequenceStructureVariantOuterComponentProperties(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
50965    composeBackboneElementProperties(element);
50966      if (element.hasStartElement()) {
50967        composeIntegerCore("start", element.getStartElement(), false);
50968        composeIntegerExtras("start", element.getStartElement(), false);
50969      }
50970      if (element.hasEndElement()) {
50971        composeIntegerCore("end", element.getEndElement(), false);
50972        composeIntegerExtras("end", element.getEndElement(), false);
50973      }
50974  }
50975
50976  protected void composeMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
50977    if (element != null) {
50978      open(name);
50979      composeMolecularSequenceStructureVariantInnerComponentProperties(element);
50980      close();
50981    }
50982  }
50983
50984  protected void composeMolecularSequenceStructureVariantInnerComponentProperties(MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
50985    composeBackboneElementProperties(element);
50986      if (element.hasStartElement()) {
50987        composeIntegerCore("start", element.getStartElement(), false);
50988        composeIntegerExtras("start", element.getStartElement(), false);
50989      }
50990      if (element.hasEndElement()) {
50991        composeIntegerCore("end", element.getEndElement(), false);
50992        composeIntegerExtras("end", element.getEndElement(), false);
50993      }
50994  }
50995
50996  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
50997    if (element != null) {
50998      prop("resourceType", name);
50999      composeNamingSystemProperties(element);
51000    }
51001  }
51002
51003  protected void composeNamingSystemProperties(NamingSystem element) throws IOException {
51004    composeDomainResourceProperties(element);
51005      if (element.hasNameElement()) {
51006        composeStringCore("name", element.getNameElement(), false);
51007        composeStringExtras("name", element.getNameElement(), false);
51008      }
51009      if (element.hasStatusElement()) {
51010        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51011        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51012      }
51013      if (element.hasKindElement()) {
51014        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
51015        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
51016      }
51017      if (element.hasDateElement()) {
51018        composeDateTimeCore("date", element.getDateElement(), false);
51019        composeDateTimeExtras("date", element.getDateElement(), false);
51020      }
51021      if (element.hasPublisherElement()) {
51022        composeStringCore("publisher", element.getPublisherElement(), false);
51023        composeStringExtras("publisher", element.getPublisherElement(), false);
51024      }
51025      if (element.hasContact()) {
51026        openArray("contact");
51027        for (ContactDetail e : element.getContact()) 
51028          composeContactDetail(null, e);
51029        closeArray();
51030      };
51031      if (element.hasResponsibleElement()) {
51032        composeStringCore("responsible", element.getResponsibleElement(), false);
51033        composeStringExtras("responsible", element.getResponsibleElement(), false);
51034      }
51035      if (element.hasType()) {
51036        composeCodeableConcept("type", element.getType());
51037      }
51038      if (element.hasDescriptionElement()) {
51039        composeMarkdownCore("description", element.getDescriptionElement(), false);
51040        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51041      }
51042      if (element.hasUseContext()) {
51043        openArray("useContext");
51044        for (UsageContext e : element.getUseContext()) 
51045          composeUsageContext(null, e);
51046        closeArray();
51047      };
51048      if (element.hasJurisdiction()) {
51049        openArray("jurisdiction");
51050        for (CodeableConcept e : element.getJurisdiction()) 
51051          composeCodeableConcept(null, e);
51052        closeArray();
51053      };
51054      if (element.hasUsageElement()) {
51055        composeStringCore("usage", element.getUsageElement(), false);
51056        composeStringExtras("usage", element.getUsageElement(), false);
51057      }
51058      if (element.hasUniqueId()) {
51059        openArray("uniqueId");
51060        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
51061          composeNamingSystemUniqueIdComponent(null, e);
51062        closeArray();
51063      };
51064  }
51065
51066  protected void composeNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
51067    if (element != null) {
51068      open(name);
51069      composeNamingSystemUniqueIdComponentProperties(element);
51070      close();
51071    }
51072  }
51073
51074  protected void composeNamingSystemUniqueIdComponentProperties(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
51075    composeBackboneElementProperties(element);
51076      if (element.hasTypeElement()) {
51077        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
51078        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
51079      }
51080      if (element.hasValueElement()) {
51081        composeStringCore("value", element.getValueElement(), false);
51082        composeStringExtras("value", element.getValueElement(), false);
51083      }
51084      if (element.hasPreferredElement()) {
51085        composeBooleanCore("preferred", element.getPreferredElement(), false);
51086        composeBooleanExtras("preferred", element.getPreferredElement(), false);
51087      }
51088      if (element.hasCommentElement()) {
51089        composeStringCore("comment", element.getCommentElement(), false);
51090        composeStringExtras("comment", element.getCommentElement(), false);
51091      }
51092      if (element.hasPeriod()) {
51093        composePeriod("period", element.getPeriod());
51094      }
51095  }
51096
51097  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
51098    if (element != null) {
51099      prop("resourceType", name);
51100      composeNutritionOrderProperties(element);
51101    }
51102  }
51103
51104  protected void composeNutritionOrderProperties(NutritionOrder element) throws IOException {
51105    composeDomainResourceProperties(element);
51106      if (element.hasIdentifier()) {
51107        openArray("identifier");
51108        for (Identifier e : element.getIdentifier()) 
51109          composeIdentifier(null, e);
51110        closeArray();
51111      };
51112      if (element.hasInstantiatesCanonical()) {
51113        if (anyHasValue(element.getInstantiatesCanonical())) {
51114          openArray("instantiatesCanonical");
51115          for (CanonicalType e : element.getInstantiatesCanonical()) 
51116            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
51117          closeArray();
51118        }
51119        if (anyHasExtras(element.getInstantiatesCanonical())) {
51120          openArray("_instantiatesCanonical");
51121          for (CanonicalType e : element.getInstantiatesCanonical()) 
51122            composeCanonicalExtras(null, e, true);
51123          closeArray();
51124        }
51125      };
51126      if (element.hasInstantiatesUri()) {
51127        if (anyHasValue(element.getInstantiatesUri())) {
51128          openArray("instantiatesUri");
51129          for (UriType e : element.getInstantiatesUri()) 
51130            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
51131          closeArray();
51132        }
51133        if (anyHasExtras(element.getInstantiatesUri())) {
51134          openArray("_instantiatesUri");
51135          for (UriType e : element.getInstantiatesUri()) 
51136            composeUriExtras(null, e, true);
51137          closeArray();
51138        }
51139      };
51140      if (element.hasInstantiates()) {
51141        if (anyHasValue(element.getInstantiates())) {
51142          openArray("instantiates");
51143          for (UriType e : element.getInstantiates()) 
51144            composeUriCore(null, e, e != element.getInstantiates().get(element.getInstantiates().size()-1));
51145          closeArray();
51146        }
51147        if (anyHasExtras(element.getInstantiates())) {
51148          openArray("_instantiates");
51149          for (UriType e : element.getInstantiates()) 
51150            composeUriExtras(null, e, true);
51151          closeArray();
51152        }
51153      };
51154      if (element.hasStatusElement()) {
51155        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
51156        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
51157      }
51158      if (element.hasIntentElement()) {
51159        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
51160        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
51161      }
51162      if (element.hasPatient()) {
51163        composeReference("patient", element.getPatient());
51164      }
51165      if (element.hasEncounter()) {
51166        composeReference("encounter", element.getEncounter());
51167      }
51168      if (element.hasDateTimeElement()) {
51169        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
51170        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
51171      }
51172      if (element.hasOrderer()) {
51173        composeReference("orderer", element.getOrderer());
51174      }
51175      if (element.hasAllergyIntolerance()) {
51176        openArray("allergyIntolerance");
51177        for (Reference e : element.getAllergyIntolerance()) 
51178          composeReference(null, e);
51179        closeArray();
51180      };
51181      if (element.hasFoodPreferenceModifier()) {
51182        openArray("foodPreferenceModifier");
51183        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
51184          composeCodeableConcept(null, e);
51185        closeArray();
51186      };
51187      if (element.hasExcludeFoodModifier()) {
51188        openArray("excludeFoodModifier");
51189        for (CodeableConcept e : element.getExcludeFoodModifier()) 
51190          composeCodeableConcept(null, e);
51191        closeArray();
51192      };
51193      if (element.hasOralDiet()) {
51194        composeNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
51195      }
51196      if (element.hasSupplement()) {
51197        openArray("supplement");
51198        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
51199          composeNutritionOrderSupplementComponent(null, e);
51200        closeArray();
51201      };
51202      if (element.hasEnteralFormula()) {
51203        composeNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
51204      }
51205      if (element.hasNote()) {
51206        openArray("note");
51207        for (Annotation e : element.getNote()) 
51208          composeAnnotation(null, e);
51209        closeArray();
51210      };
51211  }
51212
51213  protected void composeNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
51214    if (element != null) {
51215      open(name);
51216      composeNutritionOrderOralDietComponentProperties(element);
51217      close();
51218    }
51219  }
51220
51221  protected void composeNutritionOrderOralDietComponentProperties(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
51222    composeBackboneElementProperties(element);
51223      if (element.hasType()) {
51224        openArray("type");
51225        for (CodeableConcept e : element.getType()) 
51226          composeCodeableConcept(null, e);
51227        closeArray();
51228      };
51229      if (element.hasSchedule()) {
51230        openArray("schedule");
51231        for (Timing e : element.getSchedule()) 
51232          composeTiming(null, e);
51233        closeArray();
51234      };
51235      if (element.hasNutrient()) {
51236        openArray("nutrient");
51237        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
51238          composeNutritionOrderOralDietNutrientComponent(null, e);
51239        closeArray();
51240      };
51241      if (element.hasTexture()) {
51242        openArray("texture");
51243        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
51244          composeNutritionOrderOralDietTextureComponent(null, e);
51245        closeArray();
51246      };
51247      if (element.hasFluidConsistencyType()) {
51248        openArray("fluidConsistencyType");
51249        for (CodeableConcept e : element.getFluidConsistencyType()) 
51250          composeCodeableConcept(null, e);
51251        closeArray();
51252      };
51253      if (element.hasInstructionElement()) {
51254        composeStringCore("instruction", element.getInstructionElement(), false);
51255        composeStringExtras("instruction", element.getInstructionElement(), false);
51256      }
51257  }
51258
51259  protected void composeNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
51260    if (element != null) {
51261      open(name);
51262      composeNutritionOrderOralDietNutrientComponentProperties(element);
51263      close();
51264    }
51265  }
51266
51267  protected void composeNutritionOrderOralDietNutrientComponentProperties(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
51268    composeBackboneElementProperties(element);
51269      if (element.hasModifier()) {
51270        composeCodeableConcept("modifier", element.getModifier());
51271      }
51272      if (element.hasAmount()) {
51273        composeQuantity("amount", element.getAmount());
51274      }
51275  }
51276
51277  protected void composeNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
51278    if (element != null) {
51279      open(name);
51280      composeNutritionOrderOralDietTextureComponentProperties(element);
51281      close();
51282    }
51283  }
51284
51285  protected void composeNutritionOrderOralDietTextureComponentProperties(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
51286    composeBackboneElementProperties(element);
51287      if (element.hasModifier()) {
51288        composeCodeableConcept("modifier", element.getModifier());
51289      }
51290      if (element.hasFoodType()) {
51291        composeCodeableConcept("foodType", element.getFoodType());
51292      }
51293  }
51294
51295  protected void composeNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
51296    if (element != null) {
51297      open(name);
51298      composeNutritionOrderSupplementComponentProperties(element);
51299      close();
51300    }
51301  }
51302
51303  protected void composeNutritionOrderSupplementComponentProperties(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
51304    composeBackboneElementProperties(element);
51305      if (element.hasType()) {
51306        composeCodeableConcept("type", element.getType());
51307      }
51308      if (element.hasProductNameElement()) {
51309        composeStringCore("productName", element.getProductNameElement(), false);
51310        composeStringExtras("productName", element.getProductNameElement(), false);
51311      }
51312      if (element.hasSchedule()) {
51313        openArray("schedule");
51314        for (Timing e : element.getSchedule()) 
51315          composeTiming(null, e);
51316        closeArray();
51317      };
51318      if (element.hasQuantity()) {
51319        composeQuantity("quantity", element.getQuantity());
51320      }
51321      if (element.hasInstructionElement()) {
51322        composeStringCore("instruction", element.getInstructionElement(), false);
51323        composeStringExtras("instruction", element.getInstructionElement(), false);
51324      }
51325  }
51326
51327  protected void composeNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
51328    if (element != null) {
51329      open(name);
51330      composeNutritionOrderEnteralFormulaComponentProperties(element);
51331      close();
51332    }
51333  }
51334
51335  protected void composeNutritionOrderEnteralFormulaComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
51336    composeBackboneElementProperties(element);
51337      if (element.hasBaseFormulaType()) {
51338        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
51339      }
51340      if (element.hasBaseFormulaProductNameElement()) {
51341        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
51342        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
51343      }
51344      if (element.hasAdditiveType()) {
51345        composeCodeableConcept("additiveType", element.getAdditiveType());
51346      }
51347      if (element.hasAdditiveProductNameElement()) {
51348        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
51349        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
51350      }
51351      if (element.hasCaloricDensity()) {
51352        composeQuantity("caloricDensity", element.getCaloricDensity());
51353      }
51354      if (element.hasRouteofAdministration()) {
51355        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
51356      }
51357      if (element.hasAdministration()) {
51358        openArray("administration");
51359        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
51360          composeNutritionOrderEnteralFormulaAdministrationComponent(null, e);
51361        closeArray();
51362      };
51363      if (element.hasMaxVolumeToDeliver()) {
51364        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
51365      }
51366      if (element.hasAdministrationInstructionElement()) {
51367        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
51368        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
51369      }
51370  }
51371
51372  protected void composeNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
51373    if (element != null) {
51374      open(name);
51375      composeNutritionOrderEnteralFormulaAdministrationComponentProperties(element);
51376      close();
51377    }
51378  }
51379
51380  protected void composeNutritionOrderEnteralFormulaAdministrationComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
51381    composeBackboneElementProperties(element);
51382      if (element.hasSchedule()) {
51383        composeTiming("schedule", element.getSchedule());
51384      }
51385      if (element.hasQuantity()) {
51386        composeQuantity("quantity", element.getQuantity());
51387      }
51388      if (element.hasRate()) {
51389        composeType("rate", element.getRate());
51390      }
51391  }
51392
51393  protected void composeNutritionProduct(String name, NutritionProduct element) throws IOException {
51394    if (element != null) {
51395      prop("resourceType", name);
51396      composeNutritionProductProperties(element);
51397    }
51398  }
51399
51400  protected void composeNutritionProductProperties(NutritionProduct element) throws IOException {
51401    composeDomainResourceProperties(element);
51402      if (element.hasStatusElement()) {
51403        composeEnumerationCore("status", element.getStatusElement(), new NutritionProduct.NutritionProductStatusEnumFactory(), false);
51404        composeEnumerationExtras("status", element.getStatusElement(), new NutritionProduct.NutritionProductStatusEnumFactory(), false);
51405      }
51406      if (element.hasCategory()) {
51407        openArray("category");
51408        for (CodeableConcept e : element.getCategory()) 
51409          composeCodeableConcept(null, e);
51410        closeArray();
51411      };
51412      if (element.hasCode()) {
51413        composeCodeableConcept("code", element.getCode());
51414      }
51415      if (element.hasManufacturer()) {
51416        openArray("manufacturer");
51417        for (Reference e : element.getManufacturer()) 
51418          composeReference(null, e);
51419        closeArray();
51420      };
51421      if (element.hasNutrient()) {
51422        openArray("nutrient");
51423        for (NutritionProduct.NutritionProductNutrientComponent e : element.getNutrient()) 
51424          composeNutritionProductNutrientComponent(null, e);
51425        closeArray();
51426      };
51427      if (element.hasIngredient()) {
51428        openArray("ingredient");
51429        for (NutritionProduct.NutritionProductIngredientComponent e : element.getIngredient()) 
51430          composeNutritionProductIngredientComponent(null, e);
51431        closeArray();
51432      };
51433      if (element.hasKnownAllergen()) {
51434        openArray("knownAllergen");
51435        for (CodeableReference e : element.getKnownAllergen()) 
51436          composeCodeableReference(null, e);
51437        closeArray();
51438      };
51439      if (element.hasProductCharacteristic()) {
51440        openArray("productCharacteristic");
51441        for (NutritionProduct.NutritionProductProductCharacteristicComponent e : element.getProductCharacteristic()) 
51442          composeNutritionProductProductCharacteristicComponent(null, e);
51443        closeArray();
51444      };
51445      if (element.hasInstance()) {
51446        composeNutritionProductInstanceComponent("instance", element.getInstance());
51447      }
51448      if (element.hasNote()) {
51449        openArray("note");
51450        for (Annotation e : element.getNote()) 
51451          composeAnnotation(null, e);
51452        closeArray();
51453      };
51454  }
51455
51456  protected void composeNutritionProductNutrientComponent(String name, NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
51457    if (element != null) {
51458      open(name);
51459      composeNutritionProductNutrientComponentProperties(element);
51460      close();
51461    }
51462  }
51463
51464  protected void composeNutritionProductNutrientComponentProperties(NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
51465    composeBackboneElementProperties(element);
51466      if (element.hasItem()) {
51467        composeCodeableReference("item", element.getItem());
51468      }
51469      if (element.hasAmount()) {
51470        openArray("amount");
51471        for (Ratio e : element.getAmount()) 
51472          composeRatio(null, e);
51473        closeArray();
51474      };
51475  }
51476
51477  protected void composeNutritionProductIngredientComponent(String name, NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
51478    if (element != null) {
51479      open(name);
51480      composeNutritionProductIngredientComponentProperties(element);
51481      close();
51482    }
51483  }
51484
51485  protected void composeNutritionProductIngredientComponentProperties(NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
51486    composeBackboneElementProperties(element);
51487      if (element.hasItem()) {
51488        composeCodeableReference("item", element.getItem());
51489      }
51490      if (element.hasAmount()) {
51491        openArray("amount");
51492        for (Ratio e : element.getAmount()) 
51493          composeRatio(null, e);
51494        closeArray();
51495      };
51496  }
51497
51498  protected void composeNutritionProductProductCharacteristicComponent(String name, NutritionProduct.NutritionProductProductCharacteristicComponent element) throws IOException {
51499    if (element != null) {
51500      open(name);
51501      composeNutritionProductProductCharacteristicComponentProperties(element);
51502      close();
51503    }
51504  }
51505
51506  protected void composeNutritionProductProductCharacteristicComponentProperties(NutritionProduct.NutritionProductProductCharacteristicComponent element) throws IOException {
51507    composeBackboneElementProperties(element);
51508      if (element.hasType()) {
51509        composeCodeableConcept("type", element.getType());
51510      }
51511      if (element.hasValue()) {
51512        composeType("value", element.getValue());
51513      }
51514  }
51515
51516  protected void composeNutritionProductInstanceComponent(String name, NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
51517    if (element != null) {
51518      open(name);
51519      composeNutritionProductInstanceComponentProperties(element);
51520      close();
51521    }
51522  }
51523
51524  protected void composeNutritionProductInstanceComponentProperties(NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
51525    composeBackboneElementProperties(element);
51526      if (element.hasQuantity()) {
51527        composeQuantity("quantity", element.getQuantity());
51528      }
51529      if (element.hasIdentifier()) {
51530        openArray("identifier");
51531        for (Identifier e : element.getIdentifier()) 
51532          composeIdentifier(null, e);
51533        closeArray();
51534      };
51535      if (element.hasLotNumberElement()) {
51536        composeStringCore("lotNumber", element.getLotNumberElement(), false);
51537        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
51538      }
51539      if (element.hasExpiryElement()) {
51540        composeDateTimeCore("expiry", element.getExpiryElement(), false);
51541        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
51542      }
51543      if (element.hasUseByElement()) {
51544        composeDateTimeCore("useBy", element.getUseByElement(), false);
51545        composeDateTimeExtras("useBy", element.getUseByElement(), false);
51546      }
51547  }
51548
51549  protected void composeObservation(String name, Observation element) throws IOException {
51550    if (element != null) {
51551      prop("resourceType", name);
51552      composeObservationProperties(element);
51553    }
51554  }
51555
51556  protected void composeObservationProperties(Observation element) throws IOException {
51557    composeDomainResourceProperties(element);
51558      if (element.hasIdentifier()) {
51559        openArray("identifier");
51560        for (Identifier e : element.getIdentifier()) 
51561          composeIdentifier(null, e);
51562        closeArray();
51563      };
51564      if (element.hasBasedOn()) {
51565        openArray("basedOn");
51566        for (Reference e : element.getBasedOn()) 
51567          composeReference(null, e);
51568        closeArray();
51569      };
51570      if (element.hasPartOf()) {
51571        openArray("partOf");
51572        for (Reference e : element.getPartOf()) 
51573          composeReference(null, e);
51574        closeArray();
51575      };
51576      if (element.hasStatusElement()) {
51577        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
51578        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
51579      }
51580      if (element.hasCategory()) {
51581        openArray("category");
51582        for (CodeableConcept e : element.getCategory()) 
51583          composeCodeableConcept(null, e);
51584        closeArray();
51585      };
51586      if (element.hasCode()) {
51587        composeCodeableConcept("code", element.getCode());
51588      }
51589      if (element.hasSubject()) {
51590        composeReference("subject", element.getSubject());
51591      }
51592      if (element.hasFocus()) {
51593        openArray("focus");
51594        for (Reference e : element.getFocus()) 
51595          composeReference(null, e);
51596        closeArray();
51597      };
51598      if (element.hasEncounter()) {
51599        composeReference("encounter", element.getEncounter());
51600      }
51601      if (element.hasEffective()) {
51602        composeType("effective", element.getEffective());
51603      }
51604      if (element.hasIssuedElement()) {
51605        composeInstantCore("issued", element.getIssuedElement(), false);
51606        composeInstantExtras("issued", element.getIssuedElement(), false);
51607      }
51608      if (element.hasPerformer()) {
51609        openArray("performer");
51610        for (Reference e : element.getPerformer()) 
51611          composeReference(null, e);
51612        closeArray();
51613      };
51614      if (element.hasValue()) {
51615        composeType("value", element.getValue());
51616      }
51617      if (element.hasDataAbsentReason()) {
51618        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
51619      }
51620      if (element.hasInterpretation()) {
51621        openArray("interpretation");
51622        for (CodeableConcept e : element.getInterpretation()) 
51623          composeCodeableConcept(null, e);
51624        closeArray();
51625      };
51626      if (element.hasNote()) {
51627        openArray("note");
51628        for (Annotation e : element.getNote()) 
51629          composeAnnotation(null, e);
51630        closeArray();
51631      };
51632      if (element.hasBodySite()) {
51633        composeCodeableConcept("bodySite", element.getBodySite());
51634      }
51635      if (element.hasMethod()) {
51636        composeCodeableConcept("method", element.getMethod());
51637      }
51638      if (element.hasSpecimen()) {
51639        composeReference("specimen", element.getSpecimen());
51640      }
51641      if (element.hasDevice()) {
51642        composeReference("device", element.getDevice());
51643      }
51644      if (element.hasReferenceRange()) {
51645        openArray("referenceRange");
51646        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
51647          composeObservationReferenceRangeComponent(null, e);
51648        closeArray();
51649      };
51650      if (element.hasHasMember()) {
51651        openArray("hasMember");
51652        for (Reference e : element.getHasMember()) 
51653          composeReference(null, e);
51654        closeArray();
51655      };
51656      if (element.hasDerivedFrom()) {
51657        openArray("derivedFrom");
51658        for (Reference e : element.getDerivedFrom()) 
51659          composeReference(null, e);
51660        closeArray();
51661      };
51662      if (element.hasComponent()) {
51663        openArray("component");
51664        for (Observation.ObservationComponentComponent e : element.getComponent()) 
51665          composeObservationComponentComponent(null, e);
51666        closeArray();
51667      };
51668  }
51669
51670  protected void composeObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
51671    if (element != null) {
51672      open(name);
51673      composeObservationReferenceRangeComponentProperties(element);
51674      close();
51675    }
51676  }
51677
51678  protected void composeObservationReferenceRangeComponentProperties(Observation.ObservationReferenceRangeComponent element) throws IOException {
51679    composeBackboneElementProperties(element);
51680      if (element.hasLow()) {
51681        composeQuantity("low", element.getLow());
51682      }
51683      if (element.hasHigh()) {
51684        composeQuantity("high", element.getHigh());
51685      }
51686      if (element.hasType()) {
51687        composeCodeableConcept("type", element.getType());
51688      }
51689      if (element.hasAppliesTo()) {
51690        openArray("appliesTo");
51691        for (CodeableConcept e : element.getAppliesTo()) 
51692          composeCodeableConcept(null, e);
51693        closeArray();
51694      };
51695      if (element.hasAge()) {
51696        composeRange("age", element.getAge());
51697      }
51698      if (element.hasTextElement()) {
51699        composeStringCore("text", element.getTextElement(), false);
51700        composeStringExtras("text", element.getTextElement(), false);
51701      }
51702  }
51703
51704  protected void composeObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
51705    if (element != null) {
51706      open(name);
51707      composeObservationComponentComponentProperties(element);
51708      close();
51709    }
51710  }
51711
51712  protected void composeObservationComponentComponentProperties(Observation.ObservationComponentComponent element) throws IOException {
51713    composeBackboneElementProperties(element);
51714      if (element.hasCode()) {
51715        composeCodeableConcept("code", element.getCode());
51716      }
51717      if (element.hasValue()) {
51718        composeType("value", element.getValue());
51719      }
51720      if (element.hasDataAbsentReason()) {
51721        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
51722      }
51723      if (element.hasInterpretation()) {
51724        openArray("interpretation");
51725        for (CodeableConcept e : element.getInterpretation()) 
51726          composeCodeableConcept(null, e);
51727        closeArray();
51728      };
51729      if (element.hasReferenceRange()) {
51730        openArray("referenceRange");
51731        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
51732          composeObservationReferenceRangeComponent(null, e);
51733        closeArray();
51734      };
51735  }
51736
51737  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
51738    if (element != null) {
51739      prop("resourceType", name);
51740      composeObservationDefinitionProperties(element);
51741    }
51742  }
51743
51744  protected void composeObservationDefinitionProperties(ObservationDefinition element) throws IOException {
51745    composeDomainResourceProperties(element);
51746      if (element.hasCategory()) {
51747        openArray("category");
51748        for (CodeableConcept e : element.getCategory()) 
51749          composeCodeableConcept(null, e);
51750        closeArray();
51751      };
51752      if (element.hasCode()) {
51753        composeCodeableConcept("code", element.getCode());
51754      }
51755      if (element.hasIdentifier()) {
51756        openArray("identifier");
51757        for (Identifier e : element.getIdentifier()) 
51758          composeIdentifier(null, e);
51759        closeArray();
51760      };
51761      if (element.hasPermittedDataType()) {
51762        openArray("permittedDataType");
51763        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
51764          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
51765        closeArray();
51766        if (anyHasExtras(element.getPermittedDataType())) {
51767          openArray("_permittedDataType");
51768          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
51769            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
51770          closeArray();
51771        }
51772      };
51773      if (element.hasMultipleResultsAllowedElement()) {
51774        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
51775        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
51776      }
51777      if (element.hasMethod()) {
51778        composeCodeableConcept("method", element.getMethod());
51779      }
51780      if (element.hasPreferredReportNameElement()) {
51781        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
51782        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
51783      }
51784      if (element.hasQuantitativeDetails()) {
51785        composeObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
51786      }
51787      if (element.hasQualifiedInterval()) {
51788        openArray("qualifiedInterval");
51789        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
51790          composeObservationDefinitionQualifiedIntervalComponent(null, e);
51791        closeArray();
51792      };
51793      if (element.hasValidCodedValueSet()) {
51794        composeReference("validCodedValueSet", element.getValidCodedValueSet());
51795      }
51796      if (element.hasNormalCodedValueSet()) {
51797        composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
51798      }
51799      if (element.hasAbnormalCodedValueSet()) {
51800        composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
51801      }
51802      if (element.hasCriticalCodedValueSet()) {
51803        composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
51804      }
51805  }
51806
51807  protected void composeObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
51808    if (element != null) {
51809      open(name);
51810      composeObservationDefinitionQuantitativeDetailsComponentProperties(element);
51811      close();
51812    }
51813  }
51814
51815  protected void composeObservationDefinitionQuantitativeDetailsComponentProperties(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
51816    composeBackboneElementProperties(element);
51817      if (element.hasCustomaryUnit()) {
51818        composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
51819      }
51820      if (element.hasUnit()) {
51821        composeCodeableConcept("unit", element.getUnit());
51822      }
51823      if (element.hasConversionFactorElement()) {
51824        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
51825        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
51826      }
51827      if (element.hasDecimalPrecisionElement()) {
51828        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
51829        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
51830      }
51831  }
51832
51833  protected void composeObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
51834    if (element != null) {
51835      open(name);
51836      composeObservationDefinitionQualifiedIntervalComponentProperties(element);
51837      close();
51838    }
51839  }
51840
51841  protected void composeObservationDefinitionQualifiedIntervalComponentProperties(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
51842    composeBackboneElementProperties(element);
51843      if (element.hasCategoryElement()) {
51844        composeEnumerationCore("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
51845        composeEnumerationExtras("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
51846      }
51847      if (element.hasRange()) {
51848        composeRange("range", element.getRange());
51849      }
51850      if (element.hasContext()) {
51851        composeCodeableConcept("context", element.getContext());
51852      }
51853      if (element.hasAppliesTo()) {
51854        openArray("appliesTo");
51855        for (CodeableConcept e : element.getAppliesTo()) 
51856          composeCodeableConcept(null, e);
51857        closeArray();
51858      };
51859      if (element.hasGenderElement()) {
51860        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51861        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51862      }
51863      if (element.hasAge()) {
51864        composeRange("age", element.getAge());
51865      }
51866      if (element.hasGestationalAge()) {
51867        composeRange("gestationalAge", element.getGestationalAge());
51868      }
51869      if (element.hasConditionElement()) {
51870        composeStringCore("condition", element.getConditionElement(), false);
51871        composeStringExtras("condition", element.getConditionElement(), false);
51872      }
51873  }
51874
51875  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
51876    if (element != null) {
51877      prop("resourceType", name);
51878      composeOperationDefinitionProperties(element);
51879    }
51880  }
51881
51882  protected void composeOperationDefinitionProperties(OperationDefinition element) throws IOException {
51883    composeDomainResourceProperties(element);
51884      if (element.hasUrlElement()) {
51885        composeUriCore("url", element.getUrlElement(), false);
51886        composeUriExtras("url", element.getUrlElement(), false);
51887      }
51888      if (element.hasVersionElement()) {
51889        composeStringCore("version", element.getVersionElement(), false);
51890        composeStringExtras("version", element.getVersionElement(), false);
51891      }
51892      if (element.hasNameElement()) {
51893        composeStringCore("name", element.getNameElement(), false);
51894        composeStringExtras("name", element.getNameElement(), false);
51895      }
51896      if (element.hasTitleElement()) {
51897        composeStringCore("title", element.getTitleElement(), false);
51898        composeStringExtras("title", element.getTitleElement(), false);
51899      }
51900      if (element.hasStatusElement()) {
51901        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51902        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51903      }
51904      if (element.hasKindElement()) {
51905        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
51906        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
51907      }
51908      if (element.hasExperimentalElement()) {
51909        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51910        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51911      }
51912      if (element.hasDateElement()) {
51913        composeDateTimeCore("date", element.getDateElement(), false);
51914        composeDateTimeExtras("date", element.getDateElement(), false);
51915      }
51916      if (element.hasPublisherElement()) {
51917        composeStringCore("publisher", element.getPublisherElement(), false);
51918        composeStringExtras("publisher", element.getPublisherElement(), false);
51919      }
51920      if (element.hasContact()) {
51921        openArray("contact");
51922        for (ContactDetail e : element.getContact()) 
51923          composeContactDetail(null, e);
51924        closeArray();
51925      };
51926      if (element.hasDescriptionElement()) {
51927        composeMarkdownCore("description", element.getDescriptionElement(), false);
51928        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51929      }
51930      if (element.hasUseContext()) {
51931        openArray("useContext");
51932        for (UsageContext e : element.getUseContext()) 
51933          composeUsageContext(null, e);
51934        closeArray();
51935      };
51936      if (element.hasJurisdiction()) {
51937        openArray("jurisdiction");
51938        for (CodeableConcept e : element.getJurisdiction()) 
51939          composeCodeableConcept(null, e);
51940        closeArray();
51941      };
51942      if (element.hasPurposeElement()) {
51943        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51944        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51945      }
51946      if (element.hasAffectsStateElement()) {
51947        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
51948        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
51949      }
51950      if (element.hasCodeElement()) {
51951        composeCodeCore("code", element.getCodeElement(), false);
51952        composeCodeExtras("code", element.getCodeElement(), false);
51953      }
51954      if (element.hasCommentElement()) {
51955        composeMarkdownCore("comment", element.getCommentElement(), false);
51956        composeMarkdownExtras("comment", element.getCommentElement(), false);
51957      }
51958      if (element.hasBaseElement()) {
51959        composeCanonicalCore("base", element.getBaseElement(), false);
51960        composeCanonicalExtras("base", element.getBaseElement(), false);
51961      }
51962      if (element.hasResource()) {
51963        if (anyHasValue(element.getResource())) {
51964          openArray("resource");
51965          for (CodeType e : element.getResource()) 
51966            composeCodeCore(null, e, e != element.getResource().get(element.getResource().size()-1));
51967          closeArray();
51968        }
51969        if (anyHasExtras(element.getResource())) {
51970          openArray("_resource");
51971          for (CodeType e : element.getResource()) 
51972            composeCodeExtras(null, e, true);
51973          closeArray();
51974        }
51975      };
51976      if (element.hasSystemElement()) {
51977        composeBooleanCore("system", element.getSystemElement(), false);
51978        composeBooleanExtras("system", element.getSystemElement(), false);
51979      }
51980      if (element.hasTypeElement()) {
51981        composeBooleanCore("type", element.getTypeElement(), false);
51982        composeBooleanExtras("type", element.getTypeElement(), false);
51983      }
51984      if (element.hasInstanceElement()) {
51985        composeBooleanCore("instance", element.getInstanceElement(), false);
51986        composeBooleanExtras("instance", element.getInstanceElement(), false);
51987      }
51988      if (element.hasInputProfileElement()) {
51989        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
51990        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
51991      }
51992      if (element.hasOutputProfileElement()) {
51993        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
51994        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
51995      }
51996      if (element.hasParameter()) {
51997        openArray("parameter");
51998        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
51999          composeOperationDefinitionParameterComponent(null, e);
52000        closeArray();
52001      };
52002      if (element.hasOverload()) {
52003        openArray("overload");
52004        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
52005          composeOperationDefinitionOverloadComponent(null, e);
52006        closeArray();
52007      };
52008  }
52009
52010  protected void composeOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
52011    if (element != null) {
52012      open(name);
52013      composeOperationDefinitionParameterComponentProperties(element);
52014      close();
52015    }
52016  }
52017
52018  protected void composeOperationDefinitionParameterComponentProperties(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
52019    composeBackboneElementProperties(element);
52020      if (element.hasNameElement()) {
52021        composeCodeCore("name", element.getNameElement(), false);
52022        composeCodeExtras("name", element.getNameElement(), false);
52023      }
52024      if (element.hasUseElement()) {
52025        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
52026        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
52027      }
52028      if (element.hasMinElement()) {
52029        composeIntegerCore("min", element.getMinElement(), false);
52030        composeIntegerExtras("min", element.getMinElement(), false);
52031      }
52032      if (element.hasMaxElement()) {
52033        composeStringCore("max", element.getMaxElement(), false);
52034        composeStringExtras("max", element.getMaxElement(), false);
52035      }
52036      if (element.hasDocumentationElement()) {
52037        composeStringCore("documentation", element.getDocumentationElement(), false);
52038        composeStringExtras("documentation", element.getDocumentationElement(), false);
52039      }
52040      if (element.hasTypeElement()) {
52041        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
52042        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
52043      }
52044      if (element.hasTargetProfile()) {
52045        if (anyHasValue(element.getTargetProfile())) {
52046          openArray("targetProfile");
52047          for (CanonicalType e : element.getTargetProfile()) 
52048            composeCanonicalCore(null, e, e != element.getTargetProfile().get(element.getTargetProfile().size()-1));
52049          closeArray();
52050        }
52051        if (anyHasExtras(element.getTargetProfile())) {
52052          openArray("_targetProfile");
52053          for (CanonicalType e : element.getTargetProfile()) 
52054            composeCanonicalExtras(null, e, true);
52055          closeArray();
52056        }
52057      };
52058      if (element.hasSearchTypeElement()) {
52059        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
52060        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
52061      }
52062      if (element.hasBinding()) {
52063        composeOperationDefinitionParameterBindingComponent("binding", element.getBinding());
52064      }
52065      if (element.hasReferencedFrom()) {
52066        openArray("referencedFrom");
52067        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
52068          composeOperationDefinitionParameterReferencedFromComponent(null, e);
52069        closeArray();
52070      };
52071      if (element.hasPart()) {
52072        openArray("part");
52073        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
52074          composeOperationDefinitionParameterComponent(null, e);
52075        closeArray();
52076      };
52077  }
52078
52079  protected void composeOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
52080    if (element != null) {
52081      open(name);
52082      composeOperationDefinitionParameterBindingComponentProperties(element);
52083      close();
52084    }
52085  }
52086
52087  protected void composeOperationDefinitionParameterBindingComponentProperties(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
52088    composeBackboneElementProperties(element);
52089      if (element.hasStrengthElement()) {
52090        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
52091        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
52092      }
52093      if (element.hasValueSetElement()) {
52094        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
52095        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
52096      }
52097  }
52098
52099  protected void composeOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
52100    if (element != null) {
52101      open(name);
52102      composeOperationDefinitionParameterReferencedFromComponentProperties(element);
52103      close();
52104    }
52105  }
52106
52107  protected void composeOperationDefinitionParameterReferencedFromComponentProperties(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
52108    composeBackboneElementProperties(element);
52109      if (element.hasSourceElement()) {
52110        composeStringCore("source", element.getSourceElement(), false);
52111        composeStringExtras("source", element.getSourceElement(), false);
52112      }
52113      if (element.hasSourceIdElement()) {
52114        composeStringCore("sourceId", element.getSourceIdElement(), false);
52115        composeStringExtras("sourceId", element.getSourceIdElement(), false);
52116      }
52117  }
52118
52119  protected void composeOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
52120    if (element != null) {
52121      open(name);
52122      composeOperationDefinitionOverloadComponentProperties(element);
52123      close();
52124    }
52125  }
52126
52127  protected void composeOperationDefinitionOverloadComponentProperties(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
52128    composeBackboneElementProperties(element);
52129      if (element.hasParameterName()) {
52130        if (anyHasValue(element.getParameterName())) {
52131          openArray("parameterName");
52132          for (StringType e : element.getParameterName()) 
52133            composeStringCore(null, e, e != element.getParameterName().get(element.getParameterName().size()-1));
52134          closeArray();
52135        }
52136        if (anyHasExtras(element.getParameterName())) {
52137          openArray("_parameterName");
52138          for (StringType e : element.getParameterName()) 
52139            composeStringExtras(null, e, true);
52140          closeArray();
52141        }
52142      };
52143      if (element.hasCommentElement()) {
52144        composeStringCore("comment", element.getCommentElement(), false);
52145        composeStringExtras("comment", element.getCommentElement(), false);
52146      }
52147  }
52148
52149  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
52150    if (element != null) {
52151      prop("resourceType", name);
52152      composeOperationOutcomeProperties(element);
52153    }
52154  }
52155
52156  protected void composeOperationOutcomeProperties(OperationOutcome element) throws IOException {
52157    composeDomainResourceProperties(element);
52158      if (element.hasIssue()) {
52159        openArray("issue");
52160        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
52161          composeOperationOutcomeIssueComponent(null, e);
52162        closeArray();
52163      };
52164  }
52165
52166  protected void composeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
52167    if (element != null) {
52168      open(name);
52169      composeOperationOutcomeIssueComponentProperties(element);
52170      close();
52171    }
52172  }
52173
52174  protected void composeOperationOutcomeIssueComponentProperties(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
52175    composeBackboneElementProperties(element);
52176      if (element.hasSeverityElement()) {
52177        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
52178        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
52179      }
52180      if (element.hasCodeElement()) {
52181        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
52182        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
52183      }
52184      if (element.hasDetails()) {
52185        composeCodeableConcept("details", element.getDetails());
52186      }
52187      if (element.hasDiagnosticsElement()) {
52188        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
52189        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
52190      }
52191      if (element.hasLocation()) {
52192        if (anyHasValue(element.getLocation())) {
52193          openArray("location");
52194          for (StringType e : element.getLocation()) 
52195            composeStringCore(null, e, e != element.getLocation().get(element.getLocation().size()-1));
52196          closeArray();
52197        }
52198        if (anyHasExtras(element.getLocation())) {
52199          openArray("_location");
52200          for (StringType e : element.getLocation()) 
52201            composeStringExtras(null, e, true);
52202          closeArray();
52203        }
52204      };
52205      if (element.hasExpression()) {
52206        if (anyHasValue(element.getExpression())) {
52207          openArray("expression");
52208          for (StringType e : element.getExpression()) 
52209            composeStringCore(null, e, e != element.getExpression().get(element.getExpression().size()-1));
52210          closeArray();
52211        }
52212        if (anyHasExtras(element.getExpression())) {
52213          openArray("_expression");
52214          for (StringType e : element.getExpression()) 
52215            composeStringExtras(null, e, true);
52216          closeArray();
52217        }
52218      };
52219  }
52220
52221  protected void composeOrganization(String name, Organization element) throws IOException {
52222    if (element != null) {
52223      prop("resourceType", name);
52224      composeOrganizationProperties(element);
52225    }
52226  }
52227
52228  protected void composeOrganizationProperties(Organization element) throws IOException {
52229    composeDomainResourceProperties(element);
52230      if (element.hasIdentifier()) {
52231        openArray("identifier");
52232        for (Identifier e : element.getIdentifier()) 
52233          composeIdentifier(null, e);
52234        closeArray();
52235      };
52236      if (element.hasActiveElement()) {
52237        composeBooleanCore("active", element.getActiveElement(), false);
52238        composeBooleanExtras("active", element.getActiveElement(), false);
52239      }
52240      if (element.hasType()) {
52241        openArray("type");
52242        for (CodeableConcept e : element.getType()) 
52243          composeCodeableConcept(null, e);
52244        closeArray();
52245      };
52246      if (element.hasNameElement()) {
52247        composeStringCore("name", element.getNameElement(), false);
52248        composeStringExtras("name", element.getNameElement(), false);
52249      }
52250      if (element.hasAlias()) {
52251        if (anyHasValue(element.getAlias())) {
52252          openArray("alias");
52253          for (StringType e : element.getAlias()) 
52254            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
52255          closeArray();
52256        }
52257        if (anyHasExtras(element.getAlias())) {
52258          openArray("_alias");
52259          for (StringType e : element.getAlias()) 
52260            composeStringExtras(null, e, true);
52261          closeArray();
52262        }
52263      };
52264      if (element.hasTelecom()) {
52265        openArray("telecom");
52266        for (ContactPoint e : element.getTelecom()) 
52267          composeContactPoint(null, e);
52268        closeArray();
52269      };
52270      if (element.hasAddress()) {
52271        openArray("address");
52272        for (Address e : element.getAddress()) 
52273          composeAddress(null, e);
52274        closeArray();
52275      };
52276      if (element.hasPartOf()) {
52277        composeReference("partOf", element.getPartOf());
52278      }
52279      if (element.hasContact()) {
52280        openArray("contact");
52281        for (Organization.OrganizationContactComponent e : element.getContact()) 
52282          composeOrganizationContactComponent(null, e);
52283        closeArray();
52284      };
52285      if (element.hasEndpoint()) {
52286        openArray("endpoint");
52287        for (Reference e : element.getEndpoint()) 
52288          composeReference(null, e);
52289        closeArray();
52290      };
52291  }
52292
52293  protected void composeOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
52294    if (element != null) {
52295      open(name);
52296      composeOrganizationContactComponentProperties(element);
52297      close();
52298    }
52299  }
52300
52301  protected void composeOrganizationContactComponentProperties(Organization.OrganizationContactComponent element) throws IOException {
52302    composeBackboneElementProperties(element);
52303      if (element.hasPurpose()) {
52304        composeCodeableConcept("purpose", element.getPurpose());
52305      }
52306      if (element.hasName()) {
52307        composeHumanName("name", element.getName());
52308      }
52309      if (element.hasTelecom()) {
52310        openArray("telecom");
52311        for (ContactPoint e : element.getTelecom()) 
52312          composeContactPoint(null, e);
52313        closeArray();
52314      };
52315      if (element.hasAddress()) {
52316        composeAddress("address", element.getAddress());
52317      }
52318  }
52319
52320  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
52321    if (element != null) {
52322      prop("resourceType", name);
52323      composeOrganizationAffiliationProperties(element);
52324    }
52325  }
52326
52327  protected void composeOrganizationAffiliationProperties(OrganizationAffiliation element) throws IOException {
52328    composeDomainResourceProperties(element);
52329      if (element.hasIdentifier()) {
52330        openArray("identifier");
52331        for (Identifier e : element.getIdentifier()) 
52332          composeIdentifier(null, e);
52333        closeArray();
52334      };
52335      if (element.hasActiveElement()) {
52336        composeBooleanCore("active", element.getActiveElement(), false);
52337        composeBooleanExtras("active", element.getActiveElement(), false);
52338      }
52339      if (element.hasPeriod()) {
52340        composePeriod("period", element.getPeriod());
52341      }
52342      if (element.hasOrganization()) {
52343        composeReference("organization", element.getOrganization());
52344      }
52345      if (element.hasParticipatingOrganization()) {
52346        composeReference("participatingOrganization", element.getParticipatingOrganization());
52347      }
52348      if (element.hasNetwork()) {
52349        openArray("network");
52350        for (Reference e : element.getNetwork()) 
52351          composeReference(null, e);
52352        closeArray();
52353      };
52354      if (element.hasCode()) {
52355        openArray("code");
52356        for (CodeableConcept e : element.getCode()) 
52357          composeCodeableConcept(null, e);
52358        closeArray();
52359      };
52360      if (element.hasSpecialty()) {
52361        openArray("specialty");
52362        for (CodeableConcept e : element.getSpecialty()) 
52363          composeCodeableConcept(null, e);
52364        closeArray();
52365      };
52366      if (element.hasLocation()) {
52367        openArray("location");
52368        for (Reference e : element.getLocation()) 
52369          composeReference(null, e);
52370        closeArray();
52371      };
52372      if (element.hasHealthcareService()) {
52373        openArray("healthcareService");
52374        for (Reference e : element.getHealthcareService()) 
52375          composeReference(null, e);
52376        closeArray();
52377      };
52378      if (element.hasTelecom()) {
52379        openArray("telecom");
52380        for (ContactPoint e : element.getTelecom()) 
52381          composeContactPoint(null, e);
52382        closeArray();
52383      };
52384      if (element.hasEndpoint()) {
52385        openArray("endpoint");
52386        for (Reference e : element.getEndpoint()) 
52387          composeReference(null, e);
52388        closeArray();
52389      };
52390  }
52391
52392  protected void composePackagedProductDefinition(String name, PackagedProductDefinition element) throws IOException {
52393    if (element != null) {
52394      prop("resourceType", name);
52395      composePackagedProductDefinitionProperties(element);
52396    }
52397  }
52398
52399  protected void composePackagedProductDefinitionProperties(PackagedProductDefinition element) throws IOException {
52400    composeDomainResourceProperties(element);
52401      if (element.hasIdentifier()) {
52402        openArray("identifier");
52403        for (Identifier e : element.getIdentifier()) 
52404          composeIdentifier(null, e);
52405        closeArray();
52406      };
52407      if (element.hasNameElement()) {
52408        composeStringCore("name", element.getNameElement(), false);
52409        composeStringExtras("name", element.getNameElement(), false);
52410      }
52411      if (element.hasType()) {
52412        composeCodeableConcept("type", element.getType());
52413      }
52414      if (element.hasPackageFor()) {
52415        openArray("packageFor");
52416        for (Reference e : element.getPackageFor()) 
52417          composeReference(null, e);
52418        closeArray();
52419      };
52420      if (element.hasStatus()) {
52421        composeCodeableConcept("status", element.getStatus());
52422      }
52423      if (element.hasStatusDateElement()) {
52424        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
52425        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
52426      }
52427      if (element.hasContainedItemQuantity()) {
52428        openArray("containedItemQuantity");
52429        for (Quantity e : element.getContainedItemQuantity()) 
52430          composeQuantity(null, e);
52431        closeArray();
52432      };
52433      if (element.hasDescriptionElement()) {
52434        composeMarkdownCore("description", element.getDescriptionElement(), false);
52435        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52436      }
52437      if (element.hasLegalStatusOfSupply()) {
52438        openArray("legalStatusOfSupply");
52439        for (PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent e : element.getLegalStatusOfSupply()) 
52440          composePackagedProductDefinitionLegalStatusOfSupplyComponent(null, e);
52441        closeArray();
52442      };
52443      if (element.hasMarketingStatus()) {
52444        openArray("marketingStatus");
52445        for (MarketingStatus e : element.getMarketingStatus()) 
52446          composeMarketingStatus(null, e);
52447        closeArray();
52448      };
52449      if (element.hasCharacteristic()) {
52450        openArray("characteristic");
52451        for (CodeableConcept e : element.getCharacteristic()) 
52452          composeCodeableConcept(null, e);
52453        closeArray();
52454      };
52455      if (element.hasCopackagedIndicatorElement()) {
52456        composeBooleanCore("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
52457        composeBooleanExtras("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
52458      }
52459      if (element.hasManufacturer()) {
52460        openArray("manufacturer");
52461        for (Reference e : element.getManufacturer()) 
52462          composeReference(null, e);
52463        closeArray();
52464      };
52465      if (element.hasPackage()) {
52466        composePackagedProductDefinitionPackageComponent("package", element.getPackage());
52467      }
52468  }
52469
52470  protected void composePackagedProductDefinitionLegalStatusOfSupplyComponent(String name, PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent element) throws IOException {
52471    if (element != null) {
52472      open(name);
52473      composePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(element);
52474      close();
52475    }
52476  }
52477
52478  protected void composePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent element) throws IOException {
52479    composeBackboneElementProperties(element);
52480      if (element.hasCode()) {
52481        composeCodeableConcept("code", element.getCode());
52482      }
52483      if (element.hasJurisdiction()) {
52484        composeCodeableConcept("jurisdiction", element.getJurisdiction());
52485      }
52486  }
52487
52488  protected void composePackagedProductDefinitionPackageComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageComponent element) throws IOException {
52489    if (element != null) {
52490      open(name);
52491      composePackagedProductDefinitionPackageComponentProperties(element);
52492      close();
52493    }
52494  }
52495
52496  protected void composePackagedProductDefinitionPackageComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackageComponent element) throws IOException {
52497    composeBackboneElementProperties(element);
52498      if (element.hasIdentifier()) {
52499        openArray("identifier");
52500        for (Identifier e : element.getIdentifier()) 
52501          composeIdentifier(null, e);
52502        closeArray();
52503      };
52504      if (element.hasType()) {
52505        composeCodeableConcept("type", element.getType());
52506      }
52507      if (element.hasQuantityElement()) {
52508        composeIntegerCore("quantity", element.getQuantityElement(), false);
52509        composeIntegerExtras("quantity", element.getQuantityElement(), false);
52510      }
52511      if (element.hasMaterial()) {
52512        openArray("material");
52513        for (CodeableConcept e : element.getMaterial()) 
52514          composeCodeableConcept(null, e);
52515        closeArray();
52516      };
52517      if (element.hasAlternateMaterial()) {
52518        openArray("alternateMaterial");
52519        for (CodeableConcept e : element.getAlternateMaterial()) 
52520          composeCodeableConcept(null, e);
52521        closeArray();
52522      };
52523      if (element.hasShelfLifeStorage()) {
52524        openArray("shelfLifeStorage");
52525        for (ProductShelfLife e : element.getShelfLifeStorage()) 
52526          composeProductShelfLife(null, e);
52527        closeArray();
52528      };
52529      if (element.hasManufacturer()) {
52530        openArray("manufacturer");
52531        for (Reference e : element.getManufacturer()) 
52532          composeReference(null, e);
52533        closeArray();
52534      };
52535      if (element.hasProperty()) {
52536        openArray("property");
52537        for (PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent e : element.getProperty()) 
52538          composePackagedProductDefinitionPackagePropertyComponent(null, e);
52539        closeArray();
52540      };
52541      if (element.hasContainedItem()) {
52542        openArray("containedItem");
52543        for (PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent e : element.getContainedItem()) 
52544          composePackagedProductDefinitionPackageContainedItemComponent(null, e);
52545        closeArray();
52546      };
52547      if (element.hasPackage()) {
52548        openArray("package");
52549        for (PackagedProductDefinition.PackagedProductDefinitionPackageComponent e : element.getPackage()) 
52550          composePackagedProductDefinitionPackageComponent(null, e);
52551        closeArray();
52552      };
52553  }
52554
52555  protected void composePackagedProductDefinitionPackagePropertyComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent element) throws IOException {
52556    if (element != null) {
52557      open(name);
52558      composePackagedProductDefinitionPackagePropertyComponentProperties(element);
52559      close();
52560    }
52561  }
52562
52563  protected void composePackagedProductDefinitionPackagePropertyComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent element) throws IOException {
52564    composeBackboneElementProperties(element);
52565      if (element.hasType()) {
52566        composeCodeableConcept("type", element.getType());
52567      }
52568      if (element.hasValue()) {
52569        composeType("value", element.getValue());
52570      }
52571  }
52572
52573  protected void composePackagedProductDefinitionPackageContainedItemComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
52574    if (element != null) {
52575      open(name);
52576      composePackagedProductDefinitionPackageContainedItemComponentProperties(element);
52577      close();
52578    }
52579  }
52580
52581  protected void composePackagedProductDefinitionPackageContainedItemComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
52582    composeBackboneElementProperties(element);
52583      if (element.hasItem()) {
52584        composeCodeableReference("item", element.getItem());
52585      }
52586      if (element.hasAmount()) {
52587        composeQuantity("amount", element.getAmount());
52588      }
52589  }
52590
52591  protected void composeParameters(String name, Parameters element) throws IOException {
52592    if (element != null) {
52593      prop("resourceType", name);
52594      composeParametersProperties(element);
52595    }
52596  }
52597
52598  protected void composeParametersProperties(Parameters element) throws IOException {
52599    composeResourceProperties(element);
52600      if (element.hasParameter()) {
52601        openArray("parameter");
52602        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
52603          composeParametersParameterComponent(null, e);
52604        closeArray();
52605      };
52606  }
52607
52608  protected void composeParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
52609    if (element != null) {
52610      open(name);
52611      composeParametersParameterComponentProperties(element);
52612      close();
52613    }
52614  }
52615
52616  protected void composeParametersParameterComponentProperties(Parameters.ParametersParameterComponent element) throws IOException {
52617    composeBackboneElementProperties(element);
52618      if (element.hasNameElement()) {
52619        composeStringCore("name", element.getNameElement(), false);
52620        composeStringExtras("name", element.getNameElement(), false);
52621      }
52622      if (element.hasValue()) {
52623        composeType("value", element.getValue());
52624      }
52625        if (element.hasResource()) {
52626          open("resource");
52627          composeResource(element.getResource());
52628          close();
52629        }
52630      if (element.hasPart()) {
52631        openArray("part");
52632        for (Parameters.ParametersParameterComponent e : element.getPart()) 
52633          composeParametersParameterComponent(null, e);
52634        closeArray();
52635      };
52636  }
52637
52638  protected void composePatient(String name, Patient element) throws IOException {
52639    if (element != null) {
52640      prop("resourceType", name);
52641      composePatientProperties(element);
52642    }
52643  }
52644
52645  protected void composePatientProperties(Patient element) throws IOException {
52646    composeDomainResourceProperties(element);
52647      if (element.hasIdentifier()) {
52648        openArray("identifier");
52649        for (Identifier e : element.getIdentifier()) 
52650          composeIdentifier(null, e);
52651        closeArray();
52652      };
52653      if (element.hasActiveElement()) {
52654        composeBooleanCore("active", element.getActiveElement(), false);
52655        composeBooleanExtras("active", element.getActiveElement(), false);
52656      }
52657      if (element.hasName()) {
52658        openArray("name");
52659        for (HumanName e : element.getName()) 
52660          composeHumanName(null, e);
52661        closeArray();
52662      };
52663      if (element.hasTelecom()) {
52664        openArray("telecom");
52665        for (ContactPoint e : element.getTelecom()) 
52666          composeContactPoint(null, e);
52667        closeArray();
52668      };
52669      if (element.hasGenderElement()) {
52670        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52671        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52672      }
52673      if (element.hasBirthDateElement()) {
52674        composeDateCore("birthDate", element.getBirthDateElement(), false);
52675        composeDateExtras("birthDate", element.getBirthDateElement(), false);
52676      }
52677      if (element.hasDeceased()) {
52678        composeType("deceased", element.getDeceased());
52679      }
52680      if (element.hasAddress()) {
52681        openArray("address");
52682        for (Address e : element.getAddress()) 
52683          composeAddress(null, e);
52684        closeArray();
52685      };
52686      if (element.hasMaritalStatus()) {
52687        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
52688      }
52689      if (element.hasMultipleBirth()) {
52690        composeType("multipleBirth", element.getMultipleBirth());
52691      }
52692      if (element.hasPhoto()) {
52693        openArray("photo");
52694        for (Attachment e : element.getPhoto()) 
52695          composeAttachment(null, e);
52696        closeArray();
52697      };
52698      if (element.hasContact()) {
52699        openArray("contact");
52700        for (Patient.ContactComponent e : element.getContact()) 
52701          composeContactComponent(null, e);
52702        closeArray();
52703      };
52704      if (element.hasCommunication()) {
52705        openArray("communication");
52706        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
52707          composePatientCommunicationComponent(null, e);
52708        closeArray();
52709      };
52710      if (element.hasGeneralPractitioner()) {
52711        openArray("generalPractitioner");
52712        for (Reference e : element.getGeneralPractitioner()) 
52713          composeReference(null, e);
52714        closeArray();
52715      };
52716      if (element.hasManagingOrganization()) {
52717        composeReference("managingOrganization", element.getManagingOrganization());
52718      }
52719      if (element.hasLink()) {
52720        openArray("link");
52721        for (Patient.PatientLinkComponent e : element.getLink()) 
52722          composePatientLinkComponent(null, e);
52723        closeArray();
52724      };
52725  }
52726
52727  protected void composeContactComponent(String name, Patient.ContactComponent element) throws IOException {
52728    if (element != null) {
52729      open(name);
52730      composeContactComponentProperties(element);
52731      close();
52732    }
52733  }
52734
52735  protected void composeContactComponentProperties(Patient.ContactComponent element) throws IOException {
52736    composeBackboneElementProperties(element);
52737      if (element.hasRelationship()) {
52738        openArray("relationship");
52739        for (CodeableConcept e : element.getRelationship()) 
52740          composeCodeableConcept(null, e);
52741        closeArray();
52742      };
52743      if (element.hasName()) {
52744        composeHumanName("name", element.getName());
52745      }
52746      if (element.hasTelecom()) {
52747        openArray("telecom");
52748        for (ContactPoint e : element.getTelecom()) 
52749          composeContactPoint(null, e);
52750        closeArray();
52751      };
52752      if (element.hasAddress()) {
52753        composeAddress("address", element.getAddress());
52754      }
52755      if (element.hasGenderElement()) {
52756        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52757        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52758      }
52759      if (element.hasOrganization()) {
52760        composeReference("organization", element.getOrganization());
52761      }
52762      if (element.hasPeriod()) {
52763        composePeriod("period", element.getPeriod());
52764      }
52765  }
52766
52767  protected void composePatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
52768    if (element != null) {
52769      open(name);
52770      composePatientCommunicationComponentProperties(element);
52771      close();
52772    }
52773  }
52774
52775  protected void composePatientCommunicationComponentProperties(Patient.PatientCommunicationComponent element) throws IOException {
52776    composeBackboneElementProperties(element);
52777      if (element.hasLanguage()) {
52778        composeCodeableConcept("language", element.getLanguage());
52779      }
52780      if (element.hasPreferredElement()) {
52781        composeBooleanCore("preferred", element.getPreferredElement(), false);
52782        composeBooleanExtras("preferred", element.getPreferredElement(), false);
52783      }
52784  }
52785
52786  protected void composePatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
52787    if (element != null) {
52788      open(name);
52789      composePatientLinkComponentProperties(element);
52790      close();
52791    }
52792  }
52793
52794  protected void composePatientLinkComponentProperties(Patient.PatientLinkComponent element) throws IOException {
52795    composeBackboneElementProperties(element);
52796      if (element.hasOther()) {
52797        composeReference("other", element.getOther());
52798      }
52799      if (element.hasTypeElement()) {
52800        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
52801        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
52802      }
52803  }
52804
52805  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
52806    if (element != null) {
52807      prop("resourceType", name);
52808      composePaymentNoticeProperties(element);
52809    }
52810  }
52811
52812  protected void composePaymentNoticeProperties(PaymentNotice element) throws IOException {
52813    composeDomainResourceProperties(element);
52814      if (element.hasIdentifier()) {
52815        openArray("identifier");
52816        for (Identifier e : element.getIdentifier()) 
52817          composeIdentifier(null, e);
52818        closeArray();
52819      };
52820      if (element.hasStatusElement()) {
52821        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52822        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52823      }
52824      if (element.hasRequest()) {
52825        composeReference("request", element.getRequest());
52826      }
52827      if (element.hasResponse()) {
52828        composeReference("response", element.getResponse());
52829      }
52830      if (element.hasCreatedElement()) {
52831        composeDateTimeCore("created", element.getCreatedElement(), false);
52832        composeDateTimeExtras("created", element.getCreatedElement(), false);
52833      }
52834      if (element.hasProvider()) {
52835        composeReference("provider", element.getProvider());
52836      }
52837      if (element.hasPayment()) {
52838        composeReference("payment", element.getPayment());
52839      }
52840      if (element.hasPaymentDateElement()) {
52841        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
52842        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
52843      }
52844      if (element.hasPayee()) {
52845        composeReference("payee", element.getPayee());
52846      }
52847      if (element.hasRecipient()) {
52848        composeReference("recipient", element.getRecipient());
52849      }
52850      if (element.hasAmount()) {
52851        composeMoney("amount", element.getAmount());
52852      }
52853      if (element.hasPaymentStatus()) {
52854        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
52855      }
52856  }
52857
52858  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
52859    if (element != null) {
52860      prop("resourceType", name);
52861      composePaymentReconciliationProperties(element);
52862    }
52863  }
52864
52865  protected void composePaymentReconciliationProperties(PaymentReconciliation element) throws IOException {
52866    composeDomainResourceProperties(element);
52867      if (element.hasIdentifier()) {
52868        openArray("identifier");
52869        for (Identifier e : element.getIdentifier()) 
52870          composeIdentifier(null, e);
52871        closeArray();
52872      };
52873      if (element.hasStatusElement()) {
52874        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52875        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52876      }
52877      if (element.hasPeriod()) {
52878        composePeriod("period", element.getPeriod());
52879      }
52880      if (element.hasCreatedElement()) {
52881        composeDateTimeCore("created", element.getCreatedElement(), false);
52882        composeDateTimeExtras("created", element.getCreatedElement(), false);
52883      }
52884      if (element.hasPaymentIssuer()) {
52885        composeReference("paymentIssuer", element.getPaymentIssuer());
52886      }
52887      if (element.hasRequest()) {
52888        composeReference("request", element.getRequest());
52889      }
52890      if (element.hasRequestor()) {
52891        composeReference("requestor", element.getRequestor());
52892      }
52893      if (element.hasOutcomeElement()) {
52894        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
52895        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
52896      }
52897      if (element.hasDispositionElement()) {
52898        composeStringCore("disposition", element.getDispositionElement(), false);
52899        composeStringExtras("disposition", element.getDispositionElement(), false);
52900      }
52901      if (element.hasPaymentDateElement()) {
52902        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
52903        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
52904      }
52905      if (element.hasPaymentAmount()) {
52906        composeMoney("paymentAmount", element.getPaymentAmount());
52907      }
52908      if (element.hasPaymentIdentifier()) {
52909        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
52910      }
52911      if (element.hasDetail()) {
52912        openArray("detail");
52913        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
52914          composeDetailsComponent(null, e);
52915        closeArray();
52916      };
52917      if (element.hasFormCode()) {
52918        composeCodeableConcept("formCode", element.getFormCode());
52919      }
52920      if (element.hasProcessNote()) {
52921        openArray("processNote");
52922        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
52923          composeNotesComponent(null, e);
52924        closeArray();
52925      };
52926  }
52927
52928  protected void composeDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
52929    if (element != null) {
52930      open(name);
52931      composeDetailsComponentProperties(element);
52932      close();
52933    }
52934  }
52935
52936  protected void composeDetailsComponentProperties(PaymentReconciliation.DetailsComponent element) throws IOException {
52937    composeBackboneElementProperties(element);
52938      if (element.hasIdentifier()) {
52939        composeIdentifier("identifier", element.getIdentifier());
52940      }
52941      if (element.hasPredecessor()) {
52942        composeIdentifier("predecessor", element.getPredecessor());
52943      }
52944      if (element.hasType()) {
52945        composeCodeableConcept("type", element.getType());
52946      }
52947      if (element.hasRequest()) {
52948        composeReference("request", element.getRequest());
52949      }
52950      if (element.hasSubmitter()) {
52951        composeReference("submitter", element.getSubmitter());
52952      }
52953      if (element.hasResponse()) {
52954        composeReference("response", element.getResponse());
52955      }
52956      if (element.hasDateElement()) {
52957        composeDateCore("date", element.getDateElement(), false);
52958        composeDateExtras("date", element.getDateElement(), false);
52959      }
52960      if (element.hasResponsible()) {
52961        composeReference("responsible", element.getResponsible());
52962      }
52963      if (element.hasPayee()) {
52964        composeReference("payee", element.getPayee());
52965      }
52966      if (element.hasAmount()) {
52967        composeMoney("amount", element.getAmount());
52968      }
52969  }
52970
52971  protected void composeNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
52972    if (element != null) {
52973      open(name);
52974      composeNotesComponentProperties(element);
52975      close();
52976    }
52977  }
52978
52979  protected void composeNotesComponentProperties(PaymentReconciliation.NotesComponent element) throws IOException {
52980    composeBackboneElementProperties(element);
52981      if (element.hasTypeElement()) {
52982        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
52983        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
52984      }
52985      if (element.hasTextElement()) {
52986        composeStringCore("text", element.getTextElement(), false);
52987        composeStringExtras("text", element.getTextElement(), false);
52988      }
52989  }
52990
52991  protected void composePerson(String name, Person element) throws IOException {
52992    if (element != null) {
52993      prop("resourceType", name);
52994      composePersonProperties(element);
52995    }
52996  }
52997
52998  protected void composePersonProperties(Person element) throws IOException {
52999    composeDomainResourceProperties(element);
53000      if (element.hasIdentifier()) {
53001        openArray("identifier");
53002        for (Identifier e : element.getIdentifier()) 
53003          composeIdentifier(null, e);
53004        closeArray();
53005      };
53006      if (element.hasName()) {
53007        openArray("name");
53008        for (HumanName e : element.getName()) 
53009          composeHumanName(null, e);
53010        closeArray();
53011      };
53012      if (element.hasTelecom()) {
53013        openArray("telecom");
53014        for (ContactPoint e : element.getTelecom()) 
53015          composeContactPoint(null, e);
53016        closeArray();
53017      };
53018      if (element.hasGenderElement()) {
53019        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53020        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53021      }
53022      if (element.hasBirthDateElement()) {
53023        composeDateCore("birthDate", element.getBirthDateElement(), false);
53024        composeDateExtras("birthDate", element.getBirthDateElement(), false);
53025      }
53026      if (element.hasAddress()) {
53027        openArray("address");
53028        for (Address e : element.getAddress()) 
53029          composeAddress(null, e);
53030        closeArray();
53031      };
53032      if (element.hasPhoto()) {
53033        composeAttachment("photo", element.getPhoto());
53034      }
53035      if (element.hasManagingOrganization()) {
53036        composeReference("managingOrganization", element.getManagingOrganization());
53037      }
53038      if (element.hasActiveElement()) {
53039        composeBooleanCore("active", element.getActiveElement(), false);
53040        composeBooleanExtras("active", element.getActiveElement(), false);
53041      }
53042      if (element.hasLink()) {
53043        openArray("link");
53044        for (Person.PersonLinkComponent e : element.getLink()) 
53045          composePersonLinkComponent(null, e);
53046        closeArray();
53047      };
53048  }
53049
53050  protected void composePersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
53051    if (element != null) {
53052      open(name);
53053      composePersonLinkComponentProperties(element);
53054      close();
53055    }
53056  }
53057
53058  protected void composePersonLinkComponentProperties(Person.PersonLinkComponent element) throws IOException {
53059    composeBackboneElementProperties(element);
53060      if (element.hasTarget()) {
53061        composeReference("target", element.getTarget());
53062      }
53063      if (element.hasAssuranceElement()) {
53064        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
53065        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
53066      }
53067  }
53068
53069  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
53070    if (element != null) {
53071      prop("resourceType", name);
53072      composePlanDefinitionProperties(element);
53073    }
53074  }
53075
53076  protected void composePlanDefinitionProperties(PlanDefinition element) throws IOException {
53077    composeDomainResourceProperties(element);
53078      if (element.hasUrlElement()) {
53079        composeUriCore("url", element.getUrlElement(), false);
53080        composeUriExtras("url", element.getUrlElement(), false);
53081      }
53082      if (element.hasIdentifier()) {
53083        openArray("identifier");
53084        for (Identifier e : element.getIdentifier()) 
53085          composeIdentifier(null, e);
53086        closeArray();
53087      };
53088      if (element.hasVersionElement()) {
53089        composeStringCore("version", element.getVersionElement(), false);
53090        composeStringExtras("version", element.getVersionElement(), false);
53091      }
53092      if (element.hasNameElement()) {
53093        composeStringCore("name", element.getNameElement(), false);
53094        composeStringExtras("name", element.getNameElement(), false);
53095      }
53096      if (element.hasTitleElement()) {
53097        composeStringCore("title", element.getTitleElement(), false);
53098        composeStringExtras("title", element.getTitleElement(), false);
53099      }
53100      if (element.hasSubtitleElement()) {
53101        composeStringCore("subtitle", element.getSubtitleElement(), false);
53102        composeStringExtras("subtitle", element.getSubtitleElement(), false);
53103      }
53104      if (element.hasType()) {
53105        composeCodeableConcept("type", element.getType());
53106      }
53107      if (element.hasStatusElement()) {
53108        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53109        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53110      }
53111      if (element.hasExperimentalElement()) {
53112        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53113        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53114      }
53115      if (element.hasSubject()) {
53116        composeType("subject", element.getSubject());
53117      }
53118      if (element.hasDateElement()) {
53119        composeDateTimeCore("date", element.getDateElement(), false);
53120        composeDateTimeExtras("date", element.getDateElement(), false);
53121      }
53122      if (element.hasPublisherElement()) {
53123        composeStringCore("publisher", element.getPublisherElement(), false);
53124        composeStringExtras("publisher", element.getPublisherElement(), false);
53125      }
53126      if (element.hasContact()) {
53127        openArray("contact");
53128        for (ContactDetail e : element.getContact()) 
53129          composeContactDetail(null, e);
53130        closeArray();
53131      };
53132      if (element.hasDescriptionElement()) {
53133        composeMarkdownCore("description", element.getDescriptionElement(), false);
53134        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53135      }
53136      if (element.hasUseContext()) {
53137        openArray("useContext");
53138        for (UsageContext e : element.getUseContext()) 
53139          composeUsageContext(null, e);
53140        closeArray();
53141      };
53142      if (element.hasJurisdiction()) {
53143        openArray("jurisdiction");
53144        for (CodeableConcept e : element.getJurisdiction()) 
53145          composeCodeableConcept(null, e);
53146        closeArray();
53147      };
53148      if (element.hasPurposeElement()) {
53149        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53150        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53151      }
53152      if (element.hasUsageElement()) {
53153        composeStringCore("usage", element.getUsageElement(), false);
53154        composeStringExtras("usage", element.getUsageElement(), false);
53155      }
53156      if (element.hasCopyrightElement()) {
53157        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
53158        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
53159      }
53160      if (element.hasApprovalDateElement()) {
53161        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
53162        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
53163      }
53164      if (element.hasLastReviewDateElement()) {
53165        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
53166        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
53167      }
53168      if (element.hasEffectivePeriod()) {
53169        composePeriod("effectivePeriod", element.getEffectivePeriod());
53170      }
53171      if (element.hasTopic()) {
53172        openArray("topic");
53173        for (CodeableConcept e : element.getTopic()) 
53174          composeCodeableConcept(null, e);
53175        closeArray();
53176      };
53177      if (element.hasAuthor()) {
53178        openArray("author");
53179        for (ContactDetail e : element.getAuthor()) 
53180          composeContactDetail(null, e);
53181        closeArray();
53182      };
53183      if (element.hasEditor()) {
53184        openArray("editor");
53185        for (ContactDetail e : element.getEditor()) 
53186          composeContactDetail(null, e);
53187        closeArray();
53188      };
53189      if (element.hasReviewer()) {
53190        openArray("reviewer");
53191        for (ContactDetail e : element.getReviewer()) 
53192          composeContactDetail(null, e);
53193        closeArray();
53194      };
53195      if (element.hasEndorser()) {
53196        openArray("endorser");
53197        for (ContactDetail e : element.getEndorser()) 
53198          composeContactDetail(null, e);
53199        closeArray();
53200      };
53201      if (element.hasRelatedArtifact()) {
53202        openArray("relatedArtifact");
53203        for (RelatedArtifact e : element.getRelatedArtifact()) 
53204          composeRelatedArtifact(null, e);
53205        closeArray();
53206      };
53207      if (element.hasLibrary()) {
53208        if (anyHasValue(element.getLibrary())) {
53209          openArray("library");
53210          for (CanonicalType e : element.getLibrary()) 
53211            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
53212          closeArray();
53213        }
53214        if (anyHasExtras(element.getLibrary())) {
53215          openArray("_library");
53216          for (CanonicalType e : element.getLibrary()) 
53217            composeCanonicalExtras(null, e, true);
53218          closeArray();
53219        }
53220      };
53221      if (element.hasGoal()) {
53222        openArray("goal");
53223        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
53224          composePlanDefinitionGoalComponent(null, e);
53225        closeArray();
53226      };
53227      if (element.hasAction()) {
53228        openArray("action");
53229        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
53230          composePlanDefinitionActionComponent(null, e);
53231        closeArray();
53232      };
53233  }
53234
53235  protected void composePlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
53236    if (element != null) {
53237      open(name);
53238      composePlanDefinitionGoalComponentProperties(element);
53239      close();
53240    }
53241  }
53242
53243  protected void composePlanDefinitionGoalComponentProperties(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
53244    composeBackboneElementProperties(element);
53245      if (element.hasCategory()) {
53246        composeCodeableConcept("category", element.getCategory());
53247      }
53248      if (element.hasDescription()) {
53249        composeCodeableConcept("description", element.getDescription());
53250      }
53251      if (element.hasPriority()) {
53252        composeCodeableConcept("priority", element.getPriority());
53253      }
53254      if (element.hasStart()) {
53255        composeCodeableConcept("start", element.getStart());
53256      }
53257      if (element.hasAddresses()) {
53258        openArray("addresses");
53259        for (CodeableConcept e : element.getAddresses()) 
53260          composeCodeableConcept(null, e);
53261        closeArray();
53262      };
53263      if (element.hasDocumentation()) {
53264        openArray("documentation");
53265        for (RelatedArtifact e : element.getDocumentation()) 
53266          composeRelatedArtifact(null, e);
53267        closeArray();
53268      };
53269      if (element.hasTarget()) {
53270        openArray("target");
53271        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
53272          composePlanDefinitionGoalTargetComponent(null, e);
53273        closeArray();
53274      };
53275  }
53276
53277  protected void composePlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
53278    if (element != null) {
53279      open(name);
53280      composePlanDefinitionGoalTargetComponentProperties(element);
53281      close();
53282    }
53283  }
53284
53285  protected void composePlanDefinitionGoalTargetComponentProperties(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
53286    composeBackboneElementProperties(element);
53287      if (element.hasMeasure()) {
53288        composeCodeableConcept("measure", element.getMeasure());
53289      }
53290      if (element.hasDetail()) {
53291        composeType("detail", element.getDetail());
53292      }
53293      if (element.hasDue()) {
53294        composeDuration("due", element.getDue());
53295      }
53296  }
53297
53298  protected void composePlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
53299    if (element != null) {
53300      open(name);
53301      composePlanDefinitionActionComponentProperties(element);
53302      close();
53303    }
53304  }
53305
53306  protected void composePlanDefinitionActionComponentProperties(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
53307    composeBackboneElementProperties(element);
53308      if (element.hasPrefixElement()) {
53309        composeStringCore("prefix", element.getPrefixElement(), false);
53310        composeStringExtras("prefix", element.getPrefixElement(), false);
53311      }
53312      if (element.hasTitleElement()) {
53313        composeStringCore("title", element.getTitleElement(), false);
53314        composeStringExtras("title", element.getTitleElement(), false);
53315      }
53316      if (element.hasDescriptionElement()) {
53317        composeStringCore("description", element.getDescriptionElement(), false);
53318        composeStringExtras("description", element.getDescriptionElement(), false);
53319      }
53320      if (element.hasTextEquivalentElement()) {
53321        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
53322        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
53323      }
53324      if (element.hasPriorityElement()) {
53325        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
53326        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
53327      }
53328      if (element.hasCode()) {
53329        openArray("code");
53330        for (CodeableConcept e : element.getCode()) 
53331          composeCodeableConcept(null, e);
53332        closeArray();
53333      };
53334      if (element.hasReason()) {
53335        openArray("reason");
53336        for (CodeableConcept e : element.getReason()) 
53337          composeCodeableConcept(null, e);
53338        closeArray();
53339      };
53340      if (element.hasDocumentation()) {
53341        openArray("documentation");
53342        for (RelatedArtifact e : element.getDocumentation()) 
53343          composeRelatedArtifact(null, e);
53344        closeArray();
53345      };
53346      if (element.hasGoalId()) {
53347        if (anyHasValue(element.getGoalId())) {
53348          openArray("goalId");
53349          for (IdType e : element.getGoalId()) 
53350            composeIdCore(null, e, e != element.getGoalId().get(element.getGoalId().size()-1));
53351          closeArray();
53352        }
53353        if (anyHasExtras(element.getGoalId())) {
53354          openArray("_goalId");
53355          for (IdType e : element.getGoalId()) 
53356            composeIdExtras(null, e, true);
53357          closeArray();
53358        }
53359      };
53360      if (element.hasSubject()) {
53361        composeType("subject", element.getSubject());
53362      }
53363      if (element.hasTrigger()) {
53364        openArray("trigger");
53365        for (TriggerDefinition e : element.getTrigger()) 
53366          composeTriggerDefinition(null, e);
53367        closeArray();
53368      };
53369      if (element.hasCondition()) {
53370        openArray("condition");
53371        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
53372          composePlanDefinitionActionConditionComponent(null, e);
53373        closeArray();
53374      };
53375      if (element.hasInput()) {
53376        openArray("input");
53377        for (DataRequirement e : element.getInput()) 
53378          composeDataRequirement(null, e);
53379        closeArray();
53380      };
53381      if (element.hasOutput()) {
53382        openArray("output");
53383        for (DataRequirement e : element.getOutput()) 
53384          composeDataRequirement(null, e);
53385        closeArray();
53386      };
53387      if (element.hasRelatedAction()) {
53388        openArray("relatedAction");
53389        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
53390          composePlanDefinitionActionRelatedActionComponent(null, e);
53391        closeArray();
53392      };
53393      if (element.hasTiming()) {
53394        composeType("timing", element.getTiming());
53395      }
53396      if (element.hasParticipant()) {
53397        openArray("participant");
53398        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
53399          composePlanDefinitionActionParticipantComponent(null, e);
53400        closeArray();
53401      };
53402      if (element.hasType()) {
53403        composeCodeableConcept("type", element.getType());
53404      }
53405      if (element.hasGroupingBehaviorElement()) {
53406        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
53407        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
53408      }
53409      if (element.hasSelectionBehaviorElement()) {
53410        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
53411        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
53412      }
53413      if (element.hasRequiredBehaviorElement()) {
53414        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
53415        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
53416      }
53417      if (element.hasPrecheckBehaviorElement()) {
53418        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
53419        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
53420      }
53421      if (element.hasCardinalityBehaviorElement()) {
53422        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
53423        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
53424      }
53425      if (element.hasDefinition()) {
53426        composeType("definition", element.getDefinition());
53427      }
53428      if (element.hasTransformElement()) {
53429        composeCanonicalCore("transform", element.getTransformElement(), false);
53430        composeCanonicalExtras("transform", element.getTransformElement(), false);
53431      }
53432      if (element.hasDynamicValue()) {
53433        openArray("dynamicValue");
53434        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
53435          composePlanDefinitionActionDynamicValueComponent(null, e);
53436        closeArray();
53437      };
53438      if (element.hasAction()) {
53439        openArray("action");
53440        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
53441          composePlanDefinitionActionComponent(null, e);
53442        closeArray();
53443      };
53444  }
53445
53446  protected void composePlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
53447    if (element != null) {
53448      open(name);
53449      composePlanDefinitionActionConditionComponentProperties(element);
53450      close();
53451    }
53452  }
53453
53454  protected void composePlanDefinitionActionConditionComponentProperties(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
53455    composeBackboneElementProperties(element);
53456      if (element.hasKindElement()) {
53457        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
53458        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
53459      }
53460      if (element.hasExpression()) {
53461        composeExpression("expression", element.getExpression());
53462      }
53463  }
53464
53465  protected void composePlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
53466    if (element != null) {
53467      open(name);
53468      composePlanDefinitionActionRelatedActionComponentProperties(element);
53469      close();
53470    }
53471  }
53472
53473  protected void composePlanDefinitionActionRelatedActionComponentProperties(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
53474    composeBackboneElementProperties(element);
53475      if (element.hasActionIdElement()) {
53476        composeIdCore("actionId", element.getActionIdElement(), false);
53477        composeIdExtras("actionId", element.getActionIdElement(), false);
53478      }
53479      if (element.hasRelationshipElement()) {
53480        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
53481        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
53482      }
53483      if (element.hasOffset()) {
53484        composeType("offset", element.getOffset());
53485      }
53486  }
53487
53488  protected void composePlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
53489    if (element != null) {
53490      open(name);
53491      composePlanDefinitionActionParticipantComponentProperties(element);
53492      close();
53493    }
53494  }
53495
53496  protected void composePlanDefinitionActionParticipantComponentProperties(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
53497    composeBackboneElementProperties(element);
53498      if (element.hasTypeElement()) {
53499        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
53500        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
53501      }
53502      if (element.hasRole()) {
53503        composeCodeableConcept("role", element.getRole());
53504      }
53505  }
53506
53507  protected void composePlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
53508    if (element != null) {
53509      open(name);
53510      composePlanDefinitionActionDynamicValueComponentProperties(element);
53511      close();
53512    }
53513  }
53514
53515  protected void composePlanDefinitionActionDynamicValueComponentProperties(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
53516    composeBackboneElementProperties(element);
53517      if (element.hasPathElement()) {
53518        composeStringCore("path", element.getPathElement(), false);
53519        composeStringExtras("path", element.getPathElement(), false);
53520      }
53521      if (element.hasExpression()) {
53522        composeExpression("expression", element.getExpression());
53523      }
53524  }
53525
53526  protected void composePractitioner(String name, Practitioner element) throws IOException {
53527    if (element != null) {
53528      prop("resourceType", name);
53529      composePractitionerProperties(element);
53530    }
53531  }
53532
53533  protected void composePractitionerProperties(Practitioner element) throws IOException {
53534    composeDomainResourceProperties(element);
53535      if (element.hasIdentifier()) {
53536        openArray("identifier");
53537        for (Identifier e : element.getIdentifier()) 
53538          composeIdentifier(null, e);
53539        closeArray();
53540      };
53541      if (element.hasActiveElement()) {
53542        composeBooleanCore("active", element.getActiveElement(), false);
53543        composeBooleanExtras("active", element.getActiveElement(), false);
53544      }
53545      if (element.hasName()) {
53546        openArray("name");
53547        for (HumanName e : element.getName()) 
53548          composeHumanName(null, e);
53549        closeArray();
53550      };
53551      if (element.hasTelecom()) {
53552        openArray("telecom");
53553        for (ContactPoint e : element.getTelecom()) 
53554          composeContactPoint(null, e);
53555        closeArray();
53556      };
53557      if (element.hasAddress()) {
53558        openArray("address");
53559        for (Address e : element.getAddress()) 
53560          composeAddress(null, e);
53561        closeArray();
53562      };
53563      if (element.hasGenderElement()) {
53564        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53565        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53566      }
53567      if (element.hasBirthDateElement()) {
53568        composeDateCore("birthDate", element.getBirthDateElement(), false);
53569        composeDateExtras("birthDate", element.getBirthDateElement(), false);
53570      }
53571      if (element.hasPhoto()) {
53572        openArray("photo");
53573        for (Attachment e : element.getPhoto()) 
53574          composeAttachment(null, e);
53575        closeArray();
53576      };
53577      if (element.hasQualification()) {
53578        openArray("qualification");
53579        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
53580          composePractitionerQualificationComponent(null, e);
53581        closeArray();
53582      };
53583      if (element.hasCommunication()) {
53584        openArray("communication");
53585        for (CodeableConcept e : element.getCommunication()) 
53586          composeCodeableConcept(null, e);
53587        closeArray();
53588      };
53589  }
53590
53591  protected void composePractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
53592    if (element != null) {
53593      open(name);
53594      composePractitionerQualificationComponentProperties(element);
53595      close();
53596    }
53597  }
53598
53599  protected void composePractitionerQualificationComponentProperties(Practitioner.PractitionerQualificationComponent element) throws IOException {
53600    composeBackboneElementProperties(element);
53601      if (element.hasIdentifier()) {
53602        openArray("identifier");
53603        for (Identifier e : element.getIdentifier()) 
53604          composeIdentifier(null, e);
53605        closeArray();
53606      };
53607      if (element.hasCode()) {
53608        composeCodeableConcept("code", element.getCode());
53609      }
53610      if (element.hasPeriod()) {
53611        composePeriod("period", element.getPeriod());
53612      }
53613      if (element.hasIssuer()) {
53614        composeReference("issuer", element.getIssuer());
53615      }
53616  }
53617
53618  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
53619    if (element != null) {
53620      prop("resourceType", name);
53621      composePractitionerRoleProperties(element);
53622    }
53623  }
53624
53625  protected void composePractitionerRoleProperties(PractitionerRole element) throws IOException {
53626    composeDomainResourceProperties(element);
53627      if (element.hasIdentifier()) {
53628        openArray("identifier");
53629        for (Identifier e : element.getIdentifier()) 
53630          composeIdentifier(null, e);
53631        closeArray();
53632      };
53633      if (element.hasActiveElement()) {
53634        composeBooleanCore("active", element.getActiveElement(), false);
53635        composeBooleanExtras("active", element.getActiveElement(), false);
53636      }
53637      if (element.hasPeriod()) {
53638        composePeriod("period", element.getPeriod());
53639      }
53640      if (element.hasPractitioner()) {
53641        composeReference("practitioner", element.getPractitioner());
53642      }
53643      if (element.hasOrganization()) {
53644        composeReference("organization", element.getOrganization());
53645      }
53646      if (element.hasCode()) {
53647        openArray("code");
53648        for (CodeableConcept e : element.getCode()) 
53649          composeCodeableConcept(null, e);
53650        closeArray();
53651      };
53652      if (element.hasSpecialty()) {
53653        openArray("specialty");
53654        for (CodeableConcept e : element.getSpecialty()) 
53655          composeCodeableConcept(null, e);
53656        closeArray();
53657      };
53658      if (element.hasLocation()) {
53659        openArray("location");
53660        for (Reference e : element.getLocation()) 
53661          composeReference(null, e);
53662        closeArray();
53663      };
53664      if (element.hasHealthcareService()) {
53665        openArray("healthcareService");
53666        for (Reference e : element.getHealthcareService()) 
53667          composeReference(null, e);
53668        closeArray();
53669      };
53670      if (element.hasTelecom()) {
53671        openArray("telecom");
53672        for (ContactPoint e : element.getTelecom()) 
53673          composeContactPoint(null, e);
53674        closeArray();
53675      };
53676      if (element.hasAvailableTime()) {
53677        openArray("availableTime");
53678        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
53679          composePractitionerRoleAvailableTimeComponent(null, e);
53680        closeArray();
53681      };
53682      if (element.hasNotAvailable()) {
53683        openArray("notAvailable");
53684        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
53685          composePractitionerRoleNotAvailableComponent(null, e);
53686        closeArray();
53687      };
53688      if (element.hasAvailabilityExceptionsElement()) {
53689        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
53690        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
53691      }
53692      if (element.hasEndpoint()) {
53693        openArray("endpoint");
53694        for (Reference e : element.getEndpoint()) 
53695          composeReference(null, e);
53696        closeArray();
53697      };
53698  }
53699
53700  protected void composePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
53701    if (element != null) {
53702      open(name);
53703      composePractitionerRoleAvailableTimeComponentProperties(element);
53704      close();
53705    }
53706  }
53707
53708  protected void composePractitionerRoleAvailableTimeComponentProperties(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
53709    composeBackboneElementProperties(element);
53710      if (element.hasDaysOfWeek()) {
53711        openArray("daysOfWeek");
53712        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
53713          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
53714        closeArray();
53715        if (anyHasExtras(element.getDaysOfWeek())) {
53716          openArray("_daysOfWeek");
53717          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
53718            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
53719          closeArray();
53720        }
53721      };
53722      if (element.hasAllDayElement()) {
53723        composeBooleanCore("allDay", element.getAllDayElement(), false);
53724        composeBooleanExtras("allDay", element.getAllDayElement(), false);
53725      }
53726      if (element.hasAvailableStartTimeElement()) {
53727        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
53728        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
53729      }
53730      if (element.hasAvailableEndTimeElement()) {
53731        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
53732        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
53733      }
53734  }
53735
53736  protected void composePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
53737    if (element != null) {
53738      open(name);
53739      composePractitionerRoleNotAvailableComponentProperties(element);
53740      close();
53741    }
53742  }
53743
53744  protected void composePractitionerRoleNotAvailableComponentProperties(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
53745    composeBackboneElementProperties(element);
53746      if (element.hasDescriptionElement()) {
53747        composeStringCore("description", element.getDescriptionElement(), false);
53748        composeStringExtras("description", element.getDescriptionElement(), false);
53749      }
53750      if (element.hasDuring()) {
53751        composePeriod("during", element.getDuring());
53752      }
53753  }
53754
53755  protected void composeProcedure(String name, Procedure element) throws IOException {
53756    if (element != null) {
53757      prop("resourceType", name);
53758      composeProcedureProperties(element);
53759    }
53760  }
53761
53762  protected void composeProcedureProperties(Procedure element) throws IOException {
53763    composeDomainResourceProperties(element);
53764      if (element.hasIdentifier()) {
53765        openArray("identifier");
53766        for (Identifier e : element.getIdentifier()) 
53767          composeIdentifier(null, e);
53768        closeArray();
53769      };
53770      if (element.hasInstantiatesCanonical()) {
53771        if (anyHasValue(element.getInstantiatesCanonical())) {
53772          openArray("instantiatesCanonical");
53773          for (CanonicalType e : element.getInstantiatesCanonical()) 
53774            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
53775          closeArray();
53776        }
53777        if (anyHasExtras(element.getInstantiatesCanonical())) {
53778          openArray("_instantiatesCanonical");
53779          for (CanonicalType e : element.getInstantiatesCanonical()) 
53780            composeCanonicalExtras(null, e, true);
53781          closeArray();
53782        }
53783      };
53784      if (element.hasInstantiatesUri()) {
53785        if (anyHasValue(element.getInstantiatesUri())) {
53786          openArray("instantiatesUri");
53787          for (UriType e : element.getInstantiatesUri()) 
53788            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
53789          closeArray();
53790        }
53791        if (anyHasExtras(element.getInstantiatesUri())) {
53792          openArray("_instantiatesUri");
53793          for (UriType e : element.getInstantiatesUri()) 
53794            composeUriExtras(null, e, true);
53795          closeArray();
53796        }
53797      };
53798      if (element.hasBasedOn()) {
53799        openArray("basedOn");
53800        for (Reference e : element.getBasedOn()) 
53801          composeReference(null, e);
53802        closeArray();
53803      };
53804      if (element.hasPartOf()) {
53805        openArray("partOf");
53806        for (Reference e : element.getPartOf()) 
53807          composeReference(null, e);
53808        closeArray();
53809      };
53810      if (element.hasStatusElement()) {
53811        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
53812        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
53813      }
53814      if (element.hasStatusReason()) {
53815        composeCodeableConcept("statusReason", element.getStatusReason());
53816      }
53817      if (element.hasCategory()) {
53818        composeCodeableConcept("category", element.getCategory());
53819      }
53820      if (element.hasCode()) {
53821        composeCodeableConcept("code", element.getCode());
53822      }
53823      if (element.hasSubject()) {
53824        composeReference("subject", element.getSubject());
53825      }
53826      if (element.hasEncounter()) {
53827        composeReference("encounter", element.getEncounter());
53828      }
53829      if (element.hasPerformed()) {
53830        composeType("performed", element.getPerformed());
53831      }
53832      if (element.hasRecorder()) {
53833        composeReference("recorder", element.getRecorder());
53834      }
53835      if (element.hasAsserter()) {
53836        composeReference("asserter", element.getAsserter());
53837      }
53838      if (element.hasPerformer()) {
53839        openArray("performer");
53840        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
53841          composeProcedurePerformerComponent(null, e);
53842        closeArray();
53843      };
53844      if (element.hasLocation()) {
53845        composeReference("location", element.getLocation());
53846      }
53847      if (element.hasReasonCode()) {
53848        openArray("reasonCode");
53849        for (CodeableConcept e : element.getReasonCode()) 
53850          composeCodeableConcept(null, e);
53851        closeArray();
53852      };
53853      if (element.hasReasonReference()) {
53854        openArray("reasonReference");
53855        for (Reference e : element.getReasonReference()) 
53856          composeReference(null, e);
53857        closeArray();
53858      };
53859      if (element.hasBodySite()) {
53860        openArray("bodySite");
53861        for (CodeableConcept e : element.getBodySite()) 
53862          composeCodeableConcept(null, e);
53863        closeArray();
53864      };
53865      if (element.hasOutcome()) {
53866        composeCodeableConcept("outcome", element.getOutcome());
53867      }
53868      if (element.hasReport()) {
53869        openArray("report");
53870        for (Reference e : element.getReport()) 
53871          composeReference(null, e);
53872        closeArray();
53873      };
53874      if (element.hasComplication()) {
53875        openArray("complication");
53876        for (CodeableConcept e : element.getComplication()) 
53877          composeCodeableConcept(null, e);
53878        closeArray();
53879      };
53880      if (element.hasComplicationDetail()) {
53881        openArray("complicationDetail");
53882        for (Reference e : element.getComplicationDetail()) 
53883          composeReference(null, e);
53884        closeArray();
53885      };
53886      if (element.hasFollowUp()) {
53887        openArray("followUp");
53888        for (CodeableConcept e : element.getFollowUp()) 
53889          composeCodeableConcept(null, e);
53890        closeArray();
53891      };
53892      if (element.hasNote()) {
53893        openArray("note");
53894        for (Annotation e : element.getNote()) 
53895          composeAnnotation(null, e);
53896        closeArray();
53897      };
53898      if (element.hasFocalDevice()) {
53899        openArray("focalDevice");
53900        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
53901          composeProcedureFocalDeviceComponent(null, e);
53902        closeArray();
53903      };
53904      if (element.hasUsedReference()) {
53905        openArray("usedReference");
53906        for (Reference e : element.getUsedReference()) 
53907          composeReference(null, e);
53908        closeArray();
53909      };
53910      if (element.hasUsedCode()) {
53911        openArray("usedCode");
53912        for (CodeableConcept e : element.getUsedCode()) 
53913          composeCodeableConcept(null, e);
53914        closeArray();
53915      };
53916  }
53917
53918  protected void composeProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
53919    if (element != null) {
53920      open(name);
53921      composeProcedurePerformerComponentProperties(element);
53922      close();
53923    }
53924  }
53925
53926  protected void composeProcedurePerformerComponentProperties(Procedure.ProcedurePerformerComponent element) throws IOException {
53927    composeBackboneElementProperties(element);
53928      if (element.hasFunction()) {
53929        composeCodeableConcept("function", element.getFunction());
53930      }
53931      if (element.hasActor()) {
53932        composeReference("actor", element.getActor());
53933      }
53934      if (element.hasOnBehalfOf()) {
53935        composeReference("onBehalfOf", element.getOnBehalfOf());
53936      }
53937  }
53938
53939  protected void composeProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
53940    if (element != null) {
53941      open(name);
53942      composeProcedureFocalDeviceComponentProperties(element);
53943      close();
53944    }
53945  }
53946
53947  protected void composeProcedureFocalDeviceComponentProperties(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
53948    composeBackboneElementProperties(element);
53949      if (element.hasAction()) {
53950        composeCodeableConcept("action", element.getAction());
53951      }
53952      if (element.hasManipulated()) {
53953        composeReference("manipulated", element.getManipulated());
53954      }
53955  }
53956
53957  protected void composeProvenance(String name, Provenance element) throws IOException {
53958    if (element != null) {
53959      prop("resourceType", name);
53960      composeProvenanceProperties(element);
53961    }
53962  }
53963
53964  protected void composeProvenanceProperties(Provenance element) throws IOException {
53965    composeDomainResourceProperties(element);
53966      if (element.hasTarget()) {
53967        openArray("target");
53968        for (Reference e : element.getTarget()) 
53969          composeReference(null, e);
53970        closeArray();
53971      };
53972      if (element.hasOccurred()) {
53973        composeType("occurred", element.getOccurred());
53974      }
53975      if (element.hasRecordedElement()) {
53976        composeInstantCore("recorded", element.getRecordedElement(), false);
53977        composeInstantExtras("recorded", element.getRecordedElement(), false);
53978      }
53979      if (element.hasPolicy()) {
53980        if (anyHasValue(element.getPolicy())) {
53981          openArray("policy");
53982          for (UriType e : element.getPolicy()) 
53983            composeUriCore(null, e, e != element.getPolicy().get(element.getPolicy().size()-1));
53984          closeArray();
53985        }
53986        if (anyHasExtras(element.getPolicy())) {
53987          openArray("_policy");
53988          for (UriType e : element.getPolicy()) 
53989            composeUriExtras(null, e, true);
53990          closeArray();
53991        }
53992      };
53993      if (element.hasLocation()) {
53994        composeReference("location", element.getLocation());
53995      }
53996      if (element.hasReason()) {
53997        openArray("reason");
53998        for (CodeableConcept e : element.getReason()) 
53999          composeCodeableConcept(null, e);
54000        closeArray();
54001      };
54002      if (element.hasActivity()) {
54003        composeCodeableConcept("activity", element.getActivity());
54004      }
54005      if (element.hasAgent()) {
54006        openArray("agent");
54007        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
54008          composeProvenanceAgentComponent(null, e);
54009        closeArray();
54010      };
54011      if (element.hasEntity()) {
54012        openArray("entity");
54013        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
54014          composeProvenanceEntityComponent(null, e);
54015        closeArray();
54016      };
54017      if (element.hasSignature()) {
54018        openArray("signature");
54019        for (Signature e : element.getSignature()) 
54020          composeSignature(null, e);
54021        closeArray();
54022      };
54023  }
54024
54025  protected void composeProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
54026    if (element != null) {
54027      open(name);
54028      composeProvenanceAgentComponentProperties(element);
54029      close();
54030    }
54031  }
54032
54033  protected void composeProvenanceAgentComponentProperties(Provenance.ProvenanceAgentComponent element) throws IOException {
54034    composeBackboneElementProperties(element);
54035      if (element.hasType()) {
54036        composeCodeableConcept("type", element.getType());
54037      }
54038      if (element.hasRole()) {
54039        openArray("role");
54040        for (CodeableConcept e : element.getRole()) 
54041          composeCodeableConcept(null, e);
54042        closeArray();
54043      };
54044      if (element.hasWho()) {
54045        composeReference("who", element.getWho());
54046      }
54047      if (element.hasOnBehalfOf()) {
54048        composeReference("onBehalfOf", element.getOnBehalfOf());
54049      }
54050  }
54051
54052  protected void composeProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
54053    if (element != null) {
54054      open(name);
54055      composeProvenanceEntityComponentProperties(element);
54056      close();
54057    }
54058  }
54059
54060  protected void composeProvenanceEntityComponentProperties(Provenance.ProvenanceEntityComponent element) throws IOException {
54061    composeBackboneElementProperties(element);
54062      if (element.hasRoleElement()) {
54063        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
54064        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
54065      }
54066      if (element.hasWhat()) {
54067        composeReference("what", element.getWhat());
54068      }
54069      if (element.hasAgent()) {
54070        openArray("agent");
54071        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
54072          composeProvenanceAgentComponent(null, e);
54073        closeArray();
54074      };
54075  }
54076
54077  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
54078    if (element != null) {
54079      prop("resourceType", name);
54080      composeQuestionnaireProperties(element);
54081    }
54082  }
54083
54084  protected void composeQuestionnaireProperties(Questionnaire element) throws IOException {
54085    composeDomainResourceProperties(element);
54086      if (element.hasUrlElement()) {
54087        composeUriCore("url", element.getUrlElement(), false);
54088        composeUriExtras("url", element.getUrlElement(), false);
54089      }
54090      if (element.hasIdentifier()) {
54091        openArray("identifier");
54092        for (Identifier e : element.getIdentifier()) 
54093          composeIdentifier(null, e);
54094        closeArray();
54095      };
54096      if (element.hasVersionElement()) {
54097        composeStringCore("version", element.getVersionElement(), false);
54098        composeStringExtras("version", element.getVersionElement(), false);
54099      }
54100      if (element.hasNameElement()) {
54101        composeStringCore("name", element.getNameElement(), false);
54102        composeStringExtras("name", element.getNameElement(), false);
54103      }
54104      if (element.hasTitleElement()) {
54105        composeStringCore("title", element.getTitleElement(), false);
54106        composeStringExtras("title", element.getTitleElement(), false);
54107      }
54108      if (element.hasDerivedFrom()) {
54109        if (anyHasValue(element.getDerivedFrom())) {
54110          openArray("derivedFrom");
54111          for (CanonicalType e : element.getDerivedFrom()) 
54112            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
54113          closeArray();
54114        }
54115        if (anyHasExtras(element.getDerivedFrom())) {
54116          openArray("_derivedFrom");
54117          for (CanonicalType e : element.getDerivedFrom()) 
54118            composeCanonicalExtras(null, e, true);
54119          closeArray();
54120        }
54121      };
54122      if (element.hasStatusElement()) {
54123        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54124        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54125      }
54126      if (element.hasExperimentalElement()) {
54127        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54128        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54129      }
54130      if (element.hasSubjectType()) {
54131        if (anyHasValue(element.getSubjectType())) {
54132          openArray("subjectType");
54133          for (CodeType e : element.getSubjectType()) 
54134            composeCodeCore(null, e, e != element.getSubjectType().get(element.getSubjectType().size()-1));
54135          closeArray();
54136        }
54137        if (anyHasExtras(element.getSubjectType())) {
54138          openArray("_subjectType");
54139          for (CodeType e : element.getSubjectType()) 
54140            composeCodeExtras(null, e, true);
54141          closeArray();
54142        }
54143      };
54144      if (element.hasDateElement()) {
54145        composeDateTimeCore("date", element.getDateElement(), false);
54146        composeDateTimeExtras("date", element.getDateElement(), false);
54147      }
54148      if (element.hasPublisherElement()) {
54149        composeStringCore("publisher", element.getPublisherElement(), false);
54150        composeStringExtras("publisher", element.getPublisherElement(), false);
54151      }
54152      if (element.hasContact()) {
54153        openArray("contact");
54154        for (ContactDetail e : element.getContact()) 
54155          composeContactDetail(null, e);
54156        closeArray();
54157      };
54158      if (element.hasDescriptionElement()) {
54159        composeMarkdownCore("description", element.getDescriptionElement(), false);
54160        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54161      }
54162      if (element.hasUseContext()) {
54163        openArray("useContext");
54164        for (UsageContext e : element.getUseContext()) 
54165          composeUsageContext(null, e);
54166        closeArray();
54167      };
54168      if (element.hasJurisdiction()) {
54169        openArray("jurisdiction");
54170        for (CodeableConcept e : element.getJurisdiction()) 
54171          composeCodeableConcept(null, e);
54172        closeArray();
54173      };
54174      if (element.hasPurposeElement()) {
54175        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54176        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54177      }
54178      if (element.hasCopyrightElement()) {
54179        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54180        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54181      }
54182      if (element.hasApprovalDateElement()) {
54183        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
54184        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
54185      }
54186      if (element.hasLastReviewDateElement()) {
54187        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
54188        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
54189      }
54190      if (element.hasEffectivePeriod()) {
54191        composePeriod("effectivePeriod", element.getEffectivePeriod());
54192      }
54193      if (element.hasCode()) {
54194        openArray("code");
54195        for (Coding e : element.getCode()) 
54196          composeCoding(null, e);
54197        closeArray();
54198      };
54199      if (element.hasItem()) {
54200        openArray("item");
54201        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
54202          composeQuestionnaireItemComponent(null, e);
54203        closeArray();
54204      };
54205  }
54206
54207  protected void composeQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
54208    if (element != null) {
54209      open(name);
54210      composeQuestionnaireItemComponentProperties(element);
54211      close();
54212    }
54213  }
54214
54215  protected void composeQuestionnaireItemComponentProperties(Questionnaire.QuestionnaireItemComponent element) throws IOException {
54216    composeBackboneElementProperties(element);
54217      if (element.hasLinkIdElement()) {
54218        composeStringCore("linkId", element.getLinkIdElement(), false);
54219        composeStringExtras("linkId", element.getLinkIdElement(), false);
54220      }
54221      if (element.hasDefinitionElement()) {
54222        composeUriCore("definition", element.getDefinitionElement(), false);
54223        composeUriExtras("definition", element.getDefinitionElement(), false);
54224      }
54225      if (element.hasCode()) {
54226        openArray("code");
54227        for (Coding e : element.getCode()) 
54228          composeCoding(null, e);
54229        closeArray();
54230      };
54231      if (element.hasPrefixElement()) {
54232        composeStringCore("prefix", element.getPrefixElement(), false);
54233        composeStringExtras("prefix", element.getPrefixElement(), false);
54234      }
54235      if (element.hasTextElement()) {
54236        composeStringCore("text", element.getTextElement(), false);
54237        composeStringExtras("text", element.getTextElement(), false);
54238      }
54239      if (element.hasTypeElement()) {
54240        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
54241        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
54242      }
54243      if (element.hasEnableWhen()) {
54244        openArray("enableWhen");
54245        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
54246          composeQuestionnaireItemEnableWhenComponent(null, e);
54247        closeArray();
54248      };
54249      if (element.hasEnableBehaviorElement()) {
54250        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
54251        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
54252      }
54253      if (element.hasRequiredElement()) {
54254        composeBooleanCore("required", element.getRequiredElement(), false);
54255        composeBooleanExtras("required", element.getRequiredElement(), false);
54256      }
54257      if (element.hasRepeatsElement()) {
54258        composeBooleanCore("repeats", element.getRepeatsElement(), false);
54259        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
54260      }
54261      if (element.hasReadOnlyElement()) {
54262        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
54263        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
54264      }
54265      if (element.hasMaxLengthElement()) {
54266        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
54267        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
54268      }
54269      if (element.hasAnswerValueSetElement()) {
54270        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
54271        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
54272      }
54273      if (element.hasAnswerOption()) {
54274        openArray("answerOption");
54275        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
54276          composeQuestionnaireItemAnswerOptionComponent(null, e);
54277        closeArray();
54278      };
54279      if (element.hasInitial()) {
54280        openArray("initial");
54281        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
54282          composeQuestionnaireItemInitialComponent(null, e);
54283        closeArray();
54284      };
54285      if (element.hasItem()) {
54286        openArray("item");
54287        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
54288          composeQuestionnaireItemComponent(null, e);
54289        closeArray();
54290      };
54291  }
54292
54293  protected void composeQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
54294    if (element != null) {
54295      open(name);
54296      composeQuestionnaireItemEnableWhenComponentProperties(element);
54297      close();
54298    }
54299  }
54300
54301  protected void composeQuestionnaireItemEnableWhenComponentProperties(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
54302    composeBackboneElementProperties(element);
54303      if (element.hasQuestionElement()) {
54304        composeStringCore("question", element.getQuestionElement(), false);
54305        composeStringExtras("question", element.getQuestionElement(), false);
54306      }
54307      if (element.hasOperatorElement()) {
54308        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
54309        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
54310      }
54311      if (element.hasAnswer()) {
54312        composeType("answer", element.getAnswer());
54313      }
54314  }
54315
54316  protected void composeQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
54317    if (element != null) {
54318      open(name);
54319      composeQuestionnaireItemAnswerOptionComponentProperties(element);
54320      close();
54321    }
54322  }
54323
54324  protected void composeQuestionnaireItemAnswerOptionComponentProperties(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
54325    composeBackboneElementProperties(element);
54326      if (element.hasValue()) {
54327        composeType("value", element.getValue());
54328      }
54329      if (element.hasInitialSelectedElement()) {
54330        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
54331        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
54332      }
54333  }
54334
54335  protected void composeQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
54336    if (element != null) {
54337      open(name);
54338      composeQuestionnaireItemInitialComponentProperties(element);
54339      close();
54340    }
54341  }
54342
54343  protected void composeQuestionnaireItemInitialComponentProperties(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
54344    composeBackboneElementProperties(element);
54345      if (element.hasValue()) {
54346        composeType("value", element.getValue());
54347      }
54348  }
54349
54350  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
54351    if (element != null) {
54352      prop("resourceType", name);
54353      composeQuestionnaireResponseProperties(element);
54354    }
54355  }
54356
54357  protected void composeQuestionnaireResponseProperties(QuestionnaireResponse element) throws IOException {
54358    composeDomainResourceProperties(element);
54359      if (element.hasIdentifier()) {
54360        composeIdentifier("identifier", element.getIdentifier());
54361      }
54362      if (element.hasBasedOn()) {
54363        openArray("basedOn");
54364        for (Reference e : element.getBasedOn()) 
54365          composeReference(null, e);
54366        closeArray();
54367      };
54368      if (element.hasPartOf()) {
54369        openArray("partOf");
54370        for (Reference e : element.getPartOf()) 
54371          composeReference(null, e);
54372        closeArray();
54373      };
54374      if (element.hasQuestionnaireElement()) {
54375        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
54376        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
54377      }
54378      if (element.hasStatusElement()) {
54379        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
54380        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
54381      }
54382      if (element.hasSubject()) {
54383        composeReference("subject", element.getSubject());
54384      }
54385      if (element.hasEncounter()) {
54386        composeReference("encounter", element.getEncounter());
54387      }
54388      if (element.hasAuthoredElement()) {
54389        composeDateTimeCore("authored", element.getAuthoredElement(), false);
54390        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
54391      }
54392      if (element.hasAuthor()) {
54393        composeReference("author", element.getAuthor());
54394      }
54395      if (element.hasSource()) {
54396        composeReference("source", element.getSource());
54397      }
54398      if (element.hasItem()) {
54399        openArray("item");
54400        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
54401          composeQuestionnaireResponseItemComponent(null, e);
54402        closeArray();
54403      };
54404  }
54405
54406  protected void composeQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
54407    if (element != null) {
54408      open(name);
54409      composeQuestionnaireResponseItemComponentProperties(element);
54410      close();
54411    }
54412  }
54413
54414  protected void composeQuestionnaireResponseItemComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
54415    composeBackboneElementProperties(element);
54416      if (element.hasLinkIdElement()) {
54417        composeStringCore("linkId", element.getLinkIdElement(), false);
54418        composeStringExtras("linkId", element.getLinkIdElement(), false);
54419      }
54420      if (element.hasDefinitionElement()) {
54421        composeUriCore("definition", element.getDefinitionElement(), false);
54422        composeUriExtras("definition", element.getDefinitionElement(), false);
54423      }
54424      if (element.hasTextElement()) {
54425        composeStringCore("text", element.getTextElement(), false);
54426        composeStringExtras("text", element.getTextElement(), false);
54427      }
54428      if (element.hasAnswer()) {
54429        openArray("answer");
54430        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
54431          composeQuestionnaireResponseItemAnswerComponent(null, e);
54432        closeArray();
54433      };
54434      if (element.hasItem()) {
54435        openArray("item");
54436        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
54437          composeQuestionnaireResponseItemComponent(null, e);
54438        closeArray();
54439      };
54440  }
54441
54442  protected void composeQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
54443    if (element != null) {
54444      open(name);
54445      composeQuestionnaireResponseItemAnswerComponentProperties(element);
54446      close();
54447    }
54448  }
54449
54450  protected void composeQuestionnaireResponseItemAnswerComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
54451    composeBackboneElementProperties(element);
54452      if (element.hasValue()) {
54453        composeType("value", element.getValue());
54454      }
54455      if (element.hasItem()) {
54456        openArray("item");
54457        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
54458          composeQuestionnaireResponseItemComponent(null, e);
54459        closeArray();
54460      };
54461  }
54462
54463  protected void composeRegulatedAuthorization(String name, RegulatedAuthorization element) throws IOException {
54464    if (element != null) {
54465      prop("resourceType", name);
54466      composeRegulatedAuthorizationProperties(element);
54467    }
54468  }
54469
54470  protected void composeRegulatedAuthorizationProperties(RegulatedAuthorization element) throws IOException {
54471    composeDomainResourceProperties(element);
54472      if (element.hasIdentifier()) {
54473        openArray("identifier");
54474        for (Identifier e : element.getIdentifier()) 
54475          composeIdentifier(null, e);
54476        closeArray();
54477      };
54478      if (element.hasSubject()) {
54479        openArray("subject");
54480        for (Reference e : element.getSubject()) 
54481          composeReference(null, e);
54482        closeArray();
54483      };
54484      if (element.hasType()) {
54485        composeCodeableConcept("type", element.getType());
54486      }
54487      if (element.hasDescriptionElement()) {
54488        composeMarkdownCore("description", element.getDescriptionElement(), false);
54489        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54490      }
54491      if (element.hasRegion()) {
54492        openArray("region");
54493        for (CodeableConcept e : element.getRegion()) 
54494          composeCodeableConcept(null, e);
54495        closeArray();
54496      };
54497      if (element.hasStatus()) {
54498        composeCodeableConcept("status", element.getStatus());
54499      }
54500      if (element.hasStatusDateElement()) {
54501        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
54502        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
54503      }
54504      if (element.hasValidityPeriod()) {
54505        composePeriod("validityPeriod", element.getValidityPeriod());
54506      }
54507      if (element.hasIndication()) {
54508        composeCodeableReference("indication", element.getIndication());
54509      }
54510      if (element.hasIntendedUse()) {
54511        composeCodeableConcept("intendedUse", element.getIntendedUse());
54512      }
54513      if (element.hasBasis()) {
54514        openArray("basis");
54515        for (CodeableConcept e : element.getBasis()) 
54516          composeCodeableConcept(null, e);
54517        closeArray();
54518      };
54519      if (element.hasHolder()) {
54520        composeReference("holder", element.getHolder());
54521      }
54522      if (element.hasRegulator()) {
54523        composeReference("regulator", element.getRegulator());
54524      }
54525      if (element.hasCase()) {
54526        composeRegulatedAuthorizationCaseComponent("case", element.getCase());
54527      }
54528  }
54529
54530  protected void composeRegulatedAuthorizationCaseComponent(String name, RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
54531    if (element != null) {
54532      open(name);
54533      composeRegulatedAuthorizationCaseComponentProperties(element);
54534      close();
54535    }
54536  }
54537
54538  protected void composeRegulatedAuthorizationCaseComponentProperties(RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
54539    composeBackboneElementProperties(element);
54540      if (element.hasIdentifier()) {
54541        composeIdentifier("identifier", element.getIdentifier());
54542      }
54543      if (element.hasType()) {
54544        composeCodeableConcept("type", element.getType());
54545      }
54546      if (element.hasStatus()) {
54547        composeCodeableConcept("status", element.getStatus());
54548      }
54549      if (element.hasDate()) {
54550        composeType("date", element.getDate());
54551      }
54552      if (element.hasApplication()) {
54553        openArray("application");
54554        for (RegulatedAuthorization.RegulatedAuthorizationCaseComponent e : element.getApplication()) 
54555          composeRegulatedAuthorizationCaseComponent(null, e);
54556        closeArray();
54557      };
54558  }
54559
54560  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
54561    if (element != null) {
54562      prop("resourceType", name);
54563      composeRelatedPersonProperties(element);
54564    }
54565  }
54566
54567  protected void composeRelatedPersonProperties(RelatedPerson element) throws IOException {
54568    composeDomainResourceProperties(element);
54569      if (element.hasIdentifier()) {
54570        openArray("identifier");
54571        for (Identifier e : element.getIdentifier()) 
54572          composeIdentifier(null, e);
54573        closeArray();
54574      };
54575      if (element.hasActiveElement()) {
54576        composeBooleanCore("active", element.getActiveElement(), false);
54577        composeBooleanExtras("active", element.getActiveElement(), false);
54578      }
54579      if (element.hasPatient()) {
54580        composeReference("patient", element.getPatient());
54581      }
54582      if (element.hasRelationship()) {
54583        openArray("relationship");
54584        for (CodeableConcept e : element.getRelationship()) 
54585          composeCodeableConcept(null, e);
54586        closeArray();
54587      };
54588      if (element.hasName()) {
54589        openArray("name");
54590        for (HumanName e : element.getName()) 
54591          composeHumanName(null, e);
54592        closeArray();
54593      };
54594      if (element.hasTelecom()) {
54595        openArray("telecom");
54596        for (ContactPoint e : element.getTelecom()) 
54597          composeContactPoint(null, e);
54598        closeArray();
54599      };
54600      if (element.hasGenderElement()) {
54601        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
54602        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
54603      }
54604      if (element.hasBirthDateElement()) {
54605        composeDateCore("birthDate", element.getBirthDateElement(), false);
54606        composeDateExtras("birthDate", element.getBirthDateElement(), false);
54607      }
54608      if (element.hasAddress()) {
54609        openArray("address");
54610        for (Address e : element.getAddress()) 
54611          composeAddress(null, e);
54612        closeArray();
54613      };
54614      if (element.hasPhoto()) {
54615        openArray("photo");
54616        for (Attachment e : element.getPhoto()) 
54617          composeAttachment(null, e);
54618        closeArray();
54619      };
54620      if (element.hasPeriod()) {
54621        composePeriod("period", element.getPeriod());
54622      }
54623      if (element.hasCommunication()) {
54624        openArray("communication");
54625        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
54626          composeRelatedPersonCommunicationComponent(null, e);
54627        closeArray();
54628      };
54629  }
54630
54631  protected void composeRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
54632    if (element != null) {
54633      open(name);
54634      composeRelatedPersonCommunicationComponentProperties(element);
54635      close();
54636    }
54637  }
54638
54639  protected void composeRelatedPersonCommunicationComponentProperties(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
54640    composeBackboneElementProperties(element);
54641      if (element.hasLanguage()) {
54642        composeCodeableConcept("language", element.getLanguage());
54643      }
54644      if (element.hasPreferredElement()) {
54645        composeBooleanCore("preferred", element.getPreferredElement(), false);
54646        composeBooleanExtras("preferred", element.getPreferredElement(), false);
54647      }
54648  }
54649
54650  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
54651    if (element != null) {
54652      prop("resourceType", name);
54653      composeRequestGroupProperties(element);
54654    }
54655  }
54656
54657  protected void composeRequestGroupProperties(RequestGroup element) throws IOException {
54658    composeDomainResourceProperties(element);
54659      if (element.hasIdentifier()) {
54660        openArray("identifier");
54661        for (Identifier e : element.getIdentifier()) 
54662          composeIdentifier(null, e);
54663        closeArray();
54664      };
54665      if (element.hasInstantiatesCanonical()) {
54666        if (anyHasValue(element.getInstantiatesCanonical())) {
54667          openArray("instantiatesCanonical");
54668          for (CanonicalType e : element.getInstantiatesCanonical()) 
54669            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
54670          closeArray();
54671        }
54672        if (anyHasExtras(element.getInstantiatesCanonical())) {
54673          openArray("_instantiatesCanonical");
54674          for (CanonicalType e : element.getInstantiatesCanonical()) 
54675            composeCanonicalExtras(null, e, true);
54676          closeArray();
54677        }
54678      };
54679      if (element.hasInstantiatesUri()) {
54680        if (anyHasValue(element.getInstantiatesUri())) {
54681          openArray("instantiatesUri");
54682          for (UriType e : element.getInstantiatesUri()) 
54683            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
54684          closeArray();
54685        }
54686        if (anyHasExtras(element.getInstantiatesUri())) {
54687          openArray("_instantiatesUri");
54688          for (UriType e : element.getInstantiatesUri()) 
54689            composeUriExtras(null, e, true);
54690          closeArray();
54691        }
54692      };
54693      if (element.hasBasedOn()) {
54694        openArray("basedOn");
54695        for (Reference e : element.getBasedOn()) 
54696          composeReference(null, e);
54697        closeArray();
54698      };
54699      if (element.hasReplaces()) {
54700        openArray("replaces");
54701        for (Reference e : element.getReplaces()) 
54702          composeReference(null, e);
54703        closeArray();
54704      };
54705      if (element.hasGroupIdentifier()) {
54706        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
54707      }
54708      if (element.hasStatusElement()) {
54709        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
54710        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
54711      }
54712      if (element.hasIntentElement()) {
54713        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
54714        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
54715      }
54716      if (element.hasPriorityElement()) {
54717        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54718        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54719      }
54720      if (element.hasCode()) {
54721        composeCodeableConcept("code", element.getCode());
54722      }
54723      if (element.hasSubject()) {
54724        composeReference("subject", element.getSubject());
54725      }
54726      if (element.hasEncounter()) {
54727        composeReference("encounter", element.getEncounter());
54728      }
54729      if (element.hasAuthoredOnElement()) {
54730        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
54731        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
54732      }
54733      if (element.hasAuthor()) {
54734        composeReference("author", element.getAuthor());
54735      }
54736      if (element.hasReasonCode()) {
54737        openArray("reasonCode");
54738        for (CodeableConcept e : element.getReasonCode()) 
54739          composeCodeableConcept(null, e);
54740        closeArray();
54741      };
54742      if (element.hasReasonReference()) {
54743        openArray("reasonReference");
54744        for (Reference e : element.getReasonReference()) 
54745          composeReference(null, e);
54746        closeArray();
54747      };
54748      if (element.hasNote()) {
54749        openArray("note");
54750        for (Annotation e : element.getNote()) 
54751          composeAnnotation(null, e);
54752        closeArray();
54753      };
54754      if (element.hasAction()) {
54755        openArray("action");
54756        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
54757          composeRequestGroupActionComponent(null, e);
54758        closeArray();
54759      };
54760  }
54761
54762  protected void composeRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
54763    if (element != null) {
54764      open(name);
54765      composeRequestGroupActionComponentProperties(element);
54766      close();
54767    }
54768  }
54769
54770  protected void composeRequestGroupActionComponentProperties(RequestGroup.RequestGroupActionComponent element) throws IOException {
54771    composeBackboneElementProperties(element);
54772      if (element.hasPrefixElement()) {
54773        composeStringCore("prefix", element.getPrefixElement(), false);
54774        composeStringExtras("prefix", element.getPrefixElement(), false);
54775      }
54776      if (element.hasTitleElement()) {
54777        composeStringCore("title", element.getTitleElement(), false);
54778        composeStringExtras("title", element.getTitleElement(), false);
54779      }
54780      if (element.hasDescriptionElement()) {
54781        composeStringCore("description", element.getDescriptionElement(), false);
54782        composeStringExtras("description", element.getDescriptionElement(), false);
54783      }
54784      if (element.hasTextEquivalentElement()) {
54785        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
54786        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
54787      }
54788      if (element.hasPriorityElement()) {
54789        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54790        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54791      }
54792      if (element.hasCode()) {
54793        openArray("code");
54794        for (CodeableConcept e : element.getCode()) 
54795          composeCodeableConcept(null, e);
54796        closeArray();
54797      };
54798      if (element.hasDocumentation()) {
54799        openArray("documentation");
54800        for (RelatedArtifact e : element.getDocumentation()) 
54801          composeRelatedArtifact(null, e);
54802        closeArray();
54803      };
54804      if (element.hasCondition()) {
54805        openArray("condition");
54806        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
54807          composeRequestGroupActionConditionComponent(null, e);
54808        closeArray();
54809      };
54810      if (element.hasRelatedAction()) {
54811        openArray("relatedAction");
54812        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
54813          composeRequestGroupActionRelatedActionComponent(null, e);
54814        closeArray();
54815      };
54816      if (element.hasTiming()) {
54817        composeType("timing", element.getTiming());
54818      }
54819      if (element.hasParticipant()) {
54820        openArray("participant");
54821        for (Reference e : element.getParticipant()) 
54822          composeReference(null, e);
54823        closeArray();
54824      };
54825      if (element.hasType()) {
54826        composeCodeableConcept("type", element.getType());
54827      }
54828      if (element.hasGroupingBehaviorElement()) {
54829        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
54830        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
54831      }
54832      if (element.hasSelectionBehaviorElement()) {
54833        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
54834        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
54835      }
54836      if (element.hasRequiredBehaviorElement()) {
54837        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
54838        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
54839      }
54840      if (element.hasPrecheckBehaviorElement()) {
54841        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
54842        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
54843      }
54844      if (element.hasCardinalityBehaviorElement()) {
54845        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
54846        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
54847      }
54848      if (element.hasResource()) {
54849        composeReference("resource", element.getResource());
54850      }
54851      if (element.hasAction()) {
54852        openArray("action");
54853        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
54854          composeRequestGroupActionComponent(null, e);
54855        closeArray();
54856      };
54857  }
54858
54859  protected void composeRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
54860    if (element != null) {
54861      open(name);
54862      composeRequestGroupActionConditionComponentProperties(element);
54863      close();
54864    }
54865  }
54866
54867  protected void composeRequestGroupActionConditionComponentProperties(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
54868    composeBackboneElementProperties(element);
54869      if (element.hasKindElement()) {
54870        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
54871        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
54872      }
54873      if (element.hasExpression()) {
54874        composeExpression("expression", element.getExpression());
54875      }
54876  }
54877
54878  protected void composeRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
54879    if (element != null) {
54880      open(name);
54881      composeRequestGroupActionRelatedActionComponentProperties(element);
54882      close();
54883    }
54884  }
54885
54886  protected void composeRequestGroupActionRelatedActionComponentProperties(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
54887    composeBackboneElementProperties(element);
54888      if (element.hasActionIdElement()) {
54889        composeIdCore("actionId", element.getActionIdElement(), false);
54890        composeIdExtras("actionId", element.getActionIdElement(), false);
54891      }
54892      if (element.hasRelationshipElement()) {
54893        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
54894        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
54895      }
54896      if (element.hasOffset()) {
54897        composeType("offset", element.getOffset());
54898      }
54899  }
54900
54901  protected void composeResearchDefinition(String name, ResearchDefinition element) throws IOException {
54902    if (element != null) {
54903      prop("resourceType", name);
54904      composeResearchDefinitionProperties(element);
54905    }
54906  }
54907
54908  protected void composeResearchDefinitionProperties(ResearchDefinition element) throws IOException {
54909    composeDomainResourceProperties(element);
54910      if (element.hasUrlElement()) {
54911        composeUriCore("url", element.getUrlElement(), false);
54912        composeUriExtras("url", element.getUrlElement(), false);
54913      }
54914      if (element.hasIdentifier()) {
54915        openArray("identifier");
54916        for (Identifier e : element.getIdentifier()) 
54917          composeIdentifier(null, e);
54918        closeArray();
54919      };
54920      if (element.hasVersionElement()) {
54921        composeStringCore("version", element.getVersionElement(), false);
54922        composeStringExtras("version", element.getVersionElement(), false);
54923      }
54924      if (element.hasNameElement()) {
54925        composeStringCore("name", element.getNameElement(), false);
54926        composeStringExtras("name", element.getNameElement(), false);
54927      }
54928      if (element.hasTitleElement()) {
54929        composeStringCore("title", element.getTitleElement(), false);
54930        composeStringExtras("title", element.getTitleElement(), false);
54931      }
54932      if (element.hasShortTitleElement()) {
54933        composeStringCore("shortTitle", element.getShortTitleElement(), false);
54934        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
54935      }
54936      if (element.hasSubtitleElement()) {
54937        composeStringCore("subtitle", element.getSubtitleElement(), false);
54938        composeStringExtras("subtitle", element.getSubtitleElement(), false);
54939      }
54940      if (element.hasStatusElement()) {
54941        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54942        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54943      }
54944      if (element.hasExperimentalElement()) {
54945        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54946        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54947      }
54948      if (element.hasSubject()) {
54949        composeType("subject", element.getSubject());
54950      }
54951      if (element.hasDateElement()) {
54952        composeDateTimeCore("date", element.getDateElement(), false);
54953        composeDateTimeExtras("date", element.getDateElement(), false);
54954      }
54955      if (element.hasPublisherElement()) {
54956        composeStringCore("publisher", element.getPublisherElement(), false);
54957        composeStringExtras("publisher", element.getPublisherElement(), false);
54958      }
54959      if (element.hasContact()) {
54960        openArray("contact");
54961        for (ContactDetail e : element.getContact()) 
54962          composeContactDetail(null, e);
54963        closeArray();
54964      };
54965      if (element.hasDescriptionElement()) {
54966        composeMarkdownCore("description", element.getDescriptionElement(), false);
54967        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54968      }
54969      if (element.hasComment()) {
54970        if (anyHasValue(element.getComment())) {
54971          openArray("comment");
54972          for (StringType e : element.getComment()) 
54973            composeStringCore(null, e, e != element.getComment().get(element.getComment().size()-1));
54974          closeArray();
54975        }
54976        if (anyHasExtras(element.getComment())) {
54977          openArray("_comment");
54978          for (StringType e : element.getComment()) 
54979            composeStringExtras(null, e, true);
54980          closeArray();
54981        }
54982      };
54983      if (element.hasUseContext()) {
54984        openArray("useContext");
54985        for (UsageContext e : element.getUseContext()) 
54986          composeUsageContext(null, e);
54987        closeArray();
54988      };
54989      if (element.hasJurisdiction()) {
54990        openArray("jurisdiction");
54991        for (CodeableConcept e : element.getJurisdiction()) 
54992          composeCodeableConcept(null, e);
54993        closeArray();
54994      };
54995      if (element.hasPurposeElement()) {
54996        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54997        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54998      }
54999      if (element.hasUsageElement()) {
55000        composeStringCore("usage", element.getUsageElement(), false);
55001        composeStringExtras("usage", element.getUsageElement(), false);
55002      }
55003      if (element.hasCopyrightElement()) {
55004        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55005        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55006      }
55007      if (element.hasApprovalDateElement()) {
55008        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
55009        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
55010      }
55011      if (element.hasLastReviewDateElement()) {
55012        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
55013        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
55014      }
55015      if (element.hasEffectivePeriod()) {
55016        composePeriod("effectivePeriod", element.getEffectivePeriod());
55017      }
55018      if (element.hasTopic()) {
55019        openArray("topic");
55020        for (CodeableConcept e : element.getTopic()) 
55021          composeCodeableConcept(null, e);
55022        closeArray();
55023      };
55024      if (element.hasAuthor()) {
55025        openArray("author");
55026        for (ContactDetail e : element.getAuthor()) 
55027          composeContactDetail(null, e);
55028        closeArray();
55029      };
55030      if (element.hasEditor()) {
55031        openArray("editor");
55032        for (ContactDetail e : element.getEditor()) 
55033          composeContactDetail(null, e);
55034        closeArray();
55035      };
55036      if (element.hasReviewer()) {
55037        openArray("reviewer");
55038        for (ContactDetail e : element.getReviewer()) 
55039          composeContactDetail(null, e);
55040        closeArray();
55041      };
55042      if (element.hasEndorser()) {
55043        openArray("endorser");
55044        for (ContactDetail e : element.getEndorser()) 
55045          composeContactDetail(null, e);
55046        closeArray();
55047      };
55048      if (element.hasRelatedArtifact()) {
55049        openArray("relatedArtifact");
55050        for (RelatedArtifact e : element.getRelatedArtifact()) 
55051          composeRelatedArtifact(null, e);
55052        closeArray();
55053      };
55054      if (element.hasLibrary()) {
55055        if (anyHasValue(element.getLibrary())) {
55056          openArray("library");
55057          for (CanonicalType e : element.getLibrary()) 
55058            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
55059          closeArray();
55060        }
55061        if (anyHasExtras(element.getLibrary())) {
55062          openArray("_library");
55063          for (CanonicalType e : element.getLibrary()) 
55064            composeCanonicalExtras(null, e, true);
55065          closeArray();
55066        }
55067      };
55068      if (element.hasPopulation()) {
55069        composeReference("population", element.getPopulation());
55070      }
55071      if (element.hasExposure()) {
55072        composeReference("exposure", element.getExposure());
55073      }
55074      if (element.hasExposureAlternative()) {
55075        composeReference("exposureAlternative", element.getExposureAlternative());
55076      }
55077      if (element.hasOutcome()) {
55078        composeReference("outcome", element.getOutcome());
55079      }
55080  }
55081
55082  protected void composeResearchElementDefinition(String name, ResearchElementDefinition element) throws IOException {
55083    if (element != null) {
55084      prop("resourceType", name);
55085      composeResearchElementDefinitionProperties(element);
55086    }
55087  }
55088
55089  protected void composeResearchElementDefinitionProperties(ResearchElementDefinition element) throws IOException {
55090    composeDomainResourceProperties(element);
55091      if (element.hasUrlElement()) {
55092        composeUriCore("url", element.getUrlElement(), false);
55093        composeUriExtras("url", element.getUrlElement(), false);
55094      }
55095      if (element.hasIdentifier()) {
55096        openArray("identifier");
55097        for (Identifier e : element.getIdentifier()) 
55098          composeIdentifier(null, e);
55099        closeArray();
55100      };
55101      if (element.hasVersionElement()) {
55102        composeStringCore("version", element.getVersionElement(), false);
55103        composeStringExtras("version", element.getVersionElement(), false);
55104      }
55105      if (element.hasNameElement()) {
55106        composeStringCore("name", element.getNameElement(), false);
55107        composeStringExtras("name", element.getNameElement(), false);
55108      }
55109      if (element.hasTitleElement()) {
55110        composeStringCore("title", element.getTitleElement(), false);
55111        composeStringExtras("title", element.getTitleElement(), false);
55112      }
55113      if (element.hasShortTitleElement()) {
55114        composeStringCore("shortTitle", element.getShortTitleElement(), false);
55115        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
55116      }
55117      if (element.hasSubtitleElement()) {
55118        composeStringCore("subtitle", element.getSubtitleElement(), false);
55119        composeStringExtras("subtitle", element.getSubtitleElement(), false);
55120      }
55121      if (element.hasStatusElement()) {
55122        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55123        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55124      }
55125      if (element.hasExperimentalElement()) {
55126        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55127        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55128      }
55129      if (element.hasSubject()) {
55130        composeType("subject", element.getSubject());
55131      }
55132      if (element.hasDateElement()) {
55133        composeDateTimeCore("date", element.getDateElement(), false);
55134        composeDateTimeExtras("date", element.getDateElement(), false);
55135      }
55136      if (element.hasPublisherElement()) {
55137        composeStringCore("publisher", element.getPublisherElement(), false);
55138        composeStringExtras("publisher", element.getPublisherElement(), false);
55139      }
55140      if (element.hasContact()) {
55141        openArray("contact");
55142        for (ContactDetail e : element.getContact()) 
55143          composeContactDetail(null, e);
55144        closeArray();
55145      };
55146      if (element.hasDescriptionElement()) {
55147        composeMarkdownCore("description", element.getDescriptionElement(), false);
55148        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55149      }
55150      if (element.hasComment()) {
55151        if (anyHasValue(element.getComment())) {
55152          openArray("comment");
55153          for (StringType e : element.getComment()) 
55154            composeStringCore(null, e, e != element.getComment().get(element.getComment().size()-1));
55155          closeArray();
55156        }
55157        if (anyHasExtras(element.getComment())) {
55158          openArray("_comment");
55159          for (StringType e : element.getComment()) 
55160            composeStringExtras(null, e, true);
55161          closeArray();
55162        }
55163      };
55164      if (element.hasUseContext()) {
55165        openArray("useContext");
55166        for (UsageContext e : element.getUseContext()) 
55167          composeUsageContext(null, e);
55168        closeArray();
55169      };
55170      if (element.hasJurisdiction()) {
55171        openArray("jurisdiction");
55172        for (CodeableConcept e : element.getJurisdiction()) 
55173          composeCodeableConcept(null, e);
55174        closeArray();
55175      };
55176      if (element.hasPurposeElement()) {
55177        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55178        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55179      }
55180      if (element.hasUsageElement()) {
55181        composeStringCore("usage", element.getUsageElement(), false);
55182        composeStringExtras("usage", element.getUsageElement(), false);
55183      }
55184      if (element.hasCopyrightElement()) {
55185        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55186        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55187      }
55188      if (element.hasApprovalDateElement()) {
55189        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
55190        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
55191      }
55192      if (element.hasLastReviewDateElement()) {
55193        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
55194        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
55195      }
55196      if (element.hasEffectivePeriod()) {
55197        composePeriod("effectivePeriod", element.getEffectivePeriod());
55198      }
55199      if (element.hasTopic()) {
55200        openArray("topic");
55201        for (CodeableConcept e : element.getTopic()) 
55202          composeCodeableConcept(null, e);
55203        closeArray();
55204      };
55205      if (element.hasAuthor()) {
55206        openArray("author");
55207        for (ContactDetail e : element.getAuthor()) 
55208          composeContactDetail(null, e);
55209        closeArray();
55210      };
55211      if (element.hasEditor()) {
55212        openArray("editor");
55213        for (ContactDetail e : element.getEditor()) 
55214          composeContactDetail(null, e);
55215        closeArray();
55216      };
55217      if (element.hasReviewer()) {
55218        openArray("reviewer");
55219        for (ContactDetail e : element.getReviewer()) 
55220          composeContactDetail(null, e);
55221        closeArray();
55222      };
55223      if (element.hasEndorser()) {
55224        openArray("endorser");
55225        for (ContactDetail e : element.getEndorser()) 
55226          composeContactDetail(null, e);
55227        closeArray();
55228      };
55229      if (element.hasRelatedArtifact()) {
55230        openArray("relatedArtifact");
55231        for (RelatedArtifact e : element.getRelatedArtifact()) 
55232          composeRelatedArtifact(null, e);
55233        closeArray();
55234      };
55235      if (element.hasLibrary()) {
55236        if (anyHasValue(element.getLibrary())) {
55237          openArray("library");
55238          for (CanonicalType e : element.getLibrary()) 
55239            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
55240          closeArray();
55241        }
55242        if (anyHasExtras(element.getLibrary())) {
55243          openArray("_library");
55244          for (CanonicalType e : element.getLibrary()) 
55245            composeCanonicalExtras(null, e, true);
55246          closeArray();
55247        }
55248      };
55249      if (element.hasTypeElement()) {
55250        composeEnumerationCore("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
55251        composeEnumerationExtras("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
55252      }
55253      if (element.hasVariableTypeElement()) {
55254        composeEnumerationCore("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
55255        composeEnumerationExtras("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
55256      }
55257      if (element.hasCharacteristic()) {
55258        openArray("characteristic");
55259        for (ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent e : element.getCharacteristic()) 
55260          composeResearchElementDefinitionCharacteristicComponent(null, e);
55261        closeArray();
55262      };
55263  }
55264
55265  protected void composeResearchElementDefinitionCharacteristicComponent(String name, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
55266    if (element != null) {
55267      open(name);
55268      composeResearchElementDefinitionCharacteristicComponentProperties(element);
55269      close();
55270    }
55271  }
55272
55273  protected void composeResearchElementDefinitionCharacteristicComponentProperties(ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
55274    composeBackboneElementProperties(element);
55275      if (element.hasDefinition()) {
55276        composeType("definition", element.getDefinition());
55277      }
55278      if (element.hasUsageContext()) {
55279        openArray("usageContext");
55280        for (UsageContext e : element.getUsageContext()) 
55281          composeUsageContext(null, e);
55282        closeArray();
55283      };
55284      if (element.hasExcludeElement()) {
55285        composeBooleanCore("exclude", element.getExcludeElement(), false);
55286        composeBooleanExtras("exclude", element.getExcludeElement(), false);
55287      }
55288      if (element.hasUnitOfMeasure()) {
55289        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
55290      }
55291      if (element.hasStudyEffectiveDescriptionElement()) {
55292        composeStringCore("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
55293        composeStringExtras("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
55294      }
55295      if (element.hasStudyEffective()) {
55296        composeType("studyEffective", element.getStudyEffective());
55297      }
55298      if (element.hasStudyEffectiveTimeFromStart()) {
55299        composeDuration("studyEffectiveTimeFromStart", element.getStudyEffectiveTimeFromStart());
55300      }
55301      if (element.hasStudyEffectiveGroupMeasureElement()) {
55302        composeEnumerationCore("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new Enumerations.GroupMeasureEnumFactory(), false);
55303        composeEnumerationExtras("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new Enumerations.GroupMeasureEnumFactory(), false);
55304      }
55305      if (element.hasParticipantEffectiveDescriptionElement()) {
55306        composeStringCore("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
55307        composeStringExtras("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
55308      }
55309      if (element.hasParticipantEffective()) {
55310        composeType("participantEffective", element.getParticipantEffective());
55311      }
55312      if (element.hasParticipantEffectiveTimeFromStart()) {
55313        composeDuration("participantEffectiveTimeFromStart", element.getParticipantEffectiveTimeFromStart());
55314      }
55315      if (element.hasParticipantEffectiveGroupMeasureElement()) {
55316        composeEnumerationCore("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new Enumerations.GroupMeasureEnumFactory(), false);
55317        composeEnumerationExtras("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new Enumerations.GroupMeasureEnumFactory(), false);
55318      }
55319  }
55320
55321  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
55322    if (element != null) {
55323      prop("resourceType", name);
55324      composeResearchStudyProperties(element);
55325    }
55326  }
55327
55328  protected void composeResearchStudyProperties(ResearchStudy element) throws IOException {
55329    composeDomainResourceProperties(element);
55330      if (element.hasIdentifier()) {
55331        openArray("identifier");
55332        for (Identifier e : element.getIdentifier()) 
55333          composeIdentifier(null, e);
55334        closeArray();
55335      };
55336      if (element.hasTitleElement()) {
55337        composeStringCore("title", element.getTitleElement(), false);
55338        composeStringExtras("title", element.getTitleElement(), false);
55339      }
55340      if (element.hasProtocol()) {
55341        openArray("protocol");
55342        for (Reference e : element.getProtocol()) 
55343          composeReference(null, e);
55344        closeArray();
55345      };
55346      if (element.hasPartOf()) {
55347        openArray("partOf");
55348        for (Reference e : element.getPartOf()) 
55349          composeReference(null, e);
55350        closeArray();
55351      };
55352      if (element.hasStatusElement()) {
55353        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
55354        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
55355      }
55356      if (element.hasPrimaryPurposeType()) {
55357        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
55358      }
55359      if (element.hasPhase()) {
55360        composeCodeableConcept("phase", element.getPhase());
55361      }
55362      if (element.hasCategory()) {
55363        openArray("category");
55364        for (CodeableConcept e : element.getCategory()) 
55365          composeCodeableConcept(null, e);
55366        closeArray();
55367      };
55368      if (element.hasFocus()) {
55369        openArray("focus");
55370        for (CodeableConcept e : element.getFocus()) 
55371          composeCodeableConcept(null, e);
55372        closeArray();
55373      };
55374      if (element.hasCondition()) {
55375        openArray("condition");
55376        for (CodeableConcept e : element.getCondition()) 
55377          composeCodeableConcept(null, e);
55378        closeArray();
55379      };
55380      if (element.hasContact()) {
55381        openArray("contact");
55382        for (ContactDetail e : element.getContact()) 
55383          composeContactDetail(null, e);
55384        closeArray();
55385      };
55386      if (element.hasRelatedArtifact()) {
55387        openArray("relatedArtifact");
55388        for (RelatedArtifact e : element.getRelatedArtifact()) 
55389          composeRelatedArtifact(null, e);
55390        closeArray();
55391      };
55392      if (element.hasKeyword()) {
55393        openArray("keyword");
55394        for (CodeableConcept e : element.getKeyword()) 
55395          composeCodeableConcept(null, e);
55396        closeArray();
55397      };
55398      if (element.hasLocation()) {
55399        openArray("location");
55400        for (CodeableConcept e : element.getLocation()) 
55401          composeCodeableConcept(null, e);
55402        closeArray();
55403      };
55404      if (element.hasDescriptionElement()) {
55405        composeMarkdownCore("description", element.getDescriptionElement(), false);
55406        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55407      }
55408      if (element.hasEnrollment()) {
55409        openArray("enrollment");
55410        for (Reference e : element.getEnrollment()) 
55411          composeReference(null, e);
55412        closeArray();
55413      };
55414      if (element.hasPeriod()) {
55415        composePeriod("period", element.getPeriod());
55416      }
55417      if (element.hasSponsor()) {
55418        composeReference("sponsor", element.getSponsor());
55419      }
55420      if (element.hasPrincipalInvestigator()) {
55421        composeReference("principalInvestigator", element.getPrincipalInvestigator());
55422      }
55423      if (element.hasSite()) {
55424        openArray("site");
55425        for (Reference e : element.getSite()) 
55426          composeReference(null, e);
55427        closeArray();
55428      };
55429      if (element.hasReasonStopped()) {
55430        composeCodeableConcept("reasonStopped", element.getReasonStopped());
55431      }
55432      if (element.hasNote()) {
55433        openArray("note");
55434        for (Annotation e : element.getNote()) 
55435          composeAnnotation(null, e);
55436        closeArray();
55437      };
55438      if (element.hasArm()) {
55439        openArray("arm");
55440        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
55441          composeResearchStudyArmComponent(null, e);
55442        closeArray();
55443      };
55444      if (element.hasObjective()) {
55445        openArray("objective");
55446        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
55447          composeResearchStudyObjectiveComponent(null, e);
55448        closeArray();
55449      };
55450  }
55451
55452  protected void composeResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
55453    if (element != null) {
55454      open(name);
55455      composeResearchStudyArmComponentProperties(element);
55456      close();
55457    }
55458  }
55459
55460  protected void composeResearchStudyArmComponentProperties(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
55461    composeBackboneElementProperties(element);
55462      if (element.hasNameElement()) {
55463        composeStringCore("name", element.getNameElement(), false);
55464        composeStringExtras("name", element.getNameElement(), false);
55465      }
55466      if (element.hasType()) {
55467        composeCodeableConcept("type", element.getType());
55468      }
55469      if (element.hasDescriptionElement()) {
55470        composeStringCore("description", element.getDescriptionElement(), false);
55471        composeStringExtras("description", element.getDescriptionElement(), false);
55472      }
55473  }
55474
55475  protected void composeResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
55476    if (element != null) {
55477      open(name);
55478      composeResearchStudyObjectiveComponentProperties(element);
55479      close();
55480    }
55481  }
55482
55483  protected void composeResearchStudyObjectiveComponentProperties(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
55484    composeBackboneElementProperties(element);
55485      if (element.hasNameElement()) {
55486        composeStringCore("name", element.getNameElement(), false);
55487        composeStringExtras("name", element.getNameElement(), false);
55488      }
55489      if (element.hasType()) {
55490        composeCodeableConcept("type", element.getType());
55491      }
55492  }
55493
55494  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
55495    if (element != null) {
55496      prop("resourceType", name);
55497      composeResearchSubjectProperties(element);
55498    }
55499  }
55500
55501  protected void composeResearchSubjectProperties(ResearchSubject element) throws IOException {
55502    composeDomainResourceProperties(element);
55503      if (element.hasIdentifier()) {
55504        openArray("identifier");
55505        for (Identifier e : element.getIdentifier()) 
55506          composeIdentifier(null, e);
55507        closeArray();
55508      };
55509      if (element.hasStatusElement()) {
55510        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
55511        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
55512      }
55513      if (element.hasPeriod()) {
55514        composePeriod("period", element.getPeriod());
55515      }
55516      if (element.hasStudy()) {
55517        composeReference("study", element.getStudy());
55518      }
55519      if (element.hasIndividual()) {
55520        composeReference("individual", element.getIndividual());
55521      }
55522      if (element.hasAssignedArmElement()) {
55523        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
55524        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
55525      }
55526      if (element.hasActualArmElement()) {
55527        composeStringCore("actualArm", element.getActualArmElement(), false);
55528        composeStringExtras("actualArm", element.getActualArmElement(), false);
55529      }
55530      if (element.hasConsent()) {
55531        composeReference("consent", element.getConsent());
55532      }
55533  }
55534
55535  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
55536    if (element != null) {
55537      prop("resourceType", name);
55538      composeRiskAssessmentProperties(element);
55539    }
55540  }
55541
55542  protected void composeRiskAssessmentProperties(RiskAssessment element) throws IOException {
55543    composeDomainResourceProperties(element);
55544      if (element.hasIdentifier()) {
55545        openArray("identifier");
55546        for (Identifier e : element.getIdentifier()) 
55547          composeIdentifier(null, e);
55548        closeArray();
55549      };
55550      if (element.hasBasedOn()) {
55551        composeReference("basedOn", element.getBasedOn());
55552      }
55553      if (element.hasParent()) {
55554        composeReference("parent", element.getParent());
55555      }
55556      if (element.hasStatusElement()) {
55557        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
55558        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
55559      }
55560      if (element.hasMethod()) {
55561        composeCodeableConcept("method", element.getMethod());
55562      }
55563      if (element.hasCode()) {
55564        composeCodeableConcept("code", element.getCode());
55565      }
55566      if (element.hasSubject()) {
55567        composeReference("subject", element.getSubject());
55568      }
55569      if (element.hasEncounter()) {
55570        composeReference("encounter", element.getEncounter());
55571      }
55572      if (element.hasOccurrence()) {
55573        composeType("occurrence", element.getOccurrence());
55574      }
55575      if (element.hasCondition()) {
55576        composeReference("condition", element.getCondition());
55577      }
55578      if (element.hasPerformer()) {
55579        composeReference("performer", element.getPerformer());
55580      }
55581      if (element.hasReasonCode()) {
55582        openArray("reasonCode");
55583        for (CodeableConcept e : element.getReasonCode()) 
55584          composeCodeableConcept(null, e);
55585        closeArray();
55586      };
55587      if (element.hasReasonReference()) {
55588        openArray("reasonReference");
55589        for (Reference e : element.getReasonReference()) 
55590          composeReference(null, e);
55591        closeArray();
55592      };
55593      if (element.hasBasis()) {
55594        openArray("basis");
55595        for (Reference e : element.getBasis()) 
55596          composeReference(null, e);
55597        closeArray();
55598      };
55599      if (element.hasPrediction()) {
55600        openArray("prediction");
55601        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
55602          composeRiskAssessmentPredictionComponent(null, e);
55603        closeArray();
55604      };
55605      if (element.hasMitigationElement()) {
55606        composeStringCore("mitigation", element.getMitigationElement(), false);
55607        composeStringExtras("mitigation", element.getMitigationElement(), false);
55608      }
55609      if (element.hasNote()) {
55610        openArray("note");
55611        for (Annotation e : element.getNote()) 
55612          composeAnnotation(null, e);
55613        closeArray();
55614      };
55615  }
55616
55617  protected void composeRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
55618    if (element != null) {
55619      open(name);
55620      composeRiskAssessmentPredictionComponentProperties(element);
55621      close();
55622    }
55623  }
55624
55625  protected void composeRiskAssessmentPredictionComponentProperties(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
55626    composeBackboneElementProperties(element);
55627      if (element.hasOutcome()) {
55628        composeCodeableConcept("outcome", element.getOutcome());
55629      }
55630      if (element.hasProbability()) {
55631        composeType("probability", element.getProbability());
55632      }
55633      if (element.hasQualitativeRisk()) {
55634        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
55635      }
55636      if (element.hasRelativeRiskElement()) {
55637        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
55638        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
55639      }
55640      if (element.hasWhen()) {
55641        composeType("when", element.getWhen());
55642      }
55643      if (element.hasRationaleElement()) {
55644        composeStringCore("rationale", element.getRationaleElement(), false);
55645        composeStringExtras("rationale", element.getRationaleElement(), false);
55646      }
55647  }
55648
55649  protected void composeSchedule(String name, Schedule element) throws IOException {
55650    if (element != null) {
55651      prop("resourceType", name);
55652      composeScheduleProperties(element);
55653    }
55654  }
55655
55656  protected void composeScheduleProperties(Schedule element) throws IOException {
55657    composeDomainResourceProperties(element);
55658      if (element.hasIdentifier()) {
55659        openArray("identifier");
55660        for (Identifier e : element.getIdentifier()) 
55661          composeIdentifier(null, e);
55662        closeArray();
55663      };
55664      if (element.hasActiveElement()) {
55665        composeBooleanCore("active", element.getActiveElement(), false);
55666        composeBooleanExtras("active", element.getActiveElement(), false);
55667      }
55668      if (element.hasServiceCategory()) {
55669        openArray("serviceCategory");
55670        for (CodeableConcept e : element.getServiceCategory()) 
55671          composeCodeableConcept(null, e);
55672        closeArray();
55673      };
55674      if (element.hasServiceType()) {
55675        openArray("serviceType");
55676        for (CodeableConcept e : element.getServiceType()) 
55677          composeCodeableConcept(null, e);
55678        closeArray();
55679      };
55680      if (element.hasSpecialty()) {
55681        openArray("specialty");
55682        for (CodeableConcept e : element.getSpecialty()) 
55683          composeCodeableConcept(null, e);
55684        closeArray();
55685      };
55686      if (element.hasActor()) {
55687        openArray("actor");
55688        for (Reference e : element.getActor()) 
55689          composeReference(null, e);
55690        closeArray();
55691      };
55692      if (element.hasPlanningHorizon()) {
55693        composePeriod("planningHorizon", element.getPlanningHorizon());
55694      }
55695      if (element.hasCommentElement()) {
55696        composeStringCore("comment", element.getCommentElement(), false);
55697        composeStringExtras("comment", element.getCommentElement(), false);
55698      }
55699  }
55700
55701  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
55702    if (element != null) {
55703      prop("resourceType", name);
55704      composeSearchParameterProperties(element);
55705    }
55706  }
55707
55708  protected void composeSearchParameterProperties(SearchParameter element) throws IOException {
55709    composeDomainResourceProperties(element);
55710      if (element.hasUrlElement()) {
55711        composeUriCore("url", element.getUrlElement(), false);
55712        composeUriExtras("url", element.getUrlElement(), false);
55713      }
55714      if (element.hasVersionElement()) {
55715        composeStringCore("version", element.getVersionElement(), false);
55716        composeStringExtras("version", element.getVersionElement(), false);
55717      }
55718      if (element.hasNameElement()) {
55719        composeStringCore("name", element.getNameElement(), false);
55720        composeStringExtras("name", element.getNameElement(), false);
55721      }
55722      if (element.hasDerivedFromElement()) {
55723        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
55724        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
55725      }
55726      if (element.hasStatusElement()) {
55727        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55728        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55729      }
55730      if (element.hasExperimentalElement()) {
55731        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55732        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55733      }
55734      if (element.hasDateElement()) {
55735        composeDateTimeCore("date", element.getDateElement(), false);
55736        composeDateTimeExtras("date", element.getDateElement(), false);
55737      }
55738      if (element.hasPublisherElement()) {
55739        composeStringCore("publisher", element.getPublisherElement(), false);
55740        composeStringExtras("publisher", element.getPublisherElement(), false);
55741      }
55742      if (element.hasContact()) {
55743        openArray("contact");
55744        for (ContactDetail e : element.getContact()) 
55745          composeContactDetail(null, e);
55746        closeArray();
55747      };
55748      if (element.hasDescriptionElement()) {
55749        composeMarkdownCore("description", element.getDescriptionElement(), false);
55750        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55751      }
55752      if (element.hasUseContext()) {
55753        openArray("useContext");
55754        for (UsageContext e : element.getUseContext()) 
55755          composeUsageContext(null, e);
55756        closeArray();
55757      };
55758      if (element.hasJurisdiction()) {
55759        openArray("jurisdiction");
55760        for (CodeableConcept e : element.getJurisdiction()) 
55761          composeCodeableConcept(null, e);
55762        closeArray();
55763      };
55764      if (element.hasPurposeElement()) {
55765        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55766        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55767      }
55768      if (element.hasCodeElement()) {
55769        composeCodeCore("code", element.getCodeElement(), false);
55770        composeCodeExtras("code", element.getCodeElement(), false);
55771      }
55772      if (element.hasBase()) {
55773        if (anyHasValue(element.getBase())) {
55774          openArray("base");
55775          for (CodeType e : element.getBase()) 
55776            composeCodeCore(null, e, e != element.getBase().get(element.getBase().size()-1));
55777          closeArray();
55778        }
55779        if (anyHasExtras(element.getBase())) {
55780          openArray("_base");
55781          for (CodeType e : element.getBase()) 
55782            composeCodeExtras(null, e, true);
55783          closeArray();
55784        }
55785      };
55786      if (element.hasTypeElement()) {
55787        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
55788        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
55789      }
55790      if (element.hasExpressionElement()) {
55791        composeStringCore("expression", element.getExpressionElement(), false);
55792        composeStringExtras("expression", element.getExpressionElement(), false);
55793      }
55794      if (element.hasXpathElement()) {
55795        composeStringCore("xpath", element.getXpathElement(), false);
55796        composeStringExtras("xpath", element.getXpathElement(), false);
55797      }
55798      if (element.hasXpathUsageElement()) {
55799        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
55800        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
55801      }
55802      if (element.hasTarget()) {
55803        if (anyHasValue(element.getTarget())) {
55804          openArray("target");
55805          for (CodeType e : element.getTarget()) 
55806            composeCodeCore(null, e, e != element.getTarget().get(element.getTarget().size()-1));
55807          closeArray();
55808        }
55809        if (anyHasExtras(element.getTarget())) {
55810          openArray("_target");
55811          for (CodeType e : element.getTarget()) 
55812            composeCodeExtras(null, e, true);
55813          closeArray();
55814        }
55815      };
55816      if (element.hasMultipleOrElement()) {
55817        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
55818        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
55819      }
55820      if (element.hasMultipleAndElement()) {
55821        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
55822        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
55823      }
55824      if (element.hasComparator()) {
55825        openArray("comparator");
55826        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
55827          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
55828        closeArray();
55829        if (anyHasExtras(element.getComparator())) {
55830          openArray("_comparator");
55831          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
55832            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
55833          closeArray();
55834        }
55835      };
55836      if (element.hasModifier()) {
55837        openArray("modifier");
55838        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
55839          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
55840        closeArray();
55841        if (anyHasExtras(element.getModifier())) {
55842          openArray("_modifier");
55843          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
55844            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
55845          closeArray();
55846        }
55847      };
55848      if (element.hasChain()) {
55849        if (anyHasValue(element.getChain())) {
55850          openArray("chain");
55851          for (StringType e : element.getChain()) 
55852            composeStringCore(null, e, e != element.getChain().get(element.getChain().size()-1));
55853          closeArray();
55854        }
55855        if (anyHasExtras(element.getChain())) {
55856          openArray("_chain");
55857          for (StringType e : element.getChain()) 
55858            composeStringExtras(null, e, true);
55859          closeArray();
55860        }
55861      };
55862      if (element.hasComponent()) {
55863        openArray("component");
55864        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
55865          composeSearchParameterComponentComponent(null, e);
55866        closeArray();
55867      };
55868  }
55869
55870  protected void composeSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
55871    if (element != null) {
55872      open(name);
55873      composeSearchParameterComponentComponentProperties(element);
55874      close();
55875    }
55876  }
55877
55878  protected void composeSearchParameterComponentComponentProperties(SearchParameter.SearchParameterComponentComponent element) throws IOException {
55879    composeBackboneElementProperties(element);
55880      if (element.hasDefinitionElement()) {
55881        composeCanonicalCore("definition", element.getDefinitionElement(), false);
55882        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
55883      }
55884      if (element.hasExpressionElement()) {
55885        composeStringCore("expression", element.getExpressionElement(), false);
55886        composeStringExtras("expression", element.getExpressionElement(), false);
55887      }
55888  }
55889
55890  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
55891    if (element != null) {
55892      prop("resourceType", name);
55893      composeServiceRequestProperties(element);
55894    }
55895  }
55896
55897  protected void composeServiceRequestProperties(ServiceRequest element) throws IOException {
55898    composeDomainResourceProperties(element);
55899      if (element.hasIdentifier()) {
55900        openArray("identifier");
55901        for (Identifier e : element.getIdentifier()) 
55902          composeIdentifier(null, e);
55903        closeArray();
55904      };
55905      if (element.hasInstantiatesCanonical()) {
55906        if (anyHasValue(element.getInstantiatesCanonical())) {
55907          openArray("instantiatesCanonical");
55908          for (CanonicalType e : element.getInstantiatesCanonical()) 
55909            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
55910          closeArray();
55911        }
55912        if (anyHasExtras(element.getInstantiatesCanonical())) {
55913          openArray("_instantiatesCanonical");
55914          for (CanonicalType e : element.getInstantiatesCanonical()) 
55915            composeCanonicalExtras(null, e, true);
55916          closeArray();
55917        }
55918      };
55919      if (element.hasInstantiatesUri()) {
55920        if (anyHasValue(element.getInstantiatesUri())) {
55921          openArray("instantiatesUri");
55922          for (UriType e : element.getInstantiatesUri()) 
55923            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
55924          closeArray();
55925        }
55926        if (anyHasExtras(element.getInstantiatesUri())) {
55927          openArray("_instantiatesUri");
55928          for (UriType e : element.getInstantiatesUri()) 
55929            composeUriExtras(null, e, true);
55930          closeArray();
55931        }
55932      };
55933      if (element.hasBasedOn()) {
55934        openArray("basedOn");
55935        for (Reference e : element.getBasedOn()) 
55936          composeReference(null, e);
55937        closeArray();
55938      };
55939      if (element.hasReplaces()) {
55940        openArray("replaces");
55941        for (Reference e : element.getReplaces()) 
55942          composeReference(null, e);
55943        closeArray();
55944      };
55945      if (element.hasRequisition()) {
55946        composeIdentifier("requisition", element.getRequisition());
55947      }
55948      if (element.hasStatusElement()) {
55949        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
55950        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
55951      }
55952      if (element.hasIntentElement()) {
55953        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
55954        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
55955      }
55956      if (element.hasCategory()) {
55957        openArray("category");
55958        for (CodeableConcept e : element.getCategory()) 
55959          composeCodeableConcept(null, e);
55960        closeArray();
55961      };
55962      if (element.hasPriorityElement()) {
55963        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
55964        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
55965      }
55966      if (element.hasDoNotPerformElement()) {
55967        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
55968        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
55969      }
55970      if (element.hasCode()) {
55971        composeCodeableConcept("code", element.getCode());
55972      }
55973      if (element.hasOrderDetail()) {
55974        openArray("orderDetail");
55975        for (CodeableConcept e : element.getOrderDetail()) 
55976          composeCodeableConcept(null, e);
55977        closeArray();
55978      };
55979      if (element.hasQuantity()) {
55980        composeType("quantity", element.getQuantity());
55981      }
55982      if (element.hasSubject()) {
55983        composeReference("subject", element.getSubject());
55984      }
55985      if (element.hasEncounter()) {
55986        composeReference("encounter", element.getEncounter());
55987      }
55988      if (element.hasOccurrence()) {
55989        composeType("occurrence", element.getOccurrence());
55990      }
55991      if (element.hasAsNeeded()) {
55992        composeType("asNeeded", element.getAsNeeded());
55993      }
55994      if (element.hasAuthoredOnElement()) {
55995        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55996        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55997      }
55998      if (element.hasRequester()) {
55999        composeReference("requester", element.getRequester());
56000      }
56001      if (element.hasPerformerType()) {
56002        composeCodeableConcept("performerType", element.getPerformerType());
56003      }
56004      if (element.hasPerformer()) {
56005        openArray("performer");
56006        for (Reference e : element.getPerformer()) 
56007          composeReference(null, e);
56008        closeArray();
56009      };
56010      if (element.hasLocationCode()) {
56011        openArray("locationCode");
56012        for (CodeableConcept e : element.getLocationCode()) 
56013          composeCodeableConcept(null, e);
56014        closeArray();
56015      };
56016      if (element.hasLocationReference()) {
56017        openArray("locationReference");
56018        for (Reference e : element.getLocationReference()) 
56019          composeReference(null, e);
56020        closeArray();
56021      };
56022      if (element.hasReasonCode()) {
56023        openArray("reasonCode");
56024        for (CodeableConcept e : element.getReasonCode()) 
56025          composeCodeableConcept(null, e);
56026        closeArray();
56027      };
56028      if (element.hasReasonReference()) {
56029        openArray("reasonReference");
56030        for (Reference e : element.getReasonReference()) 
56031          composeReference(null, e);
56032        closeArray();
56033      };
56034      if (element.hasInsurance()) {
56035        openArray("insurance");
56036        for (Reference e : element.getInsurance()) 
56037          composeReference(null, e);
56038        closeArray();
56039      };
56040      if (element.hasSupportingInfo()) {
56041        openArray("supportingInfo");
56042        for (Reference e : element.getSupportingInfo()) 
56043          composeReference(null, e);
56044        closeArray();
56045      };
56046      if (element.hasSpecimen()) {
56047        openArray("specimen");
56048        for (Reference e : element.getSpecimen()) 
56049          composeReference(null, e);
56050        closeArray();
56051      };
56052      if (element.hasBodySite()) {
56053        openArray("bodySite");
56054        for (CodeableConcept e : element.getBodySite()) 
56055          composeCodeableConcept(null, e);
56056        closeArray();
56057      };
56058      if (element.hasNote()) {
56059        openArray("note");
56060        for (Annotation e : element.getNote()) 
56061          composeAnnotation(null, e);
56062        closeArray();
56063      };
56064      if (element.hasPatientInstructionElement()) {
56065        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
56066        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
56067      }
56068      if (element.hasRelevantHistory()) {
56069        openArray("relevantHistory");
56070        for (Reference e : element.getRelevantHistory()) 
56071          composeReference(null, e);
56072        closeArray();
56073      };
56074  }
56075
56076  protected void composeSlot(String name, Slot element) throws IOException {
56077    if (element != null) {
56078      prop("resourceType", name);
56079      composeSlotProperties(element);
56080    }
56081  }
56082
56083  protected void composeSlotProperties(Slot element) throws IOException {
56084    composeDomainResourceProperties(element);
56085      if (element.hasIdentifier()) {
56086        openArray("identifier");
56087        for (Identifier e : element.getIdentifier()) 
56088          composeIdentifier(null, e);
56089        closeArray();
56090      };
56091      if (element.hasServiceCategory()) {
56092        openArray("serviceCategory");
56093        for (CodeableConcept e : element.getServiceCategory()) 
56094          composeCodeableConcept(null, e);
56095        closeArray();
56096      };
56097      if (element.hasServiceType()) {
56098        openArray("serviceType");
56099        for (CodeableConcept e : element.getServiceType()) 
56100          composeCodeableConcept(null, e);
56101        closeArray();
56102      };
56103      if (element.hasSpecialty()) {
56104        openArray("specialty");
56105        for (CodeableConcept e : element.getSpecialty()) 
56106          composeCodeableConcept(null, e);
56107        closeArray();
56108      };
56109      if (element.hasAppointmentType()) {
56110        composeCodeableConcept("appointmentType", element.getAppointmentType());
56111      }
56112      if (element.hasSchedule()) {
56113        composeReference("schedule", element.getSchedule());
56114      }
56115      if (element.hasStatusElement()) {
56116        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
56117        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
56118      }
56119      if (element.hasStartElement()) {
56120        composeInstantCore("start", element.getStartElement(), false);
56121        composeInstantExtras("start", element.getStartElement(), false);
56122      }
56123      if (element.hasEndElement()) {
56124        composeInstantCore("end", element.getEndElement(), false);
56125        composeInstantExtras("end", element.getEndElement(), false);
56126      }
56127      if (element.hasOverbookedElement()) {
56128        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
56129        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
56130      }
56131      if (element.hasCommentElement()) {
56132        composeStringCore("comment", element.getCommentElement(), false);
56133        composeStringExtras("comment", element.getCommentElement(), false);
56134      }
56135  }
56136
56137  protected void composeSpecimen(String name, Specimen element) throws IOException {
56138    if (element != null) {
56139      prop("resourceType", name);
56140      composeSpecimenProperties(element);
56141    }
56142  }
56143
56144  protected void composeSpecimenProperties(Specimen element) throws IOException {
56145    composeDomainResourceProperties(element);
56146      if (element.hasIdentifier()) {
56147        openArray("identifier");
56148        for (Identifier e : element.getIdentifier()) 
56149          composeIdentifier(null, e);
56150        closeArray();
56151      };
56152      if (element.hasAccessionIdentifier()) {
56153        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
56154      }
56155      if (element.hasStatusElement()) {
56156        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
56157        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
56158      }
56159      if (element.hasType()) {
56160        composeCodeableConcept("type", element.getType());
56161      }
56162      if (element.hasSubject()) {
56163        composeReference("subject", element.getSubject());
56164      }
56165      if (element.hasReceivedTimeElement()) {
56166        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
56167        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
56168      }
56169      if (element.hasParent()) {
56170        openArray("parent");
56171        for (Reference e : element.getParent()) 
56172          composeReference(null, e);
56173        closeArray();
56174      };
56175      if (element.hasRequest()) {
56176        openArray("request");
56177        for (Reference e : element.getRequest()) 
56178          composeReference(null, e);
56179        closeArray();
56180      };
56181      if (element.hasCollection()) {
56182        composeSpecimenCollectionComponent("collection", element.getCollection());
56183      }
56184      if (element.hasProcessing()) {
56185        openArray("processing");
56186        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
56187          composeSpecimenProcessingComponent(null, e);
56188        closeArray();
56189      };
56190      if (element.hasContainer()) {
56191        openArray("container");
56192        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
56193          composeSpecimenContainerComponent(null, e);
56194        closeArray();
56195      };
56196      if (element.hasCondition()) {
56197        openArray("condition");
56198        for (CodeableConcept e : element.getCondition()) 
56199          composeCodeableConcept(null, e);
56200        closeArray();
56201      };
56202      if (element.hasNote()) {
56203        openArray("note");
56204        for (Annotation e : element.getNote()) 
56205          composeAnnotation(null, e);
56206        closeArray();
56207      };
56208  }
56209
56210  protected void composeSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
56211    if (element != null) {
56212      open(name);
56213      composeSpecimenCollectionComponentProperties(element);
56214      close();
56215    }
56216  }
56217
56218  protected void composeSpecimenCollectionComponentProperties(Specimen.SpecimenCollectionComponent element) throws IOException {
56219    composeBackboneElementProperties(element);
56220      if (element.hasCollector()) {
56221        composeReference("collector", element.getCollector());
56222      }
56223      if (element.hasCollected()) {
56224        composeType("collected", element.getCollected());
56225      }
56226      if (element.hasDuration()) {
56227        composeDuration("duration", element.getDuration());
56228      }
56229      if (element.hasQuantity()) {
56230        composeQuantity("quantity", element.getQuantity());
56231      }
56232      if (element.hasMethod()) {
56233        composeCodeableConcept("method", element.getMethod());
56234      }
56235      if (element.hasBodySite()) {
56236        composeCodeableConcept("bodySite", element.getBodySite());
56237      }
56238      if (element.hasFastingStatus()) {
56239        composeType("fastingStatus", element.getFastingStatus());
56240      }
56241  }
56242
56243  protected void composeSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
56244    if (element != null) {
56245      open(name);
56246      composeSpecimenProcessingComponentProperties(element);
56247      close();
56248    }
56249  }
56250
56251  protected void composeSpecimenProcessingComponentProperties(Specimen.SpecimenProcessingComponent element) throws IOException {
56252    composeBackboneElementProperties(element);
56253      if (element.hasDescriptionElement()) {
56254        composeStringCore("description", element.getDescriptionElement(), false);
56255        composeStringExtras("description", element.getDescriptionElement(), false);
56256      }
56257      if (element.hasProcedure()) {
56258        composeCodeableConcept("procedure", element.getProcedure());
56259      }
56260      if (element.hasAdditive()) {
56261        openArray("additive");
56262        for (Reference e : element.getAdditive()) 
56263          composeReference(null, e);
56264        closeArray();
56265      };
56266      if (element.hasTime()) {
56267        composeType("time", element.getTime());
56268      }
56269  }
56270
56271  protected void composeSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
56272    if (element != null) {
56273      open(name);
56274      composeSpecimenContainerComponentProperties(element);
56275      close();
56276    }
56277  }
56278
56279  protected void composeSpecimenContainerComponentProperties(Specimen.SpecimenContainerComponent element) throws IOException {
56280    composeBackboneElementProperties(element);
56281      if (element.hasIdentifier()) {
56282        openArray("identifier");
56283        for (Identifier e : element.getIdentifier()) 
56284          composeIdentifier(null, e);
56285        closeArray();
56286      };
56287      if (element.hasDescriptionElement()) {
56288        composeStringCore("description", element.getDescriptionElement(), false);
56289        composeStringExtras("description", element.getDescriptionElement(), false);
56290      }
56291      if (element.hasType()) {
56292        composeCodeableConcept("type", element.getType());
56293      }
56294      if (element.hasCapacity()) {
56295        composeQuantity("capacity", element.getCapacity());
56296      }
56297      if (element.hasSpecimenQuantity()) {
56298        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
56299      }
56300      if (element.hasAdditive()) {
56301        composeType("additive", element.getAdditive());
56302      }
56303  }
56304
56305  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
56306    if (element != null) {
56307      prop("resourceType", name);
56308      composeSpecimenDefinitionProperties(element);
56309    }
56310  }
56311
56312  protected void composeSpecimenDefinitionProperties(SpecimenDefinition element) throws IOException {
56313    composeDomainResourceProperties(element);
56314      if (element.hasIdentifier()) {
56315        composeIdentifier("identifier", element.getIdentifier());
56316      }
56317      if (element.hasTypeCollected()) {
56318        composeCodeableConcept("typeCollected", element.getTypeCollected());
56319      }
56320      if (element.hasPatientPreparation()) {
56321        openArray("patientPreparation");
56322        for (CodeableConcept e : element.getPatientPreparation()) 
56323          composeCodeableConcept(null, e);
56324        closeArray();
56325      };
56326      if (element.hasTimeAspectElement()) {
56327        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
56328        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
56329      }
56330      if (element.hasCollection()) {
56331        openArray("collection");
56332        for (CodeableConcept e : element.getCollection()) 
56333          composeCodeableConcept(null, e);
56334        closeArray();
56335      };
56336      if (element.hasTypeTested()) {
56337        openArray("typeTested");
56338        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
56339          composeSpecimenDefinitionTypeTestedComponent(null, e);
56340        closeArray();
56341      };
56342  }
56343
56344  protected void composeSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
56345    if (element != null) {
56346      open(name);
56347      composeSpecimenDefinitionTypeTestedComponentProperties(element);
56348      close();
56349    }
56350  }
56351
56352  protected void composeSpecimenDefinitionTypeTestedComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
56353    composeBackboneElementProperties(element);
56354      if (element.hasIsDerivedElement()) {
56355        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
56356        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
56357      }
56358      if (element.hasType()) {
56359        composeCodeableConcept("type", element.getType());
56360      }
56361      if (element.hasPreferenceElement()) {
56362        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
56363        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
56364      }
56365      if (element.hasContainer()) {
56366        composeSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
56367      }
56368      if (element.hasRequirementElement()) {
56369        composeStringCore("requirement", element.getRequirementElement(), false);
56370        composeStringExtras("requirement", element.getRequirementElement(), false);
56371      }
56372      if (element.hasRetentionTime()) {
56373        composeDuration("retentionTime", element.getRetentionTime());
56374      }
56375      if (element.hasRejectionCriterion()) {
56376        openArray("rejectionCriterion");
56377        for (CodeableConcept e : element.getRejectionCriterion()) 
56378          composeCodeableConcept(null, e);
56379        closeArray();
56380      };
56381      if (element.hasHandling()) {
56382        openArray("handling");
56383        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
56384          composeSpecimenDefinitionTypeTestedHandlingComponent(null, e);
56385        closeArray();
56386      };
56387  }
56388
56389  protected void composeSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
56390    if (element != null) {
56391      open(name);
56392      composeSpecimenDefinitionTypeTestedContainerComponentProperties(element);
56393      close();
56394    }
56395  }
56396
56397  protected void composeSpecimenDefinitionTypeTestedContainerComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
56398    composeBackboneElementProperties(element);
56399      if (element.hasMaterial()) {
56400        composeCodeableConcept("material", element.getMaterial());
56401      }
56402      if (element.hasType()) {
56403        composeCodeableConcept("type", element.getType());
56404      }
56405      if (element.hasCap()) {
56406        composeCodeableConcept("cap", element.getCap());
56407      }
56408      if (element.hasDescriptionElement()) {
56409        composeStringCore("description", element.getDescriptionElement(), false);
56410        composeStringExtras("description", element.getDescriptionElement(), false);
56411      }
56412      if (element.hasCapacity()) {
56413        composeQuantity("capacity", element.getCapacity());
56414      }
56415      if (element.hasMinimumVolume()) {
56416        composeType("minimumVolume", element.getMinimumVolume());
56417      }
56418      if (element.hasAdditive()) {
56419        openArray("additive");
56420        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
56421          composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
56422        closeArray();
56423      };
56424      if (element.hasPreparationElement()) {
56425        composeStringCore("preparation", element.getPreparationElement(), false);
56426        composeStringExtras("preparation", element.getPreparationElement(), false);
56427      }
56428  }
56429
56430  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
56431    if (element != null) {
56432      open(name);
56433      composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(element);
56434      close();
56435    }
56436  }
56437
56438  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
56439    composeBackboneElementProperties(element);
56440      if (element.hasAdditive()) {
56441        composeType("additive", element.getAdditive());
56442      }
56443  }
56444
56445  protected void composeSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
56446    if (element != null) {
56447      open(name);
56448      composeSpecimenDefinitionTypeTestedHandlingComponentProperties(element);
56449      close();
56450    }
56451  }
56452
56453  protected void composeSpecimenDefinitionTypeTestedHandlingComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
56454    composeBackboneElementProperties(element);
56455      if (element.hasTemperatureQualifier()) {
56456        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
56457      }
56458      if (element.hasTemperatureRange()) {
56459        composeRange("temperatureRange", element.getTemperatureRange());
56460      }
56461      if (element.hasMaxDuration()) {
56462        composeDuration("maxDuration", element.getMaxDuration());
56463      }
56464      if (element.hasInstructionElement()) {
56465        composeStringCore("instruction", element.getInstructionElement(), false);
56466        composeStringExtras("instruction", element.getInstructionElement(), false);
56467      }
56468  }
56469
56470  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
56471    if (element != null) {
56472      prop("resourceType", name);
56473      composeStructureDefinitionProperties(element);
56474    }
56475  }
56476
56477  protected void composeStructureDefinitionProperties(StructureDefinition element) throws IOException {
56478    composeDomainResourceProperties(element);
56479      if (element.hasUrlElement()) {
56480        composeUriCore("url", element.getUrlElement(), false);
56481        composeUriExtras("url", element.getUrlElement(), false);
56482      }
56483      if (element.hasIdentifier()) {
56484        openArray("identifier");
56485        for (Identifier e : element.getIdentifier()) 
56486          composeIdentifier(null, e);
56487        closeArray();
56488      };
56489      if (element.hasVersionElement()) {
56490        composeStringCore("version", element.getVersionElement(), false);
56491        composeStringExtras("version", element.getVersionElement(), false);
56492      }
56493      if (element.hasNameElement()) {
56494        composeStringCore("name", element.getNameElement(), false);
56495        composeStringExtras("name", element.getNameElement(), false);
56496      }
56497      if (element.hasTitleElement()) {
56498        composeStringCore("title", element.getTitleElement(), false);
56499        composeStringExtras("title", element.getTitleElement(), false);
56500      }
56501      if (element.hasStatusElement()) {
56502        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56503        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56504      }
56505      if (element.hasExperimentalElement()) {
56506        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56507        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56508      }
56509      if (element.hasDateElement()) {
56510        composeDateTimeCore("date", element.getDateElement(), false);
56511        composeDateTimeExtras("date", element.getDateElement(), false);
56512      }
56513      if (element.hasPublisherElement()) {
56514        composeStringCore("publisher", element.getPublisherElement(), false);
56515        composeStringExtras("publisher", element.getPublisherElement(), false);
56516      }
56517      if (element.hasContact()) {
56518        openArray("contact");
56519        for (ContactDetail e : element.getContact()) 
56520          composeContactDetail(null, e);
56521        closeArray();
56522      };
56523      if (element.hasDescriptionElement()) {
56524        composeMarkdownCore("description", element.getDescriptionElement(), false);
56525        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56526      }
56527      if (element.hasUseContext()) {
56528        openArray("useContext");
56529        for (UsageContext e : element.getUseContext()) 
56530          composeUsageContext(null, e);
56531        closeArray();
56532      };
56533      if (element.hasJurisdiction()) {
56534        openArray("jurisdiction");
56535        for (CodeableConcept e : element.getJurisdiction()) 
56536          composeCodeableConcept(null, e);
56537        closeArray();
56538      };
56539      if (element.hasPurposeElement()) {
56540        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56541        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56542      }
56543      if (element.hasCopyrightElement()) {
56544        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56545        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56546      }
56547      if (element.hasKeyword()) {
56548        openArray("keyword");
56549        for (Coding e : element.getKeyword()) 
56550          composeCoding(null, e);
56551        closeArray();
56552      };
56553      if (element.hasFhirVersionElement()) {
56554        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
56555        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
56556      }
56557      if (element.hasMapping()) {
56558        openArray("mapping");
56559        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
56560          composeStructureDefinitionMappingComponent(null, e);
56561        closeArray();
56562      };
56563      if (element.hasKindElement()) {
56564        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
56565        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
56566      }
56567      if (element.hasAbstractElement()) {
56568        composeBooleanCore("abstract", element.getAbstractElement(), false);
56569        composeBooleanExtras("abstract", element.getAbstractElement(), false);
56570      }
56571      if (element.hasContext()) {
56572        openArray("context");
56573        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
56574          composeStructureDefinitionContextComponent(null, e);
56575        closeArray();
56576      };
56577      if (element.hasContextInvariant()) {
56578        if (anyHasValue(element.getContextInvariant())) {
56579          openArray("contextInvariant");
56580          for (StringType e : element.getContextInvariant()) 
56581            composeStringCore(null, e, e != element.getContextInvariant().get(element.getContextInvariant().size()-1));
56582          closeArray();
56583        }
56584        if (anyHasExtras(element.getContextInvariant())) {
56585          openArray("_contextInvariant");
56586          for (StringType e : element.getContextInvariant()) 
56587            composeStringExtras(null, e, true);
56588          closeArray();
56589        }
56590      };
56591      if (element.hasTypeElement()) {
56592        composeUriCore("type", element.getTypeElement(), false);
56593        composeUriExtras("type", element.getTypeElement(), false);
56594      }
56595      if (element.hasBaseDefinitionElement()) {
56596        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
56597        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
56598      }
56599      if (element.hasDerivationElement()) {
56600        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
56601        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
56602      }
56603      if (element.hasSnapshot()) {
56604        composeStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
56605      }
56606      if (element.hasDifferential()) {
56607        composeStructureDefinitionDifferentialComponent("differential", element.getDifferential());
56608      }
56609  }
56610
56611  protected void composeStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
56612    if (element != null) {
56613      open(name);
56614      composeStructureDefinitionMappingComponentProperties(element);
56615      close();
56616    }
56617  }
56618
56619  protected void composeStructureDefinitionMappingComponentProperties(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
56620    composeBackboneElementProperties(element);
56621      if (element.hasIdentityElement()) {
56622        composeIdCore("identity", element.getIdentityElement(), false);
56623        composeIdExtras("identity", element.getIdentityElement(), false);
56624      }
56625      if (element.hasUriElement()) {
56626        composeUriCore("uri", element.getUriElement(), false);
56627        composeUriExtras("uri", element.getUriElement(), false);
56628      }
56629      if (element.hasNameElement()) {
56630        composeStringCore("name", element.getNameElement(), false);
56631        composeStringExtras("name", element.getNameElement(), false);
56632      }
56633      if (element.hasCommentElement()) {
56634        composeStringCore("comment", element.getCommentElement(), false);
56635        composeStringExtras("comment", element.getCommentElement(), false);
56636      }
56637  }
56638
56639  protected void composeStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
56640    if (element != null) {
56641      open(name);
56642      composeStructureDefinitionContextComponentProperties(element);
56643      close();
56644    }
56645  }
56646
56647  protected void composeStructureDefinitionContextComponentProperties(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
56648    composeBackboneElementProperties(element);
56649      if (element.hasTypeElement()) {
56650        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
56651        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
56652      }
56653      if (element.hasExpressionElement()) {
56654        composeStringCore("expression", element.getExpressionElement(), false);
56655        composeStringExtras("expression", element.getExpressionElement(), false);
56656      }
56657  }
56658
56659  protected void composeStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
56660    if (element != null) {
56661      open(name);
56662      composeStructureDefinitionSnapshotComponentProperties(element);
56663      close();
56664    }
56665  }
56666
56667  protected void composeStructureDefinitionSnapshotComponentProperties(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
56668    composeBackboneElementProperties(element);
56669      if (element.hasElement()) {
56670        openArray("element");
56671        for (ElementDefinition e : element.getElement()) 
56672          composeElementDefinition(null, e);
56673        closeArray();
56674      };
56675  }
56676
56677  protected void composeStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
56678    if (element != null) {
56679      open(name);
56680      composeStructureDefinitionDifferentialComponentProperties(element);
56681      close();
56682    }
56683  }
56684
56685  protected void composeStructureDefinitionDifferentialComponentProperties(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
56686    composeBackboneElementProperties(element);
56687      if (element.hasElement()) {
56688        openArray("element");
56689        for (ElementDefinition e : element.getElement()) 
56690          composeElementDefinition(null, e);
56691        closeArray();
56692      };
56693  }
56694
56695  protected void composeStructureMap(String name, StructureMap element) throws IOException {
56696    if (element != null) {
56697      prop("resourceType", name);
56698      composeStructureMapProperties(element);
56699    }
56700  }
56701
56702  protected void composeStructureMapProperties(StructureMap element) throws IOException {
56703    composeDomainResourceProperties(element);
56704      if (element.hasUrlElement()) {
56705        composeUriCore("url", element.getUrlElement(), false);
56706        composeUriExtras("url", element.getUrlElement(), false);
56707      }
56708      if (element.hasIdentifier()) {
56709        openArray("identifier");
56710        for (Identifier e : element.getIdentifier()) 
56711          composeIdentifier(null, e);
56712        closeArray();
56713      };
56714      if (element.hasVersionElement()) {
56715        composeStringCore("version", element.getVersionElement(), false);
56716        composeStringExtras("version", element.getVersionElement(), false);
56717      }
56718      if (element.hasNameElement()) {
56719        composeStringCore("name", element.getNameElement(), false);
56720        composeStringExtras("name", element.getNameElement(), false);
56721      }
56722      if (element.hasTitleElement()) {
56723        composeStringCore("title", element.getTitleElement(), false);
56724        composeStringExtras("title", element.getTitleElement(), false);
56725      }
56726      if (element.hasStatusElement()) {
56727        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56728        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56729      }
56730      if (element.hasExperimentalElement()) {
56731        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56732        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56733      }
56734      if (element.hasDateElement()) {
56735        composeDateTimeCore("date", element.getDateElement(), false);
56736        composeDateTimeExtras("date", element.getDateElement(), false);
56737      }
56738      if (element.hasPublisherElement()) {
56739        composeStringCore("publisher", element.getPublisherElement(), false);
56740        composeStringExtras("publisher", element.getPublisherElement(), false);
56741      }
56742      if (element.hasContact()) {
56743        openArray("contact");
56744        for (ContactDetail e : element.getContact()) 
56745          composeContactDetail(null, e);
56746        closeArray();
56747      };
56748      if (element.hasDescriptionElement()) {
56749        composeMarkdownCore("description", element.getDescriptionElement(), false);
56750        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56751      }
56752      if (element.hasUseContext()) {
56753        openArray("useContext");
56754        for (UsageContext e : element.getUseContext()) 
56755          composeUsageContext(null, e);
56756        closeArray();
56757      };
56758      if (element.hasJurisdiction()) {
56759        openArray("jurisdiction");
56760        for (CodeableConcept e : element.getJurisdiction()) 
56761          composeCodeableConcept(null, e);
56762        closeArray();
56763      };
56764      if (element.hasPurposeElement()) {
56765        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56766        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56767      }
56768      if (element.hasCopyrightElement()) {
56769        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56770        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56771      }
56772      if (element.hasStructure()) {
56773        openArray("structure");
56774        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
56775          composeStructureMapStructureComponent(null, e);
56776        closeArray();
56777      };
56778      if (element.hasImport()) {
56779        if (anyHasValue(element.getImport())) {
56780          openArray("import");
56781          for (CanonicalType e : element.getImport()) 
56782            composeCanonicalCore(null, e, e != element.getImport().get(element.getImport().size()-1));
56783          closeArray();
56784        }
56785        if (anyHasExtras(element.getImport())) {
56786          openArray("_import");
56787          for (CanonicalType e : element.getImport()) 
56788            composeCanonicalExtras(null, e, true);
56789          closeArray();
56790        }
56791      };
56792      if (element.hasGroup()) {
56793        openArray("group");
56794        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
56795          composeStructureMapGroupComponent(null, e);
56796        closeArray();
56797      };
56798  }
56799
56800  protected void composeStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
56801    if (element != null) {
56802      open(name);
56803      composeStructureMapStructureComponentProperties(element);
56804      close();
56805    }
56806  }
56807
56808  protected void composeStructureMapStructureComponentProperties(StructureMap.StructureMapStructureComponent element) throws IOException {
56809    composeBackboneElementProperties(element);
56810      if (element.hasUrlElement()) {
56811        composeCanonicalCore("url", element.getUrlElement(), false);
56812        composeCanonicalExtras("url", element.getUrlElement(), false);
56813      }
56814      if (element.hasModeElement()) {
56815        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
56816        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
56817      }
56818      if (element.hasAliasElement()) {
56819        composeStringCore("alias", element.getAliasElement(), false);
56820        composeStringExtras("alias", element.getAliasElement(), false);
56821      }
56822      if (element.hasDocumentationElement()) {
56823        composeStringCore("documentation", element.getDocumentationElement(), false);
56824        composeStringExtras("documentation", element.getDocumentationElement(), false);
56825      }
56826  }
56827
56828  protected void composeStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
56829    if (element != null) {
56830      open(name);
56831      composeStructureMapGroupComponentProperties(element);
56832      close();
56833    }
56834  }
56835
56836  protected void composeStructureMapGroupComponentProperties(StructureMap.StructureMapGroupComponent element) throws IOException {
56837    composeBackboneElementProperties(element);
56838      if (element.hasNameElement()) {
56839        composeIdCore("name", element.getNameElement(), false);
56840        composeIdExtras("name", element.getNameElement(), false);
56841      }
56842      if (element.hasExtendsElement()) {
56843        composeIdCore("extends", element.getExtendsElement(), false);
56844        composeIdExtras("extends", element.getExtendsElement(), false);
56845      }
56846      if (element.hasTypeModeElement()) {
56847        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
56848        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
56849      }
56850      if (element.hasDocumentationElement()) {
56851        composeStringCore("documentation", element.getDocumentationElement(), false);
56852        composeStringExtras("documentation", element.getDocumentationElement(), false);
56853      }
56854      if (element.hasInput()) {
56855        openArray("input");
56856        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
56857          composeStructureMapGroupInputComponent(null, e);
56858        closeArray();
56859      };
56860      if (element.hasRule()) {
56861        openArray("rule");
56862        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
56863          composeStructureMapGroupRuleComponent(null, e);
56864        closeArray();
56865      };
56866  }
56867
56868  protected void composeStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
56869    if (element != null) {
56870      open(name);
56871      composeStructureMapGroupInputComponentProperties(element);
56872      close();
56873    }
56874  }
56875
56876  protected void composeStructureMapGroupInputComponentProperties(StructureMap.StructureMapGroupInputComponent element) throws IOException {
56877    composeBackboneElementProperties(element);
56878      if (element.hasNameElement()) {
56879        composeIdCore("name", element.getNameElement(), false);
56880        composeIdExtras("name", element.getNameElement(), false);
56881      }
56882      if (element.hasTypeElement()) {
56883        composeStringCore("type", element.getTypeElement(), false);
56884        composeStringExtras("type", element.getTypeElement(), false);
56885      }
56886      if (element.hasModeElement()) {
56887        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
56888        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
56889      }
56890      if (element.hasDocumentationElement()) {
56891        composeStringCore("documentation", element.getDocumentationElement(), false);
56892        composeStringExtras("documentation", element.getDocumentationElement(), false);
56893      }
56894  }
56895
56896  protected void composeStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
56897    if (element != null) {
56898      open(name);
56899      composeStructureMapGroupRuleComponentProperties(element);
56900      close();
56901    }
56902  }
56903
56904  protected void composeStructureMapGroupRuleComponentProperties(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
56905    composeBackboneElementProperties(element);
56906      if (element.hasNameElement()) {
56907        composeIdCore("name", element.getNameElement(), false);
56908        composeIdExtras("name", element.getNameElement(), false);
56909      }
56910      if (element.hasSource()) {
56911        openArray("source");
56912        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
56913          composeStructureMapGroupRuleSourceComponent(null, e);
56914        closeArray();
56915      };
56916      if (element.hasTarget()) {
56917        openArray("target");
56918        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
56919          composeStructureMapGroupRuleTargetComponent(null, e);
56920        closeArray();
56921      };
56922      if (element.hasRule()) {
56923        openArray("rule");
56924        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
56925          composeStructureMapGroupRuleComponent(null, e);
56926        closeArray();
56927      };
56928      if (element.hasDependent()) {
56929        openArray("dependent");
56930        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
56931          composeStructureMapGroupRuleDependentComponent(null, e);
56932        closeArray();
56933      };
56934      if (element.hasDocumentationElement()) {
56935        composeStringCore("documentation", element.getDocumentationElement(), false);
56936        composeStringExtras("documentation", element.getDocumentationElement(), false);
56937      }
56938  }
56939
56940  protected void composeStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
56941    if (element != null) {
56942      open(name);
56943      composeStructureMapGroupRuleSourceComponentProperties(element);
56944      close();
56945    }
56946  }
56947
56948  protected void composeStructureMapGroupRuleSourceComponentProperties(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
56949    composeBackboneElementProperties(element);
56950      if (element.hasContextElement()) {
56951        composeIdCore("context", element.getContextElement(), false);
56952        composeIdExtras("context", element.getContextElement(), false);
56953      }
56954      if (element.hasMinElement()) {
56955        composeIntegerCore("min", element.getMinElement(), false);
56956        composeIntegerExtras("min", element.getMinElement(), false);
56957      }
56958      if (element.hasMaxElement()) {
56959        composeStringCore("max", element.getMaxElement(), false);
56960        composeStringExtras("max", element.getMaxElement(), false);
56961      }
56962      if (element.hasTypeElement()) {
56963        composeStringCore("type", element.getTypeElement(), false);
56964        composeStringExtras("type", element.getTypeElement(), false);
56965      }
56966      if (element.hasDefaultValue()) {
56967        composeType("defaultValue", element.getDefaultValue());
56968      }
56969      if (element.hasElementElement()) {
56970        composeStringCore("element", element.getElementElement(), false);
56971        composeStringExtras("element", element.getElementElement(), false);
56972      }
56973      if (element.hasListModeElement()) {
56974        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
56975        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
56976      }
56977      if (element.hasVariableElement()) {
56978        composeIdCore("variable", element.getVariableElement(), false);
56979        composeIdExtras("variable", element.getVariableElement(), false);
56980      }
56981      if (element.hasConditionElement()) {
56982        composeStringCore("condition", element.getConditionElement(), false);
56983        composeStringExtras("condition", element.getConditionElement(), false);
56984      }
56985      if (element.hasCheckElement()) {
56986        composeStringCore("check", element.getCheckElement(), false);
56987        composeStringExtras("check", element.getCheckElement(), false);
56988      }
56989      if (element.hasLogMessageElement()) {
56990        composeStringCore("logMessage", element.getLogMessageElement(), false);
56991        composeStringExtras("logMessage", element.getLogMessageElement(), false);
56992      }
56993  }
56994
56995  protected void composeStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
56996    if (element != null) {
56997      open(name);
56998      composeStructureMapGroupRuleTargetComponentProperties(element);
56999      close();
57000    }
57001  }
57002
57003  protected void composeStructureMapGroupRuleTargetComponentProperties(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
57004    composeBackboneElementProperties(element);
57005      if (element.hasContextElement()) {
57006        composeIdCore("context", element.getContextElement(), false);
57007        composeIdExtras("context", element.getContextElement(), false);
57008      }
57009      if (element.hasContextTypeElement()) {
57010        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
57011        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
57012      }
57013      if (element.hasElementElement()) {
57014        composeStringCore("element", element.getElementElement(), false);
57015        composeStringExtras("element", element.getElementElement(), false);
57016      }
57017      if (element.hasVariableElement()) {
57018        composeIdCore("variable", element.getVariableElement(), false);
57019        composeIdExtras("variable", element.getVariableElement(), false);
57020      }
57021      if (element.hasListMode()) {
57022        openArray("listMode");
57023        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
57024          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
57025        closeArray();
57026        if (anyHasExtras(element.getListMode())) {
57027          openArray("_listMode");
57028          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
57029            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
57030          closeArray();
57031        }
57032      };
57033      if (element.hasListRuleIdElement()) {
57034        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
57035        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
57036      }
57037      if (element.hasTransformElement()) {
57038        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
57039        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
57040      }
57041      if (element.hasParameter()) {
57042        openArray("parameter");
57043        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
57044          composeStructureMapGroupRuleTargetParameterComponent(null, e);
57045        closeArray();
57046      };
57047  }
57048
57049  protected void composeStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
57050    if (element != null) {
57051      open(name);
57052      composeStructureMapGroupRuleTargetParameterComponentProperties(element);
57053      close();
57054    }
57055  }
57056
57057  protected void composeStructureMapGroupRuleTargetParameterComponentProperties(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
57058    composeBackboneElementProperties(element);
57059      if (element.hasValue()) {
57060        composeType("value", element.getValue());
57061      }
57062  }
57063
57064  protected void composeStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
57065    if (element != null) {
57066      open(name);
57067      composeStructureMapGroupRuleDependentComponentProperties(element);
57068      close();
57069    }
57070  }
57071
57072  protected void composeStructureMapGroupRuleDependentComponentProperties(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
57073    composeBackboneElementProperties(element);
57074      if (element.hasNameElement()) {
57075        composeIdCore("name", element.getNameElement(), false);
57076        composeIdExtras("name", element.getNameElement(), false);
57077      }
57078      if (element.hasVariable()) {
57079        if (anyHasValue(element.getVariable())) {
57080          openArray("variable");
57081          for (StringType e : element.getVariable()) 
57082            composeStringCore(null, e, e != element.getVariable().get(element.getVariable().size()-1));
57083          closeArray();
57084        }
57085        if (anyHasExtras(element.getVariable())) {
57086          openArray("_variable");
57087          for (StringType e : element.getVariable()) 
57088            composeStringExtras(null, e, true);
57089          closeArray();
57090        }
57091      };
57092  }
57093
57094  protected void composeSubscription(String name, Subscription element) throws IOException {
57095    if (element != null) {
57096      prop("resourceType", name);
57097      composeSubscriptionProperties(element);
57098    }
57099  }
57100
57101  protected void composeSubscriptionProperties(Subscription element) throws IOException {
57102    composeDomainResourceProperties(element);
57103      if (element.hasStatusElement()) {
57104        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.SubscriptionStatusEnumFactory(), false);
57105        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.SubscriptionStatusEnumFactory(), false);
57106      }
57107      if (element.hasContact()) {
57108        openArray("contact");
57109        for (ContactPoint e : element.getContact()) 
57110          composeContactPoint(null, e);
57111        closeArray();
57112      };
57113      if (element.hasEndElement()) {
57114        composeInstantCore("end", element.getEndElement(), false);
57115        composeInstantExtras("end", element.getEndElement(), false);
57116      }
57117      if (element.hasReasonElement()) {
57118        composeStringCore("reason", element.getReasonElement(), false);
57119        composeStringExtras("reason", element.getReasonElement(), false);
57120      }
57121      if (element.hasCriteriaElement()) {
57122        composeStringCore("criteria", element.getCriteriaElement(), false);
57123        composeStringExtras("criteria", element.getCriteriaElement(), false);
57124      }
57125      if (element.hasErrorElement()) {
57126        composeStringCore("error", element.getErrorElement(), false);
57127        composeStringExtras("error", element.getErrorElement(), false);
57128      }
57129      if (element.hasChannel()) {
57130        composeSubscriptionChannelComponent("channel", element.getChannel());
57131      }
57132  }
57133
57134  protected void composeSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
57135    if (element != null) {
57136      open(name);
57137      composeSubscriptionChannelComponentProperties(element);
57138      close();
57139    }
57140  }
57141
57142  protected void composeSubscriptionChannelComponentProperties(Subscription.SubscriptionChannelComponent element) throws IOException {
57143    composeBackboneElementProperties(element);
57144      if (element.hasTypeElement()) {
57145        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
57146        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
57147      }
57148      if (element.hasEndpointElement()) {
57149        composeUrlCore("endpoint", element.getEndpointElement(), false);
57150        composeUrlExtras("endpoint", element.getEndpointElement(), false);
57151      }
57152      if (element.hasPayloadElement()) {
57153        composeCodeCore("payload", element.getPayloadElement(), false);
57154        composeCodeExtras("payload", element.getPayloadElement(), false);
57155      }
57156      if (element.hasHeader()) {
57157        if (anyHasValue(element.getHeader())) {
57158          openArray("header");
57159          for (StringType e : element.getHeader()) 
57160            composeStringCore(null, e, e != element.getHeader().get(element.getHeader().size()-1));
57161          closeArray();
57162        }
57163        if (anyHasExtras(element.getHeader())) {
57164          openArray("_header");
57165          for (StringType e : element.getHeader()) 
57166            composeStringExtras(null, e, true);
57167          closeArray();
57168        }
57169      };
57170  }
57171
57172  protected void composeSubscriptionStatus(String name, SubscriptionStatus element) throws IOException {
57173    if (element != null) {
57174      prop("resourceType", name);
57175      composeSubscriptionStatusProperties(element);
57176    }
57177  }
57178
57179  protected void composeSubscriptionStatusProperties(SubscriptionStatus element) throws IOException {
57180    composeDomainResourceProperties(element);
57181      if (element.hasStatusElement()) {
57182        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.SubscriptionStatusEnumFactory(), false);
57183        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.SubscriptionStatusEnumFactory(), false);
57184      }
57185      if (element.hasTypeElement()) {
57186        composeEnumerationCore("type", element.getTypeElement(), new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory(), false);
57187        composeEnumerationExtras("type", element.getTypeElement(), new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory(), false);
57188      }
57189      if (element.hasEventsSinceSubscriptionStartElement()) {
57190        composeStringCore("eventsSinceSubscriptionStart", element.getEventsSinceSubscriptionStartElement(), false);
57191        composeStringExtras("eventsSinceSubscriptionStart", element.getEventsSinceSubscriptionStartElement(), false);
57192      }
57193      if (element.hasEventsInNotificationElement()) {
57194        composeIntegerCore("eventsInNotification", element.getEventsInNotificationElement(), false);
57195        composeIntegerExtras("eventsInNotification", element.getEventsInNotificationElement(), false);
57196      }
57197      if (element.hasNotificationEvent()) {
57198        openArray("notificationEvent");
57199        for (SubscriptionStatus.SubscriptionStatusNotificationEventComponent e : element.getNotificationEvent()) 
57200          composeSubscriptionStatusNotificationEventComponent(null, e);
57201        closeArray();
57202      };
57203      if (element.hasSubscription()) {
57204        composeReference("subscription", element.getSubscription());
57205      }
57206      if (element.hasTopicElement()) {
57207        composeCanonicalCore("topic", element.getTopicElement(), false);
57208        composeCanonicalExtras("topic", element.getTopicElement(), false);
57209      }
57210      if (element.hasError()) {
57211        openArray("error");
57212        for (CodeableConcept e : element.getError()) 
57213          composeCodeableConcept(null, e);
57214        closeArray();
57215      };
57216  }
57217
57218  protected void composeSubscriptionStatusNotificationEventComponent(String name, SubscriptionStatus.SubscriptionStatusNotificationEventComponent element) throws IOException {
57219    if (element != null) {
57220      open(name);
57221      composeSubscriptionStatusNotificationEventComponentProperties(element);
57222      close();
57223    }
57224  }
57225
57226  protected void composeSubscriptionStatusNotificationEventComponentProperties(SubscriptionStatus.SubscriptionStatusNotificationEventComponent element) throws IOException {
57227    composeBackboneElementProperties(element);
57228      if (element.hasEventNumberElement()) {
57229        composeStringCore("eventNumber", element.getEventNumberElement(), false);
57230        composeStringExtras("eventNumber", element.getEventNumberElement(), false);
57231      }
57232      if (element.hasTimestampElement()) {
57233        composeInstantCore("timestamp", element.getTimestampElement(), false);
57234        composeInstantExtras("timestamp", element.getTimestampElement(), false);
57235      }
57236      if (element.hasFocus()) {
57237        composeReference("focus", element.getFocus());
57238      }
57239      if (element.hasAdditionalContext()) {
57240        openArray("additionalContext");
57241        for (Reference e : element.getAdditionalContext()) 
57242          composeReference(null, e);
57243        closeArray();
57244      };
57245  }
57246
57247  protected void composeSubscriptionTopic(String name, SubscriptionTopic element) throws IOException {
57248    if (element != null) {
57249      prop("resourceType", name);
57250      composeSubscriptionTopicProperties(element);
57251    }
57252  }
57253
57254  protected void composeSubscriptionTopicProperties(SubscriptionTopic element) throws IOException {
57255    composeDomainResourceProperties(element);
57256      if (element.hasUrlElement()) {
57257        composeUriCore("url", element.getUrlElement(), false);
57258        composeUriExtras("url", element.getUrlElement(), false);
57259      }
57260      if (element.hasIdentifier()) {
57261        openArray("identifier");
57262        for (Identifier e : element.getIdentifier()) 
57263          composeIdentifier(null, e);
57264        closeArray();
57265      };
57266      if (element.hasVersionElement()) {
57267        composeStringCore("version", element.getVersionElement(), false);
57268        composeStringExtras("version", element.getVersionElement(), false);
57269      }
57270      if (element.hasTitleElement()) {
57271        composeStringCore("title", element.getTitleElement(), false);
57272        composeStringExtras("title", element.getTitleElement(), false);
57273      }
57274      if (element.hasDerivedFrom()) {
57275        if (anyHasValue(element.getDerivedFrom())) {
57276          openArray("derivedFrom");
57277          for (CanonicalType e : element.getDerivedFrom()) 
57278            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
57279          closeArray();
57280        }
57281        if (anyHasExtras(element.getDerivedFrom())) {
57282          openArray("_derivedFrom");
57283          for (CanonicalType e : element.getDerivedFrom()) 
57284            composeCanonicalExtras(null, e, true);
57285          closeArray();
57286        }
57287      };
57288      if (element.hasStatusElement()) {
57289        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57290        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57291      }
57292      if (element.hasExperimentalElement()) {
57293        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57294        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57295      }
57296      if (element.hasDateElement()) {
57297        composeDateTimeCore("date", element.getDateElement(), false);
57298        composeDateTimeExtras("date", element.getDateElement(), false);
57299      }
57300      if (element.hasPublisherElement()) {
57301        composeStringCore("publisher", element.getPublisherElement(), false);
57302        composeStringExtras("publisher", element.getPublisherElement(), false);
57303      }
57304      if (element.hasContact()) {
57305        openArray("contact");
57306        for (ContactDetail e : element.getContact()) 
57307          composeContactDetail(null, e);
57308        closeArray();
57309      };
57310      if (element.hasDescriptionElement()) {
57311        composeMarkdownCore("description", element.getDescriptionElement(), false);
57312        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57313      }
57314      if (element.hasUseContext()) {
57315        openArray("useContext");
57316        for (UsageContext e : element.getUseContext()) 
57317          composeUsageContext(null, e);
57318        closeArray();
57319      };
57320      if (element.hasJurisdiction()) {
57321        openArray("jurisdiction");
57322        for (CodeableConcept e : element.getJurisdiction()) 
57323          composeCodeableConcept(null, e);
57324        closeArray();
57325      };
57326      if (element.hasPurposeElement()) {
57327        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57328        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57329      }
57330      if (element.hasCopyrightElement()) {
57331        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57332        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57333      }
57334      if (element.hasApprovalDateElement()) {
57335        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
57336        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
57337      }
57338      if (element.hasLastReviewDateElement()) {
57339        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
57340        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
57341      }
57342      if (element.hasEffectivePeriod()) {
57343        composePeriod("effectivePeriod", element.getEffectivePeriod());
57344      }
57345      if (element.hasResourceTrigger()) {
57346        openArray("resourceTrigger");
57347        for (SubscriptionTopic.SubscriptionTopicResourceTriggerComponent e : element.getResourceTrigger()) 
57348          composeSubscriptionTopicResourceTriggerComponent(null, e);
57349        closeArray();
57350      };
57351      if (element.hasEventTrigger()) {
57352        openArray("eventTrigger");
57353        for (SubscriptionTopic.SubscriptionTopicEventTriggerComponent e : element.getEventTrigger()) 
57354          composeSubscriptionTopicEventTriggerComponent(null, e);
57355        closeArray();
57356      };
57357      if (element.hasCanFilterBy()) {
57358        openArray("canFilterBy");
57359        for (SubscriptionTopic.SubscriptionTopicCanFilterByComponent e : element.getCanFilterBy()) 
57360          composeSubscriptionTopicCanFilterByComponent(null, e);
57361        closeArray();
57362      };
57363      if (element.hasNotificationShape()) {
57364        openArray("notificationShape");
57365        for (SubscriptionTopic.SubscriptionTopicNotificationShapeComponent e : element.getNotificationShape()) 
57366          composeSubscriptionTopicNotificationShapeComponent(null, e);
57367        closeArray();
57368      };
57369  }
57370
57371  protected void composeSubscriptionTopicResourceTriggerComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
57372    if (element != null) {
57373      open(name);
57374      composeSubscriptionTopicResourceTriggerComponentProperties(element);
57375      close();
57376    }
57377  }
57378
57379  protected void composeSubscriptionTopicResourceTriggerComponentProperties(SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
57380    composeBackboneElementProperties(element);
57381      if (element.hasDescriptionElement()) {
57382        composeMarkdownCore("description", element.getDescriptionElement(), false);
57383        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57384      }
57385      if (element.hasResourceElement()) {
57386        composeUriCore("resource", element.getResourceElement(), false);
57387        composeUriExtras("resource", element.getResourceElement(), false);
57388      }
57389      if (element.hasSupportedInteraction()) {
57390        openArray("supportedInteraction");
57391        for (Enumeration<SubscriptionTopic.InteractionTrigger> e : element.getSupportedInteraction()) 
57392          composeEnumerationCore(null, e, new SubscriptionTopic.InteractionTriggerEnumFactory(), true);
57393        closeArray();
57394        if (anyHasExtras(element.getSupportedInteraction())) {
57395          openArray("_supportedInteraction");
57396          for (Enumeration<SubscriptionTopic.InteractionTrigger> e : element.getSupportedInteraction()) 
57397            composeEnumerationExtras(null, e, new SubscriptionTopic.InteractionTriggerEnumFactory(), true);
57398          closeArray();
57399        }
57400      };
57401      if (element.hasQueryCriteria()) {
57402        composeSubscriptionTopicResourceTriggerQueryCriteriaComponent("queryCriteria", element.getQueryCriteria());
57403      }
57404      if (element.hasFhirPathCriteriaElement()) {
57405        composeStringCore("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
57406        composeStringExtras("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
57407      }
57408  }
57409
57410  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
57411    if (element != null) {
57412      open(name);
57413      composeSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(element);
57414      close();
57415    }
57416  }
57417
57418  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
57419    composeBackboneElementProperties(element);
57420      if (element.hasPreviousElement()) {
57421        composeStringCore("previous", element.getPreviousElement(), false);
57422        composeStringExtras("previous", element.getPreviousElement(), false);
57423      }
57424      if (element.hasResultForCreateElement()) {
57425        composeEnumerationCore("resultForCreate", element.getResultForCreateElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
57426        composeEnumerationExtras("resultForCreate", element.getResultForCreateElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
57427      }
57428      if (element.hasCurrentElement()) {
57429        composeStringCore("current", element.getCurrentElement(), false);
57430        composeStringExtras("current", element.getCurrentElement(), false);
57431      }
57432      if (element.hasResultForDeleteElement()) {
57433        composeEnumerationCore("resultForDelete", element.getResultForDeleteElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
57434        composeEnumerationExtras("resultForDelete", element.getResultForDeleteElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
57435      }
57436      if (element.hasRequireBothElement()) {
57437        composeBooleanCore("requireBoth", element.getRequireBothElement(), false);
57438        composeBooleanExtras("requireBoth", element.getRequireBothElement(), false);
57439      }
57440  }
57441
57442  protected void composeSubscriptionTopicEventTriggerComponent(String name, SubscriptionTopic.SubscriptionTopicEventTriggerComponent element) throws IOException {
57443    if (element != null) {
57444      open(name);
57445      composeSubscriptionTopicEventTriggerComponentProperties(element);
57446      close();
57447    }
57448  }
57449
57450  protected void composeSubscriptionTopicEventTriggerComponentProperties(SubscriptionTopic.SubscriptionTopicEventTriggerComponent element) throws IOException {
57451    composeBackboneElementProperties(element);
57452      if (element.hasDescriptionElement()) {
57453        composeMarkdownCore("description", element.getDescriptionElement(), false);
57454        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57455      }
57456      if (element.hasEvent()) {
57457        composeCodeableConcept("event", element.getEvent());
57458      }
57459      if (element.hasResourceElement()) {
57460        composeUriCore("resource", element.getResourceElement(), false);
57461        composeUriExtras("resource", element.getResourceElement(), false);
57462      }
57463  }
57464
57465  protected void composeSubscriptionTopicCanFilterByComponent(String name, SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
57466    if (element != null) {
57467      open(name);
57468      composeSubscriptionTopicCanFilterByComponentProperties(element);
57469      close();
57470    }
57471  }
57472
57473  protected void composeSubscriptionTopicCanFilterByComponentProperties(SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
57474    composeBackboneElementProperties(element);
57475      if (element.hasDescriptionElement()) {
57476        composeMarkdownCore("description", element.getDescriptionElement(), false);
57477        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57478      }
57479      if (element.hasResourceElement()) {
57480        composeUriCore("resource", element.getResourceElement(), false);
57481        composeUriExtras("resource", element.getResourceElement(), false);
57482      }
57483      if (element.hasFilterParameterElement()) {
57484        composeStringCore("filterParameter", element.getFilterParameterElement(), false);
57485        composeStringExtras("filterParameter", element.getFilterParameterElement(), false);
57486      }
57487      if (element.hasModifier()) {
57488        openArray("modifier");
57489        for (Enumeration<SubscriptionTopic.SubscriptionSearchModifier> e : element.getModifier()) 
57490          composeEnumerationCore(null, e, new SubscriptionTopic.SubscriptionSearchModifierEnumFactory(), true);
57491        closeArray();
57492        if (anyHasExtras(element.getModifier())) {
57493          openArray("_modifier");
57494          for (Enumeration<SubscriptionTopic.SubscriptionSearchModifier> e : element.getModifier()) 
57495            composeEnumerationExtras(null, e, new SubscriptionTopic.SubscriptionSearchModifierEnumFactory(), true);
57496          closeArray();
57497        }
57498      };
57499  }
57500
57501  protected void composeSubscriptionTopicNotificationShapeComponent(String name, SubscriptionTopic.SubscriptionTopicNotificationShapeComponent element) throws IOException {
57502    if (element != null) {
57503      open(name);
57504      composeSubscriptionTopicNotificationShapeComponentProperties(element);
57505      close();
57506    }
57507  }
57508
57509  protected void composeSubscriptionTopicNotificationShapeComponentProperties(SubscriptionTopic.SubscriptionTopicNotificationShapeComponent element) throws IOException {
57510    composeBackboneElementProperties(element);
57511      if (element.hasResourceElement()) {
57512        composeUriCore("resource", element.getResourceElement(), false);
57513        composeUriExtras("resource", element.getResourceElement(), false);
57514      }
57515      if (element.hasInclude()) {
57516        if (anyHasValue(element.getInclude())) {
57517          openArray("include");
57518          for (StringType e : element.getInclude()) 
57519            composeStringCore(null, e, e != element.getInclude().get(element.getInclude().size()-1));
57520          closeArray();
57521        }
57522        if (anyHasExtras(element.getInclude())) {
57523          openArray("_include");
57524          for (StringType e : element.getInclude()) 
57525            composeStringExtras(null, e, true);
57526          closeArray();
57527        }
57528      };
57529      if (element.hasRevInclude()) {
57530        if (anyHasValue(element.getRevInclude())) {
57531          openArray("revInclude");
57532          for (StringType e : element.getRevInclude()) 
57533            composeStringCore(null, e, e != element.getRevInclude().get(element.getRevInclude().size()-1));
57534          closeArray();
57535        }
57536        if (anyHasExtras(element.getRevInclude())) {
57537          openArray("_revInclude");
57538          for (StringType e : element.getRevInclude()) 
57539            composeStringExtras(null, e, true);
57540          closeArray();
57541        }
57542      };
57543  }
57544
57545  protected void composeSubstance(String name, Substance element) throws IOException {
57546    if (element != null) {
57547      prop("resourceType", name);
57548      composeSubstanceProperties(element);
57549    }
57550  }
57551
57552  protected void composeSubstanceProperties(Substance element) throws IOException {
57553    composeDomainResourceProperties(element);
57554      if (element.hasIdentifier()) {
57555        openArray("identifier");
57556        for (Identifier e : element.getIdentifier()) 
57557          composeIdentifier(null, e);
57558        closeArray();
57559      };
57560      if (element.hasStatusElement()) {
57561        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
57562        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
57563      }
57564      if (element.hasCategory()) {
57565        openArray("category");
57566        for (CodeableConcept e : element.getCategory()) 
57567          composeCodeableConcept(null, e);
57568        closeArray();
57569      };
57570      if (element.hasCode()) {
57571        composeCodeableConcept("code", element.getCode());
57572      }
57573      if (element.hasDescriptionElement()) {
57574        composeStringCore("description", element.getDescriptionElement(), false);
57575        composeStringExtras("description", element.getDescriptionElement(), false);
57576      }
57577      if (element.hasInstance()) {
57578        openArray("instance");
57579        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
57580          composeSubstanceInstanceComponent(null, e);
57581        closeArray();
57582      };
57583      if (element.hasIngredient()) {
57584        openArray("ingredient");
57585        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
57586          composeSubstanceIngredientComponent(null, e);
57587        closeArray();
57588      };
57589  }
57590
57591  protected void composeSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
57592    if (element != null) {
57593      open(name);
57594      composeSubstanceInstanceComponentProperties(element);
57595      close();
57596    }
57597  }
57598
57599  protected void composeSubstanceInstanceComponentProperties(Substance.SubstanceInstanceComponent element) throws IOException {
57600    composeBackboneElementProperties(element);
57601      if (element.hasIdentifier()) {
57602        composeIdentifier("identifier", element.getIdentifier());
57603      }
57604      if (element.hasExpiryElement()) {
57605        composeDateTimeCore("expiry", element.getExpiryElement(), false);
57606        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
57607      }
57608      if (element.hasQuantity()) {
57609        composeQuantity("quantity", element.getQuantity());
57610      }
57611  }
57612
57613  protected void composeSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
57614    if (element != null) {
57615      open(name);
57616      composeSubstanceIngredientComponentProperties(element);
57617      close();
57618    }
57619  }
57620
57621  protected void composeSubstanceIngredientComponentProperties(Substance.SubstanceIngredientComponent element) throws IOException {
57622    composeBackboneElementProperties(element);
57623      if (element.hasQuantity()) {
57624        composeRatio("quantity", element.getQuantity());
57625      }
57626      if (element.hasSubstance()) {
57627        composeType("substance", element.getSubstance());
57628      }
57629  }
57630
57631  protected void composeSubstanceDefinition(String name, SubstanceDefinition element) throws IOException {
57632    if (element != null) {
57633      prop("resourceType", name);
57634      composeSubstanceDefinitionProperties(element);
57635    }
57636  }
57637
57638  protected void composeSubstanceDefinitionProperties(SubstanceDefinition element) throws IOException {
57639    composeDomainResourceProperties(element);
57640      if (element.hasIdentifier()) {
57641        openArray("identifier");
57642        for (Identifier e : element.getIdentifier()) 
57643          composeIdentifier(null, e);
57644        closeArray();
57645      };
57646      if (element.hasVersionElement()) {
57647        composeStringCore("version", element.getVersionElement(), false);
57648        composeStringExtras("version", element.getVersionElement(), false);
57649      }
57650      if (element.hasStatus()) {
57651        composeCodeableConcept("status", element.getStatus());
57652      }
57653      if (element.hasClassification()) {
57654        openArray("classification");
57655        for (CodeableConcept e : element.getClassification()) 
57656          composeCodeableConcept(null, e);
57657        closeArray();
57658      };
57659      if (element.hasDomain()) {
57660        composeCodeableConcept("domain", element.getDomain());
57661      }
57662      if (element.hasGrade()) {
57663        openArray("grade");
57664        for (CodeableConcept e : element.getGrade()) 
57665          composeCodeableConcept(null, e);
57666        closeArray();
57667      };
57668      if (element.hasDescriptionElement()) {
57669        composeMarkdownCore("description", element.getDescriptionElement(), false);
57670        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57671      }
57672      if (element.hasInformationSource()) {
57673        openArray("informationSource");
57674        for (Reference e : element.getInformationSource()) 
57675          composeReference(null, e);
57676        closeArray();
57677      };
57678      if (element.hasNote()) {
57679        openArray("note");
57680        for (Annotation e : element.getNote()) 
57681          composeAnnotation(null, e);
57682        closeArray();
57683      };
57684      if (element.hasManufacturer()) {
57685        openArray("manufacturer");
57686        for (Reference e : element.getManufacturer()) 
57687          composeReference(null, e);
57688        closeArray();
57689      };
57690      if (element.hasSupplier()) {
57691        openArray("supplier");
57692        for (Reference e : element.getSupplier()) 
57693          composeReference(null, e);
57694        closeArray();
57695      };
57696      if (element.hasMoiety()) {
57697        openArray("moiety");
57698        for (SubstanceDefinition.SubstanceDefinitionMoietyComponent e : element.getMoiety()) 
57699          composeSubstanceDefinitionMoietyComponent(null, e);
57700        closeArray();
57701      };
57702      if (element.hasProperty()) {
57703        openArray("property");
57704        for (SubstanceDefinition.SubstanceDefinitionPropertyComponent e : element.getProperty()) 
57705          composeSubstanceDefinitionPropertyComponent(null, e);
57706        closeArray();
57707      };
57708      if (element.hasMolecularWeight()) {
57709        openArray("molecularWeight");
57710        for (SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent e : element.getMolecularWeight()) 
57711          composeSubstanceDefinitionMolecularWeightComponent(null, e);
57712        closeArray();
57713      };
57714      if (element.hasStructure()) {
57715        composeSubstanceDefinitionStructureComponent("structure", element.getStructure());
57716      }
57717      if (element.hasCode()) {
57718        openArray("code");
57719        for (SubstanceDefinition.SubstanceDefinitionCodeComponent e : element.getCode()) 
57720          composeSubstanceDefinitionCodeComponent(null, e);
57721        closeArray();
57722      };
57723      if (element.hasName()) {
57724        openArray("name");
57725        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getName()) 
57726          composeSubstanceDefinitionNameComponent(null, e);
57727        closeArray();
57728      };
57729      if (element.hasRelationship()) {
57730        openArray("relationship");
57731        for (SubstanceDefinition.SubstanceDefinitionRelationshipComponent e : element.getRelationship()) 
57732          composeSubstanceDefinitionRelationshipComponent(null, e);
57733        closeArray();
57734      };
57735      if (element.hasSourceMaterial()) {
57736        composeSubstanceDefinitionSourceMaterialComponent("sourceMaterial", element.getSourceMaterial());
57737      }
57738  }
57739
57740  protected void composeSubstanceDefinitionMoietyComponent(String name, SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
57741    if (element != null) {
57742      open(name);
57743      composeSubstanceDefinitionMoietyComponentProperties(element);
57744      close();
57745    }
57746  }
57747
57748  protected void composeSubstanceDefinitionMoietyComponentProperties(SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
57749    composeBackboneElementProperties(element);
57750      if (element.hasRole()) {
57751        composeCodeableConcept("role", element.getRole());
57752      }
57753      if (element.hasIdentifier()) {
57754        composeIdentifier("identifier", element.getIdentifier());
57755      }
57756      if (element.hasNameElement()) {
57757        composeStringCore("name", element.getNameElement(), false);
57758        composeStringExtras("name", element.getNameElement(), false);
57759      }
57760      if (element.hasStereochemistry()) {
57761        composeCodeableConcept("stereochemistry", element.getStereochemistry());
57762      }
57763      if (element.hasOpticalActivity()) {
57764        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
57765      }
57766      if (element.hasMolecularFormulaElement()) {
57767        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
57768        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
57769      }
57770      if (element.hasAmount()) {
57771        composeType("amount", element.getAmount());
57772      }
57773      if (element.hasAmountType()) {
57774        composeCodeableConcept("amountType", element.getAmountType());
57775      }
57776  }
57777
57778  protected void composeSubstanceDefinitionPropertyComponent(String name, SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
57779    if (element != null) {
57780      open(name);
57781      composeSubstanceDefinitionPropertyComponentProperties(element);
57782      close();
57783    }
57784  }
57785
57786  protected void composeSubstanceDefinitionPropertyComponentProperties(SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
57787    composeBackboneElementProperties(element);
57788      if (element.hasType()) {
57789        composeCodeableConcept("type", element.getType());
57790      }
57791      if (element.hasValue()) {
57792        composeType("value", element.getValue());
57793      }
57794  }
57795
57796  protected void composeSubstanceDefinitionMolecularWeightComponent(String name, SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent element) throws IOException {
57797    if (element != null) {
57798      open(name);
57799      composeSubstanceDefinitionMolecularWeightComponentProperties(element);
57800      close();
57801    }
57802  }
57803
57804  protected void composeSubstanceDefinitionMolecularWeightComponentProperties(SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent element) throws IOException {
57805    composeBackboneElementProperties(element);
57806      if (element.hasMethod()) {
57807        composeCodeableConcept("method", element.getMethod());
57808      }
57809      if (element.hasType()) {
57810        composeCodeableConcept("type", element.getType());
57811      }
57812      if (element.hasAmount()) {
57813        composeQuantity("amount", element.getAmount());
57814      }
57815  }
57816
57817  protected void composeSubstanceDefinitionStructureComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
57818    if (element != null) {
57819      open(name);
57820      composeSubstanceDefinitionStructureComponentProperties(element);
57821      close();
57822    }
57823  }
57824
57825  protected void composeSubstanceDefinitionStructureComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
57826    composeBackboneElementProperties(element);
57827      if (element.hasStereochemistry()) {
57828        composeCodeableConcept("stereochemistry", element.getStereochemistry());
57829      }
57830      if (element.hasOpticalActivity()) {
57831        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
57832      }
57833      if (element.hasMolecularFormulaElement()) {
57834        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
57835        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
57836      }
57837      if (element.hasMolecularFormulaByMoietyElement()) {
57838        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
57839        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
57840      }
57841      if (element.hasMolecularWeight()) {
57842        composeSubstanceDefinitionMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
57843      }
57844      if (element.hasTechnique()) {
57845        openArray("technique");
57846        for (CodeableConcept e : element.getTechnique()) 
57847          composeCodeableConcept(null, e);
57848        closeArray();
57849      };
57850      if (element.hasSourceDocument()) {
57851        openArray("sourceDocument");
57852        for (Reference e : element.getSourceDocument()) 
57853          composeReference(null, e);
57854        closeArray();
57855      };
57856      if (element.hasRepresentation()) {
57857        openArray("representation");
57858        for (SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent e : element.getRepresentation()) 
57859          composeSubstanceDefinitionStructureRepresentationComponent(null, e);
57860        closeArray();
57861      };
57862  }
57863
57864  protected void composeSubstanceDefinitionStructureRepresentationComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
57865    if (element != null) {
57866      open(name);
57867      composeSubstanceDefinitionStructureRepresentationComponentProperties(element);
57868      close();
57869    }
57870  }
57871
57872  protected void composeSubstanceDefinitionStructureRepresentationComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
57873    composeBackboneElementProperties(element);
57874      if (element.hasType()) {
57875        composeCodeableConcept("type", element.getType());
57876      }
57877      if (element.hasRepresentationElement()) {
57878        composeStringCore("representation", element.getRepresentationElement(), false);
57879        composeStringExtras("representation", element.getRepresentationElement(), false);
57880      }
57881      if (element.hasFormat()) {
57882        composeCodeableConcept("format", element.getFormat());
57883      }
57884      if (element.hasDocument()) {
57885        composeReference("document", element.getDocument());
57886      }
57887  }
57888
57889  protected void composeSubstanceDefinitionCodeComponent(String name, SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
57890    if (element != null) {
57891      open(name);
57892      composeSubstanceDefinitionCodeComponentProperties(element);
57893      close();
57894    }
57895  }
57896
57897  protected void composeSubstanceDefinitionCodeComponentProperties(SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
57898    composeBackboneElementProperties(element);
57899      if (element.hasCode()) {
57900        composeCodeableConcept("code", element.getCode());
57901      }
57902      if (element.hasStatus()) {
57903        composeCodeableConcept("status", element.getStatus());
57904      }
57905      if (element.hasStatusDateElement()) {
57906        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
57907        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
57908      }
57909      if (element.hasNote()) {
57910        openArray("note");
57911        for (Annotation e : element.getNote()) 
57912          composeAnnotation(null, e);
57913        closeArray();
57914      };
57915      if (element.hasSource()) {
57916        openArray("source");
57917        for (Reference e : element.getSource()) 
57918          composeReference(null, e);
57919        closeArray();
57920      };
57921  }
57922
57923  protected void composeSubstanceDefinitionNameComponent(String name, SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
57924    if (element != null) {
57925      open(name);
57926      composeSubstanceDefinitionNameComponentProperties(element);
57927      close();
57928    }
57929  }
57930
57931  protected void composeSubstanceDefinitionNameComponentProperties(SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
57932    composeBackboneElementProperties(element);
57933      if (element.hasNameElement()) {
57934        composeStringCore("name", element.getNameElement(), false);
57935        composeStringExtras("name", element.getNameElement(), false);
57936      }
57937      if (element.hasType()) {
57938        composeCodeableConcept("type", element.getType());
57939      }
57940      if (element.hasStatus()) {
57941        composeCodeableConcept("status", element.getStatus());
57942      }
57943      if (element.hasPreferredElement()) {
57944        composeBooleanCore("preferred", element.getPreferredElement(), false);
57945        composeBooleanExtras("preferred", element.getPreferredElement(), false);
57946      }
57947      if (element.hasLanguage()) {
57948        openArray("language");
57949        for (CodeableConcept e : element.getLanguage()) 
57950          composeCodeableConcept(null, e);
57951        closeArray();
57952      };
57953      if (element.hasDomain()) {
57954        openArray("domain");
57955        for (CodeableConcept e : element.getDomain()) 
57956          composeCodeableConcept(null, e);
57957        closeArray();
57958      };
57959      if (element.hasJurisdiction()) {
57960        openArray("jurisdiction");
57961        for (CodeableConcept e : element.getJurisdiction()) 
57962          composeCodeableConcept(null, e);
57963        closeArray();
57964      };
57965      if (element.hasSynonym()) {
57966        openArray("synonym");
57967        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getSynonym()) 
57968          composeSubstanceDefinitionNameComponent(null, e);
57969        closeArray();
57970      };
57971      if (element.hasTranslation()) {
57972        openArray("translation");
57973        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getTranslation()) 
57974          composeSubstanceDefinitionNameComponent(null, e);
57975        closeArray();
57976      };
57977      if (element.hasOfficial()) {
57978        openArray("official");
57979        for (SubstanceDefinition.SubstanceDefinitionNameOfficialComponent e : element.getOfficial()) 
57980          composeSubstanceDefinitionNameOfficialComponent(null, e);
57981        closeArray();
57982      };
57983      if (element.hasSource()) {
57984        openArray("source");
57985        for (Reference e : element.getSource()) 
57986          composeReference(null, e);
57987        closeArray();
57988      };
57989  }
57990
57991  protected void composeSubstanceDefinitionNameOfficialComponent(String name, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
57992    if (element != null) {
57993      open(name);
57994      composeSubstanceDefinitionNameOfficialComponentProperties(element);
57995      close();
57996    }
57997  }
57998
57999  protected void composeSubstanceDefinitionNameOfficialComponentProperties(SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
58000    composeBackboneElementProperties(element);
58001      if (element.hasAuthority()) {
58002        composeCodeableConcept("authority", element.getAuthority());
58003      }
58004      if (element.hasStatus()) {
58005        composeCodeableConcept("status", element.getStatus());
58006      }
58007      if (element.hasDateElement()) {
58008        composeDateTimeCore("date", element.getDateElement(), false);
58009        composeDateTimeExtras("date", element.getDateElement(), false);
58010      }
58011  }
58012
58013  protected void composeSubstanceDefinitionRelationshipComponent(String name, SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
58014    if (element != null) {
58015      open(name);
58016      composeSubstanceDefinitionRelationshipComponentProperties(element);
58017      close();
58018    }
58019  }
58020
58021  protected void composeSubstanceDefinitionRelationshipComponentProperties(SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
58022    composeBackboneElementProperties(element);
58023      if (element.hasSubstanceDefinition()) {
58024        composeType("substanceDefinition", element.getSubstanceDefinition());
58025      }
58026      if (element.hasType()) {
58027        composeCodeableConcept("type", element.getType());
58028      }
58029      if (element.hasIsDefiningElement()) {
58030        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
58031        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
58032      }
58033      if (element.hasAmount()) {
58034        composeType("amount", element.getAmount());
58035      }
58036      if (element.hasAmountRatioHighLimit()) {
58037        composeRatio("amountRatioHighLimit", element.getAmountRatioHighLimit());
58038      }
58039      if (element.hasAmountType()) {
58040        composeCodeableConcept("amountType", element.getAmountType());
58041      }
58042      if (element.hasSource()) {
58043        openArray("source");
58044        for (Reference e : element.getSource()) 
58045          composeReference(null, e);
58046        closeArray();
58047      };
58048  }
58049
58050  protected void composeSubstanceDefinitionSourceMaterialComponent(String name, SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent element) throws IOException {
58051    if (element != null) {
58052      open(name);
58053      composeSubstanceDefinitionSourceMaterialComponentProperties(element);
58054      close();
58055    }
58056  }
58057
58058  protected void composeSubstanceDefinitionSourceMaterialComponentProperties(SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent element) throws IOException {
58059    composeBackboneElementProperties(element);
58060      if (element.hasType()) {
58061        composeCodeableConcept("type", element.getType());
58062      }
58063      if (element.hasGenus()) {
58064        composeCodeableConcept("genus", element.getGenus());
58065      }
58066      if (element.hasSpecies()) {
58067        composeCodeableConcept("species", element.getSpecies());
58068      }
58069      if (element.hasPart()) {
58070        composeCodeableConcept("part", element.getPart());
58071      }
58072      if (element.hasCountryOfOrigin()) {
58073        openArray("countryOfOrigin");
58074        for (CodeableConcept e : element.getCountryOfOrigin()) 
58075          composeCodeableConcept(null, e);
58076        closeArray();
58077      };
58078  }
58079
58080  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
58081    if (element != null) {
58082      prop("resourceType", name);
58083      composeSupplyDeliveryProperties(element);
58084    }
58085  }
58086
58087  protected void composeSupplyDeliveryProperties(SupplyDelivery element) throws IOException {
58088    composeDomainResourceProperties(element);
58089      if (element.hasIdentifier()) {
58090        openArray("identifier");
58091        for (Identifier e : element.getIdentifier()) 
58092          composeIdentifier(null, e);
58093        closeArray();
58094      };
58095      if (element.hasBasedOn()) {
58096        openArray("basedOn");
58097        for (Reference e : element.getBasedOn()) 
58098          composeReference(null, e);
58099        closeArray();
58100      };
58101      if (element.hasPartOf()) {
58102        openArray("partOf");
58103        for (Reference e : element.getPartOf()) 
58104          composeReference(null, e);
58105        closeArray();
58106      };
58107      if (element.hasStatusElement()) {
58108        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
58109        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
58110      }
58111      if (element.hasPatient()) {
58112        composeReference("patient", element.getPatient());
58113      }
58114      if (element.hasType()) {
58115        composeCodeableConcept("type", element.getType());
58116      }
58117      if (element.hasSuppliedItem()) {
58118        composeSupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
58119      }
58120      if (element.hasOccurrence()) {
58121        composeType("occurrence", element.getOccurrence());
58122      }
58123      if (element.hasSupplier()) {
58124        composeReference("supplier", element.getSupplier());
58125      }
58126      if (element.hasDestination()) {
58127        composeReference("destination", element.getDestination());
58128      }
58129      if (element.hasReceiver()) {
58130        openArray("receiver");
58131        for (Reference e : element.getReceiver()) 
58132          composeReference(null, e);
58133        closeArray();
58134      };
58135  }
58136
58137  protected void composeSupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
58138    if (element != null) {
58139      open(name);
58140      composeSupplyDeliverySuppliedItemComponentProperties(element);
58141      close();
58142    }
58143  }
58144
58145  protected void composeSupplyDeliverySuppliedItemComponentProperties(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
58146    composeBackboneElementProperties(element);
58147      if (element.hasQuantity()) {
58148        composeQuantity("quantity", element.getQuantity());
58149      }
58150      if (element.hasItem()) {
58151        composeType("item", element.getItem());
58152      }
58153  }
58154
58155  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
58156    if (element != null) {
58157      prop("resourceType", name);
58158      composeSupplyRequestProperties(element);
58159    }
58160  }
58161
58162  protected void composeSupplyRequestProperties(SupplyRequest element) throws IOException {
58163    composeDomainResourceProperties(element);
58164      if (element.hasIdentifier()) {
58165        openArray("identifier");
58166        for (Identifier e : element.getIdentifier()) 
58167          composeIdentifier(null, e);
58168        closeArray();
58169      };
58170      if (element.hasStatusElement()) {
58171        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
58172        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
58173      }
58174      if (element.hasCategory()) {
58175        composeCodeableConcept("category", element.getCategory());
58176      }
58177      if (element.hasPriorityElement()) {
58178        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58179        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58180      }
58181      if (element.hasItem()) {
58182        composeType("item", element.getItem());
58183      }
58184      if (element.hasQuantity()) {
58185        composeQuantity("quantity", element.getQuantity());
58186      }
58187      if (element.hasParameter()) {
58188        openArray("parameter");
58189        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
58190          composeSupplyRequestParameterComponent(null, e);
58191        closeArray();
58192      };
58193      if (element.hasOccurrence()) {
58194        composeType("occurrence", element.getOccurrence());
58195      }
58196      if (element.hasAuthoredOnElement()) {
58197        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
58198        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
58199      }
58200      if (element.hasRequester()) {
58201        composeReference("requester", element.getRequester());
58202      }
58203      if (element.hasSupplier()) {
58204        openArray("supplier");
58205        for (Reference e : element.getSupplier()) 
58206          composeReference(null, e);
58207        closeArray();
58208      };
58209      if (element.hasReasonCode()) {
58210        openArray("reasonCode");
58211        for (CodeableConcept e : element.getReasonCode()) 
58212          composeCodeableConcept(null, e);
58213        closeArray();
58214      };
58215      if (element.hasReasonReference()) {
58216        openArray("reasonReference");
58217        for (Reference e : element.getReasonReference()) 
58218          composeReference(null, e);
58219        closeArray();
58220      };
58221      if (element.hasDeliverFrom()) {
58222        composeReference("deliverFrom", element.getDeliverFrom());
58223      }
58224      if (element.hasDeliverTo()) {
58225        composeReference("deliverTo", element.getDeliverTo());
58226      }
58227  }
58228
58229  protected void composeSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
58230    if (element != null) {
58231      open(name);
58232      composeSupplyRequestParameterComponentProperties(element);
58233      close();
58234    }
58235  }
58236
58237  protected void composeSupplyRequestParameterComponentProperties(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
58238    composeBackboneElementProperties(element);
58239      if (element.hasCode()) {
58240        composeCodeableConcept("code", element.getCode());
58241      }
58242      if (element.hasValue()) {
58243        composeType("value", element.getValue());
58244      }
58245  }
58246
58247  protected void composeTask(String name, Task element) throws IOException {
58248    if (element != null) {
58249      prop("resourceType", name);
58250      composeTaskProperties(element);
58251    }
58252  }
58253
58254  protected void composeTaskProperties(Task element) throws IOException {
58255    composeDomainResourceProperties(element);
58256      if (element.hasIdentifier()) {
58257        openArray("identifier");
58258        for (Identifier e : element.getIdentifier()) 
58259          composeIdentifier(null, e);
58260        closeArray();
58261      };
58262      if (element.hasInstantiatesCanonicalElement()) {
58263        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
58264        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
58265      }
58266      if (element.hasInstantiatesUriElement()) {
58267        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
58268        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
58269      }
58270      if (element.hasBasedOn()) {
58271        openArray("basedOn");
58272        for (Reference e : element.getBasedOn()) 
58273          composeReference(null, e);
58274        closeArray();
58275      };
58276      if (element.hasGroupIdentifier()) {
58277        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
58278      }
58279      if (element.hasPartOf()) {
58280        openArray("partOf");
58281        for (Reference e : element.getPartOf()) 
58282          composeReference(null, e);
58283        closeArray();
58284      };
58285      if (element.hasStatusElement()) {
58286        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
58287        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
58288      }
58289      if (element.hasStatusReason()) {
58290        composeCodeableConcept("statusReason", element.getStatusReason());
58291      }
58292      if (element.hasBusinessStatus()) {
58293        composeCodeableConcept("businessStatus", element.getBusinessStatus());
58294      }
58295      if (element.hasIntentElement()) {
58296        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
58297        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
58298      }
58299      if (element.hasPriorityElement()) {
58300        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58301        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58302      }
58303      if (element.hasCode()) {
58304        composeCodeableConcept("code", element.getCode());
58305      }
58306      if (element.hasDescriptionElement()) {
58307        composeStringCore("description", element.getDescriptionElement(), false);
58308        composeStringExtras("description", element.getDescriptionElement(), false);
58309      }
58310      if (element.hasFocus()) {
58311        composeReference("focus", element.getFocus());
58312      }
58313      if (element.hasFor()) {
58314        composeReference("for", element.getFor());
58315      }
58316      if (element.hasEncounter()) {
58317        composeReference("encounter", element.getEncounter());
58318      }
58319      if (element.hasExecutionPeriod()) {
58320        composePeriod("executionPeriod", element.getExecutionPeriod());
58321      }
58322      if (element.hasAuthoredOnElement()) {
58323        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
58324        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
58325      }
58326      if (element.hasLastModifiedElement()) {
58327        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
58328        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
58329      }
58330      if (element.hasRequester()) {
58331        composeReference("requester", element.getRequester());
58332      }
58333      if (element.hasPerformerType()) {
58334        openArray("performerType");
58335        for (CodeableConcept e : element.getPerformerType()) 
58336          composeCodeableConcept(null, e);
58337        closeArray();
58338      };
58339      if (element.hasOwner()) {
58340        composeReference("owner", element.getOwner());
58341      }
58342      if (element.hasLocation()) {
58343        composeReference("location", element.getLocation());
58344      }
58345      if (element.hasReasonCode()) {
58346        composeCodeableConcept("reasonCode", element.getReasonCode());
58347      }
58348      if (element.hasReasonReference()) {
58349        composeReference("reasonReference", element.getReasonReference());
58350      }
58351      if (element.hasInsurance()) {
58352        openArray("insurance");
58353        for (Reference e : element.getInsurance()) 
58354          composeReference(null, e);
58355        closeArray();
58356      };
58357      if (element.hasNote()) {
58358        openArray("note");
58359        for (Annotation e : element.getNote()) 
58360          composeAnnotation(null, e);
58361        closeArray();
58362      };
58363      if (element.hasRelevantHistory()) {
58364        openArray("relevantHistory");
58365        for (Reference e : element.getRelevantHistory()) 
58366          composeReference(null, e);
58367        closeArray();
58368      };
58369      if (element.hasRestriction()) {
58370        composeTaskRestrictionComponent("restriction", element.getRestriction());
58371      }
58372      if (element.hasInput()) {
58373        openArray("input");
58374        for (Task.ParameterComponent e : element.getInput()) 
58375          composeParameterComponent(null, e);
58376        closeArray();
58377      };
58378      if (element.hasOutput()) {
58379        openArray("output");
58380        for (Task.TaskOutputComponent e : element.getOutput()) 
58381          composeTaskOutputComponent(null, e);
58382        closeArray();
58383      };
58384  }
58385
58386  protected void composeTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
58387    if (element != null) {
58388      open(name);
58389      composeTaskRestrictionComponentProperties(element);
58390      close();
58391    }
58392  }
58393
58394  protected void composeTaskRestrictionComponentProperties(Task.TaskRestrictionComponent element) throws IOException {
58395    composeBackboneElementProperties(element);
58396      if (element.hasRepetitionsElement()) {
58397        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
58398        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
58399      }
58400      if (element.hasPeriod()) {
58401        composePeriod("period", element.getPeriod());
58402      }
58403      if (element.hasRecipient()) {
58404        openArray("recipient");
58405        for (Reference e : element.getRecipient()) 
58406          composeReference(null, e);
58407        closeArray();
58408      };
58409  }
58410
58411  protected void composeParameterComponent(String name, Task.ParameterComponent element) throws IOException {
58412    if (element != null) {
58413      open(name);
58414      composeParameterComponentProperties(element);
58415      close();
58416    }
58417  }
58418
58419  protected void composeParameterComponentProperties(Task.ParameterComponent element) throws IOException {
58420    composeBackboneElementProperties(element);
58421      if (element.hasType()) {
58422        composeCodeableConcept("type", element.getType());
58423      }
58424      if (element.hasValue()) {
58425        composeType("value", element.getValue());
58426      }
58427  }
58428
58429  protected void composeTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
58430    if (element != null) {
58431      open(name);
58432      composeTaskOutputComponentProperties(element);
58433      close();
58434    }
58435  }
58436
58437  protected void composeTaskOutputComponentProperties(Task.TaskOutputComponent element) throws IOException {
58438    composeBackboneElementProperties(element);
58439      if (element.hasType()) {
58440        composeCodeableConcept("type", element.getType());
58441      }
58442      if (element.hasValue()) {
58443        composeType("value", element.getValue());
58444      }
58445  }
58446
58447  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
58448    if (element != null) {
58449      prop("resourceType", name);
58450      composeTerminologyCapabilitiesProperties(element);
58451    }
58452  }
58453
58454  protected void composeTerminologyCapabilitiesProperties(TerminologyCapabilities element) throws IOException {
58455    composeDomainResourceProperties(element);
58456      if (element.hasUrlElement()) {
58457        composeUriCore("url", element.getUrlElement(), false);
58458        composeUriExtras("url", element.getUrlElement(), false);
58459      }
58460      if (element.hasVersionElement()) {
58461        composeStringCore("version", element.getVersionElement(), false);
58462        composeStringExtras("version", element.getVersionElement(), false);
58463      }
58464      if (element.hasNameElement()) {
58465        composeStringCore("name", element.getNameElement(), false);
58466        composeStringExtras("name", element.getNameElement(), false);
58467      }
58468      if (element.hasTitleElement()) {
58469        composeStringCore("title", element.getTitleElement(), false);
58470        composeStringExtras("title", element.getTitleElement(), false);
58471      }
58472      if (element.hasStatusElement()) {
58473        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58474        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58475      }
58476      if (element.hasExperimentalElement()) {
58477        composeBooleanCore("experimental", element.getExperimentalElement(), false);
58478        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58479      }
58480      if (element.hasDateElement()) {
58481        composeDateTimeCore("date", element.getDateElement(), false);
58482        composeDateTimeExtras("date", element.getDateElement(), false);
58483      }
58484      if (element.hasPublisherElement()) {
58485        composeStringCore("publisher", element.getPublisherElement(), false);
58486        composeStringExtras("publisher", element.getPublisherElement(), false);
58487      }
58488      if (element.hasContact()) {
58489        openArray("contact");
58490        for (ContactDetail e : element.getContact()) 
58491          composeContactDetail(null, e);
58492        closeArray();
58493      };
58494      if (element.hasDescriptionElement()) {
58495        composeMarkdownCore("description", element.getDescriptionElement(), false);
58496        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58497      }
58498      if (element.hasUseContext()) {
58499        openArray("useContext");
58500        for (UsageContext e : element.getUseContext()) 
58501          composeUsageContext(null, e);
58502        closeArray();
58503      };
58504      if (element.hasJurisdiction()) {
58505        openArray("jurisdiction");
58506        for (CodeableConcept e : element.getJurisdiction()) 
58507          composeCodeableConcept(null, e);
58508        closeArray();
58509      };
58510      if (element.hasPurposeElement()) {
58511        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58512        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58513      }
58514      if (element.hasCopyrightElement()) {
58515        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58516        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58517      }
58518      if (element.hasKindElement()) {
58519        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
58520        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
58521      }
58522      if (element.hasSoftware()) {
58523        composeTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
58524      }
58525      if (element.hasImplementation()) {
58526        composeTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
58527      }
58528      if (element.hasLockedDateElement()) {
58529        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
58530        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
58531      }
58532      if (element.hasCodeSystem()) {
58533        openArray("codeSystem");
58534        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
58535          composeTerminologyCapabilitiesCodeSystemComponent(null, e);
58536        closeArray();
58537      };
58538      if (element.hasExpansion()) {
58539        composeTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
58540      }
58541      if (element.hasCodeSearchElement()) {
58542        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
58543        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
58544      }
58545      if (element.hasValidateCode()) {
58546        composeTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
58547      }
58548      if (element.hasTranslation()) {
58549        composeTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
58550      }
58551      if (element.hasClosure()) {
58552        composeTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
58553      }
58554  }
58555
58556  protected void composeTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
58557    if (element != null) {
58558      open(name);
58559      composeTerminologyCapabilitiesSoftwareComponentProperties(element);
58560      close();
58561    }
58562  }
58563
58564  protected void composeTerminologyCapabilitiesSoftwareComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
58565    composeBackboneElementProperties(element);
58566      if (element.hasNameElement()) {
58567        composeStringCore("name", element.getNameElement(), false);
58568        composeStringExtras("name", element.getNameElement(), false);
58569      }
58570      if (element.hasVersionElement()) {
58571        composeStringCore("version", element.getVersionElement(), false);
58572        composeStringExtras("version", element.getVersionElement(), false);
58573      }
58574  }
58575
58576  protected void composeTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
58577    if (element != null) {
58578      open(name);
58579      composeTerminologyCapabilitiesImplementationComponentProperties(element);
58580      close();
58581    }
58582  }
58583
58584  protected void composeTerminologyCapabilitiesImplementationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
58585    composeBackboneElementProperties(element);
58586      if (element.hasDescriptionElement()) {
58587        composeStringCore("description", element.getDescriptionElement(), false);
58588        composeStringExtras("description", element.getDescriptionElement(), false);
58589      }
58590      if (element.hasUrlElement()) {
58591        composeUrlCore("url", element.getUrlElement(), false);
58592        composeUrlExtras("url", element.getUrlElement(), false);
58593      }
58594  }
58595
58596  protected void composeTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
58597    if (element != null) {
58598      open(name);
58599      composeTerminologyCapabilitiesCodeSystemComponentProperties(element);
58600      close();
58601    }
58602  }
58603
58604  protected void composeTerminologyCapabilitiesCodeSystemComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
58605    composeBackboneElementProperties(element);
58606      if (element.hasUriElement()) {
58607        composeCanonicalCore("uri", element.getUriElement(), false);
58608        composeCanonicalExtras("uri", element.getUriElement(), false);
58609      }
58610      if (element.hasVersion()) {
58611        openArray("version");
58612        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
58613          composeTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
58614        closeArray();
58615      };
58616      if (element.hasSubsumptionElement()) {
58617        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
58618        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
58619      }
58620  }
58621
58622  protected void composeTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
58623    if (element != null) {
58624      open(name);
58625      composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(element);
58626      close();
58627    }
58628  }
58629
58630  protected void composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
58631    composeBackboneElementProperties(element);
58632      if (element.hasCodeElement()) {
58633        composeStringCore("code", element.getCodeElement(), false);
58634        composeStringExtras("code", element.getCodeElement(), false);
58635      }
58636      if (element.hasIsDefaultElement()) {
58637        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
58638        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
58639      }
58640      if (element.hasCompositionalElement()) {
58641        composeBooleanCore("compositional", element.getCompositionalElement(), false);
58642        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
58643      }
58644      if (element.hasLanguage()) {
58645        if (anyHasValue(element.getLanguage())) {
58646          openArray("language");
58647          for (CodeType e : element.getLanguage()) 
58648            composeCodeCore(null, e, e != element.getLanguage().get(element.getLanguage().size()-1));
58649          closeArray();
58650        }
58651        if (anyHasExtras(element.getLanguage())) {
58652          openArray("_language");
58653          for (CodeType e : element.getLanguage()) 
58654            composeCodeExtras(null, e, true);
58655          closeArray();
58656        }
58657      };
58658      if (element.hasFilter()) {
58659        openArray("filter");
58660        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
58661          composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
58662        closeArray();
58663      };
58664      if (element.hasProperty()) {
58665        if (anyHasValue(element.getProperty())) {
58666          openArray("property");
58667          for (CodeType e : element.getProperty()) 
58668            composeCodeCore(null, e, e != element.getProperty().get(element.getProperty().size()-1));
58669          closeArray();
58670        }
58671        if (anyHasExtras(element.getProperty())) {
58672          openArray("_property");
58673          for (CodeType e : element.getProperty()) 
58674            composeCodeExtras(null, e, true);
58675          closeArray();
58676        }
58677      };
58678  }
58679
58680  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
58681    if (element != null) {
58682      open(name);
58683      composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(element);
58684      close();
58685    }
58686  }
58687
58688  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
58689    composeBackboneElementProperties(element);
58690      if (element.hasCodeElement()) {
58691        composeCodeCore("code", element.getCodeElement(), false);
58692        composeCodeExtras("code", element.getCodeElement(), false);
58693      }
58694      if (element.hasOp()) {
58695        if (anyHasValue(element.getOp())) {
58696          openArray("op");
58697          for (CodeType e : element.getOp()) 
58698            composeCodeCore(null, e, e != element.getOp().get(element.getOp().size()-1));
58699          closeArray();
58700        }
58701        if (anyHasExtras(element.getOp())) {
58702          openArray("_op");
58703          for (CodeType e : element.getOp()) 
58704            composeCodeExtras(null, e, true);
58705          closeArray();
58706        }
58707      };
58708  }
58709
58710  protected void composeTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
58711    if (element != null) {
58712      open(name);
58713      composeTerminologyCapabilitiesExpansionComponentProperties(element);
58714      close();
58715    }
58716  }
58717
58718  protected void composeTerminologyCapabilitiesExpansionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
58719    composeBackboneElementProperties(element);
58720      if (element.hasHierarchicalElement()) {
58721        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
58722        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
58723      }
58724      if (element.hasPagingElement()) {
58725        composeBooleanCore("paging", element.getPagingElement(), false);
58726        composeBooleanExtras("paging", element.getPagingElement(), false);
58727      }
58728      if (element.hasIncompleteElement()) {
58729        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
58730        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
58731      }
58732      if (element.hasParameter()) {
58733        openArray("parameter");
58734        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
58735          composeTerminologyCapabilitiesExpansionParameterComponent(null, e);
58736        closeArray();
58737      };
58738      if (element.hasTextFilterElement()) {
58739        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
58740        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
58741      }
58742  }
58743
58744  protected void composeTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
58745    if (element != null) {
58746      open(name);
58747      composeTerminologyCapabilitiesExpansionParameterComponentProperties(element);
58748      close();
58749    }
58750  }
58751
58752  protected void composeTerminologyCapabilitiesExpansionParameterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
58753    composeBackboneElementProperties(element);
58754      if (element.hasNameElement()) {
58755        composeCodeCore("name", element.getNameElement(), false);
58756        composeCodeExtras("name", element.getNameElement(), false);
58757      }
58758      if (element.hasDocumentationElement()) {
58759        composeStringCore("documentation", element.getDocumentationElement(), false);
58760        composeStringExtras("documentation", element.getDocumentationElement(), false);
58761      }
58762  }
58763
58764  protected void composeTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
58765    if (element != null) {
58766      open(name);
58767      composeTerminologyCapabilitiesValidateCodeComponentProperties(element);
58768      close();
58769    }
58770  }
58771
58772  protected void composeTerminologyCapabilitiesValidateCodeComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
58773    composeBackboneElementProperties(element);
58774      if (element.hasTranslationsElement()) {
58775        composeBooleanCore("translations", element.getTranslationsElement(), false);
58776        composeBooleanExtras("translations", element.getTranslationsElement(), false);
58777      }
58778  }
58779
58780  protected void composeTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
58781    if (element != null) {
58782      open(name);
58783      composeTerminologyCapabilitiesTranslationComponentProperties(element);
58784      close();
58785    }
58786  }
58787
58788  protected void composeTerminologyCapabilitiesTranslationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
58789    composeBackboneElementProperties(element);
58790      if (element.hasNeedsMapElement()) {
58791        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
58792        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
58793      }
58794  }
58795
58796  protected void composeTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
58797    if (element != null) {
58798      open(name);
58799      composeTerminologyCapabilitiesClosureComponentProperties(element);
58800      close();
58801    }
58802  }
58803
58804  protected void composeTerminologyCapabilitiesClosureComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
58805    composeBackboneElementProperties(element);
58806      if (element.hasTranslationElement()) {
58807        composeBooleanCore("translation", element.getTranslationElement(), false);
58808        composeBooleanExtras("translation", element.getTranslationElement(), false);
58809      }
58810  }
58811
58812  protected void composeTestReport(String name, TestReport element) throws IOException {
58813    if (element != null) {
58814      prop("resourceType", name);
58815      composeTestReportProperties(element);
58816    }
58817  }
58818
58819  protected void composeTestReportProperties(TestReport element) throws IOException {
58820    composeDomainResourceProperties(element);
58821      if (element.hasIdentifier()) {
58822        composeIdentifier("identifier", element.getIdentifier());
58823      }
58824      if (element.hasNameElement()) {
58825        composeStringCore("name", element.getNameElement(), false);
58826        composeStringExtras("name", element.getNameElement(), false);
58827      }
58828      if (element.hasStatusElement()) {
58829        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
58830        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
58831      }
58832      if (element.hasTestScript()) {
58833        composeReference("testScript", element.getTestScript());
58834      }
58835      if (element.hasResultElement()) {
58836        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
58837        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
58838      }
58839      if (element.hasScoreElement()) {
58840        composeDecimalCore("score", element.getScoreElement(), false);
58841        composeDecimalExtras("score", element.getScoreElement(), false);
58842      }
58843      if (element.hasTesterElement()) {
58844        composeStringCore("tester", element.getTesterElement(), false);
58845        composeStringExtras("tester", element.getTesterElement(), false);
58846      }
58847      if (element.hasIssuedElement()) {
58848        composeDateTimeCore("issued", element.getIssuedElement(), false);
58849        composeDateTimeExtras("issued", element.getIssuedElement(), false);
58850      }
58851      if (element.hasParticipant()) {
58852        openArray("participant");
58853        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
58854          composeTestReportParticipantComponent(null, e);
58855        closeArray();
58856      };
58857      if (element.hasSetup()) {
58858        composeTestReportSetupComponent("setup", element.getSetup());
58859      }
58860      if (element.hasTest()) {
58861        openArray("test");
58862        for (TestReport.TestReportTestComponent e : element.getTest()) 
58863          composeTestReportTestComponent(null, e);
58864        closeArray();
58865      };
58866      if (element.hasTeardown()) {
58867        composeTestReportTeardownComponent("teardown", element.getTeardown());
58868      }
58869  }
58870
58871  protected void composeTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
58872    if (element != null) {
58873      open(name);
58874      composeTestReportParticipantComponentProperties(element);
58875      close();
58876    }
58877  }
58878
58879  protected void composeTestReportParticipantComponentProperties(TestReport.TestReportParticipantComponent element) throws IOException {
58880    composeBackboneElementProperties(element);
58881      if (element.hasTypeElement()) {
58882        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
58883        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
58884      }
58885      if (element.hasUriElement()) {
58886        composeUriCore("uri", element.getUriElement(), false);
58887        composeUriExtras("uri", element.getUriElement(), false);
58888      }
58889      if (element.hasDisplayElement()) {
58890        composeStringCore("display", element.getDisplayElement(), false);
58891        composeStringExtras("display", element.getDisplayElement(), false);
58892      }
58893  }
58894
58895  protected void composeTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
58896    if (element != null) {
58897      open(name);
58898      composeTestReportSetupComponentProperties(element);
58899      close();
58900    }
58901  }
58902
58903  protected void composeTestReportSetupComponentProperties(TestReport.TestReportSetupComponent element) throws IOException {
58904    composeBackboneElementProperties(element);
58905      if (element.hasAction()) {
58906        openArray("action");
58907        for (TestReport.SetupActionComponent e : element.getAction()) 
58908          composeSetupActionComponent(null, e);
58909        closeArray();
58910      };
58911  }
58912
58913  protected void composeSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
58914    if (element != null) {
58915      open(name);
58916      composeSetupActionComponentProperties(element);
58917      close();
58918    }
58919  }
58920
58921  protected void composeSetupActionComponentProperties(TestReport.SetupActionComponent element) throws IOException {
58922    composeBackboneElementProperties(element);
58923      if (element.hasOperation()) {
58924        composeSetupActionOperationComponent("operation", element.getOperation());
58925      }
58926      if (element.hasAssert()) {
58927        composeSetupActionAssertComponent("assert", element.getAssert());
58928      }
58929  }
58930
58931  protected void composeSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
58932    if (element != null) {
58933      open(name);
58934      composeSetupActionOperationComponentProperties(element);
58935      close();
58936    }
58937  }
58938
58939  protected void composeSetupActionOperationComponentProperties(TestReport.SetupActionOperationComponent element) throws IOException {
58940    composeBackboneElementProperties(element);
58941      if (element.hasResultElement()) {
58942        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58943        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58944      }
58945      if (element.hasMessageElement()) {
58946        composeMarkdownCore("message", element.getMessageElement(), false);
58947        composeMarkdownExtras("message", element.getMessageElement(), false);
58948      }
58949      if (element.hasDetailElement()) {
58950        composeUriCore("detail", element.getDetailElement(), false);
58951        composeUriExtras("detail", element.getDetailElement(), false);
58952      }
58953  }
58954
58955  protected void composeSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
58956    if (element != null) {
58957      open(name);
58958      composeSetupActionAssertComponentProperties(element);
58959      close();
58960    }
58961  }
58962
58963  protected void composeSetupActionAssertComponentProperties(TestReport.SetupActionAssertComponent element) throws IOException {
58964    composeBackboneElementProperties(element);
58965      if (element.hasResultElement()) {
58966        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58967        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58968      }
58969      if (element.hasMessageElement()) {
58970        composeMarkdownCore("message", element.getMessageElement(), false);
58971        composeMarkdownExtras("message", element.getMessageElement(), false);
58972      }
58973      if (element.hasDetailElement()) {
58974        composeStringCore("detail", element.getDetailElement(), false);
58975        composeStringExtras("detail", element.getDetailElement(), false);
58976      }
58977  }
58978
58979  protected void composeTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
58980    if (element != null) {
58981      open(name);
58982      composeTestReportTestComponentProperties(element);
58983      close();
58984    }
58985  }
58986
58987  protected void composeTestReportTestComponentProperties(TestReport.TestReportTestComponent element) throws IOException {
58988    composeBackboneElementProperties(element);
58989      if (element.hasNameElement()) {
58990        composeStringCore("name", element.getNameElement(), false);
58991        composeStringExtras("name", element.getNameElement(), false);
58992      }
58993      if (element.hasDescriptionElement()) {
58994        composeStringCore("description", element.getDescriptionElement(), false);
58995        composeStringExtras("description", element.getDescriptionElement(), false);
58996      }
58997      if (element.hasAction()) {
58998        openArray("action");
58999        for (TestReport.TestActionComponent e : element.getAction()) 
59000          composeTestActionComponent(null, e);
59001        closeArray();
59002      };
59003  }
59004
59005  protected void composeTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
59006    if (element != null) {
59007      open(name);
59008      composeTestActionComponentProperties(element);
59009      close();
59010    }
59011  }
59012
59013  protected void composeTestActionComponentProperties(TestReport.TestActionComponent element) throws IOException {
59014    composeBackboneElementProperties(element);
59015      if (element.hasOperation()) {
59016        composeSetupActionOperationComponent("operation", element.getOperation());
59017      }
59018      if (element.hasAssert()) {
59019        composeSetupActionAssertComponent("assert", element.getAssert());
59020      }
59021  }
59022
59023  protected void composeTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
59024    if (element != null) {
59025      open(name);
59026      composeTestReportTeardownComponentProperties(element);
59027      close();
59028    }
59029  }
59030
59031  protected void composeTestReportTeardownComponentProperties(TestReport.TestReportTeardownComponent element) throws IOException {
59032    composeBackboneElementProperties(element);
59033      if (element.hasAction()) {
59034        openArray("action");
59035        for (TestReport.TeardownActionComponent e : element.getAction()) 
59036          composeTeardownActionComponent(null, e);
59037        closeArray();
59038      };
59039  }
59040
59041  protected void composeTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
59042    if (element != null) {
59043      open(name);
59044      composeTeardownActionComponentProperties(element);
59045      close();
59046    }
59047  }
59048
59049  protected void composeTeardownActionComponentProperties(TestReport.TeardownActionComponent element) throws IOException {
59050    composeBackboneElementProperties(element);
59051      if (element.hasOperation()) {
59052        composeSetupActionOperationComponent("operation", element.getOperation());
59053      }
59054  }
59055
59056  protected void composeTestScript(String name, TestScript element) throws IOException {
59057    if (element != null) {
59058      prop("resourceType", name);
59059      composeTestScriptProperties(element);
59060    }
59061  }
59062
59063  protected void composeTestScriptProperties(TestScript element) throws IOException {
59064    composeDomainResourceProperties(element);
59065      if (element.hasUrlElement()) {
59066        composeUriCore("url", element.getUrlElement(), false);
59067        composeUriExtras("url", element.getUrlElement(), false);
59068      }
59069      if (element.hasIdentifier()) {
59070        composeIdentifier("identifier", element.getIdentifier());
59071      }
59072      if (element.hasVersionElement()) {
59073        composeStringCore("version", element.getVersionElement(), false);
59074        composeStringExtras("version", element.getVersionElement(), false);
59075      }
59076      if (element.hasNameElement()) {
59077        composeStringCore("name", element.getNameElement(), false);
59078        composeStringExtras("name", element.getNameElement(), false);
59079      }
59080      if (element.hasTitleElement()) {
59081        composeStringCore("title", element.getTitleElement(), false);
59082        composeStringExtras("title", element.getTitleElement(), false);
59083      }
59084      if (element.hasStatusElement()) {
59085        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59086        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59087      }
59088      if (element.hasExperimentalElement()) {
59089        composeBooleanCore("experimental", element.getExperimentalElement(), false);
59090        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
59091      }
59092      if (element.hasDateElement()) {
59093        composeDateTimeCore("date", element.getDateElement(), false);
59094        composeDateTimeExtras("date", element.getDateElement(), false);
59095      }
59096      if (element.hasPublisherElement()) {
59097        composeStringCore("publisher", element.getPublisherElement(), false);
59098        composeStringExtras("publisher", element.getPublisherElement(), false);
59099      }
59100      if (element.hasContact()) {
59101        openArray("contact");
59102        for (ContactDetail e : element.getContact()) 
59103          composeContactDetail(null, e);
59104        closeArray();
59105      };
59106      if (element.hasDescriptionElement()) {
59107        composeMarkdownCore("description", element.getDescriptionElement(), false);
59108        composeMarkdownExtras("description", element.getDescriptionElement(), false);
59109      }
59110      if (element.hasUseContext()) {
59111        openArray("useContext");
59112        for (UsageContext e : element.getUseContext()) 
59113          composeUsageContext(null, e);
59114        closeArray();
59115      };
59116      if (element.hasJurisdiction()) {
59117        openArray("jurisdiction");
59118        for (CodeableConcept e : element.getJurisdiction()) 
59119          composeCodeableConcept(null, e);
59120        closeArray();
59121      };
59122      if (element.hasPurposeElement()) {
59123        composeMarkdownCore("purpose", element.getPurposeElement(), false);
59124        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
59125      }
59126      if (element.hasCopyrightElement()) {
59127        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
59128        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
59129      }
59130      if (element.hasOrigin()) {
59131        openArray("origin");
59132        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
59133          composeTestScriptOriginComponent(null, e);
59134        closeArray();
59135      };
59136      if (element.hasDestination()) {
59137        openArray("destination");
59138        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
59139          composeTestScriptDestinationComponent(null, e);
59140        closeArray();
59141      };
59142      if (element.hasMetadata()) {
59143        composeTestScriptMetadataComponent("metadata", element.getMetadata());
59144      }
59145      if (element.hasFixture()) {
59146        openArray("fixture");
59147        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
59148          composeTestScriptFixtureComponent(null, e);
59149        closeArray();
59150      };
59151      if (element.hasProfile()) {
59152        openArray("profile");
59153        for (Reference e : element.getProfile()) 
59154          composeReference(null, e);
59155        closeArray();
59156      };
59157      if (element.hasVariable()) {
59158        openArray("variable");
59159        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
59160          composeTestScriptVariableComponent(null, e);
59161        closeArray();
59162      };
59163      if (element.hasSetup()) {
59164        composeTestScriptSetupComponent("setup", element.getSetup());
59165      }
59166      if (element.hasTest()) {
59167        openArray("test");
59168        for (TestScript.TestScriptTestComponent e : element.getTest()) 
59169          composeTestScriptTestComponent(null, e);
59170        closeArray();
59171      };
59172      if (element.hasTeardown()) {
59173        composeTestScriptTeardownComponent("teardown", element.getTeardown());
59174      }
59175  }
59176
59177  protected void composeTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
59178    if (element != null) {
59179      open(name);
59180      composeTestScriptOriginComponentProperties(element);
59181      close();
59182    }
59183  }
59184
59185  protected void composeTestScriptOriginComponentProperties(TestScript.TestScriptOriginComponent element) throws IOException {
59186    composeBackboneElementProperties(element);
59187      if (element.hasIndexElement()) {
59188        composeIntegerCore("index", element.getIndexElement(), false);
59189        composeIntegerExtras("index", element.getIndexElement(), false);
59190      }
59191      if (element.hasProfile()) {
59192        composeCoding("profile", element.getProfile());
59193      }
59194  }
59195
59196  protected void composeTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
59197    if (element != null) {
59198      open(name);
59199      composeTestScriptDestinationComponentProperties(element);
59200      close();
59201    }
59202  }
59203
59204  protected void composeTestScriptDestinationComponentProperties(TestScript.TestScriptDestinationComponent element) throws IOException {
59205    composeBackboneElementProperties(element);
59206      if (element.hasIndexElement()) {
59207        composeIntegerCore("index", element.getIndexElement(), false);
59208        composeIntegerExtras("index", element.getIndexElement(), false);
59209      }
59210      if (element.hasProfile()) {
59211        composeCoding("profile", element.getProfile());
59212      }
59213  }
59214
59215  protected void composeTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
59216    if (element != null) {
59217      open(name);
59218      composeTestScriptMetadataComponentProperties(element);
59219      close();
59220    }
59221  }
59222
59223  protected void composeTestScriptMetadataComponentProperties(TestScript.TestScriptMetadataComponent element) throws IOException {
59224    composeBackboneElementProperties(element);
59225      if (element.hasLink()) {
59226        openArray("link");
59227        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
59228          composeTestScriptMetadataLinkComponent(null, e);
59229        closeArray();
59230      };
59231      if (element.hasCapability()) {
59232        openArray("capability");
59233        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
59234          composeTestScriptMetadataCapabilityComponent(null, e);
59235        closeArray();
59236      };
59237  }
59238
59239  protected void composeTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
59240    if (element != null) {
59241      open(name);
59242      composeTestScriptMetadataLinkComponentProperties(element);
59243      close();
59244    }
59245  }
59246
59247  protected void composeTestScriptMetadataLinkComponentProperties(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
59248    composeBackboneElementProperties(element);
59249      if (element.hasUrlElement()) {
59250        composeUriCore("url", element.getUrlElement(), false);
59251        composeUriExtras("url", element.getUrlElement(), false);
59252      }
59253      if (element.hasDescriptionElement()) {
59254        composeStringCore("description", element.getDescriptionElement(), false);
59255        composeStringExtras("description", element.getDescriptionElement(), false);
59256      }
59257  }
59258
59259  protected void composeTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
59260    if (element != null) {
59261      open(name);
59262      composeTestScriptMetadataCapabilityComponentProperties(element);
59263      close();
59264    }
59265  }
59266
59267  protected void composeTestScriptMetadataCapabilityComponentProperties(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
59268    composeBackboneElementProperties(element);
59269      if (element.hasRequiredElement()) {
59270        composeBooleanCore("required", element.getRequiredElement(), false);
59271        composeBooleanExtras("required", element.getRequiredElement(), false);
59272      }
59273      if (element.hasValidatedElement()) {
59274        composeBooleanCore("validated", element.getValidatedElement(), false);
59275        composeBooleanExtras("validated", element.getValidatedElement(), false);
59276      }
59277      if (element.hasDescriptionElement()) {
59278        composeStringCore("description", element.getDescriptionElement(), false);
59279        composeStringExtras("description", element.getDescriptionElement(), false);
59280      }
59281      if (element.hasOrigin()) {
59282        if (anyHasValue(element.getOrigin())) {
59283          openArray("origin");
59284          for (IntegerType e : element.getOrigin()) 
59285            composeIntegerCore(null, e, e != element.getOrigin().get(element.getOrigin().size()-1));
59286          closeArray();
59287        }
59288        if (anyHasExtras(element.getOrigin())) {
59289          openArray("_origin");
59290          for (IntegerType e : element.getOrigin()) 
59291            composeIntegerExtras(null, e, true);
59292          closeArray();
59293        }
59294      };
59295      if (element.hasDestinationElement()) {
59296        composeIntegerCore("destination", element.getDestinationElement(), false);
59297        composeIntegerExtras("destination", element.getDestinationElement(), false);
59298      }
59299      if (element.hasLink()) {
59300        if (anyHasValue(element.getLink())) {
59301          openArray("link");
59302          for (UriType e : element.getLink()) 
59303            composeUriCore(null, e, e != element.getLink().get(element.getLink().size()-1));
59304          closeArray();
59305        }
59306        if (anyHasExtras(element.getLink())) {
59307          openArray("_link");
59308          for (UriType e : element.getLink()) 
59309            composeUriExtras(null, e, true);
59310          closeArray();
59311        }
59312      };
59313      if (element.hasCapabilitiesElement()) {
59314        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
59315        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
59316      }
59317  }
59318
59319  protected void composeTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
59320    if (element != null) {
59321      open(name);
59322      composeTestScriptFixtureComponentProperties(element);
59323      close();
59324    }
59325  }
59326
59327  protected void composeTestScriptFixtureComponentProperties(TestScript.TestScriptFixtureComponent element) throws IOException {
59328    composeBackboneElementProperties(element);
59329      if (element.hasAutocreateElement()) {
59330        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
59331        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
59332      }
59333      if (element.hasAutodeleteElement()) {
59334        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
59335        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
59336      }
59337      if (element.hasResource()) {
59338        composeReference("resource", element.getResource());
59339      }
59340  }
59341
59342  protected void composeTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
59343    if (element != null) {
59344      open(name);
59345      composeTestScriptVariableComponentProperties(element);
59346      close();
59347    }
59348  }
59349
59350  protected void composeTestScriptVariableComponentProperties(TestScript.TestScriptVariableComponent element) throws IOException {
59351    composeBackboneElementProperties(element);
59352      if (element.hasNameElement()) {
59353        composeStringCore("name", element.getNameElement(), false);
59354        composeStringExtras("name", element.getNameElement(), false);
59355      }
59356      if (element.hasDefaultValueElement()) {
59357        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
59358        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
59359      }
59360      if (element.hasDescriptionElement()) {
59361        composeStringCore("description", element.getDescriptionElement(), false);
59362        composeStringExtras("description", element.getDescriptionElement(), false);
59363      }
59364      if (element.hasExpressionElement()) {
59365        composeStringCore("expression", element.getExpressionElement(), false);
59366        composeStringExtras("expression", element.getExpressionElement(), false);
59367      }
59368      if (element.hasHeaderFieldElement()) {
59369        composeStringCore("headerField", element.getHeaderFieldElement(), false);
59370        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
59371      }
59372      if (element.hasHintElement()) {
59373        composeStringCore("hint", element.getHintElement(), false);
59374        composeStringExtras("hint", element.getHintElement(), false);
59375      }
59376      if (element.hasPathElement()) {
59377        composeStringCore("path", element.getPathElement(), false);
59378        composeStringExtras("path", element.getPathElement(), false);
59379      }
59380      if (element.hasSourceIdElement()) {
59381        composeIdCore("sourceId", element.getSourceIdElement(), false);
59382        composeIdExtras("sourceId", element.getSourceIdElement(), false);
59383      }
59384  }
59385
59386  protected void composeTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
59387    if (element != null) {
59388      open(name);
59389      composeTestScriptSetupComponentProperties(element);
59390      close();
59391    }
59392  }
59393
59394  protected void composeTestScriptSetupComponentProperties(TestScript.TestScriptSetupComponent element) throws IOException {
59395    composeBackboneElementProperties(element);
59396      if (element.hasAction()) {
59397        openArray("action");
59398        for (TestScript.SetupActionComponent e : element.getAction()) 
59399          composeSetupActionComponent(null, e);
59400        closeArray();
59401      };
59402  }
59403
59404  protected void composeSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
59405    if (element != null) {
59406      open(name);
59407      composeSetupActionComponentProperties(element);
59408      close();
59409    }
59410  }
59411
59412  protected void composeSetupActionComponentProperties(TestScript.SetupActionComponent element) throws IOException {
59413    composeBackboneElementProperties(element);
59414      if (element.hasOperation()) {
59415        composeSetupActionOperationComponent("operation", element.getOperation());
59416      }
59417      if (element.hasAssert()) {
59418        composeSetupActionAssertComponent("assert", element.getAssert());
59419      }
59420  }
59421
59422  protected void composeSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
59423    if (element != null) {
59424      open(name);
59425      composeSetupActionOperationComponentProperties(element);
59426      close();
59427    }
59428  }
59429
59430  protected void composeSetupActionOperationComponentProperties(TestScript.SetupActionOperationComponent element) throws IOException {
59431    composeBackboneElementProperties(element);
59432      if (element.hasType()) {
59433        composeCoding("type", element.getType());
59434      }
59435      if (element.hasResourceElement()) {
59436        composeEnumerationCore("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59437        composeEnumerationExtras("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59438      }
59439      if (element.hasLabelElement()) {
59440        composeStringCore("label", element.getLabelElement(), false);
59441        composeStringExtras("label", element.getLabelElement(), false);
59442      }
59443      if (element.hasDescriptionElement()) {
59444        composeStringCore("description", element.getDescriptionElement(), false);
59445        composeStringExtras("description", element.getDescriptionElement(), false);
59446      }
59447      if (element.hasAcceptElement()) {
59448        composeCodeCore("accept", element.getAcceptElement(), false);
59449        composeCodeExtras("accept", element.getAcceptElement(), false);
59450      }
59451      if (element.hasContentTypeElement()) {
59452        composeCodeCore("contentType", element.getContentTypeElement(), false);
59453        composeCodeExtras("contentType", element.getContentTypeElement(), false);
59454      }
59455      if (element.hasDestinationElement()) {
59456        composeIntegerCore("destination", element.getDestinationElement(), false);
59457        composeIntegerExtras("destination", element.getDestinationElement(), false);
59458      }
59459      if (element.hasEncodeRequestUrlElement()) {
59460        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
59461        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
59462      }
59463      if (element.hasMethodElement()) {
59464        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59465        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59466      }
59467      if (element.hasOriginElement()) {
59468        composeIntegerCore("origin", element.getOriginElement(), false);
59469        composeIntegerExtras("origin", element.getOriginElement(), false);
59470      }
59471      if (element.hasParamsElement()) {
59472        composeStringCore("params", element.getParamsElement(), false);
59473        composeStringExtras("params", element.getParamsElement(), false);
59474      }
59475      if (element.hasRequestHeader()) {
59476        openArray("requestHeader");
59477        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
59478          composeSetupActionOperationRequestHeaderComponent(null, e);
59479        closeArray();
59480      };
59481      if (element.hasRequestIdElement()) {
59482        composeIdCore("requestId", element.getRequestIdElement(), false);
59483        composeIdExtras("requestId", element.getRequestIdElement(), false);
59484      }
59485      if (element.hasResponseIdElement()) {
59486        composeIdCore("responseId", element.getResponseIdElement(), false);
59487        composeIdExtras("responseId", element.getResponseIdElement(), false);
59488      }
59489      if (element.hasSourceIdElement()) {
59490        composeIdCore("sourceId", element.getSourceIdElement(), false);
59491        composeIdExtras("sourceId", element.getSourceIdElement(), false);
59492      }
59493      if (element.hasTargetIdElement()) {
59494        composeIdCore("targetId", element.getTargetIdElement(), false);
59495        composeIdExtras("targetId", element.getTargetIdElement(), false);
59496      }
59497      if (element.hasUrlElement()) {
59498        composeStringCore("url", element.getUrlElement(), false);
59499        composeStringExtras("url", element.getUrlElement(), false);
59500      }
59501  }
59502
59503  protected void composeSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
59504    if (element != null) {
59505      open(name);
59506      composeSetupActionOperationRequestHeaderComponentProperties(element);
59507      close();
59508    }
59509  }
59510
59511  protected void composeSetupActionOperationRequestHeaderComponentProperties(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
59512    composeBackboneElementProperties(element);
59513      if (element.hasFieldElement()) {
59514        composeStringCore("field", element.getFieldElement(), false);
59515        composeStringExtras("field", element.getFieldElement(), false);
59516      }
59517      if (element.hasValueElement()) {
59518        composeStringCore("value", element.getValueElement(), false);
59519        composeStringExtras("value", element.getValueElement(), false);
59520      }
59521  }
59522
59523  protected void composeSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
59524    if (element != null) {
59525      open(name);
59526      composeSetupActionAssertComponentProperties(element);
59527      close();
59528    }
59529  }
59530
59531  protected void composeSetupActionAssertComponentProperties(TestScript.SetupActionAssertComponent element) throws IOException {
59532    composeBackboneElementProperties(element);
59533      if (element.hasLabelElement()) {
59534        composeStringCore("label", element.getLabelElement(), false);
59535        composeStringExtras("label", element.getLabelElement(), false);
59536      }
59537      if (element.hasDescriptionElement()) {
59538        composeStringCore("description", element.getDescriptionElement(), false);
59539        composeStringExtras("description", element.getDescriptionElement(), false);
59540      }
59541      if (element.hasDirectionElement()) {
59542        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
59543        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
59544      }
59545      if (element.hasCompareToSourceIdElement()) {
59546        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
59547        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
59548      }
59549      if (element.hasCompareToSourceExpressionElement()) {
59550        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
59551        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
59552      }
59553      if (element.hasCompareToSourcePathElement()) {
59554        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
59555        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
59556      }
59557      if (element.hasContentTypeElement()) {
59558        composeCodeCore("contentType", element.getContentTypeElement(), false);
59559        composeCodeExtras("contentType", element.getContentTypeElement(), false);
59560      }
59561      if (element.hasExpressionElement()) {
59562        composeStringCore("expression", element.getExpressionElement(), false);
59563        composeStringExtras("expression", element.getExpressionElement(), false);
59564      }
59565      if (element.hasHeaderFieldElement()) {
59566        composeStringCore("headerField", element.getHeaderFieldElement(), false);
59567        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
59568      }
59569      if (element.hasMinimumIdElement()) {
59570        composeStringCore("minimumId", element.getMinimumIdElement(), false);
59571        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
59572      }
59573      if (element.hasNavigationLinksElement()) {
59574        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
59575        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
59576      }
59577      if (element.hasOperatorElement()) {
59578        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
59579        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
59580      }
59581      if (element.hasPathElement()) {
59582        composeStringCore("path", element.getPathElement(), false);
59583        composeStringExtras("path", element.getPathElement(), false);
59584      }
59585      if (element.hasRequestMethodElement()) {
59586        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59587        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59588      }
59589      if (element.hasRequestURLElement()) {
59590        composeStringCore("requestURL", element.getRequestURLElement(), false);
59591        composeStringExtras("requestURL", element.getRequestURLElement(), false);
59592      }
59593      if (element.hasResourceElement()) {
59594        composeEnumerationCore("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59595        composeEnumerationExtras("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59596      }
59597      if (element.hasResponseElement()) {
59598        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
59599        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
59600      }
59601      if (element.hasResponseCodeElement()) {
59602        composeStringCore("responseCode", element.getResponseCodeElement(), false);
59603        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
59604      }
59605      if (element.hasSourceIdElement()) {
59606        composeIdCore("sourceId", element.getSourceIdElement(), false);
59607        composeIdExtras("sourceId", element.getSourceIdElement(), false);
59608      }
59609      if (element.hasValidateProfileIdElement()) {
59610        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
59611        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
59612      }
59613      if (element.hasValueElement()) {
59614        composeStringCore("value", element.getValueElement(), false);
59615        composeStringExtras("value", element.getValueElement(), false);
59616      }
59617      if (element.hasWarningOnlyElement()) {
59618        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
59619        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
59620      }
59621  }
59622
59623  protected void composeTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
59624    if (element != null) {
59625      open(name);
59626      composeTestScriptTestComponentProperties(element);
59627      close();
59628    }
59629  }
59630
59631  protected void composeTestScriptTestComponentProperties(TestScript.TestScriptTestComponent element) throws IOException {
59632    composeBackboneElementProperties(element);
59633      if (element.hasNameElement()) {
59634        composeStringCore("name", element.getNameElement(), false);
59635        composeStringExtras("name", element.getNameElement(), false);
59636      }
59637      if (element.hasDescriptionElement()) {
59638        composeStringCore("description", element.getDescriptionElement(), false);
59639        composeStringExtras("description", element.getDescriptionElement(), false);
59640      }
59641      if (element.hasAction()) {
59642        openArray("action");
59643        for (TestScript.TestActionComponent e : element.getAction()) 
59644          composeTestActionComponent(null, e);
59645        closeArray();
59646      };
59647  }
59648
59649  protected void composeTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
59650    if (element != null) {
59651      open(name);
59652      composeTestActionComponentProperties(element);
59653      close();
59654    }
59655  }
59656
59657  protected void composeTestActionComponentProperties(TestScript.TestActionComponent element) throws IOException {
59658    composeBackboneElementProperties(element);
59659      if (element.hasOperation()) {
59660        composeSetupActionOperationComponent("operation", element.getOperation());
59661      }
59662      if (element.hasAssert()) {
59663        composeSetupActionAssertComponent("assert", element.getAssert());
59664      }
59665  }
59666
59667  protected void composeTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
59668    if (element != null) {
59669      open(name);
59670      composeTestScriptTeardownComponentProperties(element);
59671      close();
59672    }
59673  }
59674
59675  protected void composeTestScriptTeardownComponentProperties(TestScript.TestScriptTeardownComponent element) throws IOException {
59676    composeBackboneElementProperties(element);
59677      if (element.hasAction()) {
59678        openArray("action");
59679        for (TestScript.TeardownActionComponent e : element.getAction()) 
59680          composeTeardownActionComponent(null, e);
59681        closeArray();
59682      };
59683  }
59684
59685  protected void composeTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
59686    if (element != null) {
59687      open(name);
59688      composeTeardownActionComponentProperties(element);
59689      close();
59690    }
59691  }
59692
59693  protected void composeTeardownActionComponentProperties(TestScript.TeardownActionComponent element) throws IOException {
59694    composeBackboneElementProperties(element);
59695      if (element.hasOperation()) {
59696        composeSetupActionOperationComponent("operation", element.getOperation());
59697      }
59698  }
59699
59700  protected void composeValueSet(String name, ValueSet element) throws IOException {
59701    if (element != null) {
59702      prop("resourceType", name);
59703      composeValueSetProperties(element);
59704    }
59705  }
59706
59707  protected void composeValueSetProperties(ValueSet element) throws IOException {
59708    composeDomainResourceProperties(element);
59709      if (element.hasUrlElement()) {
59710        composeUriCore("url", element.getUrlElement(), false);
59711        composeUriExtras("url", element.getUrlElement(), false);
59712      }
59713      if (element.hasIdentifier()) {
59714        openArray("identifier");
59715        for (Identifier e : element.getIdentifier()) 
59716          composeIdentifier(null, e);
59717        closeArray();
59718      };
59719      if (element.hasVersionElement()) {
59720        composeStringCore("version", element.getVersionElement(), false);
59721        composeStringExtras("version", element.getVersionElement(), false);
59722      }
59723      if (element.hasNameElement()) {
59724        composeStringCore("name", element.getNameElement(), false);
59725        composeStringExtras("name", element.getNameElement(), false);
59726      }
59727      if (element.hasTitleElement()) {
59728        composeStringCore("title", element.getTitleElement(), false);
59729        composeStringExtras("title", element.getTitleElement(), false);
59730      }
59731      if (element.hasStatusElement()) {
59732        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59733        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59734      }
59735      if (element.hasExperimentalElement()) {
59736        composeBooleanCore("experimental", element.getExperimentalElement(), false);
59737        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
59738      }
59739      if (element.hasDateElement()) {
59740        composeDateTimeCore("date", element.getDateElement(), false);
59741        composeDateTimeExtras("date", element.getDateElement(), false);
59742      }
59743      if (element.hasPublisherElement()) {
59744        composeStringCore("publisher", element.getPublisherElement(), false);
59745        composeStringExtras("publisher", element.getPublisherElement(), false);
59746      }
59747      if (element.hasContact()) {
59748        openArray("contact");
59749        for (ContactDetail e : element.getContact()) 
59750          composeContactDetail(null, e);
59751        closeArray();
59752      };
59753      if (element.hasDescriptionElement()) {
59754        composeMarkdownCore("description", element.getDescriptionElement(), false);
59755        composeMarkdownExtras("description", element.getDescriptionElement(), false);
59756      }
59757      if (element.hasUseContext()) {
59758        openArray("useContext");
59759        for (UsageContext e : element.getUseContext()) 
59760          composeUsageContext(null, e);
59761        closeArray();
59762      };
59763      if (element.hasJurisdiction()) {
59764        openArray("jurisdiction");
59765        for (CodeableConcept e : element.getJurisdiction()) 
59766          composeCodeableConcept(null, e);
59767        closeArray();
59768      };
59769      if (element.hasImmutableElement()) {
59770        composeBooleanCore("immutable", element.getImmutableElement(), false);
59771        composeBooleanExtras("immutable", element.getImmutableElement(), false);
59772      }
59773      if (element.hasPurposeElement()) {
59774        composeMarkdownCore("purpose", element.getPurposeElement(), false);
59775        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
59776      }
59777      if (element.hasCopyrightElement()) {
59778        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
59779        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
59780      }
59781      if (element.hasCompose()) {
59782        composeValueSetComposeComponent("compose", element.getCompose());
59783      }
59784      if (element.hasExpansion()) {
59785        composeValueSetExpansionComponent("expansion", element.getExpansion());
59786      }
59787  }
59788
59789  protected void composeValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
59790    if (element != null) {
59791      open(name);
59792      composeValueSetComposeComponentProperties(element);
59793      close();
59794    }
59795  }
59796
59797  protected void composeValueSetComposeComponentProperties(ValueSet.ValueSetComposeComponent element) throws IOException {
59798    composeBackboneElementProperties(element);
59799      if (element.hasLockedDateElement()) {
59800        composeDateCore("lockedDate", element.getLockedDateElement(), false);
59801        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
59802      }
59803      if (element.hasInactiveElement()) {
59804        composeBooleanCore("inactive", element.getInactiveElement(), false);
59805        composeBooleanExtras("inactive", element.getInactiveElement(), false);
59806      }
59807      if (element.hasInclude()) {
59808        openArray("include");
59809        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
59810          composeConceptSetComponent(null, e);
59811        closeArray();
59812      };
59813      if (element.hasExclude()) {
59814        openArray("exclude");
59815        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
59816          composeConceptSetComponent(null, e);
59817        closeArray();
59818      };
59819  }
59820
59821  protected void composeConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
59822    if (element != null) {
59823      open(name);
59824      composeConceptSetComponentProperties(element);
59825      close();
59826    }
59827  }
59828
59829  protected void composeConceptSetComponentProperties(ValueSet.ConceptSetComponent element) throws IOException {
59830    composeBackboneElementProperties(element);
59831      if (element.hasSystemElement()) {
59832        composeUriCore("system", element.getSystemElement(), false);
59833        composeUriExtras("system", element.getSystemElement(), false);
59834      }
59835      if (element.hasVersionElement()) {
59836        composeStringCore("version", element.getVersionElement(), false);
59837        composeStringExtras("version", element.getVersionElement(), false);
59838      }
59839      if (element.hasConcept()) {
59840        openArray("concept");
59841        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
59842          composeConceptReferenceComponent(null, e);
59843        closeArray();
59844      };
59845      if (element.hasFilter()) {
59846        openArray("filter");
59847        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
59848          composeConceptSetFilterComponent(null, e);
59849        closeArray();
59850      };
59851      if (element.hasValueSet()) {
59852        if (anyHasValue(element.getValueSet())) {
59853          openArray("valueSet");
59854          for (CanonicalType e : element.getValueSet()) 
59855            composeCanonicalCore(null, e, e != element.getValueSet().get(element.getValueSet().size()-1));
59856          closeArray();
59857        }
59858        if (anyHasExtras(element.getValueSet())) {
59859          openArray("_valueSet");
59860          for (CanonicalType e : element.getValueSet()) 
59861            composeCanonicalExtras(null, e, true);
59862          closeArray();
59863        }
59864      };
59865  }
59866
59867  protected void composeConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
59868    if (element != null) {
59869      open(name);
59870      composeConceptReferenceComponentProperties(element);
59871      close();
59872    }
59873  }
59874
59875  protected void composeConceptReferenceComponentProperties(ValueSet.ConceptReferenceComponent element) throws IOException {
59876    composeBackboneElementProperties(element);
59877      if (element.hasCodeElement()) {
59878        composeCodeCore("code", element.getCodeElement(), false);
59879        composeCodeExtras("code", element.getCodeElement(), false);
59880      }
59881      if (element.hasDisplayElement()) {
59882        composeStringCore("display", element.getDisplayElement(), false);
59883        composeStringExtras("display", element.getDisplayElement(), false);
59884      }
59885      if (element.hasDesignation()) {
59886        openArray("designation");
59887        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
59888          composeConceptReferenceDesignationComponent(null, e);
59889        closeArray();
59890      };
59891  }
59892
59893  protected void composeConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
59894    if (element != null) {
59895      open(name);
59896      composeConceptReferenceDesignationComponentProperties(element);
59897      close();
59898    }
59899  }
59900
59901  protected void composeConceptReferenceDesignationComponentProperties(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
59902    composeBackboneElementProperties(element);
59903      if (element.hasLanguageElement()) {
59904        composeCodeCore("language", element.getLanguageElement(), false);
59905        composeCodeExtras("language", element.getLanguageElement(), false);
59906      }
59907      if (element.hasUse()) {
59908        composeCoding("use", element.getUse());
59909      }
59910      if (element.hasValueElement()) {
59911        composeStringCore("value", element.getValueElement(), false);
59912        composeStringExtras("value", element.getValueElement(), false);
59913      }
59914  }
59915
59916  protected void composeConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
59917    if (element != null) {
59918      open(name);
59919      composeConceptSetFilterComponentProperties(element);
59920      close();
59921    }
59922  }
59923
59924  protected void composeConceptSetFilterComponentProperties(ValueSet.ConceptSetFilterComponent element) throws IOException {
59925    composeBackboneElementProperties(element);
59926      if (element.hasPropertyElement()) {
59927        composeCodeCore("property", element.getPropertyElement(), false);
59928        composeCodeExtras("property", element.getPropertyElement(), false);
59929      }
59930      if (element.hasOpElement()) {
59931        composeEnumerationCore("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
59932        composeEnumerationExtras("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
59933      }
59934      if (element.hasValueElement()) {
59935        composeStringCore("value", element.getValueElement(), false);
59936        composeStringExtras("value", element.getValueElement(), false);
59937      }
59938  }
59939
59940  protected void composeValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
59941    if (element != null) {
59942      open(name);
59943      composeValueSetExpansionComponentProperties(element);
59944      close();
59945    }
59946  }
59947
59948  protected void composeValueSetExpansionComponentProperties(ValueSet.ValueSetExpansionComponent element) throws IOException {
59949    composeBackboneElementProperties(element);
59950      if (element.hasIdentifierElement()) {
59951        composeUriCore("identifier", element.getIdentifierElement(), false);
59952        composeUriExtras("identifier", element.getIdentifierElement(), false);
59953      }
59954      if (element.hasTimestampElement()) {
59955        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
59956        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
59957      }
59958      if (element.hasTotalElement()) {
59959        composeIntegerCore("total", element.getTotalElement(), false);
59960        composeIntegerExtras("total", element.getTotalElement(), false);
59961      }
59962      if (element.hasOffsetElement()) {
59963        composeIntegerCore("offset", element.getOffsetElement(), false);
59964        composeIntegerExtras("offset", element.getOffsetElement(), false);
59965      }
59966      if (element.hasParameter()) {
59967        openArray("parameter");
59968        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
59969          composeValueSetExpansionParameterComponent(null, e);
59970        closeArray();
59971      };
59972      if (element.hasContains()) {
59973        openArray("contains");
59974        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
59975          composeValueSetExpansionContainsComponent(null, e);
59976        closeArray();
59977      };
59978  }
59979
59980  protected void composeValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
59981    if (element != null) {
59982      open(name);
59983      composeValueSetExpansionParameterComponentProperties(element);
59984      close();
59985    }
59986  }
59987
59988  protected void composeValueSetExpansionParameterComponentProperties(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
59989    composeBackboneElementProperties(element);
59990      if (element.hasNameElement()) {
59991        composeStringCore("name", element.getNameElement(), false);
59992        composeStringExtras("name", element.getNameElement(), false);
59993      }
59994      if (element.hasValue()) {
59995        composeType("value", element.getValue());
59996      }
59997  }
59998
59999  protected void composeValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
60000    if (element != null) {
60001      open(name);
60002      composeValueSetExpansionContainsComponentProperties(element);
60003      close();
60004    }
60005  }
60006
60007  protected void composeValueSetExpansionContainsComponentProperties(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
60008    composeBackboneElementProperties(element);
60009      if (element.hasSystemElement()) {
60010        composeUriCore("system", element.getSystemElement(), false);
60011        composeUriExtras("system", element.getSystemElement(), false);
60012      }
60013      if (element.hasAbstractElement()) {
60014        composeBooleanCore("abstract", element.getAbstractElement(), false);
60015        composeBooleanExtras("abstract", element.getAbstractElement(), false);
60016      }
60017      if (element.hasInactiveElement()) {
60018        composeBooleanCore("inactive", element.getInactiveElement(), false);
60019        composeBooleanExtras("inactive", element.getInactiveElement(), false);
60020      }
60021      if (element.hasVersionElement()) {
60022        composeStringCore("version", element.getVersionElement(), false);
60023        composeStringExtras("version", element.getVersionElement(), false);
60024      }
60025      if (element.hasCodeElement()) {
60026        composeCodeCore("code", element.getCodeElement(), false);
60027        composeCodeExtras("code", element.getCodeElement(), false);
60028      }
60029      if (element.hasDisplayElement()) {
60030        composeStringCore("display", element.getDisplayElement(), false);
60031        composeStringExtras("display", element.getDisplayElement(), false);
60032      }
60033      if (element.hasDesignation()) {
60034        openArray("designation");
60035        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
60036          composeConceptReferenceDesignationComponent(null, e);
60037        closeArray();
60038      };
60039      if (element.hasContains()) {
60040        openArray("contains");
60041        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
60042          composeValueSetExpansionContainsComponent(null, e);
60043        closeArray();
60044      };
60045  }
60046
60047  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
60048    if (element != null) {
60049      prop("resourceType", name);
60050      composeVerificationResultProperties(element);
60051    }
60052  }
60053
60054  protected void composeVerificationResultProperties(VerificationResult element) throws IOException {
60055    composeDomainResourceProperties(element);
60056      if (element.hasTarget()) {
60057        openArray("target");
60058        for (Reference e : element.getTarget()) 
60059          composeReference(null, e);
60060        closeArray();
60061      };
60062      if (element.hasTargetLocation()) {
60063        if (anyHasValue(element.getTargetLocation())) {
60064          openArray("targetLocation");
60065          for (StringType e : element.getTargetLocation()) 
60066            composeStringCore(null, e, e != element.getTargetLocation().get(element.getTargetLocation().size()-1));
60067          closeArray();
60068        }
60069        if (anyHasExtras(element.getTargetLocation())) {
60070          openArray("_targetLocation");
60071          for (StringType e : element.getTargetLocation()) 
60072            composeStringExtras(null, e, true);
60073          closeArray();
60074        }
60075      };
60076      if (element.hasNeed()) {
60077        composeCodeableConcept("need", element.getNeed());
60078      }
60079      if (element.hasStatusElement()) {
60080        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
60081        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
60082      }
60083      if (element.hasStatusDateElement()) {
60084        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
60085        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
60086      }
60087      if (element.hasValidationType()) {
60088        composeCodeableConcept("validationType", element.getValidationType());
60089      }
60090      if (element.hasValidationProcess()) {
60091        openArray("validationProcess");
60092        for (CodeableConcept e : element.getValidationProcess()) 
60093          composeCodeableConcept(null, e);
60094        closeArray();
60095      };
60096      if (element.hasFrequency()) {
60097        composeTiming("frequency", element.getFrequency());
60098      }
60099      if (element.hasLastPerformedElement()) {
60100        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
60101        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
60102      }
60103      if (element.hasNextScheduledElement()) {
60104        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
60105        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
60106      }
60107      if (element.hasFailureAction()) {
60108        composeCodeableConcept("failureAction", element.getFailureAction());
60109      }
60110      if (element.hasPrimarySource()) {
60111        openArray("primarySource");
60112        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
60113          composeVerificationResultPrimarySourceComponent(null, e);
60114        closeArray();
60115      };
60116      if (element.hasAttestation()) {
60117        composeVerificationResultAttestationComponent("attestation", element.getAttestation());
60118      }
60119      if (element.hasValidator()) {
60120        openArray("validator");
60121        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
60122          composeVerificationResultValidatorComponent(null, e);
60123        closeArray();
60124      };
60125  }
60126
60127  protected void composeVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
60128    if (element != null) {
60129      open(name);
60130      composeVerificationResultPrimarySourceComponentProperties(element);
60131      close();
60132    }
60133  }
60134
60135  protected void composeVerificationResultPrimarySourceComponentProperties(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
60136    composeBackboneElementProperties(element);
60137      if (element.hasWho()) {
60138        composeReference("who", element.getWho());
60139      }
60140      if (element.hasType()) {
60141        openArray("type");
60142        for (CodeableConcept e : element.getType()) 
60143          composeCodeableConcept(null, e);
60144        closeArray();
60145      };
60146      if (element.hasCommunicationMethod()) {
60147        openArray("communicationMethod");
60148        for (CodeableConcept e : element.getCommunicationMethod()) 
60149          composeCodeableConcept(null, e);
60150        closeArray();
60151      };
60152      if (element.hasValidationStatus()) {
60153        composeCodeableConcept("validationStatus", element.getValidationStatus());
60154      }
60155      if (element.hasValidationDateElement()) {
60156        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
60157        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
60158      }
60159      if (element.hasCanPushUpdates()) {
60160        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
60161      }
60162      if (element.hasPushTypeAvailable()) {
60163        openArray("pushTypeAvailable");
60164        for (CodeableConcept e : element.getPushTypeAvailable()) 
60165          composeCodeableConcept(null, e);
60166        closeArray();
60167      };
60168  }
60169
60170  protected void composeVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
60171    if (element != null) {
60172      open(name);
60173      composeVerificationResultAttestationComponentProperties(element);
60174      close();
60175    }
60176  }
60177
60178  protected void composeVerificationResultAttestationComponentProperties(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
60179    composeBackboneElementProperties(element);
60180      if (element.hasWho()) {
60181        composeReference("who", element.getWho());
60182      }
60183      if (element.hasOnBehalfOf()) {
60184        composeReference("onBehalfOf", element.getOnBehalfOf());
60185      }
60186      if (element.hasCommunicationMethod()) {
60187        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
60188      }
60189      if (element.hasDateElement()) {
60190        composeDateCore("date", element.getDateElement(), false);
60191        composeDateExtras("date", element.getDateElement(), false);
60192      }
60193      if (element.hasSourceIdentityCertificateElement()) {
60194        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
60195        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
60196      }
60197      if (element.hasProxyIdentityCertificateElement()) {
60198        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
60199        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
60200      }
60201      if (element.hasProxySignature()) {
60202        composeSignature("proxySignature", element.getProxySignature());
60203      }
60204      if (element.hasSourceSignature()) {
60205        composeSignature("sourceSignature", element.getSourceSignature());
60206      }
60207  }
60208
60209  protected void composeVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
60210    if (element != null) {
60211      open(name);
60212      composeVerificationResultValidatorComponentProperties(element);
60213      close();
60214    }
60215  }
60216
60217  protected void composeVerificationResultValidatorComponentProperties(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
60218    composeBackboneElementProperties(element);
60219      if (element.hasOrganization()) {
60220        composeReference("organization", element.getOrganization());
60221      }
60222      if (element.hasIdentityCertificateElement()) {
60223        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
60224        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
60225      }
60226      if (element.hasAttestationSignature()) {
60227        composeSignature("attestationSignature", element.getAttestationSignature());
60228      }
60229  }
60230
60231  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
60232    if (element != null) {
60233      prop("resourceType", name);
60234      composeVisionPrescriptionProperties(element);
60235    }
60236  }
60237
60238  protected void composeVisionPrescriptionProperties(VisionPrescription element) throws IOException {
60239    composeDomainResourceProperties(element);
60240      if (element.hasIdentifier()) {
60241        openArray("identifier");
60242        for (Identifier e : element.getIdentifier()) 
60243          composeIdentifier(null, e);
60244        closeArray();
60245      };
60246      if (element.hasStatusElement()) {
60247        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
60248        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
60249      }
60250      if (element.hasCreatedElement()) {
60251        composeDateTimeCore("created", element.getCreatedElement(), false);
60252        composeDateTimeExtras("created", element.getCreatedElement(), false);
60253      }
60254      if (element.hasPatient()) {
60255        composeReference("patient", element.getPatient());
60256      }
60257      if (element.hasEncounter()) {
60258        composeReference("encounter", element.getEncounter());
60259      }
60260      if (element.hasDateWrittenElement()) {
60261        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
60262        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
60263      }
60264      if (element.hasPrescriber()) {
60265        composeReference("prescriber", element.getPrescriber());
60266      }
60267      if (element.hasLensSpecification()) {
60268        openArray("lensSpecification");
60269        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
60270          composeVisionPrescriptionLensSpecificationComponent(null, e);
60271        closeArray();
60272      };
60273  }
60274
60275  protected void composeVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
60276    if (element != null) {
60277      open(name);
60278      composeVisionPrescriptionLensSpecificationComponentProperties(element);
60279      close();
60280    }
60281  }
60282
60283  protected void composeVisionPrescriptionLensSpecificationComponentProperties(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
60284    composeBackboneElementProperties(element);
60285      if (element.hasProduct()) {
60286        composeCodeableConcept("product", element.getProduct());
60287      }
60288      if (element.hasEyeElement()) {
60289        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
60290        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
60291      }
60292      if (element.hasSphereElement()) {
60293        composeDecimalCore("sphere", element.getSphereElement(), false);
60294        composeDecimalExtras("sphere", element.getSphereElement(), false);
60295      }
60296      if (element.hasCylinderElement()) {
60297        composeDecimalCore("cylinder", element.getCylinderElement(), false);
60298        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
60299      }
60300      if (element.hasAxisElement()) {
60301        composeIntegerCore("axis", element.getAxisElement(), false);
60302        composeIntegerExtras("axis", element.getAxisElement(), false);
60303      }
60304      if (element.hasPrism()) {
60305        openArray("prism");
60306        for (VisionPrescription.PrismComponent e : element.getPrism()) 
60307          composePrismComponent(null, e);
60308        closeArray();
60309      };
60310      if (element.hasAddElement()) {
60311        composeDecimalCore("add", element.getAddElement(), false);
60312        composeDecimalExtras("add", element.getAddElement(), false);
60313      }
60314      if (element.hasPowerElement()) {
60315        composeDecimalCore("power", element.getPowerElement(), false);
60316        composeDecimalExtras("power", element.getPowerElement(), false);
60317      }
60318      if (element.hasBackCurveElement()) {
60319        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
60320        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
60321      }
60322      if (element.hasDiameterElement()) {
60323        composeDecimalCore("diameter", element.getDiameterElement(), false);
60324        composeDecimalExtras("diameter", element.getDiameterElement(), false);
60325      }
60326      if (element.hasDuration()) {
60327        composeQuantity("duration", element.getDuration());
60328      }
60329      if (element.hasColorElement()) {
60330        composeStringCore("color", element.getColorElement(), false);
60331        composeStringExtras("color", element.getColorElement(), false);
60332      }
60333      if (element.hasBrandElement()) {
60334        composeStringCore("brand", element.getBrandElement(), false);
60335        composeStringExtras("brand", element.getBrandElement(), false);
60336      }
60337      if (element.hasNote()) {
60338        openArray("note");
60339        for (Annotation e : element.getNote()) 
60340          composeAnnotation(null, e);
60341        closeArray();
60342      };
60343  }
60344
60345  protected void composePrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
60346    if (element != null) {
60347      open(name);
60348      composePrismComponentProperties(element);
60349      close();
60350    }
60351  }
60352
60353  protected void composePrismComponentProperties(VisionPrescription.PrismComponent element) throws IOException {
60354    composeBackboneElementProperties(element);
60355      if (element.hasAmountElement()) {
60356        composeDecimalCore("amount", element.getAmountElement(), false);
60357        composeDecimalExtras("amount", element.getAmountElement(), false);
60358      }
60359      if (element.hasBaseElement()) {
60360        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
60361        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
60362      }
60363  }
60364
60365
60366
60367  @Override
60368  protected void composeResource(Resource resource) throws IOException {
60369    if (resource == null) {
60370      throw new Error("Unhandled resource type "+resource.getClass().getName());
60371    } else if (resource instanceof Account) {
60372      composeAccount("Account", (Account)resource);
60373    } else if (resource instanceof ActivityDefinition) {
60374      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
60375    } else if (resource instanceof AdministrableProductDefinition) {
60376      composeAdministrableProductDefinition("AdministrableProductDefinition", (AdministrableProductDefinition)resource);
60377    } else if (resource instanceof AdverseEvent) {
60378      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
60379    } else if (resource instanceof AllergyIntolerance) {
60380      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
60381    } else if (resource instanceof Appointment) {
60382      composeAppointment("Appointment", (Appointment)resource);
60383    } else if (resource instanceof AppointmentResponse) {
60384      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
60385    } else if (resource instanceof AuditEvent) {
60386      composeAuditEvent("AuditEvent", (AuditEvent)resource);
60387    } else if (resource instanceof Basic) {
60388      composeBasic("Basic", (Basic)resource);
60389    } else if (resource instanceof Binary) {
60390      composeBinary("Binary", (Binary)resource);
60391    } else if (resource instanceof BiologicallyDerivedProduct) {
60392      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
60393    } else if (resource instanceof BodyStructure) {
60394      composeBodyStructure("BodyStructure", (BodyStructure)resource);
60395    } else if (resource instanceof Bundle) {
60396      composeBundle("Bundle", (Bundle)resource);
60397    } else if (resource instanceof CapabilityStatement) {
60398      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
60399    } else if (resource instanceof CarePlan) {
60400      composeCarePlan("CarePlan", (CarePlan)resource);
60401    } else if (resource instanceof CareTeam) {
60402      composeCareTeam("CareTeam", (CareTeam)resource);
60403    } else if (resource instanceof CatalogEntry) {
60404      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
60405    } else if (resource instanceof ChargeItem) {
60406      composeChargeItem("ChargeItem", (ChargeItem)resource);
60407    } else if (resource instanceof ChargeItemDefinition) {
60408      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
60409    } else if (resource instanceof Citation) {
60410      composeCitation("Citation", (Citation)resource);
60411    } else if (resource instanceof Claim) {
60412      composeClaim("Claim", (Claim)resource);
60413    } else if (resource instanceof ClaimResponse) {
60414      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
60415    } else if (resource instanceof ClinicalImpression) {
60416      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
60417    } else if (resource instanceof ClinicalUseDefinition) {
60418      composeClinicalUseDefinition("ClinicalUseDefinition", (ClinicalUseDefinition)resource);
60419    } else if (resource instanceof CodeSystem) {
60420      composeCodeSystem("CodeSystem", (CodeSystem)resource);
60421    } else if (resource instanceof Communication) {
60422      composeCommunication("Communication", (Communication)resource);
60423    } else if (resource instanceof CommunicationRequest) {
60424      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
60425    } else if (resource instanceof CompartmentDefinition) {
60426      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
60427    } else if (resource instanceof Composition) {
60428      composeComposition("Composition", (Composition)resource);
60429    } else if (resource instanceof ConceptMap) {
60430      composeConceptMap("ConceptMap", (ConceptMap)resource);
60431    } else if (resource instanceof Condition) {
60432      composeCondition("Condition", (Condition)resource);
60433    } else if (resource instanceof Consent) {
60434      composeConsent("Consent", (Consent)resource);
60435    } else if (resource instanceof Contract) {
60436      composeContract("Contract", (Contract)resource);
60437    } else if (resource instanceof Coverage) {
60438      composeCoverage("Coverage", (Coverage)resource);
60439    } else if (resource instanceof CoverageEligibilityRequest) {
60440      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
60441    } else if (resource instanceof CoverageEligibilityResponse) {
60442      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
60443    } else if (resource instanceof DetectedIssue) {
60444      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
60445    } else if (resource instanceof Device) {
60446      composeDevice("Device", (Device)resource);
60447    } else if (resource instanceof DeviceDefinition) {
60448      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
60449    } else if (resource instanceof DeviceMetric) {
60450      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
60451    } else if (resource instanceof DeviceRequest) {
60452      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
60453    } else if (resource instanceof DeviceUseStatement) {
60454      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
60455    } else if (resource instanceof DiagnosticReport) {
60456      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
60457    } else if (resource instanceof DocumentManifest) {
60458      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
60459    } else if (resource instanceof DocumentReference) {
60460      composeDocumentReference("DocumentReference", (DocumentReference)resource);
60461    } else if (resource instanceof Encounter) {
60462      composeEncounter("Encounter", (Encounter)resource);
60463    } else if (resource instanceof Endpoint) {
60464      composeEndpoint("Endpoint", (Endpoint)resource);
60465    } else if (resource instanceof EnrollmentRequest) {
60466      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
60467    } else if (resource instanceof EnrollmentResponse) {
60468      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
60469    } else if (resource instanceof EpisodeOfCare) {
60470      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
60471    } else if (resource instanceof EventDefinition) {
60472      composeEventDefinition("EventDefinition", (EventDefinition)resource);
60473    } else if (resource instanceof Evidence) {
60474      composeEvidence("Evidence", (Evidence)resource);
60475    } else if (resource instanceof EvidenceReport) {
60476      composeEvidenceReport("EvidenceReport", (EvidenceReport)resource);
60477    } else if (resource instanceof EvidenceVariable) {
60478      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
60479    } else if (resource instanceof ExampleScenario) {
60480      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
60481    } else if (resource instanceof ExplanationOfBenefit) {
60482      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
60483    } else if (resource instanceof FamilyMemberHistory) {
60484      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
60485    } else if (resource instanceof Flag) {
60486      composeFlag("Flag", (Flag)resource);
60487    } else if (resource instanceof Goal) {
60488      composeGoal("Goal", (Goal)resource);
60489    } else if (resource instanceof GraphDefinition) {
60490      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
60491    } else if (resource instanceof Group) {
60492      composeGroup("Group", (Group)resource);
60493    } else if (resource instanceof GuidanceResponse) {
60494      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
60495    } else if (resource instanceof HealthcareService) {
60496      composeHealthcareService("HealthcareService", (HealthcareService)resource);
60497    } else if (resource instanceof ImagingStudy) {
60498      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
60499    } else if (resource instanceof Immunization) {
60500      composeImmunization("Immunization", (Immunization)resource);
60501    } else if (resource instanceof ImmunizationEvaluation) {
60502      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
60503    } else if (resource instanceof ImmunizationRecommendation) {
60504      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
60505    } else if (resource instanceof ImplementationGuide) {
60506      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
60507    } else if (resource instanceof Ingredient) {
60508      composeIngredient("Ingredient", (Ingredient)resource);
60509    } else if (resource instanceof InsurancePlan) {
60510      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
60511    } else if (resource instanceof Invoice) {
60512      composeInvoice("Invoice", (Invoice)resource);
60513    } else if (resource instanceof Library) {
60514      composeLibrary("Library", (Library)resource);
60515    } else if (resource instanceof Linkage) {
60516      composeLinkage("Linkage", (Linkage)resource);
60517    } else if (resource instanceof ListResource) {
60518      composeListResource("List", (ListResource)resource);
60519    } else if (resource instanceof Location) {
60520      composeLocation("Location", (Location)resource);
60521    } else if (resource instanceof ManufacturedItemDefinition) {
60522      composeManufacturedItemDefinition("ManufacturedItemDefinition", (ManufacturedItemDefinition)resource);
60523    } else if (resource instanceof Measure) {
60524      composeMeasure("Measure", (Measure)resource);
60525    } else if (resource instanceof MeasureReport) {
60526      composeMeasureReport("MeasureReport", (MeasureReport)resource);
60527    } else if (resource instanceof Media) {
60528      composeMedia("Media", (Media)resource);
60529    } else if (resource instanceof Medication) {
60530      composeMedication("Medication", (Medication)resource);
60531    } else if (resource instanceof MedicationAdministration) {
60532      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
60533    } else if (resource instanceof MedicationDispense) {
60534      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
60535    } else if (resource instanceof MedicationKnowledge) {
60536      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
60537    } else if (resource instanceof MedicationRequest) {
60538      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
60539    } else if (resource instanceof MedicationStatement) {
60540      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
60541    } else if (resource instanceof MedicinalProductDefinition) {
60542      composeMedicinalProductDefinition("MedicinalProductDefinition", (MedicinalProductDefinition)resource);
60543    } else if (resource instanceof MessageDefinition) {
60544      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
60545    } else if (resource instanceof MessageHeader) {
60546      composeMessageHeader("MessageHeader", (MessageHeader)resource);
60547    } else if (resource instanceof MolecularSequence) {
60548      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
60549    } else if (resource instanceof NamingSystem) {
60550      composeNamingSystem("NamingSystem", (NamingSystem)resource);
60551    } else if (resource instanceof NutritionOrder) {
60552      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
60553    } else if (resource instanceof NutritionProduct) {
60554      composeNutritionProduct("NutritionProduct", (NutritionProduct)resource);
60555    } else if (resource instanceof Observation) {
60556      composeObservation("Observation", (Observation)resource);
60557    } else if (resource instanceof ObservationDefinition) {
60558      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
60559    } else if (resource instanceof OperationDefinition) {
60560      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
60561    } else if (resource instanceof OperationOutcome) {
60562      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
60563    } else if (resource instanceof Organization) {
60564      composeOrganization("Organization", (Organization)resource);
60565    } else if (resource instanceof OrganizationAffiliation) {
60566      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
60567    } else if (resource instanceof PackagedProductDefinition) {
60568      composePackagedProductDefinition("PackagedProductDefinition", (PackagedProductDefinition)resource);
60569    } else if (resource instanceof Parameters) {
60570      composeParameters("Parameters", (Parameters)resource);
60571    } else if (resource instanceof Patient) {
60572      composePatient("Patient", (Patient)resource);
60573    } else if (resource instanceof PaymentNotice) {
60574      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
60575    } else if (resource instanceof PaymentReconciliation) {
60576      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
60577    } else if (resource instanceof Person) {
60578      composePerson("Person", (Person)resource);
60579    } else if (resource instanceof PlanDefinition) {
60580      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
60581    } else if (resource instanceof Practitioner) {
60582      composePractitioner("Practitioner", (Practitioner)resource);
60583    } else if (resource instanceof PractitionerRole) {
60584      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
60585    } else if (resource instanceof Procedure) {
60586      composeProcedure("Procedure", (Procedure)resource);
60587    } else if (resource instanceof Provenance) {
60588      composeProvenance("Provenance", (Provenance)resource);
60589    } else if (resource instanceof Questionnaire) {
60590      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
60591    } else if (resource instanceof QuestionnaireResponse) {
60592      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
60593    } else if (resource instanceof RegulatedAuthorization) {
60594      composeRegulatedAuthorization("RegulatedAuthorization", (RegulatedAuthorization)resource);
60595    } else if (resource instanceof RelatedPerson) {
60596      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
60597    } else if (resource instanceof RequestGroup) {
60598      composeRequestGroup("RequestGroup", (RequestGroup)resource);
60599    } else if (resource instanceof ResearchDefinition) {
60600      composeResearchDefinition("ResearchDefinition", (ResearchDefinition)resource);
60601    } else if (resource instanceof ResearchElementDefinition) {
60602      composeResearchElementDefinition("ResearchElementDefinition", (ResearchElementDefinition)resource);
60603    } else if (resource instanceof ResearchStudy) {
60604      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
60605    } else if (resource instanceof ResearchSubject) {
60606      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
60607    } else if (resource instanceof RiskAssessment) {
60608      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
60609    } else if (resource instanceof Schedule) {
60610      composeSchedule("Schedule", (Schedule)resource);
60611    } else if (resource instanceof SearchParameter) {
60612      composeSearchParameter("SearchParameter", (SearchParameter)resource);
60613    } else if (resource instanceof ServiceRequest) {
60614      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
60615    } else if (resource instanceof Slot) {
60616      composeSlot("Slot", (Slot)resource);
60617    } else if (resource instanceof Specimen) {
60618      composeSpecimen("Specimen", (Specimen)resource);
60619    } else if (resource instanceof SpecimenDefinition) {
60620      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
60621    } else if (resource instanceof StructureDefinition) {
60622      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
60623    } else if (resource instanceof StructureMap) {
60624      composeStructureMap("StructureMap", (StructureMap)resource);
60625    } else if (resource instanceof Subscription) {
60626      composeSubscription("Subscription", (Subscription)resource);
60627    } else if (resource instanceof SubscriptionStatus) {
60628      composeSubscriptionStatus("SubscriptionStatus", (SubscriptionStatus)resource);
60629    } else if (resource instanceof SubscriptionTopic) {
60630      composeSubscriptionTopic("SubscriptionTopic", (SubscriptionTopic)resource);
60631    } else if (resource instanceof Substance) {
60632      composeSubstance("Substance", (Substance)resource);
60633    } else if (resource instanceof SubstanceDefinition) {
60634      composeSubstanceDefinition("SubstanceDefinition", (SubstanceDefinition)resource);
60635    } else if (resource instanceof SupplyDelivery) {
60636      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
60637    } else if (resource instanceof SupplyRequest) {
60638      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
60639    } else if (resource instanceof Task) {
60640      composeTask("Task", (Task)resource);
60641    } else if (resource instanceof TerminologyCapabilities) {
60642      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
60643    } else if (resource instanceof TestReport) {
60644      composeTestReport("TestReport", (TestReport)resource);
60645    } else if (resource instanceof TestScript) {
60646      composeTestScript("TestScript", (TestScript)resource);
60647    } else if (resource instanceof ValueSet) {
60648      composeValueSet("ValueSet", (ValueSet)resource);
60649    } else if (resource instanceof VerificationResult) {
60650      composeVerificationResult("VerificationResult", (VerificationResult)resource);
60651    } else if (resource instanceof VisionPrescription) {
60652      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
60653 
60654    } else
60655      throw new Error("Unhandled resource type "+resource.getClass().getName());
60656  }
60657
60658  protected void composeNamedReference(String name, Resource resource) throws IOException {
60659    if (resource == null) {
60660      throw new Error("Unhandled resource type "+resource.getClass().getName());
60661    } else if (resource instanceof Account) {
60662      composeAccount(name, (Account)resource);
60663    } else if (resource instanceof ActivityDefinition) {
60664      composeActivityDefinition(name, (ActivityDefinition)resource);
60665    } else if (resource instanceof AdministrableProductDefinition) {
60666      composeAdministrableProductDefinition(name, (AdministrableProductDefinition)resource);
60667    } else if (resource instanceof AdverseEvent) {
60668      composeAdverseEvent(name, (AdverseEvent)resource);
60669    } else if (resource instanceof AllergyIntolerance) {
60670      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
60671    } else if (resource instanceof Appointment) {
60672      composeAppointment(name, (Appointment)resource);
60673    } else if (resource instanceof AppointmentResponse) {
60674      composeAppointmentResponse(name, (AppointmentResponse)resource);
60675    } else if (resource instanceof AuditEvent) {
60676      composeAuditEvent(name, (AuditEvent)resource);
60677    } else if (resource instanceof Basic) {
60678      composeBasic(name, (Basic)resource);
60679    } else if (resource instanceof Binary) {
60680      composeBinary(name, (Binary)resource);
60681    } else if (resource instanceof BiologicallyDerivedProduct) {
60682      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
60683    } else if (resource instanceof BodyStructure) {
60684      composeBodyStructure(name, (BodyStructure)resource);
60685    } else if (resource instanceof Bundle) {
60686      composeBundle(name, (Bundle)resource);
60687    } else if (resource instanceof CapabilityStatement) {
60688      composeCapabilityStatement(name, (CapabilityStatement)resource);
60689    } else if (resource instanceof CarePlan) {
60690      composeCarePlan(name, (CarePlan)resource);
60691    } else if (resource instanceof CareTeam) {
60692      composeCareTeam(name, (CareTeam)resource);
60693    } else if (resource instanceof CatalogEntry) {
60694      composeCatalogEntry(name, (CatalogEntry)resource);
60695    } else if (resource instanceof ChargeItem) {
60696      composeChargeItem(name, (ChargeItem)resource);
60697    } else if (resource instanceof ChargeItemDefinition) {
60698      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
60699    } else if (resource instanceof Citation) {
60700      composeCitation(name, (Citation)resource);
60701    } else if (resource instanceof Claim) {
60702      composeClaim(name, (Claim)resource);
60703    } else if (resource instanceof ClaimResponse) {
60704      composeClaimResponse(name, (ClaimResponse)resource);
60705    } else if (resource instanceof ClinicalImpression) {
60706      composeClinicalImpression(name, (ClinicalImpression)resource);
60707    } else if (resource instanceof ClinicalUseDefinition) {
60708      composeClinicalUseDefinition(name, (ClinicalUseDefinition)resource);
60709    } else if (resource instanceof CodeSystem) {
60710      composeCodeSystem(name, (CodeSystem)resource);
60711    } else if (resource instanceof Communication) {
60712      composeCommunication(name, (Communication)resource);
60713    } else if (resource instanceof CommunicationRequest) {
60714      composeCommunicationRequest(name, (CommunicationRequest)resource);
60715    } else if (resource instanceof CompartmentDefinition) {
60716      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
60717    } else if (resource instanceof Composition) {
60718      composeComposition(name, (Composition)resource);
60719    } else if (resource instanceof ConceptMap) {
60720      composeConceptMap(name, (ConceptMap)resource);
60721    } else if (resource instanceof Condition) {
60722      composeCondition(name, (Condition)resource);
60723    } else if (resource instanceof Consent) {
60724      composeConsent(name, (Consent)resource);
60725    } else if (resource instanceof Contract) {
60726      composeContract(name, (Contract)resource);
60727    } else if (resource instanceof Coverage) {
60728      composeCoverage(name, (Coverage)resource);
60729    } else if (resource instanceof CoverageEligibilityRequest) {
60730      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
60731    } else if (resource instanceof CoverageEligibilityResponse) {
60732      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
60733    } else if (resource instanceof DetectedIssue) {
60734      composeDetectedIssue(name, (DetectedIssue)resource);
60735    } else if (resource instanceof Device) {
60736      composeDevice(name, (Device)resource);
60737    } else if (resource instanceof DeviceDefinition) {
60738      composeDeviceDefinition(name, (DeviceDefinition)resource);
60739    } else if (resource instanceof DeviceMetric) {
60740      composeDeviceMetric(name, (DeviceMetric)resource);
60741    } else if (resource instanceof DeviceRequest) {
60742      composeDeviceRequest(name, (DeviceRequest)resource);
60743    } else if (resource instanceof DeviceUseStatement) {
60744      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
60745    } else if (resource instanceof DiagnosticReport) {
60746      composeDiagnosticReport(name, (DiagnosticReport)resource);
60747    } else if (resource instanceof DocumentManifest) {
60748      composeDocumentManifest(name, (DocumentManifest)resource);
60749    } else if (resource instanceof DocumentReference) {
60750      composeDocumentReference(name, (DocumentReference)resource);
60751    } else if (resource instanceof Encounter) {
60752      composeEncounter(name, (Encounter)resource);
60753    } else if (resource instanceof Endpoint) {
60754      composeEndpoint(name, (Endpoint)resource);
60755    } else if (resource instanceof EnrollmentRequest) {
60756      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
60757    } else if (resource instanceof EnrollmentResponse) {
60758      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
60759    } else if (resource instanceof EpisodeOfCare) {
60760      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
60761    } else if (resource instanceof EventDefinition) {
60762      composeEventDefinition(name, (EventDefinition)resource);
60763    } else if (resource instanceof Evidence) {
60764      composeEvidence(name, (Evidence)resource);
60765    } else if (resource instanceof EvidenceReport) {
60766      composeEvidenceReport(name, (EvidenceReport)resource);
60767    } else if (resource instanceof EvidenceVariable) {
60768      composeEvidenceVariable(name, (EvidenceVariable)resource);
60769    } else if (resource instanceof ExampleScenario) {
60770      composeExampleScenario(name, (ExampleScenario)resource);
60771    } else if (resource instanceof ExplanationOfBenefit) {
60772      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
60773    } else if (resource instanceof FamilyMemberHistory) {
60774      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
60775    } else if (resource instanceof Flag) {
60776      composeFlag(name, (Flag)resource);
60777    } else if (resource instanceof Goal) {
60778      composeGoal(name, (Goal)resource);
60779    } else if (resource instanceof GraphDefinition) {
60780      composeGraphDefinition(name, (GraphDefinition)resource);
60781    } else if (resource instanceof Group) {
60782      composeGroup(name, (Group)resource);
60783    } else if (resource instanceof GuidanceResponse) {
60784      composeGuidanceResponse(name, (GuidanceResponse)resource);
60785    } else if (resource instanceof HealthcareService) {
60786      composeHealthcareService(name, (HealthcareService)resource);
60787    } else if (resource instanceof ImagingStudy) {
60788      composeImagingStudy(name, (ImagingStudy)resource);
60789    } else if (resource instanceof Immunization) {
60790      composeImmunization(name, (Immunization)resource);
60791    } else if (resource instanceof ImmunizationEvaluation) {
60792      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
60793    } else if (resource instanceof ImmunizationRecommendation) {
60794      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
60795    } else if (resource instanceof ImplementationGuide) {
60796      composeImplementationGuide(name, (ImplementationGuide)resource);
60797    } else if (resource instanceof Ingredient) {
60798      composeIngredient(name, (Ingredient)resource);
60799    } else if (resource instanceof InsurancePlan) {
60800      composeInsurancePlan(name, (InsurancePlan)resource);
60801    } else if (resource instanceof Invoice) {
60802      composeInvoice(name, (Invoice)resource);
60803    } else if (resource instanceof Library) {
60804      composeLibrary(name, (Library)resource);
60805    } else if (resource instanceof Linkage) {
60806      composeLinkage(name, (Linkage)resource);
60807    } else if (resource instanceof ListResource) {
60808      composeListResource(name, (ListResource)resource);
60809    } else if (resource instanceof Location) {
60810      composeLocation(name, (Location)resource);
60811    } else if (resource instanceof ManufacturedItemDefinition) {
60812      composeManufacturedItemDefinition(name, (ManufacturedItemDefinition)resource);
60813    } else if (resource instanceof Measure) {
60814      composeMeasure(name, (Measure)resource);
60815    } else if (resource instanceof MeasureReport) {
60816      composeMeasureReport(name, (MeasureReport)resource);
60817    } else if (resource instanceof Media) {
60818      composeMedia(name, (Media)resource);
60819    } else if (resource instanceof Medication) {
60820      composeMedication(name, (Medication)resource);
60821    } else if (resource instanceof MedicationAdministration) {
60822      composeMedicationAdministration(name, (MedicationAdministration)resource);
60823    } else if (resource instanceof MedicationDispense) {
60824      composeMedicationDispense(name, (MedicationDispense)resource);
60825    } else if (resource instanceof MedicationKnowledge) {
60826      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
60827    } else if (resource instanceof MedicationRequest) {
60828      composeMedicationRequest(name, (MedicationRequest)resource);
60829    } else if (resource instanceof MedicationStatement) {
60830      composeMedicationStatement(name, (MedicationStatement)resource);
60831    } else if (resource instanceof MedicinalProductDefinition) {
60832      composeMedicinalProductDefinition(name, (MedicinalProductDefinition)resource);
60833    } else if (resource instanceof MessageDefinition) {
60834      composeMessageDefinition(name, (MessageDefinition)resource);
60835    } else if (resource instanceof MessageHeader) {
60836      composeMessageHeader(name, (MessageHeader)resource);
60837    } else if (resource instanceof MolecularSequence) {
60838      composeMolecularSequence(name, (MolecularSequence)resource);
60839    } else if (resource instanceof NamingSystem) {
60840      composeNamingSystem(name, (NamingSystem)resource);
60841    } else if (resource instanceof NutritionOrder) {
60842      composeNutritionOrder(name, (NutritionOrder)resource);
60843    } else if (resource instanceof NutritionProduct) {
60844      composeNutritionProduct(name, (NutritionProduct)resource);
60845    } else if (resource instanceof Observation) {
60846      composeObservation(name, (Observation)resource);
60847    } else if (resource instanceof ObservationDefinition) {
60848      composeObservationDefinition(name, (ObservationDefinition)resource);
60849    } else if (resource instanceof OperationDefinition) {
60850      composeOperationDefinition(name, (OperationDefinition)resource);
60851    } else if (resource instanceof OperationOutcome) {
60852      composeOperationOutcome(name, (OperationOutcome)resource);
60853    } else if (resource instanceof Organization) {
60854      composeOrganization(name, (Organization)resource);
60855    } else if (resource instanceof OrganizationAffiliation) {
60856      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
60857    } else if (resource instanceof PackagedProductDefinition) {
60858      composePackagedProductDefinition(name, (PackagedProductDefinition)resource);
60859    } else if (resource instanceof Parameters) {
60860      composeParameters(name, (Parameters)resource);
60861    } else if (resource instanceof Patient) {
60862      composePatient(name, (Patient)resource);
60863    } else if (resource instanceof PaymentNotice) {
60864      composePaymentNotice(name, (PaymentNotice)resource);
60865    } else if (resource instanceof PaymentReconciliation) {
60866      composePaymentReconciliation(name, (PaymentReconciliation)resource);
60867    } else if (resource instanceof Person) {
60868      composePerson(name, (Person)resource);
60869    } else if (resource instanceof PlanDefinition) {
60870      composePlanDefinition(name, (PlanDefinition)resource);
60871    } else if (resource instanceof Practitioner) {
60872      composePractitioner(name, (Practitioner)resource);
60873    } else if (resource instanceof PractitionerRole) {
60874      composePractitionerRole(name, (PractitionerRole)resource);
60875    } else if (resource instanceof Procedure) {
60876      composeProcedure(name, (Procedure)resource);
60877    } else if (resource instanceof Provenance) {
60878      composeProvenance(name, (Provenance)resource);
60879    } else if (resource instanceof Questionnaire) {
60880      composeQuestionnaire(name, (Questionnaire)resource);
60881    } else if (resource instanceof QuestionnaireResponse) {
60882      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
60883    } else if (resource instanceof RegulatedAuthorization) {
60884      composeRegulatedAuthorization(name, (RegulatedAuthorization)resource);
60885    } else if (resource instanceof RelatedPerson) {
60886      composeRelatedPerson(name, (RelatedPerson)resource);
60887    } else if (resource instanceof RequestGroup) {
60888      composeRequestGroup(name, (RequestGroup)resource);
60889    } else if (resource instanceof ResearchDefinition) {
60890      composeResearchDefinition(name, (ResearchDefinition)resource);
60891    } else if (resource instanceof ResearchElementDefinition) {
60892      composeResearchElementDefinition(name, (ResearchElementDefinition)resource);
60893    } else if (resource instanceof ResearchStudy) {
60894      composeResearchStudy(name, (ResearchStudy)resource);
60895    } else if (resource instanceof ResearchSubject) {
60896      composeResearchSubject(name, (ResearchSubject)resource);
60897    } else if (resource instanceof RiskAssessment) {
60898      composeRiskAssessment(name, (RiskAssessment)resource);
60899    } else if (resource instanceof Schedule) {
60900      composeSchedule(name, (Schedule)resource);
60901    } else if (resource instanceof SearchParameter) {
60902      composeSearchParameter(name, (SearchParameter)resource);
60903    } else if (resource instanceof ServiceRequest) {
60904      composeServiceRequest(name, (ServiceRequest)resource);
60905    } else if (resource instanceof Slot) {
60906      composeSlot(name, (Slot)resource);
60907    } else if (resource instanceof Specimen) {
60908      composeSpecimen(name, (Specimen)resource);
60909    } else if (resource instanceof SpecimenDefinition) {
60910      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
60911    } else if (resource instanceof StructureDefinition) {
60912      composeStructureDefinition(name, (StructureDefinition)resource);
60913    } else if (resource instanceof StructureMap) {
60914      composeStructureMap(name, (StructureMap)resource);
60915    } else if (resource instanceof Subscription) {
60916      composeSubscription(name, (Subscription)resource);
60917    } else if (resource instanceof SubscriptionStatus) {
60918      composeSubscriptionStatus(name, (SubscriptionStatus)resource);
60919    } else if (resource instanceof SubscriptionTopic) {
60920      composeSubscriptionTopic(name, (SubscriptionTopic)resource);
60921    } else if (resource instanceof Substance) {
60922      composeSubstance(name, (Substance)resource);
60923    } else if (resource instanceof SubstanceDefinition) {
60924      composeSubstanceDefinition(name, (SubstanceDefinition)resource);
60925    } else if (resource instanceof SupplyDelivery) {
60926      composeSupplyDelivery(name, (SupplyDelivery)resource);
60927    } else if (resource instanceof SupplyRequest) {
60928      composeSupplyRequest(name, (SupplyRequest)resource);
60929    } else if (resource instanceof Task) {
60930      composeTask(name, (Task)resource);
60931    } else if (resource instanceof TerminologyCapabilities) {
60932      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
60933    } else if (resource instanceof TestReport) {
60934      composeTestReport(name, (TestReport)resource);
60935    } else if (resource instanceof TestScript) {
60936      composeTestScript(name, (TestScript)resource);
60937    } else if (resource instanceof ValueSet) {
60938      composeValueSet(name, (ValueSet)resource);
60939    } else if (resource instanceof VerificationResult) {
60940      composeVerificationResult(name, (VerificationResult)resource);
60941    } else if (resource instanceof VisionPrescription) {
60942      composeVisionPrescription(name, (VisionPrescription)resource);
60943 
60944    } else
60945      throw new Error("Unhandled resource type "+resource.getClass().getName());
60946  }
60947
60948  protected void composeType(String prefix, DataType type) throws IOException {
60949    if (type == null) {
60950      ;
60951    } else if (type instanceof Address) {
60952       composeAddress(prefix+"Address", (Address) type);
60953    } else if (type instanceof Age) {
60954       composeAge(prefix+"Age", (Age) type);
60955    } else if (type instanceof Annotation) {
60956       composeAnnotation(prefix+"Annotation", (Annotation) type);
60957    } else if (type instanceof Attachment) {
60958       composeAttachment(prefix+"Attachment", (Attachment) type);
60959    } else if (type instanceof CodeableConcept) {
60960       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
60961    } else if (type instanceof CodeableReference) {
60962       composeCodeableReference(prefix+"CodeableReference", (CodeableReference) type);
60963    } else if (type instanceof Coding) {
60964       composeCoding(prefix+"Coding", (Coding) type);
60965    } else if (type instanceof ContactDetail) {
60966       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
60967    } else if (type instanceof ContactPoint) {
60968       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
60969    } else if (type instanceof Contributor) {
60970       composeContributor(prefix+"Contributor", (Contributor) type);
60971    } else if (type instanceof Count) {
60972       composeCount(prefix+"Count", (Count) type);
60973    } else if (type instanceof DataRequirement) {
60974       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
60975    } else if (type instanceof Distance) {
60976       composeDistance(prefix+"Distance", (Distance) type);
60977    } else if (type instanceof Dosage) {
60978       composeDosage(prefix+"Dosage", (Dosage) type);
60979    } else if (type instanceof Duration) {
60980       composeDuration(prefix+"Duration", (Duration) type);
60981    } else if (type instanceof ElementDefinition) {
60982       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
60983    } else if (type instanceof Expression) {
60984       composeExpression(prefix+"Expression", (Expression) type);
60985    } else if (type instanceof Extension) {
60986       composeExtension(prefix+"Extension", (Extension) type);
60987    } else if (type instanceof HumanName) {
60988       composeHumanName(prefix+"HumanName", (HumanName) type);
60989    } else if (type instanceof Identifier) {
60990       composeIdentifier(prefix+"Identifier", (Identifier) type);
60991    } else if (type instanceof MarketingStatus) {
60992       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
60993    } else if (type instanceof Meta) {
60994       composeMeta(prefix+"Meta", (Meta) type);
60995    } else if (type instanceof Money) {
60996       composeMoney(prefix+"Money", (Money) type);
60997    } else if (type instanceof Narrative) {
60998       composeNarrative(prefix+"Narrative", (Narrative) type);
60999    } else if (type instanceof ParameterDefinition) {
61000       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
61001    } else if (type instanceof Period) {
61002       composePeriod(prefix+"Period", (Period) type);
61003    } else if (type instanceof Population) {
61004       composePopulation(prefix+"Population", (Population) type);
61005    } else if (type instanceof ProdCharacteristic) {
61006       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
61007    } else if (type instanceof ProductShelfLife) {
61008       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
61009    } else if (type instanceof Quantity) {
61010       composeQuantity(prefix+"Quantity", (Quantity) type);
61011    } else if (type instanceof Range) {
61012       composeRange(prefix+"Range", (Range) type);
61013    } else if (type instanceof Ratio) {
61014       composeRatio(prefix+"Ratio", (Ratio) type);
61015    } else if (type instanceof RatioRange) {
61016       composeRatioRange(prefix+"RatioRange", (RatioRange) type);
61017    } else if (type instanceof Reference) {
61018       composeReference(prefix+"Reference", (Reference) type);
61019    } else if (type instanceof RelatedArtifact) {
61020       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
61021    } else if (type instanceof SampledData) {
61022       composeSampledData(prefix+"SampledData", (SampledData) type);
61023    } else if (type instanceof Signature) {
61024       composeSignature(prefix+"Signature", (Signature) type);
61025    } else if (type instanceof Timing) {
61026       composeTiming(prefix+"Timing", (Timing) type);
61027    } else if (type instanceof TriggerDefinition) {
61028       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
61029    } else if (type instanceof UsageContext) {
61030       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
61031 
61032    } else if (type instanceof CodeType) {
61033      composeCodeCore(prefix+"Code", (CodeType) type, false);
61034      composeCodeExtras(prefix+"Code", (CodeType) type, false);
61035    }
61036    else if (type instanceof OidType) {
61037      composeOidCore(prefix+"Oid", (OidType) type, false);
61038      composeOidExtras(prefix+"Oid", (OidType) type, false);
61039    }
61040    else if (type instanceof CanonicalType) {
61041      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
61042      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
61043    }
61044    else if (type instanceof UuidType) {
61045      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
61046      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
61047    }
61048    else if (type instanceof UrlType) {
61049      composeUrlCore(prefix+"Url", (UrlType) type, false);
61050      composeUrlExtras(prefix+"Url", (UrlType) type, false);
61051    }
61052    else if (type instanceof UnsignedIntType) {
61053      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
61054      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
61055    }
61056    else if (type instanceof MarkdownType) {
61057      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
61058      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
61059    }
61060    else if (type instanceof IdType) {
61061      composeIdCore(prefix+"Id", (IdType) type, false);
61062      composeIdExtras(prefix+"Id", (IdType) type, false);
61063    }
61064    else if (type instanceof PositiveIntType) {
61065      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
61066      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
61067    }
61068    else if (type instanceof DateType) {
61069      composeDateCore(prefix+"Date", (DateType) type, false);
61070      composeDateExtras(prefix+"Date", (DateType) type, false);
61071    }
61072    else if (type instanceof DateTimeType) {
61073      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
61074      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
61075    }
61076    else if (type instanceof StringType) {
61077      composeStringCore(prefix+"String", (StringType) type, false);
61078      composeStringExtras(prefix+"String", (StringType) type, false);
61079    }
61080    else if (type instanceof IntegerType) {
61081      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
61082      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
61083    }
61084    else if (type instanceof Integer64Type) {
61085      composeInteger64Core(prefix+"Integer64", (Integer64Type) type, false);
61086      composeInteger64Extras(prefix+"Integer64", (Integer64Type) type, false);
61087    }
61088    else if (type instanceof UriType) {
61089      composeUriCore(prefix+"Uri", (UriType) type, false);
61090      composeUriExtras(prefix+"Uri", (UriType) type, false);
61091    }
61092    else if (type instanceof InstantType) {
61093      composeInstantCore(prefix+"Instant", (InstantType) type, false);
61094      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
61095    }
61096    else if (type instanceof BooleanType) {
61097      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
61098      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
61099    }
61100    else if (type instanceof Base64BinaryType) {
61101      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
61102      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
61103    }
61104    else if (type instanceof TimeType) {
61105      composeTimeCore(prefix+"Time", (TimeType) type, false);
61106      composeTimeExtras(prefix+"Time", (TimeType) type, false);
61107    }
61108    else if (type instanceof DecimalType) {
61109      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
61110      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
61111    } else
61112      throw new Error("Unhandled type");
61113  }
61114
61115  protected void composeTypeInner(DataType type) throws IOException {
61116    if (type == null) {
61117      ;
61118    } else if (type instanceof Address) {
61119       composeAddressProperties((Address) type);
61120    } else if (type instanceof Age) {
61121       composeAgeProperties((Age) type);
61122    } else if (type instanceof Annotation) {
61123       composeAnnotationProperties((Annotation) type);
61124    } else if (type instanceof Attachment) {
61125       composeAttachmentProperties((Attachment) type);
61126    } else if (type instanceof CodeableConcept) {
61127       composeCodeableConceptProperties((CodeableConcept) type);
61128    } else if (type instanceof CodeableReference) {
61129       composeCodeableReferenceProperties((CodeableReference) type);
61130    } else if (type instanceof Coding) {
61131       composeCodingProperties((Coding) type);
61132    } else if (type instanceof ContactDetail) {
61133       composeContactDetailProperties((ContactDetail) type);
61134    } else if (type instanceof ContactPoint) {
61135       composeContactPointProperties((ContactPoint) type);
61136    } else if (type instanceof Contributor) {
61137       composeContributorProperties((Contributor) type);
61138    } else if (type instanceof Count) {
61139       composeCountProperties((Count) type);
61140    } else if (type instanceof DataRequirement) {
61141       composeDataRequirementProperties((DataRequirement) type);
61142    } else if (type instanceof Distance) {
61143       composeDistanceProperties((Distance) type);
61144    } else if (type instanceof Dosage) {
61145       composeDosageProperties((Dosage) type);
61146    } else if (type instanceof Duration) {
61147       composeDurationProperties((Duration) type);
61148    } else if (type instanceof ElementDefinition) {
61149       composeElementDefinitionProperties((ElementDefinition) type);
61150    } else if (type instanceof Expression) {
61151       composeExpressionProperties((Expression) type);
61152    } else if (type instanceof Extension) {
61153       composeExtensionProperties((Extension) type);
61154    } else if (type instanceof HumanName) {
61155       composeHumanNameProperties((HumanName) type);
61156    } else if (type instanceof Identifier) {
61157       composeIdentifierProperties((Identifier) type);
61158    } else if (type instanceof MarketingStatus) {
61159       composeMarketingStatusProperties((MarketingStatus) type);
61160    } else if (type instanceof Meta) {
61161       composeMetaProperties((Meta) type);
61162    } else if (type instanceof Money) {
61163       composeMoneyProperties((Money) type);
61164    } else if (type instanceof Narrative) {
61165       composeNarrativeProperties((Narrative) type);
61166    } else if (type instanceof ParameterDefinition) {
61167       composeParameterDefinitionProperties((ParameterDefinition) type);
61168    } else if (type instanceof Period) {
61169       composePeriodProperties((Period) type);
61170    } else if (type instanceof Population) {
61171       composePopulationProperties((Population) type);
61172    } else if (type instanceof ProdCharacteristic) {
61173       composeProdCharacteristicProperties((ProdCharacteristic) type);
61174    } else if (type instanceof ProductShelfLife) {
61175       composeProductShelfLifeProperties((ProductShelfLife) type);
61176    } else if (type instanceof Quantity) {
61177       composeQuantityProperties((Quantity) type);
61178    } else if (type instanceof Range) {
61179       composeRangeProperties((Range) type);
61180    } else if (type instanceof Ratio) {
61181       composeRatioProperties((Ratio) type);
61182    } else if (type instanceof RatioRange) {
61183       composeRatioRangeProperties((RatioRange) type);
61184    } else if (type instanceof Reference) {
61185       composeReferenceProperties((Reference) type);
61186    } else if (type instanceof RelatedArtifact) {
61187       composeRelatedArtifactProperties((RelatedArtifact) type);
61188    } else if (type instanceof SampledData) {
61189       composeSampledDataProperties((SampledData) type);
61190    } else if (type instanceof Signature) {
61191       composeSignatureProperties((Signature) type);
61192    } else if (type instanceof Timing) {
61193       composeTimingProperties((Timing) type);
61194    } else if (type instanceof TriggerDefinition) {
61195       composeTriggerDefinitionProperties((TriggerDefinition) type);
61196    } else if (type instanceof UsageContext) {
61197       composeUsageContextProperties((UsageContext) type);
61198 
61199    } else
61200      throw new Error("Unhandled type: "+type.fhirType());
61201  }
61202
61203}