001package org.hl7.fhir.r5.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 Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
034
035
036
037import org.hl7.fhir.r5.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 parseBackboneElementProperties(JsonObject json, BackboneElement res) throws IOException, FHIRFormatError {
182    parseElementProperties(json, res);
183    if (json.has("modifierExtension")) {
184      JsonArray array = getJArray(json, "modifierExtension");
185      for (int i = 0; i < array.size(); i++) {
186        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
187      }
188    };
189  }
190
191  protected void parseBackboneTypeProperties(JsonObject json, BackboneType res) throws IOException, FHIRFormatError {
192    parseDataTypeProperties(json, res);
193    if (json.has("modifierExtension")) {
194      JsonArray array = getJArray(json, "modifierExtension");
195      for (int i = 0; i < array.size(); i++) {
196        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
197      }
198    };
199  }
200
201  protected void parseDataTypeProperties(JsonObject json, DataType res) throws IOException, FHIRFormatError {
202    parseElementProperties(json, res);
203  }
204
205  protected void parseElementProperties(JsonObject json, Element res) throws IOException, FHIRFormatError {
206    if (json.has("id"))
207      res.setIdElement(parseString(json.get("id").getAsString()));
208    if (json.has("_id"))
209      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
210    if (json.has("extension")) {
211      JsonArray array = getJArray(json, "extension");
212      for (int i = 0; i < array.size(); i++) {
213        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
214      }
215    };
216  }
217
218  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
219    Address res = new Address();
220    parseAddressProperties(json, res);
221    return res;
222  }
223
224  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
225    parseDataTypeProperties(json, res);
226    if (json.has("use"))
227      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
228    if (json.has("_use"))
229      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
230    if (json.has("type"))
231      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
232    if (json.has("_type"))
233      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
234    if (json.has("text"))
235      res.setTextElement(parseString(json.get("text").getAsString()));
236    if (json.has("_text"))
237      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
238    if (json.has("line")) {
239      JsonArray array = getJArray(json, "line");
240      for (int i = 0; i < array.size(); i++) {
241        if (array.get(i).isJsonNull()) {
242          res.getLine().add(new StringType());
243        } else {;
244          res.getLine().add(parseString(array.get(i).getAsString()));
245        }
246      }
247    };
248    if (json.has("_line")) {
249      JsonArray array = getJArray(json, "_line");
250      for (int i = 0; i < array.size(); i++) {
251        if (i == res.getLine().size())
252          res.getLine().add(parseString(null));
253        if (array.get(i) instanceof JsonObject) 
254          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
255      }
256    };
257    if (json.has("city"))
258      res.setCityElement(parseString(json.get("city").getAsString()));
259    if (json.has("_city"))
260      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
261    if (json.has("district"))
262      res.setDistrictElement(parseString(json.get("district").getAsString()));
263    if (json.has("_district"))
264      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
265    if (json.has("state"))
266      res.setStateElement(parseString(json.get("state").getAsString()));
267    if (json.has("_state"))
268      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
269    if (json.has("postalCode"))
270      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
271    if (json.has("_postalCode"))
272      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
273    if (json.has("country"))
274      res.setCountryElement(parseString(json.get("country").getAsString()));
275    if (json.has("_country"))
276      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
277    if (json.has("period"))
278      res.setPeriod(parsePeriod(getJObject(json, "period")));
279  }
280
281  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
282    Age res = new Age();
283    parseAgeProperties(json, res);
284    return res;
285  }
286
287  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
288    parseQuantityProperties(json, res);
289  }
290
291  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
292    Annotation res = new Annotation();
293    parseAnnotationProperties(json, res);
294    return res;
295  }
296
297  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
298    parseDataTypeProperties(json, res);
299    DataType author = parseType("author", json);
300    if (author != null)
301      res.setAuthor(author);
302    if (json.has("time"))
303      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
304    if (json.has("_time"))
305      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
306    if (json.has("text"))
307      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
308    if (json.has("_text"))
309      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
310  }
311
312  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
313    Attachment res = new Attachment();
314    parseAttachmentProperties(json, res);
315    return res;
316  }
317
318  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
319    parseDataTypeProperties(json, res);
320    if (json.has("contentType"))
321      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
322    if (json.has("_contentType"))
323      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
324    if (json.has("language"))
325      res.setLanguageElement(parseCode(json.get("language").getAsString()));
326    if (json.has("_language"))
327      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
328    if (json.has("data"))
329      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
330    if (json.has("_data"))
331      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
332    if (json.has("url"))
333      res.setUrlElement(parseUrl(json.get("url").getAsString()));
334    if (json.has("_url"))
335      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
336    if (json.has("size"))
337      res.setSizeElement(parseInteger64(json.get("size").getAsLong()));
338    if (json.has("_size"))
339      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
340    if (json.has("hash"))
341      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
342    if (json.has("_hash"))
343      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
344    if (json.has("title"))
345      res.setTitleElement(parseString(json.get("title").getAsString()));
346    if (json.has("_title"))
347      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
348    if (json.has("creation"))
349      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
350    if (json.has("_creation"))
351      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
352    if (json.has("height"))
353      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
354    if (json.has("_height"))
355      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
356    if (json.has("width"))
357      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
358    if (json.has("_width"))
359      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
360    if (json.has("frames"))
361      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
362    if (json.has("_frames"))
363      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
364    if (json.has("duration"))
365      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
366    if (json.has("_duration"))
367      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
368    if (json.has("pages"))
369      res.setPagesElement(parsePositiveInt(json.get("pages").getAsString()));
370    if (json.has("_pages"))
371      parseElementProperties(getJObject(json, "_pages"), res.getPagesElement());
372  }
373
374  protected Availability parseAvailability(JsonObject json) throws IOException, FHIRFormatError {
375    Availability res = new Availability();
376    parseAvailabilityProperties(json, res);
377    return res;
378  }
379
380  protected void parseAvailabilityProperties(JsonObject json, Availability res) throws IOException, FHIRFormatError {
381    parseDataTypeProperties(json, res);
382    if (json.has("availableTime")) {
383      JsonArray array = getJArray(json, "availableTime");
384      for (int i = 0; i < array.size(); i++) {
385        res.getAvailableTime().add(parseAvailabilityAvailableTimeComponent(array.get(i).getAsJsonObject()));
386      }
387    };
388    if (json.has("notAvailableTime")) {
389      JsonArray array = getJArray(json, "notAvailableTime");
390      for (int i = 0; i < array.size(); i++) {
391        res.getNotAvailableTime().add(parseAvailabilityNotAvailableTimeComponent(array.get(i).getAsJsonObject()));
392      }
393    };
394  }
395
396  protected Availability.AvailabilityAvailableTimeComponent parseAvailabilityAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
397    Availability.AvailabilityAvailableTimeComponent res = new Availability.AvailabilityAvailableTimeComponent();
398    parseAvailabilityAvailableTimeComponentProperties(json, res);
399    return res;
400  }
401
402  protected void parseAvailabilityAvailableTimeComponentProperties(JsonObject json, Availability.AvailabilityAvailableTimeComponent res) throws IOException, FHIRFormatError {
403    parseElementProperties(json, res);
404    if (json.has("daysOfWeek")) {
405      JsonArray array = getJArray(json, "daysOfWeek");
406      for (int i = 0; i < array.size(); i++) {
407        if (array.get(i).isJsonNull()) {
408          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
409        } else {;
410          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
411        }
412      }
413    };
414    if (json.has("_daysOfWeek")) {
415      JsonArray array = getJArray(json, "_daysOfWeek");
416      for (int i = 0; i < array.size(); i++) {
417        if (i == res.getDaysOfWeek().size())
418          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
419        if (array.get(i) instanceof JsonObject) 
420          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
421      }
422    };
423    if (json.has("allDay"))
424      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
425    if (json.has("_allDay"))
426      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
427    if (json.has("availableStartTime"))
428      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
429    if (json.has("_availableStartTime"))
430      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
431    if (json.has("availableEndTime"))
432      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
433    if (json.has("_availableEndTime"))
434      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
435  }
436
437  protected Availability.AvailabilityNotAvailableTimeComponent parseAvailabilityNotAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
438    Availability.AvailabilityNotAvailableTimeComponent res = new Availability.AvailabilityNotAvailableTimeComponent();
439    parseAvailabilityNotAvailableTimeComponentProperties(json, res);
440    return res;
441  }
442
443  protected void parseAvailabilityNotAvailableTimeComponentProperties(JsonObject json, Availability.AvailabilityNotAvailableTimeComponent res) throws IOException, FHIRFormatError {
444    parseElementProperties(json, res);
445    if (json.has("description"))
446      res.setDescriptionElement(parseString(json.get("description").getAsString()));
447    if (json.has("_description"))
448      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
449    if (json.has("during"))
450      res.setDuring(parsePeriod(getJObject(json, "during")));
451  }
452
453  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
454    CodeableConcept res = new CodeableConcept();
455    parseCodeableConceptProperties(json, res);
456    return res;
457  }
458
459  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
460    parseDataTypeProperties(json, res);
461    if (json.has("coding")) {
462      JsonArray array = getJArray(json, "coding");
463      for (int i = 0; i < array.size(); i++) {
464        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
465      }
466    };
467    if (json.has("text"))
468      res.setTextElement(parseString(json.get("text").getAsString()));
469    if (json.has("_text"))
470      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
471  }
472
473  protected CodeableReference parseCodeableReference(JsonObject json) throws IOException, FHIRFormatError {
474    CodeableReference res = new CodeableReference();
475    parseCodeableReferenceProperties(json, res);
476    return res;
477  }
478
479  protected void parseCodeableReferenceProperties(JsonObject json, CodeableReference res) throws IOException, FHIRFormatError {
480    parseDataTypeProperties(json, res);
481    if (json.has("concept"))
482      res.setConcept(parseCodeableConcept(getJObject(json, "concept")));
483    if (json.has("reference"))
484      res.setReference(parseReference(getJObject(json, "reference")));
485  }
486
487  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
488    Coding res = new Coding();
489    parseCodingProperties(json, res);
490    return res;
491  }
492
493  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
494    parseDataTypeProperties(json, res);
495    if (json.has("system"))
496      res.setSystemElement(parseUri(json.get("system").getAsString()));
497    if (json.has("_system"))
498      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
499    if (json.has("version"))
500      res.setVersionElement(parseString(json.get("version").getAsString()));
501    if (json.has("_version"))
502      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
503    if (json.has("code"))
504      res.setCodeElement(parseCode(json.get("code").getAsString()));
505    if (json.has("_code"))
506      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
507    if (json.has("display"))
508      res.setDisplayElement(parseString(json.get("display").getAsString()));
509    if (json.has("_display"))
510      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
511    if (json.has("userSelected"))
512      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
513    if (json.has("_userSelected"))
514      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
515  }
516
517  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
518    ContactDetail res = new ContactDetail();
519    parseContactDetailProperties(json, res);
520    return res;
521  }
522
523  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
524    parseDataTypeProperties(json, res);
525    if (json.has("name"))
526      res.setNameElement(parseString(json.get("name").getAsString()));
527    if (json.has("_name"))
528      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
529    if (json.has("telecom")) {
530      JsonArray array = getJArray(json, "telecom");
531      for (int i = 0; i < array.size(); i++) {
532        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
533      }
534    };
535  }
536
537  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
538    ContactPoint res = new ContactPoint();
539    parseContactPointProperties(json, res);
540    return res;
541  }
542
543  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
544    parseDataTypeProperties(json, res);
545    if (json.has("system"))
546      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
547    if (json.has("_system"))
548      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
549    if (json.has("value"))
550      res.setValueElement(parseString(json.get("value").getAsString()));
551    if (json.has("_value"))
552      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
553    if (json.has("use"))
554      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
555    if (json.has("_use"))
556      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
557    if (json.has("rank"))
558      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
559    if (json.has("_rank"))
560      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
561    if (json.has("period"))
562      res.setPeriod(parsePeriod(getJObject(json, "period")));
563  }
564
565  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
566    Contributor res = new Contributor();
567    parseContributorProperties(json, res);
568    return res;
569  }
570
571  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
572    parseDataTypeProperties(json, res);
573    if (json.has("type"))
574      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
575    if (json.has("_type"))
576      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
577    if (json.has("name"))
578      res.setNameElement(parseString(json.get("name").getAsString()));
579    if (json.has("_name"))
580      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
581    if (json.has("contact")) {
582      JsonArray array = getJArray(json, "contact");
583      for (int i = 0; i < array.size(); i++) {
584        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
585      }
586    };
587  }
588
589  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
590    Count res = new Count();
591    parseCountProperties(json, res);
592    return res;
593  }
594
595  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
596    parseQuantityProperties(json, res);
597  }
598
599  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
600    DataRequirement res = new DataRequirement();
601    parseDataRequirementProperties(json, res);
602    return res;
603  }
604
605  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
606    parseDataTypeProperties(json, res);
607    if (json.has("type"))
608      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
609    if (json.has("_type"))
610      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
611    if (json.has("profile")) {
612      JsonArray array = getJArray(json, "profile");
613      for (int i = 0; i < array.size(); i++) {
614        if (array.get(i).isJsonNull()) {
615          res.getProfile().add(new CanonicalType());
616        } else {;
617          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
618        }
619      }
620    };
621    if (json.has("_profile")) {
622      JsonArray array = getJArray(json, "_profile");
623      for (int i = 0; i < array.size(); i++) {
624        if (i == res.getProfile().size())
625          res.getProfile().add(parseCanonical(null));
626        if (array.get(i) instanceof JsonObject) 
627          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
628      }
629    };
630    DataType subject = parseType("subject", json);
631    if (subject != null)
632      res.setSubject(subject);
633    if (json.has("mustSupport")) {
634      JsonArray array = getJArray(json, "mustSupport");
635      for (int i = 0; i < array.size(); i++) {
636        if (array.get(i).isJsonNull()) {
637          res.getMustSupport().add(new StringType());
638        } else {;
639          res.getMustSupport().add(parseString(array.get(i).getAsString()));
640        }
641      }
642    };
643    if (json.has("_mustSupport")) {
644      JsonArray array = getJArray(json, "_mustSupport");
645      for (int i = 0; i < array.size(); i++) {
646        if (i == res.getMustSupport().size())
647          res.getMustSupport().add(parseString(null));
648        if (array.get(i) instanceof JsonObject) 
649          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
650      }
651    };
652    if (json.has("codeFilter")) {
653      JsonArray array = getJArray(json, "codeFilter");
654      for (int i = 0; i < array.size(); i++) {
655        res.getCodeFilter().add(parseDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject()));
656      }
657    };
658    if (json.has("dateFilter")) {
659      JsonArray array = getJArray(json, "dateFilter");
660      for (int i = 0; i < array.size(); i++) {
661        res.getDateFilter().add(parseDataRequirementDateFilterComponent(array.get(i).getAsJsonObject()));
662      }
663    };
664    if (json.has("valueFilter")) {
665      JsonArray array = getJArray(json, "valueFilter");
666      for (int i = 0; i < array.size(); i++) {
667        res.getValueFilter().add(parseDataRequirementValueFilterComponent(array.get(i).getAsJsonObject()));
668      }
669    };
670    if (json.has("limit"))
671      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
672    if (json.has("_limit"))
673      parseElementProperties(getJObject(json, "_limit"), res.getLimitElement());
674    if (json.has("sort")) {
675      JsonArray array = getJArray(json, "sort");
676      for (int i = 0; i < array.size(); i++) {
677        res.getSort().add(parseDataRequirementSortComponent(array.get(i).getAsJsonObject()));
678      }
679    };
680  }
681
682  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementCodeFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
683    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
684    parseDataRequirementCodeFilterComponentProperties(json, res);
685    return res;
686  }
687
688  protected void parseDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
689    parseElementProperties(json, res);
690    if (json.has("path"))
691      res.setPathElement(parseString(json.get("path").getAsString()));
692    if (json.has("_path"))
693      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
694    if (json.has("searchParam"))
695      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
696    if (json.has("_searchParam"))
697      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
698    if (json.has("valueSet"))
699      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
700    if (json.has("_valueSet"))
701      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
702    if (json.has("code")) {
703      JsonArray array = getJArray(json, "code");
704      for (int i = 0; i < array.size(); i++) {
705        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
706      }
707    };
708  }
709
710  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDateFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
711    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
712    parseDataRequirementDateFilterComponentProperties(json, res);
713    return res;
714  }
715
716  protected void parseDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
717    parseElementProperties(json, res);
718    if (json.has("path"))
719      res.setPathElement(parseString(json.get("path").getAsString()));
720    if (json.has("_path"))
721      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
722    if (json.has("searchParam"))
723      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
724    if (json.has("_searchParam"))
725      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
726    DataType value = parseType("value", json);
727    if (value != null)
728      res.setValue(value);
729  }
730
731  protected DataRequirement.DataRequirementValueFilterComponent parseDataRequirementValueFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
732    DataRequirement.DataRequirementValueFilterComponent res = new DataRequirement.DataRequirementValueFilterComponent();
733    parseDataRequirementValueFilterComponentProperties(json, res);
734    return res;
735  }
736
737  protected void parseDataRequirementValueFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementValueFilterComponent res) throws IOException, FHIRFormatError {
738    parseElementProperties(json, res);
739    if (json.has("path"))
740      res.setPathElement(parseString(json.get("path").getAsString()));
741    if (json.has("_path"))
742      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
743    if (json.has("searchParam"))
744      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
745    if (json.has("_searchParam"))
746      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
747    if (json.has("comparator"))
748      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), DataRequirement.ValueFilterComparator.NULL, new DataRequirement.ValueFilterComparatorEnumFactory()));
749    if (json.has("_comparator"))
750      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
751    DataType value = parseType("value", json);
752    if (value != null)
753      res.setValue(value);
754  }
755
756  protected DataRequirement.DataRequirementSortComponent parseDataRequirementSortComponent(JsonObject json) throws IOException, FHIRFormatError {
757    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
758    parseDataRequirementSortComponentProperties(json, res);
759    return res;
760  }
761
762  protected void parseDataRequirementSortComponentProperties(JsonObject json, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
763    parseElementProperties(json, res);
764    if (json.has("path"))
765      res.setPathElement(parseString(json.get("path").getAsString()));
766    if (json.has("_path"))
767      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
768    if (json.has("direction"))
769      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
770    if (json.has("_direction"))
771      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
772  }
773
774  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
775    Distance res = new Distance();
776    parseDistanceProperties(json, res);
777    return res;
778  }
779
780  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
781    parseQuantityProperties(json, res);
782  }
783
784  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
785    Dosage res = new Dosage();
786    parseDosageProperties(json, res);
787    return res;
788  }
789
790  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
791    parseBackboneTypeProperties(json, res);
792    if (json.has("sequence"))
793      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
794    if (json.has("_sequence"))
795      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
796    if (json.has("text"))
797      res.setTextElement(parseString(json.get("text").getAsString()));
798    if (json.has("_text"))
799      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
800    if (json.has("additionalInstruction")) {
801      JsonArray array = getJArray(json, "additionalInstruction");
802      for (int i = 0; i < array.size(); i++) {
803        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
804      }
805    };
806    if (json.has("patientInstruction"))
807      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
808    if (json.has("_patientInstruction"))
809      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
810    if (json.has("timing"))
811      res.setTiming(parseTiming(getJObject(json, "timing")));
812    if (json.has("asNeeded"))
813      res.setAsNeededElement(parseBoolean(json.get("asNeeded").getAsBoolean()));
814    if (json.has("_asNeeded"))
815      parseElementProperties(getJObject(json, "_asNeeded"), res.getAsNeededElement());
816    if (json.has("asNeededFor")) {
817      JsonArray array = getJArray(json, "asNeededFor");
818      for (int i = 0; i < array.size(); i++) {
819        res.getAsNeededFor().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
820      }
821    };
822    if (json.has("site"))
823      res.setSite(parseCodeableConcept(getJObject(json, "site")));
824    if (json.has("route"))
825      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
826    if (json.has("method"))
827      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
828    if (json.has("doseAndRate")) {
829      JsonArray array = getJArray(json, "doseAndRate");
830      for (int i = 0; i < array.size(); i++) {
831        res.getDoseAndRate().add(parseDosageDoseAndRateComponent(array.get(i).getAsJsonObject()));
832      }
833    };
834    if (json.has("maxDosePerPeriod")) {
835      JsonArray array = getJArray(json, "maxDosePerPeriod");
836      for (int i = 0; i < array.size(); i++) {
837        res.getMaxDosePerPeriod().add(parseRatio(array.get(i).getAsJsonObject()));
838      }
839    };
840    if (json.has("maxDosePerAdministration"))
841      res.setMaxDosePerAdministration(parseQuantity(getJObject(json, "maxDosePerAdministration")));
842    if (json.has("maxDosePerLifetime"))
843      res.setMaxDosePerLifetime(parseQuantity(getJObject(json, "maxDosePerLifetime")));
844  }
845
846  protected Dosage.DosageDoseAndRateComponent parseDosageDoseAndRateComponent(JsonObject json) throws IOException, FHIRFormatError {
847    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
848    parseDosageDoseAndRateComponentProperties(json, res);
849    return res;
850  }
851
852  protected void parseDosageDoseAndRateComponentProperties(JsonObject json, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
853    parseElementProperties(json, res);
854    if (json.has("type"))
855      res.setType(parseCodeableConcept(getJObject(json, "type")));
856    DataType dose = parseType("dose", json);
857    if (dose != null)
858      res.setDose(dose);
859    DataType rate = parseType("rate", json);
860    if (rate != null)
861      res.setRate(rate);
862  }
863
864  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
865    Duration res = new Duration();
866    parseDurationProperties(json, res);
867    return res;
868  }
869
870  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
871    parseQuantityProperties(json, res);
872  }
873
874  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
875    ElementDefinition res = new ElementDefinition();
876    parseElementDefinitionProperties(json, res);
877    return res;
878  }
879
880  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
881    parseBackboneTypeProperties(json, res);
882    if (json.has("path"))
883      res.setPathElement(parseString(json.get("path").getAsString()));
884    if (json.has("_path"))
885      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
886    if (json.has("representation")) {
887      JsonArray array = getJArray(json, "representation");
888      for (int i = 0; i < array.size(); i++) {
889        if (array.get(i).isJsonNull()) {
890          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>(new ElementDefinition.PropertyRepresentationEnumFactory(), ElementDefinition.PropertyRepresentation.NULL));
891        } else {;
892          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
893        }
894      }
895    };
896    if (json.has("_representation")) {
897      JsonArray array = getJArray(json, "_representation");
898      for (int i = 0; i < array.size(); i++) {
899        if (i == res.getRepresentation().size())
900          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
901        if (array.get(i) instanceof JsonObject) 
902          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
903      }
904    };
905    if (json.has("sliceName"))
906      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
907    if (json.has("_sliceName"))
908      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
909    if (json.has("sliceIsConstraining"))
910      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
911    if (json.has("_sliceIsConstraining"))
912      parseElementProperties(getJObject(json, "_sliceIsConstraining"), res.getSliceIsConstrainingElement());
913    if (json.has("label"))
914      res.setLabelElement(parseString(json.get("label").getAsString()));
915    if (json.has("_label"))
916      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
917    if (json.has("code")) {
918      JsonArray array = getJArray(json, "code");
919      for (int i = 0; i < array.size(); i++) {
920        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
921      }
922    };
923    if (json.has("slicing"))
924      res.setSlicing(parseElementDefinitionSlicingComponent(getJObject(json, "slicing")));
925    if (json.has("short"))
926      res.setShortElement(parseString(json.get("short").getAsString()));
927    if (json.has("_short"))
928      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
929    if (json.has("definition"))
930      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
931    if (json.has("_definition"))
932      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
933    if (json.has("comment"))
934      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
935    if (json.has("_comment"))
936      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
937    if (json.has("requirements"))
938      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
939    if (json.has("_requirements"))
940      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
941    if (json.has("alias")) {
942      JsonArray array = getJArray(json, "alias");
943      for (int i = 0; i < array.size(); i++) {
944        if (array.get(i).isJsonNull()) {
945          res.getAlias().add(new StringType());
946        } else {;
947          res.getAlias().add(parseString(array.get(i).getAsString()));
948        }
949      }
950    };
951    if (json.has("_alias")) {
952      JsonArray array = getJArray(json, "_alias");
953      for (int i = 0; i < array.size(); i++) {
954        if (i == res.getAlias().size())
955          res.getAlias().add(parseString(null));
956        if (array.get(i) instanceof JsonObject) 
957          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
958      }
959    };
960    if (json.has("min"))
961      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
962    if (json.has("_min"))
963      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
964    if (json.has("max"))
965      res.setMaxElement(parseString(json.get("max").getAsString()));
966    if (json.has("_max"))
967      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
968    if (json.has("base"))
969      res.setBase(parseElementDefinitionBaseComponent(getJObject(json, "base")));
970    if (json.has("contentReference"))
971      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
972    if (json.has("_contentReference"))
973      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
974    if (json.has("type")) {
975      JsonArray array = getJArray(json, "type");
976      for (int i = 0; i < array.size(); i++) {
977        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject()));
978      }
979    };
980    DataType defaultValue = parseType("defaultValue", json);
981    if (defaultValue != null)
982      res.setDefaultValue(defaultValue);
983    if (json.has("meaningWhenMissing"))
984      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
985    if (json.has("_meaningWhenMissing"))
986      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
987    if (json.has("orderMeaning"))
988      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
989    if (json.has("_orderMeaning"))
990      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
991    DataType fixed = parseType("fixed", json);
992    if (fixed != null)
993      res.setFixed(fixed);
994    DataType pattern = parseType("pattern", json);
995    if (pattern != null)
996      res.setPattern(pattern);
997    if (json.has("example")) {
998      JsonArray array = getJArray(json, "example");
999      for (int i = 0; i < array.size(); i++) {
1000        res.getExample().add(parseElementDefinitionExampleComponent(array.get(i).getAsJsonObject()));
1001      }
1002    };
1003    DataType minValue = parseType("minValue", json);
1004    if (minValue != null)
1005      res.setMinValue(minValue);
1006    DataType maxValue = parseType("maxValue", json);
1007    if (maxValue != null)
1008      res.setMaxValue(maxValue);
1009    if (json.has("maxLength"))
1010      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1011    if (json.has("_maxLength"))
1012      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
1013    if (json.has("condition")) {
1014      JsonArray array = getJArray(json, "condition");
1015      for (int i = 0; i < array.size(); i++) {
1016        if (array.get(i).isJsonNull()) {
1017          res.getCondition().add(new IdType());
1018        } else {;
1019          res.getCondition().add(parseId(array.get(i).getAsString()));
1020        }
1021      }
1022    };
1023    if (json.has("_condition")) {
1024      JsonArray array = getJArray(json, "_condition");
1025      for (int i = 0; i < array.size(); i++) {
1026        if (i == res.getCondition().size())
1027          res.getCondition().add(parseId(null));
1028        if (array.get(i) instanceof JsonObject) 
1029          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1030      }
1031    };
1032    if (json.has("constraint")) {
1033      JsonArray array = getJArray(json, "constraint");
1034      for (int i = 0; i < array.size(); i++) {
1035        res.getConstraint().add(parseElementDefinitionConstraintComponent(array.get(i).getAsJsonObject()));
1036      }
1037    };
1038    if (json.has("mustHaveValue"))
1039      res.setMustHaveValueElement(parseBoolean(json.get("mustHaveValue").getAsBoolean()));
1040    if (json.has("_mustHaveValue"))
1041      parseElementProperties(getJObject(json, "_mustHaveValue"), res.getMustHaveValueElement());
1042    if (json.has("valueAlternatives")) {
1043      JsonArray array = getJArray(json, "valueAlternatives");
1044      for (int i = 0; i < array.size(); i++) {
1045        if (array.get(i).isJsonNull()) {
1046          res.getValueAlternatives().add(new CanonicalType());
1047        } else {;
1048          res.getValueAlternatives().add(parseCanonical(array.get(i).getAsString()));
1049        }
1050      }
1051    };
1052    if (json.has("_valueAlternatives")) {
1053      JsonArray array = getJArray(json, "_valueAlternatives");
1054      for (int i = 0; i < array.size(); i++) {
1055        if (i == res.getValueAlternatives().size())
1056          res.getValueAlternatives().add(parseCanonical(null));
1057        if (array.get(i) instanceof JsonObject) 
1058          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueAlternatives().get(i));
1059      }
1060    };
1061    if (json.has("mustSupport"))
1062      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1063    if (json.has("_mustSupport"))
1064      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
1065    if (json.has("isModifier"))
1066      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1067    if (json.has("_isModifier"))
1068      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
1069    if (json.has("isModifierReason"))
1070      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1071    if (json.has("_isModifierReason"))
1072      parseElementProperties(getJObject(json, "_isModifierReason"), res.getIsModifierReasonElement());
1073    if (json.has("isSummary"))
1074      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1075    if (json.has("_isSummary"))
1076      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
1077    if (json.has("binding"))
1078      res.setBinding(parseElementDefinitionBindingComponent(getJObject(json, "binding")));
1079    if (json.has("mapping")) {
1080      JsonArray array = getJArray(json, "mapping");
1081      for (int i = 0; i < array.size(); i++) {
1082        res.getMapping().add(parseElementDefinitionMappingComponent(array.get(i).getAsJsonObject()));
1083      }
1084    };
1085  }
1086
1087  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionSlicingComponent(JsonObject json) throws IOException, FHIRFormatError {
1088    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1089    parseElementDefinitionSlicingComponentProperties(json, res);
1090    return res;
1091  }
1092
1093  protected void parseElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1094    parseElementProperties(json, res);
1095    if (json.has("discriminator")) {
1096      JsonArray array = getJArray(json, "discriminator");
1097      for (int i = 0; i < array.size(); i++) {
1098        res.getDiscriminator().add(parseElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject()));
1099      }
1100    };
1101    if (json.has("description"))
1102      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1103    if (json.has("_description"))
1104      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1105    if (json.has("ordered"))
1106      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1107    if (json.has("_ordered"))
1108      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
1109    if (json.has("rules"))
1110      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1111    if (json.has("_rules"))
1112      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
1113  }
1114
1115  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionSlicingDiscriminatorComponent(JsonObject json) throws IOException, FHIRFormatError {
1116    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1117    parseElementDefinitionSlicingDiscriminatorComponentProperties(json, res);
1118    return res;
1119  }
1120
1121  protected void parseElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1122    parseElementProperties(json, res);
1123    if (json.has("type"))
1124      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1125    if (json.has("_type"))
1126      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1127    if (json.has("path"))
1128      res.setPathElement(parseString(json.get("path").getAsString()));
1129    if (json.has("_path"))
1130      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1131  }
1132
1133  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionBaseComponent(JsonObject json) throws IOException, FHIRFormatError {
1134    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1135    parseElementDefinitionBaseComponentProperties(json, res);
1136    return res;
1137  }
1138
1139  protected void parseElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1140    parseElementProperties(json, res);
1141    if (json.has("path"))
1142      res.setPathElement(parseString(json.get("path").getAsString()));
1143    if (json.has("_path"))
1144      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1145    if (json.has("min"))
1146      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1147    if (json.has("_min"))
1148      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1149    if (json.has("max"))
1150      res.setMaxElement(parseString(json.get("max").getAsString()));
1151    if (json.has("_max"))
1152      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1153  }
1154
1155  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json) throws IOException, FHIRFormatError {
1156    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1157    parseElementDefinitionTypeRefComponentProperties(json, res);
1158    return res;
1159  }
1160
1161  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1162    parseElementProperties(json, res);
1163    if (json.has("code"))
1164      res.setCodeElement(parseUri(json.get("code").getAsString()));
1165    if (json.has("_code"))
1166      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1167    if (json.has("profile")) {
1168      JsonArray array = getJArray(json, "profile");
1169      for (int i = 0; i < array.size(); i++) {
1170        if (array.get(i).isJsonNull()) {
1171          res.getProfile().add(new CanonicalType());
1172        } else {;
1173          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1174        }
1175      }
1176    };
1177    if (json.has("_profile")) {
1178      JsonArray array = getJArray(json, "_profile");
1179      for (int i = 0; i < array.size(); i++) {
1180        if (i == res.getProfile().size())
1181          res.getProfile().add(parseCanonical(null));
1182        if (array.get(i) instanceof JsonObject) 
1183          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1184      }
1185    };
1186    if (json.has("targetProfile")) {
1187      JsonArray array = getJArray(json, "targetProfile");
1188      for (int i = 0; i < array.size(); i++) {
1189        if (array.get(i).isJsonNull()) {
1190          res.getTargetProfile().add(new CanonicalType());
1191        } else {;
1192          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1193        }
1194      }
1195    };
1196    if (json.has("_targetProfile")) {
1197      JsonArray array = getJArray(json, "_targetProfile");
1198      for (int i = 0; i < array.size(); i++) {
1199        if (i == res.getTargetProfile().size())
1200          res.getTargetProfile().add(parseCanonical(null));
1201        if (array.get(i) instanceof JsonObject) 
1202          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1203      }
1204    };
1205    if (json.has("aggregation")) {
1206      JsonArray array = getJArray(json, "aggregation");
1207      for (int i = 0; i < array.size(); i++) {
1208        if (array.get(i).isJsonNull()) {
1209          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>(new ElementDefinition.AggregationModeEnumFactory(), ElementDefinition.AggregationMode.NULL));
1210        } else {;
1211          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1212        }
1213      }
1214    };
1215    if (json.has("_aggregation")) {
1216      JsonArray array = getJArray(json, "_aggregation");
1217      for (int i = 0; i < array.size(); i++) {
1218        if (i == res.getAggregation().size())
1219          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1220        if (array.get(i) instanceof JsonObject) 
1221          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1222      }
1223    };
1224    if (json.has("versioning"))
1225      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1226    if (json.has("_versioning"))
1227      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1228  }
1229
1230  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionExampleComponent(JsonObject json) throws IOException, FHIRFormatError {
1231    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1232    parseElementDefinitionExampleComponentProperties(json, res);
1233    return res;
1234  }
1235
1236  protected void parseElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1237    parseElementProperties(json, res);
1238    if (json.has("label"))
1239      res.setLabelElement(parseString(json.get("label").getAsString()));
1240    if (json.has("_label"))
1241      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1242    DataType value = parseType("value", json);
1243    if (value != null)
1244      res.setValue(value);
1245  }
1246
1247  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionConstraintComponent(JsonObject json) throws IOException, FHIRFormatError {
1248    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1249    parseElementDefinitionConstraintComponentProperties(json, res);
1250    return res;
1251  }
1252
1253  protected void parseElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1254    parseElementProperties(json, res);
1255    if (json.has("key"))
1256      res.setKeyElement(parseId(json.get("key").getAsString()));
1257    if (json.has("_key"))
1258      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1259    if (json.has("requirements"))
1260      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1261    if (json.has("_requirements"))
1262      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1263    if (json.has("severity"))
1264      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1265    if (json.has("_severity"))
1266      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1267    if (json.has("suppress"))
1268      res.setSuppressElement(parseBoolean(json.get("suppress").getAsBoolean()));
1269    if (json.has("_suppress"))
1270      parseElementProperties(getJObject(json, "_suppress"), res.getSuppressElement());
1271    if (json.has("human"))
1272      res.setHumanElement(parseString(json.get("human").getAsString()));
1273    if (json.has("_human"))
1274      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1275    if (json.has("expression"))
1276      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1277    if (json.has("_expression"))
1278      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1279    if (json.has("source"))
1280      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1281    if (json.has("_source"))
1282      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1283  }
1284
1285  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
1286    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1287    parseElementDefinitionBindingComponentProperties(json, res);
1288    return res;
1289  }
1290
1291  protected void parseElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1292    parseElementProperties(json, res);
1293    if (json.has("strength"))
1294      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1295    if (json.has("_strength"))
1296      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1297    if (json.has("description"))
1298      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
1299    if (json.has("_description"))
1300      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1301    if (json.has("valueSet"))
1302      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1303    if (json.has("_valueSet"))
1304      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
1305    if (json.has("additional")) {
1306      JsonArray array = getJArray(json, "additional");
1307      for (int i = 0; i < array.size(); i++) {
1308        res.getAdditional().add(parseElementDefinitionBindingAdditionalComponent(array.get(i).getAsJsonObject()));
1309      }
1310    };
1311  }
1312
1313  protected ElementDefinition.ElementDefinitionBindingAdditionalComponent parseElementDefinitionBindingAdditionalComponent(JsonObject json) throws IOException, FHIRFormatError {
1314    ElementDefinition.ElementDefinitionBindingAdditionalComponent res = new ElementDefinition.ElementDefinitionBindingAdditionalComponent();
1315    parseElementDefinitionBindingAdditionalComponentProperties(json, res);
1316    return res;
1317  }
1318
1319  protected void parseElementDefinitionBindingAdditionalComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBindingAdditionalComponent res) throws IOException, FHIRFormatError {
1320    parseElementProperties(json, res);
1321    if (json.has("purpose"))
1322      res.setPurposeElement(parseEnumeration(json.get("purpose").getAsString(), ElementDefinition.AdditionalBindingPurposeVS.NULL, new ElementDefinition.AdditionalBindingPurposeVSEnumFactory()));
1323    if (json.has("_purpose"))
1324      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
1325    if (json.has("valueSet"))
1326      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1327    if (json.has("_valueSet"))
1328      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
1329    if (json.has("documentation"))
1330      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
1331    if (json.has("_documentation"))
1332      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1333    if (json.has("shortDoco"))
1334      res.setShortDocoElement(parseString(json.get("shortDoco").getAsString()));
1335    if (json.has("_shortDoco"))
1336      parseElementProperties(getJObject(json, "_shortDoco"), res.getShortDocoElement());
1337    if (json.has("usage")) {
1338      JsonArray array = getJArray(json, "usage");
1339      for (int i = 0; i < array.size(); i++) {
1340        res.getUsage().add(parseUsageContext(array.get(i).getAsJsonObject()));
1341      }
1342    };
1343    if (json.has("any"))
1344      res.setAnyElement(parseBoolean(json.get("any").getAsBoolean()));
1345    if (json.has("_any"))
1346      parseElementProperties(getJObject(json, "_any"), res.getAnyElement());
1347  }
1348
1349  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
1350    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1351    parseElementDefinitionMappingComponentProperties(json, res);
1352    return res;
1353  }
1354
1355  protected void parseElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1356    parseElementProperties(json, res);
1357    if (json.has("identity"))
1358      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1359    if (json.has("_identity"))
1360      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1361    if (json.has("language"))
1362      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1363    if (json.has("_language"))
1364      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1365    if (json.has("map"))
1366      res.setMapElement(parseString(json.get("map").getAsString()));
1367    if (json.has("_map"))
1368      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1369    if (json.has("comment"))
1370      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1371    if (json.has("_comment"))
1372      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1373  }
1374
1375  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1376    Expression res = new Expression();
1377    parseExpressionProperties(json, res);
1378    return res;
1379  }
1380
1381  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1382    parseDataTypeProperties(json, res);
1383    if (json.has("description"))
1384      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1385    if (json.has("_description"))
1386      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1387    if (json.has("name"))
1388      res.setNameElement(parseCode(json.get("name").getAsString()));
1389    if (json.has("_name"))
1390      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1391    if (json.has("language"))
1392      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1393    if (json.has("_language"))
1394      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1395    if (json.has("expression"))
1396      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1397    if (json.has("_expression"))
1398      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1399    if (json.has("reference"))
1400      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1401    if (json.has("_reference"))
1402      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1403  }
1404
1405  protected ExtendedContactDetail parseExtendedContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1406    ExtendedContactDetail res = new ExtendedContactDetail();
1407    parseExtendedContactDetailProperties(json, res);
1408    return res;
1409  }
1410
1411  protected void parseExtendedContactDetailProperties(JsonObject json, ExtendedContactDetail res) throws IOException, FHIRFormatError {
1412    parseDataTypeProperties(json, res);
1413    if (json.has("purpose"))
1414      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
1415    if (json.has("name")) {
1416      JsonArray array = getJArray(json, "name");
1417      for (int i = 0; i < array.size(); i++) {
1418        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
1419      }
1420    };
1421    if (json.has("telecom")) {
1422      JsonArray array = getJArray(json, "telecom");
1423      for (int i = 0; i < array.size(); i++) {
1424        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1425      }
1426    };
1427    if (json.has("address"))
1428      res.setAddress(parseAddress(getJObject(json, "address")));
1429    if (json.has("organization"))
1430      res.setOrganization(parseReference(getJObject(json, "organization")));
1431    if (json.has("period"))
1432      res.setPeriod(parsePeriod(getJObject(json, "period")));
1433  }
1434
1435  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
1436    Extension res = new Extension();
1437    parseExtensionProperties(json, res);
1438    return res;
1439  }
1440
1441  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
1442    parseDataTypeProperties(json, res);
1443    if (json.has("url"))
1444      res.setUrlElement(parseUri(json.get("url").getAsString()));
1445    if (json.has("_url"))
1446      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1447    DataType value = parseType("value", json);
1448    if (value != null)
1449      res.setValue(value);
1450  }
1451
1452  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
1453    HumanName res = new HumanName();
1454    parseHumanNameProperties(json, res);
1455    return res;
1456  }
1457
1458  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
1459    parseDataTypeProperties(json, res);
1460    if (json.has("use"))
1461      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
1462    if (json.has("_use"))
1463      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1464    if (json.has("text"))
1465      res.setTextElement(parseString(json.get("text").getAsString()));
1466    if (json.has("_text"))
1467      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1468    if (json.has("family"))
1469      res.setFamilyElement(parseString(json.get("family").getAsString()));
1470    if (json.has("_family"))
1471      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
1472    if (json.has("given")) {
1473      JsonArray array = getJArray(json, "given");
1474      for (int i = 0; i < array.size(); i++) {
1475        if (array.get(i).isJsonNull()) {
1476          res.getGiven().add(new StringType());
1477        } else {;
1478          res.getGiven().add(parseString(array.get(i).getAsString()));
1479        }
1480      }
1481    };
1482    if (json.has("_given")) {
1483      JsonArray array = getJArray(json, "_given");
1484      for (int i = 0; i < array.size(); i++) {
1485        if (i == res.getGiven().size())
1486          res.getGiven().add(parseString(null));
1487        if (array.get(i) instanceof JsonObject) 
1488          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1489      }
1490    };
1491    if (json.has("prefix")) {
1492      JsonArray array = getJArray(json, "prefix");
1493      for (int i = 0; i < array.size(); i++) {
1494        if (array.get(i).isJsonNull()) {
1495          res.getPrefix().add(new StringType());
1496        } else {;
1497          res.getPrefix().add(parseString(array.get(i).getAsString()));
1498        }
1499      }
1500    };
1501    if (json.has("_prefix")) {
1502      JsonArray array = getJArray(json, "_prefix");
1503      for (int i = 0; i < array.size(); i++) {
1504        if (i == res.getPrefix().size())
1505          res.getPrefix().add(parseString(null));
1506        if (array.get(i) instanceof JsonObject) 
1507          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1508      }
1509    };
1510    if (json.has("suffix")) {
1511      JsonArray array = getJArray(json, "suffix");
1512      for (int i = 0; i < array.size(); i++) {
1513        if (array.get(i).isJsonNull()) {
1514          res.getSuffix().add(new StringType());
1515        } else {;
1516          res.getSuffix().add(parseString(array.get(i).getAsString()));
1517        }
1518      }
1519    };
1520    if (json.has("_suffix")) {
1521      JsonArray array = getJArray(json, "_suffix");
1522      for (int i = 0; i < array.size(); i++) {
1523        if (i == res.getSuffix().size())
1524          res.getSuffix().add(parseString(null));
1525        if (array.get(i) instanceof JsonObject) 
1526          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1527      }
1528    };
1529    if (json.has("period"))
1530      res.setPeriod(parsePeriod(getJObject(json, "period")));
1531  }
1532
1533  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
1534    Identifier res = new Identifier();
1535    parseIdentifierProperties(json, res);
1536    return res;
1537  }
1538
1539  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
1540    parseDataTypeProperties(json, res);
1541    if (json.has("use"))
1542      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
1543    if (json.has("_use"))
1544      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1545    if (json.has("type"))
1546      res.setType(parseCodeableConcept(getJObject(json, "type")));
1547    if (json.has("system"))
1548      res.setSystemElement(parseUri(json.get("system").getAsString()));
1549    if (json.has("_system"))
1550      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1551    if (json.has("value"))
1552      res.setValueElement(parseString(json.get("value").getAsString()));
1553    if (json.has("_value"))
1554      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1555    if (json.has("period"))
1556      res.setPeriod(parsePeriod(getJObject(json, "period")));
1557    if (json.has("assigner"))
1558      res.setAssigner(parseReference(getJObject(json, "assigner")));
1559  }
1560
1561  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
1562    MarketingStatus res = new MarketingStatus();
1563    parseMarketingStatusProperties(json, res);
1564    return res;
1565  }
1566
1567  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
1568    parseBackboneTypeProperties(json, res);
1569    if (json.has("country"))
1570      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
1571    if (json.has("jurisdiction"))
1572      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
1573    if (json.has("status"))
1574      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
1575    if (json.has("dateRange"))
1576      res.setDateRange(parsePeriod(getJObject(json, "dateRange")));
1577    if (json.has("restoreDate"))
1578      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
1579    if (json.has("_restoreDate"))
1580      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
1581  }
1582
1583  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
1584    Meta res = new Meta();
1585    parseMetaProperties(json, res);
1586    return res;
1587  }
1588
1589  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
1590    parseDataTypeProperties(json, res);
1591    if (json.has("versionId"))
1592      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
1593    if (json.has("_versionId"))
1594      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
1595    if (json.has("lastUpdated"))
1596      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
1597    if (json.has("_lastUpdated"))
1598      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
1599    if (json.has("source"))
1600      res.setSourceElement(parseUri(json.get("source").getAsString()));
1601    if (json.has("_source"))
1602      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1603    if (json.has("profile")) {
1604      JsonArray array = getJArray(json, "profile");
1605      for (int i = 0; i < array.size(); i++) {
1606        if (array.get(i).isJsonNull()) {
1607          res.getProfile().add(new CanonicalType());
1608        } else {;
1609          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1610        }
1611      }
1612    };
1613    if (json.has("_profile")) {
1614      JsonArray array = getJArray(json, "_profile");
1615      for (int i = 0; i < array.size(); i++) {
1616        if (i == res.getProfile().size())
1617          res.getProfile().add(parseCanonical(null));
1618        if (array.get(i) instanceof JsonObject) 
1619          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1620      }
1621    };
1622    if (json.has("security")) {
1623      JsonArray array = getJArray(json, "security");
1624      for (int i = 0; i < array.size(); i++) {
1625        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
1626      }
1627    };
1628    if (json.has("tag")) {
1629      JsonArray array = getJArray(json, "tag");
1630      for (int i = 0; i < array.size(); i++) {
1631        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
1632      }
1633    };
1634  }
1635
1636  protected MonetaryComponent parseMonetaryComponent(JsonObject json) throws IOException, FHIRFormatError {
1637    MonetaryComponent res = new MonetaryComponent();
1638    parseMonetaryComponentProperties(json, res);
1639    return res;
1640  }
1641
1642  protected void parseMonetaryComponentProperties(JsonObject json, MonetaryComponent res) throws IOException, FHIRFormatError {
1643    parseDataTypeProperties(json, res);
1644    if (json.has("type"))
1645      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MonetaryComponent.PriceComponentType.NULL, new MonetaryComponent.PriceComponentTypeEnumFactory()));
1646    if (json.has("_type"))
1647      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1648    if (json.has("code"))
1649      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1650    if (json.has("factor"))
1651      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1652    if (json.has("_factor"))
1653      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
1654    if (json.has("amount"))
1655      res.setAmount(parseMoney(getJObject(json, "amount")));
1656  }
1657
1658  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
1659    Money res = new Money();
1660    parseMoneyProperties(json, res);
1661    return res;
1662  }
1663
1664  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
1665    parseDataTypeProperties(json, res);
1666    if (json.has("value"))
1667      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1668    if (json.has("_value"))
1669      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1670    if (json.has("currency"))
1671      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
1672    if (json.has("_currency"))
1673      parseElementProperties(getJObject(json, "_currency"), res.getCurrencyElement());
1674  }
1675
1676  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
1677    Narrative res = new Narrative();
1678    parseNarrativeProperties(json, res);
1679    return res;
1680  }
1681
1682  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
1683    parseDataTypeProperties(json, res);
1684    if (json.has("status"))
1685      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
1686    if (json.has("_status"))
1687      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1688    if (json.has("div"))
1689      res.setDiv(parseXhtml(json.get("div").getAsString()));
1690  }
1691
1692  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1693    ParameterDefinition res = new ParameterDefinition();
1694    parseParameterDefinitionProperties(json, res);
1695    return res;
1696  }
1697
1698  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1699    parseDataTypeProperties(json, res);
1700    if (json.has("name"))
1701      res.setNameElement(parseCode(json.get("name").getAsString()));
1702    if (json.has("_name"))
1703      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1704    if (json.has("use"))
1705      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
1706    if (json.has("_use"))
1707      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1708    if (json.has("min"))
1709      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1710    if (json.has("_min"))
1711      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1712    if (json.has("max"))
1713      res.setMaxElement(parseString(json.get("max").getAsString()));
1714    if (json.has("_max"))
1715      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1716    if (json.has("documentation"))
1717      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1718    if (json.has("_documentation"))
1719      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1720    if (json.has("type"))
1721      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
1722    if (json.has("_type"))
1723      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1724    if (json.has("profile"))
1725      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1726    if (json.has("_profile"))
1727      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1728  }
1729
1730  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1731    Period res = new Period();
1732    parsePeriodProperties(json, res);
1733    return res;
1734  }
1735
1736  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1737    parseDataTypeProperties(json, res);
1738    if (json.has("start"))
1739      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1740    if (json.has("_start"))
1741      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
1742    if (json.has("end"))
1743      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1744    if (json.has("_end"))
1745      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
1746  }
1747
1748  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1749    ProductShelfLife res = new ProductShelfLife();
1750    parseProductShelfLifeProperties(json, res);
1751    return res;
1752  }
1753
1754  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1755    parseBackboneTypeProperties(json, res);
1756    if (json.has("type"))
1757      res.setType(parseCodeableConcept(getJObject(json, "type")));
1758    DataType period = parseType("period", json);
1759    if (period != null)
1760      res.setPeriod(period);
1761    if (json.has("specialPrecautionsForStorage")) {
1762      JsonArray array = getJArray(json, "specialPrecautionsForStorage");
1763      for (int i = 0; i < array.size(); i++) {
1764        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1765      }
1766    };
1767  }
1768
1769  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1770    Quantity res = new Quantity();
1771    parseQuantityProperties(json, res);
1772    return res;
1773  }
1774
1775  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1776    parseDataTypeProperties(json, res);
1777    if (json.has("value"))
1778      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1779    if (json.has("_value"))
1780      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1781    if (json.has("comparator"))
1782      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Enumerations.QuantityComparator.NULL, new Enumerations.QuantityComparatorEnumFactory()));
1783    if (json.has("_comparator"))
1784      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
1785    if (json.has("unit"))
1786      res.setUnitElement(parseString(json.get("unit").getAsString()));
1787    if (json.has("_unit"))
1788      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
1789    if (json.has("system"))
1790      res.setSystemElement(parseUri(json.get("system").getAsString()));
1791    if (json.has("_system"))
1792      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1793    if (json.has("code"))
1794      res.setCodeElement(parseCode(json.get("code").getAsString()));
1795    if (json.has("_code"))
1796      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1797  }
1798
1799  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1800    Range res = new Range();
1801    parseRangeProperties(json, res);
1802    return res;
1803  }
1804
1805  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1806    parseDataTypeProperties(json, res);
1807    if (json.has("low"))
1808      res.setLow(parseQuantity(getJObject(json, "low")));
1809    if (json.has("high"))
1810      res.setHigh(parseQuantity(getJObject(json, "high")));
1811  }
1812
1813  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
1814    Ratio res = new Ratio();
1815    parseRatioProperties(json, res);
1816    return res;
1817  }
1818
1819  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
1820    parseDataTypeProperties(json, res);
1821    if (json.has("numerator"))
1822      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
1823    if (json.has("denominator"))
1824      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1825  }
1826
1827  protected RatioRange parseRatioRange(JsonObject json) throws IOException, FHIRFormatError {
1828    RatioRange res = new RatioRange();
1829    parseRatioRangeProperties(json, res);
1830    return res;
1831  }
1832
1833  protected void parseRatioRangeProperties(JsonObject json, RatioRange res) throws IOException, FHIRFormatError {
1834    parseDataTypeProperties(json, res);
1835    if (json.has("lowNumerator"))
1836      res.setLowNumerator(parseQuantity(getJObject(json, "lowNumerator")));
1837    if (json.has("highNumerator"))
1838      res.setHighNumerator(parseQuantity(getJObject(json, "highNumerator")));
1839    if (json.has("denominator"))
1840      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1841  }
1842
1843  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
1844    Reference res = new Reference();
1845    parseReferenceProperties(json, res);
1846    return res;
1847  }
1848
1849  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
1850    parseDataTypeProperties(json, res);
1851    if (json.has("reference"))
1852      res.setReferenceElement(parseString(json.get("reference").getAsString()));
1853    if (json.has("_reference"))
1854      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1855    if (json.has("type"))
1856      res.setTypeElement(parseUri(json.get("type").getAsString()));
1857    if (json.has("_type"))
1858      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1859    if (json.has("identifier"))
1860      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1861    if (json.has("display"))
1862      res.setDisplayElement(parseString(json.get("display").getAsString()));
1863    if (json.has("_display"))
1864      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1865  }
1866
1867  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1868    RelatedArtifact res = new RelatedArtifact();
1869    parseRelatedArtifactProperties(json, res);
1870    return res;
1871  }
1872
1873  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1874    parseDataTypeProperties(json, res);
1875    if (json.has("type"))
1876      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1877    if (json.has("_type"))
1878      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1879    if (json.has("classifier")) {
1880      JsonArray array = getJArray(json, "classifier");
1881      for (int i = 0; i < array.size(); i++) {
1882        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1883      }
1884    };
1885    if (json.has("label"))
1886      res.setLabelElement(parseString(json.get("label").getAsString()));
1887    if (json.has("_label"))
1888      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1889    if (json.has("display"))
1890      res.setDisplayElement(parseString(json.get("display").getAsString()));
1891    if (json.has("_display"))
1892      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1893    if (json.has("citation"))
1894      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1895    if (json.has("_citation"))
1896      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
1897    if (json.has("document"))
1898      res.setDocument(parseAttachment(getJObject(json, "document")));
1899    if (json.has("resource"))
1900      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1901    if (json.has("_resource"))
1902      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
1903    if (json.has("resourceReference"))
1904      res.setResourceReference(parseReference(getJObject(json, "resourceReference")));
1905    if (json.has("publicationStatus"))
1906      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
1907    if (json.has("_publicationStatus"))
1908      parseElementProperties(getJObject(json, "_publicationStatus"), res.getPublicationStatusElement());
1909    if (json.has("publicationDate"))
1910      res.setPublicationDateElement(parseDate(json.get("publicationDate").getAsString()));
1911    if (json.has("_publicationDate"))
1912      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
1913  }
1914
1915  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
1916    SampledData res = new SampledData();
1917    parseSampledDataProperties(json, res);
1918    return res;
1919  }
1920
1921  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
1922    parseDataTypeProperties(json, res);
1923    if (json.has("origin"))
1924      res.setOrigin(parseQuantity(getJObject(json, "origin")));
1925    if (json.has("interval"))
1926      res.setIntervalElement(parseDecimal(json.get("interval").getAsBigDecimal()));
1927    if (json.has("_interval"))
1928      parseElementProperties(getJObject(json, "_interval"), res.getIntervalElement());
1929    if (json.has("intervalUnit"))
1930      res.setIntervalUnitElement(parseCode(json.get("intervalUnit").getAsString()));
1931    if (json.has("_intervalUnit"))
1932      parseElementProperties(getJObject(json, "_intervalUnit"), res.getIntervalUnitElement());
1933    if (json.has("factor"))
1934      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1935    if (json.has("_factor"))
1936      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
1937    if (json.has("lowerLimit"))
1938      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
1939    if (json.has("_lowerLimit"))
1940      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
1941    if (json.has("upperLimit"))
1942      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
1943    if (json.has("_upperLimit"))
1944      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
1945    if (json.has("dimensions"))
1946      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
1947    if (json.has("_dimensions"))
1948      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
1949    if (json.has("codeMap"))
1950      res.setCodeMapElement(parseCanonical(json.get("codeMap").getAsString()));
1951    if (json.has("_codeMap"))
1952      parseElementProperties(getJObject(json, "_codeMap"), res.getCodeMapElement());
1953    if (json.has("offsets"))
1954      res.setOffsetsElement(parseString(json.get("offsets").getAsString()));
1955    if (json.has("_offsets"))
1956      parseElementProperties(getJObject(json, "_offsets"), res.getOffsetsElement());
1957    if (json.has("data"))
1958      res.setDataElement(parseString(json.get("data").getAsString()));
1959    if (json.has("_data"))
1960      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1961  }
1962
1963  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1964    Signature res = new Signature();
1965    parseSignatureProperties(json, res);
1966    return res;
1967  }
1968
1969  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1970    parseDataTypeProperties(json, res);
1971    if (json.has("type")) {
1972      JsonArray array = getJArray(json, "type");
1973      for (int i = 0; i < array.size(); i++) {
1974        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1975      }
1976    };
1977    if (json.has("when"))
1978      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1979    if (json.has("_when"))
1980      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
1981    if (json.has("who"))
1982      res.setWho(parseReference(getJObject(json, "who")));
1983    if (json.has("onBehalfOf"))
1984      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
1985    if (json.has("targetFormat"))
1986      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1987    if (json.has("_targetFormat"))
1988      parseElementProperties(getJObject(json, "_targetFormat"), res.getTargetFormatElement());
1989    if (json.has("sigFormat"))
1990      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1991    if (json.has("_sigFormat"))
1992      parseElementProperties(getJObject(json, "_sigFormat"), res.getSigFormatElement());
1993    if (json.has("data"))
1994      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1995    if (json.has("_data"))
1996      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1997  }
1998
1999  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
2000    Timing res = new Timing();
2001    parseTimingProperties(json, res);
2002    return res;
2003  }
2004
2005  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
2006    parseBackboneTypeProperties(json, res);
2007    if (json.has("event")) {
2008      JsonArray array = getJArray(json, "event");
2009      for (int i = 0; i < array.size(); i++) {
2010        if (array.get(i).isJsonNull()) {
2011          res.getEvent().add(new DateTimeType());
2012        } else {;
2013          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
2014        }
2015      }
2016    };
2017    if (json.has("_event")) {
2018      JsonArray array = getJArray(json, "_event");
2019      for (int i = 0; i < array.size(); i++) {
2020        if (i == res.getEvent().size())
2021          res.getEvent().add(parseDateTime(null));
2022        if (array.get(i) instanceof JsonObject) 
2023          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
2024      }
2025    };
2026    if (json.has("repeat"))
2027      res.setRepeat(parseTimingRepeatComponent(getJObject(json, "repeat")));
2028    if (json.has("code"))
2029      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2030  }
2031
2032  protected Timing.TimingRepeatComponent parseTimingRepeatComponent(JsonObject json) throws IOException, FHIRFormatError {
2033    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
2034    parseTimingRepeatComponentProperties(json, res);
2035    return res;
2036  }
2037
2038  protected void parseTimingRepeatComponentProperties(JsonObject json, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
2039    parseElementProperties(json, res);
2040    DataType bounds = parseType("bounds", json);
2041    if (bounds != null)
2042      res.setBounds(bounds);
2043    if (json.has("count"))
2044      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
2045    if (json.has("_count"))
2046      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
2047    if (json.has("countMax"))
2048      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
2049    if (json.has("_countMax"))
2050      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
2051    if (json.has("duration"))
2052      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
2053    if (json.has("_duration"))
2054      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
2055    if (json.has("durationMax"))
2056      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
2057    if (json.has("_durationMax"))
2058      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
2059    if (json.has("durationUnit"))
2060      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2061    if (json.has("_durationUnit"))
2062      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
2063    if (json.has("frequency"))
2064      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
2065    if (json.has("_frequency"))
2066      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
2067    if (json.has("frequencyMax"))
2068      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
2069    if (json.has("_frequencyMax"))
2070      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
2071    if (json.has("period"))
2072      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
2073    if (json.has("_period"))
2074      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
2075    if (json.has("periodMax"))
2076      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
2077    if (json.has("_periodMax"))
2078      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
2079    if (json.has("periodUnit"))
2080      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2081    if (json.has("_periodUnit"))
2082      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
2083    if (json.has("dayOfWeek")) {
2084      JsonArray array = getJArray(json, "dayOfWeek");
2085      for (int i = 0; i < array.size(); i++) {
2086        if (array.get(i).isJsonNull()) {
2087          res.getDayOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
2088        } else {;
2089          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
2090        }
2091      }
2092    };
2093    if (json.has("_dayOfWeek")) {
2094      JsonArray array = getJArray(json, "_dayOfWeek");
2095      for (int i = 0; i < array.size(); i++) {
2096        if (i == res.getDayOfWeek().size())
2097          res.getDayOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
2098        if (array.get(i) instanceof JsonObject) 
2099          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
2100      }
2101    };
2102    if (json.has("timeOfDay")) {
2103      JsonArray array = getJArray(json, "timeOfDay");
2104      for (int i = 0; i < array.size(); i++) {
2105        if (array.get(i).isJsonNull()) {
2106          res.getTimeOfDay().add(new TimeType());
2107        } else {;
2108          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
2109        }
2110      }
2111    };
2112    if (json.has("_timeOfDay")) {
2113      JsonArray array = getJArray(json, "_timeOfDay");
2114      for (int i = 0; i < array.size(); i++) {
2115        if (i == res.getTimeOfDay().size())
2116          res.getTimeOfDay().add(parseTime(null));
2117        if (array.get(i) instanceof JsonObject) 
2118          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
2119      }
2120    };
2121    if (json.has("when")) {
2122      JsonArray array = getJArray(json, "when");
2123      for (int i = 0; i < array.size(); i++) {
2124        if (array.get(i).isJsonNull()) {
2125          res.getWhen().add(new Enumeration<Timing.EventTiming>(new Timing.EventTimingEnumFactory(), Timing.EventTiming.NULL));
2126        } else {;
2127          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
2128        }
2129      }
2130    };
2131    if (json.has("_when")) {
2132      JsonArray array = getJArray(json, "_when");
2133      for (int i = 0; i < array.size(); i++) {
2134        if (i == res.getWhen().size())
2135          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
2136        if (array.get(i) instanceof JsonObject) 
2137          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
2138      }
2139    };
2140    if (json.has("offset"))
2141      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
2142    if (json.has("_offset"))
2143      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
2144  }
2145
2146  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
2147    TriggerDefinition res = new TriggerDefinition();
2148    parseTriggerDefinitionProperties(json, res);
2149    return res;
2150  }
2151
2152  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
2153    parseDataTypeProperties(json, res);
2154    if (json.has("type"))
2155      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
2156    if (json.has("_type"))
2157      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2158    if (json.has("name"))
2159      res.setNameElement(parseString(json.get("name").getAsString()));
2160    if (json.has("_name"))
2161      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2162    if (json.has("code"))
2163      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2164    if (json.has("subscriptionTopic"))
2165      res.setSubscriptionTopicElement(parseCanonical(json.get("subscriptionTopic").getAsString()));
2166    if (json.has("_subscriptionTopic"))
2167      parseElementProperties(getJObject(json, "_subscriptionTopic"), res.getSubscriptionTopicElement());
2168    DataType timing = parseType("timing", json);
2169    if (timing != null)
2170      res.setTiming(timing);
2171    if (json.has("data")) {
2172      JsonArray array = getJArray(json, "data");
2173      for (int i = 0; i < array.size(); i++) {
2174        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
2175      }
2176    };
2177    if (json.has("condition"))
2178      res.setCondition(parseExpression(getJObject(json, "condition")));
2179  }
2180
2181  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
2182    UsageContext res = new UsageContext();
2183    parseUsageContextProperties(json, res);
2184    return res;
2185  }
2186
2187  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
2188    parseDataTypeProperties(json, res);
2189    if (json.has("code"))
2190      res.setCode(parseCoding(getJObject(json, "code")));
2191    DataType value = parseType("value", json);
2192    if (value != null)
2193      res.setValue(value);
2194  }
2195
2196  protected VirtualServiceDetail parseVirtualServiceDetail(JsonObject json) throws IOException, FHIRFormatError {
2197    VirtualServiceDetail res = new VirtualServiceDetail();
2198    parseVirtualServiceDetailProperties(json, res);
2199    return res;
2200  }
2201
2202  protected void parseVirtualServiceDetailProperties(JsonObject json, VirtualServiceDetail res) throws IOException, FHIRFormatError {
2203    parseDataTypeProperties(json, res);
2204    if (json.has("channelType"))
2205      res.setChannelType(parseCoding(getJObject(json, "channelType")));
2206    DataType address = parseType("address", json);
2207    if (address != null)
2208      res.setAddress(address);
2209    if (json.has("additionalInfo")) {
2210      JsonArray array = getJArray(json, "additionalInfo");
2211      for (int i = 0; i < array.size(); i++) {
2212        if (array.get(i).isJsonNull()) {
2213          res.getAdditionalInfo().add(new UrlType());
2214        } else {;
2215          res.getAdditionalInfo().add(parseUrl(array.get(i).getAsString()));
2216        }
2217      }
2218    };
2219    if (json.has("_additionalInfo")) {
2220      JsonArray array = getJArray(json, "_additionalInfo");
2221      for (int i = 0; i < array.size(); i++) {
2222        if (i == res.getAdditionalInfo().size())
2223          res.getAdditionalInfo().add(parseUrl(null));
2224        if (array.get(i) instanceof JsonObject) 
2225          parseElementProperties(array.get(i).getAsJsonObject(), res.getAdditionalInfo().get(i));
2226      }
2227    };
2228    if (json.has("maxParticipants"))
2229      res.setMaxParticipantsElement(parsePositiveInt(json.get("maxParticipants").getAsString()));
2230    if (json.has("_maxParticipants"))
2231      parseElementProperties(getJObject(json, "_maxParticipants"), res.getMaxParticipantsElement());
2232    if (json.has("sessionKey"))
2233      res.setSessionKeyElement(parseString(json.get("sessionKey").getAsString()));
2234    if (json.has("_sessionKey"))
2235      parseElementProperties(getJObject(json, "_sessionKey"), res.getSessionKeyElement());
2236  }
2237
2238  protected void parseCanonicalResourceProperties(JsonObject json, CanonicalResource res) throws IOException, FHIRFormatError {
2239    parseDomainResourceProperties(json, res);
2240  }
2241
2242  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
2243    parseResourceProperties(json, res);
2244    if (json.has("text"))
2245      res.setText(parseNarrative(getJObject(json, "text")));
2246    if (json.has("contained")) {
2247      JsonArray array = getJArray(json, "contained");
2248      for (int i = 0; i < array.size(); i++) {
2249        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
2250      }
2251    };
2252    if (json.has("extension")) {
2253      JsonArray array = getJArray(json, "extension");
2254      for (int i = 0; i < array.size(); i++) {
2255        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2256      }
2257    };
2258    if (json.has("modifierExtension")) {
2259      JsonArray array = getJArray(json, "modifierExtension");
2260      for (int i = 0; i < array.size(); i++) {
2261        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2262      }
2263    };
2264  }
2265
2266  protected void parseMetadataResourceProperties(JsonObject json, MetadataResource res) throws IOException, FHIRFormatError {
2267    parseCanonicalResourceProperties(json, res);
2268  }
2269
2270  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
2271    parseBaseProperties(json, res);
2272    if (json.has("id"))
2273      res.setIdElement(parseId(json.get("id").getAsString()));
2274    if (json.has("_id"))
2275      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
2276    if (json.has("meta"))
2277      res.setMeta(parseMeta(getJObject(json, "meta")));
2278    if (json.has("implicitRules"))
2279      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2280    if (json.has("_implicitRules"))
2281      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
2282    if (json.has("language"))
2283      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2284    if (json.has("_language"))
2285      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2286  }
2287
2288  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2289    Account res = new Account();
2290    parseAccountProperties(json, res);
2291    return res;
2292  }
2293
2294  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2295    parseDomainResourceProperties(json, res);
2296    if (json.has("identifier")) {
2297      JsonArray array = getJArray(json, "identifier");
2298      for (int i = 0; i < array.size(); i++) {
2299        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2300      }
2301    };
2302    if (json.has("status"))
2303      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2304    if (json.has("_status"))
2305      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2306    if (json.has("billingStatus"))
2307      res.setBillingStatus(parseCodeableConcept(getJObject(json, "billingStatus")));
2308    if (json.has("type"))
2309      res.setType(parseCodeableConcept(getJObject(json, "type")));
2310    if (json.has("name"))
2311      res.setNameElement(parseString(json.get("name").getAsString()));
2312    if (json.has("_name"))
2313      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2314    if (json.has("subject")) {
2315      JsonArray array = getJArray(json, "subject");
2316      for (int i = 0; i < array.size(); i++) {
2317        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2318      }
2319    };
2320    if (json.has("servicePeriod"))
2321      res.setServicePeriod(parsePeriod(getJObject(json, "servicePeriod")));
2322    if (json.has("coverage")) {
2323      JsonArray array = getJArray(json, "coverage");
2324      for (int i = 0; i < array.size(); i++) {
2325        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject()));
2326      }
2327    };
2328    if (json.has("owner"))
2329      res.setOwner(parseReference(getJObject(json, "owner")));
2330    if (json.has("description"))
2331      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2332    if (json.has("_description"))
2333      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2334    if (json.has("guarantor")) {
2335      JsonArray array = getJArray(json, "guarantor");
2336      for (int i = 0; i < array.size(); i++) {
2337        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject()));
2338      }
2339    };
2340    if (json.has("diagnosis")) {
2341      JsonArray array = getJArray(json, "diagnosis");
2342      for (int i = 0; i < array.size(); i++) {
2343        res.getDiagnosis().add(parseAccountDiagnosisComponent(array.get(i).getAsJsonObject()));
2344      }
2345    };
2346    if (json.has("procedure")) {
2347      JsonArray array = getJArray(json, "procedure");
2348      for (int i = 0; i < array.size(); i++) {
2349        res.getProcedure().add(parseAccountProcedureComponent(array.get(i).getAsJsonObject()));
2350      }
2351    };
2352    if (json.has("relatedAccount")) {
2353      JsonArray array = getJArray(json, "relatedAccount");
2354      for (int i = 0; i < array.size(); i++) {
2355        res.getRelatedAccount().add(parseAccountRelatedAccountComponent(array.get(i).getAsJsonObject()));
2356      }
2357    };
2358    if (json.has("currency"))
2359      res.setCurrency(parseCodeableConcept(getJObject(json, "currency")));
2360    if (json.has("balance")) {
2361      JsonArray array = getJArray(json, "balance");
2362      for (int i = 0; i < array.size(); i++) {
2363        res.getBalance().add(parseAccountBalanceComponent(array.get(i).getAsJsonObject()));
2364      }
2365    };
2366    if (json.has("calculatedAt"))
2367      res.setCalculatedAtElement(parseInstant(json.get("calculatedAt").getAsString()));
2368    if (json.has("_calculatedAt"))
2369      parseElementProperties(getJObject(json, "_calculatedAt"), res.getCalculatedAtElement());
2370  }
2371
2372  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
2373    Account.CoverageComponent res = new Account.CoverageComponent();
2374    parseAccountCoverageComponentProperties(json, res);
2375    return res;
2376  }
2377
2378  protected void parseAccountCoverageComponentProperties(JsonObject json, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2379    parseBackboneElementProperties(json, res);
2380    if (json.has("coverage"))
2381      res.setCoverage(parseReference(getJObject(json, "coverage")));
2382    if (json.has("priority"))
2383      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2384    if (json.has("_priority"))
2385      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2386  }
2387
2388  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json) throws IOException, FHIRFormatError {
2389    Account.GuarantorComponent res = new Account.GuarantorComponent();
2390    parseAccountGuarantorComponentProperties(json, res);
2391    return res;
2392  }
2393
2394  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2395    parseBackboneElementProperties(json, res);
2396    if (json.has("party"))
2397      res.setParty(parseReference(getJObject(json, "party")));
2398    if (json.has("onHold"))
2399      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2400    if (json.has("_onHold"))
2401      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
2402    if (json.has("period"))
2403      res.setPeriod(parsePeriod(getJObject(json, "period")));
2404  }
2405
2406  protected Account.AccountDiagnosisComponent parseAccountDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
2407    Account.AccountDiagnosisComponent res = new Account.AccountDiagnosisComponent();
2408    parseAccountDiagnosisComponentProperties(json, res);
2409    return res;
2410  }
2411
2412  protected void parseAccountDiagnosisComponentProperties(JsonObject json, Account.AccountDiagnosisComponent res) throws IOException, FHIRFormatError {
2413    parseBackboneElementProperties(json, res);
2414    if (json.has("sequence"))
2415      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2416    if (json.has("_sequence"))
2417      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
2418    if (json.has("condition"))
2419      res.setCondition(parseCodeableReference(getJObject(json, "condition")));
2420    if (json.has("dateOfDiagnosis"))
2421      res.setDateOfDiagnosisElement(parseDateTime(json.get("dateOfDiagnosis").getAsString()));
2422    if (json.has("_dateOfDiagnosis"))
2423      parseElementProperties(getJObject(json, "_dateOfDiagnosis"), res.getDateOfDiagnosisElement());
2424    if (json.has("type")) {
2425      JsonArray array = getJArray(json, "type");
2426      for (int i = 0; i < array.size(); i++) {
2427        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2428      }
2429    };
2430    if (json.has("onAdmission"))
2431      res.setOnAdmissionElement(parseBoolean(json.get("onAdmission").getAsBoolean()));
2432    if (json.has("_onAdmission"))
2433      parseElementProperties(getJObject(json, "_onAdmission"), res.getOnAdmissionElement());
2434    if (json.has("packageCode")) {
2435      JsonArray array = getJArray(json, "packageCode");
2436      for (int i = 0; i < array.size(); i++) {
2437        res.getPackageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2438      }
2439    };
2440  }
2441
2442  protected Account.AccountProcedureComponent parseAccountProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
2443    Account.AccountProcedureComponent res = new Account.AccountProcedureComponent();
2444    parseAccountProcedureComponentProperties(json, res);
2445    return res;
2446  }
2447
2448  protected void parseAccountProcedureComponentProperties(JsonObject json, Account.AccountProcedureComponent res) throws IOException, FHIRFormatError {
2449    parseBackboneElementProperties(json, res);
2450    if (json.has("sequence"))
2451      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
2452    if (json.has("_sequence"))
2453      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
2454    if (json.has("code"))
2455      res.setCode(parseCodeableReference(getJObject(json, "code")));
2456    if (json.has("dateOfService"))
2457      res.setDateOfServiceElement(parseDateTime(json.get("dateOfService").getAsString()));
2458    if (json.has("_dateOfService"))
2459      parseElementProperties(getJObject(json, "_dateOfService"), res.getDateOfServiceElement());
2460    if (json.has("type")) {
2461      JsonArray array = getJArray(json, "type");
2462      for (int i = 0; i < array.size(); i++) {
2463        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2464      }
2465    };
2466    if (json.has("packageCode")) {
2467      JsonArray array = getJArray(json, "packageCode");
2468      for (int i = 0; i < array.size(); i++) {
2469        res.getPackageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2470      }
2471    };
2472    if (json.has("device")) {
2473      JsonArray array = getJArray(json, "device");
2474      for (int i = 0; i < array.size(); i++) {
2475        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
2476      }
2477    };
2478  }
2479
2480  protected Account.AccountRelatedAccountComponent parseAccountRelatedAccountComponent(JsonObject json) throws IOException, FHIRFormatError {
2481    Account.AccountRelatedAccountComponent res = new Account.AccountRelatedAccountComponent();
2482    parseAccountRelatedAccountComponentProperties(json, res);
2483    return res;
2484  }
2485
2486  protected void parseAccountRelatedAccountComponentProperties(JsonObject json, Account.AccountRelatedAccountComponent res) throws IOException, FHIRFormatError {
2487    parseBackboneElementProperties(json, res);
2488    if (json.has("relationship"))
2489      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
2490    if (json.has("account"))
2491      res.setAccount(parseReference(getJObject(json, "account")));
2492  }
2493
2494  protected Account.AccountBalanceComponent parseAccountBalanceComponent(JsonObject json) throws IOException, FHIRFormatError {
2495    Account.AccountBalanceComponent res = new Account.AccountBalanceComponent();
2496    parseAccountBalanceComponentProperties(json, res);
2497    return res;
2498  }
2499
2500  protected void parseAccountBalanceComponentProperties(JsonObject json, Account.AccountBalanceComponent res) throws IOException, FHIRFormatError {
2501    parseBackboneElementProperties(json, res);
2502    if (json.has("aggregate"))
2503      res.setAggregate(parseCodeableConcept(getJObject(json, "aggregate")));
2504    if (json.has("term"))
2505      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
2506    if (json.has("estimate"))
2507      res.setEstimateElement(parseBoolean(json.get("estimate").getAsBoolean()));
2508    if (json.has("_estimate"))
2509      parseElementProperties(getJObject(json, "_estimate"), res.getEstimateElement());
2510    if (json.has("amount"))
2511      res.setAmount(parseMoney(getJObject(json, "amount")));
2512  }
2513
2514  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2515    ActivityDefinition res = new ActivityDefinition();
2516    parseActivityDefinitionProperties(json, res);
2517    return res;
2518  }
2519
2520  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2521    parseMetadataResourceProperties(json, res);
2522    if (json.has("url"))
2523      res.setUrlElement(parseUri(json.get("url").getAsString()));
2524    if (json.has("_url"))
2525      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2526    if (json.has("identifier")) {
2527      JsonArray array = getJArray(json, "identifier");
2528      for (int i = 0; i < array.size(); i++) {
2529        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2530      }
2531    };
2532    if (json.has("version"))
2533      res.setVersionElement(parseString(json.get("version").getAsString()));
2534    if (json.has("_version"))
2535      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2536    DataType versionAlgorithm = parseType("versionAlgorithm", json);
2537    if (versionAlgorithm != null)
2538      res.setVersionAlgorithm(versionAlgorithm);
2539    if (json.has("name"))
2540      res.setNameElement(parseString(json.get("name").getAsString()));
2541    if (json.has("_name"))
2542      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2543    if (json.has("title"))
2544      res.setTitleElement(parseString(json.get("title").getAsString()));
2545    if (json.has("_title"))
2546      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2547    if (json.has("subtitle"))
2548      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2549    if (json.has("_subtitle"))
2550      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
2551    if (json.has("status"))
2552      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2553    if (json.has("_status"))
2554      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2555    if (json.has("experimental"))
2556      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2557    if (json.has("_experimental"))
2558      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2559    DataType subject = parseType("subject", json);
2560    if (subject != null)
2561      res.setSubject(subject);
2562    if (json.has("date"))
2563      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2564    if (json.has("_date"))
2565      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2566    if (json.has("publisher"))
2567      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2568    if (json.has("_publisher"))
2569      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2570    if (json.has("contact")) {
2571      JsonArray array = getJArray(json, "contact");
2572      for (int i = 0; i < array.size(); i++) {
2573        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2574      }
2575    };
2576    if (json.has("description"))
2577      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2578    if (json.has("_description"))
2579      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2580    if (json.has("useContext")) {
2581      JsonArray array = getJArray(json, "useContext");
2582      for (int i = 0; i < array.size(); i++) {
2583        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2584      }
2585    };
2586    if (json.has("jurisdiction")) {
2587      JsonArray array = getJArray(json, "jurisdiction");
2588      for (int i = 0; i < array.size(); i++) {
2589        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2590      }
2591    };
2592    if (json.has("purpose"))
2593      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2594    if (json.has("_purpose"))
2595      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2596    if (json.has("usage"))
2597      res.setUsageElement(parseMarkdown(json.get("usage").getAsString()));
2598    if (json.has("_usage"))
2599      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
2600    if (json.has("copyright"))
2601      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2602    if (json.has("_copyright"))
2603      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2604    if (json.has("copyrightLabel"))
2605      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
2606    if (json.has("_copyrightLabel"))
2607      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
2608    if (json.has("approvalDate"))
2609      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2610    if (json.has("_approvalDate"))
2611      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
2612    if (json.has("lastReviewDate"))
2613      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2614    if (json.has("_lastReviewDate"))
2615      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
2616    if (json.has("effectivePeriod"))
2617      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
2618    if (json.has("topic")) {
2619      JsonArray array = getJArray(json, "topic");
2620      for (int i = 0; i < array.size(); i++) {
2621        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2622      }
2623    };
2624    if (json.has("author")) {
2625      JsonArray array = getJArray(json, "author");
2626      for (int i = 0; i < array.size(); i++) {
2627        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2628      }
2629    };
2630    if (json.has("editor")) {
2631      JsonArray array = getJArray(json, "editor");
2632      for (int i = 0; i < array.size(); i++) {
2633        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2634      }
2635    };
2636    if (json.has("reviewer")) {
2637      JsonArray array = getJArray(json, "reviewer");
2638      for (int i = 0; i < array.size(); i++) {
2639        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2640      }
2641    };
2642    if (json.has("endorser")) {
2643      JsonArray array = getJArray(json, "endorser");
2644      for (int i = 0; i < array.size(); i++) {
2645        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2646      }
2647    };
2648    if (json.has("relatedArtifact")) {
2649      JsonArray array = getJArray(json, "relatedArtifact");
2650      for (int i = 0; i < array.size(); i++) {
2651        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2652      }
2653    };
2654    if (json.has("library")) {
2655      JsonArray array = getJArray(json, "library");
2656      for (int i = 0; i < array.size(); i++) {
2657        if (array.get(i).isJsonNull()) {
2658          res.getLibrary().add(new CanonicalType());
2659        } else {;
2660          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2661        }
2662      }
2663    };
2664    if (json.has("_library")) {
2665      JsonArray array = getJArray(json, "_library");
2666      for (int i = 0; i < array.size(); i++) {
2667        if (i == res.getLibrary().size())
2668          res.getLibrary().add(parseCanonical(null));
2669        if (array.get(i) instanceof JsonObject) 
2670          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2671      }
2672    };
2673    if (json.has("kind"))
2674      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.RequestResourceTypes.NULL, new ActivityDefinition.RequestResourceTypesEnumFactory()));
2675    if (json.has("_kind"))
2676      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2677    if (json.has("profile"))
2678      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2679    if (json.has("_profile"))
2680      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
2681    if (json.has("code"))
2682      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2683    if (json.has("intent"))
2684      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
2685    if (json.has("_intent"))
2686      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
2687    if (json.has("priority"))
2688      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
2689    if (json.has("_priority"))
2690      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2691    if (json.has("doNotPerform"))
2692      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2693    if (json.has("_doNotPerform"))
2694      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
2695    DataType timing = parseType("timing", json);
2696    if (timing != null)
2697      res.setTiming(timing);
2698    DataType asNeeded = parseType("asNeeded", json);
2699    if (asNeeded != null)
2700      res.setAsNeeded(asNeeded);
2701    if (json.has("location"))
2702      res.setLocation(parseCodeableReference(getJObject(json, "location")));
2703    if (json.has("participant")) {
2704      JsonArray array = getJArray(json, "participant");
2705      for (int i = 0; i < array.size(); i++) {
2706        res.getParticipant().add(parseActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject()));
2707      }
2708    };
2709    DataType product = parseType("product", json);
2710    if (product != null)
2711      res.setProduct(product);
2712    if (json.has("quantity"))
2713      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
2714    if (json.has("dosage")) {
2715      JsonArray array = getJArray(json, "dosage");
2716      for (int i = 0; i < array.size(); i++) {
2717        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2718      }
2719    };
2720    if (json.has("bodySite")) {
2721      JsonArray array = getJArray(json, "bodySite");
2722      for (int i = 0; i < array.size(); i++) {
2723        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2724      }
2725    };
2726    if (json.has("specimenRequirement")) {
2727      JsonArray array = getJArray(json, "specimenRequirement");
2728      for (int i = 0; i < array.size(); i++) {
2729        if (array.get(i).isJsonNull()) {
2730          res.getSpecimenRequirement().add(new CanonicalType());
2731        } else {;
2732          res.getSpecimenRequirement().add(parseCanonical(array.get(i).getAsString()));
2733        }
2734      }
2735    };
2736    if (json.has("_specimenRequirement")) {
2737      JsonArray array = getJArray(json, "_specimenRequirement");
2738      for (int i = 0; i < array.size(); i++) {
2739        if (i == res.getSpecimenRequirement().size())
2740          res.getSpecimenRequirement().add(parseCanonical(null));
2741        if (array.get(i) instanceof JsonObject) 
2742          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecimenRequirement().get(i));
2743      }
2744    };
2745    if (json.has("observationRequirement")) {
2746      JsonArray array = getJArray(json, "observationRequirement");
2747      for (int i = 0; i < array.size(); i++) {
2748        if (array.get(i).isJsonNull()) {
2749          res.getObservationRequirement().add(new CanonicalType());
2750        } else {;
2751          res.getObservationRequirement().add(parseCanonical(array.get(i).getAsString()));
2752        }
2753      }
2754    };
2755    if (json.has("_observationRequirement")) {
2756      JsonArray array = getJArray(json, "_observationRequirement");
2757      for (int i = 0; i < array.size(); i++) {
2758        if (i == res.getObservationRequirement().size())
2759          res.getObservationRequirement().add(parseCanonical(null));
2760        if (array.get(i) instanceof JsonObject) 
2761          parseElementProperties(array.get(i).getAsJsonObject(), res.getObservationRequirement().get(i));
2762      }
2763    };
2764    if (json.has("observationResultRequirement")) {
2765      JsonArray array = getJArray(json, "observationResultRequirement");
2766      for (int i = 0; i < array.size(); i++) {
2767        if (array.get(i).isJsonNull()) {
2768          res.getObservationResultRequirement().add(new CanonicalType());
2769        } else {;
2770          res.getObservationResultRequirement().add(parseCanonical(array.get(i).getAsString()));
2771        }
2772      }
2773    };
2774    if (json.has("_observationResultRequirement")) {
2775      JsonArray array = getJArray(json, "_observationResultRequirement");
2776      for (int i = 0; i < array.size(); i++) {
2777        if (i == res.getObservationResultRequirement().size())
2778          res.getObservationResultRequirement().add(parseCanonical(null));
2779        if (array.get(i) instanceof JsonObject) 
2780          parseElementProperties(array.get(i).getAsJsonObject(), res.getObservationResultRequirement().get(i));
2781      }
2782    };
2783    if (json.has("transform"))
2784      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2785    if (json.has("_transform"))
2786      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
2787    if (json.has("dynamicValue")) {
2788      JsonArray array = getJArray(json, "dynamicValue");
2789      for (int i = 0; i < array.size(); i++) {
2790        res.getDynamicValue().add(parseActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject()));
2791      }
2792    };
2793  }
2794
2795  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2796    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2797    parseActivityDefinitionParticipantComponentProperties(json, res);
2798    return res;
2799  }
2800
2801  protected void parseActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2802    parseBackboneElementProperties(json, res);
2803    if (json.has("type"))
2804      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
2805    if (json.has("_type"))
2806      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2807    if (json.has("typeCanonical"))
2808      res.setTypeCanonicalElement(parseCanonical(json.get("typeCanonical").getAsString()));
2809    if (json.has("_typeCanonical"))
2810      parseElementProperties(getJObject(json, "_typeCanonical"), res.getTypeCanonicalElement());
2811    if (json.has("typeReference"))
2812      res.setTypeReference(parseReference(getJObject(json, "typeReference")));
2813    if (json.has("role"))
2814      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2815    if (json.has("function"))
2816      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
2817  }
2818
2819  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
2820    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2821    parseActivityDefinitionDynamicValueComponentProperties(json, res);
2822    return res;
2823  }
2824
2825  protected void parseActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2826    parseBackboneElementProperties(json, res);
2827    if (json.has("path"))
2828      res.setPathElement(parseString(json.get("path").getAsString()));
2829    if (json.has("_path"))
2830      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2831    if (json.has("expression"))
2832      res.setExpression(parseExpression(getJObject(json, "expression")));
2833  }
2834
2835  protected ActorDefinition parseActorDefinition(JsonObject json) throws IOException, FHIRFormatError {
2836    ActorDefinition res = new ActorDefinition();
2837    parseActorDefinitionProperties(json, res);
2838    return res;
2839  }
2840
2841  protected void parseActorDefinitionProperties(JsonObject json, ActorDefinition res) throws IOException, FHIRFormatError {
2842    parseCanonicalResourceProperties(json, res);
2843    if (json.has("url"))
2844      res.setUrlElement(parseUri(json.get("url").getAsString()));
2845    if (json.has("_url"))
2846      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2847    if (json.has("identifier")) {
2848      JsonArray array = getJArray(json, "identifier");
2849      for (int i = 0; i < array.size(); i++) {
2850        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2851      }
2852    };
2853    if (json.has("version"))
2854      res.setVersionElement(parseString(json.get("version").getAsString()));
2855    if (json.has("_version"))
2856      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2857    DataType versionAlgorithm = parseType("versionAlgorithm", json);
2858    if (versionAlgorithm != null)
2859      res.setVersionAlgorithm(versionAlgorithm);
2860    if (json.has("name"))
2861      res.setNameElement(parseString(json.get("name").getAsString()));
2862    if (json.has("_name"))
2863      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2864    if (json.has("title"))
2865      res.setTitleElement(parseString(json.get("title").getAsString()));
2866    if (json.has("_title"))
2867      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2868    if (json.has("status"))
2869      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2870    if (json.has("_status"))
2871      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2872    if (json.has("experimental"))
2873      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2874    if (json.has("_experimental"))
2875      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2876    if (json.has("date"))
2877      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2878    if (json.has("_date"))
2879      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2880    if (json.has("publisher"))
2881      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2882    if (json.has("_publisher"))
2883      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2884    if (json.has("contact")) {
2885      JsonArray array = getJArray(json, "contact");
2886      for (int i = 0; i < array.size(); i++) {
2887        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2888      }
2889    };
2890    if (json.has("description"))
2891      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2892    if (json.has("_description"))
2893      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2894    if (json.has("useContext")) {
2895      JsonArray array = getJArray(json, "useContext");
2896      for (int i = 0; i < array.size(); i++) {
2897        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2898      }
2899    };
2900    if (json.has("jurisdiction")) {
2901      JsonArray array = getJArray(json, "jurisdiction");
2902      for (int i = 0; i < array.size(); i++) {
2903        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2904      }
2905    };
2906    if (json.has("purpose"))
2907      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2908    if (json.has("_purpose"))
2909      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2910    if (json.has("copyright"))
2911      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2912    if (json.has("_copyright"))
2913      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2914    if (json.has("copyrightLabel"))
2915      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
2916    if (json.has("_copyrightLabel"))
2917      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
2918    if (json.has("type"))
2919      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ExampleScenarioActorType.NULL, new Enumerations.ExampleScenarioActorTypeEnumFactory()));
2920    if (json.has("_type"))
2921      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2922    if (json.has("documentation"))
2923      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
2924    if (json.has("_documentation"))
2925      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
2926    if (json.has("reference")) {
2927      JsonArray array = getJArray(json, "reference");
2928      for (int i = 0; i < array.size(); i++) {
2929        if (array.get(i).isJsonNull()) {
2930          res.getReference().add(new UrlType());
2931        } else {;
2932          res.getReference().add(parseUrl(array.get(i).getAsString()));
2933        }
2934      }
2935    };
2936    if (json.has("_reference")) {
2937      JsonArray array = getJArray(json, "_reference");
2938      for (int i = 0; i < array.size(); i++) {
2939        if (i == res.getReference().size())
2940          res.getReference().add(parseUrl(null));
2941        if (array.get(i) instanceof JsonObject) 
2942          parseElementProperties(array.get(i).getAsJsonObject(), res.getReference().get(i));
2943      }
2944    };
2945    if (json.has("capabilities"))
2946      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
2947    if (json.has("_capabilities"))
2948      parseElementProperties(getJObject(json, "_capabilities"), res.getCapabilitiesElement());
2949    if (json.has("derivedFrom")) {
2950      JsonArray array = getJArray(json, "derivedFrom");
2951      for (int i = 0; i < array.size(); i++) {
2952        if (array.get(i).isJsonNull()) {
2953          res.getDerivedFrom().add(new CanonicalType());
2954        } else {;
2955          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
2956        }
2957      }
2958    };
2959    if (json.has("_derivedFrom")) {
2960      JsonArray array = getJArray(json, "_derivedFrom");
2961      for (int i = 0; i < array.size(); i++) {
2962        if (i == res.getDerivedFrom().size())
2963          res.getDerivedFrom().add(parseCanonical(null));
2964        if (array.get(i) instanceof JsonObject) 
2965          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
2966      }
2967    };
2968  }
2969
2970  protected AdministrableProductDefinition parseAdministrableProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
2971    AdministrableProductDefinition res = new AdministrableProductDefinition();
2972    parseAdministrableProductDefinitionProperties(json, res);
2973    return res;
2974  }
2975
2976  protected void parseAdministrableProductDefinitionProperties(JsonObject json, AdministrableProductDefinition res) throws IOException, FHIRFormatError {
2977    parseDomainResourceProperties(json, res);
2978    if (json.has("identifier")) {
2979      JsonArray array = getJArray(json, "identifier");
2980      for (int i = 0; i < array.size(); i++) {
2981        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2982      }
2983    };
2984    if (json.has("status"))
2985      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2986    if (json.has("_status"))
2987      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2988    if (json.has("formOf")) {
2989      JsonArray array = getJArray(json, "formOf");
2990      for (int i = 0; i < array.size(); i++) {
2991        res.getFormOf().add(parseReference(array.get(i).getAsJsonObject()));
2992      }
2993    };
2994    if (json.has("administrableDoseForm"))
2995      res.setAdministrableDoseForm(parseCodeableConcept(getJObject(json, "administrableDoseForm")));
2996    if (json.has("unitOfPresentation"))
2997      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
2998    if (json.has("producedFrom")) {
2999      JsonArray array = getJArray(json, "producedFrom");
3000      for (int i = 0; i < array.size(); i++) {
3001        res.getProducedFrom().add(parseReference(array.get(i).getAsJsonObject()));
3002      }
3003    };
3004    if (json.has("ingredient")) {
3005      JsonArray array = getJArray(json, "ingredient");
3006      for (int i = 0; i < array.size(); i++) {
3007        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3008      }
3009    };
3010    if (json.has("device"))
3011      res.setDevice(parseReference(getJObject(json, "device")));
3012    if (json.has("description"))
3013      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3014    if (json.has("_description"))
3015      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3016    if (json.has("property")) {
3017      JsonArray array = getJArray(json, "property");
3018      for (int i = 0; i < array.size(); i++) {
3019        res.getProperty().add(parseAdministrableProductDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
3020      }
3021    };
3022    if (json.has("routeOfAdministration")) {
3023      JsonArray array = getJArray(json, "routeOfAdministration");
3024      for (int i = 0; i < array.size(); i++) {
3025        res.getRouteOfAdministration().add(parseAdministrableProductDefinitionRouteOfAdministrationComponent(array.get(i).getAsJsonObject()));
3026      }
3027    };
3028  }
3029
3030  protected AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent parseAdministrableProductDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
3031    AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent();
3032    parseAdministrableProductDefinitionPropertyComponentProperties(json, res);
3033    return res;
3034  }
3035
3036  protected void parseAdministrableProductDefinitionPropertyComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
3037    parseBackboneElementProperties(json, res);
3038    if (json.has("type"))
3039      res.setType(parseCodeableConcept(getJObject(json, "type")));
3040    DataType value = parseType("value", json);
3041    if (value != null)
3042      res.setValue(value);
3043    if (json.has("status"))
3044      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
3045  }
3046
3047  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent parseAdministrableProductDefinitionRouteOfAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
3048    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent();
3049    parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(json, res);
3050    return res;
3051  }
3052
3053  protected void parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
3054    parseBackboneElementProperties(json, res);
3055    if (json.has("code"))
3056      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3057    if (json.has("firstDose"))
3058      res.setFirstDose(parseQuantity(getJObject(json, "firstDose")));
3059    if (json.has("maxSingleDose"))
3060      res.setMaxSingleDose(parseQuantity(getJObject(json, "maxSingleDose")));
3061    if (json.has("maxDosePerDay"))
3062      res.setMaxDosePerDay(parseQuantity(getJObject(json, "maxDosePerDay")));
3063    if (json.has("maxDosePerTreatmentPeriod"))
3064      res.setMaxDosePerTreatmentPeriod(parseRatio(getJObject(json, "maxDosePerTreatmentPeriod")));
3065    if (json.has("maxTreatmentPeriod"))
3066      res.setMaxTreatmentPeriod(parseDuration(getJObject(json, "maxTreatmentPeriod")));
3067    if (json.has("targetSpecies")) {
3068      JsonArray array = getJArray(json, "targetSpecies");
3069      for (int i = 0; i < array.size(); i++) {
3070        res.getTargetSpecies().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject()));
3071      }
3072    };
3073  }
3074
3075  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(JsonObject json) throws IOException, FHIRFormatError {
3076    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
3077    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(json, res);
3078    return res;
3079  }
3080
3081  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
3082    parseBackboneElementProperties(json, res);
3083    if (json.has("code"))
3084      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3085    if (json.has("withdrawalPeriod")) {
3086      JsonArray array = getJArray(json, "withdrawalPeriod");
3087      for (int i = 0; i < array.size(); i++) {
3088        res.getWithdrawalPeriod().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject()));
3089      }
3090    };
3091  }
3092
3093  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json) throws IOException, FHIRFormatError {
3094    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
3095    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, res);
3096    return res;
3097  }
3098
3099  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
3100    parseBackboneElementProperties(json, res);
3101    if (json.has("tissue"))
3102      res.setTissue(parseCodeableConcept(getJObject(json, "tissue")));
3103    if (json.has("value"))
3104      res.setValue(parseQuantity(getJObject(json, "value")));
3105    if (json.has("supportingInformation"))
3106      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
3107    if (json.has("_supportingInformation"))
3108      parseElementProperties(getJObject(json, "_supportingInformation"), res.getSupportingInformationElement());
3109  }
3110
3111  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
3112    AdverseEvent res = new AdverseEvent();
3113    parseAdverseEventProperties(json, res);
3114    return res;
3115  }
3116
3117  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
3118    parseDomainResourceProperties(json, res);
3119    if (json.has("identifier")) {
3120      JsonArray array = getJArray(json, "identifier");
3121      for (int i = 0; i < array.size(); i++) {
3122        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3123      }
3124    };
3125    if (json.has("status"))
3126      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AdverseEvent.AdverseEventStatus.NULL, new AdverseEvent.AdverseEventStatusEnumFactory()));
3127    if (json.has("_status"))
3128      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3129    if (json.has("actuality"))
3130      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
3131    if (json.has("_actuality"))
3132      parseElementProperties(getJObject(json, "_actuality"), res.getActualityElement());
3133    if (json.has("category")) {
3134      JsonArray array = getJArray(json, "category");
3135      for (int i = 0; i < array.size(); i++) {
3136        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3137      }
3138    };
3139    if (json.has("code"))
3140      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3141    if (json.has("subject"))
3142      res.setSubject(parseReference(getJObject(json, "subject")));
3143    if (json.has("encounter"))
3144      res.setEncounter(parseReference(getJObject(json, "encounter")));
3145    DataType occurrence = parseType("occurrence", json);
3146    if (occurrence != null)
3147      res.setOccurrence(occurrence);
3148    if (json.has("detected"))
3149      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
3150    if (json.has("_detected"))
3151      parseElementProperties(getJObject(json, "_detected"), res.getDetectedElement());
3152    if (json.has("recordedDate"))
3153      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
3154    if (json.has("_recordedDate"))
3155      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
3156    if (json.has("resultingEffect")) {
3157      JsonArray array = getJArray(json, "resultingEffect");
3158      for (int i = 0; i < array.size(); i++) {
3159        res.getResultingEffect().add(parseReference(array.get(i).getAsJsonObject()));
3160      }
3161    };
3162    if (json.has("location"))
3163      res.setLocation(parseReference(getJObject(json, "location")));
3164    if (json.has("seriousness"))
3165      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
3166    if (json.has("outcome")) {
3167      JsonArray array = getJArray(json, "outcome");
3168      for (int i = 0; i < array.size(); i++) {
3169        res.getOutcome().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3170      }
3171    };
3172    if (json.has("recorder"))
3173      res.setRecorder(parseReference(getJObject(json, "recorder")));
3174    if (json.has("participant")) {
3175      JsonArray array = getJArray(json, "participant");
3176      for (int i = 0; i < array.size(); i++) {
3177        res.getParticipant().add(parseAdverseEventParticipantComponent(array.get(i).getAsJsonObject()));
3178      }
3179    };
3180    if (json.has("study")) {
3181      JsonArray array = getJArray(json, "study");
3182      for (int i = 0; i < array.size(); i++) {
3183        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
3184      }
3185    };
3186    if (json.has("expectedInResearchStudy"))
3187      res.setExpectedInResearchStudyElement(parseBoolean(json.get("expectedInResearchStudy").getAsBoolean()));
3188    if (json.has("_expectedInResearchStudy"))
3189      parseElementProperties(getJObject(json, "_expectedInResearchStudy"), res.getExpectedInResearchStudyElement());
3190    if (json.has("suspectEntity")) {
3191      JsonArray array = getJArray(json, "suspectEntity");
3192      for (int i = 0; i < array.size(); i++) {
3193        res.getSuspectEntity().add(parseAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject()));
3194      }
3195    };
3196    if (json.has("contributingFactor")) {
3197      JsonArray array = getJArray(json, "contributingFactor");
3198      for (int i = 0; i < array.size(); i++) {
3199        res.getContributingFactor().add(parseAdverseEventContributingFactorComponent(array.get(i).getAsJsonObject()));
3200      }
3201    };
3202    if (json.has("preventiveAction")) {
3203      JsonArray array = getJArray(json, "preventiveAction");
3204      for (int i = 0; i < array.size(); i++) {
3205        res.getPreventiveAction().add(parseAdverseEventPreventiveActionComponent(array.get(i).getAsJsonObject()));
3206      }
3207    };
3208    if (json.has("mitigatingAction")) {
3209      JsonArray array = getJArray(json, "mitigatingAction");
3210      for (int i = 0; i < array.size(); i++) {
3211        res.getMitigatingAction().add(parseAdverseEventMitigatingActionComponent(array.get(i).getAsJsonObject()));
3212      }
3213    };
3214    if (json.has("supportingInfo")) {
3215      JsonArray array = getJArray(json, "supportingInfo");
3216      for (int i = 0; i < array.size(); i++) {
3217        res.getSupportingInfo().add(parseAdverseEventSupportingInfoComponent(array.get(i).getAsJsonObject()));
3218      }
3219    };
3220    if (json.has("note")) {
3221      JsonArray array = getJArray(json, "note");
3222      for (int i = 0; i < array.size(); i++) {
3223        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3224      }
3225    };
3226  }
3227
3228  protected AdverseEvent.AdverseEventParticipantComponent parseAdverseEventParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3229    AdverseEvent.AdverseEventParticipantComponent res = new AdverseEvent.AdverseEventParticipantComponent();
3230    parseAdverseEventParticipantComponentProperties(json, res);
3231    return res;
3232  }
3233
3234  protected void parseAdverseEventParticipantComponentProperties(JsonObject json, AdverseEvent.AdverseEventParticipantComponent res) throws IOException, FHIRFormatError {
3235    parseBackboneElementProperties(json, res);
3236    if (json.has("function"))
3237      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
3238    if (json.has("actor"))
3239      res.setActor(parseReference(getJObject(json, "actor")));
3240  }
3241
3242  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventSuspectEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
3243    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
3244    parseAdverseEventSuspectEntityComponentProperties(json, res);
3245    return res;
3246  }
3247
3248  protected void parseAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
3249    parseBackboneElementProperties(json, res);
3250    DataType instance = parseType("instance", json);
3251    if (instance != null)
3252      res.setInstance(instance);
3253    if (json.has("causality"))
3254      res.setCausality(parseAdverseEventSuspectEntityCausalityComponent(getJObject(json, "causality")));
3255  }
3256
3257  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventSuspectEntityCausalityComponent(JsonObject json) throws IOException, FHIRFormatError {
3258    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
3259    parseAdverseEventSuspectEntityCausalityComponentProperties(json, res);
3260    return res;
3261  }
3262
3263  protected void parseAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
3264    parseBackboneElementProperties(json, res);
3265    if (json.has("assessmentMethod"))
3266      res.setAssessmentMethod(parseCodeableConcept(getJObject(json, "assessmentMethod")));
3267    if (json.has("entityRelatedness"))
3268      res.setEntityRelatedness(parseCodeableConcept(getJObject(json, "entityRelatedness")));
3269    if (json.has("author"))
3270      res.setAuthor(parseReference(getJObject(json, "author")));
3271  }
3272
3273  protected AdverseEvent.AdverseEventContributingFactorComponent parseAdverseEventContributingFactorComponent(JsonObject json) throws IOException, FHIRFormatError {
3274    AdverseEvent.AdverseEventContributingFactorComponent res = new AdverseEvent.AdverseEventContributingFactorComponent();
3275    parseAdverseEventContributingFactorComponentProperties(json, res);
3276    return res;
3277  }
3278
3279  protected void parseAdverseEventContributingFactorComponentProperties(JsonObject json, AdverseEvent.AdverseEventContributingFactorComponent res) throws IOException, FHIRFormatError {
3280    parseBackboneElementProperties(json, res);
3281    DataType item = parseType("item", json);
3282    if (item != null)
3283      res.setItem(item);
3284  }
3285
3286  protected AdverseEvent.AdverseEventPreventiveActionComponent parseAdverseEventPreventiveActionComponent(JsonObject json) throws IOException, FHIRFormatError {
3287    AdverseEvent.AdverseEventPreventiveActionComponent res = new AdverseEvent.AdverseEventPreventiveActionComponent();
3288    parseAdverseEventPreventiveActionComponentProperties(json, res);
3289    return res;
3290  }
3291
3292  protected void parseAdverseEventPreventiveActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventPreventiveActionComponent res) throws IOException, FHIRFormatError {
3293    parseBackboneElementProperties(json, res);
3294    DataType item = parseType("item", json);
3295    if (item != null)
3296      res.setItem(item);
3297  }
3298
3299  protected AdverseEvent.AdverseEventMitigatingActionComponent parseAdverseEventMitigatingActionComponent(JsonObject json) throws IOException, FHIRFormatError {
3300    AdverseEvent.AdverseEventMitigatingActionComponent res = new AdverseEvent.AdverseEventMitigatingActionComponent();
3301    parseAdverseEventMitigatingActionComponentProperties(json, res);
3302    return res;
3303  }
3304
3305  protected void parseAdverseEventMitigatingActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventMitigatingActionComponent res) throws IOException, FHIRFormatError {
3306    parseBackboneElementProperties(json, res);
3307    DataType item = parseType("item", json);
3308    if (item != null)
3309      res.setItem(item);
3310  }
3311
3312  protected AdverseEvent.AdverseEventSupportingInfoComponent parseAdverseEventSupportingInfoComponent(JsonObject json) throws IOException, FHIRFormatError {
3313    AdverseEvent.AdverseEventSupportingInfoComponent res = new AdverseEvent.AdverseEventSupportingInfoComponent();
3314    parseAdverseEventSupportingInfoComponentProperties(json, res);
3315    return res;
3316  }
3317
3318  protected void parseAdverseEventSupportingInfoComponentProperties(JsonObject json, AdverseEvent.AdverseEventSupportingInfoComponent res) throws IOException, FHIRFormatError {
3319    parseBackboneElementProperties(json, res);
3320    DataType item = parseType("item", json);
3321    if (item != null)
3322      res.setItem(item);
3323  }
3324
3325  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
3326    AllergyIntolerance res = new AllergyIntolerance();
3327    parseAllergyIntoleranceProperties(json, res);
3328    return res;
3329  }
3330
3331  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
3332    parseDomainResourceProperties(json, res);
3333    if (json.has("identifier")) {
3334      JsonArray array = getJArray(json, "identifier");
3335      for (int i = 0; i < array.size(); i++) {
3336        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3337      }
3338    };
3339    if (json.has("clinicalStatus"))
3340      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
3341    if (json.has("verificationStatus"))
3342      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
3343    if (json.has("type"))
3344      res.setType(parseCodeableConcept(getJObject(json, "type")));
3345    if (json.has("category")) {
3346      JsonArray array = getJArray(json, "category");
3347      for (int i = 0; i < array.size(); i++) {
3348        if (array.get(i).isJsonNull()) {
3349          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>(new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), AllergyIntolerance.AllergyIntoleranceCategory.NULL));
3350        } else {;
3351          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
3352        }
3353      }
3354    };
3355    if (json.has("_category")) {
3356      JsonArray array = getJArray(json, "_category");
3357      for (int i = 0; i < array.size(); i++) {
3358        if (i == res.getCategory().size())
3359          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
3360        if (array.get(i) instanceof JsonObject) 
3361          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
3362      }
3363    };
3364    if (json.has("criticality"))
3365      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
3366    if (json.has("_criticality"))
3367      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
3368    if (json.has("code"))
3369      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3370    if (json.has("patient"))
3371      res.setPatient(parseReference(getJObject(json, "patient")));
3372    if (json.has("encounter"))
3373      res.setEncounter(parseReference(getJObject(json, "encounter")));
3374    DataType onset = parseType("onset", json);
3375    if (onset != null)
3376      res.setOnset(onset);
3377    if (json.has("recordedDate"))
3378      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
3379    if (json.has("_recordedDate"))
3380      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
3381    if (json.has("participant")) {
3382      JsonArray array = getJArray(json, "participant");
3383      for (int i = 0; i < array.size(); i++) {
3384        res.getParticipant().add(parseAllergyIntoleranceParticipantComponent(array.get(i).getAsJsonObject()));
3385      }
3386    };
3387    if (json.has("lastOccurrence"))
3388      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
3389    if (json.has("_lastOccurrence"))
3390      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
3391    if (json.has("note")) {
3392      JsonArray array = getJArray(json, "note");
3393      for (int i = 0; i < array.size(); i++) {
3394        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3395      }
3396    };
3397    if (json.has("reaction")) {
3398      JsonArray array = getJArray(json, "reaction");
3399      for (int i = 0; i < array.size(); i++) {
3400        res.getReaction().add(parseAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject()));
3401      }
3402    };
3403  }
3404
3405  protected AllergyIntolerance.AllergyIntoleranceParticipantComponent parseAllergyIntoleranceParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3406    AllergyIntolerance.AllergyIntoleranceParticipantComponent res = new AllergyIntolerance.AllergyIntoleranceParticipantComponent();
3407    parseAllergyIntoleranceParticipantComponentProperties(json, res);
3408    return res;
3409  }
3410
3411  protected void parseAllergyIntoleranceParticipantComponentProperties(JsonObject json, AllergyIntolerance.AllergyIntoleranceParticipantComponent res) throws IOException, FHIRFormatError {
3412    parseBackboneElementProperties(json, res);
3413    if (json.has("function"))
3414      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
3415    if (json.has("actor"))
3416      res.setActor(parseReference(getJObject(json, "actor")));
3417  }
3418
3419  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
3420    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
3421    parseAllergyIntoleranceReactionComponentProperties(json, res);
3422    return res;
3423  }
3424
3425  protected void parseAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
3426    parseBackboneElementProperties(json, res);
3427    if (json.has("substance"))
3428      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
3429    if (json.has("manifestation")) {
3430      JsonArray array = getJArray(json, "manifestation");
3431      for (int i = 0; i < array.size(); i++) {
3432        res.getManifestation().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3433      }
3434    };
3435    if (json.has("description"))
3436      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3437    if (json.has("_description"))
3438      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3439    if (json.has("onset"))
3440      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
3441    if (json.has("_onset"))
3442      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
3443    if (json.has("severity"))
3444      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
3445    if (json.has("_severity"))
3446      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
3447    if (json.has("exposureRoute"))
3448      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
3449    if (json.has("note")) {
3450      JsonArray array = getJArray(json, "note");
3451      for (int i = 0; i < array.size(); i++) {
3452        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3453      }
3454    };
3455  }
3456
3457  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
3458    Appointment res = new Appointment();
3459    parseAppointmentProperties(json, res);
3460    return res;
3461  }
3462
3463  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
3464    parseDomainResourceProperties(json, res);
3465    if (json.has("identifier")) {
3466      JsonArray array = getJArray(json, "identifier");
3467      for (int i = 0; i < array.size(); i++) {
3468        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3469      }
3470    };
3471    if (json.has("status"))
3472      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
3473    if (json.has("_status"))
3474      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3475    if (json.has("cancellationReason"))
3476      res.setCancellationReason(parseCodeableConcept(getJObject(json, "cancellationReason")));
3477    if (json.has("class")) {
3478      JsonArray array = getJArray(json, "class");
3479      for (int i = 0; i < array.size(); i++) {
3480        res.getClass_().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3481      }
3482    };
3483    if (json.has("serviceCategory")) {
3484      JsonArray array = getJArray(json, "serviceCategory");
3485      for (int i = 0; i < array.size(); i++) {
3486        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3487      }
3488    };
3489    if (json.has("serviceType")) {
3490      JsonArray array = getJArray(json, "serviceType");
3491      for (int i = 0; i < array.size(); i++) {
3492        res.getServiceType().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3493      }
3494    };
3495    if (json.has("specialty")) {
3496      JsonArray array = getJArray(json, "specialty");
3497      for (int i = 0; i < array.size(); i++) {
3498        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3499      }
3500    };
3501    if (json.has("appointmentType"))
3502      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
3503    if (json.has("reason")) {
3504      JsonArray array = getJArray(json, "reason");
3505      for (int i = 0; i < array.size(); i++) {
3506        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3507      }
3508    };
3509    if (json.has("priority"))
3510      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
3511    if (json.has("description"))
3512      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3513    if (json.has("_description"))
3514      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3515    if (json.has("replaces")) {
3516      JsonArray array = getJArray(json, "replaces");
3517      for (int i = 0; i < array.size(); i++) {
3518        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
3519      }
3520    };
3521    if (json.has("virtualService")) {
3522      JsonArray array = getJArray(json, "virtualService");
3523      for (int i = 0; i < array.size(); i++) {
3524        res.getVirtualService().add(parseVirtualServiceDetail(array.get(i).getAsJsonObject()));
3525      }
3526    };
3527    if (json.has("supportingInformation")) {
3528      JsonArray array = getJArray(json, "supportingInformation");
3529      for (int i = 0; i < array.size(); i++) {
3530        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3531      }
3532    };
3533    if (json.has("previousAppointment"))
3534      res.setPreviousAppointment(parseReference(getJObject(json, "previousAppointment")));
3535    if (json.has("originatingAppointment"))
3536      res.setOriginatingAppointment(parseReference(getJObject(json, "originatingAppointment")));
3537    if (json.has("start"))
3538      res.setStartElement(parseInstant(json.get("start").getAsString()));
3539    if (json.has("_start"))
3540      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
3541    if (json.has("end"))
3542      res.setEndElement(parseInstant(json.get("end").getAsString()));
3543    if (json.has("_end"))
3544      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
3545    if (json.has("minutesDuration"))
3546      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
3547    if (json.has("_minutesDuration"))
3548      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
3549    if (json.has("requestedPeriod")) {
3550      JsonArray array = getJArray(json, "requestedPeriod");
3551      for (int i = 0; i < array.size(); i++) {
3552        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
3553      }
3554    };
3555    if (json.has("slot")) {
3556      JsonArray array = getJArray(json, "slot");
3557      for (int i = 0; i < array.size(); i++) {
3558        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
3559      }
3560    };
3561    if (json.has("account")) {
3562      JsonArray array = getJArray(json, "account");
3563      for (int i = 0; i < array.size(); i++) {
3564        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
3565      }
3566    };
3567    if (json.has("created"))
3568      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
3569    if (json.has("_created"))
3570      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
3571    if (json.has("cancellationDate"))
3572      res.setCancellationDateElement(parseDateTime(json.get("cancellationDate").getAsString()));
3573    if (json.has("_cancellationDate"))
3574      parseElementProperties(getJObject(json, "_cancellationDate"), res.getCancellationDateElement());
3575    if (json.has("note")) {
3576      JsonArray array = getJArray(json, "note");
3577      for (int i = 0; i < array.size(); i++) {
3578        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3579      }
3580    };
3581    if (json.has("patientInstruction")) {
3582      JsonArray array = getJArray(json, "patientInstruction");
3583      for (int i = 0; i < array.size(); i++) {
3584        res.getPatientInstruction().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3585      }
3586    };
3587    if (json.has("basedOn")) {
3588      JsonArray array = getJArray(json, "basedOn");
3589      for (int i = 0; i < array.size(); i++) {
3590        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3591      }
3592    };
3593    if (json.has("subject"))
3594      res.setSubject(parseReference(getJObject(json, "subject")));
3595    if (json.has("participant")) {
3596      JsonArray array = getJArray(json, "participant");
3597      for (int i = 0; i < array.size(); i++) {
3598        res.getParticipant().add(parseAppointmentParticipantComponent(array.get(i).getAsJsonObject()));
3599      }
3600    };
3601    if (json.has("recurrenceId"))
3602      res.setRecurrenceIdElement(parsePositiveInt(json.get("recurrenceId").getAsString()));
3603    if (json.has("_recurrenceId"))
3604      parseElementProperties(getJObject(json, "_recurrenceId"), res.getRecurrenceIdElement());
3605    if (json.has("occurrenceChanged"))
3606      res.setOccurrenceChangedElement(parseBoolean(json.get("occurrenceChanged").getAsBoolean()));
3607    if (json.has("_occurrenceChanged"))
3608      parseElementProperties(getJObject(json, "_occurrenceChanged"), res.getOccurrenceChangedElement());
3609    if (json.has("recurrenceTemplate")) {
3610      JsonArray array = getJArray(json, "recurrenceTemplate");
3611      for (int i = 0; i < array.size(); i++) {
3612        res.getRecurrenceTemplate().add(parseAppointmentRecurrenceTemplateComponent(array.get(i).getAsJsonObject()));
3613      }
3614    };
3615  }
3616
3617  protected Appointment.AppointmentParticipantComponent parseAppointmentParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3618    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
3619    parseAppointmentParticipantComponentProperties(json, res);
3620    return res;
3621  }
3622
3623  protected void parseAppointmentParticipantComponentProperties(JsonObject json, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
3624    parseBackboneElementProperties(json, res);
3625    if (json.has("type")) {
3626      JsonArray array = getJArray(json, "type");
3627      for (int i = 0; i < array.size(); i++) {
3628        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3629      }
3630    };
3631    if (json.has("period"))
3632      res.setPeriod(parsePeriod(getJObject(json, "period")));
3633    if (json.has("actor"))
3634      res.setActor(parseReference(getJObject(json, "actor")));
3635    if (json.has("required"))
3636      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
3637    if (json.has("_required"))
3638      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
3639    if (json.has("status"))
3640      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
3641    if (json.has("_status"))
3642      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3643  }
3644
3645  protected Appointment.AppointmentRecurrenceTemplateComponent parseAppointmentRecurrenceTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3646    Appointment.AppointmentRecurrenceTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateComponent();
3647    parseAppointmentRecurrenceTemplateComponentProperties(json, res);
3648    return res;
3649  }
3650
3651  protected void parseAppointmentRecurrenceTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateComponent res) throws IOException, FHIRFormatError {
3652    parseBackboneElementProperties(json, res);
3653    if (json.has("timezone"))
3654      res.setTimezone(parseCodeableConcept(getJObject(json, "timezone")));
3655    if (json.has("recurrenceType"))
3656      res.setRecurrenceType(parseCodeableConcept(getJObject(json, "recurrenceType")));
3657    if (json.has("lastOccurrenceDate"))
3658      res.setLastOccurrenceDateElement(parseDate(json.get("lastOccurrenceDate").getAsString()));
3659    if (json.has("_lastOccurrenceDate"))
3660      parseElementProperties(getJObject(json, "_lastOccurrenceDate"), res.getLastOccurrenceDateElement());
3661    if (json.has("occurrenceCount"))
3662      res.setOccurrenceCountElement(parsePositiveInt(json.get("occurrenceCount").getAsString()));
3663    if (json.has("_occurrenceCount"))
3664      parseElementProperties(getJObject(json, "_occurrenceCount"), res.getOccurrenceCountElement());
3665    if (json.has("occurrenceDate")) {
3666      JsonArray array = getJArray(json, "occurrenceDate");
3667      for (int i = 0; i < array.size(); i++) {
3668        if (array.get(i).isJsonNull()) {
3669          res.getOccurrenceDate().add(new DateType());
3670        } else {;
3671          res.getOccurrenceDate().add(parseDate(array.get(i).getAsString()));
3672        }
3673      }
3674    };
3675    if (json.has("_occurrenceDate")) {
3676      JsonArray array = getJArray(json, "_occurrenceDate");
3677      for (int i = 0; i < array.size(); i++) {
3678        if (i == res.getOccurrenceDate().size())
3679          res.getOccurrenceDate().add(parseDate(null));
3680        if (array.get(i) instanceof JsonObject) 
3681          parseElementProperties(array.get(i).getAsJsonObject(), res.getOccurrenceDate().get(i));
3682      }
3683    };
3684    if (json.has("weeklyTemplate"))
3685      res.setWeeklyTemplate(parseAppointmentRecurrenceTemplateWeeklyTemplateComponent(getJObject(json, "weeklyTemplate")));
3686    if (json.has("monthlyTemplate"))
3687      res.setMonthlyTemplate(parseAppointmentRecurrenceTemplateMonthlyTemplateComponent(getJObject(json, "monthlyTemplate")));
3688    if (json.has("yearlyTemplate"))
3689      res.setYearlyTemplate(parseAppointmentRecurrenceTemplateYearlyTemplateComponent(getJObject(json, "yearlyTemplate")));
3690    if (json.has("excludingDate")) {
3691      JsonArray array = getJArray(json, "excludingDate");
3692      for (int i = 0; i < array.size(); i++) {
3693        if (array.get(i).isJsonNull()) {
3694          res.getExcludingDate().add(new DateType());
3695        } else {;
3696          res.getExcludingDate().add(parseDate(array.get(i).getAsString()));
3697        }
3698      }
3699    };
3700    if (json.has("_excludingDate")) {
3701      JsonArray array = getJArray(json, "_excludingDate");
3702      for (int i = 0; i < array.size(); i++) {
3703        if (i == res.getExcludingDate().size())
3704          res.getExcludingDate().add(parseDate(null));
3705        if (array.get(i) instanceof JsonObject) 
3706          parseElementProperties(array.get(i).getAsJsonObject(), res.getExcludingDate().get(i));
3707      }
3708    };
3709    if (json.has("excludingRecurrenceId")) {
3710      JsonArray array = getJArray(json, "excludingRecurrenceId");
3711      for (int i = 0; i < array.size(); i++) {
3712        if (array.get(i).isJsonNull()) {
3713          res.getExcludingRecurrenceId().add(new PositiveIntType());
3714        } else {;
3715          res.getExcludingRecurrenceId().add(parsePositiveInt(array.get(i).getAsString()));
3716        }
3717      }
3718    };
3719    if (json.has("_excludingRecurrenceId")) {
3720      JsonArray array = getJArray(json, "_excludingRecurrenceId");
3721      for (int i = 0; i < array.size(); i++) {
3722        if (i == res.getExcludingRecurrenceId().size())
3723          res.getExcludingRecurrenceId().add(parsePositiveInt(null));
3724        if (array.get(i) instanceof JsonObject) 
3725          parseElementProperties(array.get(i).getAsJsonObject(), res.getExcludingRecurrenceId().get(i));
3726      }
3727    };
3728  }
3729
3730  protected Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent parseAppointmentRecurrenceTemplateWeeklyTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3731    Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent();
3732    parseAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(json, res);
3733    return res;
3734  }
3735
3736  protected void parseAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent res) throws IOException, FHIRFormatError {
3737    parseBackboneElementProperties(json, res);
3738    if (json.has("monday"))
3739      res.setMondayElement(parseBoolean(json.get("monday").getAsBoolean()));
3740    if (json.has("_monday"))
3741      parseElementProperties(getJObject(json, "_monday"), res.getMondayElement());
3742    if (json.has("tuesday"))
3743      res.setTuesdayElement(parseBoolean(json.get("tuesday").getAsBoolean()));
3744    if (json.has("_tuesday"))
3745      parseElementProperties(getJObject(json, "_tuesday"), res.getTuesdayElement());
3746    if (json.has("wednesday"))
3747      res.setWednesdayElement(parseBoolean(json.get("wednesday").getAsBoolean()));
3748    if (json.has("_wednesday"))
3749      parseElementProperties(getJObject(json, "_wednesday"), res.getWednesdayElement());
3750    if (json.has("thursday"))
3751      res.setThursdayElement(parseBoolean(json.get("thursday").getAsBoolean()));
3752    if (json.has("_thursday"))
3753      parseElementProperties(getJObject(json, "_thursday"), res.getThursdayElement());
3754    if (json.has("friday"))
3755      res.setFridayElement(parseBoolean(json.get("friday").getAsBoolean()));
3756    if (json.has("_friday"))
3757      parseElementProperties(getJObject(json, "_friday"), res.getFridayElement());
3758    if (json.has("saturday"))
3759      res.setSaturdayElement(parseBoolean(json.get("saturday").getAsBoolean()));
3760    if (json.has("_saturday"))
3761      parseElementProperties(getJObject(json, "_saturday"), res.getSaturdayElement());
3762    if (json.has("sunday"))
3763      res.setSundayElement(parseBoolean(json.get("sunday").getAsBoolean()));
3764    if (json.has("_sunday"))
3765      parseElementProperties(getJObject(json, "_sunday"), res.getSundayElement());
3766    if (json.has("weekInterval"))
3767      res.setWeekIntervalElement(parsePositiveInt(json.get("weekInterval").getAsString()));
3768    if (json.has("_weekInterval"))
3769      parseElementProperties(getJObject(json, "_weekInterval"), res.getWeekIntervalElement());
3770  }
3771
3772  protected Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent parseAppointmentRecurrenceTemplateMonthlyTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3773    Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent();
3774    parseAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(json, res);
3775    return res;
3776  }
3777
3778  protected void parseAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent res) throws IOException, FHIRFormatError {
3779    parseBackboneElementProperties(json, res);
3780    if (json.has("dayOfMonth"))
3781      res.setDayOfMonthElement(parsePositiveInt(json.get("dayOfMonth").getAsString()));
3782    if (json.has("_dayOfMonth"))
3783      parseElementProperties(getJObject(json, "_dayOfMonth"), res.getDayOfMonthElement());
3784    if (json.has("nthWeekOfMonth"))
3785      res.setNthWeekOfMonth(parseCoding(getJObject(json, "nthWeekOfMonth")));
3786    if (json.has("dayOfWeek"))
3787      res.setDayOfWeek(parseCoding(getJObject(json, "dayOfWeek")));
3788    if (json.has("monthInterval"))
3789      res.setMonthIntervalElement(parsePositiveInt(json.get("monthInterval").getAsString()));
3790    if (json.has("_monthInterval"))
3791      parseElementProperties(getJObject(json, "_monthInterval"), res.getMonthIntervalElement());
3792  }
3793
3794  protected Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent parseAppointmentRecurrenceTemplateYearlyTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3795    Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent();
3796    parseAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(json, res);
3797    return res;
3798  }
3799
3800  protected void parseAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent res) throws IOException, FHIRFormatError {
3801    parseBackboneElementProperties(json, res);
3802    if (json.has("yearInterval"))
3803      res.setYearIntervalElement(parsePositiveInt(json.get("yearInterval").getAsString()));
3804    if (json.has("_yearInterval"))
3805      parseElementProperties(getJObject(json, "_yearInterval"), res.getYearIntervalElement());
3806  }
3807
3808  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
3809    AppointmentResponse res = new AppointmentResponse();
3810    parseAppointmentResponseProperties(json, res);
3811    return res;
3812  }
3813
3814  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
3815    parseDomainResourceProperties(json, res);
3816    if (json.has("identifier")) {
3817      JsonArray array = getJArray(json, "identifier");
3818      for (int i = 0; i < array.size(); i++) {
3819        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3820      }
3821    };
3822    if (json.has("appointment"))
3823      res.setAppointment(parseReference(getJObject(json, "appointment")));
3824    if (json.has("proposedNewTime"))
3825      res.setProposedNewTimeElement(parseBoolean(json.get("proposedNewTime").getAsBoolean()));
3826    if (json.has("_proposedNewTime"))
3827      parseElementProperties(getJObject(json, "_proposedNewTime"), res.getProposedNewTimeElement());
3828    if (json.has("start"))
3829      res.setStartElement(parseInstant(json.get("start").getAsString()));
3830    if (json.has("_start"))
3831      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
3832    if (json.has("end"))
3833      res.setEndElement(parseInstant(json.get("end").getAsString()));
3834    if (json.has("_end"))
3835      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
3836    if (json.has("participantType")) {
3837      JsonArray array = getJArray(json, "participantType");
3838      for (int i = 0; i < array.size(); i++) {
3839        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3840      }
3841    };
3842    if (json.has("actor"))
3843      res.setActor(parseReference(getJObject(json, "actor")));
3844    if (json.has("participantStatus"))
3845      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.AppointmentResponseStatus.NULL, new AppointmentResponse.AppointmentResponseStatusEnumFactory()));
3846    if (json.has("_participantStatus"))
3847      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
3848    if (json.has("comment"))
3849      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
3850    if (json.has("_comment"))
3851      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
3852    if (json.has("recurring"))
3853      res.setRecurringElement(parseBoolean(json.get("recurring").getAsBoolean()));
3854    if (json.has("_recurring"))
3855      parseElementProperties(getJObject(json, "_recurring"), res.getRecurringElement());
3856    if (json.has("occurrenceDate"))
3857      res.setOccurrenceDateElement(parseDate(json.get("occurrenceDate").getAsString()));
3858    if (json.has("_occurrenceDate"))
3859      parseElementProperties(getJObject(json, "_occurrenceDate"), res.getOccurrenceDateElement());
3860    if (json.has("recurrenceId"))
3861      res.setRecurrenceIdElement(parsePositiveInt(json.get("recurrenceId").getAsString()));
3862    if (json.has("_recurrenceId"))
3863      parseElementProperties(getJObject(json, "_recurrenceId"), res.getRecurrenceIdElement());
3864  }
3865
3866  protected ArtifactAssessment parseArtifactAssessment(JsonObject json) throws IOException, FHIRFormatError {
3867    ArtifactAssessment res = new ArtifactAssessment();
3868    parseArtifactAssessmentProperties(json, res);
3869    return res;
3870  }
3871
3872  protected void parseArtifactAssessmentProperties(JsonObject json, ArtifactAssessment res) throws IOException, FHIRFormatError {
3873    parseDomainResourceProperties(json, res);
3874    if (json.has("identifier")) {
3875      JsonArray array = getJArray(json, "identifier");
3876      for (int i = 0; i < array.size(); i++) {
3877        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3878      }
3879    };
3880    if (json.has("title"))
3881      res.setTitleElement(parseString(json.get("title").getAsString()));
3882    if (json.has("_title"))
3883      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3884    DataType citeAs = parseType("citeAs", json);
3885    if (citeAs != null)
3886      res.setCiteAs(citeAs);
3887    if (json.has("date"))
3888      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3889    if (json.has("_date"))
3890      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3891    if (json.has("copyright"))
3892      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3893    if (json.has("_copyright"))
3894      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3895    if (json.has("approvalDate"))
3896      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
3897    if (json.has("_approvalDate"))
3898      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
3899    if (json.has("lastReviewDate"))
3900      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
3901    if (json.has("_lastReviewDate"))
3902      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
3903    DataType artifact = parseType("artifact", json);
3904    if (artifact != null)
3905      res.setArtifact(artifact);
3906    if (json.has("content")) {
3907      JsonArray array = getJArray(json, "content");
3908      for (int i = 0; i < array.size(); i++) {
3909        res.getContent().add(parseArtifactAssessmentContentComponent(array.get(i).getAsJsonObject()));
3910      }
3911    };
3912    if (json.has("workflowStatus"))
3913      res.setWorkflowStatusElement(parseEnumeration(json.get("workflowStatus").getAsString(), ArtifactAssessment.ArtifactAssessmentWorkflowStatus.NULL, new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory()));
3914    if (json.has("_workflowStatus"))
3915      parseElementProperties(getJObject(json, "_workflowStatus"), res.getWorkflowStatusElement());
3916    if (json.has("disposition"))
3917      res.setDispositionElement(parseEnumeration(json.get("disposition").getAsString(), ArtifactAssessment.ArtifactAssessmentDisposition.NULL, new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory()));
3918    if (json.has("_disposition"))
3919      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
3920  }
3921
3922  protected ArtifactAssessment.ArtifactAssessmentContentComponent parseArtifactAssessmentContentComponent(JsonObject json) throws IOException, FHIRFormatError {
3923    ArtifactAssessment.ArtifactAssessmentContentComponent res = new ArtifactAssessment.ArtifactAssessmentContentComponent();
3924    parseArtifactAssessmentContentComponentProperties(json, res);
3925    return res;
3926  }
3927
3928  protected void parseArtifactAssessmentContentComponentProperties(JsonObject json, ArtifactAssessment.ArtifactAssessmentContentComponent res) throws IOException, FHIRFormatError {
3929    parseBackboneElementProperties(json, res);
3930    if (json.has("informationType"))
3931      res.setInformationTypeElement(parseEnumeration(json.get("informationType").getAsString(), ArtifactAssessment.ArtifactAssessmentInformationType.NULL, new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory()));
3932    if (json.has("_informationType"))
3933      parseElementProperties(getJObject(json, "_informationType"), res.getInformationTypeElement());
3934    if (json.has("summary"))
3935      res.setSummaryElement(parseMarkdown(json.get("summary").getAsString()));
3936    if (json.has("_summary"))
3937      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
3938    if (json.has("type"))
3939      res.setType(parseCodeableConcept(getJObject(json, "type")));
3940    if (json.has("classifier")) {
3941      JsonArray array = getJArray(json, "classifier");
3942      for (int i = 0; i < array.size(); i++) {
3943        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3944      }
3945    };
3946    if (json.has("quantity"))
3947      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
3948    if (json.has("author"))
3949      res.setAuthor(parseReference(getJObject(json, "author")));
3950    if (json.has("path")) {
3951      JsonArray array = getJArray(json, "path");
3952      for (int i = 0; i < array.size(); i++) {
3953        if (array.get(i).isJsonNull()) {
3954          res.getPath().add(new UriType());
3955        } else {;
3956          res.getPath().add(parseUri(array.get(i).getAsString()));
3957        }
3958      }
3959    };
3960    if (json.has("_path")) {
3961      JsonArray array = getJArray(json, "_path");
3962      for (int i = 0; i < array.size(); i++) {
3963        if (i == res.getPath().size())
3964          res.getPath().add(parseUri(null));
3965        if (array.get(i) instanceof JsonObject) 
3966          parseElementProperties(array.get(i).getAsJsonObject(), res.getPath().get(i));
3967      }
3968    };
3969    if (json.has("relatedArtifact")) {
3970      JsonArray array = getJArray(json, "relatedArtifact");
3971      for (int i = 0; i < array.size(); i++) {
3972        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
3973      }
3974    };
3975    if (json.has("freeToShare"))
3976      res.setFreeToShareElement(parseBoolean(json.get("freeToShare").getAsBoolean()));
3977    if (json.has("_freeToShare"))
3978      parseElementProperties(getJObject(json, "_freeToShare"), res.getFreeToShareElement());
3979    if (json.has("component")) {
3980      JsonArray array = getJArray(json, "component");
3981      for (int i = 0; i < array.size(); i++) {
3982        res.getComponent().add(parseArtifactAssessmentContentComponent(array.get(i).getAsJsonObject()));
3983      }
3984    };
3985  }
3986
3987  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
3988    AuditEvent res = new AuditEvent();
3989    parseAuditEventProperties(json, res);
3990    return res;
3991  }
3992
3993  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
3994    parseDomainResourceProperties(json, res);
3995    if (json.has("category")) {
3996      JsonArray array = getJArray(json, "category");
3997      for (int i = 0; i < array.size(); i++) {
3998        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3999      }
4000    };
4001    if (json.has("code"))
4002      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4003    if (json.has("action"))
4004      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
4005    if (json.has("_action"))
4006      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
4007    if (json.has("severity"))
4008      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AuditEvent.AuditEventSeverity.NULL, new AuditEvent.AuditEventSeverityEnumFactory()));
4009    if (json.has("_severity"))
4010      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
4011    DataType occurred = parseType("occurred", json);
4012    if (occurred != null)
4013      res.setOccurred(occurred);
4014    if (json.has("recorded"))
4015      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
4016    if (json.has("_recorded"))
4017      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
4018    if (json.has("outcome"))
4019      res.setOutcome(parseAuditEventOutcomeComponent(getJObject(json, "outcome")));
4020    if (json.has("authorization")) {
4021      JsonArray array = getJArray(json, "authorization");
4022      for (int i = 0; i < array.size(); i++) {
4023        res.getAuthorization().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4024      }
4025    };
4026    if (json.has("basedOn")) {
4027      JsonArray array = getJArray(json, "basedOn");
4028      for (int i = 0; i < array.size(); i++) {
4029        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4030      }
4031    };
4032    if (json.has("patient"))
4033      res.setPatient(parseReference(getJObject(json, "patient")));
4034    if (json.has("encounter"))
4035      res.setEncounter(parseReference(getJObject(json, "encounter")));
4036    if (json.has("agent")) {
4037      JsonArray array = getJArray(json, "agent");
4038      for (int i = 0; i < array.size(); i++) {
4039        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
4040      }
4041    };
4042    if (json.has("source"))
4043      res.setSource(parseAuditEventSourceComponent(getJObject(json, "source")));
4044    if (json.has("entity")) {
4045      JsonArray array = getJArray(json, "entity");
4046      for (int i = 0; i < array.size(); i++) {
4047        res.getEntity().add(parseAuditEventEntityComponent(array.get(i).getAsJsonObject()));
4048      }
4049    };
4050  }
4051
4052  protected AuditEvent.AuditEventOutcomeComponent parseAuditEventOutcomeComponent(JsonObject json) throws IOException, FHIRFormatError {
4053    AuditEvent.AuditEventOutcomeComponent res = new AuditEvent.AuditEventOutcomeComponent();
4054    parseAuditEventOutcomeComponentProperties(json, res);
4055    return res;
4056  }
4057
4058  protected void parseAuditEventOutcomeComponentProperties(JsonObject json, AuditEvent.AuditEventOutcomeComponent res) throws IOException, FHIRFormatError {
4059    parseBackboneElementProperties(json, res);
4060    if (json.has("code"))
4061      res.setCode(parseCoding(getJObject(json, "code")));
4062    if (json.has("detail")) {
4063      JsonArray array = getJArray(json, "detail");
4064      for (int i = 0; i < array.size(); i++) {
4065        res.getDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4066      }
4067    };
4068  }
4069
4070  protected AuditEvent.AuditEventAgentComponent parseAuditEventAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
4071    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
4072    parseAuditEventAgentComponentProperties(json, res);
4073    return res;
4074  }
4075
4076  protected void parseAuditEventAgentComponentProperties(JsonObject json, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
4077    parseBackboneElementProperties(json, res);
4078    if (json.has("type"))
4079      res.setType(parseCodeableConcept(getJObject(json, "type")));
4080    if (json.has("role")) {
4081      JsonArray array = getJArray(json, "role");
4082      for (int i = 0; i < array.size(); i++) {
4083        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4084      }
4085    };
4086    if (json.has("who"))
4087      res.setWho(parseReference(getJObject(json, "who")));
4088    if (json.has("requestor"))
4089      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
4090    if (json.has("_requestor"))
4091      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
4092    if (json.has("location"))
4093      res.setLocation(parseReference(getJObject(json, "location")));
4094    if (json.has("policy")) {
4095      JsonArray array = getJArray(json, "policy");
4096      for (int i = 0; i < array.size(); i++) {
4097        if (array.get(i).isJsonNull()) {
4098          res.getPolicy().add(new UriType());
4099        } else {;
4100          res.getPolicy().add(parseUri(array.get(i).getAsString()));
4101        }
4102      }
4103    };
4104    if (json.has("_policy")) {
4105      JsonArray array = getJArray(json, "_policy");
4106      for (int i = 0; i < array.size(); i++) {
4107        if (i == res.getPolicy().size())
4108          res.getPolicy().add(parseUri(null));
4109        if (array.get(i) instanceof JsonObject) 
4110          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
4111      }
4112    };
4113    DataType network = parseType("network", json);
4114    if (network != null)
4115      res.setNetwork(network);
4116    if (json.has("authorization")) {
4117      JsonArray array = getJArray(json, "authorization");
4118      for (int i = 0; i < array.size(); i++) {
4119        res.getAuthorization().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4120      }
4121    };
4122  }
4123
4124  protected AuditEvent.AuditEventSourceComponent parseAuditEventSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
4125    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
4126    parseAuditEventSourceComponentProperties(json, res);
4127    return res;
4128  }
4129
4130  protected void parseAuditEventSourceComponentProperties(JsonObject json, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
4131    parseBackboneElementProperties(json, res);
4132    if (json.has("site"))
4133      res.setSite(parseReference(getJObject(json, "site")));
4134    if (json.has("observer"))
4135      res.setObserver(parseReference(getJObject(json, "observer")));
4136    if (json.has("type")) {
4137      JsonArray array = getJArray(json, "type");
4138      for (int i = 0; i < array.size(); i++) {
4139        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4140      }
4141    };
4142  }
4143
4144  protected AuditEvent.AuditEventEntityComponent parseAuditEventEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
4145    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
4146    parseAuditEventEntityComponentProperties(json, res);
4147    return res;
4148  }
4149
4150  protected void parseAuditEventEntityComponentProperties(JsonObject json, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
4151    parseBackboneElementProperties(json, res);
4152    if (json.has("what"))
4153      res.setWhat(parseReference(getJObject(json, "what")));
4154    if (json.has("role"))
4155      res.setRole(parseCodeableConcept(getJObject(json, "role")));
4156    if (json.has("securityLabel")) {
4157      JsonArray array = getJArray(json, "securityLabel");
4158      for (int i = 0; i < array.size(); i++) {
4159        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4160      }
4161    };
4162    if (json.has("query"))
4163      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
4164    if (json.has("_query"))
4165      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
4166    if (json.has("detail")) {
4167      JsonArray array = getJArray(json, "detail");
4168      for (int i = 0; i < array.size(); i++) {
4169        res.getDetail().add(parseAuditEventEntityDetailComponent(array.get(i).getAsJsonObject()));
4170      }
4171    };
4172    if (json.has("agent")) {
4173      JsonArray array = getJArray(json, "agent");
4174      for (int i = 0; i < array.size(); i++) {
4175        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
4176      }
4177    };
4178  }
4179
4180  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventEntityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
4181    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
4182    parseAuditEventEntityDetailComponentProperties(json, res);
4183    return res;
4184  }
4185
4186  protected void parseAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
4187    parseBackboneElementProperties(json, res);
4188    if (json.has("type"))
4189      res.setType(parseCodeableConcept(getJObject(json, "type")));
4190    DataType value = parseType("value", json);
4191    if (value != null)
4192      res.setValue(value);
4193  }
4194
4195  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
4196    Basic res = new Basic();
4197    parseBasicProperties(json, res);
4198    return res;
4199  }
4200
4201  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
4202    parseDomainResourceProperties(json, res);
4203    if (json.has("identifier")) {
4204      JsonArray array = getJArray(json, "identifier");
4205      for (int i = 0; i < array.size(); i++) {
4206        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4207      }
4208    };
4209    if (json.has("code"))
4210      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4211    if (json.has("subject"))
4212      res.setSubject(parseReference(getJObject(json, "subject")));
4213    if (json.has("created"))
4214      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4215    if (json.has("_created"))
4216      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4217    if (json.has("author"))
4218      res.setAuthor(parseReference(getJObject(json, "author")));
4219  }
4220
4221  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
4222    Binary res = new Binary();
4223    parseBinaryProperties(json, res);
4224    return res;
4225  }
4226
4227  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
4228    parseResourceProperties(json, res);
4229    if (json.has("contentType"))
4230      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
4231    if (json.has("_contentType"))
4232      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
4233    if (json.has("securityContext"))
4234      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
4235    if (json.has("data"))
4236      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
4237    if (json.has("_data"))
4238      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
4239  }
4240
4241  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
4242    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
4243    parseBiologicallyDerivedProductProperties(json, res);
4244    return res;
4245  }
4246
4247  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
4248    parseDomainResourceProperties(json, res);
4249    if (json.has("productCategory"))
4250      res.setProductCategory(parseCoding(getJObject(json, "productCategory")));
4251    if (json.has("productCode"))
4252      res.setProductCode(parseCodeableConcept(getJObject(json, "productCode")));
4253    if (json.has("parent")) {
4254      JsonArray array = getJArray(json, "parent");
4255      for (int i = 0; i < array.size(); i++) {
4256        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
4257      }
4258    };
4259    if (json.has("request")) {
4260      JsonArray array = getJArray(json, "request");
4261      for (int i = 0; i < array.size(); i++) {
4262        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
4263      }
4264    };
4265    if (json.has("identifier")) {
4266      JsonArray array = getJArray(json, "identifier");
4267      for (int i = 0; i < array.size(); i++) {
4268        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4269      }
4270    };
4271    if (json.has("biologicalSourceEvent"))
4272      res.setBiologicalSourceEvent(parseIdentifier(getJObject(json, "biologicalSourceEvent")));
4273    if (json.has("processingFacility")) {
4274      JsonArray array = getJArray(json, "processingFacility");
4275      for (int i = 0; i < array.size(); i++) {
4276        res.getProcessingFacility().add(parseReference(array.get(i).getAsJsonObject()));
4277      }
4278    };
4279    if (json.has("division"))
4280      res.setDivisionElement(parseString(json.get("division").getAsString()));
4281    if (json.has("_division"))
4282      parseElementProperties(getJObject(json, "_division"), res.getDivisionElement());
4283    if (json.has("productStatus"))
4284      res.setProductStatus(parseCoding(getJObject(json, "productStatus")));
4285    if (json.has("expirationDate"))
4286      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
4287    if (json.has("_expirationDate"))
4288      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
4289    if (json.has("collection"))
4290      res.setCollection(parseBiologicallyDerivedProductCollectionComponent(getJObject(json, "collection")));
4291    if (json.has("storageTempRequirements"))
4292      res.setStorageTempRequirements(parseRange(getJObject(json, "storageTempRequirements")));
4293    if (json.has("property")) {
4294      JsonArray array = getJArray(json, "property");
4295      for (int i = 0; i < array.size(); i++) {
4296        res.getProperty().add(parseBiologicallyDerivedProductPropertyComponent(array.get(i).getAsJsonObject()));
4297      }
4298    };
4299  }
4300
4301  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
4302    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
4303    parseBiologicallyDerivedProductCollectionComponentProperties(json, res);
4304    return res;
4305  }
4306
4307  protected void parseBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
4308    parseBackboneElementProperties(json, res);
4309    if (json.has("collector"))
4310      res.setCollector(parseReference(getJObject(json, "collector")));
4311    if (json.has("source"))
4312      res.setSource(parseReference(getJObject(json, "source")));
4313    DataType collected = parseType("collected", json);
4314    if (collected != null)
4315      res.setCollected(collected);
4316  }
4317
4318  protected BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent parseBiologicallyDerivedProductPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
4319    BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent();
4320    parseBiologicallyDerivedProductPropertyComponentProperties(json, res);
4321    return res;
4322  }
4323
4324  protected void parseBiologicallyDerivedProductPropertyComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res) throws IOException, FHIRFormatError {
4325    parseBackboneElementProperties(json, res);
4326    if (json.has("type"))
4327      res.setType(parseCodeableConcept(getJObject(json, "type")));
4328    DataType value = parseType("value", json);
4329    if (value != null)
4330      res.setValue(value);
4331  }
4332
4333  protected BiologicallyDerivedProductDispense parseBiologicallyDerivedProductDispense(JsonObject json) throws IOException, FHIRFormatError {
4334    BiologicallyDerivedProductDispense res = new BiologicallyDerivedProductDispense();
4335    parseBiologicallyDerivedProductDispenseProperties(json, res);
4336    return res;
4337  }
4338
4339  protected void parseBiologicallyDerivedProductDispenseProperties(JsonObject json, BiologicallyDerivedProductDispense res) throws IOException, FHIRFormatError {
4340    parseDomainResourceProperties(json, res);
4341    if (json.has("identifier")) {
4342      JsonArray array = getJArray(json, "identifier");
4343      for (int i = 0; i < array.size(); i++) {
4344        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4345      }
4346    };
4347    if (json.has("basedOn")) {
4348      JsonArray array = getJArray(json, "basedOn");
4349      for (int i = 0; i < array.size(); i++) {
4350        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4351      }
4352    };
4353    if (json.has("partOf")) {
4354      JsonArray array = getJArray(json, "partOf");
4355      for (int i = 0; i < array.size(); i++) {
4356        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4357      }
4358    };
4359    if (json.has("status"))
4360      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispenseCodes.NULL, new BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispenseCodesEnumFactory()));
4361    if (json.has("_status"))
4362      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4363    if (json.has("originRelationshipType"))
4364      res.setOriginRelationshipType(parseCodeableConcept(getJObject(json, "originRelationshipType")));
4365    if (json.has("product"))
4366      res.setProduct(parseReference(getJObject(json, "product")));
4367    if (json.has("patient"))
4368      res.setPatient(parseReference(getJObject(json, "patient")));
4369    if (json.has("matchStatus"))
4370      res.setMatchStatus(parseCodeableConcept(getJObject(json, "matchStatus")));
4371    if (json.has("performer")) {
4372      JsonArray array = getJArray(json, "performer");
4373      for (int i = 0; i < array.size(); i++) {
4374        res.getPerformer().add(parseBiologicallyDerivedProductDispensePerformerComponent(array.get(i).getAsJsonObject()));
4375      }
4376    };
4377    if (json.has("location"))
4378      res.setLocation(parseReference(getJObject(json, "location")));
4379    if (json.has("quantity"))
4380      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4381    if (json.has("preparedDate"))
4382      res.setPreparedDateElement(parseDateTime(json.get("preparedDate").getAsString()));
4383    if (json.has("_preparedDate"))
4384      parseElementProperties(getJObject(json, "_preparedDate"), res.getPreparedDateElement());
4385    if (json.has("whenHandedOver"))
4386      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
4387    if (json.has("_whenHandedOver"))
4388      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
4389    if (json.has("destination"))
4390      res.setDestination(parseReference(getJObject(json, "destination")));
4391    if (json.has("note")) {
4392      JsonArray array = getJArray(json, "note");
4393      for (int i = 0; i < array.size(); i++) {
4394        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4395      }
4396    };
4397    if (json.has("usageInstruction"))
4398      res.setUsageInstructionElement(parseString(json.get("usageInstruction").getAsString()));
4399    if (json.has("_usageInstruction"))
4400      parseElementProperties(getJObject(json, "_usageInstruction"), res.getUsageInstructionElement());
4401  }
4402
4403  protected BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent parseBiologicallyDerivedProductDispensePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
4404    BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent res = new BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent();
4405    parseBiologicallyDerivedProductDispensePerformerComponentProperties(json, res);
4406    return res;
4407  }
4408
4409  protected void parseBiologicallyDerivedProductDispensePerformerComponentProperties(JsonObject json, BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent res) throws IOException, FHIRFormatError {
4410    parseBackboneElementProperties(json, res);
4411    if (json.has("function"))
4412      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
4413    if (json.has("actor"))
4414      res.setActor(parseReference(getJObject(json, "actor")));
4415  }
4416
4417  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
4418    BodyStructure res = new BodyStructure();
4419    parseBodyStructureProperties(json, res);
4420    return res;
4421  }
4422
4423  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
4424    parseDomainResourceProperties(json, res);
4425    if (json.has("identifier")) {
4426      JsonArray array = getJArray(json, "identifier");
4427      for (int i = 0; i < array.size(); i++) {
4428        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4429      }
4430    };
4431    if (json.has("active"))
4432      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
4433    if (json.has("_active"))
4434      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
4435    if (json.has("morphology"))
4436      res.setMorphology(parseCodeableConcept(getJObject(json, "morphology")));
4437    if (json.has("includedStructure")) {
4438      JsonArray array = getJArray(json, "includedStructure");
4439      for (int i = 0; i < array.size(); i++) {
4440        res.getIncludedStructure().add(parseBodyStructureIncludedStructureComponent(array.get(i).getAsJsonObject()));
4441      }
4442    };
4443    if (json.has("excludedStructure")) {
4444      JsonArray array = getJArray(json, "excludedStructure");
4445      for (int i = 0; i < array.size(); i++) {
4446        res.getExcludedStructure().add(parseBodyStructureIncludedStructureComponent(array.get(i).getAsJsonObject()));
4447      }
4448    };
4449    if (json.has("description"))
4450      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4451    if (json.has("_description"))
4452      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4453    if (json.has("image")) {
4454      JsonArray array = getJArray(json, "image");
4455      for (int i = 0; i < array.size(); i++) {
4456        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
4457      }
4458    };
4459    if (json.has("patient"))
4460      res.setPatient(parseReference(getJObject(json, "patient")));
4461  }
4462
4463  protected BodyStructure.BodyStructureIncludedStructureComponent parseBodyStructureIncludedStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
4464    BodyStructure.BodyStructureIncludedStructureComponent res = new BodyStructure.BodyStructureIncludedStructureComponent();
4465    parseBodyStructureIncludedStructureComponentProperties(json, res);
4466    return res;
4467  }
4468
4469  protected void parseBodyStructureIncludedStructureComponentProperties(JsonObject json, BodyStructure.BodyStructureIncludedStructureComponent res) throws IOException, FHIRFormatError {
4470    parseBackboneElementProperties(json, res);
4471    if (json.has("structure"))
4472      res.setStructure(parseCodeableConcept(getJObject(json, "structure")));
4473    if (json.has("laterality"))
4474      res.setLaterality(parseCodeableConcept(getJObject(json, "laterality")));
4475    if (json.has("bodyLandmarkOrientation")) {
4476      JsonArray array = getJArray(json, "bodyLandmarkOrientation");
4477      for (int i = 0; i < array.size(); i++) {
4478        res.getBodyLandmarkOrientation().add(parseBodyStructureIncludedStructureBodyLandmarkOrientationComponent(array.get(i).getAsJsonObject()));
4479      }
4480    };
4481    if (json.has("spatialReference")) {
4482      JsonArray array = getJArray(json, "spatialReference");
4483      for (int i = 0; i < array.size(); i++) {
4484        res.getSpatialReference().add(parseReference(array.get(i).getAsJsonObject()));
4485      }
4486    };
4487    if (json.has("qualifier")) {
4488      JsonArray array = getJArray(json, "qualifier");
4489      for (int i = 0; i < array.size(); i++) {
4490        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4491      }
4492    };
4493  }
4494
4495  protected BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent parseBodyStructureIncludedStructureBodyLandmarkOrientationComponent(JsonObject json) throws IOException, FHIRFormatError {
4496    BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent res = new BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent();
4497    parseBodyStructureIncludedStructureBodyLandmarkOrientationComponentProperties(json, res);
4498    return res;
4499  }
4500
4501  protected void parseBodyStructureIncludedStructureBodyLandmarkOrientationComponentProperties(JsonObject json, BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent res) throws IOException, FHIRFormatError {
4502    parseBackboneElementProperties(json, res);
4503    if (json.has("landmarkDescription")) {
4504      JsonArray array = getJArray(json, "landmarkDescription");
4505      for (int i = 0; i < array.size(); i++) {
4506        res.getLandmarkDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4507      }
4508    };
4509    if (json.has("clockFacePosition")) {
4510      JsonArray array = getJArray(json, "clockFacePosition");
4511      for (int i = 0; i < array.size(); i++) {
4512        res.getClockFacePosition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4513      }
4514    };
4515    if (json.has("distanceFromLandmark")) {
4516      JsonArray array = getJArray(json, "distanceFromLandmark");
4517      for (int i = 0; i < array.size(); i++) {
4518        res.getDistanceFromLandmark().add(parseBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent(array.get(i).getAsJsonObject()));
4519      }
4520    };
4521    if (json.has("surfaceOrientation")) {
4522      JsonArray array = getJArray(json, "surfaceOrientation");
4523      for (int i = 0; i < array.size(); i++) {
4524        res.getSurfaceOrientation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4525      }
4526    };
4527  }
4528
4529  protected BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent parseBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent(JsonObject json) throws IOException, FHIRFormatError {
4530    BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent res = new BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent();
4531    parseBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponentProperties(json, res);
4532    return res;
4533  }
4534
4535  protected void parseBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponentProperties(JsonObject json, BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent res) throws IOException, FHIRFormatError {
4536    parseBackboneElementProperties(json, res);
4537    if (json.has("device")) {
4538      JsonArray array = getJArray(json, "device");
4539      for (int i = 0; i < array.size(); i++) {
4540        res.getDevice().add(parseCodeableReference(array.get(i).getAsJsonObject()));
4541      }
4542    };
4543    if (json.has("value")) {
4544      JsonArray array = getJArray(json, "value");
4545      for (int i = 0; i < array.size(); i++) {
4546        res.getValue().add(parseQuantity(array.get(i).getAsJsonObject()));
4547      }
4548    };
4549  }
4550
4551  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
4552    Bundle res = new Bundle();
4553    parseBundleProperties(json, res);
4554    return res;
4555  }
4556
4557  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
4558    parseResourceProperties(json, res);
4559    if (json.has("identifier"))
4560      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
4561    if (json.has("type"))
4562      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
4563    if (json.has("_type"))
4564      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4565    if (json.has("timestamp"))
4566      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
4567    if (json.has("_timestamp"))
4568      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
4569    if (json.has("total"))
4570      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
4571    if (json.has("_total"))
4572      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
4573    if (json.has("link")) {
4574      JsonArray array = getJArray(json, "link");
4575      for (int i = 0; i < array.size(); i++) {
4576        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
4577      }
4578    };
4579    if (json.has("entry")) {
4580      JsonArray array = getJArray(json, "entry");
4581      for (int i = 0; i < array.size(); i++) {
4582        res.getEntry().add(parseBundleEntryComponent(array.get(i).getAsJsonObject()));
4583      }
4584    };
4585    if (json.has("signature"))
4586      res.setSignature(parseSignature(getJObject(json, "signature")));
4587    if (json.has("issues"))
4588      res.setIssues(parseResource(getJObject(json, "issues")));
4589  }
4590
4591  protected Bundle.BundleLinkComponent parseBundleLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
4592    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
4593    parseBundleLinkComponentProperties(json, res);
4594    return res;
4595  }
4596
4597  protected void parseBundleLinkComponentProperties(JsonObject json, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
4598    parseBackboneElementProperties(json, res);
4599    if (json.has("relation"))
4600      res.setRelationElement(parseEnumeration(json.get("relation").getAsString(), Bundle.LinkRelationTypes.NULL, new Bundle.LinkRelationTypesEnumFactory()));
4601    if (json.has("_relation"))
4602      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
4603    if (json.has("url"))
4604      res.setUrlElement(parseUri(json.get("url").getAsString()));
4605    if (json.has("_url"))
4606      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4607  }
4608
4609  protected Bundle.BundleEntryComponent parseBundleEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
4610    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
4611    parseBundleEntryComponentProperties(json, res);
4612    return res;
4613  }
4614
4615  protected void parseBundleEntryComponentProperties(JsonObject json, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
4616    parseBackboneElementProperties(json, res);
4617    if (json.has("link")) {
4618      JsonArray array = getJArray(json, "link");
4619      for (int i = 0; i < array.size(); i++) {
4620        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
4621      }
4622    };
4623    if (json.has("fullUrl"))
4624      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
4625    if (json.has("_fullUrl"))
4626      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
4627    if (json.has("resource"))
4628      res.setResource(parseResource(getJObject(json, "resource")));
4629    if (json.has("search"))
4630      res.setSearch(parseBundleEntrySearchComponent(getJObject(json, "search")));
4631    if (json.has("request"))
4632      res.setRequest(parseBundleEntryRequestComponent(getJObject(json, "request")));
4633    if (json.has("response"))
4634      res.setResponse(parseBundleEntryResponseComponent(getJObject(json, "response")));
4635  }
4636
4637  protected Bundle.BundleEntrySearchComponent parseBundleEntrySearchComponent(JsonObject json) throws IOException, FHIRFormatError {
4638    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
4639    parseBundleEntrySearchComponentProperties(json, res);
4640    return res;
4641  }
4642
4643  protected void parseBundleEntrySearchComponentProperties(JsonObject json, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
4644    parseBackboneElementProperties(json, res);
4645    if (json.has("mode"))
4646      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
4647    if (json.has("_mode"))
4648      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4649    if (json.has("score"))
4650      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
4651    if (json.has("_score"))
4652      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
4653  }
4654
4655  protected Bundle.BundleEntryRequestComponent parseBundleEntryRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
4656    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
4657    parseBundleEntryRequestComponentProperties(json, res);
4658    return res;
4659  }
4660
4661  protected void parseBundleEntryRequestComponentProperties(JsonObject json, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
4662    parseBackboneElementProperties(json, res);
4663    if (json.has("method"))
4664      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
4665    if (json.has("_method"))
4666      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
4667    if (json.has("url"))
4668      res.setUrlElement(parseUri(json.get("url").getAsString()));
4669    if (json.has("_url"))
4670      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4671    if (json.has("ifNoneMatch"))
4672      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
4673    if (json.has("_ifNoneMatch"))
4674      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
4675    if (json.has("ifModifiedSince"))
4676      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
4677    if (json.has("_ifModifiedSince"))
4678      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
4679    if (json.has("ifMatch"))
4680      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
4681    if (json.has("_ifMatch"))
4682      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
4683    if (json.has("ifNoneExist"))
4684      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
4685    if (json.has("_ifNoneExist"))
4686      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
4687  }
4688
4689  protected Bundle.BundleEntryResponseComponent parseBundleEntryResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
4690    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
4691    parseBundleEntryResponseComponentProperties(json, res);
4692    return res;
4693  }
4694
4695  protected void parseBundleEntryResponseComponentProperties(JsonObject json, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
4696    parseBackboneElementProperties(json, res);
4697    if (json.has("status"))
4698      res.setStatusElement(parseString(json.get("status").getAsString()));
4699    if (json.has("_status"))
4700      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4701    if (json.has("location"))
4702      res.setLocationElement(parseUri(json.get("location").getAsString()));
4703    if (json.has("_location"))
4704      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
4705    if (json.has("etag"))
4706      res.setEtagElement(parseString(json.get("etag").getAsString()));
4707    if (json.has("_etag"))
4708      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
4709    if (json.has("lastModified"))
4710      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
4711    if (json.has("_lastModified"))
4712      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
4713    if (json.has("outcome"))
4714      res.setOutcome(parseResource(getJObject(json, "outcome")));
4715  }
4716
4717  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
4718    CapabilityStatement res = new CapabilityStatement();
4719    parseCapabilityStatementProperties(json, res);
4720    return res;
4721  }
4722
4723  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
4724    parseCanonicalResourceProperties(json, res);
4725    if (json.has("url"))
4726      res.setUrlElement(parseUri(json.get("url").getAsString()));
4727    if (json.has("_url"))
4728      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4729    if (json.has("identifier")) {
4730      JsonArray array = getJArray(json, "identifier");
4731      for (int i = 0; i < array.size(); i++) {
4732        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4733      }
4734    };
4735    if (json.has("version"))
4736      res.setVersionElement(parseString(json.get("version").getAsString()));
4737    if (json.has("_version"))
4738      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4739    DataType versionAlgorithm = parseType("versionAlgorithm", json);
4740    if (versionAlgorithm != null)
4741      res.setVersionAlgorithm(versionAlgorithm);
4742    if (json.has("name"))
4743      res.setNameElement(parseString(json.get("name").getAsString()));
4744    if (json.has("_name"))
4745      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4746    if (json.has("title"))
4747      res.setTitleElement(parseString(json.get("title").getAsString()));
4748    if (json.has("_title"))
4749      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4750    if (json.has("status"))
4751      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4752    if (json.has("_status"))
4753      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4754    if (json.has("experimental"))
4755      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4756    if (json.has("_experimental"))
4757      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
4758    if (json.has("date"))
4759      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4760    if (json.has("_date"))
4761      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4762    if (json.has("publisher"))
4763      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4764    if (json.has("_publisher"))
4765      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
4766    if (json.has("contact")) {
4767      JsonArray array = getJArray(json, "contact");
4768      for (int i = 0; i < array.size(); i++) {
4769        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4770      }
4771    };
4772    if (json.has("description"))
4773      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4774    if (json.has("_description"))
4775      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4776    if (json.has("useContext")) {
4777      JsonArray array = getJArray(json, "useContext");
4778      for (int i = 0; i < array.size(); i++) {
4779        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4780      }
4781    };
4782    if (json.has("jurisdiction")) {
4783      JsonArray array = getJArray(json, "jurisdiction");
4784      for (int i = 0; i < array.size(); i++) {
4785        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4786      }
4787    };
4788    if (json.has("purpose"))
4789      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
4790    if (json.has("_purpose"))
4791      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
4792    if (json.has("copyright"))
4793      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4794    if (json.has("_copyright"))
4795      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
4796    if (json.has("copyrightLabel"))
4797      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
4798    if (json.has("_copyrightLabel"))
4799      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
4800    if (json.has("kind"))
4801      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
4802    if (json.has("_kind"))
4803      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
4804    if (json.has("instantiates")) {
4805      JsonArray array = getJArray(json, "instantiates");
4806      for (int i = 0; i < array.size(); i++) {
4807        if (array.get(i).isJsonNull()) {
4808          res.getInstantiates().add(new CanonicalType());
4809        } else {;
4810          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
4811        }
4812      }
4813    };
4814    if (json.has("_instantiates")) {
4815      JsonArray array = getJArray(json, "_instantiates");
4816      for (int i = 0; i < array.size(); i++) {
4817        if (i == res.getInstantiates().size())
4818          res.getInstantiates().add(parseCanonical(null));
4819        if (array.get(i) instanceof JsonObject) 
4820          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
4821      }
4822    };
4823    if (json.has("imports")) {
4824      JsonArray array = getJArray(json, "imports");
4825      for (int i = 0; i < array.size(); i++) {
4826        if (array.get(i).isJsonNull()) {
4827          res.getImports().add(new CanonicalType());
4828        } else {;
4829          res.getImports().add(parseCanonical(array.get(i).getAsString()));
4830        }
4831      }
4832    };
4833    if (json.has("_imports")) {
4834      JsonArray array = getJArray(json, "_imports");
4835      for (int i = 0; i < array.size(); i++) {
4836        if (i == res.getImports().size())
4837          res.getImports().add(parseCanonical(null));
4838        if (array.get(i) instanceof JsonObject) 
4839          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
4840      }
4841    };
4842    if (json.has("software"))
4843      res.setSoftware(parseCapabilityStatementSoftwareComponent(getJObject(json, "software")));
4844    if (json.has("implementation"))
4845      res.setImplementation(parseCapabilityStatementImplementationComponent(getJObject(json, "implementation")));
4846    if (json.has("fhirVersion"))
4847      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
4848    if (json.has("_fhirVersion"))
4849      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
4850    if (json.has("format")) {
4851      JsonArray array = getJArray(json, "format");
4852      for (int i = 0; i < array.size(); i++) {
4853        if (array.get(i).isJsonNull()) {
4854          res.getFormat().add(new CodeType());
4855        } else {;
4856          res.getFormat().add(parseCode(array.get(i).getAsString()));
4857        }
4858      }
4859    };
4860    if (json.has("_format")) {
4861      JsonArray array = getJArray(json, "_format");
4862      for (int i = 0; i < array.size(); i++) {
4863        if (i == res.getFormat().size())
4864          res.getFormat().add(parseCode(null));
4865        if (array.get(i) instanceof JsonObject) 
4866          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
4867      }
4868    };
4869    if (json.has("patchFormat")) {
4870      JsonArray array = getJArray(json, "patchFormat");
4871      for (int i = 0; i < array.size(); i++) {
4872        if (array.get(i).isJsonNull()) {
4873          res.getPatchFormat().add(new CodeType());
4874        } else {;
4875          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
4876        }
4877      }
4878    };
4879    if (json.has("_patchFormat")) {
4880      JsonArray array = getJArray(json, "_patchFormat");
4881      for (int i = 0; i < array.size(); i++) {
4882        if (i == res.getPatchFormat().size())
4883          res.getPatchFormat().add(parseCode(null));
4884        if (array.get(i) instanceof JsonObject) 
4885          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
4886      }
4887    };
4888    if (json.has("acceptLanguage")) {
4889      JsonArray array = getJArray(json, "acceptLanguage");
4890      for (int i = 0; i < array.size(); i++) {
4891        if (array.get(i).isJsonNull()) {
4892          res.getAcceptLanguage().add(new CodeType());
4893        } else {;
4894          res.getAcceptLanguage().add(parseCode(array.get(i).getAsString()));
4895        }
4896      }
4897    };
4898    if (json.has("_acceptLanguage")) {
4899      JsonArray array = getJArray(json, "_acceptLanguage");
4900      for (int i = 0; i < array.size(); i++) {
4901        if (i == res.getAcceptLanguage().size())
4902          res.getAcceptLanguage().add(parseCode(null));
4903        if (array.get(i) instanceof JsonObject) 
4904          parseElementProperties(array.get(i).getAsJsonObject(), res.getAcceptLanguage().get(i));
4905      }
4906    };
4907    if (json.has("implementationGuide")) {
4908      JsonArray array = getJArray(json, "implementationGuide");
4909      for (int i = 0; i < array.size(); i++) {
4910        if (array.get(i).isJsonNull()) {
4911          res.getImplementationGuide().add(new CanonicalType());
4912        } else {;
4913          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
4914        }
4915      }
4916    };
4917    if (json.has("_implementationGuide")) {
4918      JsonArray array = getJArray(json, "_implementationGuide");
4919      for (int i = 0; i < array.size(); i++) {
4920        if (i == res.getImplementationGuide().size())
4921          res.getImplementationGuide().add(parseCanonical(null));
4922        if (array.get(i) instanceof JsonObject) 
4923          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
4924      }
4925    };
4926    if (json.has("rest")) {
4927      JsonArray array = getJArray(json, "rest");
4928      for (int i = 0; i < array.size(); i++) {
4929        res.getRest().add(parseCapabilityStatementRestComponent(array.get(i).getAsJsonObject()));
4930      }
4931    };
4932    if (json.has("messaging")) {
4933      JsonArray array = getJArray(json, "messaging");
4934      for (int i = 0; i < array.size(); i++) {
4935        res.getMessaging().add(parseCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject()));
4936      }
4937    };
4938    if (json.has("document")) {
4939      JsonArray array = getJArray(json, "document");
4940      for (int i = 0; i < array.size(); i++) {
4941        res.getDocument().add(parseCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject()));
4942      }
4943    };
4944  }
4945
4946  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
4947    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
4948    parseCapabilityStatementSoftwareComponentProperties(json, res);
4949    return res;
4950  }
4951
4952  protected void parseCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
4953    parseBackboneElementProperties(json, res);
4954    if (json.has("name"))
4955      res.setNameElement(parseString(json.get("name").getAsString()));
4956    if (json.has("_name"))
4957      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4958    if (json.has("version"))
4959      res.setVersionElement(parseString(json.get("version").getAsString()));
4960    if (json.has("_version"))
4961      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4962    if (json.has("releaseDate"))
4963      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4964    if (json.has("_releaseDate"))
4965      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
4966  }
4967
4968  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
4969    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
4970    parseCapabilityStatementImplementationComponentProperties(json, res);
4971    return res;
4972  }
4973
4974  protected void parseCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
4975    parseBackboneElementProperties(json, res);
4976    if (json.has("description"))
4977      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4978    if (json.has("_description"))
4979      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4980    if (json.has("url"))
4981      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4982    if (json.has("_url"))
4983      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4984    if (json.has("custodian"))
4985      res.setCustodian(parseReference(getJObject(json, "custodian")));
4986  }
4987
4988  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementRestComponent(JsonObject json) throws IOException, FHIRFormatError {
4989    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
4990    parseCapabilityStatementRestComponentProperties(json, res);
4991    return res;
4992  }
4993
4994  protected void parseCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
4995    parseBackboneElementProperties(json, res);
4996    if (json.has("mode"))
4997      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
4998    if (json.has("_mode"))
4999      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
5000    if (json.has("documentation"))
5001      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5002    if (json.has("_documentation"))
5003      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5004    if (json.has("security"))
5005      res.setSecurity(parseCapabilityStatementRestSecurityComponent(getJObject(json, "security")));
5006    if (json.has("resource")) {
5007      JsonArray array = getJArray(json, "resource");
5008      for (int i = 0; i < array.size(); i++) {
5009        res.getResource().add(parseCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject()));
5010      }
5011    };
5012    if (json.has("interaction")) {
5013      JsonArray array = getJArray(json, "interaction");
5014      for (int i = 0; i < array.size(); i++) {
5015        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject()));
5016      }
5017    };
5018    if (json.has("searchParam")) {
5019      JsonArray array = getJArray(json, "searchParam");
5020      for (int i = 0; i < array.size(); i++) {
5021        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
5022      }
5023    };
5024    if (json.has("operation")) {
5025      JsonArray array = getJArray(json, "operation");
5026      for (int i = 0; i < array.size(); i++) {
5027        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
5028      }
5029    };
5030    if (json.has("compartment")) {
5031      JsonArray array = getJArray(json, "compartment");
5032      for (int i = 0; i < array.size(); i++) {
5033        if (array.get(i).isJsonNull()) {
5034          res.getCompartment().add(new CanonicalType());
5035        } else {;
5036          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
5037        }
5038      }
5039    };
5040    if (json.has("_compartment")) {
5041      JsonArray array = getJArray(json, "_compartment");
5042      for (int i = 0; i < array.size(); i++) {
5043        if (i == res.getCompartment().size())
5044          res.getCompartment().add(parseCanonical(null));
5045        if (array.get(i) instanceof JsonObject) 
5046          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
5047      }
5048    };
5049  }
5050
5051  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementRestSecurityComponent(JsonObject json) throws IOException, FHIRFormatError {
5052    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
5053    parseCapabilityStatementRestSecurityComponentProperties(json, res);
5054    return res;
5055  }
5056
5057  protected void parseCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
5058    parseBackboneElementProperties(json, res);
5059    if (json.has("cors"))
5060      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
5061    if (json.has("_cors"))
5062      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
5063    if (json.has("service")) {
5064      JsonArray array = getJArray(json, "service");
5065      for (int i = 0; i < array.size(); i++) {
5066        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5067      }
5068    };
5069    if (json.has("description"))
5070      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5071    if (json.has("_description"))
5072      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5073  }
5074
5075  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementRestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
5076    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
5077    parseCapabilityStatementRestResourceComponentProperties(json, res);
5078    return res;
5079  }
5080
5081  protected void parseCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
5082    parseBackboneElementProperties(json, res);
5083    if (json.has("type"))
5084      res.setTypeElement(parseCode(json.get("type").getAsString()));
5085    if (json.has("_type"))
5086      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5087    if (json.has("profile"))
5088      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
5089    if (json.has("_profile"))
5090      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
5091    if (json.has("supportedProfile")) {
5092      JsonArray array = getJArray(json, "supportedProfile");
5093      for (int i = 0; i < array.size(); i++) {
5094        if (array.get(i).isJsonNull()) {
5095          res.getSupportedProfile().add(new CanonicalType());
5096        } else {;
5097          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
5098        }
5099      }
5100    };
5101    if (json.has("_supportedProfile")) {
5102      JsonArray array = getJArray(json, "_supportedProfile");
5103      for (int i = 0; i < array.size(); i++) {
5104        if (i == res.getSupportedProfile().size())
5105          res.getSupportedProfile().add(parseCanonical(null));
5106        if (array.get(i) instanceof JsonObject) 
5107          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
5108      }
5109    };
5110    if (json.has("documentation"))
5111      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5112    if (json.has("_documentation"))
5113      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5114    if (json.has("interaction")) {
5115      JsonArray array = getJArray(json, "interaction");
5116      for (int i = 0; i < array.size(); i++) {
5117        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject()));
5118      }
5119    };
5120    if (json.has("versioning"))
5121      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
5122    if (json.has("_versioning"))
5123      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
5124    if (json.has("readHistory"))
5125      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
5126    if (json.has("_readHistory"))
5127      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
5128    if (json.has("updateCreate"))
5129      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
5130    if (json.has("_updateCreate"))
5131      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
5132    if (json.has("conditionalCreate"))
5133      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
5134    if (json.has("_conditionalCreate"))
5135      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
5136    if (json.has("conditionalRead"))
5137      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
5138    if (json.has("_conditionalRead"))
5139      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
5140    if (json.has("conditionalUpdate"))
5141      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
5142    if (json.has("_conditionalUpdate"))
5143      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
5144    if (json.has("conditionalPatch"))
5145      res.setConditionalPatchElement(parseBoolean(json.get("conditionalPatch").getAsBoolean()));
5146    if (json.has("_conditionalPatch"))
5147      parseElementProperties(getJObject(json, "_conditionalPatch"), res.getConditionalPatchElement());
5148    if (json.has("conditionalDelete"))
5149      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
5150    if (json.has("_conditionalDelete"))
5151      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
5152    if (json.has("referencePolicy")) {
5153      JsonArray array = getJArray(json, "referencePolicy");
5154      for (int i = 0; i < array.size(); i++) {
5155        if (array.get(i).isJsonNull()) {
5156          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>(new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), CapabilityStatement.ReferenceHandlingPolicy.NULL));
5157        } else {;
5158          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
5159        }
5160      }
5161    };
5162    if (json.has("_referencePolicy")) {
5163      JsonArray array = getJArray(json, "_referencePolicy");
5164      for (int i = 0; i < array.size(); i++) {
5165        if (i == res.getReferencePolicy().size())
5166          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
5167        if (array.get(i) instanceof JsonObject) 
5168          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
5169      }
5170    };
5171    if (json.has("searchInclude")) {
5172      JsonArray array = getJArray(json, "searchInclude");
5173      for (int i = 0; i < array.size(); i++) {
5174        if (array.get(i).isJsonNull()) {
5175          res.getSearchInclude().add(new StringType());
5176        } else {;
5177          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
5178        }
5179      }
5180    };
5181    if (json.has("_searchInclude")) {
5182      JsonArray array = getJArray(json, "_searchInclude");
5183      for (int i = 0; i < array.size(); i++) {
5184        if (i == res.getSearchInclude().size())
5185          res.getSearchInclude().add(parseString(null));
5186        if (array.get(i) instanceof JsonObject) 
5187          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
5188      }
5189    };
5190    if (json.has("searchRevInclude")) {
5191      JsonArray array = getJArray(json, "searchRevInclude");
5192      for (int i = 0; i < array.size(); i++) {
5193        if (array.get(i).isJsonNull()) {
5194          res.getSearchRevInclude().add(new StringType());
5195        } else {;
5196          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
5197        }
5198      }
5199    };
5200    if (json.has("_searchRevInclude")) {
5201      JsonArray array = getJArray(json, "_searchRevInclude");
5202      for (int i = 0; i < array.size(); i++) {
5203        if (i == res.getSearchRevInclude().size())
5204          res.getSearchRevInclude().add(parseString(null));
5205        if (array.get(i) instanceof JsonObject) 
5206          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
5207      }
5208    };
5209    if (json.has("searchParam")) {
5210      JsonArray array = getJArray(json, "searchParam");
5211      for (int i = 0; i < array.size(); i++) {
5212        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
5213      }
5214    };
5215    if (json.has("operation")) {
5216      JsonArray array = getJArray(json, "operation");
5217      for (int i = 0; i < array.size(); i++) {
5218        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
5219      }
5220    };
5221  }
5222
5223  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
5224    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
5225    parseCapabilityStatementResourceInteractionComponentProperties(json, res);
5226    return res;
5227  }
5228
5229  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
5230    parseBackboneElementProperties(json, res);
5231    if (json.has("code"))
5232      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
5233    if (json.has("_code"))
5234      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5235    if (json.has("documentation"))
5236      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5237    if (json.has("_documentation"))
5238      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5239  }
5240
5241  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementRestResourceSearchParamComponent(JsonObject json) throws IOException, FHIRFormatError {
5242    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
5243    parseCapabilityStatementRestResourceSearchParamComponentProperties(json, res);
5244    return res;
5245  }
5246
5247  protected void parseCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
5248    parseBackboneElementProperties(json, res);
5249    if (json.has("name"))
5250      res.setNameElement(parseString(json.get("name").getAsString()));
5251    if (json.has("_name"))
5252      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5253    if (json.has("definition"))
5254      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
5255    if (json.has("_definition"))
5256      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
5257    if (json.has("type"))
5258      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
5259    if (json.has("_type"))
5260      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5261    if (json.has("documentation"))
5262      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5263    if (json.has("_documentation"))
5264      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5265  }
5266
5267  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementRestResourceOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
5268    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
5269    parseCapabilityStatementRestResourceOperationComponentProperties(json, res);
5270    return res;
5271  }
5272
5273  protected void parseCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
5274    parseBackboneElementProperties(json, res);
5275    if (json.has("name"))
5276      res.setNameElement(parseString(json.get("name").getAsString()));
5277    if (json.has("_name"))
5278      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5279    if (json.has("definition"))
5280      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
5281    if (json.has("_definition"))
5282      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
5283    if (json.has("documentation"))
5284      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5285    if (json.has("_documentation"))
5286      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5287  }
5288
5289  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
5290    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
5291    parseCapabilityStatementSystemInteractionComponentProperties(json, res);
5292    return res;
5293  }
5294
5295  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
5296    parseBackboneElementProperties(json, res);
5297    if (json.has("code"))
5298      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
5299    if (json.has("_code"))
5300      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5301    if (json.has("documentation"))
5302      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5303    if (json.has("_documentation"))
5304      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5305  }
5306
5307  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementMessagingComponent(JsonObject json) throws IOException, FHIRFormatError {
5308    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
5309    parseCapabilityStatementMessagingComponentProperties(json, res);
5310    return res;
5311  }
5312
5313  protected void parseCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
5314    parseBackboneElementProperties(json, res);
5315    if (json.has("endpoint")) {
5316      JsonArray array = getJArray(json, "endpoint");
5317      for (int i = 0; i < array.size(); i++) {
5318        res.getEndpoint().add(parseCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject()));
5319      }
5320    };
5321    if (json.has("reliableCache"))
5322      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
5323    if (json.has("_reliableCache"))
5324      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
5325    if (json.has("documentation"))
5326      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5327    if (json.has("_documentation"))
5328      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5329    if (json.has("supportedMessage")) {
5330      JsonArray array = getJArray(json, "supportedMessage");
5331      for (int i = 0; i < array.size(); i++) {
5332        res.getSupportedMessage().add(parseCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject()));
5333      }
5334    };
5335  }
5336
5337  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementMessagingEndpointComponent(JsonObject json) throws IOException, FHIRFormatError {
5338    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
5339    parseCapabilityStatementMessagingEndpointComponentProperties(json, res);
5340    return res;
5341  }
5342
5343  protected void parseCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
5344    parseBackboneElementProperties(json, res);
5345    if (json.has("protocol"))
5346      res.setProtocol(parseCoding(getJObject(json, "protocol")));
5347    if (json.has("address"))
5348      res.setAddressElement(parseUrl(json.get("address").getAsString()));
5349    if (json.has("_address"))
5350      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
5351  }
5352
5353  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementMessagingSupportedMessageComponent(JsonObject json) throws IOException, FHIRFormatError {
5354    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
5355    parseCapabilityStatementMessagingSupportedMessageComponentProperties(json, res);
5356    return res;
5357  }
5358
5359  protected void parseCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
5360    parseBackboneElementProperties(json, res);
5361    if (json.has("mode"))
5362      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
5363    if (json.has("_mode"))
5364      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
5365    if (json.has("definition"))
5366      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
5367    if (json.has("_definition"))
5368      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
5369  }
5370
5371  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementDocumentComponent(JsonObject json) throws IOException, FHIRFormatError {
5372    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
5373    parseCapabilityStatementDocumentComponentProperties(json, res);
5374    return res;
5375  }
5376
5377  protected void parseCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
5378    parseBackboneElementProperties(json, res);
5379    if (json.has("mode"))
5380      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
5381    if (json.has("_mode"))
5382      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
5383    if (json.has("documentation"))
5384      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5385    if (json.has("_documentation"))
5386      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5387    if (json.has("profile"))
5388      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
5389    if (json.has("_profile"))
5390      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
5391  }
5392
5393  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
5394    CarePlan res = new CarePlan();
5395    parseCarePlanProperties(json, res);
5396    return res;
5397  }
5398
5399  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
5400    parseDomainResourceProperties(json, res);
5401    if (json.has("identifier")) {
5402      JsonArray array = getJArray(json, "identifier");
5403      for (int i = 0; i < array.size(); i++) {
5404        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5405      }
5406    };
5407    if (json.has("instantiatesCanonical")) {
5408      JsonArray array = getJArray(json, "instantiatesCanonical");
5409      for (int i = 0; i < array.size(); i++) {
5410        if (array.get(i).isJsonNull()) {
5411          res.getInstantiatesCanonical().add(new CanonicalType());
5412        } else {;
5413          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
5414        }
5415      }
5416    };
5417    if (json.has("_instantiatesCanonical")) {
5418      JsonArray array = getJArray(json, "_instantiatesCanonical");
5419      for (int i = 0; i < array.size(); i++) {
5420        if (i == res.getInstantiatesCanonical().size())
5421          res.getInstantiatesCanonical().add(parseCanonical(null));
5422        if (array.get(i) instanceof JsonObject) 
5423          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
5424      }
5425    };
5426    if (json.has("instantiatesUri")) {
5427      JsonArray array = getJArray(json, "instantiatesUri");
5428      for (int i = 0; i < array.size(); i++) {
5429        if (array.get(i).isJsonNull()) {
5430          res.getInstantiatesUri().add(new UriType());
5431        } else {;
5432          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
5433        }
5434      }
5435    };
5436    if (json.has("_instantiatesUri")) {
5437      JsonArray array = getJArray(json, "_instantiatesUri");
5438      for (int i = 0; i < array.size(); i++) {
5439        if (i == res.getInstantiatesUri().size())
5440          res.getInstantiatesUri().add(parseUri(null));
5441        if (array.get(i) instanceof JsonObject) 
5442          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
5443      }
5444    };
5445    if (json.has("basedOn")) {
5446      JsonArray array = getJArray(json, "basedOn");
5447      for (int i = 0; i < array.size(); i++) {
5448        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5449      }
5450    };
5451    if (json.has("replaces")) {
5452      JsonArray array = getJArray(json, "replaces");
5453      for (int i = 0; i < array.size(); i++) {
5454        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5455      }
5456    };
5457    if (json.has("partOf")) {
5458      JsonArray array = getJArray(json, "partOf");
5459      for (int i = 0; i < array.size(); i++) {
5460        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5461      }
5462    };
5463    if (json.has("status"))
5464      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
5465    if (json.has("_status"))
5466      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5467    if (json.has("intent"))
5468      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
5469    if (json.has("_intent"))
5470      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
5471    if (json.has("category")) {
5472      JsonArray array = getJArray(json, "category");
5473      for (int i = 0; i < array.size(); i++) {
5474        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5475      }
5476    };
5477    if (json.has("title"))
5478      res.setTitleElement(parseString(json.get("title").getAsString()));
5479    if (json.has("_title"))
5480      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5481    if (json.has("description"))
5482      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5483    if (json.has("_description"))
5484      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5485    if (json.has("subject"))
5486      res.setSubject(parseReference(getJObject(json, "subject")));
5487    if (json.has("encounter"))
5488      res.setEncounter(parseReference(getJObject(json, "encounter")));
5489    if (json.has("period"))
5490      res.setPeriod(parsePeriod(getJObject(json, "period")));
5491    if (json.has("created"))
5492      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5493    if (json.has("_created"))
5494      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
5495    if (json.has("custodian"))
5496      res.setCustodian(parseReference(getJObject(json, "custodian")));
5497    if (json.has("contributor")) {
5498      JsonArray array = getJArray(json, "contributor");
5499      for (int i = 0; i < array.size(); i++) {
5500        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
5501      }
5502    };
5503    if (json.has("careTeam")) {
5504      JsonArray array = getJArray(json, "careTeam");
5505      for (int i = 0; i < array.size(); i++) {
5506        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
5507      }
5508    };
5509    if (json.has("addresses")) {
5510      JsonArray array = getJArray(json, "addresses");
5511      for (int i = 0; i < array.size(); i++) {
5512        res.getAddresses().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5513      }
5514    };
5515    if (json.has("supportingInfo")) {
5516      JsonArray array = getJArray(json, "supportingInfo");
5517      for (int i = 0; i < array.size(); i++) {
5518        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
5519      }
5520    };
5521    if (json.has("goal")) {
5522      JsonArray array = getJArray(json, "goal");
5523      for (int i = 0; i < array.size(); i++) {
5524        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
5525      }
5526    };
5527    if (json.has("activity")) {
5528      JsonArray array = getJArray(json, "activity");
5529      for (int i = 0; i < array.size(); i++) {
5530        res.getActivity().add(parseCarePlanActivityComponent(array.get(i).getAsJsonObject()));
5531      }
5532    };
5533    if (json.has("note")) {
5534      JsonArray array = getJArray(json, "note");
5535      for (int i = 0; i < array.size(); i++) {
5536        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5537      }
5538    };
5539  }
5540
5541  protected CarePlan.CarePlanActivityComponent parseCarePlanActivityComponent(JsonObject json) throws IOException, FHIRFormatError {
5542    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
5543    parseCarePlanActivityComponentProperties(json, res);
5544    return res;
5545  }
5546
5547  protected void parseCarePlanActivityComponentProperties(JsonObject json, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
5548    parseBackboneElementProperties(json, res);
5549    if (json.has("performedActivity")) {
5550      JsonArray array = getJArray(json, "performedActivity");
5551      for (int i = 0; i < array.size(); i++) {
5552        res.getPerformedActivity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5553      }
5554    };
5555    if (json.has("progress")) {
5556      JsonArray array = getJArray(json, "progress");
5557      for (int i = 0; i < array.size(); i++) {
5558        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
5559      }
5560    };
5561    if (json.has("plannedActivityReference"))
5562      res.setPlannedActivityReference(parseReference(getJObject(json, "plannedActivityReference")));
5563  }
5564
5565  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
5566    CareTeam res = new CareTeam();
5567    parseCareTeamProperties(json, res);
5568    return res;
5569  }
5570
5571  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
5572    parseDomainResourceProperties(json, res);
5573    if (json.has("identifier")) {
5574      JsonArray array = getJArray(json, "identifier");
5575      for (int i = 0; i < array.size(); i++) {
5576        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5577      }
5578    };
5579    if (json.has("status"))
5580      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
5581    if (json.has("_status"))
5582      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5583    if (json.has("category")) {
5584      JsonArray array = getJArray(json, "category");
5585      for (int i = 0; i < array.size(); i++) {
5586        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5587      }
5588    };
5589    if (json.has("name"))
5590      res.setNameElement(parseString(json.get("name").getAsString()));
5591    if (json.has("_name"))
5592      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5593    if (json.has("subject"))
5594      res.setSubject(parseReference(getJObject(json, "subject")));
5595    if (json.has("period"))
5596      res.setPeriod(parsePeriod(getJObject(json, "period")));
5597    if (json.has("participant")) {
5598      JsonArray array = getJArray(json, "participant");
5599      for (int i = 0; i < array.size(); i++) {
5600        res.getParticipant().add(parseCareTeamParticipantComponent(array.get(i).getAsJsonObject()));
5601      }
5602    };
5603    if (json.has("reason")) {
5604      JsonArray array = getJArray(json, "reason");
5605      for (int i = 0; i < array.size(); i++) {
5606        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5607      }
5608    };
5609    if (json.has("managingOrganization")) {
5610      JsonArray array = getJArray(json, "managingOrganization");
5611      for (int i = 0; i < array.size(); i++) {
5612        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
5613      }
5614    };
5615    if (json.has("telecom")) {
5616      JsonArray array = getJArray(json, "telecom");
5617      for (int i = 0; i < array.size(); i++) {
5618        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5619      }
5620    };
5621    if (json.has("note")) {
5622      JsonArray array = getJArray(json, "note");
5623      for (int i = 0; i < array.size(); i++) {
5624        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5625      }
5626    };
5627  }
5628
5629  protected CareTeam.CareTeamParticipantComponent parseCareTeamParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
5630    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
5631    parseCareTeamParticipantComponentProperties(json, res);
5632    return res;
5633  }
5634
5635  protected void parseCareTeamParticipantComponentProperties(JsonObject json, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
5636    parseBackboneElementProperties(json, res);
5637    if (json.has("role"))
5638      res.setRole(parseCodeableConcept(getJObject(json, "role")));
5639    if (json.has("member"))
5640      res.setMember(parseReference(getJObject(json, "member")));
5641    if (json.has("onBehalfOf"))
5642      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
5643    DataType coverage = parseType("coverage", json);
5644    if (coverage != null)
5645      res.setCoverage(coverage);
5646  }
5647
5648  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
5649    ChargeItem res = new ChargeItem();
5650    parseChargeItemProperties(json, res);
5651    return res;
5652  }
5653
5654  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
5655    parseDomainResourceProperties(json, res);
5656    if (json.has("identifier")) {
5657      JsonArray array = getJArray(json, "identifier");
5658      for (int i = 0; i < array.size(); i++) {
5659        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5660      }
5661    };
5662    if (json.has("definitionUri")) {
5663      JsonArray array = getJArray(json, "definitionUri");
5664      for (int i = 0; i < array.size(); i++) {
5665        if (array.get(i).isJsonNull()) {
5666          res.getDefinitionUri().add(new UriType());
5667        } else {;
5668          res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
5669        }
5670      }
5671    };
5672    if (json.has("_definitionUri")) {
5673      JsonArray array = getJArray(json, "_definitionUri");
5674      for (int i = 0; i < array.size(); i++) {
5675        if (i == res.getDefinitionUri().size())
5676          res.getDefinitionUri().add(parseUri(null));
5677        if (array.get(i) instanceof JsonObject) 
5678          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
5679      }
5680    };
5681    if (json.has("definitionCanonical")) {
5682      JsonArray array = getJArray(json, "definitionCanonical");
5683      for (int i = 0; i < array.size(); i++) {
5684        if (array.get(i).isJsonNull()) {
5685          res.getDefinitionCanonical().add(new CanonicalType());
5686        } else {;
5687          res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
5688        }
5689      }
5690    };
5691    if (json.has("_definitionCanonical")) {
5692      JsonArray array = getJArray(json, "_definitionCanonical");
5693      for (int i = 0; i < array.size(); i++) {
5694        if (i == res.getDefinitionCanonical().size())
5695          res.getDefinitionCanonical().add(parseCanonical(null));
5696        if (array.get(i) instanceof JsonObject) 
5697          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
5698      }
5699    };
5700    if (json.has("status"))
5701      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
5702    if (json.has("_status"))
5703      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5704    if (json.has("partOf")) {
5705      JsonArray array = getJArray(json, "partOf");
5706      for (int i = 0; i < array.size(); i++) {
5707        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5708      }
5709    };
5710    if (json.has("code"))
5711      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5712    if (json.has("subject"))
5713      res.setSubject(parseReference(getJObject(json, "subject")));
5714    if (json.has("encounter"))
5715      res.setEncounter(parseReference(getJObject(json, "encounter")));
5716    DataType occurrence = parseType("occurrence", json);
5717    if (occurrence != null)
5718      res.setOccurrence(occurrence);
5719    if (json.has("performer")) {
5720      JsonArray array = getJArray(json, "performer");
5721      for (int i = 0; i < array.size(); i++) {
5722        res.getPerformer().add(parseChargeItemPerformerComponent(array.get(i).getAsJsonObject()));
5723      }
5724    };
5725    if (json.has("performingOrganization"))
5726      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
5727    if (json.has("requestingOrganization"))
5728      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
5729    if (json.has("costCenter"))
5730      res.setCostCenter(parseReference(getJObject(json, "costCenter")));
5731    if (json.has("quantity"))
5732      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5733    if (json.has("bodysite")) {
5734      JsonArray array = getJArray(json, "bodysite");
5735      for (int i = 0; i < array.size(); i++) {
5736        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5737      }
5738    };
5739    if (json.has("unitPriceComponent"))
5740      res.setUnitPriceComponent(parseMonetaryComponent(getJObject(json, "unitPriceComponent")));
5741    if (json.has("totalPriceComponent"))
5742      res.setTotalPriceComponent(parseMonetaryComponent(getJObject(json, "totalPriceComponent")));
5743    if (json.has("overrideReason"))
5744      res.setOverrideReason(parseCodeableConcept(getJObject(json, "overrideReason")));
5745    if (json.has("enterer"))
5746      res.setEnterer(parseReference(getJObject(json, "enterer")));
5747    if (json.has("enteredDate"))
5748      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
5749    if (json.has("_enteredDate"))
5750      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
5751    if (json.has("reason")) {
5752      JsonArray array = getJArray(json, "reason");
5753      for (int i = 0; i < array.size(); i++) {
5754        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5755      }
5756    };
5757    if (json.has("service")) {
5758      JsonArray array = getJArray(json, "service");
5759      for (int i = 0; i < array.size(); i++) {
5760        res.getService().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5761      }
5762    };
5763    if (json.has("product")) {
5764      JsonArray array = getJArray(json, "product");
5765      for (int i = 0; i < array.size(); i++) {
5766        res.getProduct().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5767      }
5768    };
5769    if (json.has("account")) {
5770      JsonArray array = getJArray(json, "account");
5771      for (int i = 0; i < array.size(); i++) {
5772        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
5773      }
5774    };
5775    if (json.has("note")) {
5776      JsonArray array = getJArray(json, "note");
5777      for (int i = 0; i < array.size(); i++) {
5778        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5779      }
5780    };
5781    if (json.has("supportingInformation")) {
5782      JsonArray array = getJArray(json, "supportingInformation");
5783      for (int i = 0; i < array.size(); i++) {
5784        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
5785      }
5786    };
5787  }
5788
5789  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
5790    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
5791    parseChargeItemPerformerComponentProperties(json, res);
5792    return res;
5793  }
5794
5795  protected void parseChargeItemPerformerComponentProperties(JsonObject json, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
5796    parseBackboneElementProperties(json, res);
5797    if (json.has("function"))
5798      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
5799    if (json.has("actor"))
5800      res.setActor(parseReference(getJObject(json, "actor")));
5801  }
5802
5803  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
5804    ChargeItemDefinition res = new ChargeItemDefinition();
5805    parseChargeItemDefinitionProperties(json, res);
5806    return res;
5807  }
5808
5809  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
5810    parseMetadataResourceProperties(json, res);
5811    if (json.has("url"))
5812      res.setUrlElement(parseUri(json.get("url").getAsString()));
5813    if (json.has("_url"))
5814      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5815    if (json.has("identifier")) {
5816      JsonArray array = getJArray(json, "identifier");
5817      for (int i = 0; i < array.size(); i++) {
5818        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5819      }
5820    };
5821    if (json.has("version"))
5822      res.setVersionElement(parseString(json.get("version").getAsString()));
5823    if (json.has("_version"))
5824      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5825    DataType versionAlgorithm = parseType("versionAlgorithm", json);
5826    if (versionAlgorithm != null)
5827      res.setVersionAlgorithm(versionAlgorithm);
5828    if (json.has("name"))
5829      res.setNameElement(parseString(json.get("name").getAsString()));
5830    if (json.has("_name"))
5831      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5832    if (json.has("title"))
5833      res.setTitleElement(parseString(json.get("title").getAsString()));
5834    if (json.has("_title"))
5835      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5836    if (json.has("derivedFromUri")) {
5837      JsonArray array = getJArray(json, "derivedFromUri");
5838      for (int i = 0; i < array.size(); i++) {
5839        if (array.get(i).isJsonNull()) {
5840          res.getDerivedFromUri().add(new UriType());
5841        } else {;
5842          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
5843        }
5844      }
5845    };
5846    if (json.has("_derivedFromUri")) {
5847      JsonArray array = getJArray(json, "_derivedFromUri");
5848      for (int i = 0; i < array.size(); i++) {
5849        if (i == res.getDerivedFromUri().size())
5850          res.getDerivedFromUri().add(parseUri(null));
5851        if (array.get(i) instanceof JsonObject) 
5852          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
5853      }
5854    };
5855    if (json.has("partOf")) {
5856      JsonArray array = getJArray(json, "partOf");
5857      for (int i = 0; i < array.size(); i++) {
5858        if (array.get(i).isJsonNull()) {
5859          res.getPartOf().add(new CanonicalType());
5860        } else {;
5861          res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
5862        }
5863      }
5864    };
5865    if (json.has("_partOf")) {
5866      JsonArray array = getJArray(json, "_partOf");
5867      for (int i = 0; i < array.size(); i++) {
5868        if (i == res.getPartOf().size())
5869          res.getPartOf().add(parseCanonical(null));
5870        if (array.get(i) instanceof JsonObject) 
5871          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
5872      }
5873    };
5874    if (json.has("replaces")) {
5875      JsonArray array = getJArray(json, "replaces");
5876      for (int i = 0; i < array.size(); i++) {
5877        if (array.get(i).isJsonNull()) {
5878          res.getReplaces().add(new CanonicalType());
5879        } else {;
5880          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
5881        }
5882      }
5883    };
5884    if (json.has("_replaces")) {
5885      JsonArray array = getJArray(json, "_replaces");
5886      for (int i = 0; i < array.size(); i++) {
5887        if (i == res.getReplaces().size())
5888          res.getReplaces().add(parseCanonical(null));
5889        if (array.get(i) instanceof JsonObject) 
5890          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
5891      }
5892    };
5893    if (json.has("status"))
5894      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5895    if (json.has("_status"))
5896      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5897    if (json.has("experimental"))
5898      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5899    if (json.has("_experimental"))
5900      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5901    if (json.has("date"))
5902      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5903    if (json.has("_date"))
5904      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5905    if (json.has("publisher"))
5906      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5907    if (json.has("_publisher"))
5908      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5909    if (json.has("contact")) {
5910      JsonArray array = getJArray(json, "contact");
5911      for (int i = 0; i < array.size(); i++) {
5912        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5913      }
5914    };
5915    if (json.has("description"))
5916      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5917    if (json.has("_description"))
5918      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5919    if (json.has("useContext")) {
5920      JsonArray array = getJArray(json, "useContext");
5921      for (int i = 0; i < array.size(); i++) {
5922        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5923      }
5924    };
5925    if (json.has("jurisdiction")) {
5926      JsonArray array = getJArray(json, "jurisdiction");
5927      for (int i = 0; i < array.size(); i++) {
5928        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5929      }
5930    };
5931    if (json.has("purpose"))
5932      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5933    if (json.has("_purpose"))
5934      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5935    if (json.has("copyright"))
5936      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5937    if (json.has("_copyright"))
5938      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5939    if (json.has("copyrightLabel"))
5940      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
5941    if (json.has("_copyrightLabel"))
5942      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
5943    if (json.has("approvalDate"))
5944      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5945    if (json.has("_approvalDate"))
5946      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
5947    if (json.has("lastReviewDate"))
5948      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5949    if (json.has("_lastReviewDate"))
5950      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
5951    if (json.has("code"))
5952      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5953    if (json.has("instance")) {
5954      JsonArray array = getJArray(json, "instance");
5955      for (int i = 0; i < array.size(); i++) {
5956        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
5957      }
5958    };
5959    if (json.has("applicability")) {
5960      JsonArray array = getJArray(json, "applicability");
5961      for (int i = 0; i < array.size(); i++) {
5962        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5963      }
5964    };
5965    if (json.has("propertyGroup")) {
5966      JsonArray array = getJArray(json, "propertyGroup");
5967      for (int i = 0; i < array.size(); i++) {
5968        res.getPropertyGroup().add(parseChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject()));
5969      }
5970    };
5971  }
5972
5973  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionApplicabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
5974    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
5975    parseChargeItemDefinitionApplicabilityComponentProperties(json, res);
5976    return res;
5977  }
5978
5979  protected void parseChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
5980    parseBackboneElementProperties(json, res);
5981    if (json.has("condition"))
5982      res.setCondition(parseExpression(getJObject(json, "condition")));
5983    if (json.has("effectivePeriod"))
5984      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
5985    if (json.has("relatedArtifact"))
5986      res.setRelatedArtifact(parseRelatedArtifact(getJObject(json, "relatedArtifact")));
5987  }
5988
5989  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionPropertyGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
5990    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
5991    parseChargeItemDefinitionPropertyGroupComponentProperties(json, res);
5992    return res;
5993  }
5994
5995  protected void parseChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
5996    parseBackboneElementProperties(json, res);
5997    if (json.has("applicability")) {
5998      JsonArray array = getJArray(json, "applicability");
5999      for (int i = 0; i < array.size(); i++) {
6000        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
6001      }
6002    };
6003    if (json.has("priceComponent")) {
6004      JsonArray array = getJArray(json, "priceComponent");
6005      for (int i = 0; i < array.size(); i++) {
6006        res.getPriceComponent().add(parseMonetaryComponent(array.get(i).getAsJsonObject()));
6007      }
6008    };
6009  }
6010
6011  protected Citation parseCitation(JsonObject json) throws IOException, FHIRFormatError {
6012    Citation res = new Citation();
6013    parseCitationProperties(json, res);
6014    return res;
6015  }
6016
6017  protected void parseCitationProperties(JsonObject json, Citation res) throws IOException, FHIRFormatError {
6018    parseMetadataResourceProperties(json, res);
6019    if (json.has("url"))
6020      res.setUrlElement(parseUri(json.get("url").getAsString()));
6021    if (json.has("_url"))
6022      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6023    if (json.has("identifier")) {
6024      JsonArray array = getJArray(json, "identifier");
6025      for (int i = 0; i < array.size(); i++) {
6026        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6027      }
6028    };
6029    if (json.has("version"))
6030      res.setVersionElement(parseString(json.get("version").getAsString()));
6031    if (json.has("_version"))
6032      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
6033    DataType versionAlgorithm = parseType("versionAlgorithm", json);
6034    if (versionAlgorithm != null)
6035      res.setVersionAlgorithm(versionAlgorithm);
6036    if (json.has("name"))
6037      res.setNameElement(parseString(json.get("name").getAsString()));
6038    if (json.has("_name"))
6039      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
6040    if (json.has("title"))
6041      res.setTitleElement(parseString(json.get("title").getAsString()));
6042    if (json.has("_title"))
6043      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6044    if (json.has("status"))
6045      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6046    if (json.has("_status"))
6047      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6048    if (json.has("experimental"))
6049      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6050    if (json.has("_experimental"))
6051      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6052    if (json.has("date"))
6053      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6054    if (json.has("_date"))
6055      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6056    if (json.has("publisher"))
6057      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6058    if (json.has("_publisher"))
6059      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6060    if (json.has("contact")) {
6061      JsonArray array = getJArray(json, "contact");
6062      for (int i = 0; i < array.size(); i++) {
6063        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6064      }
6065    };
6066    if (json.has("description"))
6067      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6068    if (json.has("_description"))
6069      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6070    if (json.has("useContext")) {
6071      JsonArray array = getJArray(json, "useContext");
6072      for (int i = 0; i < array.size(); i++) {
6073        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6074      }
6075    };
6076    if (json.has("jurisdiction")) {
6077      JsonArray array = getJArray(json, "jurisdiction");
6078      for (int i = 0; i < array.size(); i++) {
6079        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6080      }
6081    };
6082    if (json.has("purpose"))
6083      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6084    if (json.has("_purpose"))
6085      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6086    if (json.has("copyright"))
6087      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6088    if (json.has("_copyright"))
6089      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6090    if (json.has("copyrightLabel"))
6091      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
6092    if (json.has("_copyrightLabel"))
6093      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
6094    if (json.has("approvalDate"))
6095      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
6096    if (json.has("_approvalDate"))
6097      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
6098    if (json.has("lastReviewDate"))
6099      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
6100    if (json.has("_lastReviewDate"))
6101      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
6102    if (json.has("effectivePeriod"))
6103      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
6104    if (json.has("author")) {
6105      JsonArray array = getJArray(json, "author");
6106      for (int i = 0; i < array.size(); i++) {
6107        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
6108      }
6109    };
6110    if (json.has("editor")) {
6111      JsonArray array = getJArray(json, "editor");
6112      for (int i = 0; i < array.size(); i++) {
6113        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
6114      }
6115    };
6116    if (json.has("reviewer")) {
6117      JsonArray array = getJArray(json, "reviewer");
6118      for (int i = 0; i < array.size(); i++) {
6119        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
6120      }
6121    };
6122    if (json.has("endorser")) {
6123      JsonArray array = getJArray(json, "endorser");
6124      for (int i = 0; i < array.size(); i++) {
6125        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
6126      }
6127    };
6128    if (json.has("summary")) {
6129      JsonArray array = getJArray(json, "summary");
6130      for (int i = 0; i < array.size(); i++) {
6131        res.getSummary().add(parseCitationSummaryComponent(array.get(i).getAsJsonObject()));
6132      }
6133    };
6134    if (json.has("classification")) {
6135      JsonArray array = getJArray(json, "classification");
6136      for (int i = 0; i < array.size(); i++) {
6137        res.getClassification().add(parseCitationClassificationComponent(array.get(i).getAsJsonObject()));
6138      }
6139    };
6140    if (json.has("note")) {
6141      JsonArray array = getJArray(json, "note");
6142      for (int i = 0; i < array.size(); i++) {
6143        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6144      }
6145    };
6146    if (json.has("currentState")) {
6147      JsonArray array = getJArray(json, "currentState");
6148      for (int i = 0; i < array.size(); i++) {
6149        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6150      }
6151    };
6152    if (json.has("statusDate")) {
6153      JsonArray array = getJArray(json, "statusDate");
6154      for (int i = 0; i < array.size(); i++) {
6155        res.getStatusDate().add(parseCitationStatusDateComponent(array.get(i).getAsJsonObject()));
6156      }
6157    };
6158    if (json.has("relatedArtifact")) {
6159      JsonArray array = getJArray(json, "relatedArtifact");
6160      for (int i = 0; i < array.size(); i++) {
6161        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
6162      }
6163    };
6164    if (json.has("citedArtifact"))
6165      res.setCitedArtifact(parseCitationCitedArtifactComponent(getJObject(json, "citedArtifact")));
6166  }
6167
6168  protected Citation.CitationSummaryComponent parseCitationSummaryComponent(JsonObject json) throws IOException, FHIRFormatError {
6169    Citation.CitationSummaryComponent res = new Citation.CitationSummaryComponent();
6170    parseCitationSummaryComponentProperties(json, res);
6171    return res;
6172  }
6173
6174  protected void parseCitationSummaryComponentProperties(JsonObject json, Citation.CitationSummaryComponent res) throws IOException, FHIRFormatError {
6175    parseBackboneElementProperties(json, res);
6176    if (json.has("style"))
6177      res.setStyle(parseCodeableConcept(getJObject(json, "style")));
6178    if (json.has("text"))
6179      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
6180    if (json.has("_text"))
6181      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6182  }
6183
6184  protected Citation.CitationClassificationComponent parseCitationClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
6185    Citation.CitationClassificationComponent res = new Citation.CitationClassificationComponent();
6186    parseCitationClassificationComponentProperties(json, res);
6187    return res;
6188  }
6189
6190  protected void parseCitationClassificationComponentProperties(JsonObject json, Citation.CitationClassificationComponent res) throws IOException, FHIRFormatError {
6191    parseBackboneElementProperties(json, res);
6192    if (json.has("type"))
6193      res.setType(parseCodeableConcept(getJObject(json, "type")));
6194    if (json.has("classifier")) {
6195      JsonArray array = getJArray(json, "classifier");
6196      for (int i = 0; i < array.size(); i++) {
6197        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6198      }
6199    };
6200  }
6201
6202  protected Citation.CitationStatusDateComponent parseCitationStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
6203    Citation.CitationStatusDateComponent res = new Citation.CitationStatusDateComponent();
6204    parseCitationStatusDateComponentProperties(json, res);
6205    return res;
6206  }
6207
6208  protected void parseCitationStatusDateComponentProperties(JsonObject json, Citation.CitationStatusDateComponent res) throws IOException, FHIRFormatError {
6209    parseBackboneElementProperties(json, res);
6210    if (json.has("activity"))
6211      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
6212    if (json.has("actual"))
6213      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
6214    if (json.has("_actual"))
6215      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
6216    if (json.has("period"))
6217      res.setPeriod(parsePeriod(getJObject(json, "period")));
6218  }
6219
6220  protected Citation.CitationCitedArtifactComponent parseCitationCitedArtifactComponent(JsonObject json) throws IOException, FHIRFormatError {
6221    Citation.CitationCitedArtifactComponent res = new Citation.CitationCitedArtifactComponent();
6222    parseCitationCitedArtifactComponentProperties(json, res);
6223    return res;
6224  }
6225
6226  protected void parseCitationCitedArtifactComponentProperties(JsonObject json, Citation.CitationCitedArtifactComponent res) throws IOException, FHIRFormatError {
6227    parseBackboneElementProperties(json, res);
6228    if (json.has("identifier")) {
6229      JsonArray array = getJArray(json, "identifier");
6230      for (int i = 0; i < array.size(); i++) {
6231        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6232      }
6233    };
6234    if (json.has("relatedIdentifier")) {
6235      JsonArray array = getJArray(json, "relatedIdentifier");
6236      for (int i = 0; i < array.size(); i++) {
6237        res.getRelatedIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6238      }
6239    };
6240    if (json.has("dateAccessed"))
6241      res.setDateAccessedElement(parseDateTime(json.get("dateAccessed").getAsString()));
6242    if (json.has("_dateAccessed"))
6243      parseElementProperties(getJObject(json, "_dateAccessed"), res.getDateAccessedElement());
6244    if (json.has("version"))
6245      res.setVersion(parseCitationCitedArtifactVersionComponent(getJObject(json, "version")));
6246    if (json.has("currentState")) {
6247      JsonArray array = getJArray(json, "currentState");
6248      for (int i = 0; i < array.size(); i++) {
6249        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6250      }
6251    };
6252    if (json.has("statusDate")) {
6253      JsonArray array = getJArray(json, "statusDate");
6254      for (int i = 0; i < array.size(); i++) {
6255        res.getStatusDate().add(parseCitationCitedArtifactStatusDateComponent(array.get(i).getAsJsonObject()));
6256      }
6257    };
6258    if (json.has("title")) {
6259      JsonArray array = getJArray(json, "title");
6260      for (int i = 0; i < array.size(); i++) {
6261        res.getTitle().add(parseCitationCitedArtifactTitleComponent(array.get(i).getAsJsonObject()));
6262      }
6263    };
6264    if (json.has("abstract")) {
6265      JsonArray array = getJArray(json, "abstract");
6266      for (int i = 0; i < array.size(); i++) {
6267        res.getAbstract().add(parseCitationCitedArtifactAbstractComponent(array.get(i).getAsJsonObject()));
6268      }
6269    };
6270    if (json.has("part"))
6271      res.setPart(parseCitationCitedArtifactPartComponent(getJObject(json, "part")));
6272    if (json.has("relatesTo")) {
6273      JsonArray array = getJArray(json, "relatesTo");
6274      for (int i = 0; i < array.size(); i++) {
6275        res.getRelatesTo().add(parseCitationCitedArtifactRelatesToComponent(array.get(i).getAsJsonObject()));
6276      }
6277    };
6278    if (json.has("publicationForm")) {
6279      JsonArray array = getJArray(json, "publicationForm");
6280      for (int i = 0; i < array.size(); i++) {
6281        res.getPublicationForm().add(parseCitationCitedArtifactPublicationFormComponent(array.get(i).getAsJsonObject()));
6282      }
6283    };
6284    if (json.has("webLocation")) {
6285      JsonArray array = getJArray(json, "webLocation");
6286      for (int i = 0; i < array.size(); i++) {
6287        res.getWebLocation().add(parseCitationCitedArtifactWebLocationComponent(array.get(i).getAsJsonObject()));
6288      }
6289    };
6290    if (json.has("classification")) {
6291      JsonArray array = getJArray(json, "classification");
6292      for (int i = 0; i < array.size(); i++) {
6293        res.getClassification().add(parseCitationCitedArtifactClassificationComponent(array.get(i).getAsJsonObject()));
6294      }
6295    };
6296    if (json.has("contributorship"))
6297      res.setContributorship(parseCitationCitedArtifactContributorshipComponent(getJObject(json, "contributorship")));
6298    if (json.has("note")) {
6299      JsonArray array = getJArray(json, "note");
6300      for (int i = 0; i < array.size(); i++) {
6301        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6302      }
6303    };
6304  }
6305
6306  protected Citation.CitationCitedArtifactVersionComponent parseCitationCitedArtifactVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
6307    Citation.CitationCitedArtifactVersionComponent res = new Citation.CitationCitedArtifactVersionComponent();
6308    parseCitationCitedArtifactVersionComponentProperties(json, res);
6309    return res;
6310  }
6311
6312  protected void parseCitationCitedArtifactVersionComponentProperties(JsonObject json, Citation.CitationCitedArtifactVersionComponent res) throws IOException, FHIRFormatError {
6313    parseBackboneElementProperties(json, res);
6314    if (json.has("value"))
6315      res.setValueElement(parseString(json.get("value").getAsString()));
6316    if (json.has("_value"))
6317      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6318    if (json.has("baseCitation"))
6319      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
6320  }
6321
6322  protected Citation.CitationCitedArtifactStatusDateComponent parseCitationCitedArtifactStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
6323    Citation.CitationCitedArtifactStatusDateComponent res = new Citation.CitationCitedArtifactStatusDateComponent();
6324    parseCitationCitedArtifactStatusDateComponentProperties(json, res);
6325    return res;
6326  }
6327
6328  protected void parseCitationCitedArtifactStatusDateComponentProperties(JsonObject json, Citation.CitationCitedArtifactStatusDateComponent res) throws IOException, FHIRFormatError {
6329    parseBackboneElementProperties(json, res);
6330    if (json.has("activity"))
6331      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
6332    if (json.has("actual"))
6333      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
6334    if (json.has("_actual"))
6335      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
6336    if (json.has("period"))
6337      res.setPeriod(parsePeriod(getJObject(json, "period")));
6338  }
6339
6340  protected Citation.CitationCitedArtifactTitleComponent parseCitationCitedArtifactTitleComponent(JsonObject json) throws IOException, FHIRFormatError {
6341    Citation.CitationCitedArtifactTitleComponent res = new Citation.CitationCitedArtifactTitleComponent();
6342    parseCitationCitedArtifactTitleComponentProperties(json, res);
6343    return res;
6344  }
6345
6346  protected void parseCitationCitedArtifactTitleComponentProperties(JsonObject json, Citation.CitationCitedArtifactTitleComponent res) throws IOException, FHIRFormatError {
6347    parseBackboneElementProperties(json, res);
6348    if (json.has("type")) {
6349      JsonArray array = getJArray(json, "type");
6350      for (int i = 0; i < array.size(); i++) {
6351        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6352      }
6353    };
6354    if (json.has("language"))
6355      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6356    if (json.has("text"))
6357      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
6358    if (json.has("_text"))
6359      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6360  }
6361
6362  protected Citation.CitationCitedArtifactAbstractComponent parseCitationCitedArtifactAbstractComponent(JsonObject json) throws IOException, FHIRFormatError {
6363    Citation.CitationCitedArtifactAbstractComponent res = new Citation.CitationCitedArtifactAbstractComponent();
6364    parseCitationCitedArtifactAbstractComponentProperties(json, res);
6365    return res;
6366  }
6367
6368  protected void parseCitationCitedArtifactAbstractComponentProperties(JsonObject json, Citation.CitationCitedArtifactAbstractComponent res) throws IOException, FHIRFormatError {
6369    parseBackboneElementProperties(json, res);
6370    if (json.has("type"))
6371      res.setType(parseCodeableConcept(getJObject(json, "type")));
6372    if (json.has("language"))
6373      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6374    if (json.has("text"))
6375      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
6376    if (json.has("_text"))
6377      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6378    if (json.has("copyright"))
6379      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6380    if (json.has("_copyright"))
6381      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6382  }
6383
6384  protected Citation.CitationCitedArtifactPartComponent parseCitationCitedArtifactPartComponent(JsonObject json) throws IOException, FHIRFormatError {
6385    Citation.CitationCitedArtifactPartComponent res = new Citation.CitationCitedArtifactPartComponent();
6386    parseCitationCitedArtifactPartComponentProperties(json, res);
6387    return res;
6388  }
6389
6390  protected void parseCitationCitedArtifactPartComponentProperties(JsonObject json, Citation.CitationCitedArtifactPartComponent res) throws IOException, FHIRFormatError {
6391    parseBackboneElementProperties(json, res);
6392    if (json.has("type"))
6393      res.setType(parseCodeableConcept(getJObject(json, "type")));
6394    if (json.has("value"))
6395      res.setValueElement(parseString(json.get("value").getAsString()));
6396    if (json.has("_value"))
6397      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6398    if (json.has("baseCitation"))
6399      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
6400  }
6401
6402  protected Citation.CitationCitedArtifactRelatesToComponent parseCitationCitedArtifactRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
6403    Citation.CitationCitedArtifactRelatesToComponent res = new Citation.CitationCitedArtifactRelatesToComponent();
6404    parseCitationCitedArtifactRelatesToComponentProperties(json, res);
6405    return res;
6406  }
6407
6408  protected void parseCitationCitedArtifactRelatesToComponentProperties(JsonObject json, Citation.CitationCitedArtifactRelatesToComponent res) throws IOException, FHIRFormatError {
6409    parseBackboneElementProperties(json, res);
6410    if (json.has("type"))
6411      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Citation.RelatedArtifactTypeExpanded.NULL, new Citation.RelatedArtifactTypeExpandedEnumFactory()));
6412    if (json.has("_type"))
6413      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6414    if (json.has("classifier")) {
6415      JsonArray array = getJArray(json, "classifier");
6416      for (int i = 0; i < array.size(); i++) {
6417        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6418      }
6419    };
6420    if (json.has("label"))
6421      res.setLabelElement(parseString(json.get("label").getAsString()));
6422    if (json.has("_label"))
6423      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
6424    if (json.has("display"))
6425      res.setDisplayElement(parseString(json.get("display").getAsString()));
6426    if (json.has("_display"))
6427      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6428    if (json.has("citation"))
6429      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
6430    if (json.has("_citation"))
6431      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
6432    if (json.has("document"))
6433      res.setDocument(parseAttachment(getJObject(json, "document")));
6434    if (json.has("resource"))
6435      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
6436    if (json.has("_resource"))
6437      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
6438    if (json.has("resourceReference"))
6439      res.setResourceReference(parseReference(getJObject(json, "resourceReference")));
6440  }
6441
6442  protected Citation.CitationCitedArtifactPublicationFormComponent parseCitationCitedArtifactPublicationFormComponent(JsonObject json) throws IOException, FHIRFormatError {
6443    Citation.CitationCitedArtifactPublicationFormComponent res = new Citation.CitationCitedArtifactPublicationFormComponent();
6444    parseCitationCitedArtifactPublicationFormComponentProperties(json, res);
6445    return res;
6446  }
6447
6448  protected void parseCitationCitedArtifactPublicationFormComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormComponent res) throws IOException, FHIRFormatError {
6449    parseBackboneElementProperties(json, res);
6450    if (json.has("publishedIn"))
6451      res.setPublishedIn(parseCitationCitedArtifactPublicationFormPublishedInComponent(getJObject(json, "publishedIn")));
6452    if (json.has("citedMedium"))
6453      res.setCitedMedium(parseCodeableConcept(getJObject(json, "citedMedium")));
6454    if (json.has("volume"))
6455      res.setVolumeElement(parseString(json.get("volume").getAsString()));
6456    if (json.has("_volume"))
6457      parseElementProperties(getJObject(json, "_volume"), res.getVolumeElement());
6458    if (json.has("issue"))
6459      res.setIssueElement(parseString(json.get("issue").getAsString()));
6460    if (json.has("_issue"))
6461      parseElementProperties(getJObject(json, "_issue"), res.getIssueElement());
6462    if (json.has("articleDate"))
6463      res.setArticleDateElement(parseDateTime(json.get("articleDate").getAsString()));
6464    if (json.has("_articleDate"))
6465      parseElementProperties(getJObject(json, "_articleDate"), res.getArticleDateElement());
6466    if (json.has("publicationDateText"))
6467      res.setPublicationDateTextElement(parseString(json.get("publicationDateText").getAsString()));
6468    if (json.has("_publicationDateText"))
6469      parseElementProperties(getJObject(json, "_publicationDateText"), res.getPublicationDateTextElement());
6470    if (json.has("publicationDateSeason"))
6471      res.setPublicationDateSeasonElement(parseString(json.get("publicationDateSeason").getAsString()));
6472    if (json.has("_publicationDateSeason"))
6473      parseElementProperties(getJObject(json, "_publicationDateSeason"), res.getPublicationDateSeasonElement());
6474    if (json.has("lastRevisionDate"))
6475      res.setLastRevisionDateElement(parseDateTime(json.get("lastRevisionDate").getAsString()));
6476    if (json.has("_lastRevisionDate"))
6477      parseElementProperties(getJObject(json, "_lastRevisionDate"), res.getLastRevisionDateElement());
6478    if (json.has("language")) {
6479      JsonArray array = getJArray(json, "language");
6480      for (int i = 0; i < array.size(); i++) {
6481        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6482      }
6483    };
6484    if (json.has("accessionNumber"))
6485      res.setAccessionNumberElement(parseString(json.get("accessionNumber").getAsString()));
6486    if (json.has("_accessionNumber"))
6487      parseElementProperties(getJObject(json, "_accessionNumber"), res.getAccessionNumberElement());
6488    if (json.has("pageString"))
6489      res.setPageStringElement(parseString(json.get("pageString").getAsString()));
6490    if (json.has("_pageString"))
6491      parseElementProperties(getJObject(json, "_pageString"), res.getPageStringElement());
6492    if (json.has("firstPage"))
6493      res.setFirstPageElement(parseString(json.get("firstPage").getAsString()));
6494    if (json.has("_firstPage"))
6495      parseElementProperties(getJObject(json, "_firstPage"), res.getFirstPageElement());
6496    if (json.has("lastPage"))
6497      res.setLastPageElement(parseString(json.get("lastPage").getAsString()));
6498    if (json.has("_lastPage"))
6499      parseElementProperties(getJObject(json, "_lastPage"), res.getLastPageElement());
6500    if (json.has("pageCount"))
6501      res.setPageCountElement(parseString(json.get("pageCount").getAsString()));
6502    if (json.has("_pageCount"))
6503      parseElementProperties(getJObject(json, "_pageCount"), res.getPageCountElement());
6504    if (json.has("copyright"))
6505      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6506    if (json.has("_copyright"))
6507      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6508  }
6509
6510  protected Citation.CitationCitedArtifactPublicationFormPublishedInComponent parseCitationCitedArtifactPublicationFormPublishedInComponent(JsonObject json) throws IOException, FHIRFormatError {
6511    Citation.CitationCitedArtifactPublicationFormPublishedInComponent res = new Citation.CitationCitedArtifactPublicationFormPublishedInComponent();
6512    parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(json, res);
6513    return res;
6514  }
6515
6516  protected void parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPublishedInComponent res) throws IOException, FHIRFormatError {
6517    parseBackboneElementProperties(json, res);
6518    if (json.has("type"))
6519      res.setType(parseCodeableConcept(getJObject(json, "type")));
6520    if (json.has("identifier")) {
6521      JsonArray array = getJArray(json, "identifier");
6522      for (int i = 0; i < array.size(); i++) {
6523        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6524      }
6525    };
6526    if (json.has("title"))
6527      res.setTitleElement(parseString(json.get("title").getAsString()));
6528    if (json.has("_title"))
6529      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6530    if (json.has("publisher"))
6531      res.setPublisher(parseReference(getJObject(json, "publisher")));
6532    if (json.has("publisherLocation"))
6533      res.setPublisherLocationElement(parseString(json.get("publisherLocation").getAsString()));
6534    if (json.has("_publisherLocation"))
6535      parseElementProperties(getJObject(json, "_publisherLocation"), res.getPublisherLocationElement());
6536  }
6537
6538  protected Citation.CitationCitedArtifactWebLocationComponent parseCitationCitedArtifactWebLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
6539    Citation.CitationCitedArtifactWebLocationComponent res = new Citation.CitationCitedArtifactWebLocationComponent();
6540    parseCitationCitedArtifactWebLocationComponentProperties(json, res);
6541    return res;
6542  }
6543
6544  protected void parseCitationCitedArtifactWebLocationComponentProperties(JsonObject json, Citation.CitationCitedArtifactWebLocationComponent res) throws IOException, FHIRFormatError {
6545    parseBackboneElementProperties(json, res);
6546    if (json.has("classifier")) {
6547      JsonArray array = getJArray(json, "classifier");
6548      for (int i = 0; i < array.size(); i++) {
6549        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6550      }
6551    };
6552    if (json.has("url"))
6553      res.setUrlElement(parseUri(json.get("url").getAsString()));
6554    if (json.has("_url"))
6555      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6556  }
6557
6558  protected Citation.CitationCitedArtifactClassificationComponent parseCitationCitedArtifactClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
6559    Citation.CitationCitedArtifactClassificationComponent res = new Citation.CitationCitedArtifactClassificationComponent();
6560    parseCitationCitedArtifactClassificationComponentProperties(json, res);
6561    return res;
6562  }
6563
6564  protected void parseCitationCitedArtifactClassificationComponentProperties(JsonObject json, Citation.CitationCitedArtifactClassificationComponent res) throws IOException, FHIRFormatError {
6565    parseBackboneElementProperties(json, res);
6566    if (json.has("type"))
6567      res.setType(parseCodeableConcept(getJObject(json, "type")));
6568    if (json.has("classifier")) {
6569      JsonArray array = getJArray(json, "classifier");
6570      for (int i = 0; i < array.size(); i++) {
6571        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6572      }
6573    };
6574    if (json.has("artifactAssessment")) {
6575      JsonArray array = getJArray(json, "artifactAssessment");
6576      for (int i = 0; i < array.size(); i++) {
6577        res.getArtifactAssessment().add(parseReference(array.get(i).getAsJsonObject()));
6578      }
6579    };
6580  }
6581
6582  protected Citation.CitationCitedArtifactContributorshipComponent parseCitationCitedArtifactContributorshipComponent(JsonObject json) throws IOException, FHIRFormatError {
6583    Citation.CitationCitedArtifactContributorshipComponent res = new Citation.CitationCitedArtifactContributorshipComponent();
6584    parseCitationCitedArtifactContributorshipComponentProperties(json, res);
6585    return res;
6586  }
6587
6588  protected void parseCitationCitedArtifactContributorshipComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipComponent res) throws IOException, FHIRFormatError {
6589    parseBackboneElementProperties(json, res);
6590    if (json.has("complete"))
6591      res.setCompleteElement(parseBoolean(json.get("complete").getAsBoolean()));
6592    if (json.has("_complete"))
6593      parseElementProperties(getJObject(json, "_complete"), res.getCompleteElement());
6594    if (json.has("entry")) {
6595      JsonArray array = getJArray(json, "entry");
6596      for (int i = 0; i < array.size(); i++) {
6597        res.getEntry().add(parseCitationCitedArtifactContributorshipEntryComponent(array.get(i).getAsJsonObject()));
6598      }
6599    };
6600    if (json.has("summary")) {
6601      JsonArray array = getJArray(json, "summary");
6602      for (int i = 0; i < array.size(); i++) {
6603        res.getSummary().add(parseCitationContributorshipSummaryComponent(array.get(i).getAsJsonObject()));
6604      }
6605    };
6606  }
6607
6608  protected Citation.CitationCitedArtifactContributorshipEntryComponent parseCitationCitedArtifactContributorshipEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
6609    Citation.CitationCitedArtifactContributorshipEntryComponent res = new Citation.CitationCitedArtifactContributorshipEntryComponent();
6610    parseCitationCitedArtifactContributorshipEntryComponentProperties(json, res);
6611    return res;
6612  }
6613
6614  protected void parseCitationCitedArtifactContributorshipEntryComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryComponent res) throws IOException, FHIRFormatError {
6615    parseBackboneElementProperties(json, res);
6616    if (json.has("contributor"))
6617      res.setContributor(parseReference(getJObject(json, "contributor")));
6618    if (json.has("forenameInitials"))
6619      res.setForenameInitialsElement(parseString(json.get("forenameInitials").getAsString()));
6620    if (json.has("_forenameInitials"))
6621      parseElementProperties(getJObject(json, "_forenameInitials"), res.getForenameInitialsElement());
6622    if (json.has("affiliation")) {
6623      JsonArray array = getJArray(json, "affiliation");
6624      for (int i = 0; i < array.size(); i++) {
6625        res.getAffiliation().add(parseReference(array.get(i).getAsJsonObject()));
6626      }
6627    };
6628    if (json.has("contributionType")) {
6629      JsonArray array = getJArray(json, "contributionType");
6630      for (int i = 0; i < array.size(); i++) {
6631        res.getContributionType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6632      }
6633    };
6634    if (json.has("role"))
6635      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6636    if (json.has("contributionInstance")) {
6637      JsonArray array = getJArray(json, "contributionInstance");
6638      for (int i = 0; i < array.size(); i++) {
6639        res.getContributionInstance().add(parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(array.get(i).getAsJsonObject()));
6640      }
6641    };
6642    if (json.has("correspondingContact"))
6643      res.setCorrespondingContactElement(parseBoolean(json.get("correspondingContact").getAsBoolean()));
6644    if (json.has("_correspondingContact"))
6645      parseElementProperties(getJObject(json, "_correspondingContact"), res.getCorrespondingContactElement());
6646    if (json.has("rankingOrder"))
6647      res.setRankingOrderElement(parsePositiveInt(json.get("rankingOrder").getAsString()));
6648    if (json.has("_rankingOrder"))
6649      parseElementProperties(getJObject(json, "_rankingOrder"), res.getRankingOrderElement());
6650  }
6651
6652  protected Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
6653    Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res = new Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent();
6654    parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(json, res);
6655    return res;
6656  }
6657
6658  protected void parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res) throws IOException, FHIRFormatError {
6659    parseBackboneElementProperties(json, res);
6660    if (json.has("type"))
6661      res.setType(parseCodeableConcept(getJObject(json, "type")));
6662    if (json.has("time"))
6663      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6664    if (json.has("_time"))
6665      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
6666  }
6667
6668  protected Citation.ContributorshipSummaryComponent parseCitationContributorshipSummaryComponent(JsonObject json) throws IOException, FHIRFormatError {
6669    Citation.ContributorshipSummaryComponent res = new Citation.ContributorshipSummaryComponent();
6670    parseCitationContributorshipSummaryComponentProperties(json, res);
6671    return res;
6672  }
6673
6674  protected void parseCitationContributorshipSummaryComponentProperties(JsonObject json, Citation.ContributorshipSummaryComponent res) throws IOException, FHIRFormatError {
6675    parseBackboneElementProperties(json, res);
6676    if (json.has("type"))
6677      res.setType(parseCodeableConcept(getJObject(json, "type")));
6678    if (json.has("style"))
6679      res.setStyle(parseCodeableConcept(getJObject(json, "style")));
6680    if (json.has("source"))
6681      res.setSource(parseCodeableConcept(getJObject(json, "source")));
6682    if (json.has("value"))
6683      res.setValueElement(parseMarkdown(json.get("value").getAsString()));
6684    if (json.has("_value"))
6685      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6686  }
6687
6688  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
6689    Claim res = new Claim();
6690    parseClaimProperties(json, res);
6691    return res;
6692  }
6693
6694  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
6695    parseDomainResourceProperties(json, res);
6696    if (json.has("identifier")) {
6697      JsonArray array = getJArray(json, "identifier");
6698      for (int i = 0; i < array.size(); i++) {
6699        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6700      }
6701    };
6702    if (json.has("traceNumber")) {
6703      JsonArray array = getJArray(json, "traceNumber");
6704      for (int i = 0; i < array.size(); i++) {
6705        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
6706      }
6707    };
6708    if (json.has("status"))
6709      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
6710    if (json.has("_status"))
6711      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6712    if (json.has("type"))
6713      res.setType(parseCodeableConcept(getJObject(json, "type")));
6714    if (json.has("subType"))
6715      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6716    if (json.has("use"))
6717      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
6718    if (json.has("_use"))
6719      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
6720    if (json.has("patient"))
6721      res.setPatient(parseReference(getJObject(json, "patient")));
6722    if (json.has("billablePeriod"))
6723      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
6724    if (json.has("created"))
6725      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6726    if (json.has("_created"))
6727      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
6728    if (json.has("enterer"))
6729      res.setEnterer(parseReference(getJObject(json, "enterer")));
6730    if (json.has("insurer"))
6731      res.setInsurer(parseReference(getJObject(json, "insurer")));
6732    if (json.has("provider"))
6733      res.setProvider(parseReference(getJObject(json, "provider")));
6734    if (json.has("priority"))
6735      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
6736    if (json.has("fundsReserve"))
6737      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
6738    if (json.has("related")) {
6739      JsonArray array = getJArray(json, "related");
6740      for (int i = 0; i < array.size(); i++) {
6741        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject()));
6742      }
6743    };
6744    if (json.has("prescription"))
6745      res.setPrescription(parseReference(getJObject(json, "prescription")));
6746    if (json.has("originalPrescription"))
6747      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
6748    if (json.has("payee"))
6749      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee")));
6750    if (json.has("referral"))
6751      res.setReferral(parseReference(getJObject(json, "referral")));
6752    if (json.has("encounter")) {
6753      JsonArray array = getJArray(json, "encounter");
6754      for (int i = 0; i < array.size(); i++) {
6755        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
6756      }
6757    };
6758    if (json.has("facility"))
6759      res.setFacility(parseReference(getJObject(json, "facility")));
6760    if (json.has("diagnosisRelatedGroup"))
6761      res.setDiagnosisRelatedGroup(parseCodeableConcept(getJObject(json, "diagnosisRelatedGroup")));
6762    if (json.has("event")) {
6763      JsonArray array = getJArray(json, "event");
6764      for (int i = 0; i < array.size(); i++) {
6765        res.getEvent().add(parseClaimEventComponent(array.get(i).getAsJsonObject()));
6766      }
6767    };
6768    if (json.has("careTeam")) {
6769      JsonArray array = getJArray(json, "careTeam");
6770      for (int i = 0; i < array.size(); i++) {
6771        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject()));
6772      }
6773    };
6774    if (json.has("supportingInfo")) {
6775      JsonArray array = getJArray(json, "supportingInfo");
6776      for (int i = 0; i < array.size(); i++) {
6777        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject()));
6778      }
6779    };
6780    if (json.has("diagnosis")) {
6781      JsonArray array = getJArray(json, "diagnosis");
6782      for (int i = 0; i < array.size(); i++) {
6783        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject()));
6784      }
6785    };
6786    if (json.has("procedure")) {
6787      JsonArray array = getJArray(json, "procedure");
6788      for (int i = 0; i < array.size(); i++) {
6789        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject()));
6790      }
6791    };
6792    if (json.has("insurance")) {
6793      JsonArray array = getJArray(json, "insurance");
6794      for (int i = 0; i < array.size(); i++) {
6795        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject()));
6796      }
6797    };
6798    if (json.has("accident"))
6799      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident")));
6800    if (json.has("patientPaid"))
6801      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
6802    if (json.has("item")) {
6803      JsonArray array = getJArray(json, "item");
6804      for (int i = 0; i < array.size(); i++) {
6805        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject()));
6806      }
6807    };
6808    if (json.has("total"))
6809      res.setTotal(parseMoney(getJObject(json, "total")));
6810  }
6811
6812  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
6813    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
6814    parseClaimRelatedClaimComponentProperties(json, res);
6815    return res;
6816  }
6817
6818  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
6819    parseBackboneElementProperties(json, res);
6820    if (json.has("claim"))
6821      res.setClaim(parseReference(getJObject(json, "claim")));
6822    if (json.has("relationship"))
6823      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
6824    if (json.has("reference"))
6825      res.setReference(parseIdentifier(getJObject(json, "reference")));
6826  }
6827
6828  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
6829    Claim.PayeeComponent res = new Claim.PayeeComponent();
6830    parseClaimPayeeComponentProperties(json, res);
6831    return res;
6832  }
6833
6834  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
6835    parseBackboneElementProperties(json, res);
6836    if (json.has("type"))
6837      res.setType(parseCodeableConcept(getJObject(json, "type")));
6838    if (json.has("party"))
6839      res.setParty(parseReference(getJObject(json, "party")));
6840  }
6841
6842  protected Claim.ClaimEventComponent parseClaimEventComponent(JsonObject json) throws IOException, FHIRFormatError {
6843    Claim.ClaimEventComponent res = new Claim.ClaimEventComponent();
6844    parseClaimEventComponentProperties(json, res);
6845    return res;
6846  }
6847
6848  protected void parseClaimEventComponentProperties(JsonObject json, Claim.ClaimEventComponent res) throws IOException, FHIRFormatError {
6849    parseBackboneElementProperties(json, res);
6850    if (json.has("type"))
6851      res.setType(parseCodeableConcept(getJObject(json, "type")));
6852    DataType when = parseType("when", json);
6853    if (when != null)
6854      res.setWhen(when);
6855  }
6856
6857  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
6858    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
6859    parseClaimCareTeamComponentProperties(json, res);
6860    return res;
6861  }
6862
6863  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
6864    parseBackboneElementProperties(json, res);
6865    if (json.has("sequence"))
6866      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6867    if (json.has("_sequence"))
6868      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6869    if (json.has("provider"))
6870      res.setProvider(parseReference(getJObject(json, "provider")));
6871    if (json.has("responsible"))
6872      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
6873    if (json.has("_responsible"))
6874      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
6875    if (json.has("role"))
6876      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6877    if (json.has("specialty"))
6878      res.setSpecialty(parseCodeableConcept(getJObject(json, "specialty")));
6879  }
6880
6881  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
6882    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
6883    parseClaimSupportingInformationComponentProperties(json, res);
6884    return res;
6885  }
6886
6887  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
6888    parseBackboneElementProperties(json, res);
6889    if (json.has("sequence"))
6890      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6891    if (json.has("_sequence"))
6892      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6893    if (json.has("category"))
6894      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6895    if (json.has("code"))
6896      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6897    DataType timing = parseType("timing", json);
6898    if (timing != null)
6899      res.setTiming(timing);
6900    DataType value = parseType("value", json);
6901    if (value != null)
6902      res.setValue(value);
6903    if (json.has("reason"))
6904      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
6905  }
6906
6907  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
6908    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
6909    parseClaimDiagnosisComponentProperties(json, res);
6910    return res;
6911  }
6912
6913  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
6914    parseBackboneElementProperties(json, res);
6915    if (json.has("sequence"))
6916      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6917    if (json.has("_sequence"))
6918      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6919    DataType diagnosis = parseType("diagnosis", json);
6920    if (diagnosis != null)
6921      res.setDiagnosis(diagnosis);
6922    if (json.has("type")) {
6923      JsonArray array = getJArray(json, "type");
6924      for (int i = 0; i < array.size(); i++) {
6925        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6926      }
6927    };
6928    if (json.has("onAdmission"))
6929      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
6930  }
6931
6932  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
6933    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
6934    parseClaimProcedureComponentProperties(json, res);
6935    return res;
6936  }
6937
6938  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
6939    parseBackboneElementProperties(json, res);
6940    if (json.has("sequence"))
6941      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6942    if (json.has("_sequence"))
6943      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6944    if (json.has("type")) {
6945      JsonArray array = getJArray(json, "type");
6946      for (int i = 0; i < array.size(); i++) {
6947        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6948      }
6949    };
6950    if (json.has("date"))
6951      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6952    if (json.has("_date"))
6953      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6954    DataType procedure = parseType("procedure", json);
6955    if (procedure != null)
6956      res.setProcedure(procedure);
6957    if (json.has("udi")) {
6958      JsonArray array = getJArray(json, "udi");
6959      for (int i = 0; i < array.size(); i++) {
6960        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6961      }
6962    };
6963  }
6964
6965  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
6966    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
6967    parseClaimInsuranceComponentProperties(json, res);
6968    return res;
6969  }
6970
6971  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
6972    parseBackboneElementProperties(json, res);
6973    if (json.has("sequence"))
6974      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6975    if (json.has("_sequence"))
6976      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6977    if (json.has("focal"))
6978      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6979    if (json.has("_focal"))
6980      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
6981    if (json.has("identifier"))
6982      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6983    if (json.has("coverage"))
6984      res.setCoverage(parseReference(getJObject(json, "coverage")));
6985    if (json.has("businessArrangement"))
6986      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6987    if (json.has("_businessArrangement"))
6988      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
6989    if (json.has("preAuthRef")) {
6990      JsonArray array = getJArray(json, "preAuthRef");
6991      for (int i = 0; i < array.size(); i++) {
6992        if (array.get(i).isJsonNull()) {
6993          res.getPreAuthRef().add(new StringType());
6994        } else {;
6995          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
6996        }
6997      }
6998    };
6999    if (json.has("_preAuthRef")) {
7000      JsonArray array = getJArray(json, "_preAuthRef");
7001      for (int i = 0; i < array.size(); i++) {
7002        if (i == res.getPreAuthRef().size())
7003          res.getPreAuthRef().add(parseString(null));
7004        if (array.get(i) instanceof JsonObject) 
7005          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
7006      }
7007    };
7008    if (json.has("claimResponse"))
7009      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
7010  }
7011
7012  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
7013    Claim.AccidentComponent res = new Claim.AccidentComponent();
7014    parseClaimAccidentComponentProperties(json, res);
7015    return res;
7016  }
7017
7018  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
7019    parseBackboneElementProperties(json, res);
7020    if (json.has("date"))
7021      res.setDateElement(parseDate(json.get("date").getAsString()));
7022    if (json.has("_date"))
7023      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7024    if (json.has("type"))
7025      res.setType(parseCodeableConcept(getJObject(json, "type")));
7026    DataType location = parseType("location", json);
7027    if (location != null)
7028      res.setLocation(location);
7029  }
7030
7031  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json) throws IOException, FHIRFormatError {
7032    Claim.ItemComponent res = new Claim.ItemComponent();
7033    parseClaimItemComponentProperties(json, res);
7034    return res;
7035  }
7036
7037  protected void parseClaimItemComponentProperties(JsonObject json, Claim.ItemComponent res) throws IOException, FHIRFormatError {
7038    parseBackboneElementProperties(json, res);
7039    if (json.has("sequence"))
7040      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7041    if (json.has("_sequence"))
7042      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
7043    if (json.has("traceNumber")) {
7044      JsonArray array = getJArray(json, "traceNumber");
7045      for (int i = 0; i < array.size(); i++) {
7046        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7047      }
7048    };
7049    if (json.has("careTeamSequence")) {
7050      JsonArray array = getJArray(json, "careTeamSequence");
7051      for (int i = 0; i < array.size(); i++) {
7052        if (array.get(i).isJsonNull()) {
7053          res.getCareTeamSequence().add(new PositiveIntType());
7054        } else {;
7055          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
7056        }
7057      }
7058    };
7059    if (json.has("_careTeamSequence")) {
7060      JsonArray array = getJArray(json, "_careTeamSequence");
7061      for (int i = 0; i < array.size(); i++) {
7062        if (i == res.getCareTeamSequence().size())
7063          res.getCareTeamSequence().add(parsePositiveInt(null));
7064        if (array.get(i) instanceof JsonObject) 
7065          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
7066      }
7067    };
7068    if (json.has("diagnosisSequence")) {
7069      JsonArray array = getJArray(json, "diagnosisSequence");
7070      for (int i = 0; i < array.size(); i++) {
7071        if (array.get(i).isJsonNull()) {
7072          res.getDiagnosisSequence().add(new PositiveIntType());
7073        } else {;
7074          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
7075        }
7076      }
7077    };
7078    if (json.has("_diagnosisSequence")) {
7079      JsonArray array = getJArray(json, "_diagnosisSequence");
7080      for (int i = 0; i < array.size(); i++) {
7081        if (i == res.getDiagnosisSequence().size())
7082          res.getDiagnosisSequence().add(parsePositiveInt(null));
7083        if (array.get(i) instanceof JsonObject) 
7084          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
7085      }
7086    };
7087    if (json.has("procedureSequence")) {
7088      JsonArray array = getJArray(json, "procedureSequence");
7089      for (int i = 0; i < array.size(); i++) {
7090        if (array.get(i).isJsonNull()) {
7091          res.getProcedureSequence().add(new PositiveIntType());
7092        } else {;
7093          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
7094        }
7095      }
7096    };
7097    if (json.has("_procedureSequence")) {
7098      JsonArray array = getJArray(json, "_procedureSequence");
7099      for (int i = 0; i < array.size(); i++) {
7100        if (i == res.getProcedureSequence().size())
7101          res.getProcedureSequence().add(parsePositiveInt(null));
7102        if (array.get(i) instanceof JsonObject) 
7103          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
7104      }
7105    };
7106    if (json.has("informationSequence")) {
7107      JsonArray array = getJArray(json, "informationSequence");
7108      for (int i = 0; i < array.size(); i++) {
7109        if (array.get(i).isJsonNull()) {
7110          res.getInformationSequence().add(new PositiveIntType());
7111        } else {;
7112          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
7113        }
7114      }
7115    };
7116    if (json.has("_informationSequence")) {
7117      JsonArray array = getJArray(json, "_informationSequence");
7118      for (int i = 0; i < array.size(); i++) {
7119        if (i == res.getInformationSequence().size())
7120          res.getInformationSequence().add(parsePositiveInt(null));
7121        if (array.get(i) instanceof JsonObject) 
7122          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
7123      }
7124    };
7125    if (json.has("revenue"))
7126      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7127    if (json.has("category"))
7128      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7129    if (json.has("productOrService"))
7130      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7131    if (json.has("productOrServiceEnd"))
7132      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7133    if (json.has("request")) {
7134      JsonArray array = getJArray(json, "request");
7135      for (int i = 0; i < array.size(); i++) {
7136        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
7137      }
7138    };
7139    if (json.has("modifier")) {
7140      JsonArray array = getJArray(json, "modifier");
7141      for (int i = 0; i < array.size(); i++) {
7142        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7143      }
7144    };
7145    if (json.has("programCode")) {
7146      JsonArray array = getJArray(json, "programCode");
7147      for (int i = 0; i < array.size(); i++) {
7148        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7149      }
7150    };
7151    DataType serviced = parseType("serviced", json);
7152    if (serviced != null)
7153      res.setServiced(serviced);
7154    DataType location = parseType("location", json);
7155    if (location != null)
7156      res.setLocation(location);
7157    if (json.has("patientPaid"))
7158      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
7159    if (json.has("quantity"))
7160      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7161    if (json.has("unitPrice"))
7162      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7163    if (json.has("factor"))
7164      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7165    if (json.has("_factor"))
7166      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7167    if (json.has("tax"))
7168      res.setTax(parseMoney(getJObject(json, "tax")));
7169    if (json.has("net"))
7170      res.setNet(parseMoney(getJObject(json, "net")));
7171    if (json.has("udi")) {
7172      JsonArray array = getJArray(json, "udi");
7173      for (int i = 0; i < array.size(); i++) {
7174        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7175      }
7176    };
7177    if (json.has("bodySite")) {
7178      JsonArray array = getJArray(json, "bodySite");
7179      for (int i = 0; i < array.size(); i++) {
7180        res.getBodySite().add(parseClaimBodySiteComponent(array.get(i).getAsJsonObject()));
7181      }
7182    };
7183    if (json.has("encounter")) {
7184      JsonArray array = getJArray(json, "encounter");
7185      for (int i = 0; i < array.size(); i++) {
7186        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
7187      }
7188    };
7189    if (json.has("detail")) {
7190      JsonArray array = getJArray(json, "detail");
7191      for (int i = 0; i < array.size(); i++) {
7192        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject()));
7193      }
7194    };
7195  }
7196
7197  protected Claim.BodySiteComponent parseClaimBodySiteComponent(JsonObject json) throws IOException, FHIRFormatError {
7198    Claim.BodySiteComponent res = new Claim.BodySiteComponent();
7199    parseClaimBodySiteComponentProperties(json, res);
7200    return res;
7201  }
7202
7203  protected void parseClaimBodySiteComponentProperties(JsonObject json, Claim.BodySiteComponent res) throws IOException, FHIRFormatError {
7204    parseBackboneElementProperties(json, res);
7205    if (json.has("site")) {
7206      JsonArray array = getJArray(json, "site");
7207      for (int i = 0; i < array.size(); i++) {
7208        res.getSite().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7209      }
7210    };
7211    if (json.has("subSite")) {
7212      JsonArray array = getJArray(json, "subSite");
7213      for (int i = 0; i < array.size(); i++) {
7214        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7215      }
7216    };
7217  }
7218
7219  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7220    Claim.DetailComponent res = new Claim.DetailComponent();
7221    parseClaimDetailComponentProperties(json, res);
7222    return res;
7223  }
7224
7225  protected void parseClaimDetailComponentProperties(JsonObject json, Claim.DetailComponent res) throws IOException, FHIRFormatError {
7226    parseBackboneElementProperties(json, res);
7227    if (json.has("sequence"))
7228      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7229    if (json.has("_sequence"))
7230      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
7231    if (json.has("traceNumber")) {
7232      JsonArray array = getJArray(json, "traceNumber");
7233      for (int i = 0; i < array.size(); i++) {
7234        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7235      }
7236    };
7237    if (json.has("revenue"))
7238      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7239    if (json.has("category"))
7240      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7241    if (json.has("productOrService"))
7242      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7243    if (json.has("productOrServiceEnd"))
7244      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7245    if (json.has("modifier")) {
7246      JsonArray array = getJArray(json, "modifier");
7247      for (int i = 0; i < array.size(); i++) {
7248        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7249      }
7250    };
7251    if (json.has("programCode")) {
7252      JsonArray array = getJArray(json, "programCode");
7253      for (int i = 0; i < array.size(); i++) {
7254        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7255      }
7256    };
7257    if (json.has("patientPaid"))
7258      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
7259    if (json.has("quantity"))
7260      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7261    if (json.has("unitPrice"))
7262      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7263    if (json.has("factor"))
7264      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7265    if (json.has("_factor"))
7266      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7267    if (json.has("tax"))
7268      res.setTax(parseMoney(getJObject(json, "tax")));
7269    if (json.has("net"))
7270      res.setNet(parseMoney(getJObject(json, "net")));
7271    if (json.has("udi")) {
7272      JsonArray array = getJArray(json, "udi");
7273      for (int i = 0; i < array.size(); i++) {
7274        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7275      }
7276    };
7277    if (json.has("subDetail")) {
7278      JsonArray array = getJArray(json, "subDetail");
7279      for (int i = 0; i < array.size(); i++) {
7280        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject()));
7281      }
7282    };
7283  }
7284
7285  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7286    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
7287    parseClaimSubDetailComponentProperties(json, res);
7288    return res;
7289  }
7290
7291  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
7292    parseBackboneElementProperties(json, res);
7293    if (json.has("sequence"))
7294      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7295    if (json.has("_sequence"))
7296      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
7297    if (json.has("traceNumber")) {
7298      JsonArray array = getJArray(json, "traceNumber");
7299      for (int i = 0; i < array.size(); i++) {
7300        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7301      }
7302    };
7303    if (json.has("revenue"))
7304      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7305    if (json.has("category"))
7306      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7307    if (json.has("productOrService"))
7308      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7309    if (json.has("productOrServiceEnd"))
7310      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7311    if (json.has("modifier")) {
7312      JsonArray array = getJArray(json, "modifier");
7313      for (int i = 0; i < array.size(); i++) {
7314        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7315      }
7316    };
7317    if (json.has("programCode")) {
7318      JsonArray array = getJArray(json, "programCode");
7319      for (int i = 0; i < array.size(); i++) {
7320        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7321      }
7322    };
7323    if (json.has("patientPaid"))
7324      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
7325    if (json.has("quantity"))
7326      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7327    if (json.has("unitPrice"))
7328      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7329    if (json.has("factor"))
7330      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7331    if (json.has("_factor"))
7332      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7333    if (json.has("tax"))
7334      res.setTax(parseMoney(getJObject(json, "tax")));
7335    if (json.has("net"))
7336      res.setNet(parseMoney(getJObject(json, "net")));
7337    if (json.has("udi")) {
7338      JsonArray array = getJArray(json, "udi");
7339      for (int i = 0; i < array.size(); i++) {
7340        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7341      }
7342    };
7343  }
7344
7345  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
7346    ClaimResponse res = new ClaimResponse();
7347    parseClaimResponseProperties(json, res);
7348    return res;
7349  }
7350
7351  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
7352    parseDomainResourceProperties(json, res);
7353    if (json.has("identifier")) {
7354      JsonArray array = getJArray(json, "identifier");
7355      for (int i = 0; i < array.size(); i++) {
7356        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7357      }
7358    };
7359    if (json.has("traceNumber")) {
7360      JsonArray array = getJArray(json, "traceNumber");
7361      for (int i = 0; i < array.size(); i++) {
7362        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7363      }
7364    };
7365    if (json.has("status"))
7366      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
7367    if (json.has("_status"))
7368      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7369    if (json.has("type"))
7370      res.setType(parseCodeableConcept(getJObject(json, "type")));
7371    if (json.has("subType"))
7372      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
7373    if (json.has("use"))
7374      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
7375    if (json.has("_use"))
7376      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
7377    if (json.has("patient"))
7378      res.setPatient(parseReference(getJObject(json, "patient")));
7379    if (json.has("created"))
7380      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7381    if (json.has("_created"))
7382      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7383    if (json.has("insurer"))
7384      res.setInsurer(parseReference(getJObject(json, "insurer")));
7385    if (json.has("requestor"))
7386      res.setRequestor(parseReference(getJObject(json, "requestor")));
7387    if (json.has("request"))
7388      res.setRequest(parseReference(getJObject(json, "request")));
7389    if (json.has("outcome"))
7390      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
7391    if (json.has("_outcome"))
7392      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
7393    if (json.has("decision"))
7394      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7395    if (json.has("disposition"))
7396      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
7397    if (json.has("_disposition"))
7398      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
7399    if (json.has("preAuthRef"))
7400      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
7401    if (json.has("_preAuthRef"))
7402      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
7403    if (json.has("preAuthPeriod"))
7404      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
7405    if (json.has("event")) {
7406      JsonArray array = getJArray(json, "event");
7407      for (int i = 0; i < array.size(); i++) {
7408        res.getEvent().add(parseClaimResponseEventComponent(array.get(i).getAsJsonObject()));
7409      }
7410    };
7411    if (json.has("payeeType"))
7412      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
7413    if (json.has("encounter")) {
7414      JsonArray array = getJArray(json, "encounter");
7415      for (int i = 0; i < array.size(); i++) {
7416        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
7417      }
7418    };
7419    if (json.has("diagnosisRelatedGroup"))
7420      res.setDiagnosisRelatedGroup(parseCodeableConcept(getJObject(json, "diagnosisRelatedGroup")));
7421    if (json.has("item")) {
7422      JsonArray array = getJArray(json, "item");
7423      for (int i = 0; i < array.size(); i++) {
7424        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject()));
7425      }
7426    };
7427    if (json.has("addItem")) {
7428      JsonArray array = getJArray(json, "addItem");
7429      for (int i = 0; i < array.size(); i++) {
7430        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject()));
7431      }
7432    };
7433    if (json.has("adjudication")) {
7434      JsonArray array = getJArray(json, "adjudication");
7435      for (int i = 0; i < array.size(); i++) {
7436        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7437      }
7438    };
7439    if (json.has("total")) {
7440      JsonArray array = getJArray(json, "total");
7441      for (int i = 0; i < array.size(); i++) {
7442        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject()));
7443      }
7444    };
7445    if (json.has("payment"))
7446      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment")));
7447    if (json.has("fundsReserve"))
7448      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
7449    if (json.has("formCode"))
7450      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
7451    if (json.has("form"))
7452      res.setForm(parseAttachment(getJObject(json, "form")));
7453    if (json.has("processNote")) {
7454      JsonArray array = getJArray(json, "processNote");
7455      for (int i = 0; i < array.size(); i++) {
7456        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject()));
7457      }
7458    };
7459    if (json.has("communicationRequest")) {
7460      JsonArray array = getJArray(json, "communicationRequest");
7461      for (int i = 0; i < array.size(); i++) {
7462        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
7463      }
7464    };
7465    if (json.has("insurance")) {
7466      JsonArray array = getJArray(json, "insurance");
7467      for (int i = 0; i < array.size(); i++) {
7468        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject()));
7469      }
7470    };
7471    if (json.has("error")) {
7472      JsonArray array = getJArray(json, "error");
7473      for (int i = 0; i < array.size(); i++) {
7474        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject()));
7475      }
7476    };
7477  }
7478
7479  protected ClaimResponse.ClaimResponseEventComponent parseClaimResponseEventComponent(JsonObject json) throws IOException, FHIRFormatError {
7480    ClaimResponse.ClaimResponseEventComponent res = new ClaimResponse.ClaimResponseEventComponent();
7481    parseClaimResponseEventComponentProperties(json, res);
7482    return res;
7483  }
7484
7485  protected void parseClaimResponseEventComponentProperties(JsonObject json, ClaimResponse.ClaimResponseEventComponent res) throws IOException, FHIRFormatError {
7486    parseBackboneElementProperties(json, res);
7487    if (json.has("type"))
7488      res.setType(parseCodeableConcept(getJObject(json, "type")));
7489    DataType when = parseType("when", json);
7490    if (when != null)
7491      res.setWhen(when);
7492  }
7493
7494  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
7495    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
7496    parseClaimResponseItemComponentProperties(json, res);
7497    return res;
7498  }
7499
7500  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
7501    parseBackboneElementProperties(json, res);
7502    if (json.has("itemSequence"))
7503      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
7504    if (json.has("_itemSequence"))
7505      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
7506    if (json.has("traceNumber")) {
7507      JsonArray array = getJArray(json, "traceNumber");
7508      for (int i = 0; i < array.size(); i++) {
7509        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7510      }
7511    };
7512    if (json.has("noteNumber")) {
7513      JsonArray array = getJArray(json, "noteNumber");
7514      for (int i = 0; i < array.size(); i++) {
7515        if (array.get(i).isJsonNull()) {
7516          res.getNoteNumber().add(new PositiveIntType());
7517        } else {;
7518          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7519        }
7520      }
7521    };
7522    if (json.has("_noteNumber")) {
7523      JsonArray array = getJArray(json, "_noteNumber");
7524      for (int i = 0; i < array.size(); i++) {
7525        if (i == res.getNoteNumber().size())
7526          res.getNoteNumber().add(parsePositiveInt(null));
7527        if (array.get(i) instanceof JsonObject) 
7528          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7529      }
7530    };
7531    if (json.has("reviewOutcome"))
7532      res.setReviewOutcome(parseClaimResponseReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
7533    if (json.has("adjudication")) {
7534      JsonArray array = getJArray(json, "adjudication");
7535      for (int i = 0; i < array.size(); i++) {
7536        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7537      }
7538    };
7539    if (json.has("detail")) {
7540      JsonArray array = getJArray(json, "detail");
7541      for (int i = 0; i < array.size(); i++) {
7542        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject()));
7543      }
7544    };
7545  }
7546
7547  protected ClaimResponse.ReviewOutcomeComponent parseClaimResponseReviewOutcomeComponent(JsonObject json) throws IOException, FHIRFormatError {
7548    ClaimResponse.ReviewOutcomeComponent res = new ClaimResponse.ReviewOutcomeComponent();
7549    parseClaimResponseReviewOutcomeComponentProperties(json, res);
7550    return res;
7551  }
7552
7553  protected void parseClaimResponseReviewOutcomeComponentProperties(JsonObject json, ClaimResponse.ReviewOutcomeComponent res) throws IOException, FHIRFormatError {
7554    parseBackboneElementProperties(json, res);
7555    if (json.has("decision"))
7556      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7557    if (json.has("reason")) {
7558      JsonArray array = getJArray(json, "reason");
7559      for (int i = 0; i < array.size(); i++) {
7560        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7561      }
7562    };
7563    if (json.has("preAuthRef"))
7564      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
7565    if (json.has("_preAuthRef"))
7566      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
7567    if (json.has("preAuthPeriod"))
7568      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
7569  }
7570
7571  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7572    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
7573    parseClaimResponseAdjudicationComponentProperties(json, res);
7574    return res;
7575  }
7576
7577  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
7578    parseBackboneElementProperties(json, res);
7579    if (json.has("category"))
7580      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7581    if (json.has("reason"))
7582      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
7583    if (json.has("amount"))
7584      res.setAmount(parseMoney(getJObject(json, "amount")));
7585    if (json.has("quantity"))
7586      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7587  }
7588
7589  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7590    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
7591    parseClaimResponseItemDetailComponentProperties(json, res);
7592    return res;
7593  }
7594
7595  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
7596    parseBackboneElementProperties(json, res);
7597    if (json.has("detailSequence"))
7598      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
7599    if (json.has("_detailSequence"))
7600      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
7601    if (json.has("traceNumber")) {
7602      JsonArray array = getJArray(json, "traceNumber");
7603      for (int i = 0; i < array.size(); i++) {
7604        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7605      }
7606    };
7607    if (json.has("noteNumber")) {
7608      JsonArray array = getJArray(json, "noteNumber");
7609      for (int i = 0; i < array.size(); i++) {
7610        if (array.get(i).isJsonNull()) {
7611          res.getNoteNumber().add(new PositiveIntType());
7612        } else {;
7613          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7614        }
7615      }
7616    };
7617    if (json.has("_noteNumber")) {
7618      JsonArray array = getJArray(json, "_noteNumber");
7619      for (int i = 0; i < array.size(); i++) {
7620        if (i == res.getNoteNumber().size())
7621          res.getNoteNumber().add(parsePositiveInt(null));
7622        if (array.get(i) instanceof JsonObject) 
7623          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7624      }
7625    };
7626    if (json.has("reviewOutcome"))
7627      res.setReviewOutcome(parseClaimResponseReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
7628    if (json.has("adjudication")) {
7629      JsonArray array = getJArray(json, "adjudication");
7630      for (int i = 0; i < array.size(); i++) {
7631        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7632      }
7633    };
7634    if (json.has("subDetail")) {
7635      JsonArray array = getJArray(json, "subDetail");
7636      for (int i = 0; i < array.size(); i++) {
7637        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject()));
7638      }
7639    };
7640  }
7641
7642  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7643    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
7644    parseClaimResponseSubDetailComponentProperties(json, res);
7645    return res;
7646  }
7647
7648  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
7649    parseBackboneElementProperties(json, res);
7650    if (json.has("subDetailSequence"))
7651      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
7652    if (json.has("_subDetailSequence"))
7653      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
7654    if (json.has("traceNumber")) {
7655      JsonArray array = getJArray(json, "traceNumber");
7656      for (int i = 0; i < array.size(); i++) {
7657        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7658      }
7659    };
7660    if (json.has("noteNumber")) {
7661      JsonArray array = getJArray(json, "noteNumber");
7662      for (int i = 0; i < array.size(); i++) {
7663        if (array.get(i).isJsonNull()) {
7664          res.getNoteNumber().add(new PositiveIntType());
7665        } else {;
7666          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7667        }
7668      }
7669    };
7670    if (json.has("_noteNumber")) {
7671      JsonArray array = getJArray(json, "_noteNumber");
7672      for (int i = 0; i < array.size(); i++) {
7673        if (i == res.getNoteNumber().size())
7674          res.getNoteNumber().add(parsePositiveInt(null));
7675        if (array.get(i) instanceof JsonObject) 
7676          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7677      }
7678    };
7679    if (json.has("reviewOutcome"))
7680      res.setReviewOutcome(parseClaimResponseReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
7681    if (json.has("adjudication")) {
7682      JsonArray array = getJArray(json, "adjudication");
7683      for (int i = 0; i < array.size(); i++) {
7684        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7685      }
7686    };
7687  }
7688
7689  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
7690    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
7691    parseClaimResponseAddedItemComponentProperties(json, res);
7692    return res;
7693  }
7694
7695  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
7696    parseBackboneElementProperties(json, res);
7697    if (json.has("itemSequence")) {
7698      JsonArray array = getJArray(json, "itemSequence");
7699      for (int i = 0; i < array.size(); i++) {
7700        if (array.get(i).isJsonNull()) {
7701          res.getItemSequence().add(new PositiveIntType());
7702        } else {;
7703          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
7704        }
7705      }
7706    };
7707    if (json.has("_itemSequence")) {
7708      JsonArray array = getJArray(json, "_itemSequence");
7709      for (int i = 0; i < array.size(); i++) {
7710        if (i == res.getItemSequence().size())
7711          res.getItemSequence().add(parsePositiveInt(null));
7712        if (array.get(i) instanceof JsonObject) 
7713          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
7714      }
7715    };
7716    if (json.has("detailSequence")) {
7717      JsonArray array = getJArray(json, "detailSequence");
7718      for (int i = 0; i < array.size(); i++) {
7719        if (array.get(i).isJsonNull()) {
7720          res.getDetailSequence().add(new PositiveIntType());
7721        } else {;
7722          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
7723        }
7724      }
7725    };
7726    if (json.has("_detailSequence")) {
7727      JsonArray array = getJArray(json, "_detailSequence");
7728      for (int i = 0; i < array.size(); i++) {
7729        if (i == res.getDetailSequence().size())
7730          res.getDetailSequence().add(parsePositiveInt(null));
7731        if (array.get(i) instanceof JsonObject) 
7732          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
7733      }
7734    };
7735    if (json.has("subdetailSequence")) {
7736      JsonArray array = getJArray(json, "subdetailSequence");
7737      for (int i = 0; i < array.size(); i++) {
7738        if (array.get(i).isJsonNull()) {
7739          res.getSubdetailSequence().add(new PositiveIntType());
7740        } else {;
7741          res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
7742        }
7743      }
7744    };
7745    if (json.has("_subdetailSequence")) {
7746      JsonArray array = getJArray(json, "_subdetailSequence");
7747      for (int i = 0; i < array.size(); i++) {
7748        if (i == res.getSubdetailSequence().size())
7749          res.getSubdetailSequence().add(parsePositiveInt(null));
7750        if (array.get(i) instanceof JsonObject) 
7751          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
7752      }
7753    };
7754    if (json.has("traceNumber")) {
7755      JsonArray array = getJArray(json, "traceNumber");
7756      for (int i = 0; i < array.size(); i++) {
7757        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7758      }
7759    };
7760    if (json.has("provider")) {
7761      JsonArray array = getJArray(json, "provider");
7762      for (int i = 0; i < array.size(); i++) {
7763        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
7764      }
7765    };
7766    if (json.has("revenue"))
7767      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7768    if (json.has("productOrService"))
7769      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7770    if (json.has("productOrServiceEnd"))
7771      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7772    if (json.has("request")) {
7773      JsonArray array = getJArray(json, "request");
7774      for (int i = 0; i < array.size(); i++) {
7775        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
7776      }
7777    };
7778    if (json.has("modifier")) {
7779      JsonArray array = getJArray(json, "modifier");
7780      for (int i = 0; i < array.size(); i++) {
7781        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7782      }
7783    };
7784    if (json.has("programCode")) {
7785      JsonArray array = getJArray(json, "programCode");
7786      for (int i = 0; i < array.size(); i++) {
7787        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7788      }
7789    };
7790    DataType serviced = parseType("serviced", json);
7791    if (serviced != null)
7792      res.setServiced(serviced);
7793    DataType location = parseType("location", json);
7794    if (location != null)
7795      res.setLocation(location);
7796    if (json.has("quantity"))
7797      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7798    if (json.has("unitPrice"))
7799      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7800    if (json.has("factor"))
7801      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7802    if (json.has("_factor"))
7803      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7804    if (json.has("tax"))
7805      res.setTax(parseMoney(getJObject(json, "tax")));
7806    if (json.has("net"))
7807      res.setNet(parseMoney(getJObject(json, "net")));
7808    if (json.has("bodySite")) {
7809      JsonArray array = getJArray(json, "bodySite");
7810      for (int i = 0; i < array.size(); i++) {
7811        res.getBodySite().add(parseClaimResponseBodySiteComponent(array.get(i).getAsJsonObject()));
7812      }
7813    };
7814    if (json.has("noteNumber")) {
7815      JsonArray array = getJArray(json, "noteNumber");
7816      for (int i = 0; i < array.size(); i++) {
7817        if (array.get(i).isJsonNull()) {
7818          res.getNoteNumber().add(new PositiveIntType());
7819        } else {;
7820          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7821        }
7822      }
7823    };
7824    if (json.has("_noteNumber")) {
7825      JsonArray array = getJArray(json, "_noteNumber");
7826      for (int i = 0; i < array.size(); i++) {
7827        if (i == res.getNoteNumber().size())
7828          res.getNoteNumber().add(parsePositiveInt(null));
7829        if (array.get(i) instanceof JsonObject) 
7830          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7831      }
7832    };
7833    if (json.has("reviewOutcome"))
7834      res.setReviewOutcome(parseClaimResponseReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
7835    if (json.has("adjudication")) {
7836      JsonArray array = getJArray(json, "adjudication");
7837      for (int i = 0; i < array.size(); i++) {
7838        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7839      }
7840    };
7841    if (json.has("detail")) {
7842      JsonArray array = getJArray(json, "detail");
7843      for (int i = 0; i < array.size(); i++) {
7844        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject()));
7845      }
7846    };
7847  }
7848
7849  protected ClaimResponse.BodySiteComponent parseClaimResponseBodySiteComponent(JsonObject json) throws IOException, FHIRFormatError {
7850    ClaimResponse.BodySiteComponent res = new ClaimResponse.BodySiteComponent();
7851    parseClaimResponseBodySiteComponentProperties(json, res);
7852    return res;
7853  }
7854
7855  protected void parseClaimResponseBodySiteComponentProperties(JsonObject json, ClaimResponse.BodySiteComponent res) throws IOException, FHIRFormatError {
7856    parseBackboneElementProperties(json, res);
7857    if (json.has("site")) {
7858      JsonArray array = getJArray(json, "site");
7859      for (int i = 0; i < array.size(); i++) {
7860        res.getSite().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7861      }
7862    };
7863    if (json.has("subSite")) {
7864      JsonArray array = getJArray(json, "subSite");
7865      for (int i = 0; i < array.size(); i++) {
7866        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7867      }
7868    };
7869  }
7870
7871  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7872    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
7873    parseClaimResponseAddedItemDetailComponentProperties(json, res);
7874    return res;
7875  }
7876
7877  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
7878    parseBackboneElementProperties(json, res);
7879    if (json.has("traceNumber")) {
7880      JsonArray array = getJArray(json, "traceNumber");
7881      for (int i = 0; i < array.size(); i++) {
7882        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7883      }
7884    };
7885    if (json.has("revenue"))
7886      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7887    if (json.has("productOrService"))
7888      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7889    if (json.has("productOrServiceEnd"))
7890      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7891    if (json.has("modifier")) {
7892      JsonArray array = getJArray(json, "modifier");
7893      for (int i = 0; i < array.size(); i++) {
7894        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7895      }
7896    };
7897    if (json.has("quantity"))
7898      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7899    if (json.has("unitPrice"))
7900      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7901    if (json.has("factor"))
7902      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7903    if (json.has("_factor"))
7904      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7905    if (json.has("tax"))
7906      res.setTax(parseMoney(getJObject(json, "tax")));
7907    if (json.has("net"))
7908      res.setNet(parseMoney(getJObject(json, "net")));
7909    if (json.has("noteNumber")) {
7910      JsonArray array = getJArray(json, "noteNumber");
7911      for (int i = 0; i < array.size(); i++) {
7912        if (array.get(i).isJsonNull()) {
7913          res.getNoteNumber().add(new PositiveIntType());
7914        } else {;
7915          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7916        }
7917      }
7918    };
7919    if (json.has("_noteNumber")) {
7920      JsonArray array = getJArray(json, "_noteNumber");
7921      for (int i = 0; i < array.size(); i++) {
7922        if (i == res.getNoteNumber().size())
7923          res.getNoteNumber().add(parsePositiveInt(null));
7924        if (array.get(i) instanceof JsonObject) 
7925          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7926      }
7927    };
7928    if (json.has("reviewOutcome"))
7929      res.setReviewOutcome(parseClaimResponseReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
7930    if (json.has("adjudication")) {
7931      JsonArray array = getJArray(json, "adjudication");
7932      for (int i = 0; i < array.size(); i++) {
7933        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7934      }
7935    };
7936    if (json.has("subDetail")) {
7937      JsonArray array = getJArray(json, "subDetail");
7938      for (int i = 0; i < array.size(); i++) {
7939        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject()));
7940      }
7941    };
7942  }
7943
7944  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7945    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
7946    parseClaimResponseAddedItemSubDetailComponentProperties(json, res);
7947    return res;
7948  }
7949
7950  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
7951    parseBackboneElementProperties(json, res);
7952    if (json.has("traceNumber")) {
7953      JsonArray array = getJArray(json, "traceNumber");
7954      for (int i = 0; i < array.size(); i++) {
7955        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
7956      }
7957    };
7958    if (json.has("revenue"))
7959      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7960    if (json.has("productOrService"))
7961      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7962    if (json.has("productOrServiceEnd"))
7963      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7964    if (json.has("modifier")) {
7965      JsonArray array = getJArray(json, "modifier");
7966      for (int i = 0; i < array.size(); i++) {
7967        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7968      }
7969    };
7970    if (json.has("quantity"))
7971      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7972    if (json.has("unitPrice"))
7973      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7974    if (json.has("factor"))
7975      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7976    if (json.has("_factor"))
7977      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7978    if (json.has("tax"))
7979      res.setTax(parseMoney(getJObject(json, "tax")));
7980    if (json.has("net"))
7981      res.setNet(parseMoney(getJObject(json, "net")));
7982    if (json.has("noteNumber")) {
7983      JsonArray array = getJArray(json, "noteNumber");
7984      for (int i = 0; i < array.size(); i++) {
7985        if (array.get(i).isJsonNull()) {
7986          res.getNoteNumber().add(new PositiveIntType());
7987        } else {;
7988          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7989        }
7990      }
7991    };
7992    if (json.has("_noteNumber")) {
7993      JsonArray array = getJArray(json, "_noteNumber");
7994      for (int i = 0; i < array.size(); i++) {
7995        if (i == res.getNoteNumber().size())
7996          res.getNoteNumber().add(parsePositiveInt(null));
7997        if (array.get(i) instanceof JsonObject) 
7998          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7999      }
8000    };
8001    if (json.has("reviewOutcome"))
8002      res.setReviewOutcome(parseClaimResponseReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
8003    if (json.has("adjudication")) {
8004      JsonArray array = getJArray(json, "adjudication");
8005      for (int i = 0; i < array.size(); i++) {
8006        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
8007      }
8008    };
8009  }
8010
8011  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
8012    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
8013    parseClaimResponseTotalComponentProperties(json, res);
8014    return res;
8015  }
8016
8017  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
8018    parseBackboneElementProperties(json, res);
8019    if (json.has("category"))
8020      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
8021    if (json.has("amount"))
8022      res.setAmount(parseMoney(getJObject(json, "amount")));
8023  }
8024
8025  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
8026    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
8027    parseClaimResponsePaymentComponentProperties(json, res);
8028    return res;
8029  }
8030
8031  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
8032    parseBackboneElementProperties(json, res);
8033    if (json.has("type"))
8034      res.setType(parseCodeableConcept(getJObject(json, "type")));
8035    if (json.has("adjustment"))
8036      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
8037    if (json.has("adjustmentReason"))
8038      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
8039    if (json.has("date"))
8040      res.setDateElement(parseDate(json.get("date").getAsString()));
8041    if (json.has("_date"))
8042      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8043    if (json.has("amount"))
8044      res.setAmount(parseMoney(getJObject(json, "amount")));
8045    if (json.has("identifier"))
8046      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8047  }
8048
8049  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
8050    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
8051    parseClaimResponseNoteComponentProperties(json, res);
8052    return res;
8053  }
8054
8055  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
8056    parseBackboneElementProperties(json, res);
8057    if (json.has("number"))
8058      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
8059    if (json.has("_number"))
8060      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
8061    if (json.has("type"))
8062      res.setType(parseCodeableConcept(getJObject(json, "type")));
8063    if (json.has("text"))
8064      res.setTextElement(parseString(json.get("text").getAsString()));
8065    if (json.has("_text"))
8066      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
8067    if (json.has("language"))
8068      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
8069  }
8070
8071  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
8072    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
8073    parseClaimResponseInsuranceComponentProperties(json, res);
8074    return res;
8075  }
8076
8077  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8078    parseBackboneElementProperties(json, res);
8079    if (json.has("sequence"))
8080      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8081    if (json.has("_sequence"))
8082      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
8083    if (json.has("focal"))
8084      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
8085    if (json.has("_focal"))
8086      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
8087    if (json.has("coverage"))
8088      res.setCoverage(parseReference(getJObject(json, "coverage")));
8089    if (json.has("businessArrangement"))
8090      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
8091    if (json.has("_businessArrangement"))
8092      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
8093    if (json.has("claimResponse"))
8094      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
8095  }
8096
8097  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json) throws IOException, FHIRFormatError {
8098    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
8099    parseClaimResponseErrorComponentProperties(json, res);
8100    return res;
8101  }
8102
8103  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
8104    parseBackboneElementProperties(json, res);
8105    if (json.has("itemSequence"))
8106      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
8107    if (json.has("_itemSequence"))
8108      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
8109    if (json.has("detailSequence"))
8110      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
8111    if (json.has("_detailSequence"))
8112      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
8113    if (json.has("subDetailSequence"))
8114      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
8115    if (json.has("_subDetailSequence"))
8116      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
8117    if (json.has("code"))
8118      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8119    if (json.has("expression")) {
8120      JsonArray array = getJArray(json, "expression");
8121      for (int i = 0; i < array.size(); i++) {
8122        if (array.get(i).isJsonNull()) {
8123          res.getExpression().add(new StringType());
8124        } else {;
8125          res.getExpression().add(parseString(array.get(i).getAsString()));
8126        }
8127      }
8128    };
8129    if (json.has("_expression")) {
8130      JsonArray array = getJArray(json, "_expression");
8131      for (int i = 0; i < array.size(); i++) {
8132        if (i == res.getExpression().size())
8133          res.getExpression().add(parseString(null));
8134        if (array.get(i) instanceof JsonObject) 
8135          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
8136      }
8137    };
8138  }
8139
8140  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
8141    ClinicalImpression res = new ClinicalImpression();
8142    parseClinicalImpressionProperties(json, res);
8143    return res;
8144  }
8145
8146  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
8147    parseDomainResourceProperties(json, res);
8148    if (json.has("identifier")) {
8149      JsonArray array = getJArray(json, "identifier");
8150      for (int i = 0; i < array.size(); i++) {
8151        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8152      }
8153    };
8154    if (json.has("status"))
8155      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
8156    if (json.has("_status"))
8157      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8158    if (json.has("statusReason"))
8159      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
8160    if (json.has("description"))
8161      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8162    if (json.has("_description"))
8163      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8164    if (json.has("subject"))
8165      res.setSubject(parseReference(getJObject(json, "subject")));
8166    if (json.has("encounter"))
8167      res.setEncounter(parseReference(getJObject(json, "encounter")));
8168    DataType effective = parseType("effective", json);
8169    if (effective != null)
8170      res.setEffective(effective);
8171    if (json.has("date"))
8172      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8173    if (json.has("_date"))
8174      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8175    if (json.has("performer"))
8176      res.setPerformer(parseReference(getJObject(json, "performer")));
8177    if (json.has("previous"))
8178      res.setPrevious(parseReference(getJObject(json, "previous")));
8179    if (json.has("problem")) {
8180      JsonArray array = getJArray(json, "problem");
8181      for (int i = 0; i < array.size(); i++) {
8182        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
8183      }
8184    };
8185    if (json.has("changePattern"))
8186      res.setChangePattern(parseCodeableConcept(getJObject(json, "changePattern")));
8187    if (json.has("protocol")) {
8188      JsonArray array = getJArray(json, "protocol");
8189      for (int i = 0; i < array.size(); i++) {
8190        if (array.get(i).isJsonNull()) {
8191          res.getProtocol().add(new UriType());
8192        } else {;
8193          res.getProtocol().add(parseUri(array.get(i).getAsString()));
8194        }
8195      }
8196    };
8197    if (json.has("_protocol")) {
8198      JsonArray array = getJArray(json, "_protocol");
8199      for (int i = 0; i < array.size(); i++) {
8200        if (i == res.getProtocol().size())
8201          res.getProtocol().add(parseUri(null));
8202        if (array.get(i) instanceof JsonObject) 
8203          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
8204      }
8205    };
8206    if (json.has("summary"))
8207      res.setSummaryElement(parseString(json.get("summary").getAsString()));
8208    if (json.has("_summary"))
8209      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
8210    if (json.has("finding")) {
8211      JsonArray array = getJArray(json, "finding");
8212      for (int i = 0; i < array.size(); i++) {
8213        res.getFinding().add(parseClinicalImpressionFindingComponent(array.get(i).getAsJsonObject()));
8214      }
8215    };
8216    if (json.has("prognosisCodeableConcept")) {
8217      JsonArray array = getJArray(json, "prognosisCodeableConcept");
8218      for (int i = 0; i < array.size(); i++) {
8219        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8220      }
8221    };
8222    if (json.has("prognosisReference")) {
8223      JsonArray array = getJArray(json, "prognosisReference");
8224      for (int i = 0; i < array.size(); i++) {
8225        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
8226      }
8227    };
8228    if (json.has("supportingInfo")) {
8229      JsonArray array = getJArray(json, "supportingInfo");
8230      for (int i = 0; i < array.size(); i++) {
8231        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
8232      }
8233    };
8234    if (json.has("note")) {
8235      JsonArray array = getJArray(json, "note");
8236      for (int i = 0; i < array.size(); i++) {
8237        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8238      }
8239    };
8240  }
8241
8242  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionFindingComponent(JsonObject json) throws IOException, FHIRFormatError {
8243    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
8244    parseClinicalImpressionFindingComponentProperties(json, res);
8245    return res;
8246  }
8247
8248  protected void parseClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
8249    parseBackboneElementProperties(json, res);
8250    if (json.has("item"))
8251      res.setItem(parseCodeableReference(getJObject(json, "item")));
8252    if (json.has("basis"))
8253      res.setBasisElement(parseString(json.get("basis").getAsString()));
8254    if (json.has("_basis"))
8255      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
8256  }
8257
8258  protected ClinicalUseDefinition parseClinicalUseDefinition(JsonObject json) throws IOException, FHIRFormatError {
8259    ClinicalUseDefinition res = new ClinicalUseDefinition();
8260    parseClinicalUseDefinitionProperties(json, res);
8261    return res;
8262  }
8263
8264  protected void parseClinicalUseDefinitionProperties(JsonObject json, ClinicalUseDefinition res) throws IOException, FHIRFormatError {
8265    parseDomainResourceProperties(json, res);
8266    if (json.has("identifier")) {
8267      JsonArray array = getJArray(json, "identifier");
8268      for (int i = 0; i < array.size(); i++) {
8269        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8270      }
8271    };
8272    if (json.has("type"))
8273      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ClinicalUseDefinition.ClinicalUseDefinitionType.NULL, new ClinicalUseDefinition.ClinicalUseDefinitionTypeEnumFactory()));
8274    if (json.has("_type"))
8275      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
8276    if (json.has("category")) {
8277      JsonArray array = getJArray(json, "category");
8278      for (int i = 0; i < array.size(); i++) {
8279        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8280      }
8281    };
8282    if (json.has("subject")) {
8283      JsonArray array = getJArray(json, "subject");
8284      for (int i = 0; i < array.size(); i++) {
8285        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
8286      }
8287    };
8288    if (json.has("status"))
8289      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
8290    if (json.has("contraindication"))
8291      res.setContraindication(parseClinicalUseDefinitionContraindicationComponent(getJObject(json, "contraindication")));
8292    if (json.has("indication"))
8293      res.setIndication(parseClinicalUseDefinitionIndicationComponent(getJObject(json, "indication")));
8294    if (json.has("interaction"))
8295      res.setInteraction(parseClinicalUseDefinitionInteractionComponent(getJObject(json, "interaction")));
8296    if (json.has("population")) {
8297      JsonArray array = getJArray(json, "population");
8298      for (int i = 0; i < array.size(); i++) {
8299        res.getPopulation().add(parseReference(array.get(i).getAsJsonObject()));
8300      }
8301    };
8302    if (json.has("library")) {
8303      JsonArray array = getJArray(json, "library");
8304      for (int i = 0; i < array.size(); i++) {
8305        if (array.get(i).isJsonNull()) {
8306          res.getLibrary().add(new CanonicalType());
8307        } else {;
8308          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
8309        }
8310      }
8311    };
8312    if (json.has("_library")) {
8313      JsonArray array = getJArray(json, "_library");
8314      for (int i = 0; i < array.size(); i++) {
8315        if (i == res.getLibrary().size())
8316          res.getLibrary().add(parseCanonical(null));
8317        if (array.get(i) instanceof JsonObject) 
8318          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
8319      }
8320    };
8321    if (json.has("undesirableEffect"))
8322      res.setUndesirableEffect(parseClinicalUseDefinitionUndesirableEffectComponent(getJObject(json, "undesirableEffect")));
8323    if (json.has("warning"))
8324      res.setWarning(parseClinicalUseDefinitionWarningComponent(getJObject(json, "warning")));
8325  }
8326
8327  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent parseClinicalUseDefinitionContraindicationComponent(JsonObject json) throws IOException, FHIRFormatError {
8328    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent();
8329    parseClinicalUseDefinitionContraindicationComponentProperties(json, res);
8330    return res;
8331  }
8332
8333  protected void parseClinicalUseDefinitionContraindicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res) throws IOException, FHIRFormatError {
8334    parseBackboneElementProperties(json, res);
8335    if (json.has("diseaseSymptomProcedure"))
8336      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
8337    if (json.has("diseaseStatus"))
8338      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
8339    if (json.has("comorbidity")) {
8340      JsonArray array = getJArray(json, "comorbidity");
8341      for (int i = 0; i < array.size(); i++) {
8342        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8343      }
8344    };
8345    if (json.has("indication")) {
8346      JsonArray array = getJArray(json, "indication");
8347      for (int i = 0; i < array.size(); i++) {
8348        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
8349      }
8350    };
8351    if (json.has("applicability"))
8352      res.setApplicability(parseExpression(getJObject(json, "applicability")));
8353    if (json.has("otherTherapy")) {
8354      JsonArray array = getJArray(json, "otherTherapy");
8355      for (int i = 0; i < array.size(); i++) {
8356        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
8357      }
8358    };
8359  }
8360
8361  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent parseClinicalUseDefinitionContraindicationOtherTherapyComponent(JsonObject json) throws IOException, FHIRFormatError {
8362    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent();
8363    parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(json, res);
8364    return res;
8365  }
8366
8367  protected void parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
8368    parseBackboneElementProperties(json, res);
8369    if (json.has("relationshipType"))
8370      res.setRelationshipType(parseCodeableConcept(getJObject(json, "relationshipType")));
8371    if (json.has("treatment"))
8372      res.setTreatment(parseCodeableReference(getJObject(json, "treatment")));
8373  }
8374
8375  protected ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent parseClinicalUseDefinitionIndicationComponent(JsonObject json) throws IOException, FHIRFormatError {
8376    ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent();
8377    parseClinicalUseDefinitionIndicationComponentProperties(json, res);
8378    return res;
8379  }
8380
8381  protected void parseClinicalUseDefinitionIndicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res) throws IOException, FHIRFormatError {
8382    parseBackboneElementProperties(json, res);
8383    if (json.has("diseaseSymptomProcedure"))
8384      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
8385    if (json.has("diseaseStatus"))
8386      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
8387    if (json.has("comorbidity")) {
8388      JsonArray array = getJArray(json, "comorbidity");
8389      for (int i = 0; i < array.size(); i++) {
8390        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8391      }
8392    };
8393    if (json.has("intendedEffect"))
8394      res.setIntendedEffect(parseCodeableReference(getJObject(json, "intendedEffect")));
8395    DataType duration = parseType("duration", json);
8396    if (duration != null)
8397      res.setDuration(duration);
8398    if (json.has("undesirableEffect")) {
8399      JsonArray array = getJArray(json, "undesirableEffect");
8400      for (int i = 0; i < array.size(); i++) {
8401        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
8402      }
8403    };
8404    if (json.has("applicability"))
8405      res.setApplicability(parseExpression(getJObject(json, "applicability")));
8406    if (json.has("otherTherapy")) {
8407      JsonArray array = getJArray(json, "otherTherapy");
8408      for (int i = 0; i < array.size(); i++) {
8409        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
8410      }
8411    };
8412  }
8413
8414  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent parseClinicalUseDefinitionInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
8415    ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent();
8416    parseClinicalUseDefinitionInteractionComponentProperties(json, res);
8417    return res;
8418  }
8419
8420  protected void parseClinicalUseDefinitionInteractionComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res) throws IOException, FHIRFormatError {
8421    parseBackboneElementProperties(json, res);
8422    if (json.has("interactant")) {
8423      JsonArray array = getJArray(json, "interactant");
8424      for (int i = 0; i < array.size(); i++) {
8425        res.getInteractant().add(parseClinicalUseDefinitionInteractionInteractantComponent(array.get(i).getAsJsonObject()));
8426      }
8427    };
8428    if (json.has("type"))
8429      res.setType(parseCodeableConcept(getJObject(json, "type")));
8430    if (json.has("effect"))
8431      res.setEffect(parseCodeableReference(getJObject(json, "effect")));
8432    if (json.has("incidence"))
8433      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
8434    if (json.has("management")) {
8435      JsonArray array = getJArray(json, "management");
8436      for (int i = 0; i < array.size(); i++) {
8437        res.getManagement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8438      }
8439    };
8440  }
8441
8442  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent parseClinicalUseDefinitionInteractionInteractantComponent(JsonObject json) throws IOException, FHIRFormatError {
8443    ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent();
8444    parseClinicalUseDefinitionInteractionInteractantComponentProperties(json, res);
8445    return res;
8446  }
8447
8448  protected void parseClinicalUseDefinitionInteractionInteractantComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res) throws IOException, FHIRFormatError {
8449    parseBackboneElementProperties(json, res);
8450    DataType item = parseType("item", json);
8451    if (item != null)
8452      res.setItem(item);
8453  }
8454
8455  protected ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent parseClinicalUseDefinitionUndesirableEffectComponent(JsonObject json) throws IOException, FHIRFormatError {
8456    ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent();
8457    parseClinicalUseDefinitionUndesirableEffectComponentProperties(json, res);
8458    return res;
8459  }
8460
8461  protected void parseClinicalUseDefinitionUndesirableEffectComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res) throws IOException, FHIRFormatError {
8462    parseBackboneElementProperties(json, res);
8463    if (json.has("symptomConditionEffect"))
8464      res.setSymptomConditionEffect(parseCodeableReference(getJObject(json, "symptomConditionEffect")));
8465    if (json.has("classification"))
8466      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
8467    if (json.has("frequencyOfOccurrence"))
8468      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
8469  }
8470
8471  protected ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent parseClinicalUseDefinitionWarningComponent(JsonObject json) throws IOException, FHIRFormatError {
8472    ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent();
8473    parseClinicalUseDefinitionWarningComponentProperties(json, res);
8474    return res;
8475  }
8476
8477  protected void parseClinicalUseDefinitionWarningComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res) throws IOException, FHIRFormatError {
8478    parseBackboneElementProperties(json, res);
8479    if (json.has("description"))
8480      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8481    if (json.has("_description"))
8482      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8483    if (json.has("code"))
8484      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8485  }
8486
8487  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
8488    CodeSystem res = new CodeSystem();
8489    parseCodeSystemProperties(json, res);
8490    return res;
8491  }
8492
8493  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
8494    parseMetadataResourceProperties(json, res);
8495    if (json.has("url"))
8496      res.setUrlElement(parseUri(json.get("url").getAsString()));
8497    if (json.has("_url"))
8498      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8499    if (json.has("identifier")) {
8500      JsonArray array = getJArray(json, "identifier");
8501      for (int i = 0; i < array.size(); i++) {
8502        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8503      }
8504    };
8505    if (json.has("version"))
8506      res.setVersionElement(parseString(json.get("version").getAsString()));
8507    if (json.has("_version"))
8508      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8509    DataType versionAlgorithm = parseType("versionAlgorithm", json);
8510    if (versionAlgorithm != null)
8511      res.setVersionAlgorithm(versionAlgorithm);
8512    if (json.has("name"))
8513      res.setNameElement(parseString(json.get("name").getAsString()));
8514    if (json.has("_name"))
8515      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8516    if (json.has("title"))
8517      res.setTitleElement(parseString(json.get("title").getAsString()));
8518    if (json.has("_title"))
8519      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8520    if (json.has("status"))
8521      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8522    if (json.has("_status"))
8523      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8524    if (json.has("experimental"))
8525      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8526    if (json.has("_experimental"))
8527      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8528    if (json.has("date"))
8529      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8530    if (json.has("_date"))
8531      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8532    if (json.has("publisher"))
8533      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8534    if (json.has("_publisher"))
8535      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8536    if (json.has("contact")) {
8537      JsonArray array = getJArray(json, "contact");
8538      for (int i = 0; i < array.size(); i++) {
8539        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8540      }
8541    };
8542    if (json.has("description"))
8543      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8544    if (json.has("_description"))
8545      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8546    if (json.has("useContext")) {
8547      JsonArray array = getJArray(json, "useContext");
8548      for (int i = 0; i < array.size(); i++) {
8549        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8550      }
8551    };
8552    if (json.has("jurisdiction")) {
8553      JsonArray array = getJArray(json, "jurisdiction");
8554      for (int i = 0; i < array.size(); i++) {
8555        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8556      }
8557    };
8558    if (json.has("purpose"))
8559      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
8560    if (json.has("_purpose"))
8561      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
8562    if (json.has("copyright"))
8563      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8564    if (json.has("_copyright"))
8565      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
8566    if (json.has("copyrightLabel"))
8567      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
8568    if (json.has("_copyrightLabel"))
8569      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
8570    if (json.has("approvalDate"))
8571      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
8572    if (json.has("_approvalDate"))
8573      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
8574    if (json.has("lastReviewDate"))
8575      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
8576    if (json.has("_lastReviewDate"))
8577      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
8578    if (json.has("effectivePeriod"))
8579      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
8580    if (json.has("topic")) {
8581      JsonArray array = getJArray(json, "topic");
8582      for (int i = 0; i < array.size(); i++) {
8583        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8584      }
8585    };
8586    if (json.has("author")) {
8587      JsonArray array = getJArray(json, "author");
8588      for (int i = 0; i < array.size(); i++) {
8589        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
8590      }
8591    };
8592    if (json.has("editor")) {
8593      JsonArray array = getJArray(json, "editor");
8594      for (int i = 0; i < array.size(); i++) {
8595        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
8596      }
8597    };
8598    if (json.has("reviewer")) {
8599      JsonArray array = getJArray(json, "reviewer");
8600      for (int i = 0; i < array.size(); i++) {
8601        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
8602      }
8603    };
8604    if (json.has("endorser")) {
8605      JsonArray array = getJArray(json, "endorser");
8606      for (int i = 0; i < array.size(); i++) {
8607        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
8608      }
8609    };
8610    if (json.has("relatedArtifact")) {
8611      JsonArray array = getJArray(json, "relatedArtifact");
8612      for (int i = 0; i < array.size(); i++) {
8613        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
8614      }
8615    };
8616    if (json.has("caseSensitive"))
8617      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
8618    if (json.has("_caseSensitive"))
8619      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
8620    if (json.has("valueSet"))
8621      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
8622    if (json.has("_valueSet"))
8623      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
8624    if (json.has("hierarchyMeaning"))
8625      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
8626    if (json.has("_hierarchyMeaning"))
8627      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
8628    if (json.has("compositional"))
8629      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
8630    if (json.has("_compositional"))
8631      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
8632    if (json.has("versionNeeded"))
8633      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
8634    if (json.has("_versionNeeded"))
8635      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
8636    if (json.has("content"))
8637      res.setContentElement(parseEnumeration(json.get("content").getAsString(), Enumerations.CodeSystemContentMode.NULL, new Enumerations.CodeSystemContentModeEnumFactory()));
8638    if (json.has("_content"))
8639      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
8640    if (json.has("supplements"))
8641      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
8642    if (json.has("_supplements"))
8643      parseElementProperties(getJObject(json, "_supplements"), res.getSupplementsElement());
8644    if (json.has("count"))
8645      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
8646    if (json.has("_count"))
8647      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
8648    if (json.has("filter")) {
8649      JsonArray array = getJArray(json, "filter");
8650      for (int i = 0; i < array.size(); i++) {
8651        res.getFilter().add(parseCodeSystemFilterComponent(array.get(i).getAsJsonObject()));
8652      }
8653    };
8654    if (json.has("property")) {
8655      JsonArray array = getJArray(json, "property");
8656      for (int i = 0; i < array.size(); i++) {
8657        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject()));
8658      }
8659    };
8660    if (json.has("concept")) {
8661      JsonArray array = getJArray(json, "concept");
8662      for (int i = 0; i < array.size(); i++) {
8663        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
8664      }
8665    };
8666  }
8667
8668  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
8669    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
8670    parseCodeSystemFilterComponentProperties(json, res);
8671    return res;
8672  }
8673
8674  protected void parseCodeSystemFilterComponentProperties(JsonObject json, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
8675    parseBackboneElementProperties(json, res);
8676    if (json.has("code"))
8677      res.setCodeElement(parseCode(json.get("code").getAsString()));
8678    if (json.has("_code"))
8679      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8680    if (json.has("description"))
8681      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8682    if (json.has("_description"))
8683      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8684    if (json.has("operator")) {
8685      JsonArray array = getJArray(json, "operator");
8686      for (int i = 0; i < array.size(); i++) {
8687        if (array.get(i).isJsonNull()) {
8688          res.getOperator().add(new Enumeration<Enumerations.FilterOperator>(new Enumerations.FilterOperatorEnumFactory(), Enumerations.FilterOperator.NULL));
8689        } else {;
8690          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
8691        }
8692      }
8693    };
8694    if (json.has("_operator")) {
8695      JsonArray array = getJArray(json, "_operator");
8696      for (int i = 0; i < array.size(); i++) {
8697        if (i == res.getOperator().size())
8698          res.getOperator().add(parseEnumeration(null, Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
8699        if (array.get(i) instanceof JsonObject) 
8700          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
8701      }
8702    };
8703    if (json.has("value"))
8704      res.setValueElement(parseString(json.get("value").getAsString()));
8705    if (json.has("_value"))
8706      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8707  }
8708
8709  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
8710    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
8711    parseCodeSystemPropertyComponentProperties(json, res);
8712    return res;
8713  }
8714
8715  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
8716    parseBackboneElementProperties(json, res);
8717    if (json.has("code"))
8718      res.setCodeElement(parseCode(json.get("code").getAsString()));
8719    if (json.has("_code"))
8720      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8721    if (json.has("uri"))
8722      res.setUriElement(parseUri(json.get("uri").getAsString()));
8723    if (json.has("_uri"))
8724      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
8725    if (json.has("description"))
8726      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8727    if (json.has("_description"))
8728      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8729    if (json.has("type"))
8730      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
8731    if (json.has("_type"))
8732      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
8733  }
8734
8735  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
8736    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
8737    parseCodeSystemConceptDefinitionComponentProperties(json, res);
8738    return res;
8739  }
8740
8741  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
8742    parseBackboneElementProperties(json, res);
8743    if (json.has("code"))
8744      res.setCodeElement(parseCode(json.get("code").getAsString()));
8745    if (json.has("_code"))
8746      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8747    if (json.has("display"))
8748      res.setDisplayElement(parseString(json.get("display").getAsString()));
8749    if (json.has("_display"))
8750      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8751    if (json.has("definition"))
8752      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
8753    if (json.has("_definition"))
8754      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
8755    if (json.has("designation")) {
8756      JsonArray array = getJArray(json, "designation");
8757      for (int i = 0; i < array.size(); i++) {
8758        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject()));
8759      }
8760    };
8761    if (json.has("property")) {
8762      JsonArray array = getJArray(json, "property");
8763      for (int i = 0; i < array.size(); i++) {
8764        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject()));
8765      }
8766    };
8767    if (json.has("concept")) {
8768      JsonArray array = getJArray(json, "concept");
8769      for (int i = 0; i < array.size(); i++) {
8770        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
8771      }
8772    };
8773  }
8774
8775  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
8776    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
8777    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, res);
8778    return res;
8779  }
8780
8781  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
8782    parseBackboneElementProperties(json, res);
8783    if (json.has("language"))
8784      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8785    if (json.has("_language"))
8786      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
8787    if (json.has("use"))
8788      res.setUse(parseCoding(getJObject(json, "use")));
8789    if (json.has("additionalUse")) {
8790      JsonArray array = getJArray(json, "additionalUse");
8791      for (int i = 0; i < array.size(); i++) {
8792        res.getAdditionalUse().add(parseCoding(array.get(i).getAsJsonObject()));
8793      }
8794    };
8795    if (json.has("value"))
8796      res.setValueElement(parseString(json.get("value").getAsString()));
8797    if (json.has("_value"))
8798      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8799  }
8800
8801  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
8802    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
8803    parseCodeSystemConceptPropertyComponentProperties(json, res);
8804    return res;
8805  }
8806
8807  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
8808    parseBackboneElementProperties(json, res);
8809    if (json.has("code"))
8810      res.setCodeElement(parseCode(json.get("code").getAsString()));
8811    if (json.has("_code"))
8812      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8813    DataType value = parseType("value", json);
8814    if (value != null)
8815      res.setValue(value);
8816  }
8817
8818  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
8819    Communication res = new Communication();
8820    parseCommunicationProperties(json, res);
8821    return res;
8822  }
8823
8824  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
8825    parseDomainResourceProperties(json, res);
8826    if (json.has("identifier")) {
8827      JsonArray array = getJArray(json, "identifier");
8828      for (int i = 0; i < array.size(); i++) {
8829        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8830      }
8831    };
8832    if (json.has("instantiatesCanonical")) {
8833      JsonArray array = getJArray(json, "instantiatesCanonical");
8834      for (int i = 0; i < array.size(); i++) {
8835        if (array.get(i).isJsonNull()) {
8836          res.getInstantiatesCanonical().add(new CanonicalType());
8837        } else {;
8838          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
8839        }
8840      }
8841    };
8842    if (json.has("_instantiatesCanonical")) {
8843      JsonArray array = getJArray(json, "_instantiatesCanonical");
8844      for (int i = 0; i < array.size(); i++) {
8845        if (i == res.getInstantiatesCanonical().size())
8846          res.getInstantiatesCanonical().add(parseCanonical(null));
8847        if (array.get(i) instanceof JsonObject) 
8848          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
8849      }
8850    };
8851    if (json.has("instantiatesUri")) {
8852      JsonArray array = getJArray(json, "instantiatesUri");
8853      for (int i = 0; i < array.size(); i++) {
8854        if (array.get(i).isJsonNull()) {
8855          res.getInstantiatesUri().add(new UriType());
8856        } else {;
8857          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
8858        }
8859      }
8860    };
8861    if (json.has("_instantiatesUri")) {
8862      JsonArray array = getJArray(json, "_instantiatesUri");
8863      for (int i = 0; i < array.size(); i++) {
8864        if (i == res.getInstantiatesUri().size())
8865          res.getInstantiatesUri().add(parseUri(null));
8866        if (array.get(i) instanceof JsonObject) 
8867          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
8868      }
8869    };
8870    if (json.has("basedOn")) {
8871      JsonArray array = getJArray(json, "basedOn");
8872      for (int i = 0; i < array.size(); i++) {
8873        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
8874      }
8875    };
8876    if (json.has("partOf")) {
8877      JsonArray array = getJArray(json, "partOf");
8878      for (int i = 0; i < array.size(); i++) {
8879        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
8880      }
8881    };
8882    if (json.has("inResponseTo")) {
8883      JsonArray array = getJArray(json, "inResponseTo");
8884      for (int i = 0; i < array.size(); i++) {
8885        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
8886      }
8887    };
8888    if (json.has("status"))
8889      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
8890    if (json.has("_status"))
8891      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8892    if (json.has("statusReason"))
8893      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
8894    if (json.has("category")) {
8895      JsonArray array = getJArray(json, "category");
8896      for (int i = 0; i < array.size(); i++) {
8897        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8898      }
8899    };
8900    if (json.has("priority"))
8901      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
8902    if (json.has("_priority"))
8903      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
8904    if (json.has("medium")) {
8905      JsonArray array = getJArray(json, "medium");
8906      for (int i = 0; i < array.size(); i++) {
8907        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8908      }
8909    };
8910    if (json.has("subject"))
8911      res.setSubject(parseReference(getJObject(json, "subject")));
8912    if (json.has("topic"))
8913      res.setTopic(parseCodeableConcept(getJObject(json, "topic")));
8914    if (json.has("about")) {
8915      JsonArray array = getJArray(json, "about");
8916      for (int i = 0; i < array.size(); i++) {
8917        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
8918      }
8919    };
8920    if (json.has("encounter"))
8921      res.setEncounter(parseReference(getJObject(json, "encounter")));
8922    if (json.has("sent"))
8923      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
8924    if (json.has("_sent"))
8925      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
8926    if (json.has("received"))
8927      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
8928    if (json.has("_received"))
8929      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
8930    if (json.has("recipient")) {
8931      JsonArray array = getJArray(json, "recipient");
8932      for (int i = 0; i < array.size(); i++) {
8933        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
8934      }
8935    };
8936    if (json.has("sender"))
8937      res.setSender(parseReference(getJObject(json, "sender")));
8938    if (json.has("reason")) {
8939      JsonArray array = getJArray(json, "reason");
8940      for (int i = 0; i < array.size(); i++) {
8941        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8942      }
8943    };
8944    if (json.has("payload")) {
8945      JsonArray array = getJArray(json, "payload");
8946      for (int i = 0; i < array.size(); i++) {
8947        res.getPayload().add(parseCommunicationPayloadComponent(array.get(i).getAsJsonObject()));
8948      }
8949    };
8950    if (json.has("note")) {
8951      JsonArray array = getJArray(json, "note");
8952      for (int i = 0; i < array.size(); i++) {
8953        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8954      }
8955    };
8956  }
8957
8958  protected Communication.CommunicationPayloadComponent parseCommunicationPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
8959    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
8960    parseCommunicationPayloadComponentProperties(json, res);
8961    return res;
8962  }
8963
8964  protected void parseCommunicationPayloadComponentProperties(JsonObject json, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
8965    parseBackboneElementProperties(json, res);
8966    DataType content = parseType("content", json);
8967    if (content != null)
8968      res.setContent(content);
8969  }
8970
8971  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
8972    CommunicationRequest res = new CommunicationRequest();
8973    parseCommunicationRequestProperties(json, res);
8974    return res;
8975  }
8976
8977  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
8978    parseDomainResourceProperties(json, res);
8979    if (json.has("identifier")) {
8980      JsonArray array = getJArray(json, "identifier");
8981      for (int i = 0; i < array.size(); i++) {
8982        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8983      }
8984    };
8985    if (json.has("basedOn")) {
8986      JsonArray array = getJArray(json, "basedOn");
8987      for (int i = 0; i < array.size(); i++) {
8988        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
8989      }
8990    };
8991    if (json.has("replaces")) {
8992      JsonArray array = getJArray(json, "replaces");
8993      for (int i = 0; i < array.size(); i++) {
8994        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
8995      }
8996    };
8997    if (json.has("groupIdentifier"))
8998      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
8999    if (json.has("status"))
9000      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
9001    if (json.has("_status"))
9002      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9003    if (json.has("statusReason"))
9004      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
9005    if (json.has("intent"))
9006      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
9007    if (json.has("_intent"))
9008      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
9009    if (json.has("category")) {
9010      JsonArray array = getJArray(json, "category");
9011      for (int i = 0; i < array.size(); i++) {
9012        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9013      }
9014    };
9015    if (json.has("priority"))
9016      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
9017    if (json.has("_priority"))
9018      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
9019    if (json.has("doNotPerform"))
9020      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
9021    if (json.has("_doNotPerform"))
9022      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
9023    if (json.has("medium")) {
9024      JsonArray array = getJArray(json, "medium");
9025      for (int i = 0; i < array.size(); i++) {
9026        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9027      }
9028    };
9029    if (json.has("subject"))
9030      res.setSubject(parseReference(getJObject(json, "subject")));
9031    if (json.has("about")) {
9032      JsonArray array = getJArray(json, "about");
9033      for (int i = 0; i < array.size(); i++) {
9034        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
9035      }
9036    };
9037    if (json.has("encounter"))
9038      res.setEncounter(parseReference(getJObject(json, "encounter")));
9039    if (json.has("payload")) {
9040      JsonArray array = getJArray(json, "payload");
9041      for (int i = 0; i < array.size(); i++) {
9042        res.getPayload().add(parseCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject()));
9043      }
9044    };
9045    DataType occurrence = parseType("occurrence", json);
9046    if (occurrence != null)
9047      res.setOccurrence(occurrence);
9048    if (json.has("authoredOn"))
9049      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
9050    if (json.has("_authoredOn"))
9051      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
9052    if (json.has("requester"))
9053      res.setRequester(parseReference(getJObject(json, "requester")));
9054    if (json.has("recipient")) {
9055      JsonArray array = getJArray(json, "recipient");
9056      for (int i = 0; i < array.size(); i++) {
9057        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
9058      }
9059    };
9060    if (json.has("informationProvider")) {
9061      JsonArray array = getJArray(json, "informationProvider");
9062      for (int i = 0; i < array.size(); i++) {
9063        res.getInformationProvider().add(parseReference(array.get(i).getAsJsonObject()));
9064      }
9065    };
9066    if (json.has("reason")) {
9067      JsonArray array = getJArray(json, "reason");
9068      for (int i = 0; i < array.size(); i++) {
9069        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
9070      }
9071    };
9072    if (json.has("note")) {
9073      JsonArray array = getJArray(json, "note");
9074      for (int i = 0; i < array.size(); i++) {
9075        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9076      }
9077    };
9078  }
9079
9080  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
9081    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
9082    parseCommunicationRequestPayloadComponentProperties(json, res);
9083    return res;
9084  }
9085
9086  protected void parseCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
9087    parseBackboneElementProperties(json, res);
9088    DataType content = parseType("content", json);
9089    if (content != null)
9090      res.setContent(content);
9091  }
9092
9093  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
9094    CompartmentDefinition res = new CompartmentDefinition();
9095    parseCompartmentDefinitionProperties(json, res);
9096    return res;
9097  }
9098
9099  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
9100    parseCanonicalResourceProperties(json, res);
9101    if (json.has("url"))
9102      res.setUrlElement(parseUri(json.get("url").getAsString()));
9103    if (json.has("_url"))
9104      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9105    if (json.has("version"))
9106      res.setVersionElement(parseString(json.get("version").getAsString()));
9107    if (json.has("_version"))
9108      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9109    DataType versionAlgorithm = parseType("versionAlgorithm", json);
9110    if (versionAlgorithm != null)
9111      res.setVersionAlgorithm(versionAlgorithm);
9112    if (json.has("name"))
9113      res.setNameElement(parseString(json.get("name").getAsString()));
9114    if (json.has("_name"))
9115      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9116    if (json.has("title"))
9117      res.setTitleElement(parseString(json.get("title").getAsString()));
9118    if (json.has("_title"))
9119      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
9120    if (json.has("status"))
9121      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9122    if (json.has("_status"))
9123      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9124    if (json.has("experimental"))
9125      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9126    if (json.has("_experimental"))
9127      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
9128    if (json.has("date"))
9129      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9130    if (json.has("_date"))
9131      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9132    if (json.has("publisher"))
9133      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9134    if (json.has("_publisher"))
9135      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
9136    if (json.has("contact")) {
9137      JsonArray array = getJArray(json, "contact");
9138      for (int i = 0; i < array.size(); i++) {
9139        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9140      }
9141    };
9142    if (json.has("description"))
9143      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9144    if (json.has("_description"))
9145      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9146    if (json.has("useContext")) {
9147      JsonArray array = getJArray(json, "useContext");
9148      for (int i = 0; i < array.size(); i++) {
9149        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9150      }
9151    };
9152    if (json.has("purpose"))
9153      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
9154    if (json.has("_purpose"))
9155      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
9156    if (json.has("code"))
9157      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
9158    if (json.has("_code"))
9159      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9160    if (json.has("search"))
9161      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
9162    if (json.has("_search"))
9163      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
9164    if (json.has("resource")) {
9165      JsonArray array = getJArray(json, "resource");
9166      for (int i = 0; i < array.size(); i++) {
9167        res.getResource().add(parseCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject()));
9168      }
9169    };
9170  }
9171
9172  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
9173    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
9174    parseCompartmentDefinitionResourceComponentProperties(json, res);
9175    return res;
9176  }
9177
9178  protected void parseCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
9179    parseBackboneElementProperties(json, res);
9180    if (json.has("code"))
9181      res.setCodeElement(parseCode(json.get("code").getAsString()));
9182    if (json.has("_code"))
9183      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9184    if (json.has("param")) {
9185      JsonArray array = getJArray(json, "param");
9186      for (int i = 0; i < array.size(); i++) {
9187        if (array.get(i).isJsonNull()) {
9188          res.getParam().add(new StringType());
9189        } else {;
9190          res.getParam().add(parseString(array.get(i).getAsString()));
9191        }
9192      }
9193    };
9194    if (json.has("_param")) {
9195      JsonArray array = getJArray(json, "_param");
9196      for (int i = 0; i < array.size(); i++) {
9197        if (i == res.getParam().size())
9198          res.getParam().add(parseString(null));
9199        if (array.get(i) instanceof JsonObject) 
9200          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
9201      }
9202    };
9203    if (json.has("documentation"))
9204      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
9205    if (json.has("_documentation"))
9206      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
9207    if (json.has("startParam"))
9208      res.setStartParamElement(parseUri(json.get("startParam").getAsString()));
9209    if (json.has("_startParam"))
9210      parseElementProperties(getJObject(json, "_startParam"), res.getStartParamElement());
9211    if (json.has("endParam"))
9212      res.setEndParamElement(parseUri(json.get("endParam").getAsString()));
9213    if (json.has("_endParam"))
9214      parseElementProperties(getJObject(json, "_endParam"), res.getEndParamElement());
9215  }
9216
9217  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
9218    Composition res = new Composition();
9219    parseCompositionProperties(json, res);
9220    return res;
9221  }
9222
9223  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
9224    parseDomainResourceProperties(json, res);
9225    if (json.has("url"))
9226      res.setUrlElement(parseUri(json.get("url").getAsString()));
9227    if (json.has("_url"))
9228      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9229    if (json.has("identifier")) {
9230      JsonArray array = getJArray(json, "identifier");
9231      for (int i = 0; i < array.size(); i++) {
9232        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9233      }
9234    };
9235    if (json.has("version"))
9236      res.setVersionElement(parseString(json.get("version").getAsString()));
9237    if (json.has("_version"))
9238      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9239    if (json.has("status"))
9240      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
9241    if (json.has("_status"))
9242      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9243    if (json.has("type"))
9244      res.setType(parseCodeableConcept(getJObject(json, "type")));
9245    if (json.has("category")) {
9246      JsonArray array = getJArray(json, "category");
9247      for (int i = 0; i < array.size(); i++) {
9248        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9249      }
9250    };
9251    if (json.has("subject")) {
9252      JsonArray array = getJArray(json, "subject");
9253      for (int i = 0; i < array.size(); i++) {
9254        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
9255      }
9256    };
9257    if (json.has("encounter"))
9258      res.setEncounter(parseReference(getJObject(json, "encounter")));
9259    if (json.has("date"))
9260      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9261    if (json.has("_date"))
9262      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9263    if (json.has("useContext")) {
9264      JsonArray array = getJArray(json, "useContext");
9265      for (int i = 0; i < array.size(); i++) {
9266        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9267      }
9268    };
9269    if (json.has("author")) {
9270      JsonArray array = getJArray(json, "author");
9271      for (int i = 0; i < array.size(); i++) {
9272        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9273      }
9274    };
9275    if (json.has("name"))
9276      res.setNameElement(parseString(json.get("name").getAsString()));
9277    if (json.has("_name"))
9278      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9279    if (json.has("title"))
9280      res.setTitleElement(parseString(json.get("title").getAsString()));
9281    if (json.has("_title"))
9282      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
9283    if (json.has("note")) {
9284      JsonArray array = getJArray(json, "note");
9285      for (int i = 0; i < array.size(); i++) {
9286        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9287      }
9288    };
9289    if (json.has("attester")) {
9290      JsonArray array = getJArray(json, "attester");
9291      for (int i = 0; i < array.size(); i++) {
9292        res.getAttester().add(parseCompositionAttesterComponent(array.get(i).getAsJsonObject()));
9293      }
9294    };
9295    if (json.has("custodian"))
9296      res.setCustodian(parseReference(getJObject(json, "custodian")));
9297    if (json.has("relatesTo")) {
9298      JsonArray array = getJArray(json, "relatesTo");
9299      for (int i = 0; i < array.size(); i++) {
9300        res.getRelatesTo().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
9301      }
9302    };
9303    if (json.has("event")) {
9304      JsonArray array = getJArray(json, "event");
9305      for (int i = 0; i < array.size(); i++) {
9306        res.getEvent().add(parseCompositionEventComponent(array.get(i).getAsJsonObject()));
9307      }
9308    };
9309    if (json.has("section")) {
9310      JsonArray array = getJArray(json, "section");
9311      for (int i = 0; i < array.size(); i++) {
9312        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
9313      }
9314    };
9315  }
9316
9317  protected Composition.CompositionAttesterComponent parseCompositionAttesterComponent(JsonObject json) throws IOException, FHIRFormatError {
9318    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
9319    parseCompositionAttesterComponentProperties(json, res);
9320    return res;
9321  }
9322
9323  protected void parseCompositionAttesterComponentProperties(JsonObject json, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
9324    parseBackboneElementProperties(json, res);
9325    if (json.has("mode"))
9326      res.setMode(parseCodeableConcept(getJObject(json, "mode")));
9327    if (json.has("time"))
9328      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
9329    if (json.has("_time"))
9330      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
9331    if (json.has("party"))
9332      res.setParty(parseReference(getJObject(json, "party")));
9333  }
9334
9335  protected Composition.CompositionEventComponent parseCompositionEventComponent(JsonObject json) throws IOException, FHIRFormatError {
9336    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
9337    parseCompositionEventComponentProperties(json, res);
9338    return res;
9339  }
9340
9341  protected void parseCompositionEventComponentProperties(JsonObject json, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
9342    parseBackboneElementProperties(json, res);
9343    if (json.has("period"))
9344      res.setPeriod(parsePeriod(getJObject(json, "period")));
9345    if (json.has("detail")) {
9346      JsonArray array = getJArray(json, "detail");
9347      for (int i = 0; i < array.size(); i++) {
9348        res.getDetail().add(parseCodeableReference(array.get(i).getAsJsonObject()));
9349      }
9350    };
9351  }
9352
9353  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json) throws IOException, FHIRFormatError {
9354    Composition.SectionComponent res = new Composition.SectionComponent();
9355    parseCompositionSectionComponentProperties(json, res);
9356    return res;
9357  }
9358
9359  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition.SectionComponent res) throws IOException, FHIRFormatError {
9360    parseBackboneElementProperties(json, res);
9361    if (json.has("title"))
9362      res.setTitleElement(parseString(json.get("title").getAsString()));
9363    if (json.has("_title"))
9364      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
9365    if (json.has("code"))
9366      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9367    if (json.has("author")) {
9368      JsonArray array = getJArray(json, "author");
9369      for (int i = 0; i < array.size(); i++) {
9370        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9371      }
9372    };
9373    if (json.has("focus"))
9374      res.setFocus(parseReference(getJObject(json, "focus")));
9375    if (json.has("text"))
9376      res.setText(parseNarrative(getJObject(json, "text")));
9377    if (json.has("orderedBy"))
9378      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
9379    if (json.has("entry")) {
9380      JsonArray array = getJArray(json, "entry");
9381      for (int i = 0; i < array.size(); i++) {
9382        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
9383      }
9384    };
9385    if (json.has("emptyReason"))
9386      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
9387    if (json.has("section")) {
9388      JsonArray array = getJArray(json, "section");
9389      for (int i = 0; i < array.size(); i++) {
9390        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
9391      }
9392    };
9393  }
9394
9395  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
9396    ConceptMap res = new ConceptMap();
9397    parseConceptMapProperties(json, res);
9398    return res;
9399  }
9400
9401  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
9402    parseMetadataResourceProperties(json, res);
9403    if (json.has("url"))
9404      res.setUrlElement(parseUri(json.get("url").getAsString()));
9405    if (json.has("_url"))
9406      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9407    if (json.has("identifier")) {
9408      JsonArray array = getJArray(json, "identifier");
9409      for (int i = 0; i < array.size(); i++) {
9410        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9411      }
9412    };
9413    if (json.has("version"))
9414      res.setVersionElement(parseString(json.get("version").getAsString()));
9415    if (json.has("_version"))
9416      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9417    DataType versionAlgorithm = parseType("versionAlgorithm", json);
9418    if (versionAlgorithm != null)
9419      res.setVersionAlgorithm(versionAlgorithm);
9420    if (json.has("name"))
9421      res.setNameElement(parseString(json.get("name").getAsString()));
9422    if (json.has("_name"))
9423      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9424    if (json.has("title"))
9425      res.setTitleElement(parseString(json.get("title").getAsString()));
9426    if (json.has("_title"))
9427      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
9428    if (json.has("status"))
9429      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9430    if (json.has("_status"))
9431      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9432    if (json.has("experimental"))
9433      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9434    if (json.has("_experimental"))
9435      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
9436    if (json.has("date"))
9437      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9438    if (json.has("_date"))
9439      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9440    if (json.has("publisher"))
9441      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9442    if (json.has("_publisher"))
9443      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
9444    if (json.has("contact")) {
9445      JsonArray array = getJArray(json, "contact");
9446      for (int i = 0; i < array.size(); i++) {
9447        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9448      }
9449    };
9450    if (json.has("description"))
9451      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9452    if (json.has("_description"))
9453      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9454    if (json.has("useContext")) {
9455      JsonArray array = getJArray(json, "useContext");
9456      for (int i = 0; i < array.size(); i++) {
9457        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9458      }
9459    };
9460    if (json.has("jurisdiction")) {
9461      JsonArray array = getJArray(json, "jurisdiction");
9462      for (int i = 0; i < array.size(); i++) {
9463        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9464      }
9465    };
9466    if (json.has("purpose"))
9467      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
9468    if (json.has("_purpose"))
9469      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
9470    if (json.has("copyright"))
9471      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
9472    if (json.has("_copyright"))
9473      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
9474    if (json.has("copyrightLabel"))
9475      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
9476    if (json.has("_copyrightLabel"))
9477      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
9478    if (json.has("approvalDate"))
9479      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
9480    if (json.has("_approvalDate"))
9481      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
9482    if (json.has("lastReviewDate"))
9483      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
9484    if (json.has("_lastReviewDate"))
9485      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
9486    if (json.has("effectivePeriod"))
9487      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
9488    if (json.has("topic")) {
9489      JsonArray array = getJArray(json, "topic");
9490      for (int i = 0; i < array.size(); i++) {
9491        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9492      }
9493    };
9494    if (json.has("author")) {
9495      JsonArray array = getJArray(json, "author");
9496      for (int i = 0; i < array.size(); i++) {
9497        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
9498      }
9499    };
9500    if (json.has("editor")) {
9501      JsonArray array = getJArray(json, "editor");
9502      for (int i = 0; i < array.size(); i++) {
9503        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
9504      }
9505    };
9506    if (json.has("reviewer")) {
9507      JsonArray array = getJArray(json, "reviewer");
9508      for (int i = 0; i < array.size(); i++) {
9509        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
9510      }
9511    };
9512    if (json.has("endorser")) {
9513      JsonArray array = getJArray(json, "endorser");
9514      for (int i = 0; i < array.size(); i++) {
9515        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
9516      }
9517    };
9518    if (json.has("relatedArtifact")) {
9519      JsonArray array = getJArray(json, "relatedArtifact");
9520      for (int i = 0; i < array.size(); i++) {
9521        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
9522      }
9523    };
9524    if (json.has("property")) {
9525      JsonArray array = getJArray(json, "property");
9526      for (int i = 0; i < array.size(); i++) {
9527        res.getProperty().add(parseConceptMapPropertyComponent(array.get(i).getAsJsonObject()));
9528      }
9529    };
9530    if (json.has("additionalAttribute")) {
9531      JsonArray array = getJArray(json, "additionalAttribute");
9532      for (int i = 0; i < array.size(); i++) {
9533        res.getAdditionalAttribute().add(parseConceptMapAdditionalAttributeComponent(array.get(i).getAsJsonObject()));
9534      }
9535    };
9536    DataType sourceScope = parseType("sourceScope", json);
9537    if (sourceScope != null)
9538      res.setSourceScope(sourceScope);
9539    DataType targetScope = parseType("targetScope", json);
9540    if (targetScope != null)
9541      res.setTargetScope(targetScope);
9542    if (json.has("group")) {
9543      JsonArray array = getJArray(json, "group");
9544      for (int i = 0; i < array.size(); i++) {
9545        res.getGroup().add(parseConceptMapGroupComponent(array.get(i).getAsJsonObject()));
9546      }
9547    };
9548  }
9549
9550  protected ConceptMap.PropertyComponent parseConceptMapPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
9551    ConceptMap.PropertyComponent res = new ConceptMap.PropertyComponent();
9552    parseConceptMapPropertyComponentProperties(json, res);
9553    return res;
9554  }
9555
9556  protected void parseConceptMapPropertyComponentProperties(JsonObject json, ConceptMap.PropertyComponent res) throws IOException, FHIRFormatError {
9557    parseBackboneElementProperties(json, res);
9558    if (json.has("code"))
9559      res.setCodeElement(parseCode(json.get("code").getAsString()));
9560    if (json.has("_code"))
9561      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9562    if (json.has("uri"))
9563      res.setUriElement(parseUri(json.get("uri").getAsString()));
9564    if (json.has("_uri"))
9565      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
9566    if (json.has("description"))
9567      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9568    if (json.has("_description"))
9569      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9570    if (json.has("type"))
9571      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ConceptMap.ConceptMapPropertyType.NULL, new ConceptMap.ConceptMapPropertyTypeEnumFactory()));
9572    if (json.has("_type"))
9573      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9574    if (json.has("system"))
9575      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
9576    if (json.has("_system"))
9577      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
9578  }
9579
9580  protected ConceptMap.AdditionalAttributeComponent parseConceptMapAdditionalAttributeComponent(JsonObject json) throws IOException, FHIRFormatError {
9581    ConceptMap.AdditionalAttributeComponent res = new ConceptMap.AdditionalAttributeComponent();
9582    parseConceptMapAdditionalAttributeComponentProperties(json, res);
9583    return res;
9584  }
9585
9586  protected void parseConceptMapAdditionalAttributeComponentProperties(JsonObject json, ConceptMap.AdditionalAttributeComponent res) throws IOException, FHIRFormatError {
9587    parseBackboneElementProperties(json, res);
9588    if (json.has("code"))
9589      res.setCodeElement(parseCode(json.get("code").getAsString()));
9590    if (json.has("_code"))
9591      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9592    if (json.has("uri"))
9593      res.setUriElement(parseUri(json.get("uri").getAsString()));
9594    if (json.has("_uri"))
9595      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
9596    if (json.has("description"))
9597      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9598    if (json.has("_description"))
9599      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9600    if (json.has("type"))
9601      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ConceptMap.ConceptMapAttributeType.NULL, new ConceptMap.ConceptMapAttributeTypeEnumFactory()));
9602    if (json.has("_type"))
9603      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9604  }
9605
9606  protected ConceptMap.ConceptMapGroupComponent parseConceptMapGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
9607    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
9608    parseConceptMapGroupComponentProperties(json, res);
9609    return res;
9610  }
9611
9612  protected void parseConceptMapGroupComponentProperties(JsonObject json, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
9613    parseBackboneElementProperties(json, res);
9614    if (json.has("source"))
9615      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
9616    if (json.has("_source"))
9617      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
9618    if (json.has("target"))
9619      res.setTargetElement(parseCanonical(json.get("target").getAsString()));
9620    if (json.has("_target"))
9621      parseElementProperties(getJObject(json, "_target"), res.getTargetElement());
9622    if (json.has("element")) {
9623      JsonArray array = getJArray(json, "element");
9624      for (int i = 0; i < array.size(); i++) {
9625        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject()));
9626      }
9627    };
9628    if (json.has("unmapped"))
9629      res.setUnmapped(parseConceptMapGroupUnmappedComponent(getJObject(json, "unmapped")));
9630  }
9631
9632  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json) throws IOException, FHIRFormatError {
9633    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
9634    parseConceptMapSourceElementComponentProperties(json, res);
9635    return res;
9636  }
9637
9638  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
9639    parseBackboneElementProperties(json, res);
9640    if (json.has("code"))
9641      res.setCodeElement(parseCode(json.get("code").getAsString()));
9642    if (json.has("_code"))
9643      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9644    if (json.has("display"))
9645      res.setDisplayElement(parseString(json.get("display").getAsString()));
9646    if (json.has("_display"))
9647      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
9648    if (json.has("valueSet"))
9649      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
9650    if (json.has("_valueSet"))
9651      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
9652    if (json.has("noMap"))
9653      res.setNoMapElement(parseBoolean(json.get("noMap").getAsBoolean()));
9654    if (json.has("_noMap"))
9655      parseElementProperties(getJObject(json, "_noMap"), res.getNoMapElement());
9656    if (json.has("target")) {
9657      JsonArray array = getJArray(json, "target");
9658      for (int i = 0; i < array.size(); i++) {
9659        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject()));
9660      }
9661    };
9662  }
9663
9664  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json) throws IOException, FHIRFormatError {
9665    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
9666    parseConceptMapTargetElementComponentProperties(json, res);
9667    return res;
9668  }
9669
9670  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
9671    parseBackboneElementProperties(json, res);
9672    if (json.has("code"))
9673      res.setCodeElement(parseCode(json.get("code").getAsString()));
9674    if (json.has("_code"))
9675      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9676    if (json.has("display"))
9677      res.setDisplayElement(parseString(json.get("display").getAsString()));
9678    if (json.has("_display"))
9679      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
9680    if (json.has("valueSet"))
9681      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
9682    if (json.has("_valueSet"))
9683      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
9684    if (json.has("relationship"))
9685      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ConceptMapRelationship.NULL, new Enumerations.ConceptMapRelationshipEnumFactory()));
9686    if (json.has("_relationship"))
9687      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
9688    if (json.has("comment"))
9689      res.setCommentElement(parseString(json.get("comment").getAsString()));
9690    if (json.has("_comment"))
9691      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
9692    if (json.has("property")) {
9693      JsonArray array = getJArray(json, "property");
9694      for (int i = 0; i < array.size(); i++) {
9695        res.getProperty().add(parseConceptMapMappingPropertyComponent(array.get(i).getAsJsonObject()));
9696      }
9697    };
9698    if (json.has("dependsOn")) {
9699      JsonArray array = getJArray(json, "dependsOn");
9700      for (int i = 0; i < array.size(); i++) {
9701        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject()));
9702      }
9703    };
9704    if (json.has("product")) {
9705      JsonArray array = getJArray(json, "product");
9706      for (int i = 0; i < array.size(); i++) {
9707        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject()));
9708      }
9709    };
9710  }
9711
9712  protected ConceptMap.MappingPropertyComponent parseConceptMapMappingPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
9713    ConceptMap.MappingPropertyComponent res = new ConceptMap.MappingPropertyComponent();
9714    parseConceptMapMappingPropertyComponentProperties(json, res);
9715    return res;
9716  }
9717
9718  protected void parseConceptMapMappingPropertyComponentProperties(JsonObject json, ConceptMap.MappingPropertyComponent res) throws IOException, FHIRFormatError {
9719    parseBackboneElementProperties(json, res);
9720    if (json.has("code"))
9721      res.setCodeElement(parseCode(json.get("code").getAsString()));
9722    if (json.has("_code"))
9723      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9724    DataType value = parseType("value", json);
9725    if (value != null)
9726      res.setValue(value);
9727  }
9728
9729  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json) throws IOException, FHIRFormatError {
9730    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
9731    parseConceptMapOtherElementComponentProperties(json, res);
9732    return res;
9733  }
9734
9735  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
9736    parseBackboneElementProperties(json, res);
9737    if (json.has("attribute"))
9738      res.setAttributeElement(parseCode(json.get("attribute").getAsString()));
9739    if (json.has("_attribute"))
9740      parseElementProperties(getJObject(json, "_attribute"), res.getAttributeElement());
9741    DataType value = parseType("value", json);
9742    if (value != null)
9743      res.setValue(value);
9744    if (json.has("valueSet"))
9745      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
9746    if (json.has("_valueSet"))
9747      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
9748  }
9749
9750  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapGroupUnmappedComponent(JsonObject json) throws IOException, FHIRFormatError {
9751    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
9752    parseConceptMapGroupUnmappedComponentProperties(json, res);
9753    return res;
9754  }
9755
9756  protected void parseConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
9757    parseBackboneElementProperties(json, res);
9758    if (json.has("mode"))
9759      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
9760    if (json.has("_mode"))
9761      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
9762    if (json.has("code"))
9763      res.setCodeElement(parseCode(json.get("code").getAsString()));
9764    if (json.has("_code"))
9765      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
9766    if (json.has("display"))
9767      res.setDisplayElement(parseString(json.get("display").getAsString()));
9768    if (json.has("_display"))
9769      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
9770    if (json.has("valueSet"))
9771      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
9772    if (json.has("_valueSet"))
9773      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
9774    if (json.has("relationship"))
9775      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ConceptMapRelationship.NULL, new Enumerations.ConceptMapRelationshipEnumFactory()));
9776    if (json.has("_relationship"))
9777      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
9778    if (json.has("otherMap"))
9779      res.setOtherMapElement(parseCanonical(json.get("otherMap").getAsString()));
9780    if (json.has("_otherMap"))
9781      parseElementProperties(getJObject(json, "_otherMap"), res.getOtherMapElement());
9782  }
9783
9784  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
9785    Condition res = new Condition();
9786    parseConditionProperties(json, res);
9787    return res;
9788  }
9789
9790  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
9791    parseDomainResourceProperties(json, res);
9792    if (json.has("identifier")) {
9793      JsonArray array = getJArray(json, "identifier");
9794      for (int i = 0; i < array.size(); i++) {
9795        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9796      }
9797    };
9798    if (json.has("clinicalStatus"))
9799      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
9800    if (json.has("verificationStatus"))
9801      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
9802    if (json.has("category")) {
9803      JsonArray array = getJArray(json, "category");
9804      for (int i = 0; i < array.size(); i++) {
9805        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9806      }
9807    };
9808    if (json.has("severity"))
9809      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
9810    if (json.has("code"))
9811      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9812    if (json.has("bodySite")) {
9813      JsonArray array = getJArray(json, "bodySite");
9814      for (int i = 0; i < array.size(); i++) {
9815        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9816      }
9817    };
9818    if (json.has("subject"))
9819      res.setSubject(parseReference(getJObject(json, "subject")));
9820    if (json.has("encounter"))
9821      res.setEncounter(parseReference(getJObject(json, "encounter")));
9822    DataType onset = parseType("onset", json);
9823    if (onset != null)
9824      res.setOnset(onset);
9825    DataType abatement = parseType("abatement", json);
9826    if (abatement != null)
9827      res.setAbatement(abatement);
9828    if (json.has("recordedDate"))
9829      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
9830    if (json.has("_recordedDate"))
9831      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
9832    if (json.has("participant")) {
9833      JsonArray array = getJArray(json, "participant");
9834      for (int i = 0; i < array.size(); i++) {
9835        res.getParticipant().add(parseConditionParticipantComponent(array.get(i).getAsJsonObject()));
9836      }
9837    };
9838    if (json.has("stage")) {
9839      JsonArray array = getJArray(json, "stage");
9840      for (int i = 0; i < array.size(); i++) {
9841        res.getStage().add(parseConditionStageComponent(array.get(i).getAsJsonObject()));
9842      }
9843    };
9844    if (json.has("evidence")) {
9845      JsonArray array = getJArray(json, "evidence");
9846      for (int i = 0; i < array.size(); i++) {
9847        res.getEvidence().add(parseCodeableReference(array.get(i).getAsJsonObject()));
9848      }
9849    };
9850    if (json.has("note")) {
9851      JsonArray array = getJArray(json, "note");
9852      for (int i = 0; i < array.size(); i++) {
9853        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9854      }
9855    };
9856  }
9857
9858  protected Condition.ConditionParticipantComponent parseConditionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
9859    Condition.ConditionParticipantComponent res = new Condition.ConditionParticipantComponent();
9860    parseConditionParticipantComponentProperties(json, res);
9861    return res;
9862  }
9863
9864  protected void parseConditionParticipantComponentProperties(JsonObject json, Condition.ConditionParticipantComponent res) throws IOException, FHIRFormatError {
9865    parseBackboneElementProperties(json, res);
9866    if (json.has("function"))
9867      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
9868    if (json.has("actor"))
9869      res.setActor(parseReference(getJObject(json, "actor")));
9870  }
9871
9872  protected Condition.ConditionStageComponent parseConditionStageComponent(JsonObject json) throws IOException, FHIRFormatError {
9873    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
9874    parseConditionStageComponentProperties(json, res);
9875    return res;
9876  }
9877
9878  protected void parseConditionStageComponentProperties(JsonObject json, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
9879    parseBackboneElementProperties(json, res);
9880    if (json.has("summary"))
9881      res.setSummary(parseCodeableConcept(getJObject(json, "summary")));
9882    if (json.has("assessment")) {
9883      JsonArray array = getJArray(json, "assessment");
9884      for (int i = 0; i < array.size(); i++) {
9885        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
9886      }
9887    };
9888    if (json.has("type"))
9889      res.setType(parseCodeableConcept(getJObject(json, "type")));
9890  }
9891
9892  protected ConditionDefinition parseConditionDefinition(JsonObject json) throws IOException, FHIRFormatError {
9893    ConditionDefinition res = new ConditionDefinition();
9894    parseConditionDefinitionProperties(json, res);
9895    return res;
9896  }
9897
9898  protected void parseConditionDefinitionProperties(JsonObject json, ConditionDefinition res) throws IOException, FHIRFormatError {
9899    parseMetadataResourceProperties(json, res);
9900    if (json.has("url"))
9901      res.setUrlElement(parseUri(json.get("url").getAsString()));
9902    if (json.has("_url"))
9903      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9904    if (json.has("identifier")) {
9905      JsonArray array = getJArray(json, "identifier");
9906      for (int i = 0; i < array.size(); i++) {
9907        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9908      }
9909    };
9910    if (json.has("version"))
9911      res.setVersionElement(parseString(json.get("version").getAsString()));
9912    if (json.has("_version"))
9913      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9914    DataType versionAlgorithm = parseType("versionAlgorithm", json);
9915    if (versionAlgorithm != null)
9916      res.setVersionAlgorithm(versionAlgorithm);
9917    if (json.has("name"))
9918      res.setNameElement(parseString(json.get("name").getAsString()));
9919    if (json.has("_name"))
9920      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9921    if (json.has("title"))
9922      res.setTitleElement(parseString(json.get("title").getAsString()));
9923    if (json.has("_title"))
9924      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
9925    if (json.has("subtitle"))
9926      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
9927    if (json.has("_subtitle"))
9928      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
9929    if (json.has("status"))
9930      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9931    if (json.has("_status"))
9932      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9933    if (json.has("experimental"))
9934      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9935    if (json.has("_experimental"))
9936      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
9937    if (json.has("date"))
9938      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9939    if (json.has("_date"))
9940      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9941    if (json.has("publisher"))
9942      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9943    if (json.has("_publisher"))
9944      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
9945    if (json.has("contact")) {
9946      JsonArray array = getJArray(json, "contact");
9947      for (int i = 0; i < array.size(); i++) {
9948        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9949      }
9950    };
9951    if (json.has("description"))
9952      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9953    if (json.has("_description"))
9954      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9955    if (json.has("useContext")) {
9956      JsonArray array = getJArray(json, "useContext");
9957      for (int i = 0; i < array.size(); i++) {
9958        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9959      }
9960    };
9961    if (json.has("jurisdiction")) {
9962      JsonArray array = getJArray(json, "jurisdiction");
9963      for (int i = 0; i < array.size(); i++) {
9964        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9965      }
9966    };
9967    if (json.has("code"))
9968      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9969    if (json.has("severity"))
9970      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
9971    if (json.has("bodySite"))
9972      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
9973    if (json.has("stage"))
9974      res.setStage(parseCodeableConcept(getJObject(json, "stage")));
9975    if (json.has("hasSeverity"))
9976      res.setHasSeverityElement(parseBoolean(json.get("hasSeverity").getAsBoolean()));
9977    if (json.has("_hasSeverity"))
9978      parseElementProperties(getJObject(json, "_hasSeverity"), res.getHasSeverityElement());
9979    if (json.has("hasBodySite"))
9980      res.setHasBodySiteElement(parseBoolean(json.get("hasBodySite").getAsBoolean()));
9981    if (json.has("_hasBodySite"))
9982      parseElementProperties(getJObject(json, "_hasBodySite"), res.getHasBodySiteElement());
9983    if (json.has("hasStage"))
9984      res.setHasStageElement(parseBoolean(json.get("hasStage").getAsBoolean()));
9985    if (json.has("_hasStage"))
9986      parseElementProperties(getJObject(json, "_hasStage"), res.getHasStageElement());
9987    if (json.has("definition")) {
9988      JsonArray array = getJArray(json, "definition");
9989      for (int i = 0; i < array.size(); i++) {
9990        if (array.get(i).isJsonNull()) {
9991          res.getDefinition().add(new UriType());
9992        } else {;
9993          res.getDefinition().add(parseUri(array.get(i).getAsString()));
9994        }
9995      }
9996    };
9997    if (json.has("_definition")) {
9998      JsonArray array = getJArray(json, "_definition");
9999      for (int i = 0; i < array.size(); i++) {
10000        if (i == res.getDefinition().size())
10001          res.getDefinition().add(parseUri(null));
10002        if (array.get(i) instanceof JsonObject) 
10003          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
10004      }
10005    };
10006    if (json.has("observation")) {
10007      JsonArray array = getJArray(json, "observation");
10008      for (int i = 0; i < array.size(); i++) {
10009        res.getObservation().add(parseConditionDefinitionObservationComponent(array.get(i).getAsJsonObject()));
10010      }
10011    };
10012    if (json.has("medication")) {
10013      JsonArray array = getJArray(json, "medication");
10014      for (int i = 0; i < array.size(); i++) {
10015        res.getMedication().add(parseConditionDefinitionMedicationComponent(array.get(i).getAsJsonObject()));
10016      }
10017    };
10018    if (json.has("precondition")) {
10019      JsonArray array = getJArray(json, "precondition");
10020      for (int i = 0; i < array.size(); i++) {
10021        res.getPrecondition().add(parseConditionDefinitionPreconditionComponent(array.get(i).getAsJsonObject()));
10022      }
10023    };
10024    if (json.has("team")) {
10025      JsonArray array = getJArray(json, "team");
10026      for (int i = 0; i < array.size(); i++) {
10027        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
10028      }
10029    };
10030    if (json.has("questionnaire")) {
10031      JsonArray array = getJArray(json, "questionnaire");
10032      for (int i = 0; i < array.size(); i++) {
10033        res.getQuestionnaire().add(parseConditionDefinitionQuestionnaireComponent(array.get(i).getAsJsonObject()));
10034      }
10035    };
10036    if (json.has("plan")) {
10037      JsonArray array = getJArray(json, "plan");
10038      for (int i = 0; i < array.size(); i++) {
10039        res.getPlan().add(parseConditionDefinitionPlanComponent(array.get(i).getAsJsonObject()));
10040      }
10041    };
10042  }
10043
10044  protected ConditionDefinition.ConditionDefinitionObservationComponent parseConditionDefinitionObservationComponent(JsonObject json) throws IOException, FHIRFormatError {
10045    ConditionDefinition.ConditionDefinitionObservationComponent res = new ConditionDefinition.ConditionDefinitionObservationComponent();
10046    parseConditionDefinitionObservationComponentProperties(json, res);
10047    return res;
10048  }
10049
10050  protected void parseConditionDefinitionObservationComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionObservationComponent res) throws IOException, FHIRFormatError {
10051    parseBackboneElementProperties(json, res);
10052    if (json.has("category"))
10053      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
10054    if (json.has("code"))
10055      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10056  }
10057
10058  protected ConditionDefinition.ConditionDefinitionMedicationComponent parseConditionDefinitionMedicationComponent(JsonObject json) throws IOException, FHIRFormatError {
10059    ConditionDefinition.ConditionDefinitionMedicationComponent res = new ConditionDefinition.ConditionDefinitionMedicationComponent();
10060    parseConditionDefinitionMedicationComponentProperties(json, res);
10061    return res;
10062  }
10063
10064  protected void parseConditionDefinitionMedicationComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionMedicationComponent res) throws IOException, FHIRFormatError {
10065    parseBackboneElementProperties(json, res);
10066    if (json.has("category"))
10067      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
10068    if (json.has("code"))
10069      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10070  }
10071
10072  protected ConditionDefinition.ConditionDefinitionPreconditionComponent parseConditionDefinitionPreconditionComponent(JsonObject json) throws IOException, FHIRFormatError {
10073    ConditionDefinition.ConditionDefinitionPreconditionComponent res = new ConditionDefinition.ConditionDefinitionPreconditionComponent();
10074    parseConditionDefinitionPreconditionComponentProperties(json, res);
10075    return res;
10076  }
10077
10078  protected void parseConditionDefinitionPreconditionComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionPreconditionComponent res) throws IOException, FHIRFormatError {
10079    parseBackboneElementProperties(json, res);
10080    if (json.has("type"))
10081      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ConditionDefinition.ConditionPreconditionType.NULL, new ConditionDefinition.ConditionPreconditionTypeEnumFactory()));
10082    if (json.has("_type"))
10083      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10084    if (json.has("code"))
10085      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10086    DataType value = parseType("value", json);
10087    if (value != null)
10088      res.setValue(value);
10089  }
10090
10091  protected ConditionDefinition.ConditionDefinitionQuestionnaireComponent parseConditionDefinitionQuestionnaireComponent(JsonObject json) throws IOException, FHIRFormatError {
10092    ConditionDefinition.ConditionDefinitionQuestionnaireComponent res = new ConditionDefinition.ConditionDefinitionQuestionnaireComponent();
10093    parseConditionDefinitionQuestionnaireComponentProperties(json, res);
10094    return res;
10095  }
10096
10097  protected void parseConditionDefinitionQuestionnaireComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionQuestionnaireComponent res) throws IOException, FHIRFormatError {
10098    parseBackboneElementProperties(json, res);
10099    if (json.has("purpose"))
10100      res.setPurposeElement(parseEnumeration(json.get("purpose").getAsString(), ConditionDefinition.ConditionQuestionnairePurpose.NULL, new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory()));
10101    if (json.has("_purpose"))
10102      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
10103    if (json.has("reference"))
10104      res.setReference(parseReference(getJObject(json, "reference")));
10105  }
10106
10107  protected ConditionDefinition.ConditionDefinitionPlanComponent parseConditionDefinitionPlanComponent(JsonObject json) throws IOException, FHIRFormatError {
10108    ConditionDefinition.ConditionDefinitionPlanComponent res = new ConditionDefinition.ConditionDefinitionPlanComponent();
10109    parseConditionDefinitionPlanComponentProperties(json, res);
10110    return res;
10111  }
10112
10113  protected void parseConditionDefinitionPlanComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionPlanComponent res) throws IOException, FHIRFormatError {
10114    parseBackboneElementProperties(json, res);
10115    if (json.has("role"))
10116      res.setRole(parseCodeableConcept(getJObject(json, "role")));
10117    if (json.has("reference"))
10118      res.setReference(parseReference(getJObject(json, "reference")));
10119  }
10120
10121  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
10122    Consent res = new Consent();
10123    parseConsentProperties(json, res);
10124    return res;
10125  }
10126
10127  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
10128    parseDomainResourceProperties(json, res);
10129    if (json.has("identifier")) {
10130      JsonArray array = getJArray(json, "identifier");
10131      for (int i = 0; i < array.size(); i++) {
10132        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10133      }
10134    };
10135    if (json.has("status"))
10136      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
10137    if (json.has("_status"))
10138      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10139    if (json.has("category")) {
10140      JsonArray array = getJArray(json, "category");
10141      for (int i = 0; i < array.size(); i++) {
10142        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10143      }
10144    };
10145    if (json.has("subject"))
10146      res.setSubject(parseReference(getJObject(json, "subject")));
10147    if (json.has("date"))
10148      res.setDateElement(parseDate(json.get("date").getAsString()));
10149    if (json.has("_date"))
10150      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10151    if (json.has("period"))
10152      res.setPeriod(parsePeriod(getJObject(json, "period")));
10153    if (json.has("grantor")) {
10154      JsonArray array = getJArray(json, "grantor");
10155      for (int i = 0; i < array.size(); i++) {
10156        res.getGrantor().add(parseReference(array.get(i).getAsJsonObject()));
10157      }
10158    };
10159    if (json.has("grantee")) {
10160      JsonArray array = getJArray(json, "grantee");
10161      for (int i = 0; i < array.size(); i++) {
10162        res.getGrantee().add(parseReference(array.get(i).getAsJsonObject()));
10163      }
10164    };
10165    if (json.has("manager")) {
10166      JsonArray array = getJArray(json, "manager");
10167      for (int i = 0; i < array.size(); i++) {
10168        res.getManager().add(parseReference(array.get(i).getAsJsonObject()));
10169      }
10170    };
10171    if (json.has("controller")) {
10172      JsonArray array = getJArray(json, "controller");
10173      for (int i = 0; i < array.size(); i++) {
10174        res.getController().add(parseReference(array.get(i).getAsJsonObject()));
10175      }
10176    };
10177    if (json.has("sourceAttachment")) {
10178      JsonArray array = getJArray(json, "sourceAttachment");
10179      for (int i = 0; i < array.size(); i++) {
10180        res.getSourceAttachment().add(parseAttachment(array.get(i).getAsJsonObject()));
10181      }
10182    };
10183    if (json.has("sourceReference")) {
10184      JsonArray array = getJArray(json, "sourceReference");
10185      for (int i = 0; i < array.size(); i++) {
10186        res.getSourceReference().add(parseReference(array.get(i).getAsJsonObject()));
10187      }
10188    };
10189    if (json.has("regulatoryBasis")) {
10190      JsonArray array = getJArray(json, "regulatoryBasis");
10191      for (int i = 0; i < array.size(); i++) {
10192        res.getRegulatoryBasis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10193      }
10194    };
10195    if (json.has("policyBasis"))
10196      res.setPolicyBasis(parseConsentPolicyBasisComponent(getJObject(json, "policyBasis")));
10197    if (json.has("policyText")) {
10198      JsonArray array = getJArray(json, "policyText");
10199      for (int i = 0; i < array.size(); i++) {
10200        res.getPolicyText().add(parseReference(array.get(i).getAsJsonObject()));
10201      }
10202    };
10203    if (json.has("verification")) {
10204      JsonArray array = getJArray(json, "verification");
10205      for (int i = 0; i < array.size(); i++) {
10206        res.getVerification().add(parseConsentVerificationComponent(array.get(i).getAsJsonObject()));
10207      }
10208    };
10209    if (json.has("decision"))
10210      res.setDecisionElement(parseEnumeration(json.get("decision").getAsString(), Enumerations.ConsentProvisionType.NULL, new Enumerations.ConsentProvisionTypeEnumFactory()));
10211    if (json.has("_decision"))
10212      parseElementProperties(getJObject(json, "_decision"), res.getDecisionElement());
10213    if (json.has("provision")) {
10214      JsonArray array = getJArray(json, "provision");
10215      for (int i = 0; i < array.size(); i++) {
10216        res.getProvision().add(parseConsentProvisionComponent(array.get(i).getAsJsonObject()));
10217      }
10218    };
10219  }
10220
10221  protected Consent.ConsentPolicyBasisComponent parseConsentPolicyBasisComponent(JsonObject json) throws IOException, FHIRFormatError {
10222    Consent.ConsentPolicyBasisComponent res = new Consent.ConsentPolicyBasisComponent();
10223    parseConsentPolicyBasisComponentProperties(json, res);
10224    return res;
10225  }
10226
10227  protected void parseConsentPolicyBasisComponentProperties(JsonObject json, Consent.ConsentPolicyBasisComponent res) throws IOException, FHIRFormatError {
10228    parseBackboneElementProperties(json, res);
10229    if (json.has("reference"))
10230      res.setReference(parseReference(getJObject(json, "reference")));
10231    if (json.has("url"))
10232      res.setUrlElement(parseUrl(json.get("url").getAsString()));
10233    if (json.has("_url"))
10234      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10235  }
10236
10237  protected Consent.ConsentVerificationComponent parseConsentVerificationComponent(JsonObject json) throws IOException, FHIRFormatError {
10238    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
10239    parseConsentVerificationComponentProperties(json, res);
10240    return res;
10241  }
10242
10243  protected void parseConsentVerificationComponentProperties(JsonObject json, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
10244    parseBackboneElementProperties(json, res);
10245    if (json.has("verified"))
10246      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
10247    if (json.has("_verified"))
10248      parseElementProperties(getJObject(json, "_verified"), res.getVerifiedElement());
10249    if (json.has("verificationType"))
10250      res.setVerificationType(parseCodeableConcept(getJObject(json, "verificationType")));
10251    if (json.has("verifiedBy"))
10252      res.setVerifiedBy(parseReference(getJObject(json, "verifiedBy")));
10253    if (json.has("verifiedWith"))
10254      res.setVerifiedWith(parseReference(getJObject(json, "verifiedWith")));
10255    if (json.has("verificationDate")) {
10256      JsonArray array = getJArray(json, "verificationDate");
10257      for (int i = 0; i < array.size(); i++) {
10258        if (array.get(i).isJsonNull()) {
10259          res.getVerificationDate().add(new DateTimeType());
10260        } else {;
10261          res.getVerificationDate().add(parseDateTime(array.get(i).getAsString()));
10262        }
10263      }
10264    };
10265    if (json.has("_verificationDate")) {
10266      JsonArray array = getJArray(json, "_verificationDate");
10267      for (int i = 0; i < array.size(); i++) {
10268        if (i == res.getVerificationDate().size())
10269          res.getVerificationDate().add(parseDateTime(null));
10270        if (array.get(i) instanceof JsonObject) 
10271          parseElementProperties(array.get(i).getAsJsonObject(), res.getVerificationDate().get(i));
10272      }
10273    };
10274  }
10275
10276  protected Consent.ProvisionComponent parseConsentProvisionComponent(JsonObject json) throws IOException, FHIRFormatError {
10277    Consent.ProvisionComponent res = new Consent.ProvisionComponent();
10278    parseConsentProvisionComponentProperties(json, res);
10279    return res;
10280  }
10281
10282  protected void parseConsentProvisionComponentProperties(JsonObject json, Consent.ProvisionComponent res) throws IOException, FHIRFormatError {
10283    parseBackboneElementProperties(json, res);
10284    if (json.has("period"))
10285      res.setPeriod(parsePeriod(getJObject(json, "period")));
10286    if (json.has("actor")) {
10287      JsonArray array = getJArray(json, "actor");
10288      for (int i = 0; i < array.size(); i++) {
10289        res.getActor().add(parseConsentProvisionActorComponent(array.get(i).getAsJsonObject()));
10290      }
10291    };
10292    if (json.has("action")) {
10293      JsonArray array = getJArray(json, "action");
10294      for (int i = 0; i < array.size(); i++) {
10295        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10296      }
10297    };
10298    if (json.has("securityLabel")) {
10299      JsonArray array = getJArray(json, "securityLabel");
10300      for (int i = 0; i < array.size(); i++) {
10301        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
10302      }
10303    };
10304    if (json.has("purpose")) {
10305      JsonArray array = getJArray(json, "purpose");
10306      for (int i = 0; i < array.size(); i++) {
10307        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
10308      }
10309    };
10310    if (json.has("documentType")) {
10311      JsonArray array = getJArray(json, "documentType");
10312      for (int i = 0; i < array.size(); i++) {
10313        res.getDocumentType().add(parseCoding(array.get(i).getAsJsonObject()));
10314      }
10315    };
10316    if (json.has("resourceType")) {
10317      JsonArray array = getJArray(json, "resourceType");
10318      for (int i = 0; i < array.size(); i++) {
10319        res.getResourceType().add(parseCoding(array.get(i).getAsJsonObject()));
10320      }
10321    };
10322    if (json.has("code")) {
10323      JsonArray array = getJArray(json, "code");
10324      for (int i = 0; i < array.size(); i++) {
10325        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10326      }
10327    };
10328    if (json.has("dataPeriod"))
10329      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
10330    if (json.has("data")) {
10331      JsonArray array = getJArray(json, "data");
10332      for (int i = 0; i < array.size(); i++) {
10333        res.getData().add(parseConsentProvisionDataComponent(array.get(i).getAsJsonObject()));
10334      }
10335    };
10336    if (json.has("expression"))
10337      res.setExpression(parseExpression(getJObject(json, "expression")));
10338    if (json.has("provision")) {
10339      JsonArray array = getJArray(json, "provision");
10340      for (int i = 0; i < array.size(); i++) {
10341        res.getProvision().add(parseConsentProvisionComponent(array.get(i).getAsJsonObject()));
10342      }
10343    };
10344  }
10345
10346  protected Consent.ProvisionActorComponent parseConsentProvisionActorComponent(JsonObject json) throws IOException, FHIRFormatError {
10347    Consent.ProvisionActorComponent res = new Consent.ProvisionActorComponent();
10348    parseConsentProvisionActorComponentProperties(json, res);
10349    return res;
10350  }
10351
10352  protected void parseConsentProvisionActorComponentProperties(JsonObject json, Consent.ProvisionActorComponent res) throws IOException, FHIRFormatError {
10353    parseBackboneElementProperties(json, res);
10354    if (json.has("role"))
10355      res.setRole(parseCodeableConcept(getJObject(json, "role")));
10356    if (json.has("reference"))
10357      res.setReference(parseReference(getJObject(json, "reference")));
10358  }
10359
10360  protected Consent.ProvisionDataComponent parseConsentProvisionDataComponent(JsonObject json) throws IOException, FHIRFormatError {
10361    Consent.ProvisionDataComponent res = new Consent.ProvisionDataComponent();
10362    parseConsentProvisionDataComponentProperties(json, res);
10363    return res;
10364  }
10365
10366  protected void parseConsentProvisionDataComponentProperties(JsonObject json, Consent.ProvisionDataComponent res) throws IOException, FHIRFormatError {
10367    parseBackboneElementProperties(json, res);
10368    if (json.has("meaning"))
10369      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Enumerations.ConsentDataMeaning.NULL, new Enumerations.ConsentDataMeaningEnumFactory()));
10370    if (json.has("_meaning"))
10371      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
10372    if (json.has("reference"))
10373      res.setReference(parseReference(getJObject(json, "reference")));
10374  }
10375
10376  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
10377    Contract res = new Contract();
10378    parseContractProperties(json, res);
10379    return res;
10380  }
10381
10382  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
10383    parseDomainResourceProperties(json, res);
10384    if (json.has("identifier")) {
10385      JsonArray array = getJArray(json, "identifier");
10386      for (int i = 0; i < array.size(); i++) {
10387        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10388      }
10389    };
10390    if (json.has("url"))
10391      res.setUrlElement(parseUri(json.get("url").getAsString()));
10392    if (json.has("_url"))
10393      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10394    if (json.has("version"))
10395      res.setVersionElement(parseString(json.get("version").getAsString()));
10396    if (json.has("_version"))
10397      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10398    if (json.has("status"))
10399      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractResourceStatusCodes.NULL, new Contract.ContractResourceStatusCodesEnumFactory()));
10400    if (json.has("_status"))
10401      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10402    if (json.has("legalState"))
10403      res.setLegalState(parseCodeableConcept(getJObject(json, "legalState")));
10404    if (json.has("instantiatesCanonical"))
10405      res.setInstantiatesCanonical(parseReference(getJObject(json, "instantiatesCanonical")));
10406    if (json.has("instantiatesUri"))
10407      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
10408    if (json.has("_instantiatesUri"))
10409      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
10410    if (json.has("contentDerivative"))
10411      res.setContentDerivative(parseCodeableConcept(getJObject(json, "contentDerivative")));
10412    if (json.has("issued"))
10413      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
10414    if (json.has("_issued"))
10415      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
10416    if (json.has("applies"))
10417      res.setApplies(parsePeriod(getJObject(json, "applies")));
10418    if (json.has("expirationType"))
10419      res.setExpirationType(parseCodeableConcept(getJObject(json, "expirationType")));
10420    if (json.has("subject")) {
10421      JsonArray array = getJArray(json, "subject");
10422      for (int i = 0; i < array.size(); i++) {
10423        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
10424      }
10425    };
10426    if (json.has("authority")) {
10427      JsonArray array = getJArray(json, "authority");
10428      for (int i = 0; i < array.size(); i++) {
10429        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
10430      }
10431    };
10432    if (json.has("domain")) {
10433      JsonArray array = getJArray(json, "domain");
10434      for (int i = 0; i < array.size(); i++) {
10435        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
10436      }
10437    };
10438    if (json.has("site")) {
10439      JsonArray array = getJArray(json, "site");
10440      for (int i = 0; i < array.size(); i++) {
10441        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
10442      }
10443    };
10444    if (json.has("name"))
10445      res.setNameElement(parseString(json.get("name").getAsString()));
10446    if (json.has("_name"))
10447      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10448    if (json.has("title"))
10449      res.setTitleElement(parseString(json.get("title").getAsString()));
10450    if (json.has("_title"))
10451      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
10452    if (json.has("subtitle"))
10453      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10454    if (json.has("_subtitle"))
10455      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
10456    if (json.has("alias")) {
10457      JsonArray array = getJArray(json, "alias");
10458      for (int i = 0; i < array.size(); i++) {
10459        if (array.get(i).isJsonNull()) {
10460          res.getAlias().add(new StringType());
10461        } else {;
10462          res.getAlias().add(parseString(array.get(i).getAsString()));
10463        }
10464      }
10465    };
10466    if (json.has("_alias")) {
10467      JsonArray array = getJArray(json, "_alias");
10468      for (int i = 0; i < array.size(); i++) {
10469        if (i == res.getAlias().size())
10470          res.getAlias().add(parseString(null));
10471        if (array.get(i) instanceof JsonObject) 
10472          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
10473      }
10474    };
10475    if (json.has("author"))
10476      res.setAuthor(parseReference(getJObject(json, "author")));
10477    if (json.has("scope"))
10478      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
10479    DataType topic = parseType("topic", json);
10480    if (topic != null)
10481      res.setTopic(topic);
10482    if (json.has("type"))
10483      res.setType(parseCodeableConcept(getJObject(json, "type")));
10484    if (json.has("subType")) {
10485      JsonArray array = getJArray(json, "subType");
10486      for (int i = 0; i < array.size(); i++) {
10487        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10488      }
10489    };
10490    if (json.has("contentDefinition"))
10491      res.setContentDefinition(parseContractContentDefinitionComponent(getJObject(json, "contentDefinition")));
10492    if (json.has("term")) {
10493      JsonArray array = getJArray(json, "term");
10494      for (int i = 0; i < array.size(); i++) {
10495        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject()));
10496      }
10497    };
10498    if (json.has("supportingInfo")) {
10499      JsonArray array = getJArray(json, "supportingInfo");
10500      for (int i = 0; i < array.size(); i++) {
10501        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
10502      }
10503    };
10504    if (json.has("relevantHistory")) {
10505      JsonArray array = getJArray(json, "relevantHistory");
10506      for (int i = 0; i < array.size(); i++) {
10507        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
10508      }
10509    };
10510    if (json.has("signer")) {
10511      JsonArray array = getJArray(json, "signer");
10512      for (int i = 0; i < array.size(); i++) {
10513        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject()));
10514      }
10515    };
10516    if (json.has("friendly")) {
10517      JsonArray array = getJArray(json, "friendly");
10518      for (int i = 0; i < array.size(); i++) {
10519        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject()));
10520      }
10521    };
10522    if (json.has("legal")) {
10523      JsonArray array = getJArray(json, "legal");
10524      for (int i = 0; i < array.size(); i++) {
10525        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject()));
10526      }
10527    };
10528    if (json.has("rule")) {
10529      JsonArray array = getJArray(json, "rule");
10530      for (int i = 0; i < array.size(); i++) {
10531        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject()));
10532      }
10533    };
10534    DataType legallyBinding = parseType("legallyBinding", json);
10535    if (legallyBinding != null)
10536      res.setLegallyBinding(legallyBinding);
10537  }
10538
10539  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
10540    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
10541    parseContractContentDefinitionComponentProperties(json, res);
10542    return res;
10543  }
10544
10545  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
10546    parseBackboneElementProperties(json, res);
10547    if (json.has("type"))
10548      res.setType(parseCodeableConcept(getJObject(json, "type")));
10549    if (json.has("subType"))
10550      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
10551    if (json.has("publisher"))
10552      res.setPublisher(parseReference(getJObject(json, "publisher")));
10553    if (json.has("publicationDate"))
10554      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
10555    if (json.has("_publicationDate"))
10556      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
10557    if (json.has("publicationStatus"))
10558      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractResourcePublicationStatusCodes.NULL, new Contract.ContractResourcePublicationStatusCodesEnumFactory()));
10559    if (json.has("_publicationStatus"))
10560      parseElementProperties(getJObject(json, "_publicationStatus"), res.getPublicationStatusElement());
10561    if (json.has("copyright"))
10562      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10563    if (json.has("_copyright"))
10564      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
10565  }
10566
10567  protected Contract.TermComponent parseContractTermComponent(JsonObject json) throws IOException, FHIRFormatError {
10568    Contract.TermComponent res = new Contract.TermComponent();
10569    parseContractTermComponentProperties(json, res);
10570    return res;
10571  }
10572
10573  protected void parseContractTermComponentProperties(JsonObject json, Contract.TermComponent res) throws IOException, FHIRFormatError {
10574    parseBackboneElementProperties(json, res);
10575    if (json.has("identifier"))
10576      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
10577    if (json.has("issued"))
10578      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
10579    if (json.has("_issued"))
10580      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
10581    if (json.has("applies"))
10582      res.setApplies(parsePeriod(getJObject(json, "applies")));
10583    DataType topic = parseType("topic", json);
10584    if (topic != null)
10585      res.setTopic(topic);
10586    if (json.has("type"))
10587      res.setType(parseCodeableConcept(getJObject(json, "type")));
10588    if (json.has("subType"))
10589      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
10590    if (json.has("text"))
10591      res.setTextElement(parseString(json.get("text").getAsString()));
10592    if (json.has("_text"))
10593      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
10594    if (json.has("securityLabel")) {
10595      JsonArray array = getJArray(json, "securityLabel");
10596      for (int i = 0; i < array.size(); i++) {
10597        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject()));
10598      }
10599    };
10600    if (json.has("offer"))
10601      res.setOffer(parseContractOfferComponent(getJObject(json, "offer")));
10602    if (json.has("asset")) {
10603      JsonArray array = getJArray(json, "asset");
10604      for (int i = 0; i < array.size(); i++) {
10605        res.getAsset().add(parseContractAssetComponent(array.get(i).getAsJsonObject()));
10606      }
10607    };
10608    if (json.has("action")) {
10609      JsonArray array = getJArray(json, "action");
10610      for (int i = 0; i < array.size(); i++) {
10611        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject()));
10612      }
10613    };
10614    if (json.has("group")) {
10615      JsonArray array = getJArray(json, "group");
10616      for (int i = 0; i < array.size(); i++) {
10617        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject()));
10618      }
10619    };
10620  }
10621
10622  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json) throws IOException, FHIRFormatError {
10623    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
10624    parseContractSecurityLabelComponentProperties(json, res);
10625    return res;
10626  }
10627
10628  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
10629    parseBackboneElementProperties(json, res);
10630    if (json.has("number")) {
10631      JsonArray array = getJArray(json, "number");
10632      for (int i = 0; i < array.size(); i++) {
10633        if (array.get(i).isJsonNull()) {
10634          res.getNumber().add(new UnsignedIntType());
10635        } else {;
10636          res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
10637        }
10638      }
10639    };
10640    if (json.has("_number")) {
10641      JsonArray array = getJArray(json, "_number");
10642      for (int i = 0; i < array.size(); i++) {
10643        if (i == res.getNumber().size())
10644          res.getNumber().add(parseUnsignedInt(null));
10645        if (array.get(i) instanceof JsonObject) 
10646          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
10647      }
10648    };
10649    if (json.has("classification"))
10650      res.setClassification(parseCoding(getJObject(json, "classification")));
10651    if (json.has("category")) {
10652      JsonArray array = getJArray(json, "category");
10653      for (int i = 0; i < array.size(); i++) {
10654        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
10655      }
10656    };
10657    if (json.has("control")) {
10658      JsonArray array = getJArray(json, "control");
10659      for (int i = 0; i < array.size(); i++) {
10660        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
10661      }
10662    };
10663  }
10664
10665  protected Contract.ContractOfferComponent parseContractOfferComponent(JsonObject json) throws IOException, FHIRFormatError {
10666    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
10667    parseContractOfferComponentProperties(json, res);
10668    return res;
10669  }
10670
10671  protected void parseContractOfferComponentProperties(JsonObject json, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
10672    parseBackboneElementProperties(json, res);
10673    if (json.has("identifier")) {
10674      JsonArray array = getJArray(json, "identifier");
10675      for (int i = 0; i < array.size(); i++) {
10676        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10677      }
10678    };
10679    if (json.has("party")) {
10680      JsonArray array = getJArray(json, "party");
10681      for (int i = 0; i < array.size(); i++) {
10682        res.getParty().add(parseContractPartyComponent(array.get(i).getAsJsonObject()));
10683      }
10684    };
10685    if (json.has("topic"))
10686      res.setTopic(parseReference(getJObject(json, "topic")));
10687    if (json.has("type"))
10688      res.setType(parseCodeableConcept(getJObject(json, "type")));
10689    if (json.has("decision"))
10690      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
10691    if (json.has("decisionMode")) {
10692      JsonArray array = getJArray(json, "decisionMode");
10693      for (int i = 0; i < array.size(); i++) {
10694        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10695      }
10696    };
10697    if (json.has("answer")) {
10698      JsonArray array = getJArray(json, "answer");
10699      for (int i = 0; i < array.size(); i++) {
10700        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject()));
10701      }
10702    };
10703    if (json.has("text"))
10704      res.setTextElement(parseString(json.get("text").getAsString()));
10705    if (json.has("_text"))
10706      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
10707    if (json.has("linkId")) {
10708      JsonArray array = getJArray(json, "linkId");
10709      for (int i = 0; i < array.size(); i++) {
10710        if (array.get(i).isJsonNull()) {
10711          res.getLinkId().add(new StringType());
10712        } else {;
10713          res.getLinkId().add(parseString(array.get(i).getAsString()));
10714        }
10715      }
10716    };
10717    if (json.has("_linkId")) {
10718      JsonArray array = getJArray(json, "_linkId");
10719      for (int i = 0; i < array.size(); i++) {
10720        if (i == res.getLinkId().size())
10721          res.getLinkId().add(parseString(null));
10722        if (array.get(i) instanceof JsonObject) 
10723          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
10724      }
10725    };
10726    if (json.has("securityLabelNumber")) {
10727      JsonArray array = getJArray(json, "securityLabelNumber");
10728      for (int i = 0; i < array.size(); i++) {
10729        if (array.get(i).isJsonNull()) {
10730          res.getSecurityLabelNumber().add(new UnsignedIntType());
10731        } else {;
10732          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
10733        }
10734      }
10735    };
10736    if (json.has("_securityLabelNumber")) {
10737      JsonArray array = getJArray(json, "_securityLabelNumber");
10738      for (int i = 0; i < array.size(); i++) {
10739        if (i == res.getSecurityLabelNumber().size())
10740          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
10741        if (array.get(i) instanceof JsonObject) 
10742          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
10743      }
10744    };
10745  }
10746
10747  protected Contract.ContractPartyComponent parseContractPartyComponent(JsonObject json) throws IOException, FHIRFormatError {
10748    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
10749    parseContractPartyComponentProperties(json, res);
10750    return res;
10751  }
10752
10753  protected void parseContractPartyComponentProperties(JsonObject json, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
10754    parseBackboneElementProperties(json, res);
10755    if (json.has("reference")) {
10756      JsonArray array = getJArray(json, "reference");
10757      for (int i = 0; i < array.size(); i++) {
10758        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
10759      }
10760    };
10761    if (json.has("role"))
10762      res.setRole(parseCodeableConcept(getJObject(json, "role")));
10763  }
10764
10765  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json) throws IOException, FHIRFormatError {
10766    Contract.AnswerComponent res = new Contract.AnswerComponent();
10767    parseContractAnswerComponentProperties(json, res);
10768    return res;
10769  }
10770
10771  protected void parseContractAnswerComponentProperties(JsonObject json, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
10772    parseBackboneElementProperties(json, res);
10773    DataType value = parseType("value", json);
10774    if (value != null)
10775      res.setValue(value);
10776  }
10777
10778  protected Contract.ContractAssetComponent parseContractAssetComponent(JsonObject json) throws IOException, FHIRFormatError {
10779    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
10780    parseContractAssetComponentProperties(json, res);
10781    return res;
10782  }
10783
10784  protected void parseContractAssetComponentProperties(JsonObject json, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
10785    parseBackboneElementProperties(json, res);
10786    if (json.has("scope"))
10787      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
10788    if (json.has("type")) {
10789      JsonArray array = getJArray(json, "type");
10790      for (int i = 0; i < array.size(); i++) {
10791        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10792      }
10793    };
10794    if (json.has("typeReference")) {
10795      JsonArray array = getJArray(json, "typeReference");
10796      for (int i = 0; i < array.size(); i++) {
10797        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
10798      }
10799    };
10800    if (json.has("subtype")) {
10801      JsonArray array = getJArray(json, "subtype");
10802      for (int i = 0; i < array.size(); i++) {
10803        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10804      }
10805    };
10806    if (json.has("relationship"))
10807      res.setRelationship(parseCoding(getJObject(json, "relationship")));
10808    if (json.has("context")) {
10809      JsonArray array = getJArray(json, "context");
10810      for (int i = 0; i < array.size(); i++) {
10811        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject()));
10812      }
10813    };
10814    if (json.has("condition"))
10815      res.setConditionElement(parseString(json.get("condition").getAsString()));
10816    if (json.has("_condition"))
10817      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
10818    if (json.has("periodType")) {
10819      JsonArray array = getJArray(json, "periodType");
10820      for (int i = 0; i < array.size(); i++) {
10821        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10822      }
10823    };
10824    if (json.has("period")) {
10825      JsonArray array = getJArray(json, "period");
10826      for (int i = 0; i < array.size(); i++) {
10827        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
10828      }
10829    };
10830    if (json.has("usePeriod")) {
10831      JsonArray array = getJArray(json, "usePeriod");
10832      for (int i = 0; i < array.size(); i++) {
10833        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
10834      }
10835    };
10836    if (json.has("text"))
10837      res.setTextElement(parseString(json.get("text").getAsString()));
10838    if (json.has("_text"))
10839      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
10840    if (json.has("linkId")) {
10841      JsonArray array = getJArray(json, "linkId");
10842      for (int i = 0; i < array.size(); i++) {
10843        if (array.get(i).isJsonNull()) {
10844          res.getLinkId().add(new StringType());
10845        } else {;
10846          res.getLinkId().add(parseString(array.get(i).getAsString()));
10847        }
10848      }
10849    };
10850    if (json.has("_linkId")) {
10851      JsonArray array = getJArray(json, "_linkId");
10852      for (int i = 0; i < array.size(); i++) {
10853        if (i == res.getLinkId().size())
10854          res.getLinkId().add(parseString(null));
10855        if (array.get(i) instanceof JsonObject) 
10856          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
10857      }
10858    };
10859    if (json.has("answer")) {
10860      JsonArray array = getJArray(json, "answer");
10861      for (int i = 0; i < array.size(); i++) {
10862        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject()));
10863      }
10864    };
10865    if (json.has("securityLabelNumber")) {
10866      JsonArray array = getJArray(json, "securityLabelNumber");
10867      for (int i = 0; i < array.size(); i++) {
10868        if (array.get(i).isJsonNull()) {
10869          res.getSecurityLabelNumber().add(new UnsignedIntType());
10870        } else {;
10871          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
10872        }
10873      }
10874    };
10875    if (json.has("_securityLabelNumber")) {
10876      JsonArray array = getJArray(json, "_securityLabelNumber");
10877      for (int i = 0; i < array.size(); i++) {
10878        if (i == res.getSecurityLabelNumber().size())
10879          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
10880        if (array.get(i) instanceof JsonObject) 
10881          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
10882      }
10883    };
10884    if (json.has("valuedItem")) {
10885      JsonArray array = getJArray(json, "valuedItem");
10886      for (int i = 0; i < array.size(); i++) {
10887        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject()));
10888      }
10889    };
10890  }
10891
10892  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json) throws IOException, FHIRFormatError {
10893    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
10894    parseContractAssetContextComponentProperties(json, res);
10895    return res;
10896  }
10897
10898  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
10899    parseBackboneElementProperties(json, res);
10900    if (json.has("reference"))
10901      res.setReference(parseReference(getJObject(json, "reference")));
10902    if (json.has("code")) {
10903      JsonArray array = getJArray(json, "code");
10904      for (int i = 0; i < array.size(); i++) {
10905        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10906      }
10907    };
10908    if (json.has("text"))
10909      res.setTextElement(parseString(json.get("text").getAsString()));
10910    if (json.has("_text"))
10911      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
10912  }
10913
10914  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
10915    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
10916    parseContractValuedItemComponentProperties(json, res);
10917    return res;
10918  }
10919
10920  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
10921    parseBackboneElementProperties(json, res);
10922    DataType entity = parseType("entity", json);
10923    if (entity != null)
10924      res.setEntity(entity);
10925    if (json.has("identifier"))
10926      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
10927    if (json.has("effectiveTime"))
10928      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
10929    if (json.has("_effectiveTime"))
10930      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
10931    if (json.has("quantity"))
10932      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
10933    if (json.has("unitPrice"))
10934      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
10935    if (json.has("factor"))
10936      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
10937    if (json.has("_factor"))
10938      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
10939    if (json.has("points"))
10940      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
10941    if (json.has("_points"))
10942      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
10943    if (json.has("net"))
10944      res.setNet(parseMoney(getJObject(json, "net")));
10945    if (json.has("payment"))
10946      res.setPaymentElement(parseString(json.get("payment").getAsString()));
10947    if (json.has("_payment"))
10948      parseElementProperties(getJObject(json, "_payment"), res.getPaymentElement());
10949    if (json.has("paymentDate"))
10950      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
10951    if (json.has("_paymentDate"))
10952      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
10953    if (json.has("responsible"))
10954      res.setResponsible(parseReference(getJObject(json, "responsible")));
10955    if (json.has("recipient"))
10956      res.setRecipient(parseReference(getJObject(json, "recipient")));
10957    if (json.has("linkId")) {
10958      JsonArray array = getJArray(json, "linkId");
10959      for (int i = 0; i < array.size(); i++) {
10960        if (array.get(i).isJsonNull()) {
10961          res.getLinkId().add(new StringType());
10962        } else {;
10963          res.getLinkId().add(parseString(array.get(i).getAsString()));
10964        }
10965      }
10966    };
10967    if (json.has("_linkId")) {
10968      JsonArray array = getJArray(json, "_linkId");
10969      for (int i = 0; i < array.size(); i++) {
10970        if (i == res.getLinkId().size())
10971          res.getLinkId().add(parseString(null));
10972        if (array.get(i) instanceof JsonObject) 
10973          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
10974      }
10975    };
10976    if (json.has("securityLabelNumber")) {
10977      JsonArray array = getJArray(json, "securityLabelNumber");
10978      for (int i = 0; i < array.size(); i++) {
10979        if (array.get(i).isJsonNull()) {
10980          res.getSecurityLabelNumber().add(new UnsignedIntType());
10981        } else {;
10982          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
10983        }
10984      }
10985    };
10986    if (json.has("_securityLabelNumber")) {
10987      JsonArray array = getJArray(json, "_securityLabelNumber");
10988      for (int i = 0; i < array.size(); i++) {
10989        if (i == res.getSecurityLabelNumber().size())
10990          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
10991        if (array.get(i) instanceof JsonObject) 
10992          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
10993      }
10994    };
10995  }
10996
10997  protected Contract.ActionComponent parseContractActionComponent(JsonObject json) throws IOException, FHIRFormatError {
10998    Contract.ActionComponent res = new Contract.ActionComponent();
10999    parseContractActionComponentProperties(json, res);
11000    return res;
11001  }
11002
11003  protected void parseContractActionComponentProperties(JsonObject json, Contract.ActionComponent res) throws IOException, FHIRFormatError {
11004    parseBackboneElementProperties(json, res);
11005    if (json.has("doNotPerform"))
11006      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
11007    if (json.has("_doNotPerform"))
11008      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
11009    if (json.has("type"))
11010      res.setType(parseCodeableConcept(getJObject(json, "type")));
11011    if (json.has("subject")) {
11012      JsonArray array = getJArray(json, "subject");
11013      for (int i = 0; i < array.size(); i++) {
11014        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject()));
11015      }
11016    };
11017    if (json.has("intent"))
11018      res.setIntent(parseCodeableConcept(getJObject(json, "intent")));
11019    if (json.has("linkId")) {
11020      JsonArray array = getJArray(json, "linkId");
11021      for (int i = 0; i < array.size(); i++) {
11022        if (array.get(i).isJsonNull()) {
11023          res.getLinkId().add(new StringType());
11024        } else {;
11025          res.getLinkId().add(parseString(array.get(i).getAsString()));
11026        }
11027      }
11028    };
11029    if (json.has("_linkId")) {
11030      JsonArray array = getJArray(json, "_linkId");
11031      for (int i = 0; i < array.size(); i++) {
11032        if (i == res.getLinkId().size())
11033          res.getLinkId().add(parseString(null));
11034        if (array.get(i) instanceof JsonObject) 
11035          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
11036      }
11037    };
11038    if (json.has("status"))
11039      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
11040    if (json.has("context"))
11041      res.setContext(parseReference(getJObject(json, "context")));
11042    if (json.has("contextLinkId")) {
11043      JsonArray array = getJArray(json, "contextLinkId");
11044      for (int i = 0; i < array.size(); i++) {
11045        if (array.get(i).isJsonNull()) {
11046          res.getContextLinkId().add(new StringType());
11047        } else {;
11048          res.getContextLinkId().add(parseString(array.get(i).getAsString()));
11049        }
11050      }
11051    };
11052    if (json.has("_contextLinkId")) {
11053      JsonArray array = getJArray(json, "_contextLinkId");
11054      for (int i = 0; i < array.size(); i++) {
11055        if (i == res.getContextLinkId().size())
11056          res.getContextLinkId().add(parseString(null));
11057        if (array.get(i) instanceof JsonObject) 
11058          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
11059      }
11060    };
11061    DataType occurrence = parseType("occurrence", json);
11062    if (occurrence != null)
11063      res.setOccurrence(occurrence);
11064    if (json.has("requester")) {
11065      JsonArray array = getJArray(json, "requester");
11066      for (int i = 0; i < array.size(); i++) {
11067        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
11068      }
11069    };
11070    if (json.has("requesterLinkId")) {
11071      JsonArray array = getJArray(json, "requesterLinkId");
11072      for (int i = 0; i < array.size(); i++) {
11073        if (array.get(i).isJsonNull()) {
11074          res.getRequesterLinkId().add(new StringType());
11075        } else {;
11076          res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
11077        }
11078      }
11079    };
11080    if (json.has("_requesterLinkId")) {
11081      JsonArray array = getJArray(json, "_requesterLinkId");
11082      for (int i = 0; i < array.size(); i++) {
11083        if (i == res.getRequesterLinkId().size())
11084          res.getRequesterLinkId().add(parseString(null));
11085        if (array.get(i) instanceof JsonObject) 
11086          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
11087      }
11088    };
11089    if (json.has("performerType")) {
11090      JsonArray array = getJArray(json, "performerType");
11091      for (int i = 0; i < array.size(); i++) {
11092        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11093      }
11094    };
11095    if (json.has("performerRole"))
11096      res.setPerformerRole(parseCodeableConcept(getJObject(json, "performerRole")));
11097    if (json.has("performer"))
11098      res.setPerformer(parseReference(getJObject(json, "performer")));
11099    if (json.has("performerLinkId")) {
11100      JsonArray array = getJArray(json, "performerLinkId");
11101      for (int i = 0; i < array.size(); i++) {
11102        if (array.get(i).isJsonNull()) {
11103          res.getPerformerLinkId().add(new StringType());
11104        } else {;
11105          res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
11106        }
11107      }
11108    };
11109    if (json.has("_performerLinkId")) {
11110      JsonArray array = getJArray(json, "_performerLinkId");
11111      for (int i = 0; i < array.size(); i++) {
11112        if (i == res.getPerformerLinkId().size())
11113          res.getPerformerLinkId().add(parseString(null));
11114        if (array.get(i) instanceof JsonObject) 
11115          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
11116      }
11117    };
11118    if (json.has("reason")) {
11119      JsonArray array = getJArray(json, "reason");
11120      for (int i = 0; i < array.size(); i++) {
11121        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
11122      }
11123    };
11124    if (json.has("reasonLinkId")) {
11125      JsonArray array = getJArray(json, "reasonLinkId");
11126      for (int i = 0; i < array.size(); i++) {
11127        if (array.get(i).isJsonNull()) {
11128          res.getReasonLinkId().add(new StringType());
11129        } else {;
11130          res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
11131        }
11132      }
11133    };
11134    if (json.has("_reasonLinkId")) {
11135      JsonArray array = getJArray(json, "_reasonLinkId");
11136      for (int i = 0; i < array.size(); i++) {
11137        if (i == res.getReasonLinkId().size())
11138          res.getReasonLinkId().add(parseString(null));
11139        if (array.get(i) instanceof JsonObject) 
11140          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
11141      }
11142    };
11143    if (json.has("note")) {
11144      JsonArray array = getJArray(json, "note");
11145      for (int i = 0; i < array.size(); i++) {
11146        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11147      }
11148    };
11149    if (json.has("securityLabelNumber")) {
11150      JsonArray array = getJArray(json, "securityLabelNumber");
11151      for (int i = 0; i < array.size(); i++) {
11152        if (array.get(i).isJsonNull()) {
11153          res.getSecurityLabelNumber().add(new UnsignedIntType());
11154        } else {;
11155          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
11156        }
11157      }
11158    };
11159    if (json.has("_securityLabelNumber")) {
11160      JsonArray array = getJArray(json, "_securityLabelNumber");
11161      for (int i = 0; i < array.size(); i++) {
11162        if (i == res.getSecurityLabelNumber().size())
11163          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
11164        if (array.get(i) instanceof JsonObject) 
11165          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
11166      }
11167    };
11168  }
11169
11170  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json) throws IOException, FHIRFormatError {
11171    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
11172    parseContractActionSubjectComponentProperties(json, res);
11173    return res;
11174  }
11175
11176  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
11177    parseBackboneElementProperties(json, res);
11178    if (json.has("reference")) {
11179      JsonArray array = getJArray(json, "reference");
11180      for (int i = 0; i < array.size(); i++) {
11181        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
11182      }
11183    };
11184    if (json.has("role"))
11185      res.setRole(parseCodeableConcept(getJObject(json, "role")));
11186  }
11187
11188  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json) throws IOException, FHIRFormatError {
11189    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
11190    parseContractSignatoryComponentProperties(json, res);
11191    return res;
11192  }
11193
11194  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
11195    parseBackboneElementProperties(json, res);
11196    if (json.has("type"))
11197      res.setType(parseCoding(getJObject(json, "type")));
11198    if (json.has("party"))
11199      res.setParty(parseReference(getJObject(json, "party")));
11200    if (json.has("signature")) {
11201      JsonArray array = getJArray(json, "signature");
11202      for (int i = 0; i < array.size(); i++) {
11203        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
11204      }
11205    };
11206  }
11207
11208  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
11209    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
11210    parseContractFriendlyLanguageComponentProperties(json, res);
11211    return res;
11212  }
11213
11214  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
11215    parseBackboneElementProperties(json, res);
11216    DataType content = parseType("content", json);
11217    if (content != null)
11218      res.setContent(content);
11219  }
11220
11221  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
11222    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
11223    parseContractLegalLanguageComponentProperties(json, res);
11224    return res;
11225  }
11226
11227  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
11228    parseBackboneElementProperties(json, res);
11229    DataType content = parseType("content", json);
11230    if (content != null)
11231      res.setContent(content);
11232  }
11233
11234  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
11235    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
11236    parseContractComputableLanguageComponentProperties(json, res);
11237    return res;
11238  }
11239
11240  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
11241    parseBackboneElementProperties(json, res);
11242    DataType content = parseType("content", json);
11243    if (content != null)
11244      res.setContent(content);
11245  }
11246
11247  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
11248    Coverage res = new Coverage();
11249    parseCoverageProperties(json, res);
11250    return res;
11251  }
11252
11253  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
11254    parseDomainResourceProperties(json, res);
11255    if (json.has("identifier")) {
11256      JsonArray array = getJArray(json, "identifier");
11257      for (int i = 0; i < array.size(); i++) {
11258        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11259      }
11260    };
11261    if (json.has("status"))
11262      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
11263    if (json.has("_status"))
11264      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11265    if (json.has("kind"))
11266      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Coverage.Kind.NULL, new Coverage.KindEnumFactory()));
11267    if (json.has("_kind"))
11268      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
11269    if (json.has("paymentBy")) {
11270      JsonArray array = getJArray(json, "paymentBy");
11271      for (int i = 0; i < array.size(); i++) {
11272        res.getPaymentBy().add(parseCoveragePaymentByComponent(array.get(i).getAsJsonObject()));
11273      }
11274    };
11275    if (json.has("type"))
11276      res.setType(parseCodeableConcept(getJObject(json, "type")));
11277    if (json.has("policyHolder"))
11278      res.setPolicyHolder(parseReference(getJObject(json, "policyHolder")));
11279    if (json.has("subscriber"))
11280      res.setSubscriber(parseReference(getJObject(json, "subscriber")));
11281    if (json.has("subscriberId")) {
11282      JsonArray array = getJArray(json, "subscriberId");
11283      for (int i = 0; i < array.size(); i++) {
11284        res.getSubscriberId().add(parseIdentifier(array.get(i).getAsJsonObject()));
11285      }
11286    };
11287    if (json.has("beneficiary"))
11288      res.setBeneficiary(parseReference(getJObject(json, "beneficiary")));
11289    if (json.has("dependent"))
11290      res.setDependentElement(parseString(json.get("dependent").getAsString()));
11291    if (json.has("_dependent"))
11292      parseElementProperties(getJObject(json, "_dependent"), res.getDependentElement());
11293    if (json.has("relationship"))
11294      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
11295    if (json.has("period"))
11296      res.setPeriod(parsePeriod(getJObject(json, "period")));
11297    if (json.has("insurer"))
11298      res.setInsurer(parseReference(getJObject(json, "insurer")));
11299    if (json.has("class")) {
11300      JsonArray array = getJArray(json, "class");
11301      for (int i = 0; i < array.size(); i++) {
11302        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject()));
11303      }
11304    };
11305    if (json.has("order"))
11306      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
11307    if (json.has("_order"))
11308      parseElementProperties(getJObject(json, "_order"), res.getOrderElement());
11309    if (json.has("network"))
11310      res.setNetworkElement(parseString(json.get("network").getAsString()));
11311    if (json.has("_network"))
11312      parseElementProperties(getJObject(json, "_network"), res.getNetworkElement());
11313    if (json.has("costToBeneficiary")) {
11314      JsonArray array = getJArray(json, "costToBeneficiary");
11315      for (int i = 0; i < array.size(); i++) {
11316        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject()));
11317      }
11318    };
11319    if (json.has("subrogation"))
11320      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
11321    if (json.has("_subrogation"))
11322      parseElementProperties(getJObject(json, "_subrogation"), res.getSubrogationElement());
11323    if (json.has("contract")) {
11324      JsonArray array = getJArray(json, "contract");
11325      for (int i = 0; i < array.size(); i++) {
11326        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
11327      }
11328    };
11329    if (json.has("insurancePlan"))
11330      res.setInsurancePlan(parseReference(getJObject(json, "insurancePlan")));
11331  }
11332
11333  protected Coverage.CoveragePaymentByComponent parseCoveragePaymentByComponent(JsonObject json) throws IOException, FHIRFormatError {
11334    Coverage.CoveragePaymentByComponent res = new Coverage.CoveragePaymentByComponent();
11335    parseCoveragePaymentByComponentProperties(json, res);
11336    return res;
11337  }
11338
11339  protected void parseCoveragePaymentByComponentProperties(JsonObject json, Coverage.CoveragePaymentByComponent res) throws IOException, FHIRFormatError {
11340    parseBackboneElementProperties(json, res);
11341    if (json.has("party"))
11342      res.setParty(parseReference(getJObject(json, "party")));
11343    if (json.has("responsibility"))
11344      res.setResponsibilityElement(parseString(json.get("responsibility").getAsString()));
11345    if (json.has("_responsibility"))
11346      parseElementProperties(getJObject(json, "_responsibility"), res.getResponsibilityElement());
11347  }
11348
11349  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json) throws IOException, FHIRFormatError {
11350    Coverage.ClassComponent res = new Coverage.ClassComponent();
11351    parseCoverageClassComponentProperties(json, res);
11352    return res;
11353  }
11354
11355  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
11356    parseBackboneElementProperties(json, res);
11357    if (json.has("type"))
11358      res.setType(parseCodeableConcept(getJObject(json, "type")));
11359    if (json.has("value"))
11360      res.setValue(parseIdentifier(getJObject(json, "value")));
11361    if (json.has("name"))
11362      res.setNameElement(parseString(json.get("name").getAsString()));
11363    if (json.has("_name"))
11364      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11365  }
11366
11367  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json) throws IOException, FHIRFormatError {
11368    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
11369    parseCoverageCostToBeneficiaryComponentProperties(json, res);
11370    return res;
11371  }
11372
11373  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
11374    parseBackboneElementProperties(json, res);
11375    if (json.has("type"))
11376      res.setType(parseCodeableConcept(getJObject(json, "type")));
11377    if (json.has("category"))
11378      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
11379    if (json.has("network"))
11380      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
11381    if (json.has("unit"))
11382      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
11383    if (json.has("term"))
11384      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
11385    DataType value = parseType("value", json);
11386    if (value != null)
11387      res.setValue(value);
11388    if (json.has("exception")) {
11389      JsonArray array = getJArray(json, "exception");
11390      for (int i = 0; i < array.size(); i++) {
11391        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject()));
11392      }
11393    };
11394  }
11395
11396  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json) throws IOException, FHIRFormatError {
11397    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
11398    parseCoverageExemptionComponentProperties(json, res);
11399    return res;
11400  }
11401
11402  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
11403    parseBackboneElementProperties(json, res);
11404    if (json.has("type"))
11405      res.setType(parseCodeableConcept(getJObject(json, "type")));
11406    if (json.has("period"))
11407      res.setPeriod(parsePeriod(getJObject(json, "period")));
11408  }
11409
11410  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
11411    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
11412    parseCoverageEligibilityRequestProperties(json, res);
11413    return res;
11414  }
11415
11416  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
11417    parseDomainResourceProperties(json, res);
11418    if (json.has("identifier")) {
11419      JsonArray array = getJArray(json, "identifier");
11420      for (int i = 0; i < array.size(); i++) {
11421        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11422      }
11423    };
11424    if (json.has("status"))
11425      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
11426    if (json.has("_status"))
11427      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11428    if (json.has("priority"))
11429      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
11430    if (json.has("purpose")) {
11431      JsonArray array = getJArray(json, "purpose");
11432      for (int i = 0; i < array.size(); i++) {
11433        if (array.get(i).isJsonNull()) {
11434          res.getPurpose().add(new Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose>(new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL));
11435        } else {;
11436          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
11437        }
11438      }
11439    };
11440    if (json.has("_purpose")) {
11441      JsonArray array = getJArray(json, "_purpose");
11442      for (int i = 0; i < array.size(); i++) {
11443        if (i == res.getPurpose().size())
11444          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
11445        if (array.get(i) instanceof JsonObject) 
11446          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
11447      }
11448    };
11449    if (json.has("patient"))
11450      res.setPatient(parseReference(getJObject(json, "patient")));
11451    if (json.has("event")) {
11452      JsonArray array = getJArray(json, "event");
11453      for (int i = 0; i < array.size(); i++) {
11454        res.getEvent().add(parseCoverageEligibilityRequestEventComponent(array.get(i).getAsJsonObject()));
11455      }
11456    };
11457    DataType serviced = parseType("serviced", json);
11458    if (serviced != null)
11459      res.setServiced(serviced);
11460    if (json.has("created"))
11461      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11462    if (json.has("_created"))
11463      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11464    if (json.has("enterer"))
11465      res.setEnterer(parseReference(getJObject(json, "enterer")));
11466    if (json.has("provider"))
11467      res.setProvider(parseReference(getJObject(json, "provider")));
11468    if (json.has("insurer"))
11469      res.setInsurer(parseReference(getJObject(json, "insurer")));
11470    if (json.has("facility"))
11471      res.setFacility(parseReference(getJObject(json, "facility")));
11472    if (json.has("supportingInfo")) {
11473      JsonArray array = getJArray(json, "supportingInfo");
11474      for (int i = 0; i < array.size(); i++) {
11475        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject()));
11476      }
11477    };
11478    if (json.has("insurance")) {
11479      JsonArray array = getJArray(json, "insurance");
11480      for (int i = 0; i < array.size(); i++) {
11481        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject()));
11482      }
11483    };
11484    if (json.has("item")) {
11485      JsonArray array = getJArray(json, "item");
11486      for (int i = 0; i < array.size(); i++) {
11487        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject()));
11488      }
11489    };
11490  }
11491
11492  protected CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent parseCoverageEligibilityRequestEventComponent(JsonObject json) throws IOException, FHIRFormatError {
11493    CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent res = new CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent();
11494    parseCoverageEligibilityRequestEventComponentProperties(json, res);
11495    return res;
11496  }
11497
11498  protected void parseCoverageEligibilityRequestEventComponentProperties(JsonObject json, CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent res) throws IOException, FHIRFormatError {
11499    parseBackboneElementProperties(json, res);
11500    if (json.has("type"))
11501      res.setType(parseCodeableConcept(getJObject(json, "type")));
11502    DataType when = parseType("when", json);
11503    if (when != null)
11504      res.setWhen(when);
11505  }
11506
11507  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
11508    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
11509    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, res);
11510    return res;
11511  }
11512
11513  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
11514    parseBackboneElementProperties(json, res);
11515    if (json.has("sequence"))
11516      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11517    if (json.has("_sequence"))
11518      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
11519    if (json.has("information"))
11520      res.setInformation(parseReference(getJObject(json, "information")));
11521    if (json.has("appliesToAll"))
11522      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
11523    if (json.has("_appliesToAll"))
11524      parseElementProperties(getJObject(json, "_appliesToAll"), res.getAppliesToAllElement());
11525  }
11526
11527  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
11528    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
11529    parseCoverageEligibilityRequestInsuranceComponentProperties(json, res);
11530    return res;
11531  }
11532
11533  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
11534    parseBackboneElementProperties(json, res);
11535    if (json.has("focal"))
11536      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
11537    if (json.has("_focal"))
11538      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
11539    if (json.has("coverage"))
11540      res.setCoverage(parseReference(getJObject(json, "coverage")));
11541    if (json.has("businessArrangement"))
11542      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
11543    if (json.has("_businessArrangement"))
11544      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
11545  }
11546
11547  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json) throws IOException, FHIRFormatError {
11548    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
11549    parseCoverageEligibilityRequestDetailsComponentProperties(json, res);
11550    return res;
11551  }
11552
11553  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
11554    parseBackboneElementProperties(json, res);
11555    if (json.has("supportingInfoSequence")) {
11556      JsonArray array = getJArray(json, "supportingInfoSequence");
11557      for (int i = 0; i < array.size(); i++) {
11558        if (array.get(i).isJsonNull()) {
11559          res.getSupportingInfoSequence().add(new PositiveIntType());
11560        } else {;
11561          res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
11562        }
11563      }
11564    };
11565    if (json.has("_supportingInfoSequence")) {
11566      JsonArray array = getJArray(json, "_supportingInfoSequence");
11567      for (int i = 0; i < array.size(); i++) {
11568        if (i == res.getSupportingInfoSequence().size())
11569          res.getSupportingInfoSequence().add(parsePositiveInt(null));
11570        if (array.get(i) instanceof JsonObject) 
11571          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
11572      }
11573    };
11574    if (json.has("category"))
11575      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
11576    if (json.has("productOrService"))
11577      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
11578    if (json.has("modifier")) {
11579      JsonArray array = getJArray(json, "modifier");
11580      for (int i = 0; i < array.size(); i++) {
11581        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11582      }
11583    };
11584    if (json.has("provider"))
11585      res.setProvider(parseReference(getJObject(json, "provider")));
11586    if (json.has("quantity"))
11587      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
11588    if (json.has("unitPrice"))
11589      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
11590    if (json.has("facility"))
11591      res.setFacility(parseReference(getJObject(json, "facility")));
11592    if (json.has("diagnosis")) {
11593      JsonArray array = getJArray(json, "diagnosis");
11594      for (int i = 0; i < array.size(); i++) {
11595        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject()));
11596      }
11597    };
11598    if (json.has("detail")) {
11599      JsonArray array = getJArray(json, "detail");
11600      for (int i = 0; i < array.size(); i++) {
11601        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
11602      }
11603    };
11604  }
11605
11606  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
11607    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
11608    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, res);
11609    return res;
11610  }
11611
11612  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
11613    parseBackboneElementProperties(json, res);
11614    DataType diagnosis = parseType("diagnosis", json);
11615    if (diagnosis != null)
11616      res.setDiagnosis(diagnosis);
11617  }
11618
11619  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
11620    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
11621    parseCoverageEligibilityResponseProperties(json, res);
11622    return res;
11623  }
11624
11625  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
11626    parseDomainResourceProperties(json, res);
11627    if (json.has("identifier")) {
11628      JsonArray array = getJArray(json, "identifier");
11629      for (int i = 0; i < array.size(); i++) {
11630        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11631      }
11632    };
11633    if (json.has("status"))
11634      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
11635    if (json.has("_status"))
11636      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11637    if (json.has("purpose")) {
11638      JsonArray array = getJArray(json, "purpose");
11639      for (int i = 0; i < array.size(); i++) {
11640        if (array.get(i).isJsonNull()) {
11641          res.getPurpose().add(new Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose>(new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL));
11642        } else {;
11643          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
11644        }
11645      }
11646    };
11647    if (json.has("_purpose")) {
11648      JsonArray array = getJArray(json, "_purpose");
11649      for (int i = 0; i < array.size(); i++) {
11650        if (i == res.getPurpose().size())
11651          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
11652        if (array.get(i) instanceof JsonObject) 
11653          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
11654      }
11655    };
11656    if (json.has("patient"))
11657      res.setPatient(parseReference(getJObject(json, "patient")));
11658    if (json.has("event")) {
11659      JsonArray array = getJArray(json, "event");
11660      for (int i = 0; i < array.size(); i++) {
11661        res.getEvent().add(parseCoverageEligibilityResponseEventComponent(array.get(i).getAsJsonObject()));
11662      }
11663    };
11664    DataType serviced = parseType("serviced", json);
11665    if (serviced != null)
11666      res.setServiced(serviced);
11667    if (json.has("created"))
11668      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11669    if (json.has("_created"))
11670      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11671    if (json.has("requestor"))
11672      res.setRequestor(parseReference(getJObject(json, "requestor")));
11673    if (json.has("request"))
11674      res.setRequest(parseReference(getJObject(json, "request")));
11675    if (json.has("outcome"))
11676      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), CoverageEligibilityResponse.EligibilityOutcome.NULL, new CoverageEligibilityResponse.EligibilityOutcomeEnumFactory()));
11677    if (json.has("_outcome"))
11678      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
11679    if (json.has("disposition"))
11680      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11681    if (json.has("_disposition"))
11682      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
11683    if (json.has("insurer"))
11684      res.setInsurer(parseReference(getJObject(json, "insurer")));
11685    if (json.has("insurance")) {
11686      JsonArray array = getJArray(json, "insurance");
11687      for (int i = 0; i < array.size(); i++) {
11688        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject()));
11689      }
11690    };
11691    if (json.has("preAuthRef"))
11692      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
11693    if (json.has("_preAuthRef"))
11694      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
11695    if (json.has("form"))
11696      res.setForm(parseCodeableConcept(getJObject(json, "form")));
11697    if (json.has("error")) {
11698      JsonArray array = getJArray(json, "error");
11699      for (int i = 0; i < array.size(); i++) {
11700        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject()));
11701      }
11702    };
11703  }
11704
11705  protected CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent parseCoverageEligibilityResponseEventComponent(JsonObject json) throws IOException, FHIRFormatError {
11706    CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent res = new CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent();
11707    parseCoverageEligibilityResponseEventComponentProperties(json, res);
11708    return res;
11709  }
11710
11711  protected void parseCoverageEligibilityResponseEventComponentProperties(JsonObject json, CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent res) throws IOException, FHIRFormatError {
11712    parseBackboneElementProperties(json, res);
11713    if (json.has("type"))
11714      res.setType(parseCodeableConcept(getJObject(json, "type")));
11715    DataType when = parseType("when", json);
11716    if (when != null)
11717      res.setWhen(when);
11718  }
11719
11720  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
11721    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
11722    parseCoverageEligibilityResponseInsuranceComponentProperties(json, res);
11723    return res;
11724  }
11725
11726  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
11727    parseBackboneElementProperties(json, res);
11728    if (json.has("coverage"))
11729      res.setCoverage(parseReference(getJObject(json, "coverage")));
11730    if (json.has("inforce"))
11731      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
11732    if (json.has("_inforce"))
11733      parseElementProperties(getJObject(json, "_inforce"), res.getInforceElement());
11734    if (json.has("benefitPeriod"))
11735      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
11736    if (json.has("item")) {
11737      JsonArray array = getJArray(json, "item");
11738      for (int i = 0; i < array.size(); i++) {
11739        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject()));
11740      }
11741    };
11742  }
11743
11744  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json) throws IOException, FHIRFormatError {
11745    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
11746    parseCoverageEligibilityResponseItemsComponentProperties(json, res);
11747    return res;
11748  }
11749
11750  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
11751    parseBackboneElementProperties(json, res);
11752    if (json.has("category"))
11753      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
11754    if (json.has("productOrService"))
11755      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
11756    if (json.has("modifier")) {
11757      JsonArray array = getJArray(json, "modifier");
11758      for (int i = 0; i < array.size(); i++) {
11759        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11760      }
11761    };
11762    if (json.has("provider"))
11763      res.setProvider(parseReference(getJObject(json, "provider")));
11764    if (json.has("excluded"))
11765      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
11766    if (json.has("_excluded"))
11767      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
11768    if (json.has("name"))
11769      res.setNameElement(parseString(json.get("name").getAsString()));
11770    if (json.has("_name"))
11771      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11772    if (json.has("description"))
11773      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11774    if (json.has("_description"))
11775      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11776    if (json.has("network"))
11777      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
11778    if (json.has("unit"))
11779      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
11780    if (json.has("term"))
11781      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
11782    if (json.has("benefit")) {
11783      JsonArray array = getJArray(json, "benefit");
11784      for (int i = 0; i < array.size(); i++) {
11785        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject()));
11786      }
11787    };
11788    if (json.has("authorizationRequired"))
11789      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
11790    if (json.has("_authorizationRequired"))
11791      parseElementProperties(getJObject(json, "_authorizationRequired"), res.getAuthorizationRequiredElement());
11792    if (json.has("authorizationSupporting")) {
11793      JsonArray array = getJArray(json, "authorizationSupporting");
11794      for (int i = 0; i < array.size(); i++) {
11795        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11796      }
11797    };
11798    if (json.has("authorizationUrl"))
11799      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
11800    if (json.has("_authorizationUrl"))
11801      parseElementProperties(getJObject(json, "_authorizationUrl"), res.getAuthorizationUrlElement());
11802  }
11803
11804  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
11805    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
11806    parseCoverageEligibilityResponseBenefitComponentProperties(json, res);
11807    return res;
11808  }
11809
11810  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
11811    parseBackboneElementProperties(json, res);
11812    if (json.has("type"))
11813      res.setType(parseCodeableConcept(getJObject(json, "type")));
11814    DataType allowed = parseType("allowed", json);
11815    if (allowed != null)
11816      res.setAllowed(allowed);
11817    DataType used = parseType("used", json);
11818    if (used != null)
11819      res.setUsed(used);
11820  }
11821
11822  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json) throws IOException, FHIRFormatError {
11823    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
11824    parseCoverageEligibilityResponseErrorsComponentProperties(json, res);
11825    return res;
11826  }
11827
11828  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
11829    parseBackboneElementProperties(json, res);
11830    if (json.has("code"))
11831      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11832    if (json.has("expression")) {
11833      JsonArray array = getJArray(json, "expression");
11834      for (int i = 0; i < array.size(); i++) {
11835        if (array.get(i).isJsonNull()) {
11836          res.getExpression().add(new StringType());
11837        } else {;
11838          res.getExpression().add(parseString(array.get(i).getAsString()));
11839        }
11840      }
11841    };
11842    if (json.has("_expression")) {
11843      JsonArray array = getJArray(json, "_expression");
11844      for (int i = 0; i < array.size(); i++) {
11845        if (i == res.getExpression().size())
11846          res.getExpression().add(parseString(null));
11847        if (array.get(i) instanceof JsonObject) 
11848          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
11849      }
11850    };
11851  }
11852
11853  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
11854    DetectedIssue res = new DetectedIssue();
11855    parseDetectedIssueProperties(json, res);
11856    return res;
11857  }
11858
11859  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
11860    parseDomainResourceProperties(json, res);
11861    if (json.has("identifier")) {
11862      JsonArray array = getJArray(json, "identifier");
11863      for (int i = 0; i < array.size(); i++) {
11864        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11865      }
11866    };
11867    if (json.has("status"))
11868      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
11869    if (json.has("_status"))
11870      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11871    if (json.has("category")) {
11872      JsonArray array = getJArray(json, "category");
11873      for (int i = 0; i < array.size(); i++) {
11874        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11875      }
11876    };
11877    if (json.has("code"))
11878      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11879    if (json.has("severity"))
11880      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
11881    if (json.has("_severity"))
11882      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
11883    if (json.has("subject"))
11884      res.setSubject(parseReference(getJObject(json, "subject")));
11885    if (json.has("encounter"))
11886      res.setEncounter(parseReference(getJObject(json, "encounter")));
11887    DataType identified = parseType("identified", json);
11888    if (identified != null)
11889      res.setIdentified(identified);
11890    if (json.has("author"))
11891      res.setAuthor(parseReference(getJObject(json, "author")));
11892    if (json.has("implicated")) {
11893      JsonArray array = getJArray(json, "implicated");
11894      for (int i = 0; i < array.size(); i++) {
11895        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
11896      }
11897    };
11898    if (json.has("evidence")) {
11899      JsonArray array = getJArray(json, "evidence");
11900      for (int i = 0; i < array.size(); i++) {
11901        res.getEvidence().add(parseDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject()));
11902      }
11903    };
11904    if (json.has("detail"))
11905      res.setDetailElement(parseMarkdown(json.get("detail").getAsString()));
11906    if (json.has("_detail"))
11907      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
11908    if (json.has("reference"))
11909      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
11910    if (json.has("_reference"))
11911      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
11912    if (json.has("mitigation")) {
11913      JsonArray array = getJArray(json, "mitigation");
11914      for (int i = 0; i < array.size(); i++) {
11915        res.getMitigation().add(parseDetectedIssueMitigationComponent(array.get(i).getAsJsonObject()));
11916      }
11917    };
11918  }
11919
11920  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueEvidenceComponent(JsonObject json) throws IOException, FHIRFormatError {
11921    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
11922    parseDetectedIssueEvidenceComponentProperties(json, res);
11923    return res;
11924  }
11925
11926  protected void parseDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
11927    parseBackboneElementProperties(json, res);
11928    if (json.has("code")) {
11929      JsonArray array = getJArray(json, "code");
11930      for (int i = 0; i < array.size(); i++) {
11931        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11932      }
11933    };
11934    if (json.has("detail")) {
11935      JsonArray array = getJArray(json, "detail");
11936      for (int i = 0; i < array.size(); i++) {
11937        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
11938      }
11939    };
11940  }
11941
11942  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueMitigationComponent(JsonObject json) throws IOException, FHIRFormatError {
11943    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
11944    parseDetectedIssueMitigationComponentProperties(json, res);
11945    return res;
11946  }
11947
11948  protected void parseDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
11949    parseBackboneElementProperties(json, res);
11950    if (json.has("action"))
11951      res.setAction(parseCodeableConcept(getJObject(json, "action")));
11952    if (json.has("date"))
11953      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11954    if (json.has("_date"))
11955      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11956    if (json.has("author"))
11957      res.setAuthor(parseReference(getJObject(json, "author")));
11958    if (json.has("note")) {
11959      JsonArray array = getJArray(json, "note");
11960      for (int i = 0; i < array.size(); i++) {
11961        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11962      }
11963    };
11964  }
11965
11966  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
11967    Device res = new Device();
11968    parseDeviceProperties(json, res);
11969    return res;
11970  }
11971
11972  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
11973    parseDomainResourceProperties(json, res);
11974    if (json.has("identifier")) {
11975      JsonArray array = getJArray(json, "identifier");
11976      for (int i = 0; i < array.size(); i++) {
11977        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11978      }
11979    };
11980    if (json.has("displayName"))
11981      res.setDisplayNameElement(parseString(json.get("displayName").getAsString()));
11982    if (json.has("_displayName"))
11983      parseElementProperties(getJObject(json, "_displayName"), res.getDisplayNameElement());
11984    if (json.has("definition"))
11985      res.setDefinition(parseCodeableReference(getJObject(json, "definition")));
11986    if (json.has("udiCarrier")) {
11987      JsonArray array = getJArray(json, "udiCarrier");
11988      for (int i = 0; i < array.size(); i++) {
11989        res.getUdiCarrier().add(parseDeviceUdiCarrierComponent(array.get(i).getAsJsonObject()));
11990      }
11991    };
11992    if (json.has("status"))
11993      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
11994    if (json.has("_status"))
11995      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11996    if (json.has("availabilityStatus"))
11997      res.setAvailabilityStatus(parseCodeableConcept(getJObject(json, "availabilityStatus")));
11998    if (json.has("biologicalSourceEvent"))
11999      res.setBiologicalSourceEvent(parseIdentifier(getJObject(json, "biologicalSourceEvent")));
12000    if (json.has("manufacturer"))
12001      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
12002    if (json.has("_manufacturer"))
12003      parseElementProperties(getJObject(json, "_manufacturer"), res.getManufacturerElement());
12004    if (json.has("manufactureDate"))
12005      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
12006    if (json.has("_manufactureDate"))
12007      parseElementProperties(getJObject(json, "_manufactureDate"), res.getManufactureDateElement());
12008    if (json.has("expirationDate"))
12009      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
12010    if (json.has("_expirationDate"))
12011      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
12012    if (json.has("lotNumber"))
12013      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
12014    if (json.has("_lotNumber"))
12015      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
12016    if (json.has("serialNumber"))
12017      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
12018    if (json.has("_serialNumber"))
12019      parseElementProperties(getJObject(json, "_serialNumber"), res.getSerialNumberElement());
12020    if (json.has("name")) {
12021      JsonArray array = getJArray(json, "name");
12022      for (int i = 0; i < array.size(); i++) {
12023        res.getName().add(parseDeviceNameComponent(array.get(i).getAsJsonObject()));
12024      }
12025    };
12026    if (json.has("modelNumber"))
12027      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
12028    if (json.has("_modelNumber"))
12029      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
12030    if (json.has("partNumber"))
12031      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
12032    if (json.has("_partNumber"))
12033      parseElementProperties(getJObject(json, "_partNumber"), res.getPartNumberElement());
12034    if (json.has("category")) {
12035      JsonArray array = getJArray(json, "category");
12036      for (int i = 0; i < array.size(); i++) {
12037        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12038      }
12039    };
12040    if (json.has("type")) {
12041      JsonArray array = getJArray(json, "type");
12042      for (int i = 0; i < array.size(); i++) {
12043        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12044      }
12045    };
12046    if (json.has("version")) {
12047      JsonArray array = getJArray(json, "version");
12048      for (int i = 0; i < array.size(); i++) {
12049        res.getVersion().add(parseDeviceVersionComponent(array.get(i).getAsJsonObject()));
12050      }
12051    };
12052    if (json.has("conformsTo")) {
12053      JsonArray array = getJArray(json, "conformsTo");
12054      for (int i = 0; i < array.size(); i++) {
12055        res.getConformsTo().add(parseDeviceConformsToComponent(array.get(i).getAsJsonObject()));
12056      }
12057    };
12058    if (json.has("property")) {
12059      JsonArray array = getJArray(json, "property");
12060      for (int i = 0; i < array.size(); i++) {
12061        res.getProperty().add(parseDevicePropertyComponent(array.get(i).getAsJsonObject()));
12062      }
12063    };
12064    if (json.has("mode"))
12065      res.setMode(parseCodeableConcept(getJObject(json, "mode")));
12066    if (json.has("cycle"))
12067      res.setCycle(parseCount(getJObject(json, "cycle")));
12068    if (json.has("duration"))
12069      res.setDuration(parseDuration(getJObject(json, "duration")));
12070    if (json.has("owner"))
12071      res.setOwner(parseReference(getJObject(json, "owner")));
12072    if (json.has("contact")) {
12073      JsonArray array = getJArray(json, "contact");
12074      for (int i = 0; i < array.size(); i++) {
12075        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
12076      }
12077    };
12078    if (json.has("location"))
12079      res.setLocation(parseReference(getJObject(json, "location")));
12080    if (json.has("url"))
12081      res.setUrlElement(parseUri(json.get("url").getAsString()));
12082    if (json.has("_url"))
12083      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12084    if (json.has("endpoint")) {
12085      JsonArray array = getJArray(json, "endpoint");
12086      for (int i = 0; i < array.size(); i++) {
12087        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
12088      }
12089    };
12090    if (json.has("gateway")) {
12091      JsonArray array = getJArray(json, "gateway");
12092      for (int i = 0; i < array.size(); i++) {
12093        res.getGateway().add(parseCodeableReference(array.get(i).getAsJsonObject()));
12094      }
12095    };
12096    if (json.has("note")) {
12097      JsonArray array = getJArray(json, "note");
12098      for (int i = 0; i < array.size(); i++) {
12099        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12100      }
12101    };
12102    if (json.has("safety")) {
12103      JsonArray array = getJArray(json, "safety");
12104      for (int i = 0; i < array.size(); i++) {
12105        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12106      }
12107    };
12108    if (json.has("parent"))
12109      res.setParent(parseReference(getJObject(json, "parent")));
12110  }
12111
12112  protected Device.DeviceUdiCarrierComponent parseDeviceUdiCarrierComponent(JsonObject json) throws IOException, FHIRFormatError {
12113    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
12114    parseDeviceUdiCarrierComponentProperties(json, res);
12115    return res;
12116  }
12117
12118  protected void parseDeviceUdiCarrierComponentProperties(JsonObject json, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
12119    parseBackboneElementProperties(json, res);
12120    if (json.has("deviceIdentifier"))
12121      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
12122    if (json.has("_deviceIdentifier"))
12123      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
12124    if (json.has("issuer"))
12125      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
12126    if (json.has("_issuer"))
12127      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
12128    if (json.has("jurisdiction"))
12129      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
12130    if (json.has("_jurisdiction"))
12131      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
12132    if (json.has("carrierAIDC"))
12133      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
12134    if (json.has("_carrierAIDC"))
12135      parseElementProperties(getJObject(json, "_carrierAIDC"), res.getCarrierAIDCElement());
12136    if (json.has("carrierHRF"))
12137      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
12138    if (json.has("_carrierHRF"))
12139      parseElementProperties(getJObject(json, "_carrierHRF"), res.getCarrierHRFElement());
12140    if (json.has("entryType"))
12141      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
12142    if (json.has("_entryType"))
12143      parseElementProperties(getJObject(json, "_entryType"), res.getEntryTypeElement());
12144  }
12145
12146  protected Device.DeviceNameComponent parseDeviceNameComponent(JsonObject json) throws IOException, FHIRFormatError {
12147    Device.DeviceNameComponent res = new Device.DeviceNameComponent();
12148    parseDeviceNameComponentProperties(json, res);
12149    return res;
12150  }
12151
12152  protected void parseDeviceNameComponentProperties(JsonObject json, Device.DeviceNameComponent res) throws IOException, FHIRFormatError {
12153    parseBackboneElementProperties(json, res);
12154    if (json.has("value"))
12155      res.setValueElement(parseString(json.get("value").getAsString()));
12156    if (json.has("_value"))
12157      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
12158    if (json.has("type"))
12159      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
12160    if (json.has("_type"))
12161      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12162    if (json.has("display"))
12163      res.setDisplayElement(parseBoolean(json.get("display").getAsBoolean()));
12164    if (json.has("_display"))
12165      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
12166  }
12167
12168  protected Device.DeviceVersionComponent parseDeviceVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
12169    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
12170    parseDeviceVersionComponentProperties(json, res);
12171    return res;
12172  }
12173
12174  protected void parseDeviceVersionComponentProperties(JsonObject json, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
12175    parseBackboneElementProperties(json, res);
12176    if (json.has("type"))
12177      res.setType(parseCodeableConcept(getJObject(json, "type")));
12178    if (json.has("component"))
12179      res.setComponent(parseIdentifier(getJObject(json, "component")));
12180    if (json.has("installDate"))
12181      res.setInstallDateElement(parseDateTime(json.get("installDate").getAsString()));
12182    if (json.has("_installDate"))
12183      parseElementProperties(getJObject(json, "_installDate"), res.getInstallDateElement());
12184    if (json.has("value"))
12185      res.setValueElement(parseString(json.get("value").getAsString()));
12186    if (json.has("_value"))
12187      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
12188  }
12189
12190  protected Device.DeviceConformsToComponent parseDeviceConformsToComponent(JsonObject json) throws IOException, FHIRFormatError {
12191    Device.DeviceConformsToComponent res = new Device.DeviceConformsToComponent();
12192    parseDeviceConformsToComponentProperties(json, res);
12193    return res;
12194  }
12195
12196  protected void parseDeviceConformsToComponentProperties(JsonObject json, Device.DeviceConformsToComponent res) throws IOException, FHIRFormatError {
12197    parseBackboneElementProperties(json, res);
12198    if (json.has("category"))
12199      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12200    if (json.has("specification"))
12201      res.setSpecification(parseCodeableConcept(getJObject(json, "specification")));
12202    if (json.has("version"))
12203      res.setVersionElement(parseString(json.get("version").getAsString()));
12204    if (json.has("_version"))
12205      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12206  }
12207
12208  protected Device.DevicePropertyComponent parseDevicePropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
12209    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
12210    parseDevicePropertyComponentProperties(json, res);
12211    return res;
12212  }
12213
12214  protected void parseDevicePropertyComponentProperties(JsonObject json, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
12215    parseBackboneElementProperties(json, res);
12216    if (json.has("type"))
12217      res.setType(parseCodeableConcept(getJObject(json, "type")));
12218    DataType value = parseType("value", json);
12219    if (value != null)
12220      res.setValue(value);
12221  }
12222
12223  protected DeviceAssociation parseDeviceAssociation(JsonObject json) throws IOException, FHIRFormatError {
12224    DeviceAssociation res = new DeviceAssociation();
12225    parseDeviceAssociationProperties(json, res);
12226    return res;
12227  }
12228
12229  protected void parseDeviceAssociationProperties(JsonObject json, DeviceAssociation res) throws IOException, FHIRFormatError {
12230    parseDomainResourceProperties(json, res);
12231    if (json.has("identifier")) {
12232      JsonArray array = getJArray(json, "identifier");
12233      for (int i = 0; i < array.size(); i++) {
12234        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12235      }
12236    };
12237    if (json.has("device"))
12238      res.setDevice(parseReference(getJObject(json, "device")));
12239    if (json.has("category")) {
12240      JsonArray array = getJArray(json, "category");
12241      for (int i = 0; i < array.size(); i++) {
12242        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12243      }
12244    };
12245    if (json.has("status"))
12246      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
12247    if (json.has("statusReason")) {
12248      JsonArray array = getJArray(json, "statusReason");
12249      for (int i = 0; i < array.size(); i++) {
12250        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12251      }
12252    };
12253    if (json.has("subject"))
12254      res.setSubject(parseReference(getJObject(json, "subject")));
12255    if (json.has("bodyStructure"))
12256      res.setBodyStructure(parseReference(getJObject(json, "bodyStructure")));
12257    if (json.has("period"))
12258      res.setPeriod(parsePeriod(getJObject(json, "period")));
12259    if (json.has("operation")) {
12260      JsonArray array = getJArray(json, "operation");
12261      for (int i = 0; i < array.size(); i++) {
12262        res.getOperation().add(parseDeviceAssociationOperationComponent(array.get(i).getAsJsonObject()));
12263      }
12264    };
12265  }
12266
12267  protected DeviceAssociation.DeviceAssociationOperationComponent parseDeviceAssociationOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
12268    DeviceAssociation.DeviceAssociationOperationComponent res = new DeviceAssociation.DeviceAssociationOperationComponent();
12269    parseDeviceAssociationOperationComponentProperties(json, res);
12270    return res;
12271  }
12272
12273  protected void parseDeviceAssociationOperationComponentProperties(JsonObject json, DeviceAssociation.DeviceAssociationOperationComponent res) throws IOException, FHIRFormatError {
12274    parseBackboneElementProperties(json, res);
12275    if (json.has("status"))
12276      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
12277    if (json.has("operator")) {
12278      JsonArray array = getJArray(json, "operator");
12279      for (int i = 0; i < array.size(); i++) {
12280        res.getOperator().add(parseReference(array.get(i).getAsJsonObject()));
12281      }
12282    };
12283    if (json.has("period"))
12284      res.setPeriod(parsePeriod(getJObject(json, "period")));
12285  }
12286
12287  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
12288    DeviceDefinition res = new DeviceDefinition();
12289    parseDeviceDefinitionProperties(json, res);
12290    return res;
12291  }
12292
12293  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
12294    parseDomainResourceProperties(json, res);
12295    if (json.has("description"))
12296      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12297    if (json.has("_description"))
12298      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12299    if (json.has("identifier")) {
12300      JsonArray array = getJArray(json, "identifier");
12301      for (int i = 0; i < array.size(); i++) {
12302        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12303      }
12304    };
12305    if (json.has("udiDeviceIdentifier")) {
12306      JsonArray array = getJArray(json, "udiDeviceIdentifier");
12307      for (int i = 0; i < array.size(); i++) {
12308        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject()));
12309      }
12310    };
12311    if (json.has("regulatoryIdentifier")) {
12312      JsonArray array = getJArray(json, "regulatoryIdentifier");
12313      for (int i = 0; i < array.size(); i++) {
12314        res.getRegulatoryIdentifier().add(parseDeviceDefinitionRegulatoryIdentifierComponent(array.get(i).getAsJsonObject()));
12315      }
12316    };
12317    if (json.has("partNumber"))
12318      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
12319    if (json.has("_partNumber"))
12320      parseElementProperties(getJObject(json, "_partNumber"), res.getPartNumberElement());
12321    if (json.has("manufacturer"))
12322      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
12323    if (json.has("deviceName")) {
12324      JsonArray array = getJArray(json, "deviceName");
12325      for (int i = 0; i < array.size(); i++) {
12326        res.getDeviceName().add(parseDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject()));
12327      }
12328    };
12329    if (json.has("modelNumber"))
12330      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
12331    if (json.has("_modelNumber"))
12332      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
12333    if (json.has("classification")) {
12334      JsonArray array = getJArray(json, "classification");
12335      for (int i = 0; i < array.size(); i++) {
12336        res.getClassification().add(parseDeviceDefinitionClassificationComponent(array.get(i).getAsJsonObject()));
12337      }
12338    };
12339    if (json.has("conformsTo")) {
12340      JsonArray array = getJArray(json, "conformsTo");
12341      for (int i = 0; i < array.size(); i++) {
12342        res.getConformsTo().add(parseDeviceDefinitionConformsToComponent(array.get(i).getAsJsonObject()));
12343      }
12344    };
12345    if (json.has("hasPart")) {
12346      JsonArray array = getJArray(json, "hasPart");
12347      for (int i = 0; i < array.size(); i++) {
12348        res.getHasPart().add(parseDeviceDefinitionHasPartComponent(array.get(i).getAsJsonObject()));
12349      }
12350    };
12351    if (json.has("packaging")) {
12352      JsonArray array = getJArray(json, "packaging");
12353      for (int i = 0; i < array.size(); i++) {
12354        res.getPackaging().add(parseDeviceDefinitionPackagingComponent(array.get(i).getAsJsonObject()));
12355      }
12356    };
12357    if (json.has("version")) {
12358      JsonArray array = getJArray(json, "version");
12359      for (int i = 0; i < array.size(); i++) {
12360        res.getVersion().add(parseDeviceDefinitionVersionComponent(array.get(i).getAsJsonObject()));
12361      }
12362    };
12363    if (json.has("safety")) {
12364      JsonArray array = getJArray(json, "safety");
12365      for (int i = 0; i < array.size(); i++) {
12366        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12367      }
12368    };
12369    if (json.has("shelfLifeStorage")) {
12370      JsonArray array = getJArray(json, "shelfLifeStorage");
12371      for (int i = 0; i < array.size(); i++) {
12372        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
12373      }
12374    };
12375    if (json.has("languageCode")) {
12376      JsonArray array = getJArray(json, "languageCode");
12377      for (int i = 0; i < array.size(); i++) {
12378        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12379      }
12380    };
12381    if (json.has("property")) {
12382      JsonArray array = getJArray(json, "property");
12383      for (int i = 0; i < array.size(); i++) {
12384        res.getProperty().add(parseDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
12385      }
12386    };
12387    if (json.has("owner"))
12388      res.setOwner(parseReference(getJObject(json, "owner")));
12389    if (json.has("contact")) {
12390      JsonArray array = getJArray(json, "contact");
12391      for (int i = 0; i < array.size(); i++) {
12392        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
12393      }
12394    };
12395    if (json.has("link")) {
12396      JsonArray array = getJArray(json, "link");
12397      for (int i = 0; i < array.size(); i++) {
12398        res.getLink().add(parseDeviceDefinitionLinkComponent(array.get(i).getAsJsonObject()));
12399      }
12400    };
12401    if (json.has("note")) {
12402      JsonArray array = getJArray(json, "note");
12403      for (int i = 0; i < array.size(); i++) {
12404        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12405      }
12406    };
12407    if (json.has("material")) {
12408      JsonArray array = getJArray(json, "material");
12409      for (int i = 0; i < array.size(); i++) {
12410        res.getMaterial().add(parseDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject()));
12411      }
12412    };
12413    if (json.has("productionIdentifierInUDI")) {
12414      JsonArray array = getJArray(json, "productionIdentifierInUDI");
12415      for (int i = 0; i < array.size(); i++) {
12416        if (array.get(i).isJsonNull()) {
12417          res.getProductionIdentifierInUDI().add(new Enumeration<DeviceDefinition.DeviceProductionIdentifierInUDI>(new DeviceDefinition.DeviceProductionIdentifierInUDIEnumFactory(), DeviceDefinition.DeviceProductionIdentifierInUDI.NULL));
12418        } else {;
12419          res.getProductionIdentifierInUDI().add(parseEnumeration(array.get(i).getAsString(), DeviceDefinition.DeviceProductionIdentifierInUDI.NULL, new DeviceDefinition.DeviceProductionIdentifierInUDIEnumFactory()));
12420        }
12421      }
12422    };
12423    if (json.has("_productionIdentifierInUDI")) {
12424      JsonArray array = getJArray(json, "_productionIdentifierInUDI");
12425      for (int i = 0; i < array.size(); i++) {
12426        if (i == res.getProductionIdentifierInUDI().size())
12427          res.getProductionIdentifierInUDI().add(parseEnumeration(null, DeviceDefinition.DeviceProductionIdentifierInUDI.NULL, new DeviceDefinition.DeviceProductionIdentifierInUDIEnumFactory()));
12428        if (array.get(i) instanceof JsonObject) 
12429          parseElementProperties(array.get(i).getAsJsonObject(), res.getProductionIdentifierInUDI().get(i));
12430      }
12431    };
12432    if (json.has("guideline"))
12433      res.setGuideline(parseDeviceDefinitionGuidelineComponent(getJObject(json, "guideline")));
12434    if (json.has("correctiveAction"))
12435      res.setCorrectiveAction(parseDeviceDefinitionCorrectiveActionComponent(getJObject(json, "correctiveAction")));
12436    if (json.has("chargeItem")) {
12437      JsonArray array = getJArray(json, "chargeItem");
12438      for (int i = 0; i < array.size(); i++) {
12439        res.getChargeItem().add(parseDeviceDefinitionChargeItemComponent(array.get(i).getAsJsonObject()));
12440      }
12441    };
12442  }
12443
12444  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json) throws IOException, FHIRFormatError {
12445    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
12446    parseDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, res);
12447    return res;
12448  }
12449
12450  protected void parseDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
12451    parseBackboneElementProperties(json, res);
12452    if (json.has("deviceIdentifier"))
12453      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
12454    if (json.has("_deviceIdentifier"))
12455      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
12456    if (json.has("issuer"))
12457      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
12458    if (json.has("_issuer"))
12459      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
12460    if (json.has("jurisdiction"))
12461      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
12462    if (json.has("_jurisdiction"))
12463      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
12464    if (json.has("marketDistribution")) {
12465      JsonArray array = getJArray(json, "marketDistribution");
12466      for (int i = 0; i < array.size(); i++) {
12467        res.getMarketDistribution().add(parseDeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent(array.get(i).getAsJsonObject()));
12468      }
12469    };
12470  }
12471
12472  protected DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent parseDeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent(JsonObject json) throws IOException, FHIRFormatError {
12473    DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent res = new DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent();
12474    parseDeviceDefinitionUdiDeviceIdentifierMarketDistributionComponentProperties(json, res);
12475    return res;
12476  }
12477
12478  protected void parseDeviceDefinitionUdiDeviceIdentifierMarketDistributionComponentProperties(JsonObject json, DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent res) throws IOException, FHIRFormatError {
12479    parseBackboneElementProperties(json, res);
12480    if (json.has("marketPeriod"))
12481      res.setMarketPeriod(parsePeriod(getJObject(json, "marketPeriod")));
12482    if (json.has("subJurisdiction"))
12483      res.setSubJurisdictionElement(parseUri(json.get("subJurisdiction").getAsString()));
12484    if (json.has("_subJurisdiction"))
12485      parseElementProperties(getJObject(json, "_subJurisdiction"), res.getSubJurisdictionElement());
12486  }
12487
12488  protected DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent parseDeviceDefinitionRegulatoryIdentifierComponent(JsonObject json) throws IOException, FHIRFormatError {
12489    DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent res = new DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent();
12490    parseDeviceDefinitionRegulatoryIdentifierComponentProperties(json, res);
12491    return res;
12492  }
12493
12494  protected void parseDeviceDefinitionRegulatoryIdentifierComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent res) throws IOException, FHIRFormatError {
12495    parseBackboneElementProperties(json, res);
12496    if (json.has("type"))
12497      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceDefinitionRegulatoryIdentifierType.NULL, new DeviceDefinition.DeviceDefinitionRegulatoryIdentifierTypeEnumFactory()));
12498    if (json.has("_type"))
12499      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12500    if (json.has("deviceIdentifier"))
12501      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
12502    if (json.has("_deviceIdentifier"))
12503      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
12504    if (json.has("issuer"))
12505      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
12506    if (json.has("_issuer"))
12507      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
12508    if (json.has("jurisdiction"))
12509      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
12510    if (json.has("_jurisdiction"))
12511      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
12512  }
12513
12514  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceNameComponent(JsonObject json) throws IOException, FHIRFormatError {
12515    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
12516    parseDeviceDefinitionDeviceNameComponentProperties(json, res);
12517    return res;
12518  }
12519
12520  protected void parseDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
12521    parseBackboneElementProperties(json, res);
12522    if (json.has("name"))
12523      res.setNameElement(parseString(json.get("name").getAsString()));
12524    if (json.has("_name"))
12525      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12526    if (json.has("type"))
12527      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
12528    if (json.has("_type"))
12529      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12530  }
12531
12532  protected DeviceDefinition.DeviceDefinitionClassificationComponent parseDeviceDefinitionClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
12533    DeviceDefinition.DeviceDefinitionClassificationComponent res = new DeviceDefinition.DeviceDefinitionClassificationComponent();
12534    parseDeviceDefinitionClassificationComponentProperties(json, res);
12535    return res;
12536  }
12537
12538  protected void parseDeviceDefinitionClassificationComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionClassificationComponent res) throws IOException, FHIRFormatError {
12539    parseBackboneElementProperties(json, res);
12540    if (json.has("type"))
12541      res.setType(parseCodeableConcept(getJObject(json, "type")));
12542    if (json.has("justification")) {
12543      JsonArray array = getJArray(json, "justification");
12544      for (int i = 0; i < array.size(); i++) {
12545        res.getJustification().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12546      }
12547    };
12548  }
12549
12550  protected DeviceDefinition.DeviceDefinitionConformsToComponent parseDeviceDefinitionConformsToComponent(JsonObject json) throws IOException, FHIRFormatError {
12551    DeviceDefinition.DeviceDefinitionConformsToComponent res = new DeviceDefinition.DeviceDefinitionConformsToComponent();
12552    parseDeviceDefinitionConformsToComponentProperties(json, res);
12553    return res;
12554  }
12555
12556  protected void parseDeviceDefinitionConformsToComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionConformsToComponent res) throws IOException, FHIRFormatError {
12557    parseBackboneElementProperties(json, res);
12558    if (json.has("category"))
12559      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12560    if (json.has("specification"))
12561      res.setSpecification(parseCodeableConcept(getJObject(json, "specification")));
12562    if (json.has("version")) {
12563      JsonArray array = getJArray(json, "version");
12564      for (int i = 0; i < array.size(); i++) {
12565        if (array.get(i).isJsonNull()) {
12566          res.getVersion().add(new StringType());
12567        } else {;
12568          res.getVersion().add(parseString(array.get(i).getAsString()));
12569        }
12570      }
12571    };
12572    if (json.has("_version")) {
12573      JsonArray array = getJArray(json, "_version");
12574      for (int i = 0; i < array.size(); i++) {
12575        if (i == res.getVersion().size())
12576          res.getVersion().add(parseString(null));
12577        if (array.get(i) instanceof JsonObject) 
12578          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
12579      }
12580    };
12581    if (json.has("source")) {
12582      JsonArray array = getJArray(json, "source");
12583      for (int i = 0; i < array.size(); i++) {
12584        res.getSource().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12585      }
12586    };
12587  }
12588
12589  protected DeviceDefinition.DeviceDefinitionHasPartComponent parseDeviceDefinitionHasPartComponent(JsonObject json) throws IOException, FHIRFormatError {
12590    DeviceDefinition.DeviceDefinitionHasPartComponent res = new DeviceDefinition.DeviceDefinitionHasPartComponent();
12591    parseDeviceDefinitionHasPartComponentProperties(json, res);
12592    return res;
12593  }
12594
12595  protected void parseDeviceDefinitionHasPartComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionHasPartComponent res) throws IOException, FHIRFormatError {
12596    parseBackboneElementProperties(json, res);
12597    if (json.has("reference"))
12598      res.setReference(parseReference(getJObject(json, "reference")));
12599    if (json.has("count"))
12600      res.setCountElement(parseInteger(json.get("count").getAsLong()));
12601    if (json.has("_count"))
12602      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
12603  }
12604
12605  protected DeviceDefinition.DeviceDefinitionPackagingComponent parseDeviceDefinitionPackagingComponent(JsonObject json) throws IOException, FHIRFormatError {
12606    DeviceDefinition.DeviceDefinitionPackagingComponent res = new DeviceDefinition.DeviceDefinitionPackagingComponent();
12607    parseDeviceDefinitionPackagingComponentProperties(json, res);
12608    return res;
12609  }
12610
12611  protected void parseDeviceDefinitionPackagingComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionPackagingComponent res) throws IOException, FHIRFormatError {
12612    parseBackboneElementProperties(json, res);
12613    if (json.has("identifier"))
12614      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
12615    if (json.has("type"))
12616      res.setType(parseCodeableConcept(getJObject(json, "type")));
12617    if (json.has("count"))
12618      res.setCountElement(parseInteger(json.get("count").getAsLong()));
12619    if (json.has("_count"))
12620      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
12621    if (json.has("distributor")) {
12622      JsonArray array = getJArray(json, "distributor");
12623      for (int i = 0; i < array.size(); i++) {
12624        res.getDistributor().add(parseDeviceDefinitionPackagingDistributorComponent(array.get(i).getAsJsonObject()));
12625      }
12626    };
12627    if (json.has("udiDeviceIdentifier")) {
12628      JsonArray array = getJArray(json, "udiDeviceIdentifier");
12629      for (int i = 0; i < array.size(); i++) {
12630        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject()));
12631      }
12632    };
12633    if (json.has("packaging")) {
12634      JsonArray array = getJArray(json, "packaging");
12635      for (int i = 0; i < array.size(); i++) {
12636        res.getPackaging().add(parseDeviceDefinitionPackagingComponent(array.get(i).getAsJsonObject()));
12637      }
12638    };
12639  }
12640
12641  protected DeviceDefinition.PackagingDistributorComponent parseDeviceDefinitionPackagingDistributorComponent(JsonObject json) throws IOException, FHIRFormatError {
12642    DeviceDefinition.PackagingDistributorComponent res = new DeviceDefinition.PackagingDistributorComponent();
12643    parseDeviceDefinitionPackagingDistributorComponentProperties(json, res);
12644    return res;
12645  }
12646
12647  protected void parseDeviceDefinitionPackagingDistributorComponentProperties(JsonObject json, DeviceDefinition.PackagingDistributorComponent res) throws IOException, FHIRFormatError {
12648    parseBackboneElementProperties(json, res);
12649    if (json.has("name"))
12650      res.setNameElement(parseString(json.get("name").getAsString()));
12651    if (json.has("_name"))
12652      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12653    if (json.has("organizationReference")) {
12654      JsonArray array = getJArray(json, "organizationReference");
12655      for (int i = 0; i < array.size(); i++) {
12656        res.getOrganizationReference().add(parseReference(array.get(i).getAsJsonObject()));
12657      }
12658    };
12659  }
12660
12661  protected DeviceDefinition.DeviceDefinitionVersionComponent parseDeviceDefinitionVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
12662    DeviceDefinition.DeviceDefinitionVersionComponent res = new DeviceDefinition.DeviceDefinitionVersionComponent();
12663    parseDeviceDefinitionVersionComponentProperties(json, res);
12664    return res;
12665  }
12666
12667  protected void parseDeviceDefinitionVersionComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionVersionComponent res) throws IOException, FHIRFormatError {
12668    parseBackboneElementProperties(json, res);
12669    if (json.has("type"))
12670      res.setType(parseCodeableConcept(getJObject(json, "type")));
12671    if (json.has("component"))
12672      res.setComponent(parseIdentifier(getJObject(json, "component")));
12673    if (json.has("value"))
12674      res.setValueElement(parseString(json.get("value").getAsString()));
12675    if (json.has("_value"))
12676      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
12677  }
12678
12679  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
12680    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
12681    parseDeviceDefinitionPropertyComponentProperties(json, res);
12682    return res;
12683  }
12684
12685  protected void parseDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
12686    parseBackboneElementProperties(json, res);
12687    if (json.has("type"))
12688      res.setType(parseCodeableConcept(getJObject(json, "type")));
12689    DataType value = parseType("value", json);
12690    if (value != null)
12691      res.setValue(value);
12692  }
12693
12694  protected DeviceDefinition.DeviceDefinitionLinkComponent parseDeviceDefinitionLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
12695    DeviceDefinition.DeviceDefinitionLinkComponent res = new DeviceDefinition.DeviceDefinitionLinkComponent();
12696    parseDeviceDefinitionLinkComponentProperties(json, res);
12697    return res;
12698  }
12699
12700  protected void parseDeviceDefinitionLinkComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionLinkComponent res) throws IOException, FHIRFormatError {
12701    parseBackboneElementProperties(json, res);
12702    if (json.has("relation"))
12703      res.setRelation(parseCoding(getJObject(json, "relation")));
12704    if (json.has("relatedDevice"))
12705      res.setRelatedDevice(parseCodeableReference(getJObject(json, "relatedDevice")));
12706  }
12707
12708  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionMaterialComponent(JsonObject json) throws IOException, FHIRFormatError {
12709    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
12710    parseDeviceDefinitionMaterialComponentProperties(json, res);
12711    return res;
12712  }
12713
12714  protected void parseDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
12715    parseBackboneElementProperties(json, res);
12716    if (json.has("substance"))
12717      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
12718    if (json.has("alternate"))
12719      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
12720    if (json.has("_alternate"))
12721      parseElementProperties(getJObject(json, "_alternate"), res.getAlternateElement());
12722    if (json.has("allergenicIndicator"))
12723      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
12724    if (json.has("_allergenicIndicator"))
12725      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
12726  }
12727
12728  protected DeviceDefinition.DeviceDefinitionGuidelineComponent parseDeviceDefinitionGuidelineComponent(JsonObject json) throws IOException, FHIRFormatError {
12729    DeviceDefinition.DeviceDefinitionGuidelineComponent res = new DeviceDefinition.DeviceDefinitionGuidelineComponent();
12730    parseDeviceDefinitionGuidelineComponentProperties(json, res);
12731    return res;
12732  }
12733
12734  protected void parseDeviceDefinitionGuidelineComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionGuidelineComponent res) throws IOException, FHIRFormatError {
12735    parseBackboneElementProperties(json, res);
12736    if (json.has("useContext")) {
12737      JsonArray array = getJArray(json, "useContext");
12738      for (int i = 0; i < array.size(); i++) {
12739        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12740      }
12741    };
12742    if (json.has("usageInstruction"))
12743      res.setUsageInstructionElement(parseMarkdown(json.get("usageInstruction").getAsString()));
12744    if (json.has("_usageInstruction"))
12745      parseElementProperties(getJObject(json, "_usageInstruction"), res.getUsageInstructionElement());
12746    if (json.has("relatedArtifact")) {
12747      JsonArray array = getJArray(json, "relatedArtifact");
12748      for (int i = 0; i < array.size(); i++) {
12749        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12750      }
12751    };
12752    if (json.has("indication")) {
12753      JsonArray array = getJArray(json, "indication");
12754      for (int i = 0; i < array.size(); i++) {
12755        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12756      }
12757    };
12758    if (json.has("contraindication")) {
12759      JsonArray array = getJArray(json, "contraindication");
12760      for (int i = 0; i < array.size(); i++) {
12761        res.getContraindication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12762      }
12763    };
12764    if (json.has("warning")) {
12765      JsonArray array = getJArray(json, "warning");
12766      for (int i = 0; i < array.size(); i++) {
12767        res.getWarning().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12768      }
12769    };
12770    if (json.has("intendedUse"))
12771      res.setIntendedUseElement(parseString(json.get("intendedUse").getAsString()));
12772    if (json.has("_intendedUse"))
12773      parseElementProperties(getJObject(json, "_intendedUse"), res.getIntendedUseElement());
12774  }
12775
12776  protected DeviceDefinition.DeviceDefinitionCorrectiveActionComponent parseDeviceDefinitionCorrectiveActionComponent(JsonObject json) throws IOException, FHIRFormatError {
12777    DeviceDefinition.DeviceDefinitionCorrectiveActionComponent res = new DeviceDefinition.DeviceDefinitionCorrectiveActionComponent();
12778    parseDeviceDefinitionCorrectiveActionComponentProperties(json, res);
12779    return res;
12780  }
12781
12782  protected void parseDeviceDefinitionCorrectiveActionComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionCorrectiveActionComponent res) throws IOException, FHIRFormatError {
12783    parseBackboneElementProperties(json, res);
12784    if (json.has("recall"))
12785      res.setRecallElement(parseBoolean(json.get("recall").getAsBoolean()));
12786    if (json.has("_recall"))
12787      parseElementProperties(getJObject(json, "_recall"), res.getRecallElement());
12788    if (json.has("scope"))
12789      res.setScopeElement(parseEnumeration(json.get("scope").getAsString(), DeviceDefinition.DeviceCorrectiveActionScope.NULL, new DeviceDefinition.DeviceCorrectiveActionScopeEnumFactory()));
12790    if (json.has("_scope"))
12791      parseElementProperties(getJObject(json, "_scope"), res.getScopeElement());
12792    if (json.has("period"))
12793      res.setPeriod(parsePeriod(getJObject(json, "period")));
12794  }
12795
12796  protected DeviceDefinition.DeviceDefinitionChargeItemComponent parseDeviceDefinitionChargeItemComponent(JsonObject json) throws IOException, FHIRFormatError {
12797    DeviceDefinition.DeviceDefinitionChargeItemComponent res = new DeviceDefinition.DeviceDefinitionChargeItemComponent();
12798    parseDeviceDefinitionChargeItemComponentProperties(json, res);
12799    return res;
12800  }
12801
12802  protected void parseDeviceDefinitionChargeItemComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionChargeItemComponent res) throws IOException, FHIRFormatError {
12803    parseBackboneElementProperties(json, res);
12804    if (json.has("chargeItemCode"))
12805      res.setChargeItemCode(parseCodeableReference(getJObject(json, "chargeItemCode")));
12806    if (json.has("count"))
12807      res.setCount(parseQuantity(getJObject(json, "count")));
12808    if (json.has("effectivePeriod"))
12809      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
12810    if (json.has("useContext")) {
12811      JsonArray array = getJArray(json, "useContext");
12812      for (int i = 0; i < array.size(); i++) {
12813        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12814      }
12815    };
12816  }
12817
12818  protected DeviceDispense parseDeviceDispense(JsonObject json) throws IOException, FHIRFormatError {
12819    DeviceDispense res = new DeviceDispense();
12820    parseDeviceDispenseProperties(json, res);
12821    return res;
12822  }
12823
12824  protected void parseDeviceDispenseProperties(JsonObject json, DeviceDispense res) throws IOException, FHIRFormatError {
12825    parseDomainResourceProperties(json, res);
12826    if (json.has("identifier")) {
12827      JsonArray array = getJArray(json, "identifier");
12828      for (int i = 0; i < array.size(); i++) {
12829        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12830      }
12831    };
12832    if (json.has("basedOn")) {
12833      JsonArray array = getJArray(json, "basedOn");
12834      for (int i = 0; i < array.size(); i++) {
12835        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12836      }
12837    };
12838    if (json.has("partOf")) {
12839      JsonArray array = getJArray(json, "partOf");
12840      for (int i = 0; i < array.size(); i++) {
12841        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12842      }
12843    };
12844    if (json.has("status"))
12845      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceDispense.DeviceDispenseStatusCodes.NULL, new DeviceDispense.DeviceDispenseStatusCodesEnumFactory()));
12846    if (json.has("_status"))
12847      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12848    if (json.has("statusReason"))
12849      res.setStatusReason(parseCodeableReference(getJObject(json, "statusReason")));
12850    if (json.has("category")) {
12851      JsonArray array = getJArray(json, "category");
12852      for (int i = 0; i < array.size(); i++) {
12853        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12854      }
12855    };
12856    if (json.has("device"))
12857      res.setDevice(parseCodeableReference(getJObject(json, "device")));
12858    if (json.has("subject"))
12859      res.setSubject(parseReference(getJObject(json, "subject")));
12860    if (json.has("receiver"))
12861      res.setReceiver(parseReference(getJObject(json, "receiver")));
12862    if (json.has("encounter"))
12863      res.setEncounter(parseReference(getJObject(json, "encounter")));
12864    if (json.has("supportingInformation")) {
12865      JsonArray array = getJArray(json, "supportingInformation");
12866      for (int i = 0; i < array.size(); i++) {
12867        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12868      }
12869    };
12870    if (json.has("performer")) {
12871      JsonArray array = getJArray(json, "performer");
12872      for (int i = 0; i < array.size(); i++) {
12873        res.getPerformer().add(parseDeviceDispensePerformerComponent(array.get(i).getAsJsonObject()));
12874      }
12875    };
12876    if (json.has("location"))
12877      res.setLocation(parseReference(getJObject(json, "location")));
12878    if (json.has("type"))
12879      res.setType(parseCodeableConcept(getJObject(json, "type")));
12880    if (json.has("quantity"))
12881      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12882    if (json.has("preparedDate"))
12883      res.setPreparedDateElement(parseDateTime(json.get("preparedDate").getAsString()));
12884    if (json.has("_preparedDate"))
12885      parseElementProperties(getJObject(json, "_preparedDate"), res.getPreparedDateElement());
12886    if (json.has("whenHandedOver"))
12887      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
12888    if (json.has("_whenHandedOver"))
12889      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
12890    if (json.has("destination"))
12891      res.setDestination(parseReference(getJObject(json, "destination")));
12892    if (json.has("note")) {
12893      JsonArray array = getJArray(json, "note");
12894      for (int i = 0; i < array.size(); i++) {
12895        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12896      }
12897    };
12898    if (json.has("usageInstruction"))
12899      res.setUsageInstructionElement(parseMarkdown(json.get("usageInstruction").getAsString()));
12900    if (json.has("_usageInstruction"))
12901      parseElementProperties(getJObject(json, "_usageInstruction"), res.getUsageInstructionElement());
12902    if (json.has("eventHistory")) {
12903      JsonArray array = getJArray(json, "eventHistory");
12904      for (int i = 0; i < array.size(); i++) {
12905        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12906      }
12907    };
12908  }
12909
12910  protected DeviceDispense.DeviceDispensePerformerComponent parseDeviceDispensePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
12911    DeviceDispense.DeviceDispensePerformerComponent res = new DeviceDispense.DeviceDispensePerformerComponent();
12912    parseDeviceDispensePerformerComponentProperties(json, res);
12913    return res;
12914  }
12915
12916  protected void parseDeviceDispensePerformerComponentProperties(JsonObject json, DeviceDispense.DeviceDispensePerformerComponent res) throws IOException, FHIRFormatError {
12917    parseBackboneElementProperties(json, res);
12918    if (json.has("function"))
12919      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
12920    if (json.has("actor"))
12921      res.setActor(parseReference(getJObject(json, "actor")));
12922  }
12923
12924  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
12925    DeviceMetric res = new DeviceMetric();
12926    parseDeviceMetricProperties(json, res);
12927    return res;
12928  }
12929
12930  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
12931    parseDomainResourceProperties(json, res);
12932    if (json.has("identifier")) {
12933      JsonArray array = getJArray(json, "identifier");
12934      for (int i = 0; i < array.size(); i++) {
12935        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12936      }
12937    };
12938    if (json.has("type"))
12939      res.setType(parseCodeableConcept(getJObject(json, "type")));
12940    if (json.has("unit"))
12941      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
12942    if (json.has("device"))
12943      res.setDevice(parseReference(getJObject(json, "device")));
12944    if (json.has("operationalStatus"))
12945      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
12946    if (json.has("_operationalStatus"))
12947      parseElementProperties(getJObject(json, "_operationalStatus"), res.getOperationalStatusElement());
12948    if (json.has("color"))
12949      res.setColorElement(parseCode(json.get("color").getAsString()));
12950    if (json.has("_color"))
12951      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
12952    if (json.has("category"))
12953      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
12954    if (json.has("_category"))
12955      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
12956    if (json.has("measurementFrequency"))
12957      res.setMeasurementFrequency(parseQuantity(getJObject(json, "measurementFrequency")));
12958    if (json.has("calibration")) {
12959      JsonArray array = getJArray(json, "calibration");
12960      for (int i = 0; i < array.size(); i++) {
12961        res.getCalibration().add(parseDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject()));
12962      }
12963    };
12964  }
12965
12966  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricCalibrationComponent(JsonObject json) throws IOException, FHIRFormatError {
12967    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
12968    parseDeviceMetricCalibrationComponentProperties(json, res);
12969    return res;
12970  }
12971
12972  protected void parseDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
12973    parseBackboneElementProperties(json, res);
12974    if (json.has("type"))
12975      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
12976    if (json.has("_type"))
12977      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12978    if (json.has("state"))
12979      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
12980    if (json.has("_state"))
12981      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
12982    if (json.has("time"))
12983      res.setTimeElement(parseInstant(json.get("time").getAsString()));
12984    if (json.has("_time"))
12985      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
12986  }
12987
12988  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
12989    DeviceRequest res = new DeviceRequest();
12990    parseDeviceRequestProperties(json, res);
12991    return res;
12992  }
12993
12994  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
12995    parseDomainResourceProperties(json, res);
12996    if (json.has("identifier")) {
12997      JsonArray array = getJArray(json, "identifier");
12998      for (int i = 0; i < array.size(); i++) {
12999        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13000      }
13001    };
13002    if (json.has("instantiatesCanonical")) {
13003      JsonArray array = getJArray(json, "instantiatesCanonical");
13004      for (int i = 0; i < array.size(); i++) {
13005        if (array.get(i).isJsonNull()) {
13006          res.getInstantiatesCanonical().add(new CanonicalType());
13007        } else {;
13008          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
13009        }
13010      }
13011    };
13012    if (json.has("_instantiatesCanonical")) {
13013      JsonArray array = getJArray(json, "_instantiatesCanonical");
13014      for (int i = 0; i < array.size(); i++) {
13015        if (i == res.getInstantiatesCanonical().size())
13016          res.getInstantiatesCanonical().add(parseCanonical(null));
13017        if (array.get(i) instanceof JsonObject) 
13018          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
13019      }
13020    };
13021    if (json.has("instantiatesUri")) {
13022      JsonArray array = getJArray(json, "instantiatesUri");
13023      for (int i = 0; i < array.size(); i++) {
13024        if (array.get(i).isJsonNull()) {
13025          res.getInstantiatesUri().add(new UriType());
13026        } else {;
13027          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
13028        }
13029      }
13030    };
13031    if (json.has("_instantiatesUri")) {
13032      JsonArray array = getJArray(json, "_instantiatesUri");
13033      for (int i = 0; i < array.size(); i++) {
13034        if (i == res.getInstantiatesUri().size())
13035          res.getInstantiatesUri().add(parseUri(null));
13036        if (array.get(i) instanceof JsonObject) 
13037          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
13038      }
13039    };
13040    if (json.has("basedOn")) {
13041      JsonArray array = getJArray(json, "basedOn");
13042      for (int i = 0; i < array.size(); i++) {
13043        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13044      }
13045    };
13046    if (json.has("replaces")) {
13047      JsonArray array = getJArray(json, "replaces");
13048      for (int i = 0; i < array.size(); i++) {
13049        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
13050      }
13051    };
13052    if (json.has("groupIdentifier"))
13053      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
13054    if (json.has("status"))
13055      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
13056    if (json.has("_status"))
13057      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13058    if (json.has("intent"))
13059      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
13060    if (json.has("_intent"))
13061      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
13062    if (json.has("priority"))
13063      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
13064    if (json.has("_priority"))
13065      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
13066    if (json.has("doNotPerform"))
13067      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
13068    if (json.has("_doNotPerform"))
13069      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
13070    if (json.has("code"))
13071      res.setCode(parseCodeableReference(getJObject(json, "code")));
13072    if (json.has("quantity"))
13073      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
13074    if (json.has("_quantity"))
13075      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
13076    if (json.has("parameter")) {
13077      JsonArray array = getJArray(json, "parameter");
13078      for (int i = 0; i < array.size(); i++) {
13079        res.getParameter().add(parseDeviceRequestParameterComponent(array.get(i).getAsJsonObject()));
13080      }
13081    };
13082    if (json.has("subject"))
13083      res.setSubject(parseReference(getJObject(json, "subject")));
13084    if (json.has("encounter"))
13085      res.setEncounter(parseReference(getJObject(json, "encounter")));
13086    DataType occurrence = parseType("occurrence", json);
13087    if (occurrence != null)
13088      res.setOccurrence(occurrence);
13089    if (json.has("authoredOn"))
13090      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
13091    if (json.has("_authoredOn"))
13092      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
13093    if (json.has("requester"))
13094      res.setRequester(parseReference(getJObject(json, "requester")));
13095    if (json.has("performer"))
13096      res.setPerformer(parseCodeableReference(getJObject(json, "performer")));
13097    if (json.has("reason")) {
13098      JsonArray array = getJArray(json, "reason");
13099      for (int i = 0; i < array.size(); i++) {
13100        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13101      }
13102    };
13103    if (json.has("asNeeded"))
13104      res.setAsNeededElement(parseBoolean(json.get("asNeeded").getAsBoolean()));
13105    if (json.has("_asNeeded"))
13106      parseElementProperties(getJObject(json, "_asNeeded"), res.getAsNeededElement());
13107    if (json.has("asNeededFor"))
13108      res.setAsNeededFor(parseCodeableConcept(getJObject(json, "asNeededFor")));
13109    if (json.has("insurance")) {
13110      JsonArray array = getJArray(json, "insurance");
13111      for (int i = 0; i < array.size(); i++) {
13112        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
13113      }
13114    };
13115    if (json.has("supportingInfo")) {
13116      JsonArray array = getJArray(json, "supportingInfo");
13117      for (int i = 0; i < array.size(); i++) {
13118        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
13119      }
13120    };
13121    if (json.has("note")) {
13122      JsonArray array = getJArray(json, "note");
13123      for (int i = 0; i < array.size(); i++) {
13124        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13125      }
13126    };
13127    if (json.has("relevantHistory")) {
13128      JsonArray array = getJArray(json, "relevantHistory");
13129      for (int i = 0; i < array.size(); i++) {
13130        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
13131      }
13132    };
13133  }
13134
13135  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
13136    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
13137    parseDeviceRequestParameterComponentProperties(json, res);
13138    return res;
13139  }
13140
13141  protected void parseDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
13142    parseBackboneElementProperties(json, res);
13143    if (json.has("code"))
13144      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13145    DataType value = parseType("value", json);
13146    if (value != null)
13147      res.setValue(value);
13148  }
13149
13150  protected DeviceUsage parseDeviceUsage(JsonObject json) throws IOException, FHIRFormatError {
13151    DeviceUsage res = new DeviceUsage();
13152    parseDeviceUsageProperties(json, res);
13153    return res;
13154  }
13155
13156  protected void parseDeviceUsageProperties(JsonObject json, DeviceUsage res) throws IOException, FHIRFormatError {
13157    parseDomainResourceProperties(json, res);
13158    if (json.has("identifier")) {
13159      JsonArray array = getJArray(json, "identifier");
13160      for (int i = 0; i < array.size(); i++) {
13161        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13162      }
13163    };
13164    if (json.has("basedOn")) {
13165      JsonArray array = getJArray(json, "basedOn");
13166      for (int i = 0; i < array.size(); i++) {
13167        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13168      }
13169    };
13170    if (json.has("status"))
13171      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUsage.DeviceUsageStatus.NULL, new DeviceUsage.DeviceUsageStatusEnumFactory()));
13172    if (json.has("_status"))
13173      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13174    if (json.has("category")) {
13175      JsonArray array = getJArray(json, "category");
13176      for (int i = 0; i < array.size(); i++) {
13177        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13178      }
13179    };
13180    if (json.has("patient"))
13181      res.setPatient(parseReference(getJObject(json, "patient")));
13182    if (json.has("derivedFrom")) {
13183      JsonArray array = getJArray(json, "derivedFrom");
13184      for (int i = 0; i < array.size(); i++) {
13185        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
13186      }
13187    };
13188    if (json.has("context"))
13189      res.setContext(parseReference(getJObject(json, "context")));
13190    DataType timing = parseType("timing", json);
13191    if (timing != null)
13192      res.setTiming(timing);
13193    if (json.has("dateAsserted"))
13194      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
13195    if (json.has("_dateAsserted"))
13196      parseElementProperties(getJObject(json, "_dateAsserted"), res.getDateAssertedElement());
13197    if (json.has("usageStatus"))
13198      res.setUsageStatus(parseCodeableConcept(getJObject(json, "usageStatus")));
13199    if (json.has("usageReason")) {
13200      JsonArray array = getJArray(json, "usageReason");
13201      for (int i = 0; i < array.size(); i++) {
13202        res.getUsageReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13203      }
13204    };
13205    if (json.has("adherence"))
13206      res.setAdherence(parseDeviceUsageAdherenceComponent(getJObject(json, "adherence")));
13207    if (json.has("informationSource"))
13208      res.setInformationSource(parseReference(getJObject(json, "informationSource")));
13209    if (json.has("device"))
13210      res.setDevice(parseCodeableReference(getJObject(json, "device")));
13211    if (json.has("reason")) {
13212      JsonArray array = getJArray(json, "reason");
13213      for (int i = 0; i < array.size(); i++) {
13214        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13215      }
13216    };
13217    if (json.has("bodySite"))
13218      res.setBodySite(parseCodeableReference(getJObject(json, "bodySite")));
13219    if (json.has("note")) {
13220      JsonArray array = getJArray(json, "note");
13221      for (int i = 0; i < array.size(); i++) {
13222        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13223      }
13224    };
13225  }
13226
13227  protected DeviceUsage.DeviceUsageAdherenceComponent parseDeviceUsageAdherenceComponent(JsonObject json) throws IOException, FHIRFormatError {
13228    DeviceUsage.DeviceUsageAdherenceComponent res = new DeviceUsage.DeviceUsageAdherenceComponent();
13229    parseDeviceUsageAdherenceComponentProperties(json, res);
13230    return res;
13231  }
13232
13233  protected void parseDeviceUsageAdherenceComponentProperties(JsonObject json, DeviceUsage.DeviceUsageAdherenceComponent res) throws IOException, FHIRFormatError {
13234    parseBackboneElementProperties(json, res);
13235    if (json.has("code"))
13236      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13237    if (json.has("reason")) {
13238      JsonArray array = getJArray(json, "reason");
13239      for (int i = 0; i < array.size(); i++) {
13240        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13241      }
13242    };
13243  }
13244
13245  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
13246    DiagnosticReport res = new DiagnosticReport();
13247    parseDiagnosticReportProperties(json, res);
13248    return res;
13249  }
13250
13251  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
13252    parseDomainResourceProperties(json, res);
13253    if (json.has("identifier")) {
13254      JsonArray array = getJArray(json, "identifier");
13255      for (int i = 0; i < array.size(); i++) {
13256        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13257      }
13258    };
13259    if (json.has("basedOn")) {
13260      JsonArray array = getJArray(json, "basedOn");
13261      for (int i = 0; i < array.size(); i++) {
13262        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13263      }
13264    };
13265    if (json.has("status"))
13266      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
13267    if (json.has("_status"))
13268      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13269    if (json.has("category")) {
13270      JsonArray array = getJArray(json, "category");
13271      for (int i = 0; i < array.size(); i++) {
13272        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13273      }
13274    };
13275    if (json.has("code"))
13276      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13277    if (json.has("subject"))
13278      res.setSubject(parseReference(getJObject(json, "subject")));
13279    if (json.has("encounter"))
13280      res.setEncounter(parseReference(getJObject(json, "encounter")));
13281    DataType effective = parseType("effective", json);
13282    if (effective != null)
13283      res.setEffective(effective);
13284    if (json.has("issued"))
13285      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
13286    if (json.has("_issued"))
13287      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
13288    if (json.has("performer")) {
13289      JsonArray array = getJArray(json, "performer");
13290      for (int i = 0; i < array.size(); i++) {
13291        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
13292      }
13293    };
13294    if (json.has("resultsInterpreter")) {
13295      JsonArray array = getJArray(json, "resultsInterpreter");
13296      for (int i = 0; i < array.size(); i++) {
13297        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
13298      }
13299    };
13300    if (json.has("specimen")) {
13301      JsonArray array = getJArray(json, "specimen");
13302      for (int i = 0; i < array.size(); i++) {
13303        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
13304      }
13305    };
13306    if (json.has("result")) {
13307      JsonArray array = getJArray(json, "result");
13308      for (int i = 0; i < array.size(); i++) {
13309        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
13310      }
13311    };
13312    if (json.has("note")) {
13313      JsonArray array = getJArray(json, "note");
13314      for (int i = 0; i < array.size(); i++) {
13315        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13316      }
13317    };
13318    if (json.has("study")) {
13319      JsonArray array = getJArray(json, "study");
13320      for (int i = 0; i < array.size(); i++) {
13321        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
13322      }
13323    };
13324    if (json.has("supportingInfo")) {
13325      JsonArray array = getJArray(json, "supportingInfo");
13326      for (int i = 0; i < array.size(); i++) {
13327        res.getSupportingInfo().add(parseDiagnosticReportSupportingInfoComponent(array.get(i).getAsJsonObject()));
13328      }
13329    };
13330    if (json.has("media")) {
13331      JsonArray array = getJArray(json, "media");
13332      for (int i = 0; i < array.size(); i++) {
13333        res.getMedia().add(parseDiagnosticReportMediaComponent(array.get(i).getAsJsonObject()));
13334      }
13335    };
13336    if (json.has("composition"))
13337      res.setComposition(parseReference(getJObject(json, "composition")));
13338    if (json.has("conclusion"))
13339      res.setConclusionElement(parseMarkdown(json.get("conclusion").getAsString()));
13340    if (json.has("_conclusion"))
13341      parseElementProperties(getJObject(json, "_conclusion"), res.getConclusionElement());
13342    if (json.has("conclusionCode")) {
13343      JsonArray array = getJArray(json, "conclusionCode");
13344      for (int i = 0; i < array.size(); i++) {
13345        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13346      }
13347    };
13348    if (json.has("presentedForm")) {
13349      JsonArray array = getJArray(json, "presentedForm");
13350      for (int i = 0; i < array.size(); i++) {
13351        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
13352      }
13353    };
13354  }
13355
13356  protected DiagnosticReport.DiagnosticReportSupportingInfoComponent parseDiagnosticReportSupportingInfoComponent(JsonObject json) throws IOException, FHIRFormatError {
13357    DiagnosticReport.DiagnosticReportSupportingInfoComponent res = new DiagnosticReport.DiagnosticReportSupportingInfoComponent();
13358    parseDiagnosticReportSupportingInfoComponentProperties(json, res);
13359    return res;
13360  }
13361
13362  protected void parseDiagnosticReportSupportingInfoComponentProperties(JsonObject json, DiagnosticReport.DiagnosticReportSupportingInfoComponent res) throws IOException, FHIRFormatError {
13363    parseBackboneElementProperties(json, res);
13364    if (json.has("type"))
13365      res.setType(parseCodeableConcept(getJObject(json, "type")));
13366    if (json.has("reference"))
13367      res.setReference(parseReference(getJObject(json, "reference")));
13368  }
13369
13370  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportMediaComponent(JsonObject json) throws IOException, FHIRFormatError {
13371    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
13372    parseDiagnosticReportMediaComponentProperties(json, res);
13373    return res;
13374  }
13375
13376  protected void parseDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
13377    parseBackboneElementProperties(json, res);
13378    if (json.has("comment"))
13379      res.setCommentElement(parseString(json.get("comment").getAsString()));
13380    if (json.has("_comment"))
13381      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13382    if (json.has("link"))
13383      res.setLink(parseReference(getJObject(json, "link")));
13384  }
13385
13386  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
13387    DocumentReference res = new DocumentReference();
13388    parseDocumentReferenceProperties(json, res);
13389    return res;
13390  }
13391
13392  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
13393    parseDomainResourceProperties(json, res);
13394    if (json.has("identifier")) {
13395      JsonArray array = getJArray(json, "identifier");
13396      for (int i = 0; i < array.size(); i++) {
13397        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13398      }
13399    };
13400    if (json.has("version"))
13401      res.setVersionElement(parseString(json.get("version").getAsString()));
13402    if (json.has("_version"))
13403      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
13404    if (json.has("basedOn")) {
13405      JsonArray array = getJArray(json, "basedOn");
13406      for (int i = 0; i < array.size(); i++) {
13407        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13408      }
13409    };
13410    if (json.has("status"))
13411      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DocumentReference.DocumentReferenceStatus.NULL, new DocumentReference.DocumentReferenceStatusEnumFactory()));
13412    if (json.has("_status"))
13413      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13414    if (json.has("docStatus"))
13415      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
13416    if (json.has("_docStatus"))
13417      parseElementProperties(getJObject(json, "_docStatus"), res.getDocStatusElement());
13418    if (json.has("modality")) {
13419      JsonArray array = getJArray(json, "modality");
13420      for (int i = 0; i < array.size(); i++) {
13421        res.getModality().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13422      }
13423    };
13424    if (json.has("type"))
13425      res.setType(parseCodeableConcept(getJObject(json, "type")));
13426    if (json.has("category")) {
13427      JsonArray array = getJArray(json, "category");
13428      for (int i = 0; i < array.size(); i++) {
13429        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13430      }
13431    };
13432    if (json.has("subject"))
13433      res.setSubject(parseReference(getJObject(json, "subject")));
13434    if (json.has("context")) {
13435      JsonArray array = getJArray(json, "context");
13436      for (int i = 0; i < array.size(); i++) {
13437        res.getContext().add(parseReference(array.get(i).getAsJsonObject()));
13438      }
13439    };
13440    if (json.has("event")) {
13441      JsonArray array = getJArray(json, "event");
13442      for (int i = 0; i < array.size(); i++) {
13443        res.getEvent().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13444      }
13445    };
13446    if (json.has("bodySite")) {
13447      JsonArray array = getJArray(json, "bodySite");
13448      for (int i = 0; i < array.size(); i++) {
13449        res.getBodySite().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13450      }
13451    };
13452    if (json.has("facilityType"))
13453      res.setFacilityType(parseCodeableConcept(getJObject(json, "facilityType")));
13454    if (json.has("practiceSetting"))
13455      res.setPracticeSetting(parseCodeableConcept(getJObject(json, "practiceSetting")));
13456    if (json.has("period"))
13457      res.setPeriod(parsePeriod(getJObject(json, "period")));
13458    if (json.has("date"))
13459      res.setDateElement(parseInstant(json.get("date").getAsString()));
13460    if (json.has("_date"))
13461      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13462    if (json.has("author")) {
13463      JsonArray array = getJArray(json, "author");
13464      for (int i = 0; i < array.size(); i++) {
13465        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
13466      }
13467    };
13468    if (json.has("attester")) {
13469      JsonArray array = getJArray(json, "attester");
13470      for (int i = 0; i < array.size(); i++) {
13471        res.getAttester().add(parseDocumentReferenceAttesterComponent(array.get(i).getAsJsonObject()));
13472      }
13473    };
13474    if (json.has("custodian"))
13475      res.setCustodian(parseReference(getJObject(json, "custodian")));
13476    if (json.has("relatesTo")) {
13477      JsonArray array = getJArray(json, "relatesTo");
13478      for (int i = 0; i < array.size(); i++) {
13479        res.getRelatesTo().add(parseDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject()));
13480      }
13481    };
13482    if (json.has("description"))
13483      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13484    if (json.has("_description"))
13485      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13486    if (json.has("securityLabel")) {
13487      JsonArray array = getJArray(json, "securityLabel");
13488      for (int i = 0; i < array.size(); i++) {
13489        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13490      }
13491    };
13492    if (json.has("content")) {
13493      JsonArray array = getJArray(json, "content");
13494      for (int i = 0; i < array.size(); i++) {
13495        res.getContent().add(parseDocumentReferenceContentComponent(array.get(i).getAsJsonObject()));
13496      }
13497    };
13498  }
13499
13500  protected DocumentReference.DocumentReferenceAttesterComponent parseDocumentReferenceAttesterComponent(JsonObject json) throws IOException, FHIRFormatError {
13501    DocumentReference.DocumentReferenceAttesterComponent res = new DocumentReference.DocumentReferenceAttesterComponent();
13502    parseDocumentReferenceAttesterComponentProperties(json, res);
13503    return res;
13504  }
13505
13506  protected void parseDocumentReferenceAttesterComponentProperties(JsonObject json, DocumentReference.DocumentReferenceAttesterComponent res) throws IOException, FHIRFormatError {
13507    parseBackboneElementProperties(json, res);
13508    if (json.has("mode"))
13509      res.setMode(parseCodeableConcept(getJObject(json, "mode")));
13510    if (json.has("time"))
13511      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
13512    if (json.has("_time"))
13513      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
13514    if (json.has("party"))
13515      res.setParty(parseReference(getJObject(json, "party")));
13516  }
13517
13518  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
13519    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
13520    parseDocumentReferenceRelatesToComponentProperties(json, res);
13521    return res;
13522  }
13523
13524  protected void parseDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
13525    parseBackboneElementProperties(json, res);
13526    if (json.has("code"))
13527      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13528    if (json.has("target"))
13529      res.setTarget(parseReference(getJObject(json, "target")));
13530  }
13531
13532  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceContentComponent(JsonObject json) throws IOException, FHIRFormatError {
13533    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
13534    parseDocumentReferenceContentComponentProperties(json, res);
13535    return res;
13536  }
13537
13538  protected void parseDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
13539    parseBackboneElementProperties(json, res);
13540    if (json.has("attachment"))
13541      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
13542    if (json.has("profile")) {
13543      JsonArray array = getJArray(json, "profile");
13544      for (int i = 0; i < array.size(); i++) {
13545        res.getProfile().add(parseDocumentReferenceContentProfileComponent(array.get(i).getAsJsonObject()));
13546      }
13547    };
13548  }
13549
13550  protected DocumentReference.DocumentReferenceContentProfileComponent parseDocumentReferenceContentProfileComponent(JsonObject json) throws IOException, FHIRFormatError {
13551    DocumentReference.DocumentReferenceContentProfileComponent res = new DocumentReference.DocumentReferenceContentProfileComponent();
13552    parseDocumentReferenceContentProfileComponentProperties(json, res);
13553    return res;
13554  }
13555
13556  protected void parseDocumentReferenceContentProfileComponentProperties(JsonObject json, DocumentReference.DocumentReferenceContentProfileComponent res) throws IOException, FHIRFormatError {
13557    parseBackboneElementProperties(json, res);
13558    DataType value = parseType("value", json);
13559    if (value != null)
13560      res.setValue(value);
13561  }
13562
13563  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
13564    Encounter res = new Encounter();
13565    parseEncounterProperties(json, res);
13566    return res;
13567  }
13568
13569  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
13570    parseDomainResourceProperties(json, res);
13571    if (json.has("identifier")) {
13572      JsonArray array = getJArray(json, "identifier");
13573      for (int i = 0; i < array.size(); i++) {
13574        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13575      }
13576    };
13577    if (json.has("status"))
13578      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EncounterStatus.NULL, new Enumerations.EncounterStatusEnumFactory()));
13579    if (json.has("_status"))
13580      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13581    if (json.has("class")) {
13582      JsonArray array = getJArray(json, "class");
13583      for (int i = 0; i < array.size(); i++) {
13584        res.getClass_().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13585      }
13586    };
13587    if (json.has("priority"))
13588      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
13589    if (json.has("type")) {
13590      JsonArray array = getJArray(json, "type");
13591      for (int i = 0; i < array.size(); i++) {
13592        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13593      }
13594    };
13595    if (json.has("serviceType")) {
13596      JsonArray array = getJArray(json, "serviceType");
13597      for (int i = 0; i < array.size(); i++) {
13598        res.getServiceType().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13599      }
13600    };
13601    if (json.has("subject"))
13602      res.setSubject(parseReference(getJObject(json, "subject")));
13603    if (json.has("subjectStatus"))
13604      res.setSubjectStatus(parseCodeableConcept(getJObject(json, "subjectStatus")));
13605    if (json.has("episodeOfCare")) {
13606      JsonArray array = getJArray(json, "episodeOfCare");
13607      for (int i = 0; i < array.size(); i++) {
13608        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
13609      }
13610    };
13611    if (json.has("basedOn")) {
13612      JsonArray array = getJArray(json, "basedOn");
13613      for (int i = 0; i < array.size(); i++) {
13614        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13615      }
13616    };
13617    if (json.has("careTeam")) {
13618      JsonArray array = getJArray(json, "careTeam");
13619      for (int i = 0; i < array.size(); i++) {
13620        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
13621      }
13622    };
13623    if (json.has("partOf"))
13624      res.setPartOf(parseReference(getJObject(json, "partOf")));
13625    if (json.has("serviceProvider"))
13626      res.setServiceProvider(parseReference(getJObject(json, "serviceProvider")));
13627    if (json.has("participant")) {
13628      JsonArray array = getJArray(json, "participant");
13629      for (int i = 0; i < array.size(); i++) {
13630        res.getParticipant().add(parseEncounterParticipantComponent(array.get(i).getAsJsonObject()));
13631      }
13632    };
13633    if (json.has("appointment")) {
13634      JsonArray array = getJArray(json, "appointment");
13635      for (int i = 0; i < array.size(); i++) {
13636        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
13637      }
13638    };
13639    if (json.has("virtualService")) {
13640      JsonArray array = getJArray(json, "virtualService");
13641      for (int i = 0; i < array.size(); i++) {
13642        res.getVirtualService().add(parseVirtualServiceDetail(array.get(i).getAsJsonObject()));
13643      }
13644    };
13645    if (json.has("actualPeriod"))
13646      res.setActualPeriod(parsePeriod(getJObject(json, "actualPeriod")));
13647    if (json.has("plannedStartDate"))
13648      res.setPlannedStartDateElement(parseDateTime(json.get("plannedStartDate").getAsString()));
13649    if (json.has("_plannedStartDate"))
13650      parseElementProperties(getJObject(json, "_plannedStartDate"), res.getPlannedStartDateElement());
13651    if (json.has("plannedEndDate"))
13652      res.setPlannedEndDateElement(parseDateTime(json.get("plannedEndDate").getAsString()));
13653    if (json.has("_plannedEndDate"))
13654      parseElementProperties(getJObject(json, "_plannedEndDate"), res.getPlannedEndDateElement());
13655    if (json.has("length"))
13656      res.setLength(parseDuration(getJObject(json, "length")));
13657    if (json.has("reason")) {
13658      JsonArray array = getJArray(json, "reason");
13659      for (int i = 0; i < array.size(); i++) {
13660        res.getReason().add(parseEncounterReasonComponent(array.get(i).getAsJsonObject()));
13661      }
13662    };
13663    if (json.has("diagnosis")) {
13664      JsonArray array = getJArray(json, "diagnosis");
13665      for (int i = 0; i < array.size(); i++) {
13666        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject()));
13667      }
13668    };
13669    if (json.has("account")) {
13670      JsonArray array = getJArray(json, "account");
13671      for (int i = 0; i < array.size(); i++) {
13672        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
13673      }
13674    };
13675    if (json.has("dietPreference")) {
13676      JsonArray array = getJArray(json, "dietPreference");
13677      for (int i = 0; i < array.size(); i++) {
13678        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13679      }
13680    };
13681    if (json.has("specialArrangement")) {
13682      JsonArray array = getJArray(json, "specialArrangement");
13683      for (int i = 0; i < array.size(); i++) {
13684        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13685      }
13686    };
13687    if (json.has("specialCourtesy")) {
13688      JsonArray array = getJArray(json, "specialCourtesy");
13689      for (int i = 0; i < array.size(); i++) {
13690        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13691      }
13692    };
13693    if (json.has("admission"))
13694      res.setAdmission(parseEncounterAdmissionComponent(getJObject(json, "admission")));
13695    if (json.has("location")) {
13696      JsonArray array = getJArray(json, "location");
13697      for (int i = 0; i < array.size(); i++) {
13698        res.getLocation().add(parseEncounterLocationComponent(array.get(i).getAsJsonObject()));
13699      }
13700    };
13701  }
13702
13703  protected Encounter.EncounterParticipantComponent parseEncounterParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
13704    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
13705    parseEncounterParticipantComponentProperties(json, res);
13706    return res;
13707  }
13708
13709  protected void parseEncounterParticipantComponentProperties(JsonObject json, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
13710    parseBackboneElementProperties(json, res);
13711    if (json.has("type")) {
13712      JsonArray array = getJArray(json, "type");
13713      for (int i = 0; i < array.size(); i++) {
13714        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13715      }
13716    };
13717    if (json.has("period"))
13718      res.setPeriod(parsePeriod(getJObject(json, "period")));
13719    if (json.has("actor"))
13720      res.setActor(parseReference(getJObject(json, "actor")));
13721  }
13722
13723  protected Encounter.ReasonComponent parseEncounterReasonComponent(JsonObject json) throws IOException, FHIRFormatError {
13724    Encounter.ReasonComponent res = new Encounter.ReasonComponent();
13725    parseEncounterReasonComponentProperties(json, res);
13726    return res;
13727  }
13728
13729  protected void parseEncounterReasonComponentProperties(JsonObject json, Encounter.ReasonComponent res) throws IOException, FHIRFormatError {
13730    parseBackboneElementProperties(json, res);
13731    if (json.has("use")) {
13732      JsonArray array = getJArray(json, "use");
13733      for (int i = 0; i < array.size(); i++) {
13734        res.getUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13735      }
13736    };
13737    if (json.has("value")) {
13738      JsonArray array = getJArray(json, "value");
13739      for (int i = 0; i < array.size(); i++) {
13740        res.getValue().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13741      }
13742    };
13743  }
13744
13745  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
13746    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
13747    parseEncounterDiagnosisComponentProperties(json, res);
13748    return res;
13749  }
13750
13751  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
13752    parseBackboneElementProperties(json, res);
13753    if (json.has("condition")) {
13754      JsonArray array = getJArray(json, "condition");
13755      for (int i = 0; i < array.size(); i++) {
13756        res.getCondition().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13757      }
13758    };
13759    if (json.has("use")) {
13760      JsonArray array = getJArray(json, "use");
13761      for (int i = 0; i < array.size(); i++) {
13762        res.getUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13763      }
13764    };
13765  }
13766
13767  protected Encounter.EncounterAdmissionComponent parseEncounterAdmissionComponent(JsonObject json) throws IOException, FHIRFormatError {
13768    Encounter.EncounterAdmissionComponent res = new Encounter.EncounterAdmissionComponent();
13769    parseEncounterAdmissionComponentProperties(json, res);
13770    return res;
13771  }
13772
13773  protected void parseEncounterAdmissionComponentProperties(JsonObject json, Encounter.EncounterAdmissionComponent res) throws IOException, FHIRFormatError {
13774    parseBackboneElementProperties(json, res);
13775    if (json.has("preAdmissionIdentifier"))
13776      res.setPreAdmissionIdentifier(parseIdentifier(getJObject(json, "preAdmissionIdentifier")));
13777    if (json.has("origin"))
13778      res.setOrigin(parseReference(getJObject(json, "origin")));
13779    if (json.has("admitSource"))
13780      res.setAdmitSource(parseCodeableConcept(getJObject(json, "admitSource")));
13781    if (json.has("reAdmission"))
13782      res.setReAdmission(parseCodeableConcept(getJObject(json, "reAdmission")));
13783    if (json.has("destination"))
13784      res.setDestination(parseReference(getJObject(json, "destination")));
13785    if (json.has("dischargeDisposition"))
13786      res.setDischargeDisposition(parseCodeableConcept(getJObject(json, "dischargeDisposition")));
13787  }
13788
13789  protected Encounter.EncounterLocationComponent parseEncounterLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
13790    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
13791    parseEncounterLocationComponentProperties(json, res);
13792    return res;
13793  }
13794
13795  protected void parseEncounterLocationComponentProperties(JsonObject json, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
13796    parseBackboneElementProperties(json, res);
13797    if (json.has("location"))
13798      res.setLocation(parseReference(getJObject(json, "location")));
13799    if (json.has("status"))
13800      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
13801    if (json.has("_status"))
13802      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13803    if (json.has("form"))
13804      res.setForm(parseCodeableConcept(getJObject(json, "form")));
13805    if (json.has("period"))
13806      res.setPeriod(parsePeriod(getJObject(json, "period")));
13807  }
13808
13809  protected EncounterHistory parseEncounterHistory(JsonObject json) throws IOException, FHIRFormatError {
13810    EncounterHistory res = new EncounterHistory();
13811    parseEncounterHistoryProperties(json, res);
13812    return res;
13813  }
13814
13815  protected void parseEncounterHistoryProperties(JsonObject json, EncounterHistory res) throws IOException, FHIRFormatError {
13816    parseDomainResourceProperties(json, res);
13817    if (json.has("encounter"))
13818      res.setEncounter(parseReference(getJObject(json, "encounter")));
13819    if (json.has("identifier")) {
13820      JsonArray array = getJArray(json, "identifier");
13821      for (int i = 0; i < array.size(); i++) {
13822        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13823      }
13824    };
13825    if (json.has("status"))
13826      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EncounterStatus.NULL, new Enumerations.EncounterStatusEnumFactory()));
13827    if (json.has("_status"))
13828      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13829    if (json.has("class"))
13830      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
13831    if (json.has("type")) {
13832      JsonArray array = getJArray(json, "type");
13833      for (int i = 0; i < array.size(); i++) {
13834        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13835      }
13836    };
13837    if (json.has("serviceType")) {
13838      JsonArray array = getJArray(json, "serviceType");
13839      for (int i = 0; i < array.size(); i++) {
13840        res.getServiceType().add(parseCodeableReference(array.get(i).getAsJsonObject()));
13841      }
13842    };
13843    if (json.has("subject"))
13844      res.setSubject(parseReference(getJObject(json, "subject")));
13845    if (json.has("subjectStatus"))
13846      res.setSubjectStatus(parseCodeableConcept(getJObject(json, "subjectStatus")));
13847    if (json.has("actualPeriod"))
13848      res.setActualPeriod(parsePeriod(getJObject(json, "actualPeriod")));
13849    if (json.has("plannedStartDate"))
13850      res.setPlannedStartDateElement(parseDateTime(json.get("plannedStartDate").getAsString()));
13851    if (json.has("_plannedStartDate"))
13852      parseElementProperties(getJObject(json, "_plannedStartDate"), res.getPlannedStartDateElement());
13853    if (json.has("plannedEndDate"))
13854      res.setPlannedEndDateElement(parseDateTime(json.get("plannedEndDate").getAsString()));
13855    if (json.has("_plannedEndDate"))
13856      parseElementProperties(getJObject(json, "_plannedEndDate"), res.getPlannedEndDateElement());
13857    if (json.has("length"))
13858      res.setLength(parseDuration(getJObject(json, "length")));
13859    if (json.has("location")) {
13860      JsonArray array = getJArray(json, "location");
13861      for (int i = 0; i < array.size(); i++) {
13862        res.getLocation().add(parseEncounterHistoryLocationComponent(array.get(i).getAsJsonObject()));
13863      }
13864    };
13865  }
13866
13867  protected EncounterHistory.EncounterHistoryLocationComponent parseEncounterHistoryLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
13868    EncounterHistory.EncounterHistoryLocationComponent res = new EncounterHistory.EncounterHistoryLocationComponent();
13869    parseEncounterHistoryLocationComponentProperties(json, res);
13870    return res;
13871  }
13872
13873  protected void parseEncounterHistoryLocationComponentProperties(JsonObject json, EncounterHistory.EncounterHistoryLocationComponent res) throws IOException, FHIRFormatError {
13874    parseBackboneElementProperties(json, res);
13875    if (json.has("location"))
13876      res.setLocation(parseReference(getJObject(json, "location")));
13877    if (json.has("form"))
13878      res.setForm(parseCodeableConcept(getJObject(json, "form")));
13879  }
13880
13881  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
13882    Endpoint res = new Endpoint();
13883    parseEndpointProperties(json, res);
13884    return res;
13885  }
13886
13887  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
13888    parseDomainResourceProperties(json, res);
13889    if (json.has("identifier")) {
13890      JsonArray array = getJArray(json, "identifier");
13891      for (int i = 0; i < array.size(); i++) {
13892        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13893      }
13894    };
13895    if (json.has("status"))
13896      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
13897    if (json.has("_status"))
13898      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13899    if (json.has("connectionType")) {
13900      JsonArray array = getJArray(json, "connectionType");
13901      for (int i = 0; i < array.size(); i++) {
13902        res.getConnectionType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13903      }
13904    };
13905    if (json.has("name"))
13906      res.setNameElement(parseString(json.get("name").getAsString()));
13907    if (json.has("_name"))
13908      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13909    if (json.has("description"))
13910      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13911    if (json.has("_description"))
13912      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13913    if (json.has("environmentType")) {
13914      JsonArray array = getJArray(json, "environmentType");
13915      for (int i = 0; i < array.size(); i++) {
13916        res.getEnvironmentType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13917      }
13918    };
13919    if (json.has("managingOrganization"))
13920      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
13921    if (json.has("contact")) {
13922      JsonArray array = getJArray(json, "contact");
13923      for (int i = 0; i < array.size(); i++) {
13924        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
13925      }
13926    };
13927    if (json.has("period"))
13928      res.setPeriod(parsePeriod(getJObject(json, "period")));
13929    if (json.has("payload")) {
13930      JsonArray array = getJArray(json, "payload");
13931      for (int i = 0; i < array.size(); i++) {
13932        res.getPayload().add(parseEndpointPayloadComponent(array.get(i).getAsJsonObject()));
13933      }
13934    };
13935    if (json.has("address"))
13936      res.setAddressElement(parseUrl(json.get("address").getAsString()));
13937    if (json.has("_address"))
13938      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
13939    if (json.has("header")) {
13940      JsonArray array = getJArray(json, "header");
13941      for (int i = 0; i < array.size(); i++) {
13942        if (array.get(i).isJsonNull()) {
13943          res.getHeader().add(new StringType());
13944        } else {;
13945          res.getHeader().add(parseString(array.get(i).getAsString()));
13946        }
13947      }
13948    };
13949    if (json.has("_header")) {
13950      JsonArray array = getJArray(json, "_header");
13951      for (int i = 0; i < array.size(); i++) {
13952        if (i == res.getHeader().size())
13953          res.getHeader().add(parseString(null));
13954        if (array.get(i) instanceof JsonObject) 
13955          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
13956      }
13957    };
13958  }
13959
13960  protected Endpoint.EndpointPayloadComponent parseEndpointPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
13961    Endpoint.EndpointPayloadComponent res = new Endpoint.EndpointPayloadComponent();
13962    parseEndpointPayloadComponentProperties(json, res);
13963    return res;
13964  }
13965
13966  protected void parseEndpointPayloadComponentProperties(JsonObject json, Endpoint.EndpointPayloadComponent res) throws IOException, FHIRFormatError {
13967    parseBackboneElementProperties(json, res);
13968    if (json.has("type")) {
13969      JsonArray array = getJArray(json, "type");
13970      for (int i = 0; i < array.size(); i++) {
13971        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13972      }
13973    };
13974    if (json.has("mimeType")) {
13975      JsonArray array = getJArray(json, "mimeType");
13976      for (int i = 0; i < array.size(); i++) {
13977        if (array.get(i).isJsonNull()) {
13978          res.getMimeType().add(new CodeType());
13979        } else {;
13980          res.getMimeType().add(parseCode(array.get(i).getAsString()));
13981        }
13982      }
13983    };
13984    if (json.has("_mimeType")) {
13985      JsonArray array = getJArray(json, "_mimeType");
13986      for (int i = 0; i < array.size(); i++) {
13987        if (i == res.getMimeType().size())
13988          res.getMimeType().add(parseCode(null));
13989        if (array.get(i) instanceof JsonObject) 
13990          parseElementProperties(array.get(i).getAsJsonObject(), res.getMimeType().get(i));
13991      }
13992    };
13993  }
13994
13995  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
13996    EnrollmentRequest res = new EnrollmentRequest();
13997    parseEnrollmentRequestProperties(json, res);
13998    return res;
13999  }
14000
14001  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
14002    parseDomainResourceProperties(json, res);
14003    if (json.has("identifier")) {
14004      JsonArray array = getJArray(json, "identifier");
14005      for (int i = 0; i < array.size(); i++) {
14006        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14007      }
14008    };
14009    if (json.has("status"))
14010      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
14011    if (json.has("_status"))
14012      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14013    if (json.has("created"))
14014      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
14015    if (json.has("_created"))
14016      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
14017    if (json.has("insurer"))
14018      res.setInsurer(parseReference(getJObject(json, "insurer")));
14019    if (json.has("provider"))
14020      res.setProvider(parseReference(getJObject(json, "provider")));
14021    if (json.has("candidate"))
14022      res.setCandidate(parseReference(getJObject(json, "candidate")));
14023    if (json.has("coverage"))
14024      res.setCoverage(parseReference(getJObject(json, "coverage")));
14025  }
14026
14027  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
14028    EnrollmentResponse res = new EnrollmentResponse();
14029    parseEnrollmentResponseProperties(json, res);
14030    return res;
14031  }
14032
14033  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
14034    parseDomainResourceProperties(json, res);
14035    if (json.has("identifier")) {
14036      JsonArray array = getJArray(json, "identifier");
14037      for (int i = 0; i < array.size(); i++) {
14038        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14039      }
14040    };
14041    if (json.has("status"))
14042      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
14043    if (json.has("_status"))
14044      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14045    if (json.has("request"))
14046      res.setRequest(parseReference(getJObject(json, "request")));
14047    if (json.has("outcome"))
14048      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), EnrollmentResponse.EnrollmentOutcome.NULL, new EnrollmentResponse.EnrollmentOutcomeEnumFactory()));
14049    if (json.has("_outcome"))
14050      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
14051    if (json.has("disposition"))
14052      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
14053    if (json.has("_disposition"))
14054      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
14055    if (json.has("created"))
14056      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
14057    if (json.has("_created"))
14058      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
14059    if (json.has("organization"))
14060      res.setOrganization(parseReference(getJObject(json, "organization")));
14061    if (json.has("requestProvider"))
14062      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
14063  }
14064
14065  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
14066    EpisodeOfCare res = new EpisodeOfCare();
14067    parseEpisodeOfCareProperties(json, res);
14068    return res;
14069  }
14070
14071  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
14072    parseDomainResourceProperties(json, res);
14073    if (json.has("identifier")) {
14074      JsonArray array = getJArray(json, "identifier");
14075      for (int i = 0; i < array.size(); i++) {
14076        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14077      }
14078    };
14079    if (json.has("status"))
14080      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
14081    if (json.has("_status"))
14082      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14083    if (json.has("statusHistory")) {
14084      JsonArray array = getJArray(json, "statusHistory");
14085      for (int i = 0; i < array.size(); i++) {
14086        res.getStatusHistory().add(parseEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject()));
14087      }
14088    };
14089    if (json.has("type")) {
14090      JsonArray array = getJArray(json, "type");
14091      for (int i = 0; i < array.size(); i++) {
14092        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14093      }
14094    };
14095    if (json.has("reason")) {
14096      JsonArray array = getJArray(json, "reason");
14097      for (int i = 0; i < array.size(); i++) {
14098        res.getReason().add(parseEpisodeOfCareReasonComponent(array.get(i).getAsJsonObject()));
14099      }
14100    };
14101    if (json.has("diagnosis")) {
14102      JsonArray array = getJArray(json, "diagnosis");
14103      for (int i = 0; i < array.size(); i++) {
14104        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject()));
14105      }
14106    };
14107    if (json.has("patient"))
14108      res.setPatient(parseReference(getJObject(json, "patient")));
14109    if (json.has("managingOrganization"))
14110      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
14111    if (json.has("period"))
14112      res.setPeriod(parsePeriod(getJObject(json, "period")));
14113    if (json.has("referralRequest")) {
14114      JsonArray array = getJArray(json, "referralRequest");
14115      for (int i = 0; i < array.size(); i++) {
14116        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
14117      }
14118    };
14119    if (json.has("careManager"))
14120      res.setCareManager(parseReference(getJObject(json, "careManager")));
14121    if (json.has("careTeam")) {
14122      JsonArray array = getJArray(json, "careTeam");
14123      for (int i = 0; i < array.size(); i++) {
14124        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
14125      }
14126    };
14127    if (json.has("account")) {
14128      JsonArray array = getJArray(json, "account");
14129      for (int i = 0; i < array.size(); i++) {
14130        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
14131      }
14132    };
14133  }
14134
14135  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareStatusHistoryComponent(JsonObject json) throws IOException, FHIRFormatError {
14136    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
14137    parseEpisodeOfCareStatusHistoryComponentProperties(json, res);
14138    return res;
14139  }
14140
14141  protected void parseEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
14142    parseBackboneElementProperties(json, res);
14143    if (json.has("status"))
14144      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
14145    if (json.has("_status"))
14146      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14147    if (json.has("period"))
14148      res.setPeriod(parsePeriod(getJObject(json, "period")));
14149  }
14150
14151  protected EpisodeOfCare.ReasonComponent parseEpisodeOfCareReasonComponent(JsonObject json) throws IOException, FHIRFormatError {
14152    EpisodeOfCare.ReasonComponent res = new EpisodeOfCare.ReasonComponent();
14153    parseEpisodeOfCareReasonComponentProperties(json, res);
14154    return res;
14155  }
14156
14157  protected void parseEpisodeOfCareReasonComponentProperties(JsonObject json, EpisodeOfCare.ReasonComponent res) throws IOException, FHIRFormatError {
14158    parseBackboneElementProperties(json, res);
14159    if (json.has("use"))
14160      res.setUse(parseCodeableConcept(getJObject(json, "use")));
14161    if (json.has("value")) {
14162      JsonArray array = getJArray(json, "value");
14163      for (int i = 0; i < array.size(); i++) {
14164        res.getValue().add(parseCodeableReference(array.get(i).getAsJsonObject()));
14165      }
14166    };
14167  }
14168
14169  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
14170    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
14171    parseEpisodeOfCareDiagnosisComponentProperties(json, res);
14172    return res;
14173  }
14174
14175  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
14176    parseBackboneElementProperties(json, res);
14177    if (json.has("condition")) {
14178      JsonArray array = getJArray(json, "condition");
14179      for (int i = 0; i < array.size(); i++) {
14180        res.getCondition().add(parseCodeableReference(array.get(i).getAsJsonObject()));
14181      }
14182    };
14183    if (json.has("use"))
14184      res.setUse(parseCodeableConcept(getJObject(json, "use")));
14185  }
14186
14187  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
14188    EventDefinition res = new EventDefinition();
14189    parseEventDefinitionProperties(json, res);
14190    return res;
14191  }
14192
14193  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
14194    parseMetadataResourceProperties(json, res);
14195    if (json.has("url"))
14196      res.setUrlElement(parseUri(json.get("url").getAsString()));
14197    if (json.has("_url"))
14198      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14199    if (json.has("identifier")) {
14200      JsonArray array = getJArray(json, "identifier");
14201      for (int i = 0; i < array.size(); i++) {
14202        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14203      }
14204    };
14205    if (json.has("version"))
14206      res.setVersionElement(parseString(json.get("version").getAsString()));
14207    if (json.has("_version"))
14208      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14209    DataType versionAlgorithm = parseType("versionAlgorithm", json);
14210    if (versionAlgorithm != null)
14211      res.setVersionAlgorithm(versionAlgorithm);
14212    if (json.has("name"))
14213      res.setNameElement(parseString(json.get("name").getAsString()));
14214    if (json.has("_name"))
14215      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14216    if (json.has("title"))
14217      res.setTitleElement(parseString(json.get("title").getAsString()));
14218    if (json.has("_title"))
14219      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14220    if (json.has("subtitle"))
14221      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
14222    if (json.has("_subtitle"))
14223      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
14224    if (json.has("status"))
14225      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14226    if (json.has("_status"))
14227      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14228    if (json.has("experimental"))
14229      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14230    if (json.has("_experimental"))
14231      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
14232    DataType subject = parseType("subject", json);
14233    if (subject != null)
14234      res.setSubject(subject);
14235    if (json.has("date"))
14236      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14237    if (json.has("_date"))
14238      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14239    if (json.has("publisher"))
14240      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14241    if (json.has("_publisher"))
14242      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14243    if (json.has("contact")) {
14244      JsonArray array = getJArray(json, "contact");
14245      for (int i = 0; i < array.size(); i++) {
14246        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14247      }
14248    };
14249    if (json.has("description"))
14250      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14251    if (json.has("_description"))
14252      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14253    if (json.has("useContext")) {
14254      JsonArray array = getJArray(json, "useContext");
14255      for (int i = 0; i < array.size(); i++) {
14256        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14257      }
14258    };
14259    if (json.has("jurisdiction")) {
14260      JsonArray array = getJArray(json, "jurisdiction");
14261      for (int i = 0; i < array.size(); i++) {
14262        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14263      }
14264    };
14265    if (json.has("purpose"))
14266      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14267    if (json.has("_purpose"))
14268      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
14269    if (json.has("usage"))
14270      res.setUsageElement(parseMarkdown(json.get("usage").getAsString()));
14271    if (json.has("_usage"))
14272      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
14273    if (json.has("copyright"))
14274      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14275    if (json.has("_copyright"))
14276      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
14277    if (json.has("copyrightLabel"))
14278      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
14279    if (json.has("_copyrightLabel"))
14280      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
14281    if (json.has("approvalDate"))
14282      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14283    if (json.has("_approvalDate"))
14284      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
14285    if (json.has("lastReviewDate"))
14286      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14287    if (json.has("_lastReviewDate"))
14288      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
14289    if (json.has("effectivePeriod"))
14290      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
14291    if (json.has("topic")) {
14292      JsonArray array = getJArray(json, "topic");
14293      for (int i = 0; i < array.size(); i++) {
14294        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14295      }
14296    };
14297    if (json.has("author")) {
14298      JsonArray array = getJArray(json, "author");
14299      for (int i = 0; i < array.size(); i++) {
14300        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14301      }
14302    };
14303    if (json.has("editor")) {
14304      JsonArray array = getJArray(json, "editor");
14305      for (int i = 0; i < array.size(); i++) {
14306        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14307      }
14308    };
14309    if (json.has("reviewer")) {
14310      JsonArray array = getJArray(json, "reviewer");
14311      for (int i = 0; i < array.size(); i++) {
14312        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14313      }
14314    };
14315    if (json.has("endorser")) {
14316      JsonArray array = getJArray(json, "endorser");
14317      for (int i = 0; i < array.size(); i++) {
14318        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14319      }
14320    };
14321    if (json.has("relatedArtifact")) {
14322      JsonArray array = getJArray(json, "relatedArtifact");
14323      for (int i = 0; i < array.size(); i++) {
14324        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14325      }
14326    };
14327    if (json.has("trigger")) {
14328      JsonArray array = getJArray(json, "trigger");
14329      for (int i = 0; i < array.size(); i++) {
14330        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
14331      }
14332    };
14333  }
14334
14335  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
14336    Evidence res = new Evidence();
14337    parseEvidenceProperties(json, res);
14338    return res;
14339  }
14340
14341  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
14342    parseMetadataResourceProperties(json, res);
14343    if (json.has("url"))
14344      res.setUrlElement(parseUri(json.get("url").getAsString()));
14345    if (json.has("_url"))
14346      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14347    if (json.has("identifier")) {
14348      JsonArray array = getJArray(json, "identifier");
14349      for (int i = 0; i < array.size(); i++) {
14350        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14351      }
14352    };
14353    if (json.has("version"))
14354      res.setVersionElement(parseString(json.get("version").getAsString()));
14355    if (json.has("_version"))
14356      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14357    DataType versionAlgorithm = parseType("versionAlgorithm", json);
14358    if (versionAlgorithm != null)
14359      res.setVersionAlgorithm(versionAlgorithm);
14360    if (json.has("name"))
14361      res.setNameElement(parseString(json.get("name").getAsString()));
14362    if (json.has("_name"))
14363      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14364    if (json.has("title"))
14365      res.setTitleElement(parseString(json.get("title").getAsString()));
14366    if (json.has("_title"))
14367      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14368    DataType citeAs = parseType("citeAs", json);
14369    if (citeAs != null)
14370      res.setCiteAs(citeAs);
14371    if (json.has("status"))
14372      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14373    if (json.has("_status"))
14374      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14375    if (json.has("experimental"))
14376      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14377    if (json.has("_experimental"))
14378      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
14379    if (json.has("date"))
14380      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14381    if (json.has("_date"))
14382      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14383    if (json.has("approvalDate"))
14384      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14385    if (json.has("_approvalDate"))
14386      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
14387    if (json.has("lastReviewDate"))
14388      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14389    if (json.has("_lastReviewDate"))
14390      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
14391    if (json.has("publisher"))
14392      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14393    if (json.has("_publisher"))
14394      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14395    if (json.has("contact")) {
14396      JsonArray array = getJArray(json, "contact");
14397      for (int i = 0; i < array.size(); i++) {
14398        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14399      }
14400    };
14401    if (json.has("author")) {
14402      JsonArray array = getJArray(json, "author");
14403      for (int i = 0; i < array.size(); i++) {
14404        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14405      }
14406    };
14407    if (json.has("editor")) {
14408      JsonArray array = getJArray(json, "editor");
14409      for (int i = 0; i < array.size(); i++) {
14410        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14411      }
14412    };
14413    if (json.has("reviewer")) {
14414      JsonArray array = getJArray(json, "reviewer");
14415      for (int i = 0; i < array.size(); i++) {
14416        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14417      }
14418    };
14419    if (json.has("endorser")) {
14420      JsonArray array = getJArray(json, "endorser");
14421      for (int i = 0; i < array.size(); i++) {
14422        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14423      }
14424    };
14425    if (json.has("useContext")) {
14426      JsonArray array = getJArray(json, "useContext");
14427      for (int i = 0; i < array.size(); i++) {
14428        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14429      }
14430    };
14431    if (json.has("purpose"))
14432      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14433    if (json.has("_purpose"))
14434      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
14435    if (json.has("copyright"))
14436      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14437    if (json.has("_copyright"))
14438      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
14439    if (json.has("copyrightLabel"))
14440      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
14441    if (json.has("_copyrightLabel"))
14442      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
14443    if (json.has("relatedArtifact")) {
14444      JsonArray array = getJArray(json, "relatedArtifact");
14445      for (int i = 0; i < array.size(); i++) {
14446        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14447      }
14448    };
14449    if (json.has("description"))
14450      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14451    if (json.has("_description"))
14452      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14453    if (json.has("assertion"))
14454      res.setAssertionElement(parseMarkdown(json.get("assertion").getAsString()));
14455    if (json.has("_assertion"))
14456      parseElementProperties(getJObject(json, "_assertion"), res.getAssertionElement());
14457    if (json.has("note")) {
14458      JsonArray array = getJArray(json, "note");
14459      for (int i = 0; i < array.size(); i++) {
14460        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14461      }
14462    };
14463    if (json.has("variableDefinition")) {
14464      JsonArray array = getJArray(json, "variableDefinition");
14465      for (int i = 0; i < array.size(); i++) {
14466        res.getVariableDefinition().add(parseEvidenceVariableDefinitionComponent(array.get(i).getAsJsonObject()));
14467      }
14468    };
14469    if (json.has("synthesisType"))
14470      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
14471    if (json.has("studyDesign")) {
14472      JsonArray array = getJArray(json, "studyDesign");
14473      for (int i = 0; i < array.size(); i++) {
14474        res.getStudyDesign().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14475      }
14476    };
14477    if (json.has("statistic")) {
14478      JsonArray array = getJArray(json, "statistic");
14479      for (int i = 0; i < array.size(); i++) {
14480        res.getStatistic().add(parseEvidenceStatisticComponent(array.get(i).getAsJsonObject()));
14481      }
14482    };
14483    if (json.has("certainty")) {
14484      JsonArray array = getJArray(json, "certainty");
14485      for (int i = 0; i < array.size(); i++) {
14486        res.getCertainty().add(parseEvidenceCertaintyComponent(array.get(i).getAsJsonObject()));
14487      }
14488    };
14489  }
14490
14491  protected Evidence.EvidenceVariableDefinitionComponent parseEvidenceVariableDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
14492    Evidence.EvidenceVariableDefinitionComponent res = new Evidence.EvidenceVariableDefinitionComponent();
14493    parseEvidenceVariableDefinitionComponentProperties(json, res);
14494    return res;
14495  }
14496
14497  protected void parseEvidenceVariableDefinitionComponentProperties(JsonObject json, Evidence.EvidenceVariableDefinitionComponent res) throws IOException, FHIRFormatError {
14498    parseBackboneElementProperties(json, res);
14499    if (json.has("description"))
14500      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14501    if (json.has("_description"))
14502      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14503    if (json.has("note")) {
14504      JsonArray array = getJArray(json, "note");
14505      for (int i = 0; i < array.size(); i++) {
14506        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14507      }
14508    };
14509    if (json.has("variableRole"))
14510      res.setVariableRole(parseCodeableConcept(getJObject(json, "variableRole")));
14511    if (json.has("observed"))
14512      res.setObserved(parseReference(getJObject(json, "observed")));
14513    if (json.has("intended"))
14514      res.setIntended(parseReference(getJObject(json, "intended")));
14515    if (json.has("directnessMatch"))
14516      res.setDirectnessMatch(parseCodeableConcept(getJObject(json, "directnessMatch")));
14517  }
14518
14519  protected Evidence.EvidenceStatisticComponent parseEvidenceStatisticComponent(JsonObject json) throws IOException, FHIRFormatError {
14520    Evidence.EvidenceStatisticComponent res = new Evidence.EvidenceStatisticComponent();
14521    parseEvidenceStatisticComponentProperties(json, res);
14522    return res;
14523  }
14524
14525  protected void parseEvidenceStatisticComponentProperties(JsonObject json, Evidence.EvidenceStatisticComponent res) throws IOException, FHIRFormatError {
14526    parseBackboneElementProperties(json, res);
14527    if (json.has("description"))
14528      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14529    if (json.has("_description"))
14530      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14531    if (json.has("note")) {
14532      JsonArray array = getJArray(json, "note");
14533      for (int i = 0; i < array.size(); i++) {
14534        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14535      }
14536    };
14537    if (json.has("statisticType"))
14538      res.setStatisticType(parseCodeableConcept(getJObject(json, "statisticType")));
14539    if (json.has("category"))
14540      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14541    if (json.has("quantity"))
14542      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
14543    if (json.has("numberOfEvents"))
14544      res.setNumberOfEventsElement(parseUnsignedInt(json.get("numberOfEvents").getAsString()));
14545    if (json.has("_numberOfEvents"))
14546      parseElementProperties(getJObject(json, "_numberOfEvents"), res.getNumberOfEventsElement());
14547    if (json.has("numberAffected"))
14548      res.setNumberAffectedElement(parseUnsignedInt(json.get("numberAffected").getAsString()));
14549    if (json.has("_numberAffected"))
14550      parseElementProperties(getJObject(json, "_numberAffected"), res.getNumberAffectedElement());
14551    if (json.has("sampleSize"))
14552      res.setSampleSize(parseEvidenceStatisticSampleSizeComponent(getJObject(json, "sampleSize")));
14553    if (json.has("attributeEstimate")) {
14554      JsonArray array = getJArray(json, "attributeEstimate");
14555      for (int i = 0; i < array.size(); i++) {
14556        res.getAttributeEstimate().add(parseEvidenceStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject()));
14557      }
14558    };
14559    if (json.has("modelCharacteristic")) {
14560      JsonArray array = getJArray(json, "modelCharacteristic");
14561      for (int i = 0; i < array.size(); i++) {
14562        res.getModelCharacteristic().add(parseEvidenceStatisticModelCharacteristicComponent(array.get(i).getAsJsonObject()));
14563      }
14564    };
14565  }
14566
14567  protected Evidence.EvidenceStatisticSampleSizeComponent parseEvidenceStatisticSampleSizeComponent(JsonObject json) throws IOException, FHIRFormatError {
14568    Evidence.EvidenceStatisticSampleSizeComponent res = new Evidence.EvidenceStatisticSampleSizeComponent();
14569    parseEvidenceStatisticSampleSizeComponentProperties(json, res);
14570    return res;
14571  }
14572
14573  protected void parseEvidenceStatisticSampleSizeComponentProperties(JsonObject json, Evidence.EvidenceStatisticSampleSizeComponent res) throws IOException, FHIRFormatError {
14574    parseBackboneElementProperties(json, res);
14575    if (json.has("description"))
14576      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14577    if (json.has("_description"))
14578      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14579    if (json.has("note")) {
14580      JsonArray array = getJArray(json, "note");
14581      for (int i = 0; i < array.size(); i++) {
14582        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14583      }
14584    };
14585    if (json.has("numberOfStudies"))
14586      res.setNumberOfStudiesElement(parseUnsignedInt(json.get("numberOfStudies").getAsString()));
14587    if (json.has("_numberOfStudies"))
14588      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
14589    if (json.has("numberOfParticipants"))
14590      res.setNumberOfParticipantsElement(parseUnsignedInt(json.get("numberOfParticipants").getAsString()));
14591    if (json.has("_numberOfParticipants"))
14592      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
14593    if (json.has("knownDataCount"))
14594      res.setKnownDataCountElement(parseUnsignedInt(json.get("knownDataCount").getAsString()));
14595    if (json.has("_knownDataCount"))
14596      parseElementProperties(getJObject(json, "_knownDataCount"), res.getKnownDataCountElement());
14597  }
14598
14599  protected Evidence.EvidenceStatisticAttributeEstimateComponent parseEvidenceStatisticAttributeEstimateComponent(JsonObject json) throws IOException, FHIRFormatError {
14600    Evidence.EvidenceStatisticAttributeEstimateComponent res = new Evidence.EvidenceStatisticAttributeEstimateComponent();
14601    parseEvidenceStatisticAttributeEstimateComponentProperties(json, res);
14602    return res;
14603  }
14604
14605  protected void parseEvidenceStatisticAttributeEstimateComponentProperties(JsonObject json, Evidence.EvidenceStatisticAttributeEstimateComponent res) throws IOException, FHIRFormatError {
14606    parseBackboneElementProperties(json, res);
14607    if (json.has("description"))
14608      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14609    if (json.has("_description"))
14610      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14611    if (json.has("note")) {
14612      JsonArray array = getJArray(json, "note");
14613      for (int i = 0; i < array.size(); i++) {
14614        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14615      }
14616    };
14617    if (json.has("type"))
14618      res.setType(parseCodeableConcept(getJObject(json, "type")));
14619    if (json.has("quantity"))
14620      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
14621    if (json.has("level"))
14622      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
14623    if (json.has("_level"))
14624      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
14625    if (json.has("range"))
14626      res.setRange(parseRange(getJObject(json, "range")));
14627    if (json.has("attributeEstimate")) {
14628      JsonArray array = getJArray(json, "attributeEstimate");
14629      for (int i = 0; i < array.size(); i++) {
14630        res.getAttributeEstimate().add(parseEvidenceStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject()));
14631      }
14632    };
14633  }
14634
14635  protected Evidence.EvidenceStatisticModelCharacteristicComponent parseEvidenceStatisticModelCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
14636    Evidence.EvidenceStatisticModelCharacteristicComponent res = new Evidence.EvidenceStatisticModelCharacteristicComponent();
14637    parseEvidenceStatisticModelCharacteristicComponentProperties(json, res);
14638    return res;
14639  }
14640
14641  protected void parseEvidenceStatisticModelCharacteristicComponentProperties(JsonObject json, Evidence.EvidenceStatisticModelCharacteristicComponent res) throws IOException, FHIRFormatError {
14642    parseBackboneElementProperties(json, res);
14643    if (json.has("code"))
14644      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14645    if (json.has("value"))
14646      res.setValue(parseQuantity(getJObject(json, "value")));
14647    if (json.has("variable")) {
14648      JsonArray array = getJArray(json, "variable");
14649      for (int i = 0; i < array.size(); i++) {
14650        res.getVariable().add(parseEvidenceStatisticModelCharacteristicVariableComponent(array.get(i).getAsJsonObject()));
14651      }
14652    };
14653    if (json.has("attributeEstimate")) {
14654      JsonArray array = getJArray(json, "attributeEstimate");
14655      for (int i = 0; i < array.size(); i++) {
14656        res.getAttributeEstimate().add(parseEvidenceStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject()));
14657      }
14658    };
14659  }
14660
14661  protected Evidence.EvidenceStatisticModelCharacteristicVariableComponent parseEvidenceStatisticModelCharacteristicVariableComponent(JsonObject json) throws IOException, FHIRFormatError {
14662    Evidence.EvidenceStatisticModelCharacteristicVariableComponent res = new Evidence.EvidenceStatisticModelCharacteristicVariableComponent();
14663    parseEvidenceStatisticModelCharacteristicVariableComponentProperties(json, res);
14664    return res;
14665  }
14666
14667  protected void parseEvidenceStatisticModelCharacteristicVariableComponentProperties(JsonObject json, Evidence.EvidenceStatisticModelCharacteristicVariableComponent res) throws IOException, FHIRFormatError {
14668    parseBackboneElementProperties(json, res);
14669    if (json.has("variableDefinition"))
14670      res.setVariableDefinition(parseReference(getJObject(json, "variableDefinition")));
14671    if (json.has("handling"))
14672      res.setHandlingElement(parseEnumeration(json.get("handling").getAsString(), Enumerations.EvidenceVariableHandling.NULL, new Enumerations.EvidenceVariableHandlingEnumFactory()));
14673    if (json.has("_handling"))
14674      parseElementProperties(getJObject(json, "_handling"), res.getHandlingElement());
14675    if (json.has("valueCategory")) {
14676      JsonArray array = getJArray(json, "valueCategory");
14677      for (int i = 0; i < array.size(); i++) {
14678        res.getValueCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14679      }
14680    };
14681    if (json.has("valueQuantity")) {
14682      JsonArray array = getJArray(json, "valueQuantity");
14683      for (int i = 0; i < array.size(); i++) {
14684        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
14685      }
14686    };
14687    if (json.has("valueRange")) {
14688      JsonArray array = getJArray(json, "valueRange");
14689      for (int i = 0; i < array.size(); i++) {
14690        res.getValueRange().add(parseRange(array.get(i).getAsJsonObject()));
14691      }
14692    };
14693  }
14694
14695  protected Evidence.EvidenceCertaintyComponent parseEvidenceCertaintyComponent(JsonObject json) throws IOException, FHIRFormatError {
14696    Evidence.EvidenceCertaintyComponent res = new Evidence.EvidenceCertaintyComponent();
14697    parseEvidenceCertaintyComponentProperties(json, res);
14698    return res;
14699  }
14700
14701  protected void parseEvidenceCertaintyComponentProperties(JsonObject json, Evidence.EvidenceCertaintyComponent res) throws IOException, FHIRFormatError {
14702    parseBackboneElementProperties(json, res);
14703    if (json.has("description"))
14704      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14705    if (json.has("_description"))
14706      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14707    if (json.has("note")) {
14708      JsonArray array = getJArray(json, "note");
14709      for (int i = 0; i < array.size(); i++) {
14710        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14711      }
14712    };
14713    if (json.has("type"))
14714      res.setType(parseCodeableConcept(getJObject(json, "type")));
14715    if (json.has("rating"))
14716      res.setRating(parseCodeableConcept(getJObject(json, "rating")));
14717    if (json.has("rater"))
14718      res.setRaterElement(parseString(json.get("rater").getAsString()));
14719    if (json.has("_rater"))
14720      parseElementProperties(getJObject(json, "_rater"), res.getRaterElement());
14721    if (json.has("subcomponent")) {
14722      JsonArray array = getJArray(json, "subcomponent");
14723      for (int i = 0; i < array.size(); i++) {
14724        res.getSubcomponent().add(parseEvidenceCertaintyComponent(array.get(i).getAsJsonObject()));
14725      }
14726    };
14727  }
14728
14729  protected EvidenceReport parseEvidenceReport(JsonObject json) throws IOException, FHIRFormatError {
14730    EvidenceReport res = new EvidenceReport();
14731    parseEvidenceReportProperties(json, res);
14732    return res;
14733  }
14734
14735  protected void parseEvidenceReportProperties(JsonObject json, EvidenceReport res) throws IOException, FHIRFormatError {
14736    parseMetadataResourceProperties(json, res);
14737    if (json.has("url"))
14738      res.setUrlElement(parseUri(json.get("url").getAsString()));
14739    if (json.has("_url"))
14740      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14741    if (json.has("status"))
14742      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14743    if (json.has("_status"))
14744      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14745    if (json.has("useContext")) {
14746      JsonArray array = getJArray(json, "useContext");
14747      for (int i = 0; i < array.size(); i++) {
14748        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14749      }
14750    };
14751    if (json.has("identifier")) {
14752      JsonArray array = getJArray(json, "identifier");
14753      for (int i = 0; i < array.size(); i++) {
14754        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14755      }
14756    };
14757    if (json.has("relatedIdentifier")) {
14758      JsonArray array = getJArray(json, "relatedIdentifier");
14759      for (int i = 0; i < array.size(); i++) {
14760        res.getRelatedIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14761      }
14762    };
14763    DataType citeAs = parseType("citeAs", json);
14764    if (citeAs != null)
14765      res.setCiteAs(citeAs);
14766    if (json.has("type"))
14767      res.setType(parseCodeableConcept(getJObject(json, "type")));
14768    if (json.has("note")) {
14769      JsonArray array = getJArray(json, "note");
14770      for (int i = 0; i < array.size(); i++) {
14771        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14772      }
14773    };
14774    if (json.has("relatedArtifact")) {
14775      JsonArray array = getJArray(json, "relatedArtifact");
14776      for (int i = 0; i < array.size(); i++) {
14777        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14778      }
14779    };
14780    if (json.has("subject"))
14781      res.setSubject(parseEvidenceReportSubjectComponent(getJObject(json, "subject")));
14782    if (json.has("publisher"))
14783      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14784    if (json.has("_publisher"))
14785      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14786    if (json.has("contact")) {
14787      JsonArray array = getJArray(json, "contact");
14788      for (int i = 0; i < array.size(); i++) {
14789        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14790      }
14791    };
14792    if (json.has("author")) {
14793      JsonArray array = getJArray(json, "author");
14794      for (int i = 0; i < array.size(); i++) {
14795        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14796      }
14797    };
14798    if (json.has("editor")) {
14799      JsonArray array = getJArray(json, "editor");
14800      for (int i = 0; i < array.size(); i++) {
14801        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14802      }
14803    };
14804    if (json.has("reviewer")) {
14805      JsonArray array = getJArray(json, "reviewer");
14806      for (int i = 0; i < array.size(); i++) {
14807        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14808      }
14809    };
14810    if (json.has("endorser")) {
14811      JsonArray array = getJArray(json, "endorser");
14812      for (int i = 0; i < array.size(); i++) {
14813        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14814      }
14815    };
14816    if (json.has("relatesTo")) {
14817      JsonArray array = getJArray(json, "relatesTo");
14818      for (int i = 0; i < array.size(); i++) {
14819        res.getRelatesTo().add(parseEvidenceReportRelatesToComponent(array.get(i).getAsJsonObject()));
14820      }
14821    };
14822    if (json.has("section")) {
14823      JsonArray array = getJArray(json, "section");
14824      for (int i = 0; i < array.size(); i++) {
14825        res.getSection().add(parseEvidenceReportSectionComponent(array.get(i).getAsJsonObject()));
14826      }
14827    };
14828  }
14829
14830  protected EvidenceReport.EvidenceReportSubjectComponent parseEvidenceReportSubjectComponent(JsonObject json) throws IOException, FHIRFormatError {
14831    EvidenceReport.EvidenceReportSubjectComponent res = new EvidenceReport.EvidenceReportSubjectComponent();
14832    parseEvidenceReportSubjectComponentProperties(json, res);
14833    return res;
14834  }
14835
14836  protected void parseEvidenceReportSubjectComponentProperties(JsonObject json, EvidenceReport.EvidenceReportSubjectComponent res) throws IOException, FHIRFormatError {
14837    parseBackboneElementProperties(json, res);
14838    if (json.has("characteristic")) {
14839      JsonArray array = getJArray(json, "characteristic");
14840      for (int i = 0; i < array.size(); i++) {
14841        res.getCharacteristic().add(parseEvidenceReportSubjectCharacteristicComponent(array.get(i).getAsJsonObject()));
14842      }
14843    };
14844    if (json.has("note")) {
14845      JsonArray array = getJArray(json, "note");
14846      for (int i = 0; i < array.size(); i++) {
14847        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14848      }
14849    };
14850  }
14851
14852  protected EvidenceReport.EvidenceReportSubjectCharacteristicComponent parseEvidenceReportSubjectCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
14853    EvidenceReport.EvidenceReportSubjectCharacteristicComponent res = new EvidenceReport.EvidenceReportSubjectCharacteristicComponent();
14854    parseEvidenceReportSubjectCharacteristicComponentProperties(json, res);
14855    return res;
14856  }
14857
14858  protected void parseEvidenceReportSubjectCharacteristicComponentProperties(JsonObject json, EvidenceReport.EvidenceReportSubjectCharacteristicComponent res) throws IOException, FHIRFormatError {
14859    parseBackboneElementProperties(json, res);
14860    if (json.has("code"))
14861      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14862    DataType value = parseType("value", json);
14863    if (value != null)
14864      res.setValue(value);
14865    if (json.has("exclude"))
14866      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
14867    if (json.has("_exclude"))
14868      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
14869    if (json.has("period"))
14870      res.setPeriod(parsePeriod(getJObject(json, "period")));
14871  }
14872
14873  protected EvidenceReport.EvidenceReportRelatesToComponent parseEvidenceReportRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
14874    EvidenceReport.EvidenceReportRelatesToComponent res = new EvidenceReport.EvidenceReportRelatesToComponent();
14875    parseEvidenceReportRelatesToComponentProperties(json, res);
14876    return res;
14877  }
14878
14879  protected void parseEvidenceReportRelatesToComponentProperties(JsonObject json, EvidenceReport.EvidenceReportRelatesToComponent res) throws IOException, FHIRFormatError {
14880    parseBackboneElementProperties(json, res);
14881    if (json.has("code"))
14882      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), EvidenceReport.ReportRelationshipType.NULL, new EvidenceReport.ReportRelationshipTypeEnumFactory()));
14883    if (json.has("_code"))
14884      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
14885    if (json.has("target"))
14886      res.setTarget(parseEvidenceReportRelatesToTargetComponent(getJObject(json, "target")));
14887  }
14888
14889  protected EvidenceReport.EvidenceReportRelatesToTargetComponent parseEvidenceReportRelatesToTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
14890    EvidenceReport.EvidenceReportRelatesToTargetComponent res = new EvidenceReport.EvidenceReportRelatesToTargetComponent();
14891    parseEvidenceReportRelatesToTargetComponentProperties(json, res);
14892    return res;
14893  }
14894
14895  protected void parseEvidenceReportRelatesToTargetComponentProperties(JsonObject json, EvidenceReport.EvidenceReportRelatesToTargetComponent res) throws IOException, FHIRFormatError {
14896    parseBackboneElementProperties(json, res);
14897    if (json.has("url"))
14898      res.setUrlElement(parseUri(json.get("url").getAsString()));
14899    if (json.has("_url"))
14900      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14901    if (json.has("identifier"))
14902      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
14903    if (json.has("display"))
14904      res.setDisplayElement(parseMarkdown(json.get("display").getAsString()));
14905    if (json.has("_display"))
14906      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
14907    if (json.has("resource"))
14908      res.setResource(parseReference(getJObject(json, "resource")));
14909  }
14910
14911  protected EvidenceReport.SectionComponent parseEvidenceReportSectionComponent(JsonObject json) throws IOException, FHIRFormatError {
14912    EvidenceReport.SectionComponent res = new EvidenceReport.SectionComponent();
14913    parseEvidenceReportSectionComponentProperties(json, res);
14914    return res;
14915  }
14916
14917  protected void parseEvidenceReportSectionComponentProperties(JsonObject json, EvidenceReport.SectionComponent res) throws IOException, FHIRFormatError {
14918    parseBackboneElementProperties(json, res);
14919    if (json.has("title"))
14920      res.setTitleElement(parseString(json.get("title").getAsString()));
14921    if (json.has("_title"))
14922      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14923    if (json.has("focus"))
14924      res.setFocus(parseCodeableConcept(getJObject(json, "focus")));
14925    if (json.has("focusReference"))
14926      res.setFocusReference(parseReference(getJObject(json, "focusReference")));
14927    if (json.has("author")) {
14928      JsonArray array = getJArray(json, "author");
14929      for (int i = 0; i < array.size(); i++) {
14930        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
14931      }
14932    };
14933    if (json.has("text"))
14934      res.setText(parseNarrative(getJObject(json, "text")));
14935    if (json.has("mode"))
14936      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
14937    if (json.has("_mode"))
14938      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
14939    if (json.has("orderedBy"))
14940      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
14941    if (json.has("entryClassifier")) {
14942      JsonArray array = getJArray(json, "entryClassifier");
14943      for (int i = 0; i < array.size(); i++) {
14944        res.getEntryClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14945      }
14946    };
14947    if (json.has("entryReference")) {
14948      JsonArray array = getJArray(json, "entryReference");
14949      for (int i = 0; i < array.size(); i++) {
14950        res.getEntryReference().add(parseReference(array.get(i).getAsJsonObject()));
14951      }
14952    };
14953    if (json.has("entryQuantity")) {
14954      JsonArray array = getJArray(json, "entryQuantity");
14955      for (int i = 0; i < array.size(); i++) {
14956        res.getEntryQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
14957      }
14958    };
14959    if (json.has("emptyReason"))
14960      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
14961    if (json.has("section")) {
14962      JsonArray array = getJArray(json, "section");
14963      for (int i = 0; i < array.size(); i++) {
14964        res.getSection().add(parseEvidenceReportSectionComponent(array.get(i).getAsJsonObject()));
14965      }
14966    };
14967  }
14968
14969  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
14970    EvidenceVariable res = new EvidenceVariable();
14971    parseEvidenceVariableProperties(json, res);
14972    return res;
14973  }
14974
14975  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
14976    parseMetadataResourceProperties(json, res);
14977    if (json.has("url"))
14978      res.setUrlElement(parseUri(json.get("url").getAsString()));
14979    if (json.has("_url"))
14980      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14981    if (json.has("identifier")) {
14982      JsonArray array = getJArray(json, "identifier");
14983      for (int i = 0; i < array.size(); i++) {
14984        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14985      }
14986    };
14987    if (json.has("version"))
14988      res.setVersionElement(parseString(json.get("version").getAsString()));
14989    if (json.has("_version"))
14990      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14991    DataType versionAlgorithm = parseType("versionAlgorithm", json);
14992    if (versionAlgorithm != null)
14993      res.setVersionAlgorithm(versionAlgorithm);
14994    if (json.has("name"))
14995      res.setNameElement(parseString(json.get("name").getAsString()));
14996    if (json.has("_name"))
14997      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14998    if (json.has("title"))
14999      res.setTitleElement(parseString(json.get("title").getAsString()));
15000    if (json.has("_title"))
15001      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15002    if (json.has("shortTitle"))
15003      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
15004    if (json.has("_shortTitle"))
15005      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
15006    if (json.has("status"))
15007      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15008    if (json.has("_status"))
15009      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15010    if (json.has("experimental"))
15011      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15012    if (json.has("_experimental"))
15013      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
15014    if (json.has("date"))
15015      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15016    if (json.has("_date"))
15017      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15018    if (json.has("publisher"))
15019      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15020    if (json.has("_publisher"))
15021      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
15022    if (json.has("contact")) {
15023      JsonArray array = getJArray(json, "contact");
15024      for (int i = 0; i < array.size(); i++) {
15025        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15026      }
15027    };
15028    if (json.has("description"))
15029      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15030    if (json.has("_description"))
15031      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15032    if (json.has("note")) {
15033      JsonArray array = getJArray(json, "note");
15034      for (int i = 0; i < array.size(); i++) {
15035        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15036      }
15037    };
15038    if (json.has("useContext")) {
15039      JsonArray array = getJArray(json, "useContext");
15040      for (int i = 0; i < array.size(); i++) {
15041        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15042      }
15043    };
15044    if (json.has("purpose"))
15045      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15046    if (json.has("_purpose"))
15047      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
15048    if (json.has("copyright"))
15049      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15050    if (json.has("_copyright"))
15051      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
15052    if (json.has("copyrightLabel"))
15053      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
15054    if (json.has("_copyrightLabel"))
15055      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
15056    if (json.has("approvalDate"))
15057      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15058    if (json.has("_approvalDate"))
15059      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
15060    if (json.has("lastReviewDate"))
15061      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15062    if (json.has("_lastReviewDate"))
15063      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
15064    if (json.has("effectivePeriod"))
15065      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
15066    if (json.has("author")) {
15067      JsonArray array = getJArray(json, "author");
15068      for (int i = 0; i < array.size(); i++) {
15069        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15070      }
15071    };
15072    if (json.has("editor")) {
15073      JsonArray array = getJArray(json, "editor");
15074      for (int i = 0; i < array.size(); i++) {
15075        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15076      }
15077    };
15078    if (json.has("reviewer")) {
15079      JsonArray array = getJArray(json, "reviewer");
15080      for (int i = 0; i < array.size(); i++) {
15081        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
15082      }
15083    };
15084    if (json.has("endorser")) {
15085      JsonArray array = getJArray(json, "endorser");
15086      for (int i = 0; i < array.size(); i++) {
15087        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
15088      }
15089    };
15090    if (json.has("relatedArtifact")) {
15091      JsonArray array = getJArray(json, "relatedArtifact");
15092      for (int i = 0; i < array.size(); i++) {
15093        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15094      }
15095    };
15096    if (json.has("actual"))
15097      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
15098    if (json.has("_actual"))
15099      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
15100    if (json.has("characteristic")) {
15101      JsonArray array = getJArray(json, "characteristic");
15102      for (int i = 0; i < array.size(); i++) {
15103        res.getCharacteristic().add(parseEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject()));
15104      }
15105    };
15106    if (json.has("handling"))
15107      res.setHandlingElement(parseEnumeration(json.get("handling").getAsString(), Enumerations.EvidenceVariableHandling.NULL, new Enumerations.EvidenceVariableHandlingEnumFactory()));
15108    if (json.has("_handling"))
15109      parseElementProperties(getJObject(json, "_handling"), res.getHandlingElement());
15110    if (json.has("category")) {
15111      JsonArray array = getJArray(json, "category");
15112      for (int i = 0; i < array.size(); i++) {
15113        res.getCategory().add(parseEvidenceVariableCategoryComponent(array.get(i).getAsJsonObject()));
15114      }
15115    };
15116  }
15117
15118  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
15119    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
15120    parseEvidenceVariableCharacteristicComponentProperties(json, res);
15121    return res;
15122  }
15123
15124  protected void parseEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
15125    parseBackboneElementProperties(json, res);
15126    if (json.has("linkId"))
15127      res.setLinkIdElement(parseId(json.get("linkId").getAsString()));
15128    if (json.has("_linkId"))
15129      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
15130    if (json.has("description"))
15131      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15132    if (json.has("_description"))
15133      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15134    if (json.has("note")) {
15135      JsonArray array = getJArray(json, "note");
15136      for (int i = 0; i < array.size(); i++) {
15137        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15138      }
15139    };
15140    if (json.has("exclude"))
15141      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
15142    if (json.has("_exclude"))
15143      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
15144    if (json.has("definitionReference"))
15145      res.setDefinitionReference(parseReference(getJObject(json, "definitionReference")));
15146    if (json.has("definitionCanonical"))
15147      res.setDefinitionCanonicalElement(parseCanonical(json.get("definitionCanonical").getAsString()));
15148    if (json.has("_definitionCanonical"))
15149      parseElementProperties(getJObject(json, "_definitionCanonical"), res.getDefinitionCanonicalElement());
15150    if (json.has("definitionCodeableConcept"))
15151      res.setDefinitionCodeableConcept(parseCodeableConcept(getJObject(json, "definitionCodeableConcept")));
15152    if (json.has("definitionExpression"))
15153      res.setDefinitionExpression(parseExpression(getJObject(json, "definitionExpression")));
15154    if (json.has("definitionId"))
15155      res.setDefinitionIdElement(parseId(json.get("definitionId").getAsString()));
15156    if (json.has("_definitionId"))
15157      parseElementProperties(getJObject(json, "_definitionId"), res.getDefinitionIdElement());
15158    if (json.has("definitionByTypeAndValue"))
15159      res.setDefinitionByTypeAndValue(parseEvidenceVariableCharacteristicDefinitionByTypeAndValueComponent(getJObject(json, "definitionByTypeAndValue")));
15160    if (json.has("definitionByCombination"))
15161      res.setDefinitionByCombination(parseEvidenceVariableCharacteristicDefinitionByCombinationComponent(getJObject(json, "definitionByCombination")));
15162    DataType instances = parseType("instances", json);
15163    if (instances != null)
15164      res.setInstances(instances);
15165    DataType duration = parseType("duration", json);
15166    if (duration != null)
15167      res.setDuration(duration);
15168    if (json.has("timeFromEvent")) {
15169      JsonArray array = getJArray(json, "timeFromEvent");
15170      for (int i = 0; i < array.size(); i++) {
15171        res.getTimeFromEvent().add(parseEvidenceVariableCharacteristicTimeFromEventComponent(array.get(i).getAsJsonObject()));
15172      }
15173    };
15174  }
15175
15176  protected EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent parseEvidenceVariableCharacteristicDefinitionByTypeAndValueComponent(JsonObject json) throws IOException, FHIRFormatError {
15177    EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent res = new EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent();
15178    parseEvidenceVariableCharacteristicDefinitionByTypeAndValueComponentProperties(json, res);
15179    return res;
15180  }
15181
15182  protected void parseEvidenceVariableCharacteristicDefinitionByTypeAndValueComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent res) throws IOException, FHIRFormatError {
15183    parseBackboneElementProperties(json, res);
15184    if (json.has("type"))
15185      res.setType(parseCodeableConcept(getJObject(json, "type")));
15186    if (json.has("method")) {
15187      JsonArray array = getJArray(json, "method");
15188      for (int i = 0; i < array.size(); i++) {
15189        res.getMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15190      }
15191    };
15192    if (json.has("device"))
15193      res.setDevice(parseReference(getJObject(json, "device")));
15194    DataType value = parseType("value", json);
15195    if (value != null)
15196      res.setValue(value);
15197    if (json.has("offset"))
15198      res.setOffset(parseCodeableConcept(getJObject(json, "offset")));
15199  }
15200
15201  protected EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent parseEvidenceVariableCharacteristicDefinitionByCombinationComponent(JsonObject json) throws IOException, FHIRFormatError {
15202    EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent res = new EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent();
15203    parseEvidenceVariableCharacteristicDefinitionByCombinationComponentProperties(json, res);
15204    return res;
15205  }
15206
15207  protected void parseEvidenceVariableCharacteristicDefinitionByCombinationComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent res) throws IOException, FHIRFormatError {
15208    parseBackboneElementProperties(json, res);
15209    if (json.has("code"))
15210      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), EvidenceVariable.CharacteristicCombination.NULL, new EvidenceVariable.CharacteristicCombinationEnumFactory()));
15211    if (json.has("_code"))
15212      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
15213    if (json.has("threshold"))
15214      res.setThresholdElement(parsePositiveInt(json.get("threshold").getAsString()));
15215    if (json.has("_threshold"))
15216      parseElementProperties(getJObject(json, "_threshold"), res.getThresholdElement());
15217    if (json.has("characteristic")) {
15218      JsonArray array = getJArray(json, "characteristic");
15219      for (int i = 0; i < array.size(); i++) {
15220        res.getCharacteristic().add(parseEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject()));
15221      }
15222    };
15223  }
15224
15225  protected EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent parseEvidenceVariableCharacteristicTimeFromEventComponent(JsonObject json) throws IOException, FHIRFormatError {
15226    EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent res = new EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent();
15227    parseEvidenceVariableCharacteristicTimeFromEventComponentProperties(json, res);
15228    return res;
15229  }
15230
15231  protected void parseEvidenceVariableCharacteristicTimeFromEventComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent res) throws IOException, FHIRFormatError {
15232    parseBackboneElementProperties(json, res);
15233    if (json.has("description"))
15234      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15235    if (json.has("_description"))
15236      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15237    if (json.has("note")) {
15238      JsonArray array = getJArray(json, "note");
15239      for (int i = 0; i < array.size(); i++) {
15240        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15241      }
15242    };
15243    DataType event = parseType("event", json);
15244    if (event != null)
15245      res.setEvent(event);
15246    if (json.has("quantity"))
15247      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
15248    if (json.has("range"))
15249      res.setRange(parseRange(getJObject(json, "range")));
15250  }
15251
15252  protected EvidenceVariable.EvidenceVariableCategoryComponent parseEvidenceVariableCategoryComponent(JsonObject json) throws IOException, FHIRFormatError {
15253    EvidenceVariable.EvidenceVariableCategoryComponent res = new EvidenceVariable.EvidenceVariableCategoryComponent();
15254    parseEvidenceVariableCategoryComponentProperties(json, res);
15255    return res;
15256  }
15257
15258  protected void parseEvidenceVariableCategoryComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCategoryComponent res) throws IOException, FHIRFormatError {
15259    parseBackboneElementProperties(json, res);
15260    if (json.has("name"))
15261      res.setNameElement(parseString(json.get("name").getAsString()));
15262    if (json.has("_name"))
15263      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15264    DataType value = parseType("value", json);
15265    if (value != null)
15266      res.setValue(value);
15267  }
15268
15269  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
15270    ExampleScenario res = new ExampleScenario();
15271    parseExampleScenarioProperties(json, res);
15272    return res;
15273  }
15274
15275  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
15276    parseCanonicalResourceProperties(json, res);
15277    if (json.has("url"))
15278      res.setUrlElement(parseUri(json.get("url").getAsString()));
15279    if (json.has("_url"))
15280      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
15281    if (json.has("identifier")) {
15282      JsonArray array = getJArray(json, "identifier");
15283      for (int i = 0; i < array.size(); i++) {
15284        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15285      }
15286    };
15287    if (json.has("version"))
15288      res.setVersionElement(parseString(json.get("version").getAsString()));
15289    if (json.has("_version"))
15290      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
15291    DataType versionAlgorithm = parseType("versionAlgorithm", json);
15292    if (versionAlgorithm != null)
15293      res.setVersionAlgorithm(versionAlgorithm);
15294    if (json.has("name"))
15295      res.setNameElement(parseString(json.get("name").getAsString()));
15296    if (json.has("_name"))
15297      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15298    if (json.has("title"))
15299      res.setTitleElement(parseString(json.get("title").getAsString()));
15300    if (json.has("_title"))
15301      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15302    if (json.has("status"))
15303      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15304    if (json.has("_status"))
15305      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15306    if (json.has("experimental"))
15307      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15308    if (json.has("_experimental"))
15309      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
15310    if (json.has("date"))
15311      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15312    if (json.has("_date"))
15313      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15314    if (json.has("publisher"))
15315      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15316    if (json.has("_publisher"))
15317      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
15318    if (json.has("contact")) {
15319      JsonArray array = getJArray(json, "contact");
15320      for (int i = 0; i < array.size(); i++) {
15321        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15322      }
15323    };
15324    if (json.has("description"))
15325      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15326    if (json.has("_description"))
15327      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15328    if (json.has("useContext")) {
15329      JsonArray array = getJArray(json, "useContext");
15330      for (int i = 0; i < array.size(); i++) {
15331        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15332      }
15333    };
15334    if (json.has("jurisdiction")) {
15335      JsonArray array = getJArray(json, "jurisdiction");
15336      for (int i = 0; i < array.size(); i++) {
15337        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15338      }
15339    };
15340    if (json.has("purpose"))
15341      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15342    if (json.has("_purpose"))
15343      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
15344    if (json.has("copyright"))
15345      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15346    if (json.has("_copyright"))
15347      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
15348    if (json.has("copyrightLabel"))
15349      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
15350    if (json.has("_copyrightLabel"))
15351      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
15352    if (json.has("actor")) {
15353      JsonArray array = getJArray(json, "actor");
15354      for (int i = 0; i < array.size(); i++) {
15355        res.getActor().add(parseExampleScenarioActorComponent(array.get(i).getAsJsonObject()));
15356      }
15357    };
15358    if (json.has("instance")) {
15359      JsonArray array = getJArray(json, "instance");
15360      for (int i = 0; i < array.size(); i++) {
15361        res.getInstance().add(parseExampleScenarioInstanceComponent(array.get(i).getAsJsonObject()));
15362      }
15363    };
15364    if (json.has("process")) {
15365      JsonArray array = getJArray(json, "process");
15366      for (int i = 0; i < array.size(); i++) {
15367        res.getProcess().add(parseExampleScenarioProcessComponent(array.get(i).getAsJsonObject()));
15368      }
15369    };
15370  }
15371
15372  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioActorComponent(JsonObject json) throws IOException, FHIRFormatError {
15373    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
15374    parseExampleScenarioActorComponentProperties(json, res);
15375    return res;
15376  }
15377
15378  protected void parseExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
15379    parseBackboneElementProperties(json, res);
15380    if (json.has("key"))
15381      res.setKeyElement(parseString(json.get("key").getAsString()));
15382    if (json.has("_key"))
15383      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
15384    if (json.has("type"))
15385      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ExampleScenarioActorType.NULL, new Enumerations.ExampleScenarioActorTypeEnumFactory()));
15386    if (json.has("_type"))
15387      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15388    if (json.has("title"))
15389      res.setTitleElement(parseString(json.get("title").getAsString()));
15390    if (json.has("_title"))
15391      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15392    if (json.has("description"))
15393      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15394    if (json.has("_description"))
15395      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15396  }
15397
15398  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
15399    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
15400    parseExampleScenarioInstanceComponentProperties(json, res);
15401    return res;
15402  }
15403
15404  protected void parseExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
15405    parseBackboneElementProperties(json, res);
15406    if (json.has("key"))
15407      res.setKeyElement(parseString(json.get("key").getAsString()));
15408    if (json.has("_key"))
15409      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
15410    if (json.has("structureType"))
15411      res.setStructureType(parseCoding(getJObject(json, "structureType")));
15412    if (json.has("structureVersion"))
15413      res.setStructureVersionElement(parseString(json.get("structureVersion").getAsString()));
15414    if (json.has("_structureVersion"))
15415      parseElementProperties(getJObject(json, "_structureVersion"), res.getStructureVersionElement());
15416    DataType structureProfile = parseType("structureProfile", json);
15417    if (structureProfile != null)
15418      res.setStructureProfile(structureProfile);
15419    if (json.has("title"))
15420      res.setTitleElement(parseString(json.get("title").getAsString()));
15421    if (json.has("_title"))
15422      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15423    if (json.has("description"))
15424      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15425    if (json.has("_description"))
15426      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15427    if (json.has("content"))
15428      res.setContent(parseReference(getJObject(json, "content")));
15429    if (json.has("version")) {
15430      JsonArray array = getJArray(json, "version");
15431      for (int i = 0; i < array.size(); i++) {
15432        res.getVersion().add(parseExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject()));
15433      }
15434    };
15435    if (json.has("containedInstance")) {
15436      JsonArray array = getJArray(json, "containedInstance");
15437      for (int i = 0; i < array.size(); i++) {
15438        res.getContainedInstance().add(parseExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject()));
15439      }
15440    };
15441  }
15442
15443  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioInstanceVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
15444    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
15445    parseExampleScenarioInstanceVersionComponentProperties(json, res);
15446    return res;
15447  }
15448
15449  protected void parseExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
15450    parseBackboneElementProperties(json, res);
15451    if (json.has("key"))
15452      res.setKeyElement(parseString(json.get("key").getAsString()));
15453    if (json.has("_key"))
15454      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
15455    if (json.has("title"))
15456      res.setTitleElement(parseString(json.get("title").getAsString()));
15457    if (json.has("_title"))
15458      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15459    if (json.has("description"))
15460      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15461    if (json.has("_description"))
15462      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15463    if (json.has("content"))
15464      res.setContent(parseReference(getJObject(json, "content")));
15465  }
15466
15467  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioInstanceContainedInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
15468    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
15469    parseExampleScenarioInstanceContainedInstanceComponentProperties(json, res);
15470    return res;
15471  }
15472
15473  protected void parseExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
15474    parseBackboneElementProperties(json, res);
15475    if (json.has("instanceReference"))
15476      res.setInstanceReferenceElement(parseString(json.get("instanceReference").getAsString()));
15477    if (json.has("_instanceReference"))
15478      parseElementProperties(getJObject(json, "_instanceReference"), res.getInstanceReferenceElement());
15479    if (json.has("versionReference"))
15480      res.setVersionReferenceElement(parseString(json.get("versionReference").getAsString()));
15481    if (json.has("_versionReference"))
15482      parseElementProperties(getJObject(json, "_versionReference"), res.getVersionReferenceElement());
15483  }
15484
15485  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioProcessComponent(JsonObject json) throws IOException, FHIRFormatError {
15486    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
15487    parseExampleScenarioProcessComponentProperties(json, res);
15488    return res;
15489  }
15490
15491  protected void parseExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
15492    parseBackboneElementProperties(json, res);
15493    if (json.has("title"))
15494      res.setTitleElement(parseString(json.get("title").getAsString()));
15495    if (json.has("_title"))
15496      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15497    if (json.has("description"))
15498      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15499    if (json.has("_description"))
15500      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15501    if (json.has("preConditions"))
15502      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
15503    if (json.has("_preConditions"))
15504      parseElementProperties(getJObject(json, "_preConditions"), res.getPreConditionsElement());
15505    if (json.has("postConditions"))
15506      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
15507    if (json.has("_postConditions"))
15508      parseElementProperties(getJObject(json, "_postConditions"), res.getPostConditionsElement());
15509    if (json.has("step")) {
15510      JsonArray array = getJArray(json, "step");
15511      for (int i = 0; i < array.size(); i++) {
15512        res.getStep().add(parseExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject()));
15513      }
15514    };
15515  }
15516
15517  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioProcessStepComponent(JsonObject json) throws IOException, FHIRFormatError {
15518    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
15519    parseExampleScenarioProcessStepComponentProperties(json, res);
15520    return res;
15521  }
15522
15523  protected void parseExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
15524    parseBackboneElementProperties(json, res);
15525    if (json.has("number"))
15526      res.setNumberElement(parseString(json.get("number").getAsString()));
15527    if (json.has("_number"))
15528      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
15529    if (json.has("process"))
15530      res.setProcess(parseExampleScenarioProcessComponent(getJObject(json, "process")));
15531    if (json.has("workflow"))
15532      res.setWorkflowElement(parseCanonical(json.get("workflow").getAsString()));
15533    if (json.has("_workflow"))
15534      parseElementProperties(getJObject(json, "_workflow"), res.getWorkflowElement());
15535    if (json.has("operation"))
15536      res.setOperation(parseExampleScenarioProcessStepOperationComponent(getJObject(json, "operation")));
15537    if (json.has("alternative")) {
15538      JsonArray array = getJArray(json, "alternative");
15539      for (int i = 0; i < array.size(); i++) {
15540        res.getAlternative().add(parseExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject()));
15541      }
15542    };
15543    if (json.has("pause"))
15544      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
15545    if (json.has("_pause"))
15546      parseElementProperties(getJObject(json, "_pause"), res.getPauseElement());
15547  }
15548
15549  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioProcessStepOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
15550    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
15551    parseExampleScenarioProcessStepOperationComponentProperties(json, res);
15552    return res;
15553  }
15554
15555  protected void parseExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
15556    parseBackboneElementProperties(json, res);
15557    if (json.has("type"))
15558      res.setType(parseCoding(getJObject(json, "type")));
15559    if (json.has("title"))
15560      res.setTitleElement(parseString(json.get("title").getAsString()));
15561    if (json.has("_title"))
15562      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15563    if (json.has("initiator"))
15564      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
15565    if (json.has("_initiator"))
15566      parseElementProperties(getJObject(json, "_initiator"), res.getInitiatorElement());
15567    if (json.has("receiver"))
15568      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
15569    if (json.has("_receiver"))
15570      parseElementProperties(getJObject(json, "_receiver"), res.getReceiverElement());
15571    if (json.has("description"))
15572      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15573    if (json.has("_description"))
15574      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15575    if (json.has("initiatorActive"))
15576      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
15577    if (json.has("_initiatorActive"))
15578      parseElementProperties(getJObject(json, "_initiatorActive"), res.getInitiatorActiveElement());
15579    if (json.has("receiverActive"))
15580      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
15581    if (json.has("_receiverActive"))
15582      parseElementProperties(getJObject(json, "_receiverActive"), res.getReceiverActiveElement());
15583    if (json.has("request"))
15584      res.setRequest(parseExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "request")));
15585    if (json.has("response"))
15586      res.setResponse(parseExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "response")));
15587  }
15588
15589  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioProcessStepAlternativeComponent(JsonObject json) throws IOException, FHIRFormatError {
15590    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
15591    parseExampleScenarioProcessStepAlternativeComponentProperties(json, res);
15592    return res;
15593  }
15594
15595  protected void parseExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
15596    parseBackboneElementProperties(json, res);
15597    if (json.has("title"))
15598      res.setTitleElement(parseString(json.get("title").getAsString()));
15599    if (json.has("_title"))
15600      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15601    if (json.has("description"))
15602      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15603    if (json.has("_description"))
15604      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15605    if (json.has("step")) {
15606      JsonArray array = getJArray(json, "step");
15607      for (int i = 0; i < array.size(); i++) {
15608        res.getStep().add(parseExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject()));
15609      }
15610    };
15611  }
15612
15613  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
15614    ExplanationOfBenefit res = new ExplanationOfBenefit();
15615    parseExplanationOfBenefitProperties(json, res);
15616    return res;
15617  }
15618
15619  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
15620    parseDomainResourceProperties(json, res);
15621    if (json.has("identifier")) {
15622      JsonArray array = getJArray(json, "identifier");
15623      for (int i = 0; i < array.size(); i++) {
15624        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15625      }
15626    };
15627    if (json.has("traceNumber")) {
15628      JsonArray array = getJArray(json, "traceNumber");
15629      for (int i = 0; i < array.size(); i++) {
15630        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
15631      }
15632    };
15633    if (json.has("status"))
15634      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
15635    if (json.has("_status"))
15636      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15637    if (json.has("type"))
15638      res.setType(parseCodeableConcept(getJObject(json, "type")));
15639    if (json.has("subType"))
15640      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
15641    if (json.has("use"))
15642      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
15643    if (json.has("_use"))
15644      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
15645    if (json.has("patient"))
15646      res.setPatient(parseReference(getJObject(json, "patient")));
15647    if (json.has("billablePeriod"))
15648      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
15649    if (json.has("created"))
15650      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
15651    if (json.has("_created"))
15652      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
15653    if (json.has("enterer"))
15654      res.setEnterer(parseReference(getJObject(json, "enterer")));
15655    if (json.has("insurer"))
15656      res.setInsurer(parseReference(getJObject(json, "insurer")));
15657    if (json.has("provider"))
15658      res.setProvider(parseReference(getJObject(json, "provider")));
15659    if (json.has("priority"))
15660      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
15661    if (json.has("fundsReserveRequested"))
15662      res.setFundsReserveRequested(parseCodeableConcept(getJObject(json, "fundsReserveRequested")));
15663    if (json.has("fundsReserve"))
15664      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
15665    if (json.has("related")) {
15666      JsonArray array = getJArray(json, "related");
15667      for (int i = 0; i < array.size(); i++) {
15668        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject()));
15669      }
15670    };
15671    if (json.has("prescription"))
15672      res.setPrescription(parseReference(getJObject(json, "prescription")));
15673    if (json.has("originalPrescription"))
15674      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
15675    if (json.has("event")) {
15676      JsonArray array = getJArray(json, "event");
15677      for (int i = 0; i < array.size(); i++) {
15678        res.getEvent().add(parseExplanationOfBenefitEventComponent(array.get(i).getAsJsonObject()));
15679      }
15680    };
15681    if (json.has("payee"))
15682      res.setPayee(parseExplanationOfBenefitPayeeComponent(getJObject(json, "payee")));
15683    if (json.has("referral"))
15684      res.setReferral(parseReference(getJObject(json, "referral")));
15685    if (json.has("encounter")) {
15686      JsonArray array = getJArray(json, "encounter");
15687      for (int i = 0; i < array.size(); i++) {
15688        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
15689      }
15690    };
15691    if (json.has("facility"))
15692      res.setFacility(parseReference(getJObject(json, "facility")));
15693    if (json.has("claim"))
15694      res.setClaim(parseReference(getJObject(json, "claim")));
15695    if (json.has("claimResponse"))
15696      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
15697    if (json.has("outcome"))
15698      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
15699    if (json.has("_outcome"))
15700      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
15701    if (json.has("decision"))
15702      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
15703    if (json.has("disposition"))
15704      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
15705    if (json.has("_disposition"))
15706      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
15707    if (json.has("preAuthRef")) {
15708      JsonArray array = getJArray(json, "preAuthRef");
15709      for (int i = 0; i < array.size(); i++) {
15710        if (array.get(i).isJsonNull()) {
15711          res.getPreAuthRef().add(new StringType());
15712        } else {;
15713          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
15714        }
15715      }
15716    };
15717    if (json.has("_preAuthRef")) {
15718      JsonArray array = getJArray(json, "_preAuthRef");
15719      for (int i = 0; i < array.size(); i++) {
15720        if (i == res.getPreAuthRef().size())
15721          res.getPreAuthRef().add(parseString(null));
15722        if (array.get(i) instanceof JsonObject) 
15723          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
15724      }
15725    };
15726    if (json.has("preAuthRefPeriod")) {
15727      JsonArray array = getJArray(json, "preAuthRefPeriod");
15728      for (int i = 0; i < array.size(); i++) {
15729        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
15730      }
15731    };
15732    if (json.has("diagnosisRelatedGroup"))
15733      res.setDiagnosisRelatedGroup(parseCodeableConcept(getJObject(json, "diagnosisRelatedGroup")));
15734    if (json.has("careTeam")) {
15735      JsonArray array = getJArray(json, "careTeam");
15736      for (int i = 0; i < array.size(); i++) {
15737        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject()));
15738      }
15739    };
15740    if (json.has("supportingInfo")) {
15741      JsonArray array = getJArray(json, "supportingInfo");
15742      for (int i = 0; i < array.size(); i++) {
15743        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject()));
15744      }
15745    };
15746    if (json.has("diagnosis")) {
15747      JsonArray array = getJArray(json, "diagnosis");
15748      for (int i = 0; i < array.size(); i++) {
15749        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject()));
15750      }
15751    };
15752    if (json.has("procedure")) {
15753      JsonArray array = getJArray(json, "procedure");
15754      for (int i = 0; i < array.size(); i++) {
15755        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject()));
15756      }
15757    };
15758    if (json.has("precedence"))
15759      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
15760    if (json.has("_precedence"))
15761      parseElementProperties(getJObject(json, "_precedence"), res.getPrecedenceElement());
15762    if (json.has("insurance")) {
15763      JsonArray array = getJArray(json, "insurance");
15764      for (int i = 0; i < array.size(); i++) {
15765        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject()));
15766      }
15767    };
15768    if (json.has("accident"))
15769      res.setAccident(parseExplanationOfBenefitAccidentComponent(getJObject(json, "accident")));
15770    if (json.has("patientPaid"))
15771      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
15772    if (json.has("item")) {
15773      JsonArray array = getJArray(json, "item");
15774      for (int i = 0; i < array.size(); i++) {
15775        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject()));
15776      }
15777    };
15778    if (json.has("addItem")) {
15779      JsonArray array = getJArray(json, "addItem");
15780      for (int i = 0; i < array.size(); i++) {
15781        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject()));
15782      }
15783    };
15784    if (json.has("adjudication")) {
15785      JsonArray array = getJArray(json, "adjudication");
15786      for (int i = 0; i < array.size(); i++) {
15787        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
15788      }
15789    };
15790    if (json.has("total")) {
15791      JsonArray array = getJArray(json, "total");
15792      for (int i = 0; i < array.size(); i++) {
15793        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject()));
15794      }
15795    };
15796    if (json.has("payment"))
15797      res.setPayment(parseExplanationOfBenefitPaymentComponent(getJObject(json, "payment")));
15798    if (json.has("formCode"))
15799      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
15800    if (json.has("form"))
15801      res.setForm(parseAttachment(getJObject(json, "form")));
15802    if (json.has("processNote")) {
15803      JsonArray array = getJArray(json, "processNote");
15804      for (int i = 0; i < array.size(); i++) {
15805        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject()));
15806      }
15807    };
15808    if (json.has("benefitPeriod"))
15809      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
15810    if (json.has("benefitBalance")) {
15811      JsonArray array = getJArray(json, "benefitBalance");
15812      for (int i = 0; i < array.size(); i++) {
15813        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject()));
15814      }
15815    };
15816  }
15817
15818  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
15819    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
15820    parseExplanationOfBenefitRelatedClaimComponentProperties(json, res);
15821    return res;
15822  }
15823
15824  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
15825    parseBackboneElementProperties(json, res);
15826    if (json.has("claim"))
15827      res.setClaim(parseReference(getJObject(json, "claim")));
15828    if (json.has("relationship"))
15829      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
15830    if (json.has("reference"))
15831      res.setReference(parseIdentifier(getJObject(json, "reference")));
15832  }
15833
15834  protected ExplanationOfBenefit.ExplanationOfBenefitEventComponent parseExplanationOfBenefitEventComponent(JsonObject json) throws IOException, FHIRFormatError {
15835    ExplanationOfBenefit.ExplanationOfBenefitEventComponent res = new ExplanationOfBenefit.ExplanationOfBenefitEventComponent();
15836    parseExplanationOfBenefitEventComponentProperties(json, res);
15837    return res;
15838  }
15839
15840  protected void parseExplanationOfBenefitEventComponentProperties(JsonObject json, ExplanationOfBenefit.ExplanationOfBenefitEventComponent res) throws IOException, FHIRFormatError {
15841    parseBackboneElementProperties(json, res);
15842    if (json.has("type"))
15843      res.setType(parseCodeableConcept(getJObject(json, "type")));
15844    DataType when = parseType("when", json);
15845    if (when != null)
15846      res.setWhen(when);
15847  }
15848
15849  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
15850    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
15851    parseExplanationOfBenefitPayeeComponentProperties(json, res);
15852    return res;
15853  }
15854
15855  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
15856    parseBackboneElementProperties(json, res);
15857    if (json.has("type"))
15858      res.setType(parseCodeableConcept(getJObject(json, "type")));
15859    if (json.has("party"))
15860      res.setParty(parseReference(getJObject(json, "party")));
15861  }
15862
15863  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
15864    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
15865    parseExplanationOfBenefitCareTeamComponentProperties(json, res);
15866    return res;
15867  }
15868
15869  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
15870    parseBackboneElementProperties(json, res);
15871    if (json.has("sequence"))
15872      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
15873    if (json.has("_sequence"))
15874      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
15875    if (json.has("provider"))
15876      res.setProvider(parseReference(getJObject(json, "provider")));
15877    if (json.has("responsible"))
15878      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
15879    if (json.has("_responsible"))
15880      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
15881    if (json.has("role"))
15882      res.setRole(parseCodeableConcept(getJObject(json, "role")));
15883    if (json.has("specialty"))
15884      res.setSpecialty(parseCodeableConcept(getJObject(json, "specialty")));
15885  }
15886
15887  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
15888    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
15889    parseExplanationOfBenefitSupportingInformationComponentProperties(json, res);
15890    return res;
15891  }
15892
15893  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
15894    parseBackboneElementProperties(json, res);
15895    if (json.has("sequence"))
15896      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
15897    if (json.has("_sequence"))
15898      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
15899    if (json.has("category"))
15900      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
15901    if (json.has("code"))
15902      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15903    DataType timing = parseType("timing", json);
15904    if (timing != null)
15905      res.setTiming(timing);
15906    DataType value = parseType("value", json);
15907    if (value != null)
15908      res.setValue(value);
15909    if (json.has("reason"))
15910      res.setReason(parseCoding(getJObject(json, "reason")));
15911  }
15912
15913  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
15914    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
15915    parseExplanationOfBenefitDiagnosisComponentProperties(json, res);
15916    return res;
15917  }
15918
15919  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
15920    parseBackboneElementProperties(json, res);
15921    if (json.has("sequence"))
15922      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
15923    if (json.has("_sequence"))
15924      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
15925    DataType diagnosis = parseType("diagnosis", json);
15926    if (diagnosis != null)
15927      res.setDiagnosis(diagnosis);
15928    if (json.has("type")) {
15929      JsonArray array = getJArray(json, "type");
15930      for (int i = 0; i < array.size(); i++) {
15931        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15932      }
15933    };
15934    if (json.has("onAdmission"))
15935      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
15936  }
15937
15938  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
15939    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
15940    parseExplanationOfBenefitProcedureComponentProperties(json, res);
15941    return res;
15942  }
15943
15944  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
15945    parseBackboneElementProperties(json, res);
15946    if (json.has("sequence"))
15947      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
15948    if (json.has("_sequence"))
15949      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
15950    if (json.has("type")) {
15951      JsonArray array = getJArray(json, "type");
15952      for (int i = 0; i < array.size(); i++) {
15953        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15954      }
15955    };
15956    if (json.has("date"))
15957      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15958    if (json.has("_date"))
15959      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15960    DataType procedure = parseType("procedure", json);
15961    if (procedure != null)
15962      res.setProcedure(procedure);
15963    if (json.has("udi")) {
15964      JsonArray array = getJArray(json, "udi");
15965      for (int i = 0; i < array.size(); i++) {
15966        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
15967      }
15968    };
15969  }
15970
15971  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
15972    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
15973    parseExplanationOfBenefitInsuranceComponentProperties(json, res);
15974    return res;
15975  }
15976
15977  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
15978    parseBackboneElementProperties(json, res);
15979    if (json.has("focal"))
15980      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
15981    if (json.has("_focal"))
15982      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
15983    if (json.has("coverage"))
15984      res.setCoverage(parseReference(getJObject(json, "coverage")));
15985    if (json.has("preAuthRef")) {
15986      JsonArray array = getJArray(json, "preAuthRef");
15987      for (int i = 0; i < array.size(); i++) {
15988        if (array.get(i).isJsonNull()) {
15989          res.getPreAuthRef().add(new StringType());
15990        } else {;
15991          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
15992        }
15993      }
15994    };
15995    if (json.has("_preAuthRef")) {
15996      JsonArray array = getJArray(json, "_preAuthRef");
15997      for (int i = 0; i < array.size(); i++) {
15998        if (i == res.getPreAuthRef().size())
15999          res.getPreAuthRef().add(parseString(null));
16000        if (array.get(i) instanceof JsonObject) 
16001          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
16002      }
16003    };
16004  }
16005
16006  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
16007    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
16008    parseExplanationOfBenefitAccidentComponentProperties(json, res);
16009    return res;
16010  }
16011
16012  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
16013    parseBackboneElementProperties(json, res);
16014    if (json.has("date"))
16015      res.setDateElement(parseDate(json.get("date").getAsString()));
16016    if (json.has("_date"))
16017      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16018    if (json.has("type"))
16019      res.setType(parseCodeableConcept(getJObject(json, "type")));
16020    DataType location = parseType("location", json);
16021    if (location != null)
16022      res.setLocation(location);
16023  }
16024
16025  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json) throws IOException, FHIRFormatError {
16026    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
16027    parseExplanationOfBenefitItemComponentProperties(json, res);
16028    return res;
16029  }
16030
16031  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
16032    parseBackboneElementProperties(json, res);
16033    if (json.has("sequence"))
16034      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
16035    if (json.has("_sequence"))
16036      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
16037    if (json.has("careTeamSequence")) {
16038      JsonArray array = getJArray(json, "careTeamSequence");
16039      for (int i = 0; i < array.size(); i++) {
16040        if (array.get(i).isJsonNull()) {
16041          res.getCareTeamSequence().add(new PositiveIntType());
16042        } else {;
16043          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
16044        }
16045      }
16046    };
16047    if (json.has("_careTeamSequence")) {
16048      JsonArray array = getJArray(json, "_careTeamSequence");
16049      for (int i = 0; i < array.size(); i++) {
16050        if (i == res.getCareTeamSequence().size())
16051          res.getCareTeamSequence().add(parsePositiveInt(null));
16052        if (array.get(i) instanceof JsonObject) 
16053          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
16054      }
16055    };
16056    if (json.has("diagnosisSequence")) {
16057      JsonArray array = getJArray(json, "diagnosisSequence");
16058      for (int i = 0; i < array.size(); i++) {
16059        if (array.get(i).isJsonNull()) {
16060          res.getDiagnosisSequence().add(new PositiveIntType());
16061        } else {;
16062          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
16063        }
16064      }
16065    };
16066    if (json.has("_diagnosisSequence")) {
16067      JsonArray array = getJArray(json, "_diagnosisSequence");
16068      for (int i = 0; i < array.size(); i++) {
16069        if (i == res.getDiagnosisSequence().size())
16070          res.getDiagnosisSequence().add(parsePositiveInt(null));
16071        if (array.get(i) instanceof JsonObject) 
16072          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
16073      }
16074    };
16075    if (json.has("procedureSequence")) {
16076      JsonArray array = getJArray(json, "procedureSequence");
16077      for (int i = 0; i < array.size(); i++) {
16078        if (array.get(i).isJsonNull()) {
16079          res.getProcedureSequence().add(new PositiveIntType());
16080        } else {;
16081          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
16082        }
16083      }
16084    };
16085    if (json.has("_procedureSequence")) {
16086      JsonArray array = getJArray(json, "_procedureSequence");
16087      for (int i = 0; i < array.size(); i++) {
16088        if (i == res.getProcedureSequence().size())
16089          res.getProcedureSequence().add(parsePositiveInt(null));
16090        if (array.get(i) instanceof JsonObject) 
16091          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
16092      }
16093    };
16094    if (json.has("informationSequence")) {
16095      JsonArray array = getJArray(json, "informationSequence");
16096      for (int i = 0; i < array.size(); i++) {
16097        if (array.get(i).isJsonNull()) {
16098          res.getInformationSequence().add(new PositiveIntType());
16099        } else {;
16100          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
16101        }
16102      }
16103    };
16104    if (json.has("_informationSequence")) {
16105      JsonArray array = getJArray(json, "_informationSequence");
16106      for (int i = 0; i < array.size(); i++) {
16107        if (i == res.getInformationSequence().size())
16108          res.getInformationSequence().add(parsePositiveInt(null));
16109        if (array.get(i) instanceof JsonObject) 
16110          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
16111      }
16112    };
16113    if (json.has("traceNumber")) {
16114      JsonArray array = getJArray(json, "traceNumber");
16115      for (int i = 0; i < array.size(); i++) {
16116        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
16117      }
16118    };
16119    if (json.has("revenue"))
16120      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
16121    if (json.has("category"))
16122      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16123    if (json.has("productOrService"))
16124      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
16125    if (json.has("productOrServiceEnd"))
16126      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
16127    if (json.has("request")) {
16128      JsonArray array = getJArray(json, "request");
16129      for (int i = 0; i < array.size(); i++) {
16130        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
16131      }
16132    };
16133    if (json.has("modifier")) {
16134      JsonArray array = getJArray(json, "modifier");
16135      for (int i = 0; i < array.size(); i++) {
16136        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16137      }
16138    };
16139    if (json.has("programCode")) {
16140      JsonArray array = getJArray(json, "programCode");
16141      for (int i = 0; i < array.size(); i++) {
16142        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16143      }
16144    };
16145    DataType serviced = parseType("serviced", json);
16146    if (serviced != null)
16147      res.setServiced(serviced);
16148    DataType location = parseType("location", json);
16149    if (location != null)
16150      res.setLocation(location);
16151    if (json.has("patientPaid"))
16152      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
16153    if (json.has("quantity"))
16154      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16155    if (json.has("unitPrice"))
16156      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
16157    if (json.has("factor"))
16158      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16159    if (json.has("_factor"))
16160      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
16161    if (json.has("tax"))
16162      res.setTax(parseMoney(getJObject(json, "tax")));
16163    if (json.has("net"))
16164      res.setNet(parseMoney(getJObject(json, "net")));
16165    if (json.has("udi")) {
16166      JsonArray array = getJArray(json, "udi");
16167      for (int i = 0; i < array.size(); i++) {
16168        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
16169      }
16170    };
16171    if (json.has("bodySite")) {
16172      JsonArray array = getJArray(json, "bodySite");
16173      for (int i = 0; i < array.size(); i++) {
16174        res.getBodySite().add(parseExplanationOfBenefitItemBodySiteComponent(array.get(i).getAsJsonObject()));
16175      }
16176    };
16177    if (json.has("encounter")) {
16178      JsonArray array = getJArray(json, "encounter");
16179      for (int i = 0; i < array.size(); i++) {
16180        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
16181      }
16182    };
16183    if (json.has("noteNumber")) {
16184      JsonArray array = getJArray(json, "noteNumber");
16185      for (int i = 0; i < array.size(); i++) {
16186        if (array.get(i).isJsonNull()) {
16187          res.getNoteNumber().add(new PositiveIntType());
16188        } else {;
16189          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
16190        }
16191      }
16192    };
16193    if (json.has("_noteNumber")) {
16194      JsonArray array = getJArray(json, "_noteNumber");
16195      for (int i = 0; i < array.size(); i++) {
16196        if (i == res.getNoteNumber().size())
16197          res.getNoteNumber().add(parsePositiveInt(null));
16198        if (array.get(i) instanceof JsonObject) 
16199          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
16200      }
16201    };
16202    if (json.has("reviewOutcome"))
16203      res.setReviewOutcome(parseExplanationOfBenefitItemReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
16204    if (json.has("adjudication")) {
16205      JsonArray array = getJArray(json, "adjudication");
16206      for (int i = 0; i < array.size(); i++) {
16207        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
16208      }
16209    };
16210    if (json.has("detail")) {
16211      JsonArray array = getJArray(json, "detail");
16212      for (int i = 0; i < array.size(); i++) {
16213        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject()));
16214      }
16215    };
16216  }
16217
16218  protected ExplanationOfBenefit.ItemBodySiteComponent parseExplanationOfBenefitItemBodySiteComponent(JsonObject json) throws IOException, FHIRFormatError {
16219    ExplanationOfBenefit.ItemBodySiteComponent res = new ExplanationOfBenefit.ItemBodySiteComponent();
16220    parseExplanationOfBenefitItemBodySiteComponentProperties(json, res);
16221    return res;
16222  }
16223
16224  protected void parseExplanationOfBenefitItemBodySiteComponentProperties(JsonObject json, ExplanationOfBenefit.ItemBodySiteComponent res) throws IOException, FHIRFormatError {
16225    parseBackboneElementProperties(json, res);
16226    if (json.has("site")) {
16227      JsonArray array = getJArray(json, "site");
16228      for (int i = 0; i < array.size(); i++) {
16229        res.getSite().add(parseCodeableReference(array.get(i).getAsJsonObject()));
16230      }
16231    };
16232    if (json.has("subSite")) {
16233      JsonArray array = getJArray(json, "subSite");
16234      for (int i = 0; i < array.size(); i++) {
16235        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16236      }
16237    };
16238  }
16239
16240  protected ExplanationOfBenefit.ItemReviewOutcomeComponent parseExplanationOfBenefitItemReviewOutcomeComponent(JsonObject json) throws IOException, FHIRFormatError {
16241    ExplanationOfBenefit.ItemReviewOutcomeComponent res = new ExplanationOfBenefit.ItemReviewOutcomeComponent();
16242    parseExplanationOfBenefitItemReviewOutcomeComponentProperties(json, res);
16243    return res;
16244  }
16245
16246  protected void parseExplanationOfBenefitItemReviewOutcomeComponentProperties(JsonObject json, ExplanationOfBenefit.ItemReviewOutcomeComponent res) throws IOException, FHIRFormatError {
16247    parseBackboneElementProperties(json, res);
16248    if (json.has("decision"))
16249      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
16250    if (json.has("reason")) {
16251      JsonArray array = getJArray(json, "reason");
16252      for (int i = 0; i < array.size(); i++) {
16253        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16254      }
16255    };
16256    if (json.has("preAuthRef"))
16257      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
16258    if (json.has("_preAuthRef"))
16259      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
16260    if (json.has("preAuthPeriod"))
16261      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
16262  }
16263
16264  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
16265    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
16266    parseExplanationOfBenefitAdjudicationComponentProperties(json, res);
16267    return res;
16268  }
16269
16270  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
16271    parseBackboneElementProperties(json, res);
16272    if (json.has("category"))
16273      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16274    if (json.has("reason"))
16275      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
16276    if (json.has("amount"))
16277      res.setAmount(parseMoney(getJObject(json, "amount")));
16278    if (json.has("quantity"))
16279      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16280  }
16281
16282  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
16283    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
16284    parseExplanationOfBenefitDetailComponentProperties(json, res);
16285    return res;
16286  }
16287
16288  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
16289    parseBackboneElementProperties(json, res);
16290    if (json.has("sequence"))
16291      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
16292    if (json.has("_sequence"))
16293      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
16294    if (json.has("traceNumber")) {
16295      JsonArray array = getJArray(json, "traceNumber");
16296      for (int i = 0; i < array.size(); i++) {
16297        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
16298      }
16299    };
16300    if (json.has("revenue"))
16301      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
16302    if (json.has("category"))
16303      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16304    if (json.has("productOrService"))
16305      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
16306    if (json.has("productOrServiceEnd"))
16307      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
16308    if (json.has("modifier")) {
16309      JsonArray array = getJArray(json, "modifier");
16310      for (int i = 0; i < array.size(); i++) {
16311        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16312      }
16313    };
16314    if (json.has("programCode")) {
16315      JsonArray array = getJArray(json, "programCode");
16316      for (int i = 0; i < array.size(); i++) {
16317        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16318      }
16319    };
16320    if (json.has("patientPaid"))
16321      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
16322    if (json.has("quantity"))
16323      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16324    if (json.has("unitPrice"))
16325      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
16326    if (json.has("factor"))
16327      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16328    if (json.has("_factor"))
16329      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
16330    if (json.has("tax"))
16331      res.setTax(parseMoney(getJObject(json, "tax")));
16332    if (json.has("net"))
16333      res.setNet(parseMoney(getJObject(json, "net")));
16334    if (json.has("udi")) {
16335      JsonArray array = getJArray(json, "udi");
16336      for (int i = 0; i < array.size(); i++) {
16337        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
16338      }
16339    };
16340    if (json.has("noteNumber")) {
16341      JsonArray array = getJArray(json, "noteNumber");
16342      for (int i = 0; i < array.size(); i++) {
16343        if (array.get(i).isJsonNull()) {
16344          res.getNoteNumber().add(new PositiveIntType());
16345        } else {;
16346          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
16347        }
16348      }
16349    };
16350    if (json.has("_noteNumber")) {
16351      JsonArray array = getJArray(json, "_noteNumber");
16352      for (int i = 0; i < array.size(); i++) {
16353        if (i == res.getNoteNumber().size())
16354          res.getNoteNumber().add(parsePositiveInt(null));
16355        if (array.get(i) instanceof JsonObject) 
16356          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
16357      }
16358    };
16359    if (json.has("reviewOutcome"))
16360      res.setReviewOutcome(parseExplanationOfBenefitItemReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
16361    if (json.has("adjudication")) {
16362      JsonArray array = getJArray(json, "adjudication");
16363      for (int i = 0; i < array.size(); i++) {
16364        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
16365      }
16366    };
16367    if (json.has("subDetail")) {
16368      JsonArray array = getJArray(json, "subDetail");
16369      for (int i = 0; i < array.size(); i++) {
16370        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject()));
16371      }
16372    };
16373  }
16374
16375  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
16376    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
16377    parseExplanationOfBenefitSubDetailComponentProperties(json, res);
16378    return res;
16379  }
16380
16381  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
16382    parseBackboneElementProperties(json, res);
16383    if (json.has("sequence"))
16384      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
16385    if (json.has("_sequence"))
16386      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
16387    if (json.has("traceNumber")) {
16388      JsonArray array = getJArray(json, "traceNumber");
16389      for (int i = 0; i < array.size(); i++) {
16390        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
16391      }
16392    };
16393    if (json.has("revenue"))
16394      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
16395    if (json.has("category"))
16396      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16397    if (json.has("productOrService"))
16398      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
16399    if (json.has("productOrServiceEnd"))
16400      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
16401    if (json.has("modifier")) {
16402      JsonArray array = getJArray(json, "modifier");
16403      for (int i = 0; i < array.size(); i++) {
16404        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16405      }
16406    };
16407    if (json.has("programCode")) {
16408      JsonArray array = getJArray(json, "programCode");
16409      for (int i = 0; i < array.size(); i++) {
16410        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16411      }
16412    };
16413    if (json.has("patientPaid"))
16414      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
16415    if (json.has("quantity"))
16416      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16417    if (json.has("unitPrice"))
16418      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
16419    if (json.has("factor"))
16420      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16421    if (json.has("_factor"))
16422      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
16423    if (json.has("tax"))
16424      res.setTax(parseMoney(getJObject(json, "tax")));
16425    if (json.has("net"))
16426      res.setNet(parseMoney(getJObject(json, "net")));
16427    if (json.has("udi")) {
16428      JsonArray array = getJArray(json, "udi");
16429      for (int i = 0; i < array.size(); i++) {
16430        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
16431      }
16432    };
16433    if (json.has("noteNumber")) {
16434      JsonArray array = getJArray(json, "noteNumber");
16435      for (int i = 0; i < array.size(); i++) {
16436        if (array.get(i).isJsonNull()) {
16437          res.getNoteNumber().add(new PositiveIntType());
16438        } else {;
16439          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
16440        }
16441      }
16442    };
16443    if (json.has("_noteNumber")) {
16444      JsonArray array = getJArray(json, "_noteNumber");
16445      for (int i = 0; i < array.size(); i++) {
16446        if (i == res.getNoteNumber().size())
16447          res.getNoteNumber().add(parsePositiveInt(null));
16448        if (array.get(i) instanceof JsonObject) 
16449          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
16450      }
16451    };
16452    if (json.has("reviewOutcome"))
16453      res.setReviewOutcome(parseExplanationOfBenefitItemReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
16454    if (json.has("adjudication")) {
16455      JsonArray array = getJArray(json, "adjudication");
16456      for (int i = 0; i < array.size(); i++) {
16457        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
16458      }
16459    };
16460  }
16461
16462  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
16463    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
16464    parseExplanationOfBenefitAddedItemComponentProperties(json, res);
16465    return res;
16466  }
16467
16468  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
16469    parseBackboneElementProperties(json, res);
16470    if (json.has("itemSequence")) {
16471      JsonArray array = getJArray(json, "itemSequence");
16472      for (int i = 0; i < array.size(); i++) {
16473        if (array.get(i).isJsonNull()) {
16474          res.getItemSequence().add(new PositiveIntType());
16475        } else {;
16476          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
16477        }
16478      }
16479    };
16480    if (json.has("_itemSequence")) {
16481      JsonArray array = getJArray(json, "_itemSequence");
16482      for (int i = 0; i < array.size(); i++) {
16483        if (i == res.getItemSequence().size())
16484          res.getItemSequence().add(parsePositiveInt(null));
16485        if (array.get(i) instanceof JsonObject) 
16486          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
16487      }
16488    };
16489    if (json.has("detailSequence")) {
16490      JsonArray array = getJArray(json, "detailSequence");
16491      for (int i = 0; i < array.size(); i++) {
16492        if (array.get(i).isJsonNull()) {
16493          res.getDetailSequence().add(new PositiveIntType());
16494        } else {;
16495          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
16496        }
16497      }
16498    };
16499    if (json.has("_detailSequence")) {
16500      JsonArray array = getJArray(json, "_detailSequence");
16501      for (int i = 0; i < array.size(); i++) {
16502        if (i == res.getDetailSequence().size())
16503          res.getDetailSequence().add(parsePositiveInt(null));
16504        if (array.get(i) instanceof JsonObject) 
16505          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
16506      }
16507    };
16508    if (json.has("subDetailSequence")) {
16509      JsonArray array = getJArray(json, "subDetailSequence");
16510      for (int i = 0; i < array.size(); i++) {
16511        if (array.get(i).isJsonNull()) {
16512          res.getSubDetailSequence().add(new PositiveIntType());
16513        } else {;
16514          res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
16515        }
16516      }
16517    };
16518    if (json.has("_subDetailSequence")) {
16519      JsonArray array = getJArray(json, "_subDetailSequence");
16520      for (int i = 0; i < array.size(); i++) {
16521        if (i == res.getSubDetailSequence().size())
16522          res.getSubDetailSequence().add(parsePositiveInt(null));
16523        if (array.get(i) instanceof JsonObject) 
16524          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
16525      }
16526    };
16527    if (json.has("traceNumber")) {
16528      JsonArray array = getJArray(json, "traceNumber");
16529      for (int i = 0; i < array.size(); i++) {
16530        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
16531      }
16532    };
16533    if (json.has("provider")) {
16534      JsonArray array = getJArray(json, "provider");
16535      for (int i = 0; i < array.size(); i++) {
16536        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
16537      }
16538    };
16539    if (json.has("revenue"))
16540      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
16541    if (json.has("productOrService"))
16542      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
16543    if (json.has("productOrServiceEnd"))
16544      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
16545    if (json.has("request")) {
16546      JsonArray array = getJArray(json, "request");
16547      for (int i = 0; i < array.size(); i++) {
16548        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
16549      }
16550    };
16551    if (json.has("modifier")) {
16552      JsonArray array = getJArray(json, "modifier");
16553      for (int i = 0; i < array.size(); i++) {
16554        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16555      }
16556    };
16557    if (json.has("programCode")) {
16558      JsonArray array = getJArray(json, "programCode");
16559      for (int i = 0; i < array.size(); i++) {
16560        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16561      }
16562    };
16563    DataType serviced = parseType("serviced", json);
16564    if (serviced != null)
16565      res.setServiced(serviced);
16566    DataType location = parseType("location", json);
16567    if (location != null)
16568      res.setLocation(location);
16569    if (json.has("patientPaid"))
16570      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
16571    if (json.has("quantity"))
16572      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16573    if (json.has("unitPrice"))
16574      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
16575    if (json.has("factor"))
16576      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16577    if (json.has("_factor"))
16578      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
16579    if (json.has("tax"))
16580      res.setTax(parseMoney(getJObject(json, "tax")));
16581    if (json.has("net"))
16582      res.setNet(parseMoney(getJObject(json, "net")));
16583    if (json.has("bodySite")) {
16584      JsonArray array = getJArray(json, "bodySite");
16585      for (int i = 0; i < array.size(); i++) {
16586        res.getBodySite().add(parseExplanationOfBenefitAddedItemBodySiteComponent(array.get(i).getAsJsonObject()));
16587      }
16588    };
16589    if (json.has("noteNumber")) {
16590      JsonArray array = getJArray(json, "noteNumber");
16591      for (int i = 0; i < array.size(); i++) {
16592        if (array.get(i).isJsonNull()) {
16593          res.getNoteNumber().add(new PositiveIntType());
16594        } else {;
16595          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
16596        }
16597      }
16598    };
16599    if (json.has("_noteNumber")) {
16600      JsonArray array = getJArray(json, "_noteNumber");
16601      for (int i = 0; i < array.size(); i++) {
16602        if (i == res.getNoteNumber().size())
16603          res.getNoteNumber().add(parsePositiveInt(null));
16604        if (array.get(i) instanceof JsonObject) 
16605          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
16606      }
16607    };
16608    if (json.has("reviewOutcome"))
16609      res.setReviewOutcome(parseExplanationOfBenefitItemReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
16610    if (json.has("adjudication")) {
16611      JsonArray array = getJArray(json, "adjudication");
16612      for (int i = 0; i < array.size(); i++) {
16613        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
16614      }
16615    };
16616    if (json.has("detail")) {
16617      JsonArray array = getJArray(json, "detail");
16618      for (int i = 0; i < array.size(); i++) {
16619        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject()));
16620      }
16621    };
16622  }
16623
16624  protected ExplanationOfBenefit.AddedItemBodySiteComponent parseExplanationOfBenefitAddedItemBodySiteComponent(JsonObject json) throws IOException, FHIRFormatError {
16625    ExplanationOfBenefit.AddedItemBodySiteComponent res = new ExplanationOfBenefit.AddedItemBodySiteComponent();
16626    parseExplanationOfBenefitAddedItemBodySiteComponentProperties(json, res);
16627    return res;
16628  }
16629
16630  protected void parseExplanationOfBenefitAddedItemBodySiteComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemBodySiteComponent res) throws IOException, FHIRFormatError {
16631    parseBackboneElementProperties(json, res);
16632    if (json.has("site")) {
16633      JsonArray array = getJArray(json, "site");
16634      for (int i = 0; i < array.size(); i++) {
16635        res.getSite().add(parseCodeableReference(array.get(i).getAsJsonObject()));
16636      }
16637    };
16638    if (json.has("subSite")) {
16639      JsonArray array = getJArray(json, "subSite");
16640      for (int i = 0; i < array.size(); i++) {
16641        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16642      }
16643    };
16644  }
16645
16646  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
16647    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
16648    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, res);
16649    return res;
16650  }
16651
16652  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
16653    parseBackboneElementProperties(json, res);
16654    if (json.has("traceNumber")) {
16655      JsonArray array = getJArray(json, "traceNumber");
16656      for (int i = 0; i < array.size(); i++) {
16657        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
16658      }
16659    };
16660    if (json.has("revenue"))
16661      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
16662    if (json.has("productOrService"))
16663      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
16664    if (json.has("productOrServiceEnd"))
16665      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
16666    if (json.has("modifier")) {
16667      JsonArray array = getJArray(json, "modifier");
16668      for (int i = 0; i < array.size(); i++) {
16669        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16670      }
16671    };
16672    if (json.has("patientPaid"))
16673      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
16674    if (json.has("quantity"))
16675      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16676    if (json.has("unitPrice"))
16677      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
16678    if (json.has("factor"))
16679      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16680    if (json.has("_factor"))
16681      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
16682    if (json.has("tax"))
16683      res.setTax(parseMoney(getJObject(json, "tax")));
16684    if (json.has("net"))
16685      res.setNet(parseMoney(getJObject(json, "net")));
16686    if (json.has("noteNumber")) {
16687      JsonArray array = getJArray(json, "noteNumber");
16688      for (int i = 0; i < array.size(); i++) {
16689        if (array.get(i).isJsonNull()) {
16690          res.getNoteNumber().add(new PositiveIntType());
16691        } else {;
16692          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
16693        }
16694      }
16695    };
16696    if (json.has("_noteNumber")) {
16697      JsonArray array = getJArray(json, "_noteNumber");
16698      for (int i = 0; i < array.size(); i++) {
16699        if (i == res.getNoteNumber().size())
16700          res.getNoteNumber().add(parsePositiveInt(null));
16701        if (array.get(i) instanceof JsonObject) 
16702          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
16703      }
16704    };
16705    if (json.has("reviewOutcome"))
16706      res.setReviewOutcome(parseExplanationOfBenefitItemReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
16707    if (json.has("adjudication")) {
16708      JsonArray array = getJArray(json, "adjudication");
16709      for (int i = 0; i < array.size(); i++) {
16710        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
16711      }
16712    };
16713    if (json.has("subDetail")) {
16714      JsonArray array = getJArray(json, "subDetail");
16715      for (int i = 0; i < array.size(); i++) {
16716        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject()));
16717      }
16718    };
16719  }
16720
16721  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
16722    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
16723    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, res);
16724    return res;
16725  }
16726
16727  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
16728    parseBackboneElementProperties(json, res);
16729    if (json.has("traceNumber")) {
16730      JsonArray array = getJArray(json, "traceNumber");
16731      for (int i = 0; i < array.size(); i++) {
16732        res.getTraceNumber().add(parseIdentifier(array.get(i).getAsJsonObject()));
16733      }
16734    };
16735    if (json.has("revenue"))
16736      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
16737    if (json.has("productOrService"))
16738      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
16739    if (json.has("productOrServiceEnd"))
16740      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
16741    if (json.has("modifier")) {
16742      JsonArray array = getJArray(json, "modifier");
16743      for (int i = 0; i < array.size(); i++) {
16744        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16745      }
16746    };
16747    if (json.has("patientPaid"))
16748      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
16749    if (json.has("quantity"))
16750      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16751    if (json.has("unitPrice"))
16752      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
16753    if (json.has("factor"))
16754      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16755    if (json.has("_factor"))
16756      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
16757    if (json.has("tax"))
16758      res.setTax(parseMoney(getJObject(json, "tax")));
16759    if (json.has("net"))
16760      res.setNet(parseMoney(getJObject(json, "net")));
16761    if (json.has("noteNumber")) {
16762      JsonArray array = getJArray(json, "noteNumber");
16763      for (int i = 0; i < array.size(); i++) {
16764        if (array.get(i).isJsonNull()) {
16765          res.getNoteNumber().add(new PositiveIntType());
16766        } else {;
16767          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
16768        }
16769      }
16770    };
16771    if (json.has("_noteNumber")) {
16772      JsonArray array = getJArray(json, "_noteNumber");
16773      for (int i = 0; i < array.size(); i++) {
16774        if (i == res.getNoteNumber().size())
16775          res.getNoteNumber().add(parsePositiveInt(null));
16776        if (array.get(i) instanceof JsonObject) 
16777          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
16778      }
16779    };
16780    if (json.has("reviewOutcome"))
16781      res.setReviewOutcome(parseExplanationOfBenefitItemReviewOutcomeComponent(getJObject(json, "reviewOutcome")));
16782    if (json.has("adjudication")) {
16783      JsonArray array = getJArray(json, "adjudication");
16784      for (int i = 0; i < array.size(); i++) {
16785        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
16786      }
16787    };
16788  }
16789
16790  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
16791    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
16792    parseExplanationOfBenefitTotalComponentProperties(json, res);
16793    return res;
16794  }
16795
16796  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
16797    parseBackboneElementProperties(json, res);
16798    if (json.has("category"))
16799      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16800    if (json.has("amount"))
16801      res.setAmount(parseMoney(getJObject(json, "amount")));
16802  }
16803
16804  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
16805    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
16806    parseExplanationOfBenefitPaymentComponentProperties(json, res);
16807    return res;
16808  }
16809
16810  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
16811    parseBackboneElementProperties(json, res);
16812    if (json.has("type"))
16813      res.setType(parseCodeableConcept(getJObject(json, "type")));
16814    if (json.has("adjustment"))
16815      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
16816    if (json.has("adjustmentReason"))
16817      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
16818    if (json.has("date"))
16819      res.setDateElement(parseDate(json.get("date").getAsString()));
16820    if (json.has("_date"))
16821      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16822    if (json.has("amount"))
16823      res.setAmount(parseMoney(getJObject(json, "amount")));
16824    if (json.has("identifier"))
16825      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
16826  }
16827
16828  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
16829    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
16830    parseExplanationOfBenefitNoteComponentProperties(json, res);
16831    return res;
16832  }
16833
16834  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
16835    parseBackboneElementProperties(json, res);
16836    if (json.has("number"))
16837      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
16838    if (json.has("_number"))
16839      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
16840    if (json.has("type"))
16841      res.setType(parseCodeableConcept(getJObject(json, "type")));
16842    if (json.has("text"))
16843      res.setTextElement(parseString(json.get("text").getAsString()));
16844    if (json.has("_text"))
16845      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
16846    if (json.has("language"))
16847      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
16848  }
16849
16850  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json) throws IOException, FHIRFormatError {
16851    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
16852    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, res);
16853    return res;
16854  }
16855
16856  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
16857    parseBackboneElementProperties(json, res);
16858    if (json.has("category"))
16859      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16860    if (json.has("excluded"))
16861      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
16862    if (json.has("_excluded"))
16863      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
16864    if (json.has("name"))
16865      res.setNameElement(parseString(json.get("name").getAsString()));
16866    if (json.has("_name"))
16867      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16868    if (json.has("description"))
16869      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16870    if (json.has("_description"))
16871      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16872    if (json.has("network"))
16873      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
16874    if (json.has("unit"))
16875      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
16876    if (json.has("term"))
16877      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
16878    if (json.has("financial")) {
16879      JsonArray array = getJArray(json, "financial");
16880      for (int i = 0; i < array.size(); i++) {
16881        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject()));
16882      }
16883    };
16884  }
16885
16886  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
16887    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
16888    parseExplanationOfBenefitBenefitComponentProperties(json, res);
16889    return res;
16890  }
16891
16892  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
16893    parseBackboneElementProperties(json, res);
16894    if (json.has("type"))
16895      res.setType(parseCodeableConcept(getJObject(json, "type")));
16896    DataType allowed = parseType("allowed", json);
16897    if (allowed != null)
16898      res.setAllowed(allowed);
16899    DataType used = parseType("used", json);
16900    if (used != null)
16901      res.setUsed(used);
16902  }
16903
16904  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
16905    FamilyMemberHistory res = new FamilyMemberHistory();
16906    parseFamilyMemberHistoryProperties(json, res);
16907    return res;
16908  }
16909
16910  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
16911    parseDomainResourceProperties(json, res);
16912    if (json.has("identifier")) {
16913      JsonArray array = getJArray(json, "identifier");
16914      for (int i = 0; i < array.size(); i++) {
16915        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16916      }
16917    };
16918    if (json.has("instantiatesCanonical")) {
16919      JsonArray array = getJArray(json, "instantiatesCanonical");
16920      for (int i = 0; i < array.size(); i++) {
16921        if (array.get(i).isJsonNull()) {
16922          res.getInstantiatesCanonical().add(new CanonicalType());
16923        } else {;
16924          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
16925        }
16926      }
16927    };
16928    if (json.has("_instantiatesCanonical")) {
16929      JsonArray array = getJArray(json, "_instantiatesCanonical");
16930      for (int i = 0; i < array.size(); i++) {
16931        if (i == res.getInstantiatesCanonical().size())
16932          res.getInstantiatesCanonical().add(parseCanonical(null));
16933        if (array.get(i) instanceof JsonObject) 
16934          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
16935      }
16936    };
16937    if (json.has("instantiatesUri")) {
16938      JsonArray array = getJArray(json, "instantiatesUri");
16939      for (int i = 0; i < array.size(); i++) {
16940        if (array.get(i).isJsonNull()) {
16941          res.getInstantiatesUri().add(new UriType());
16942        } else {;
16943          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
16944        }
16945      }
16946    };
16947    if (json.has("_instantiatesUri")) {
16948      JsonArray array = getJArray(json, "_instantiatesUri");
16949      for (int i = 0; i < array.size(); i++) {
16950        if (i == res.getInstantiatesUri().size())
16951          res.getInstantiatesUri().add(parseUri(null));
16952        if (array.get(i) instanceof JsonObject) 
16953          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
16954      }
16955    };
16956    if (json.has("status"))
16957      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
16958    if (json.has("_status"))
16959      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16960    if (json.has("dataAbsentReason"))
16961      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
16962    if (json.has("patient"))
16963      res.setPatient(parseReference(getJObject(json, "patient")));
16964    if (json.has("date"))
16965      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16966    if (json.has("_date"))
16967      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16968    if (json.has("participant")) {
16969      JsonArray array = getJArray(json, "participant");
16970      for (int i = 0; i < array.size(); i++) {
16971        res.getParticipant().add(parseFamilyMemberHistoryParticipantComponent(array.get(i).getAsJsonObject()));
16972      }
16973    };
16974    if (json.has("name"))
16975      res.setNameElement(parseString(json.get("name").getAsString()));
16976    if (json.has("_name"))
16977      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16978    if (json.has("relationship"))
16979      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
16980    if (json.has("sex"))
16981      res.setSex(parseCodeableConcept(getJObject(json, "sex")));
16982    DataType born = parseType("born", json);
16983    if (born != null)
16984      res.setBorn(born);
16985    DataType age = parseType("age", json);
16986    if (age != null)
16987      res.setAge(age);
16988    if (json.has("estimatedAge"))
16989      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
16990    if (json.has("_estimatedAge"))
16991      parseElementProperties(getJObject(json, "_estimatedAge"), res.getEstimatedAgeElement());
16992    DataType deceased = parseType("deceased", json);
16993    if (deceased != null)
16994      res.setDeceased(deceased);
16995    if (json.has("reason")) {
16996      JsonArray array = getJArray(json, "reason");
16997      for (int i = 0; i < array.size(); i++) {
16998        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
16999      }
17000    };
17001    if (json.has("note")) {
17002      JsonArray array = getJArray(json, "note");
17003      for (int i = 0; i < array.size(); i++) {
17004        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17005      }
17006    };
17007    if (json.has("condition")) {
17008      JsonArray array = getJArray(json, "condition");
17009      for (int i = 0; i < array.size(); i++) {
17010        res.getCondition().add(parseFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject()));
17011      }
17012    };
17013    if (json.has("procedure")) {
17014      JsonArray array = getJArray(json, "procedure");
17015      for (int i = 0; i < array.size(); i++) {
17016        res.getProcedure().add(parseFamilyMemberHistoryProcedureComponent(array.get(i).getAsJsonObject()));
17017      }
17018    };
17019  }
17020
17021  protected FamilyMemberHistory.FamilyMemberHistoryParticipantComponent parseFamilyMemberHistoryParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
17022    FamilyMemberHistory.FamilyMemberHistoryParticipantComponent res = new FamilyMemberHistory.FamilyMemberHistoryParticipantComponent();
17023    parseFamilyMemberHistoryParticipantComponentProperties(json, res);
17024    return res;
17025  }
17026
17027  protected void parseFamilyMemberHistoryParticipantComponentProperties(JsonObject json, FamilyMemberHistory.FamilyMemberHistoryParticipantComponent res) throws IOException, FHIRFormatError {
17028    parseBackboneElementProperties(json, res);
17029    if (json.has("function"))
17030      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
17031    if (json.has("actor"))
17032      res.setActor(parseReference(getJObject(json, "actor")));
17033  }
17034
17035  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
17036    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
17037    parseFamilyMemberHistoryConditionComponentProperties(json, res);
17038    return res;
17039  }
17040
17041  protected void parseFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
17042    parseBackboneElementProperties(json, res);
17043    if (json.has("code"))
17044      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17045    if (json.has("outcome"))
17046      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
17047    if (json.has("contributedToDeath"))
17048      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
17049    if (json.has("_contributedToDeath"))
17050      parseElementProperties(getJObject(json, "_contributedToDeath"), res.getContributedToDeathElement());
17051    DataType onset = parseType("onset", json);
17052    if (onset != null)
17053      res.setOnset(onset);
17054    if (json.has("note")) {
17055      JsonArray array = getJArray(json, "note");
17056      for (int i = 0; i < array.size(); i++) {
17057        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17058      }
17059    };
17060  }
17061
17062  protected FamilyMemberHistory.FamilyMemberHistoryProcedureComponent parseFamilyMemberHistoryProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
17063    FamilyMemberHistory.FamilyMemberHistoryProcedureComponent res = new FamilyMemberHistory.FamilyMemberHistoryProcedureComponent();
17064    parseFamilyMemberHistoryProcedureComponentProperties(json, res);
17065    return res;
17066  }
17067
17068  protected void parseFamilyMemberHistoryProcedureComponentProperties(JsonObject json, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent res) throws IOException, FHIRFormatError {
17069    parseBackboneElementProperties(json, res);
17070    if (json.has("code"))
17071      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17072    if (json.has("outcome"))
17073      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
17074    if (json.has("contributedToDeath"))
17075      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
17076    if (json.has("_contributedToDeath"))
17077      parseElementProperties(getJObject(json, "_contributedToDeath"), res.getContributedToDeathElement());
17078    DataType performed = parseType("performed", json);
17079    if (performed != null)
17080      res.setPerformed(performed);
17081    if (json.has("note")) {
17082      JsonArray array = getJArray(json, "note");
17083      for (int i = 0; i < array.size(); i++) {
17084        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17085      }
17086    };
17087  }
17088
17089  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
17090    Flag res = new Flag();
17091    parseFlagProperties(json, res);
17092    return res;
17093  }
17094
17095  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
17096    parseDomainResourceProperties(json, res);
17097    if (json.has("identifier")) {
17098      JsonArray array = getJArray(json, "identifier");
17099      for (int i = 0; i < array.size(); i++) {
17100        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17101      }
17102    };
17103    if (json.has("status"))
17104      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
17105    if (json.has("_status"))
17106      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17107    if (json.has("category")) {
17108      JsonArray array = getJArray(json, "category");
17109      for (int i = 0; i < array.size(); i++) {
17110        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17111      }
17112    };
17113    if (json.has("code"))
17114      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17115    if (json.has("subject"))
17116      res.setSubject(parseReference(getJObject(json, "subject")));
17117    if (json.has("period"))
17118      res.setPeriod(parsePeriod(getJObject(json, "period")));
17119    if (json.has("encounter"))
17120      res.setEncounter(parseReference(getJObject(json, "encounter")));
17121    if (json.has("author"))
17122      res.setAuthor(parseReference(getJObject(json, "author")));
17123  }
17124
17125  protected FormularyItem parseFormularyItem(JsonObject json) throws IOException, FHIRFormatError {
17126    FormularyItem res = new FormularyItem();
17127    parseFormularyItemProperties(json, res);
17128    return res;
17129  }
17130
17131  protected void parseFormularyItemProperties(JsonObject json, FormularyItem res) throws IOException, FHIRFormatError {
17132    parseDomainResourceProperties(json, res);
17133    if (json.has("identifier")) {
17134      JsonArray array = getJArray(json, "identifier");
17135      for (int i = 0; i < array.size(); i++) {
17136        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17137      }
17138    };
17139    if (json.has("code"))
17140      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17141    if (json.has("status"))
17142      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FormularyItem.FormularyItemStatusCodes.NULL, new FormularyItem.FormularyItemStatusCodesEnumFactory()));
17143    if (json.has("_status"))
17144      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17145  }
17146
17147  protected GenomicStudy parseGenomicStudy(JsonObject json) throws IOException, FHIRFormatError {
17148    GenomicStudy res = new GenomicStudy();
17149    parseGenomicStudyProperties(json, res);
17150    return res;
17151  }
17152
17153  protected void parseGenomicStudyProperties(JsonObject json, GenomicStudy res) throws IOException, FHIRFormatError {
17154    parseDomainResourceProperties(json, res);
17155    if (json.has("identifier")) {
17156      JsonArray array = getJArray(json, "identifier");
17157      for (int i = 0; i < array.size(); i++) {
17158        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17159      }
17160    };
17161    if (json.has("status"))
17162      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GenomicStudy.GenomicStudyStatus.NULL, new GenomicStudy.GenomicStudyStatusEnumFactory()));
17163    if (json.has("_status"))
17164      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17165    if (json.has("type")) {
17166      JsonArray array = getJArray(json, "type");
17167      for (int i = 0; i < array.size(); i++) {
17168        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17169      }
17170    };
17171    if (json.has("subject"))
17172      res.setSubject(parseReference(getJObject(json, "subject")));
17173    if (json.has("encounter"))
17174      res.setEncounter(parseReference(getJObject(json, "encounter")));
17175    if (json.has("startDate"))
17176      res.setStartDateElement(parseDateTime(json.get("startDate").getAsString()));
17177    if (json.has("_startDate"))
17178      parseElementProperties(getJObject(json, "_startDate"), res.getStartDateElement());
17179    if (json.has("basedOn")) {
17180      JsonArray array = getJArray(json, "basedOn");
17181      for (int i = 0; i < array.size(); i++) {
17182        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17183      }
17184    };
17185    if (json.has("referrer"))
17186      res.setReferrer(parseReference(getJObject(json, "referrer")));
17187    if (json.has("interpreter")) {
17188      JsonArray array = getJArray(json, "interpreter");
17189      for (int i = 0; i < array.size(); i++) {
17190        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
17191      }
17192    };
17193    if (json.has("reason")) {
17194      JsonArray array = getJArray(json, "reason");
17195      for (int i = 0; i < array.size(); i++) {
17196        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
17197      }
17198    };
17199    if (json.has("instantiatesCanonical"))
17200      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
17201    if (json.has("_instantiatesCanonical"))
17202      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
17203    if (json.has("instantiatesUri"))
17204      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
17205    if (json.has("_instantiatesUri"))
17206      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
17207    if (json.has("note")) {
17208      JsonArray array = getJArray(json, "note");
17209      for (int i = 0; i < array.size(); i++) {
17210        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17211      }
17212    };
17213    if (json.has("description"))
17214      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17215    if (json.has("_description"))
17216      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17217    if (json.has("analysis")) {
17218      JsonArray array = getJArray(json, "analysis");
17219      for (int i = 0; i < array.size(); i++) {
17220        res.getAnalysis().add(parseGenomicStudyAnalysisComponent(array.get(i).getAsJsonObject()));
17221      }
17222    };
17223  }
17224
17225  protected GenomicStudy.GenomicStudyAnalysisComponent parseGenomicStudyAnalysisComponent(JsonObject json) throws IOException, FHIRFormatError {
17226    GenomicStudy.GenomicStudyAnalysisComponent res = new GenomicStudy.GenomicStudyAnalysisComponent();
17227    parseGenomicStudyAnalysisComponentProperties(json, res);
17228    return res;
17229  }
17230
17231  protected void parseGenomicStudyAnalysisComponentProperties(JsonObject json, GenomicStudy.GenomicStudyAnalysisComponent res) throws IOException, FHIRFormatError {
17232    parseBackboneElementProperties(json, res);
17233    if (json.has("identifier")) {
17234      JsonArray array = getJArray(json, "identifier");
17235      for (int i = 0; i < array.size(); i++) {
17236        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17237      }
17238    };
17239    if (json.has("methodType")) {
17240      JsonArray array = getJArray(json, "methodType");
17241      for (int i = 0; i < array.size(); i++) {
17242        res.getMethodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17243      }
17244    };
17245    if (json.has("changeType")) {
17246      JsonArray array = getJArray(json, "changeType");
17247      for (int i = 0; i < array.size(); i++) {
17248        res.getChangeType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17249      }
17250    };
17251    if (json.has("genomeBuild"))
17252      res.setGenomeBuild(parseCodeableConcept(getJObject(json, "genomeBuild")));
17253    if (json.has("instantiatesCanonical"))
17254      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
17255    if (json.has("_instantiatesCanonical"))
17256      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
17257    if (json.has("instantiatesUri"))
17258      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
17259    if (json.has("_instantiatesUri"))
17260      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
17261    if (json.has("title"))
17262      res.setTitleElement(parseString(json.get("title").getAsString()));
17263    if (json.has("_title"))
17264      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17265    if (json.has("focus")) {
17266      JsonArray array = getJArray(json, "focus");
17267      for (int i = 0; i < array.size(); i++) {
17268        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
17269      }
17270    };
17271    if (json.has("specimen")) {
17272      JsonArray array = getJArray(json, "specimen");
17273      for (int i = 0; i < array.size(); i++) {
17274        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
17275      }
17276    };
17277    if (json.has("date"))
17278      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17279    if (json.has("_date"))
17280      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17281    if (json.has("note")) {
17282      JsonArray array = getJArray(json, "note");
17283      for (int i = 0; i < array.size(); i++) {
17284        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17285      }
17286    };
17287    if (json.has("protocolPerformed"))
17288      res.setProtocolPerformed(parseReference(getJObject(json, "protocolPerformed")));
17289    if (json.has("regionsStudied")) {
17290      JsonArray array = getJArray(json, "regionsStudied");
17291      for (int i = 0; i < array.size(); i++) {
17292        res.getRegionsStudied().add(parseReference(array.get(i).getAsJsonObject()));
17293      }
17294    };
17295    if (json.has("regionsCalled")) {
17296      JsonArray array = getJArray(json, "regionsCalled");
17297      for (int i = 0; i < array.size(); i++) {
17298        res.getRegionsCalled().add(parseReference(array.get(i).getAsJsonObject()));
17299      }
17300    };
17301    if (json.has("input")) {
17302      JsonArray array = getJArray(json, "input");
17303      for (int i = 0; i < array.size(); i++) {
17304        res.getInput().add(parseGenomicStudyAnalysisInputComponent(array.get(i).getAsJsonObject()));
17305      }
17306    };
17307    if (json.has("output")) {
17308      JsonArray array = getJArray(json, "output");
17309      for (int i = 0; i < array.size(); i++) {
17310        res.getOutput().add(parseGenomicStudyAnalysisOutputComponent(array.get(i).getAsJsonObject()));
17311      }
17312    };
17313    if (json.has("performer")) {
17314      JsonArray array = getJArray(json, "performer");
17315      for (int i = 0; i < array.size(); i++) {
17316        res.getPerformer().add(parseGenomicStudyAnalysisPerformerComponent(array.get(i).getAsJsonObject()));
17317      }
17318    };
17319    if (json.has("device")) {
17320      JsonArray array = getJArray(json, "device");
17321      for (int i = 0; i < array.size(); i++) {
17322        res.getDevice().add(parseGenomicStudyAnalysisDeviceComponent(array.get(i).getAsJsonObject()));
17323      }
17324    };
17325  }
17326
17327  protected GenomicStudy.GenomicStudyAnalysisInputComponent parseGenomicStudyAnalysisInputComponent(JsonObject json) throws IOException, FHIRFormatError {
17328    GenomicStudy.GenomicStudyAnalysisInputComponent res = new GenomicStudy.GenomicStudyAnalysisInputComponent();
17329    parseGenomicStudyAnalysisInputComponentProperties(json, res);
17330    return res;
17331  }
17332
17333  protected void parseGenomicStudyAnalysisInputComponentProperties(JsonObject json, GenomicStudy.GenomicStudyAnalysisInputComponent res) throws IOException, FHIRFormatError {
17334    parseBackboneElementProperties(json, res);
17335    if (json.has("file"))
17336      res.setFile(parseReference(getJObject(json, "file")));
17337    if (json.has("type"))
17338      res.setType(parseCodeableConcept(getJObject(json, "type")));
17339    DataType generatedBy = parseType("generatedBy", json);
17340    if (generatedBy != null)
17341      res.setGeneratedBy(generatedBy);
17342  }
17343
17344  protected GenomicStudy.GenomicStudyAnalysisOutputComponent parseGenomicStudyAnalysisOutputComponent(JsonObject json) throws IOException, FHIRFormatError {
17345    GenomicStudy.GenomicStudyAnalysisOutputComponent res = new GenomicStudy.GenomicStudyAnalysisOutputComponent();
17346    parseGenomicStudyAnalysisOutputComponentProperties(json, res);
17347    return res;
17348  }
17349
17350  protected void parseGenomicStudyAnalysisOutputComponentProperties(JsonObject json, GenomicStudy.GenomicStudyAnalysisOutputComponent res) throws IOException, FHIRFormatError {
17351    parseBackboneElementProperties(json, res);
17352    if (json.has("file"))
17353      res.setFile(parseReference(getJObject(json, "file")));
17354    if (json.has("type"))
17355      res.setType(parseCodeableConcept(getJObject(json, "type")));
17356  }
17357
17358  protected GenomicStudy.GenomicStudyAnalysisPerformerComponent parseGenomicStudyAnalysisPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
17359    GenomicStudy.GenomicStudyAnalysisPerformerComponent res = new GenomicStudy.GenomicStudyAnalysisPerformerComponent();
17360    parseGenomicStudyAnalysisPerformerComponentProperties(json, res);
17361    return res;
17362  }
17363
17364  protected void parseGenomicStudyAnalysisPerformerComponentProperties(JsonObject json, GenomicStudy.GenomicStudyAnalysisPerformerComponent res) throws IOException, FHIRFormatError {
17365    parseBackboneElementProperties(json, res);
17366    if (json.has("actor"))
17367      res.setActor(parseReference(getJObject(json, "actor")));
17368    if (json.has("role"))
17369      res.setRole(parseCodeableConcept(getJObject(json, "role")));
17370  }
17371
17372  protected GenomicStudy.GenomicStudyAnalysisDeviceComponent parseGenomicStudyAnalysisDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
17373    GenomicStudy.GenomicStudyAnalysisDeviceComponent res = new GenomicStudy.GenomicStudyAnalysisDeviceComponent();
17374    parseGenomicStudyAnalysisDeviceComponentProperties(json, res);
17375    return res;
17376  }
17377
17378  protected void parseGenomicStudyAnalysisDeviceComponentProperties(JsonObject json, GenomicStudy.GenomicStudyAnalysisDeviceComponent res) throws IOException, FHIRFormatError {
17379    parseBackboneElementProperties(json, res);
17380    if (json.has("device"))
17381      res.setDevice(parseReference(getJObject(json, "device")));
17382    if (json.has("function"))
17383      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
17384  }
17385
17386  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
17387    Goal res = new Goal();
17388    parseGoalProperties(json, res);
17389    return res;
17390  }
17391
17392  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
17393    parseDomainResourceProperties(json, res);
17394    if (json.has("identifier")) {
17395      JsonArray array = getJArray(json, "identifier");
17396      for (int i = 0; i < array.size(); i++) {
17397        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17398      }
17399    };
17400    if (json.has("lifecycleStatus"))
17401      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
17402    if (json.has("_lifecycleStatus"))
17403      parseElementProperties(getJObject(json, "_lifecycleStatus"), res.getLifecycleStatusElement());
17404    if (json.has("achievementStatus"))
17405      res.setAchievementStatus(parseCodeableConcept(getJObject(json, "achievementStatus")));
17406    if (json.has("category")) {
17407      JsonArray array = getJArray(json, "category");
17408      for (int i = 0; i < array.size(); i++) {
17409        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17410      }
17411    };
17412    if (json.has("continuous"))
17413      res.setContinuousElement(parseBoolean(json.get("continuous").getAsBoolean()));
17414    if (json.has("_continuous"))
17415      parseElementProperties(getJObject(json, "_continuous"), res.getContinuousElement());
17416    if (json.has("priority"))
17417      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
17418    if (json.has("description"))
17419      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
17420    if (json.has("subject"))
17421      res.setSubject(parseReference(getJObject(json, "subject")));
17422    DataType start = parseType("start", json);
17423    if (start != null)
17424      res.setStart(start);
17425    if (json.has("target")) {
17426      JsonArray array = getJArray(json, "target");
17427      for (int i = 0; i < array.size(); i++) {
17428        res.getTarget().add(parseGoalTargetComponent(array.get(i).getAsJsonObject()));
17429      }
17430    };
17431    if (json.has("statusDate"))
17432      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
17433    if (json.has("_statusDate"))
17434      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
17435    if (json.has("statusReason"))
17436      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
17437    if (json.has("_statusReason"))
17438      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
17439    if (json.has("source"))
17440      res.setSource(parseReference(getJObject(json, "source")));
17441    if (json.has("addresses")) {
17442      JsonArray array = getJArray(json, "addresses");
17443      for (int i = 0; i < array.size(); i++) {
17444        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
17445      }
17446    };
17447    if (json.has("note")) {
17448      JsonArray array = getJArray(json, "note");
17449      for (int i = 0; i < array.size(); i++) {
17450        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17451      }
17452    };
17453    if (json.has("outcome")) {
17454      JsonArray array = getJArray(json, "outcome");
17455      for (int i = 0; i < array.size(); i++) {
17456        res.getOutcome().add(parseCodeableReference(array.get(i).getAsJsonObject()));
17457      }
17458    };
17459  }
17460
17461  protected Goal.GoalTargetComponent parseGoalTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
17462    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
17463    parseGoalTargetComponentProperties(json, res);
17464    return res;
17465  }
17466
17467  protected void parseGoalTargetComponentProperties(JsonObject json, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
17468    parseBackboneElementProperties(json, res);
17469    if (json.has("measure"))
17470      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
17471    DataType detail = parseType("detail", json);
17472    if (detail != null)
17473      res.setDetail(detail);
17474    DataType due = parseType("due", json);
17475    if (due != null)
17476      res.setDue(due);
17477  }
17478
17479  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
17480    GraphDefinition res = new GraphDefinition();
17481    parseGraphDefinitionProperties(json, res);
17482    return res;
17483  }
17484
17485  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
17486    parseCanonicalResourceProperties(json, res);
17487    if (json.has("url"))
17488      res.setUrlElement(parseUri(json.get("url").getAsString()));
17489    if (json.has("_url"))
17490      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17491    if (json.has("identifier")) {
17492      JsonArray array = getJArray(json, "identifier");
17493      for (int i = 0; i < array.size(); i++) {
17494        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17495      }
17496    };
17497    if (json.has("version"))
17498      res.setVersionElement(parseString(json.get("version").getAsString()));
17499    if (json.has("_version"))
17500      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17501    DataType versionAlgorithm = parseType("versionAlgorithm", json);
17502    if (versionAlgorithm != null)
17503      res.setVersionAlgorithm(versionAlgorithm);
17504    if (json.has("name"))
17505      res.setNameElement(parseString(json.get("name").getAsString()));
17506    if (json.has("_name"))
17507      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17508    if (json.has("title"))
17509      res.setTitleElement(parseString(json.get("title").getAsString()));
17510    if (json.has("_title"))
17511      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17512    if (json.has("status"))
17513      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17514    if (json.has("_status"))
17515      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17516    if (json.has("experimental"))
17517      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17518    if (json.has("_experimental"))
17519      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17520    if (json.has("date"))
17521      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17522    if (json.has("_date"))
17523      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17524    if (json.has("publisher"))
17525      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17526    if (json.has("_publisher"))
17527      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17528    if (json.has("contact")) {
17529      JsonArray array = getJArray(json, "contact");
17530      for (int i = 0; i < array.size(); i++) {
17531        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17532      }
17533    };
17534    if (json.has("description"))
17535      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17536    if (json.has("_description"))
17537      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17538    if (json.has("useContext")) {
17539      JsonArray array = getJArray(json, "useContext");
17540      for (int i = 0; i < array.size(); i++) {
17541        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17542      }
17543    };
17544    if (json.has("jurisdiction")) {
17545      JsonArray array = getJArray(json, "jurisdiction");
17546      for (int i = 0; i < array.size(); i++) {
17547        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17548      }
17549    };
17550    if (json.has("purpose"))
17551      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17552    if (json.has("_purpose"))
17553      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17554    if (json.has("copyright"))
17555      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17556    if (json.has("_copyright"))
17557      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17558    if (json.has("copyrightLabel"))
17559      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
17560    if (json.has("_copyrightLabel"))
17561      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
17562    if (json.has("start"))
17563      res.setStartElement(parseId(json.get("start").getAsString()));
17564    if (json.has("_start"))
17565      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
17566    if (json.has("node")) {
17567      JsonArray array = getJArray(json, "node");
17568      for (int i = 0; i < array.size(); i++) {
17569        res.getNode().add(parseGraphDefinitionNodeComponent(array.get(i).getAsJsonObject()));
17570      }
17571    };
17572    if (json.has("link")) {
17573      JsonArray array = getJArray(json, "link");
17574      for (int i = 0; i < array.size(); i++) {
17575        res.getLink().add(parseGraphDefinitionLinkComponent(array.get(i).getAsJsonObject()));
17576      }
17577    };
17578  }
17579
17580  protected GraphDefinition.GraphDefinitionNodeComponent parseGraphDefinitionNodeComponent(JsonObject json) throws IOException, FHIRFormatError {
17581    GraphDefinition.GraphDefinitionNodeComponent res = new GraphDefinition.GraphDefinitionNodeComponent();
17582    parseGraphDefinitionNodeComponentProperties(json, res);
17583    return res;
17584  }
17585
17586  protected void parseGraphDefinitionNodeComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionNodeComponent res) throws IOException, FHIRFormatError {
17587    parseBackboneElementProperties(json, res);
17588    if (json.has("nodeId"))
17589      res.setNodeIdElement(parseId(json.get("nodeId").getAsString()));
17590    if (json.has("_nodeId"))
17591      parseElementProperties(getJObject(json, "_nodeId"), res.getNodeIdElement());
17592    if (json.has("description"))
17593      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17594    if (json.has("_description"))
17595      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17596    if (json.has("type"))
17597      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.VersionIndependentResourceTypesAll.NULL, new Enumerations.VersionIndependentResourceTypesAllEnumFactory()));
17598    if (json.has("_type"))
17599      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17600    if (json.has("profile"))
17601      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
17602    if (json.has("_profile"))
17603      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
17604  }
17605
17606  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
17607    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
17608    parseGraphDefinitionLinkComponentProperties(json, res);
17609    return res;
17610  }
17611
17612  protected void parseGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
17613    parseBackboneElementProperties(json, res);
17614    if (json.has("description"))
17615      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17616    if (json.has("_description"))
17617      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17618    if (json.has("min"))
17619      res.setMinElement(parseInteger(json.get("min").getAsLong()));
17620    if (json.has("_min"))
17621      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
17622    if (json.has("max"))
17623      res.setMaxElement(parseString(json.get("max").getAsString()));
17624    if (json.has("_max"))
17625      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
17626    if (json.has("sourceId"))
17627      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
17628    if (json.has("_sourceId"))
17629      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
17630    if (json.has("path"))
17631      res.setPathElement(parseString(json.get("path").getAsString()));
17632    if (json.has("_path"))
17633      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
17634    if (json.has("sliceName"))
17635      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
17636    if (json.has("_sliceName"))
17637      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
17638    if (json.has("targetId"))
17639      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
17640    if (json.has("_targetId"))
17641      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
17642    if (json.has("params"))
17643      res.setParamsElement(parseString(json.get("params").getAsString()));
17644    if (json.has("_params"))
17645      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
17646    if (json.has("compartment")) {
17647      JsonArray array = getJArray(json, "compartment");
17648      for (int i = 0; i < array.size(); i++) {
17649        res.getCompartment().add(parseGraphDefinitionLinkCompartmentComponent(array.get(i).getAsJsonObject()));
17650      }
17651    };
17652  }
17653
17654  protected GraphDefinition.GraphDefinitionLinkCompartmentComponent parseGraphDefinitionLinkCompartmentComponent(JsonObject json) throws IOException, FHIRFormatError {
17655    GraphDefinition.GraphDefinitionLinkCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkCompartmentComponent();
17656    parseGraphDefinitionLinkCompartmentComponentProperties(json, res);
17657    return res;
17658  }
17659
17660  protected void parseGraphDefinitionLinkCompartmentComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkCompartmentComponent res) throws IOException, FHIRFormatError {
17661    parseBackboneElementProperties(json, res);
17662    if (json.has("use"))
17663      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
17664    if (json.has("_use"))
17665      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
17666    if (json.has("rule"))
17667      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
17668    if (json.has("_rule"))
17669      parseElementProperties(getJObject(json, "_rule"), res.getRuleElement());
17670    if (json.has("code"))
17671      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
17672    if (json.has("_code"))
17673      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
17674    if (json.has("expression"))
17675      res.setExpressionElement(parseString(json.get("expression").getAsString()));
17676    if (json.has("_expression"))
17677      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
17678    if (json.has("description"))
17679      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17680    if (json.has("_description"))
17681      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17682  }
17683
17684  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
17685    Group res = new Group();
17686    parseGroupProperties(json, res);
17687    return res;
17688  }
17689
17690  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
17691    parseDomainResourceProperties(json, res);
17692    if (json.has("identifier")) {
17693      JsonArray array = getJArray(json, "identifier");
17694      for (int i = 0; i < array.size(); i++) {
17695        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17696      }
17697    };
17698    if (json.has("active"))
17699      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
17700    if (json.has("_active"))
17701      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
17702    if (json.has("type"))
17703      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
17704    if (json.has("_type"))
17705      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17706    if (json.has("membership"))
17707      res.setMembershipElement(parseEnumeration(json.get("membership").getAsString(), Group.GroupMembershipBasis.NULL, new Group.GroupMembershipBasisEnumFactory()));
17708    if (json.has("_membership"))
17709      parseElementProperties(getJObject(json, "_membership"), res.getMembershipElement());
17710    if (json.has("code"))
17711      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17712    if (json.has("name"))
17713      res.setNameElement(parseString(json.get("name").getAsString()));
17714    if (json.has("_name"))
17715      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17716    if (json.has("description"))
17717      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17718    if (json.has("_description"))
17719      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17720    if (json.has("quantity"))
17721      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
17722    if (json.has("_quantity"))
17723      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
17724    if (json.has("managingEntity"))
17725      res.setManagingEntity(parseReference(getJObject(json, "managingEntity")));
17726    if (json.has("characteristic")) {
17727      JsonArray array = getJArray(json, "characteristic");
17728      for (int i = 0; i < array.size(); i++) {
17729        res.getCharacteristic().add(parseGroupCharacteristicComponent(array.get(i).getAsJsonObject()));
17730      }
17731    };
17732    if (json.has("member")) {
17733      JsonArray array = getJArray(json, "member");
17734      for (int i = 0; i < array.size(); i++) {
17735        res.getMember().add(parseGroupMemberComponent(array.get(i).getAsJsonObject()));
17736      }
17737    };
17738  }
17739
17740  protected Group.GroupCharacteristicComponent parseGroupCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
17741    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
17742    parseGroupCharacteristicComponentProperties(json, res);
17743    return res;
17744  }
17745
17746  protected void parseGroupCharacteristicComponentProperties(JsonObject json, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
17747    parseBackboneElementProperties(json, res);
17748    if (json.has("code"))
17749      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17750    DataType value = parseType("value", json);
17751    if (value != null)
17752      res.setValue(value);
17753    if (json.has("exclude"))
17754      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
17755    if (json.has("_exclude"))
17756      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
17757    if (json.has("period"))
17758      res.setPeriod(parsePeriod(getJObject(json, "period")));
17759  }
17760
17761  protected Group.GroupMemberComponent parseGroupMemberComponent(JsonObject json) throws IOException, FHIRFormatError {
17762    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
17763    parseGroupMemberComponentProperties(json, res);
17764    return res;
17765  }
17766
17767  protected void parseGroupMemberComponentProperties(JsonObject json, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
17768    parseBackboneElementProperties(json, res);
17769    if (json.has("entity"))
17770      res.setEntity(parseReference(getJObject(json, "entity")));
17771    if (json.has("period"))
17772      res.setPeriod(parsePeriod(getJObject(json, "period")));
17773    if (json.has("inactive"))
17774      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
17775    if (json.has("_inactive"))
17776      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
17777  }
17778
17779  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
17780    GuidanceResponse res = new GuidanceResponse();
17781    parseGuidanceResponseProperties(json, res);
17782    return res;
17783  }
17784
17785  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
17786    parseDomainResourceProperties(json, res);
17787    if (json.has("requestIdentifier"))
17788      res.setRequestIdentifier(parseIdentifier(getJObject(json, "requestIdentifier")));
17789    if (json.has("identifier")) {
17790      JsonArray array = getJArray(json, "identifier");
17791      for (int i = 0; i < array.size(); i++) {
17792        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17793      }
17794    };
17795    DataType module = parseType("module", json);
17796    if (module != null)
17797      res.setModule(module);
17798    if (json.has("status"))
17799      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
17800    if (json.has("_status"))
17801      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17802    if (json.has("subject"))
17803      res.setSubject(parseReference(getJObject(json, "subject")));
17804    if (json.has("encounter"))
17805      res.setEncounter(parseReference(getJObject(json, "encounter")));
17806    if (json.has("occurrenceDateTime"))
17807      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
17808    if (json.has("_occurrenceDateTime"))
17809      parseElementProperties(getJObject(json, "_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
17810    if (json.has("performer"))
17811      res.setPerformer(parseReference(getJObject(json, "performer")));
17812    if (json.has("reason")) {
17813      JsonArray array = getJArray(json, "reason");
17814      for (int i = 0; i < array.size(); i++) {
17815        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
17816      }
17817    };
17818    if (json.has("note")) {
17819      JsonArray array = getJArray(json, "note");
17820      for (int i = 0; i < array.size(); i++) {
17821        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17822      }
17823    };
17824    if (json.has("evaluationMessage"))
17825      res.setEvaluationMessage(parseReference(getJObject(json, "evaluationMessage")));
17826    if (json.has("outputParameters"))
17827      res.setOutputParameters(parseReference(getJObject(json, "outputParameters")));
17828    if (json.has("result")) {
17829      JsonArray array = getJArray(json, "result");
17830      for (int i = 0; i < array.size(); i++) {
17831        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
17832      }
17833    };
17834    if (json.has("dataRequirement")) {
17835      JsonArray array = getJArray(json, "dataRequirement");
17836      for (int i = 0; i < array.size(); i++) {
17837        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
17838      }
17839    };
17840  }
17841
17842  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
17843    HealthcareService res = new HealthcareService();
17844    parseHealthcareServiceProperties(json, res);
17845    return res;
17846  }
17847
17848  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
17849    parseDomainResourceProperties(json, res);
17850    if (json.has("identifier")) {
17851      JsonArray array = getJArray(json, "identifier");
17852      for (int i = 0; i < array.size(); i++) {
17853        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17854      }
17855    };
17856    if (json.has("active"))
17857      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
17858    if (json.has("_active"))
17859      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
17860    if (json.has("providedBy"))
17861      res.setProvidedBy(parseReference(getJObject(json, "providedBy")));
17862    if (json.has("offeredIn")) {
17863      JsonArray array = getJArray(json, "offeredIn");
17864      for (int i = 0; i < array.size(); i++) {
17865        res.getOfferedIn().add(parseReference(array.get(i).getAsJsonObject()));
17866      }
17867    };
17868    if (json.has("category")) {
17869      JsonArray array = getJArray(json, "category");
17870      for (int i = 0; i < array.size(); i++) {
17871        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17872      }
17873    };
17874    if (json.has("type")) {
17875      JsonArray array = getJArray(json, "type");
17876      for (int i = 0; i < array.size(); i++) {
17877        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17878      }
17879    };
17880    if (json.has("specialty")) {
17881      JsonArray array = getJArray(json, "specialty");
17882      for (int i = 0; i < array.size(); i++) {
17883        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17884      }
17885    };
17886    if (json.has("location")) {
17887      JsonArray array = getJArray(json, "location");
17888      for (int i = 0; i < array.size(); i++) {
17889        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
17890      }
17891    };
17892    if (json.has("name"))
17893      res.setNameElement(parseString(json.get("name").getAsString()));
17894    if (json.has("_name"))
17895      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17896    if (json.has("comment"))
17897      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
17898    if (json.has("_comment"))
17899      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
17900    if (json.has("extraDetails"))
17901      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
17902    if (json.has("_extraDetails"))
17903      parseElementProperties(getJObject(json, "_extraDetails"), res.getExtraDetailsElement());
17904    if (json.has("photo"))
17905      res.setPhoto(parseAttachment(getJObject(json, "photo")));
17906    if (json.has("contact")) {
17907      JsonArray array = getJArray(json, "contact");
17908      for (int i = 0; i < array.size(); i++) {
17909        res.getContact().add(parseExtendedContactDetail(array.get(i).getAsJsonObject()));
17910      }
17911    };
17912    if (json.has("coverageArea")) {
17913      JsonArray array = getJArray(json, "coverageArea");
17914      for (int i = 0; i < array.size(); i++) {
17915        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
17916      }
17917    };
17918    if (json.has("serviceProvisionCode")) {
17919      JsonArray array = getJArray(json, "serviceProvisionCode");
17920      for (int i = 0; i < array.size(); i++) {
17921        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17922      }
17923    };
17924    if (json.has("eligibility")) {
17925      JsonArray array = getJArray(json, "eligibility");
17926      for (int i = 0; i < array.size(); i++) {
17927        res.getEligibility().add(parseHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject()));
17928      }
17929    };
17930    if (json.has("program")) {
17931      JsonArray array = getJArray(json, "program");
17932      for (int i = 0; i < array.size(); i++) {
17933        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17934      }
17935    };
17936    if (json.has("characteristic")) {
17937      JsonArray array = getJArray(json, "characteristic");
17938      for (int i = 0; i < array.size(); i++) {
17939        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17940      }
17941    };
17942    if (json.has("communication")) {
17943      JsonArray array = getJArray(json, "communication");
17944      for (int i = 0; i < array.size(); i++) {
17945        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17946      }
17947    };
17948    if (json.has("referralMethod")) {
17949      JsonArray array = getJArray(json, "referralMethod");
17950      for (int i = 0; i < array.size(); i++) {
17951        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17952      }
17953    };
17954    if (json.has("appointmentRequired"))
17955      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
17956    if (json.has("_appointmentRequired"))
17957      parseElementProperties(getJObject(json, "_appointmentRequired"), res.getAppointmentRequiredElement());
17958    if (json.has("availability")) {
17959      JsonArray array = getJArray(json, "availability");
17960      for (int i = 0; i < array.size(); i++) {
17961        res.getAvailability().add(parseAvailability(array.get(i).getAsJsonObject()));
17962      }
17963    };
17964    if (json.has("endpoint")) {
17965      JsonArray array = getJArray(json, "endpoint");
17966      for (int i = 0; i < array.size(); i++) {
17967        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
17968      }
17969    };
17970  }
17971
17972  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceEligibilityComponent(JsonObject json) throws IOException, FHIRFormatError {
17973    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
17974    parseHealthcareServiceEligibilityComponentProperties(json, res);
17975    return res;
17976  }
17977
17978  protected void parseHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
17979    parseBackboneElementProperties(json, res);
17980    if (json.has("code"))
17981      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17982    if (json.has("comment"))
17983      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
17984    if (json.has("_comment"))
17985      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
17986  }
17987
17988  protected ImagingSelection parseImagingSelection(JsonObject json) throws IOException, FHIRFormatError {
17989    ImagingSelection res = new ImagingSelection();
17990    parseImagingSelectionProperties(json, res);
17991    return res;
17992  }
17993
17994  protected void parseImagingSelectionProperties(JsonObject json, ImagingSelection res) throws IOException, FHIRFormatError {
17995    parseDomainResourceProperties(json, res);
17996    if (json.has("identifier")) {
17997      JsonArray array = getJArray(json, "identifier");
17998      for (int i = 0; i < array.size(); i++) {
17999        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18000      }
18001    };
18002    if (json.has("status"))
18003      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingSelection.ImagingSelectionStatus.NULL, new ImagingSelection.ImagingSelectionStatusEnumFactory()));
18004    if (json.has("_status"))
18005      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18006    if (json.has("subject"))
18007      res.setSubject(parseReference(getJObject(json, "subject")));
18008    if (json.has("issued"))
18009      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
18010    if (json.has("_issued"))
18011      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
18012    if (json.has("performer")) {
18013      JsonArray array = getJArray(json, "performer");
18014      for (int i = 0; i < array.size(); i++) {
18015        res.getPerformer().add(parseImagingSelectionPerformerComponent(array.get(i).getAsJsonObject()));
18016      }
18017    };
18018    if (json.has("basedOn")) {
18019      JsonArray array = getJArray(json, "basedOn");
18020      for (int i = 0; i < array.size(); i++) {
18021        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18022      }
18023    };
18024    if (json.has("category")) {
18025      JsonArray array = getJArray(json, "category");
18026      for (int i = 0; i < array.size(); i++) {
18027        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18028      }
18029    };
18030    if (json.has("code"))
18031      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18032    if (json.has("studyUid"))
18033      res.setStudyUidElement(parseId(json.get("studyUid").getAsString()));
18034    if (json.has("_studyUid"))
18035      parseElementProperties(getJObject(json, "_studyUid"), res.getStudyUidElement());
18036    if (json.has("derivedFrom")) {
18037      JsonArray array = getJArray(json, "derivedFrom");
18038      for (int i = 0; i < array.size(); i++) {
18039        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
18040      }
18041    };
18042    if (json.has("endpoint")) {
18043      JsonArray array = getJArray(json, "endpoint");
18044      for (int i = 0; i < array.size(); i++) {
18045        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
18046      }
18047    };
18048    if (json.has("seriesUid"))
18049      res.setSeriesUidElement(parseId(json.get("seriesUid").getAsString()));
18050    if (json.has("_seriesUid"))
18051      parseElementProperties(getJObject(json, "_seriesUid"), res.getSeriesUidElement());
18052    if (json.has("seriesNumber"))
18053      res.setSeriesNumberElement(parseUnsignedInt(json.get("seriesNumber").getAsString()));
18054    if (json.has("_seriesNumber"))
18055      parseElementProperties(getJObject(json, "_seriesNumber"), res.getSeriesNumberElement());
18056    if (json.has("frameOfReferenceUid"))
18057      res.setFrameOfReferenceUidElement(parseId(json.get("frameOfReferenceUid").getAsString()));
18058    if (json.has("_frameOfReferenceUid"))
18059      parseElementProperties(getJObject(json, "_frameOfReferenceUid"), res.getFrameOfReferenceUidElement());
18060    if (json.has("bodySite"))
18061      res.setBodySite(parseCodeableReference(getJObject(json, "bodySite")));
18062    if (json.has("focus")) {
18063      JsonArray array = getJArray(json, "focus");
18064      for (int i = 0; i < array.size(); i++) {
18065        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18066      }
18067    };
18068    if (json.has("instance")) {
18069      JsonArray array = getJArray(json, "instance");
18070      for (int i = 0; i < array.size(); i++) {
18071        res.getInstance().add(parseImagingSelectionInstanceComponent(array.get(i).getAsJsonObject()));
18072      }
18073    };
18074  }
18075
18076  protected ImagingSelection.ImagingSelectionPerformerComponent parseImagingSelectionPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
18077    ImagingSelection.ImagingSelectionPerformerComponent res = new ImagingSelection.ImagingSelectionPerformerComponent();
18078    parseImagingSelectionPerformerComponentProperties(json, res);
18079    return res;
18080  }
18081
18082  protected void parseImagingSelectionPerformerComponentProperties(JsonObject json, ImagingSelection.ImagingSelectionPerformerComponent res) throws IOException, FHIRFormatError {
18083    parseBackboneElementProperties(json, res);
18084    if (json.has("function"))
18085      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
18086    if (json.has("actor"))
18087      res.setActor(parseReference(getJObject(json, "actor")));
18088  }
18089
18090  protected ImagingSelection.ImagingSelectionInstanceComponent parseImagingSelectionInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
18091    ImagingSelection.ImagingSelectionInstanceComponent res = new ImagingSelection.ImagingSelectionInstanceComponent();
18092    parseImagingSelectionInstanceComponentProperties(json, res);
18093    return res;
18094  }
18095
18096  protected void parseImagingSelectionInstanceComponentProperties(JsonObject json, ImagingSelection.ImagingSelectionInstanceComponent res) throws IOException, FHIRFormatError {
18097    parseBackboneElementProperties(json, res);
18098    if (json.has("uid"))
18099      res.setUidElement(parseId(json.get("uid").getAsString()));
18100    if (json.has("_uid"))
18101      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
18102    if (json.has("number"))
18103      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
18104    if (json.has("_number"))
18105      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
18106    if (json.has("sopClass"))
18107      res.setSopClass(parseCoding(getJObject(json, "sopClass")));
18108    if (json.has("subset")) {
18109      JsonArray array = getJArray(json, "subset");
18110      for (int i = 0; i < array.size(); i++) {
18111        if (array.get(i).isJsonNull()) {
18112          res.getSubset().add(new StringType());
18113        } else {;
18114          res.getSubset().add(parseString(array.get(i).getAsString()));
18115        }
18116      }
18117    };
18118    if (json.has("_subset")) {
18119      JsonArray array = getJArray(json, "_subset");
18120      for (int i = 0; i < array.size(); i++) {
18121        if (i == res.getSubset().size())
18122          res.getSubset().add(parseString(null));
18123        if (array.get(i) instanceof JsonObject) 
18124          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubset().get(i));
18125      }
18126    };
18127    if (json.has("imageRegion2D")) {
18128      JsonArray array = getJArray(json, "imageRegion2D");
18129      for (int i = 0; i < array.size(); i++) {
18130        res.getImageRegion2D().add(parseImagingSelectionImageRegion2DComponent(array.get(i).getAsJsonObject()));
18131      }
18132    };
18133    if (json.has("imageRegion3D")) {
18134      JsonArray array = getJArray(json, "imageRegion3D");
18135      for (int i = 0; i < array.size(); i++) {
18136        res.getImageRegion3D().add(parseImagingSelectionImageRegion3DComponent(array.get(i).getAsJsonObject()));
18137      }
18138    };
18139  }
18140
18141  protected ImagingSelection.ImageRegion2DComponent parseImagingSelectionImageRegion2DComponent(JsonObject json) throws IOException, FHIRFormatError {
18142    ImagingSelection.ImageRegion2DComponent res = new ImagingSelection.ImageRegion2DComponent();
18143    parseImagingSelectionImageRegion2DComponentProperties(json, res);
18144    return res;
18145  }
18146
18147  protected void parseImagingSelectionImageRegion2DComponentProperties(JsonObject json, ImagingSelection.ImageRegion2DComponent res) throws IOException, FHIRFormatError {
18148    parseBackboneElementProperties(json, res);
18149    if (json.has("regionType"))
18150      res.setRegionTypeElement(parseEnumeration(json.get("regionType").getAsString(), ImagingSelection.ImagingSelection2DGraphicType.NULL, new ImagingSelection.ImagingSelection2DGraphicTypeEnumFactory()));
18151    if (json.has("_regionType"))
18152      parseElementProperties(getJObject(json, "_regionType"), res.getRegionTypeElement());
18153    if (json.has("coordinate")) {
18154      JsonArray array = getJArray(json, "coordinate");
18155      for (int i = 0; i < array.size(); i++) {
18156        if (array.get(i).isJsonNull()) {
18157          res.getCoordinate().add(new DecimalType());
18158        } else {;
18159          res.getCoordinate().add(parseDecimal(array.get(i).getAsBigDecimal()));
18160        }
18161      }
18162    };
18163    if (json.has("_coordinate")) {
18164      JsonArray array = getJArray(json, "_coordinate");
18165      for (int i = 0; i < array.size(); i++) {
18166        if (i == res.getCoordinate().size())
18167          res.getCoordinate().add(parseDecimal(null));
18168        if (array.get(i) instanceof JsonObject) 
18169          parseElementProperties(array.get(i).getAsJsonObject(), res.getCoordinate().get(i));
18170      }
18171    };
18172  }
18173
18174  protected ImagingSelection.ImageRegion3DComponent parseImagingSelectionImageRegion3DComponent(JsonObject json) throws IOException, FHIRFormatError {
18175    ImagingSelection.ImageRegion3DComponent res = new ImagingSelection.ImageRegion3DComponent();
18176    parseImagingSelectionImageRegion3DComponentProperties(json, res);
18177    return res;
18178  }
18179
18180  protected void parseImagingSelectionImageRegion3DComponentProperties(JsonObject json, ImagingSelection.ImageRegion3DComponent res) throws IOException, FHIRFormatError {
18181    parseBackboneElementProperties(json, res);
18182    if (json.has("regionType"))
18183      res.setRegionTypeElement(parseEnumeration(json.get("regionType").getAsString(), ImagingSelection.ImagingSelection3DGraphicType.NULL, new ImagingSelection.ImagingSelection3DGraphicTypeEnumFactory()));
18184    if (json.has("_regionType"))
18185      parseElementProperties(getJObject(json, "_regionType"), res.getRegionTypeElement());
18186    if (json.has("coordinate")) {
18187      JsonArray array = getJArray(json, "coordinate");
18188      for (int i = 0; i < array.size(); i++) {
18189        if (array.get(i).isJsonNull()) {
18190          res.getCoordinate().add(new DecimalType());
18191        } else {;
18192          res.getCoordinate().add(parseDecimal(array.get(i).getAsBigDecimal()));
18193        }
18194      }
18195    };
18196    if (json.has("_coordinate")) {
18197      JsonArray array = getJArray(json, "_coordinate");
18198      for (int i = 0; i < array.size(); i++) {
18199        if (i == res.getCoordinate().size())
18200          res.getCoordinate().add(parseDecimal(null));
18201        if (array.get(i) instanceof JsonObject) 
18202          parseElementProperties(array.get(i).getAsJsonObject(), res.getCoordinate().get(i));
18203      }
18204    };
18205  }
18206
18207  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
18208    ImagingStudy res = new ImagingStudy();
18209    parseImagingStudyProperties(json, res);
18210    return res;
18211  }
18212
18213  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
18214    parseDomainResourceProperties(json, res);
18215    if (json.has("identifier")) {
18216      JsonArray array = getJArray(json, "identifier");
18217      for (int i = 0; i < array.size(); i++) {
18218        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18219      }
18220    };
18221    if (json.has("status"))
18222      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
18223    if (json.has("_status"))
18224      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18225    if (json.has("modality")) {
18226      JsonArray array = getJArray(json, "modality");
18227      for (int i = 0; i < array.size(); i++) {
18228        res.getModality().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18229      }
18230    };
18231    if (json.has("subject"))
18232      res.setSubject(parseReference(getJObject(json, "subject")));
18233    if (json.has("encounter"))
18234      res.setEncounter(parseReference(getJObject(json, "encounter")));
18235    if (json.has("started"))
18236      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
18237    if (json.has("_started"))
18238      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
18239    if (json.has("basedOn")) {
18240      JsonArray array = getJArray(json, "basedOn");
18241      for (int i = 0; i < array.size(); i++) {
18242        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18243      }
18244    };
18245    if (json.has("partOf")) {
18246      JsonArray array = getJArray(json, "partOf");
18247      for (int i = 0; i < array.size(); i++) {
18248        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18249      }
18250    };
18251    if (json.has("referrer"))
18252      res.setReferrer(parseReference(getJObject(json, "referrer")));
18253    if (json.has("endpoint")) {
18254      JsonArray array = getJArray(json, "endpoint");
18255      for (int i = 0; i < array.size(); i++) {
18256        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
18257      }
18258    };
18259    if (json.has("numberOfSeries"))
18260      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
18261    if (json.has("_numberOfSeries"))
18262      parseElementProperties(getJObject(json, "_numberOfSeries"), res.getNumberOfSeriesElement());
18263    if (json.has("numberOfInstances"))
18264      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
18265    if (json.has("_numberOfInstances"))
18266      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
18267    if (json.has("procedure")) {
18268      JsonArray array = getJArray(json, "procedure");
18269      for (int i = 0; i < array.size(); i++) {
18270        res.getProcedure().add(parseCodeableReference(array.get(i).getAsJsonObject()));
18271      }
18272    };
18273    if (json.has("location"))
18274      res.setLocation(parseReference(getJObject(json, "location")));
18275    if (json.has("reason")) {
18276      JsonArray array = getJArray(json, "reason");
18277      for (int i = 0; i < array.size(); i++) {
18278        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
18279      }
18280    };
18281    if (json.has("note")) {
18282      JsonArray array = getJArray(json, "note");
18283      for (int i = 0; i < array.size(); i++) {
18284        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18285      }
18286    };
18287    if (json.has("description"))
18288      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18289    if (json.has("_description"))
18290      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18291    if (json.has("series")) {
18292      JsonArray array = getJArray(json, "series");
18293      for (int i = 0; i < array.size(); i++) {
18294        res.getSeries().add(parseImagingStudySeriesComponent(array.get(i).getAsJsonObject()));
18295      }
18296    };
18297  }
18298
18299  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudySeriesComponent(JsonObject json) throws IOException, FHIRFormatError {
18300    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
18301    parseImagingStudySeriesComponentProperties(json, res);
18302    return res;
18303  }
18304
18305  protected void parseImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
18306    parseBackboneElementProperties(json, res);
18307    if (json.has("uid"))
18308      res.setUidElement(parseId(json.get("uid").getAsString()));
18309    if (json.has("_uid"))
18310      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
18311    if (json.has("number"))
18312      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
18313    if (json.has("_number"))
18314      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
18315    if (json.has("modality"))
18316      res.setModality(parseCodeableConcept(getJObject(json, "modality")));
18317    if (json.has("description"))
18318      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18319    if (json.has("_description"))
18320      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18321    if (json.has("numberOfInstances"))
18322      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
18323    if (json.has("_numberOfInstances"))
18324      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
18325    if (json.has("endpoint")) {
18326      JsonArray array = getJArray(json, "endpoint");
18327      for (int i = 0; i < array.size(); i++) {
18328        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
18329      }
18330    };
18331    if (json.has("bodySite"))
18332      res.setBodySite(parseCodeableReference(getJObject(json, "bodySite")));
18333    if (json.has("laterality"))
18334      res.setLaterality(parseCodeableConcept(getJObject(json, "laterality")));
18335    if (json.has("specimen")) {
18336      JsonArray array = getJArray(json, "specimen");
18337      for (int i = 0; i < array.size(); i++) {
18338        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
18339      }
18340    };
18341    if (json.has("started"))
18342      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
18343    if (json.has("_started"))
18344      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
18345    if (json.has("performer")) {
18346      JsonArray array = getJArray(json, "performer");
18347      for (int i = 0; i < array.size(); i++) {
18348        res.getPerformer().add(parseImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject()));
18349      }
18350    };
18351    if (json.has("instance")) {
18352      JsonArray array = getJArray(json, "instance");
18353      for (int i = 0; i < array.size(); i++) {
18354        res.getInstance().add(parseImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject()));
18355      }
18356    };
18357  }
18358
18359  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudySeriesPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
18360    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
18361    parseImagingStudySeriesPerformerComponentProperties(json, res);
18362    return res;
18363  }
18364
18365  protected void parseImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
18366    parseBackboneElementProperties(json, res);
18367    if (json.has("function"))
18368      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
18369    if (json.has("actor"))
18370      res.setActor(parseReference(getJObject(json, "actor")));
18371  }
18372
18373  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudySeriesInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
18374    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
18375    parseImagingStudySeriesInstanceComponentProperties(json, res);
18376    return res;
18377  }
18378
18379  protected void parseImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
18380    parseBackboneElementProperties(json, res);
18381    if (json.has("uid"))
18382      res.setUidElement(parseId(json.get("uid").getAsString()));
18383    if (json.has("_uid"))
18384      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
18385    if (json.has("sopClass"))
18386      res.setSopClass(parseCoding(getJObject(json, "sopClass")));
18387    if (json.has("number"))
18388      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
18389    if (json.has("_number"))
18390      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
18391    if (json.has("title"))
18392      res.setTitleElement(parseString(json.get("title").getAsString()));
18393    if (json.has("_title"))
18394      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
18395  }
18396
18397  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
18398    Immunization res = new Immunization();
18399    parseImmunizationProperties(json, res);
18400    return res;
18401  }
18402
18403  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
18404    parseDomainResourceProperties(json, res);
18405    if (json.has("identifier")) {
18406      JsonArray array = getJArray(json, "identifier");
18407      for (int i = 0; i < array.size(); i++) {
18408        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18409      }
18410    };
18411    if (json.has("basedOn")) {
18412      JsonArray array = getJArray(json, "basedOn");
18413      for (int i = 0; i < array.size(); i++) {
18414        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18415      }
18416    };
18417    if (json.has("status"))
18418      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatusCodes.NULL, new Immunization.ImmunizationStatusCodesEnumFactory()));
18419    if (json.has("_status"))
18420      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18421    if (json.has("statusReason"))
18422      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
18423    if (json.has("vaccineCode"))
18424      res.setVaccineCode(parseCodeableConcept(getJObject(json, "vaccineCode")));
18425    if (json.has("administeredProduct"))
18426      res.setAdministeredProduct(parseCodeableReference(getJObject(json, "administeredProduct")));
18427    if (json.has("manufacturer"))
18428      res.setManufacturer(parseCodeableReference(getJObject(json, "manufacturer")));
18429    if (json.has("lotNumber"))
18430      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
18431    if (json.has("_lotNumber"))
18432      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
18433    if (json.has("expirationDate"))
18434      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
18435    if (json.has("_expirationDate"))
18436      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
18437    if (json.has("patient"))
18438      res.setPatient(parseReference(getJObject(json, "patient")));
18439    if (json.has("encounter"))
18440      res.setEncounter(parseReference(getJObject(json, "encounter")));
18441    if (json.has("supportingInformation")) {
18442      JsonArray array = getJArray(json, "supportingInformation");
18443      for (int i = 0; i < array.size(); i++) {
18444        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
18445      }
18446    };
18447    DataType occurrence = parseType("occurrence", json);
18448    if (occurrence != null)
18449      res.setOccurrence(occurrence);
18450    if (json.has("primarySource"))
18451      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
18452    if (json.has("_primarySource"))
18453      parseElementProperties(getJObject(json, "_primarySource"), res.getPrimarySourceElement());
18454    if (json.has("informationSource"))
18455      res.setInformationSource(parseCodeableReference(getJObject(json, "informationSource")));
18456    if (json.has("location"))
18457      res.setLocation(parseReference(getJObject(json, "location")));
18458    if (json.has("site"))
18459      res.setSite(parseCodeableConcept(getJObject(json, "site")));
18460    if (json.has("route"))
18461      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
18462    if (json.has("doseQuantity"))
18463      res.setDoseQuantity(parseQuantity(getJObject(json, "doseQuantity")));
18464    if (json.has("performer")) {
18465      JsonArray array = getJArray(json, "performer");
18466      for (int i = 0; i < array.size(); i++) {
18467        res.getPerformer().add(parseImmunizationPerformerComponent(array.get(i).getAsJsonObject()));
18468      }
18469    };
18470    if (json.has("note")) {
18471      JsonArray array = getJArray(json, "note");
18472      for (int i = 0; i < array.size(); i++) {
18473        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18474      }
18475    };
18476    if (json.has("reason")) {
18477      JsonArray array = getJArray(json, "reason");
18478      for (int i = 0; i < array.size(); i++) {
18479        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
18480      }
18481    };
18482    if (json.has("isSubpotent"))
18483      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
18484    if (json.has("_isSubpotent"))
18485      parseElementProperties(getJObject(json, "_isSubpotent"), res.getIsSubpotentElement());
18486    if (json.has("subpotentReason")) {
18487      JsonArray array = getJArray(json, "subpotentReason");
18488      for (int i = 0; i < array.size(); i++) {
18489        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18490      }
18491    };
18492    if (json.has("programEligibility")) {
18493      JsonArray array = getJArray(json, "programEligibility");
18494      for (int i = 0; i < array.size(); i++) {
18495        res.getProgramEligibility().add(parseImmunizationProgramEligibilityComponent(array.get(i).getAsJsonObject()));
18496      }
18497    };
18498    if (json.has("fundingSource"))
18499      res.setFundingSource(parseCodeableConcept(getJObject(json, "fundingSource")));
18500    if (json.has("reaction")) {
18501      JsonArray array = getJArray(json, "reaction");
18502      for (int i = 0; i < array.size(); i++) {
18503        res.getReaction().add(parseImmunizationReactionComponent(array.get(i).getAsJsonObject()));
18504      }
18505    };
18506    if (json.has("protocolApplied")) {
18507      JsonArray array = getJArray(json, "protocolApplied");
18508      for (int i = 0; i < array.size(); i++) {
18509        res.getProtocolApplied().add(parseImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject()));
18510      }
18511    };
18512  }
18513
18514  protected Immunization.ImmunizationPerformerComponent parseImmunizationPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
18515    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
18516    parseImmunizationPerformerComponentProperties(json, res);
18517    return res;
18518  }
18519
18520  protected void parseImmunizationPerformerComponentProperties(JsonObject json, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
18521    parseBackboneElementProperties(json, res);
18522    if (json.has("function"))
18523      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
18524    if (json.has("actor"))
18525      res.setActor(parseReference(getJObject(json, "actor")));
18526  }
18527
18528  protected Immunization.ImmunizationProgramEligibilityComponent parseImmunizationProgramEligibilityComponent(JsonObject json) throws IOException, FHIRFormatError {
18529    Immunization.ImmunizationProgramEligibilityComponent res = new Immunization.ImmunizationProgramEligibilityComponent();
18530    parseImmunizationProgramEligibilityComponentProperties(json, res);
18531    return res;
18532  }
18533
18534  protected void parseImmunizationProgramEligibilityComponentProperties(JsonObject json, Immunization.ImmunizationProgramEligibilityComponent res) throws IOException, FHIRFormatError {
18535    parseBackboneElementProperties(json, res);
18536    if (json.has("program"))
18537      res.setProgram(parseCodeableConcept(getJObject(json, "program")));
18538    if (json.has("programStatus"))
18539      res.setProgramStatus(parseCodeableConcept(getJObject(json, "programStatus")));
18540  }
18541
18542  protected Immunization.ImmunizationReactionComponent parseImmunizationReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
18543    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
18544    parseImmunizationReactionComponentProperties(json, res);
18545    return res;
18546  }
18547
18548  protected void parseImmunizationReactionComponentProperties(JsonObject json, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
18549    parseBackboneElementProperties(json, res);
18550    if (json.has("date"))
18551      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18552    if (json.has("_date"))
18553      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
18554    if (json.has("manifestation"))
18555      res.setManifestation(parseCodeableReference(getJObject(json, "manifestation")));
18556    if (json.has("reported"))
18557      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
18558    if (json.has("_reported"))
18559      parseElementProperties(getJObject(json, "_reported"), res.getReportedElement());
18560  }
18561
18562  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationProtocolAppliedComponent(JsonObject json) throws IOException, FHIRFormatError {
18563    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
18564    parseImmunizationProtocolAppliedComponentProperties(json, res);
18565    return res;
18566  }
18567
18568  protected void parseImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
18569    parseBackboneElementProperties(json, res);
18570    if (json.has("series"))
18571      res.setSeriesElement(parseString(json.get("series").getAsString()));
18572    if (json.has("_series"))
18573      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
18574    if (json.has("authority"))
18575      res.setAuthority(parseReference(getJObject(json, "authority")));
18576    if (json.has("targetDisease")) {
18577      JsonArray array = getJArray(json, "targetDisease");
18578      for (int i = 0; i < array.size(); i++) {
18579        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18580      }
18581    };
18582    if (json.has("doseNumber"))
18583      res.setDoseNumberElement(parseString(json.get("doseNumber").getAsString()));
18584    if (json.has("_doseNumber"))
18585      parseElementProperties(getJObject(json, "_doseNumber"), res.getDoseNumberElement());
18586    if (json.has("seriesDoses"))
18587      res.setSeriesDosesElement(parseString(json.get("seriesDoses").getAsString()));
18588    if (json.has("_seriesDoses"))
18589      parseElementProperties(getJObject(json, "_seriesDoses"), res.getSeriesDosesElement());
18590  }
18591
18592  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
18593    ImmunizationEvaluation res = new ImmunizationEvaluation();
18594    parseImmunizationEvaluationProperties(json, res);
18595    return res;
18596  }
18597
18598  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
18599    parseDomainResourceProperties(json, res);
18600    if (json.has("identifier")) {
18601      JsonArray array = getJArray(json, "identifier");
18602      for (int i = 0; i < array.size(); i++) {
18603        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18604      }
18605    };
18606    if (json.has("status"))
18607      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory()));
18608    if (json.has("_status"))
18609      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18610    if (json.has("patient"))
18611      res.setPatient(parseReference(getJObject(json, "patient")));
18612    if (json.has("date"))
18613      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18614    if (json.has("_date"))
18615      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
18616    if (json.has("authority"))
18617      res.setAuthority(parseReference(getJObject(json, "authority")));
18618    if (json.has("targetDisease"))
18619      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
18620    if (json.has("immunizationEvent"))
18621      res.setImmunizationEvent(parseReference(getJObject(json, "immunizationEvent")));
18622    if (json.has("doseStatus"))
18623      res.setDoseStatus(parseCodeableConcept(getJObject(json, "doseStatus")));
18624    if (json.has("doseStatusReason")) {
18625      JsonArray array = getJArray(json, "doseStatusReason");
18626      for (int i = 0; i < array.size(); i++) {
18627        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18628      }
18629    };
18630    if (json.has("description"))
18631      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18632    if (json.has("_description"))
18633      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18634    if (json.has("series"))
18635      res.setSeriesElement(parseString(json.get("series").getAsString()));
18636    if (json.has("_series"))
18637      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
18638    if (json.has("doseNumber"))
18639      res.setDoseNumberElement(parseString(json.get("doseNumber").getAsString()));
18640    if (json.has("_doseNumber"))
18641      parseElementProperties(getJObject(json, "_doseNumber"), res.getDoseNumberElement());
18642    if (json.has("seriesDoses"))
18643      res.setSeriesDosesElement(parseString(json.get("seriesDoses").getAsString()));
18644    if (json.has("_seriesDoses"))
18645      parseElementProperties(getJObject(json, "_seriesDoses"), res.getSeriesDosesElement());
18646  }
18647
18648  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
18649    ImmunizationRecommendation res = new ImmunizationRecommendation();
18650    parseImmunizationRecommendationProperties(json, res);
18651    return res;
18652  }
18653
18654  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
18655    parseDomainResourceProperties(json, res);
18656    if (json.has("identifier")) {
18657      JsonArray array = getJArray(json, "identifier");
18658      for (int i = 0; i < array.size(); i++) {
18659        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18660      }
18661    };
18662    if (json.has("patient"))
18663      res.setPatient(parseReference(getJObject(json, "patient")));
18664    if (json.has("date"))
18665      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18666    if (json.has("_date"))
18667      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
18668    if (json.has("authority"))
18669      res.setAuthority(parseReference(getJObject(json, "authority")));
18670    if (json.has("recommendation")) {
18671      JsonArray array = getJArray(json, "recommendation");
18672      for (int i = 0; i < array.size(); i++) {
18673        res.getRecommendation().add(parseImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject()));
18674      }
18675    };
18676  }
18677
18678  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationRecommendationComponent(JsonObject json) throws IOException, FHIRFormatError {
18679    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
18680    parseImmunizationRecommendationRecommendationComponentProperties(json, res);
18681    return res;
18682  }
18683
18684  protected void parseImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
18685    parseBackboneElementProperties(json, res);
18686    if (json.has("vaccineCode")) {
18687      JsonArray array = getJArray(json, "vaccineCode");
18688      for (int i = 0; i < array.size(); i++) {
18689        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18690      }
18691    };
18692    if (json.has("targetDisease")) {
18693      JsonArray array = getJArray(json, "targetDisease");
18694      for (int i = 0; i < array.size(); i++) {
18695        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18696      }
18697    };
18698    if (json.has("contraindicatedVaccineCode")) {
18699      JsonArray array = getJArray(json, "contraindicatedVaccineCode");
18700      for (int i = 0; i < array.size(); i++) {
18701        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18702      }
18703    };
18704    if (json.has("forecastStatus"))
18705      res.setForecastStatus(parseCodeableConcept(getJObject(json, "forecastStatus")));
18706    if (json.has("forecastReason")) {
18707      JsonArray array = getJArray(json, "forecastReason");
18708      for (int i = 0; i < array.size(); i++) {
18709        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18710      }
18711    };
18712    if (json.has("dateCriterion")) {
18713      JsonArray array = getJArray(json, "dateCriterion");
18714      for (int i = 0; i < array.size(); i++) {
18715        res.getDateCriterion().add(parseImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject()));
18716      }
18717    };
18718    if (json.has("description"))
18719      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18720    if (json.has("_description"))
18721      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18722    if (json.has("series"))
18723      res.setSeriesElement(parseString(json.get("series").getAsString()));
18724    if (json.has("_series"))
18725      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
18726    if (json.has("doseNumber"))
18727      res.setDoseNumberElement(parseString(json.get("doseNumber").getAsString()));
18728    if (json.has("_doseNumber"))
18729      parseElementProperties(getJObject(json, "_doseNumber"), res.getDoseNumberElement());
18730    if (json.has("seriesDoses"))
18731      res.setSeriesDosesElement(parseString(json.get("seriesDoses").getAsString()));
18732    if (json.has("_seriesDoses"))
18733      parseElementProperties(getJObject(json, "_seriesDoses"), res.getSeriesDosesElement());
18734    if (json.has("supportingImmunization")) {
18735      JsonArray array = getJArray(json, "supportingImmunization");
18736      for (int i = 0; i < array.size(); i++) {
18737        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
18738      }
18739    };
18740    if (json.has("supportingPatientInformation")) {
18741      JsonArray array = getJArray(json, "supportingPatientInformation");
18742      for (int i = 0; i < array.size(); i++) {
18743        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
18744      }
18745    };
18746  }
18747
18748  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json) throws IOException, FHIRFormatError {
18749    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
18750    parseImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, res);
18751    return res;
18752  }
18753
18754  protected void parseImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
18755    parseBackboneElementProperties(json, res);
18756    if (json.has("code"))
18757      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18758    if (json.has("value"))
18759      res.setValueElement(parseDateTime(json.get("value").getAsString()));
18760    if (json.has("_value"))
18761      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
18762  }
18763
18764  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
18765    ImplementationGuide res = new ImplementationGuide();
18766    parseImplementationGuideProperties(json, res);
18767    return res;
18768  }
18769
18770  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
18771    parseCanonicalResourceProperties(json, res);
18772    if (json.has("url"))
18773      res.setUrlElement(parseUri(json.get("url").getAsString()));
18774    if (json.has("_url"))
18775      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
18776    if (json.has("identifier")) {
18777      JsonArray array = getJArray(json, "identifier");
18778      for (int i = 0; i < array.size(); i++) {
18779        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18780      }
18781    };
18782    if (json.has("version"))
18783      res.setVersionElement(parseString(json.get("version").getAsString()));
18784    if (json.has("_version"))
18785      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
18786    DataType versionAlgorithm = parseType("versionAlgorithm", json);
18787    if (versionAlgorithm != null)
18788      res.setVersionAlgorithm(versionAlgorithm);
18789    if (json.has("name"))
18790      res.setNameElement(parseString(json.get("name").getAsString()));
18791    if (json.has("_name"))
18792      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18793    if (json.has("title"))
18794      res.setTitleElement(parseString(json.get("title").getAsString()));
18795    if (json.has("_title"))
18796      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
18797    if (json.has("status"))
18798      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18799    if (json.has("_status"))
18800      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18801    if (json.has("experimental"))
18802      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18803    if (json.has("_experimental"))
18804      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
18805    if (json.has("date"))
18806      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18807    if (json.has("_date"))
18808      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
18809    if (json.has("publisher"))
18810      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18811    if (json.has("_publisher"))
18812      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
18813    if (json.has("contact")) {
18814      JsonArray array = getJArray(json, "contact");
18815      for (int i = 0; i < array.size(); i++) {
18816        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18817      }
18818    };
18819    if (json.has("description"))
18820      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18821    if (json.has("_description"))
18822      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18823    if (json.has("useContext")) {
18824      JsonArray array = getJArray(json, "useContext");
18825      for (int i = 0; i < array.size(); i++) {
18826        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18827      }
18828    };
18829    if (json.has("jurisdiction")) {
18830      JsonArray array = getJArray(json, "jurisdiction");
18831      for (int i = 0; i < array.size(); i++) {
18832        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18833      }
18834    };
18835    if (json.has("purpose"))
18836      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18837    if (json.has("_purpose"))
18838      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
18839    if (json.has("copyright"))
18840      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18841    if (json.has("_copyright"))
18842      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
18843    if (json.has("copyrightLabel"))
18844      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
18845    if (json.has("_copyrightLabel"))
18846      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
18847    if (json.has("packageId"))
18848      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
18849    if (json.has("_packageId"))
18850      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
18851    if (json.has("license"))
18852      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
18853    if (json.has("_license"))
18854      parseElementProperties(getJObject(json, "_license"), res.getLicenseElement());
18855    if (json.has("fhirVersion")) {
18856      JsonArray array = getJArray(json, "fhirVersion");
18857      for (int i = 0; i < array.size(); i++) {
18858        if (array.get(i).isJsonNull()) {
18859          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>(new Enumerations.FHIRVersionEnumFactory(), Enumerations.FHIRVersion.NULL));
18860        } else {;
18861          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
18862        }
18863      }
18864    };
18865    if (json.has("_fhirVersion")) {
18866      JsonArray array = getJArray(json, "_fhirVersion");
18867      for (int i = 0; i < array.size(); i++) {
18868        if (i == res.getFhirVersion().size())
18869          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
18870        if (array.get(i) instanceof JsonObject) 
18871          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
18872      }
18873    };
18874    if (json.has("dependsOn")) {
18875      JsonArray array = getJArray(json, "dependsOn");
18876      for (int i = 0; i < array.size(); i++) {
18877        res.getDependsOn().add(parseImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject()));
18878      }
18879    };
18880    if (json.has("global")) {
18881      JsonArray array = getJArray(json, "global");
18882      for (int i = 0; i < array.size(); i++) {
18883        res.getGlobal().add(parseImplementationGuideGlobalComponent(array.get(i).getAsJsonObject()));
18884      }
18885    };
18886    if (json.has("definition"))
18887      res.setDefinition(parseImplementationGuideDefinitionComponent(getJObject(json, "definition")));
18888    if (json.has("manifest"))
18889      res.setManifest(parseImplementationGuideManifestComponent(getJObject(json, "manifest")));
18890  }
18891
18892  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideDependsOnComponent(JsonObject json) throws IOException, FHIRFormatError {
18893    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
18894    parseImplementationGuideDependsOnComponentProperties(json, res);
18895    return res;
18896  }
18897
18898  protected void parseImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
18899    parseBackboneElementProperties(json, res);
18900    if (json.has("uri"))
18901      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
18902    if (json.has("_uri"))
18903      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
18904    if (json.has("packageId"))
18905      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
18906    if (json.has("_packageId"))
18907      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
18908    if (json.has("version"))
18909      res.setVersionElement(parseString(json.get("version").getAsString()));
18910    if (json.has("_version"))
18911      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
18912    if (json.has("reason"))
18913      res.setReasonElement(parseMarkdown(json.get("reason").getAsString()));
18914    if (json.has("_reason"))
18915      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
18916  }
18917
18918  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideGlobalComponent(JsonObject json) throws IOException, FHIRFormatError {
18919    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
18920    parseImplementationGuideGlobalComponentProperties(json, res);
18921    return res;
18922  }
18923
18924  protected void parseImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
18925    parseBackboneElementProperties(json, res);
18926    if (json.has("type"))
18927      res.setTypeElement(parseCode(json.get("type").getAsString()));
18928    if (json.has("_type"))
18929      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18930    if (json.has("profile"))
18931      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
18932    if (json.has("_profile"))
18933      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
18934  }
18935
18936  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
18937    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
18938    parseImplementationGuideDefinitionComponentProperties(json, res);
18939    return res;
18940  }
18941
18942  protected void parseImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
18943    parseBackboneElementProperties(json, res);
18944    if (json.has("grouping")) {
18945      JsonArray array = getJArray(json, "grouping");
18946      for (int i = 0; i < array.size(); i++) {
18947        res.getGrouping().add(parseImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject()));
18948      }
18949    };
18950    if (json.has("resource")) {
18951      JsonArray array = getJArray(json, "resource");
18952      for (int i = 0; i < array.size(); i++) {
18953        res.getResource().add(parseImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject()));
18954      }
18955    };
18956    if (json.has("page"))
18957      res.setPage(parseImplementationGuideDefinitionPageComponent(getJObject(json, "page")));
18958    if (json.has("parameter")) {
18959      JsonArray array = getJArray(json, "parameter");
18960      for (int i = 0; i < array.size(); i++) {
18961        res.getParameter().add(parseImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject()));
18962      }
18963    };
18964    if (json.has("template")) {
18965      JsonArray array = getJArray(json, "template");
18966      for (int i = 0; i < array.size(); i++) {
18967        res.getTemplate().add(parseImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject()));
18968      }
18969    };
18970  }
18971
18972  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideDefinitionGroupingComponent(JsonObject json) throws IOException, FHIRFormatError {
18973    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
18974    parseImplementationGuideDefinitionGroupingComponentProperties(json, res);
18975    return res;
18976  }
18977
18978  protected void parseImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
18979    parseBackboneElementProperties(json, res);
18980    if (json.has("name"))
18981      res.setNameElement(parseString(json.get("name").getAsString()));
18982    if (json.has("_name"))
18983      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18984    if (json.has("description"))
18985      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18986    if (json.has("_description"))
18987      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18988  }
18989
18990  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
18991    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
18992    parseImplementationGuideDefinitionResourceComponentProperties(json, res);
18993    return res;
18994  }
18995
18996  protected void parseImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
18997    parseBackboneElementProperties(json, res);
18998    if (json.has("reference"))
18999      res.setReference(parseReference(getJObject(json, "reference")));
19000    if (json.has("fhirVersion")) {
19001      JsonArray array = getJArray(json, "fhirVersion");
19002      for (int i = 0; i < array.size(); i++) {
19003        if (array.get(i).isJsonNull()) {
19004          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>(new Enumerations.FHIRVersionEnumFactory(), Enumerations.FHIRVersion.NULL));
19005        } else {;
19006          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
19007        }
19008      }
19009    };
19010    if (json.has("_fhirVersion")) {
19011      JsonArray array = getJArray(json, "_fhirVersion");
19012      for (int i = 0; i < array.size(); i++) {
19013        if (i == res.getFhirVersion().size())
19014          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
19015        if (array.get(i) instanceof JsonObject) 
19016          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
19017      }
19018    };
19019    if (json.has("name"))
19020      res.setNameElement(parseString(json.get("name").getAsString()));
19021    if (json.has("_name"))
19022      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19023    if (json.has("description"))
19024      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19025    if (json.has("_description"))
19026      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19027    if (json.has("isExample"))
19028      res.setIsExampleElement(parseBoolean(json.get("isExample").getAsBoolean()));
19029    if (json.has("_isExample"))
19030      parseElementProperties(getJObject(json, "_isExample"), res.getIsExampleElement());
19031    if (json.has("profile")) {
19032      JsonArray array = getJArray(json, "profile");
19033      for (int i = 0; i < array.size(); i++) {
19034        if (array.get(i).isJsonNull()) {
19035          res.getProfile().add(new CanonicalType());
19036        } else {;
19037          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
19038        }
19039      }
19040    };
19041    if (json.has("_profile")) {
19042      JsonArray array = getJArray(json, "_profile");
19043      for (int i = 0; i < array.size(); i++) {
19044        if (i == res.getProfile().size())
19045          res.getProfile().add(parseCanonical(null));
19046        if (array.get(i) instanceof JsonObject) 
19047          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
19048      }
19049    };
19050    if (json.has("groupingId"))
19051      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
19052    if (json.has("_groupingId"))
19053      parseElementProperties(getJObject(json, "_groupingId"), res.getGroupingIdElement());
19054  }
19055
19056  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideDefinitionPageComponent(JsonObject json) throws IOException, FHIRFormatError {
19057    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
19058    parseImplementationGuideDefinitionPageComponentProperties(json, res);
19059    return res;
19060  }
19061
19062  protected void parseImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
19063    parseBackboneElementProperties(json, res);
19064    DataType source = parseType("source", json);
19065    if (source != null)
19066      res.setSource(source);
19067    if (json.has("name"))
19068      res.setNameElement(parseUrl(json.get("name").getAsString()));
19069    if (json.has("_name"))
19070      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19071    if (json.has("title"))
19072      res.setTitleElement(parseString(json.get("title").getAsString()));
19073    if (json.has("_title"))
19074      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
19075    if (json.has("generation"))
19076      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
19077    if (json.has("_generation"))
19078      parseElementProperties(getJObject(json, "_generation"), res.getGenerationElement());
19079    if (json.has("page")) {
19080      JsonArray array = getJArray(json, "page");
19081      for (int i = 0; i < array.size(); i++) {
19082        res.getPage().add(parseImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject()));
19083      }
19084    };
19085  }
19086
19087  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideDefinitionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
19088    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
19089    parseImplementationGuideDefinitionParameterComponentProperties(json, res);
19090    return res;
19091  }
19092
19093  protected void parseImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
19094    parseBackboneElementProperties(json, res);
19095    if (json.has("code"))
19096      res.setCode(parseCoding(getJObject(json, "code")));
19097    if (json.has("value"))
19098      res.setValueElement(parseString(json.get("value").getAsString()));
19099    if (json.has("_value"))
19100      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19101  }
19102
19103  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideDefinitionTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
19104    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
19105    parseImplementationGuideDefinitionTemplateComponentProperties(json, res);
19106    return res;
19107  }
19108
19109  protected void parseImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
19110    parseBackboneElementProperties(json, res);
19111    if (json.has("code"))
19112      res.setCodeElement(parseCode(json.get("code").getAsString()));
19113    if (json.has("_code"))
19114      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19115    if (json.has("source"))
19116      res.setSourceElement(parseString(json.get("source").getAsString()));
19117    if (json.has("_source"))
19118      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
19119    if (json.has("scope"))
19120      res.setScopeElement(parseString(json.get("scope").getAsString()));
19121    if (json.has("_scope"))
19122      parseElementProperties(getJObject(json, "_scope"), res.getScopeElement());
19123  }
19124
19125  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideManifestComponent(JsonObject json) throws IOException, FHIRFormatError {
19126    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
19127    parseImplementationGuideManifestComponentProperties(json, res);
19128    return res;
19129  }
19130
19131  protected void parseImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
19132    parseBackboneElementProperties(json, res);
19133    if (json.has("rendering"))
19134      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
19135    if (json.has("_rendering"))
19136      parseElementProperties(getJObject(json, "_rendering"), res.getRenderingElement());
19137    if (json.has("resource")) {
19138      JsonArray array = getJArray(json, "resource");
19139      for (int i = 0; i < array.size(); i++) {
19140        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject()));
19141      }
19142    };
19143    if (json.has("page")) {
19144      JsonArray array = getJArray(json, "page");
19145      for (int i = 0; i < array.size(); i++) {
19146        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject()));
19147      }
19148    };
19149    if (json.has("image")) {
19150      JsonArray array = getJArray(json, "image");
19151      for (int i = 0; i < array.size(); i++) {
19152        if (array.get(i).isJsonNull()) {
19153          res.getImage().add(new StringType());
19154        } else {;
19155          res.getImage().add(parseString(array.get(i).getAsString()));
19156        }
19157      }
19158    };
19159    if (json.has("_image")) {
19160      JsonArray array = getJArray(json, "_image");
19161      for (int i = 0; i < array.size(); i++) {
19162        if (i == res.getImage().size())
19163          res.getImage().add(parseString(null));
19164        if (array.get(i) instanceof JsonObject) 
19165          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
19166      }
19167    };
19168    if (json.has("other")) {
19169      JsonArray array = getJArray(json, "other");
19170      for (int i = 0; i < array.size(); i++) {
19171        if (array.get(i).isJsonNull()) {
19172          res.getOther().add(new StringType());
19173        } else {;
19174          res.getOther().add(parseString(array.get(i).getAsString()));
19175        }
19176      }
19177    };
19178    if (json.has("_other")) {
19179      JsonArray array = getJArray(json, "_other");
19180      for (int i = 0; i < array.size(); i++) {
19181        if (i == res.getOther().size())
19182          res.getOther().add(parseString(null));
19183        if (array.get(i) instanceof JsonObject) 
19184          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
19185      }
19186    };
19187  }
19188
19189  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
19190    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
19191    parseImplementationGuideManifestResourceComponentProperties(json, res);
19192    return res;
19193  }
19194
19195  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
19196    parseBackboneElementProperties(json, res);
19197    if (json.has("reference"))
19198      res.setReference(parseReference(getJObject(json, "reference")));
19199    if (json.has("isExample"))
19200      res.setIsExampleElement(parseBoolean(json.get("isExample").getAsBoolean()));
19201    if (json.has("_isExample"))
19202      parseElementProperties(getJObject(json, "_isExample"), res.getIsExampleElement());
19203    if (json.has("profile")) {
19204      JsonArray array = getJArray(json, "profile");
19205      for (int i = 0; i < array.size(); i++) {
19206        if (array.get(i).isJsonNull()) {
19207          res.getProfile().add(new CanonicalType());
19208        } else {;
19209          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
19210        }
19211      }
19212    };
19213    if (json.has("_profile")) {
19214      JsonArray array = getJArray(json, "_profile");
19215      for (int i = 0; i < array.size(); i++) {
19216        if (i == res.getProfile().size())
19217          res.getProfile().add(parseCanonical(null));
19218        if (array.get(i) instanceof JsonObject) 
19219          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
19220      }
19221    };
19222    if (json.has("relativePath"))
19223      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
19224    if (json.has("_relativePath"))
19225      parseElementProperties(getJObject(json, "_relativePath"), res.getRelativePathElement());
19226  }
19227
19228  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json) throws IOException, FHIRFormatError {
19229    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
19230    parseImplementationGuideManifestPageComponentProperties(json, res);
19231    return res;
19232  }
19233
19234  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
19235    parseBackboneElementProperties(json, res);
19236    if (json.has("name"))
19237      res.setNameElement(parseString(json.get("name").getAsString()));
19238    if (json.has("_name"))
19239      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19240    if (json.has("title"))
19241      res.setTitleElement(parseString(json.get("title").getAsString()));
19242    if (json.has("_title"))
19243      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
19244    if (json.has("anchor")) {
19245      JsonArray array = getJArray(json, "anchor");
19246      for (int i = 0; i < array.size(); i++) {
19247        if (array.get(i).isJsonNull()) {
19248          res.getAnchor().add(new StringType());
19249        } else {;
19250          res.getAnchor().add(parseString(array.get(i).getAsString()));
19251        }
19252      }
19253    };
19254    if (json.has("_anchor")) {
19255      JsonArray array = getJArray(json, "_anchor");
19256      for (int i = 0; i < array.size(); i++) {
19257        if (i == res.getAnchor().size())
19258          res.getAnchor().add(parseString(null));
19259        if (array.get(i) instanceof JsonObject) 
19260          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
19261      }
19262    };
19263  }
19264
19265  protected Ingredient parseIngredient(JsonObject json) throws IOException, FHIRFormatError {
19266    Ingredient res = new Ingredient();
19267    parseIngredientProperties(json, res);
19268    return res;
19269  }
19270
19271  protected void parseIngredientProperties(JsonObject json, Ingredient res) throws IOException, FHIRFormatError {
19272    parseDomainResourceProperties(json, res);
19273    if (json.has("identifier"))
19274      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
19275    if (json.has("status"))
19276      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19277    if (json.has("_status"))
19278      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19279    if (json.has("for")) {
19280      JsonArray array = getJArray(json, "for");
19281      for (int i = 0; i < array.size(); i++) {
19282        res.getFor().add(parseReference(array.get(i).getAsJsonObject()));
19283      }
19284    };
19285    if (json.has("role"))
19286      res.setRole(parseCodeableConcept(getJObject(json, "role")));
19287    if (json.has("function")) {
19288      JsonArray array = getJArray(json, "function");
19289      for (int i = 0; i < array.size(); i++) {
19290        res.getFunction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19291      }
19292    };
19293    if (json.has("group"))
19294      res.setGroup(parseCodeableConcept(getJObject(json, "group")));
19295    if (json.has("allergenicIndicator"))
19296      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
19297    if (json.has("_allergenicIndicator"))
19298      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
19299    if (json.has("comment"))
19300      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
19301    if (json.has("_comment"))
19302      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
19303    if (json.has("manufacturer")) {
19304      JsonArray array = getJArray(json, "manufacturer");
19305      for (int i = 0; i < array.size(); i++) {
19306        res.getManufacturer().add(parseIngredientManufacturerComponent(array.get(i).getAsJsonObject()));
19307      }
19308    };
19309    if (json.has("substance"))
19310      res.setSubstance(parseIngredientSubstanceComponent(getJObject(json, "substance")));
19311  }
19312
19313  protected Ingredient.IngredientManufacturerComponent parseIngredientManufacturerComponent(JsonObject json) throws IOException, FHIRFormatError {
19314    Ingredient.IngredientManufacturerComponent res = new Ingredient.IngredientManufacturerComponent();
19315    parseIngredientManufacturerComponentProperties(json, res);
19316    return res;
19317  }
19318
19319  protected void parseIngredientManufacturerComponentProperties(JsonObject json, Ingredient.IngredientManufacturerComponent res) throws IOException, FHIRFormatError {
19320    parseBackboneElementProperties(json, res);
19321    if (json.has("role"))
19322      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Ingredient.IngredientManufacturerRole.NULL, new Ingredient.IngredientManufacturerRoleEnumFactory()));
19323    if (json.has("_role"))
19324      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
19325    if (json.has("manufacturer"))
19326      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
19327  }
19328
19329  protected Ingredient.IngredientSubstanceComponent parseIngredientSubstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
19330    Ingredient.IngredientSubstanceComponent res = new Ingredient.IngredientSubstanceComponent();
19331    parseIngredientSubstanceComponentProperties(json, res);
19332    return res;
19333  }
19334
19335  protected void parseIngredientSubstanceComponentProperties(JsonObject json, Ingredient.IngredientSubstanceComponent res) throws IOException, FHIRFormatError {
19336    parseBackboneElementProperties(json, res);
19337    if (json.has("code"))
19338      res.setCode(parseCodeableReference(getJObject(json, "code")));
19339    if (json.has("strength")) {
19340      JsonArray array = getJArray(json, "strength");
19341      for (int i = 0; i < array.size(); i++) {
19342        res.getStrength().add(parseIngredientSubstanceStrengthComponent(array.get(i).getAsJsonObject()));
19343      }
19344    };
19345  }
19346
19347  protected Ingredient.IngredientSubstanceStrengthComponent parseIngredientSubstanceStrengthComponent(JsonObject json) throws IOException, FHIRFormatError {
19348    Ingredient.IngredientSubstanceStrengthComponent res = new Ingredient.IngredientSubstanceStrengthComponent();
19349    parseIngredientSubstanceStrengthComponentProperties(json, res);
19350    return res;
19351  }
19352
19353  protected void parseIngredientSubstanceStrengthComponentProperties(JsonObject json, Ingredient.IngredientSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
19354    parseBackboneElementProperties(json, res);
19355    DataType presentation = parseType("presentation", json);
19356    if (presentation != null)
19357      res.setPresentation(presentation);
19358    if (json.has("textPresentation"))
19359      res.setTextPresentationElement(parseString(json.get("textPresentation").getAsString()));
19360    if (json.has("_textPresentation"))
19361      parseElementProperties(getJObject(json, "_textPresentation"), res.getTextPresentationElement());
19362    DataType concentration = parseType("concentration", json);
19363    if (concentration != null)
19364      res.setConcentration(concentration);
19365    if (json.has("textConcentration"))
19366      res.setTextConcentrationElement(parseString(json.get("textConcentration").getAsString()));
19367    if (json.has("_textConcentration"))
19368      parseElementProperties(getJObject(json, "_textConcentration"), res.getTextConcentrationElement());
19369    if (json.has("basis"))
19370      res.setBasis(parseCodeableConcept(getJObject(json, "basis")));
19371    if (json.has("measurementPoint"))
19372      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
19373    if (json.has("_measurementPoint"))
19374      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
19375    if (json.has("country")) {
19376      JsonArray array = getJArray(json, "country");
19377      for (int i = 0; i < array.size(); i++) {
19378        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19379      }
19380    };
19381    if (json.has("referenceStrength")) {
19382      JsonArray array = getJArray(json, "referenceStrength");
19383      for (int i = 0; i < array.size(); i++) {
19384        res.getReferenceStrength().add(parseIngredientSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject()));
19385      }
19386    };
19387  }
19388
19389  protected Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent parseIngredientSubstanceStrengthReferenceStrengthComponent(JsonObject json) throws IOException, FHIRFormatError {
19390    Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent res = new Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent();
19391    parseIngredientSubstanceStrengthReferenceStrengthComponentProperties(json, res);
19392    return res;
19393  }
19394
19395  protected void parseIngredientSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
19396    parseBackboneElementProperties(json, res);
19397    if (json.has("substance"))
19398      res.setSubstance(parseCodeableReference(getJObject(json, "substance")));
19399    DataType strength = parseType("strength", json);
19400    if (strength != null)
19401      res.setStrength(strength);
19402    if (json.has("measurementPoint"))
19403      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
19404    if (json.has("_measurementPoint"))
19405      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
19406    if (json.has("country")) {
19407      JsonArray array = getJArray(json, "country");
19408      for (int i = 0; i < array.size(); i++) {
19409        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19410      }
19411    };
19412  }
19413
19414  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
19415    InsurancePlan res = new InsurancePlan();
19416    parseInsurancePlanProperties(json, res);
19417    return res;
19418  }
19419
19420  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
19421    parseDomainResourceProperties(json, res);
19422    if (json.has("identifier")) {
19423      JsonArray array = getJArray(json, "identifier");
19424      for (int i = 0; i < array.size(); i++) {
19425        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19426      }
19427    };
19428    if (json.has("status"))
19429      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19430    if (json.has("_status"))
19431      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19432    if (json.has("type")) {
19433      JsonArray array = getJArray(json, "type");
19434      for (int i = 0; i < array.size(); i++) {
19435        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19436      }
19437    };
19438    if (json.has("name"))
19439      res.setNameElement(parseString(json.get("name").getAsString()));
19440    if (json.has("_name"))
19441      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19442    if (json.has("alias")) {
19443      JsonArray array = getJArray(json, "alias");
19444      for (int i = 0; i < array.size(); i++) {
19445        if (array.get(i).isJsonNull()) {
19446          res.getAlias().add(new StringType());
19447        } else {;
19448          res.getAlias().add(parseString(array.get(i).getAsString()));
19449        }
19450      }
19451    };
19452    if (json.has("_alias")) {
19453      JsonArray array = getJArray(json, "_alias");
19454      for (int i = 0; i < array.size(); i++) {
19455        if (i == res.getAlias().size())
19456          res.getAlias().add(parseString(null));
19457        if (array.get(i) instanceof JsonObject) 
19458          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
19459      }
19460    };
19461    if (json.has("period"))
19462      res.setPeriod(parsePeriod(getJObject(json, "period")));
19463    if (json.has("ownedBy"))
19464      res.setOwnedBy(parseReference(getJObject(json, "ownedBy")));
19465    if (json.has("administeredBy"))
19466      res.setAdministeredBy(parseReference(getJObject(json, "administeredBy")));
19467    if (json.has("coverageArea")) {
19468      JsonArray array = getJArray(json, "coverageArea");
19469      for (int i = 0; i < array.size(); i++) {
19470        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
19471      }
19472    };
19473    if (json.has("contact")) {
19474      JsonArray array = getJArray(json, "contact");
19475      for (int i = 0; i < array.size(); i++) {
19476        res.getContact().add(parseExtendedContactDetail(array.get(i).getAsJsonObject()));
19477      }
19478    };
19479    if (json.has("endpoint")) {
19480      JsonArray array = getJArray(json, "endpoint");
19481      for (int i = 0; i < array.size(); i++) {
19482        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19483      }
19484    };
19485    if (json.has("network")) {
19486      JsonArray array = getJArray(json, "network");
19487      for (int i = 0; i < array.size(); i++) {
19488        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
19489      }
19490    };
19491    if (json.has("coverage")) {
19492      JsonArray array = getJArray(json, "coverage");
19493      for (int i = 0; i < array.size(); i++) {
19494        res.getCoverage().add(parseInsurancePlanCoverageComponent(array.get(i).getAsJsonObject()));
19495      }
19496    };
19497    if (json.has("plan")) {
19498      JsonArray array = getJArray(json, "plan");
19499      for (int i = 0; i < array.size(); i++) {
19500        res.getPlan().add(parseInsurancePlanPlanComponent(array.get(i).getAsJsonObject()));
19501      }
19502    };
19503  }
19504
19505  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
19506    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
19507    parseInsurancePlanCoverageComponentProperties(json, res);
19508    return res;
19509  }
19510
19511  protected void parseInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
19512    parseBackboneElementProperties(json, res);
19513    if (json.has("type"))
19514      res.setType(parseCodeableConcept(getJObject(json, "type")));
19515    if (json.has("network")) {
19516      JsonArray array = getJArray(json, "network");
19517      for (int i = 0; i < array.size(); i++) {
19518        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
19519      }
19520    };
19521    if (json.has("benefit")) {
19522      JsonArray array = getJArray(json, "benefit");
19523      for (int i = 0; i < array.size(); i++) {
19524        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject()));
19525      }
19526    };
19527  }
19528
19529  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
19530    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
19531    parseInsurancePlanCoverageBenefitComponentProperties(json, res);
19532    return res;
19533  }
19534
19535  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
19536    parseBackboneElementProperties(json, res);
19537    if (json.has("type"))
19538      res.setType(parseCodeableConcept(getJObject(json, "type")));
19539    if (json.has("requirement"))
19540      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
19541    if (json.has("_requirement"))
19542      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
19543    if (json.has("limit")) {
19544      JsonArray array = getJArray(json, "limit");
19545      for (int i = 0; i < array.size(); i++) {
19546        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject()));
19547      }
19548    };
19549  }
19550
19551  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json) throws IOException, FHIRFormatError {
19552    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
19553    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, res);
19554    return res;
19555  }
19556
19557  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
19558    parseBackboneElementProperties(json, res);
19559    if (json.has("value"))
19560      res.setValue(parseQuantity(getJObject(json, "value")));
19561    if (json.has("code"))
19562      res.setCode(parseCodeableConcept(getJObject(json, "code")));
19563  }
19564
19565  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanPlanComponent(JsonObject json) throws IOException, FHIRFormatError {
19566    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
19567    parseInsurancePlanPlanComponentProperties(json, res);
19568    return res;
19569  }
19570
19571  protected void parseInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
19572    parseBackboneElementProperties(json, res);
19573    if (json.has("identifier")) {
19574      JsonArray array = getJArray(json, "identifier");
19575      for (int i = 0; i < array.size(); i++) {
19576        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19577      }
19578    };
19579    if (json.has("type"))
19580      res.setType(parseCodeableConcept(getJObject(json, "type")));
19581    if (json.has("coverageArea")) {
19582      JsonArray array = getJArray(json, "coverageArea");
19583      for (int i = 0; i < array.size(); i++) {
19584        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
19585      }
19586    };
19587    if (json.has("network")) {
19588      JsonArray array = getJArray(json, "network");
19589      for (int i = 0; i < array.size(); i++) {
19590        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
19591      }
19592    };
19593    if (json.has("generalCost")) {
19594      JsonArray array = getJArray(json, "generalCost");
19595      for (int i = 0; i < array.size(); i++) {
19596        res.getGeneralCost().add(parseInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject()));
19597      }
19598    };
19599    if (json.has("specificCost")) {
19600      JsonArray array = getJArray(json, "specificCost");
19601      for (int i = 0; i < array.size(); i++) {
19602        res.getSpecificCost().add(parseInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject()));
19603      }
19604    };
19605  }
19606
19607  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanPlanGeneralCostComponent(JsonObject json) throws IOException, FHIRFormatError {
19608    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
19609    parseInsurancePlanPlanGeneralCostComponentProperties(json, res);
19610    return res;
19611  }
19612
19613  protected void parseInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
19614    parseBackboneElementProperties(json, res);
19615    if (json.has("type"))
19616      res.setType(parseCodeableConcept(getJObject(json, "type")));
19617    if (json.has("groupSize"))
19618      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
19619    if (json.has("_groupSize"))
19620      parseElementProperties(getJObject(json, "_groupSize"), res.getGroupSizeElement());
19621    if (json.has("cost"))
19622      res.setCost(parseMoney(getJObject(json, "cost")));
19623    if (json.has("comment"))
19624      res.setCommentElement(parseString(json.get("comment").getAsString()));
19625    if (json.has("_comment"))
19626      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
19627  }
19628
19629  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanPlanSpecificCostComponent(JsonObject json) throws IOException, FHIRFormatError {
19630    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
19631    parseInsurancePlanPlanSpecificCostComponentProperties(json, res);
19632    return res;
19633  }
19634
19635  protected void parseInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
19636    parseBackboneElementProperties(json, res);
19637    if (json.has("category"))
19638      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
19639    if (json.has("benefit")) {
19640      JsonArray array = getJArray(json, "benefit");
19641      for (int i = 0; i < array.size(); i++) {
19642        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject()));
19643      }
19644    };
19645  }
19646
19647  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
19648    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
19649    parseInsurancePlanPlanBenefitComponentProperties(json, res);
19650    return res;
19651  }
19652
19653  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
19654    parseBackboneElementProperties(json, res);
19655    if (json.has("type"))
19656      res.setType(parseCodeableConcept(getJObject(json, "type")));
19657    if (json.has("cost")) {
19658      JsonArray array = getJArray(json, "cost");
19659      for (int i = 0; i < array.size(); i++) {
19660        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject()));
19661      }
19662    };
19663  }
19664
19665  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json) throws IOException, FHIRFormatError {
19666    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
19667    parseInsurancePlanPlanBenefitCostComponentProperties(json, res);
19668    return res;
19669  }
19670
19671  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
19672    parseBackboneElementProperties(json, res);
19673    if (json.has("type"))
19674      res.setType(parseCodeableConcept(getJObject(json, "type")));
19675    if (json.has("applicability"))
19676      res.setApplicability(parseCodeableConcept(getJObject(json, "applicability")));
19677    if (json.has("qualifiers")) {
19678      JsonArray array = getJArray(json, "qualifiers");
19679      for (int i = 0; i < array.size(); i++) {
19680        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19681      }
19682    };
19683    if (json.has("value"))
19684      res.setValue(parseQuantity(getJObject(json, "value")));
19685  }
19686
19687  protected InventoryItem parseInventoryItem(JsonObject json) throws IOException, FHIRFormatError {
19688    InventoryItem res = new InventoryItem();
19689    parseInventoryItemProperties(json, res);
19690    return res;
19691  }
19692
19693  protected void parseInventoryItemProperties(JsonObject json, InventoryItem res) throws IOException, FHIRFormatError {
19694    parseDomainResourceProperties(json, res);
19695    if (json.has("identifier")) {
19696      JsonArray array = getJArray(json, "identifier");
19697      for (int i = 0; i < array.size(); i++) {
19698        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19699      }
19700    };
19701    if (json.has("status"))
19702      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), InventoryItem.InventoryItemStatusCodes.NULL, new InventoryItem.InventoryItemStatusCodesEnumFactory()));
19703    if (json.has("_status"))
19704      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19705    if (json.has("category")) {
19706      JsonArray array = getJArray(json, "category");
19707      for (int i = 0; i < array.size(); i++) {
19708        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19709      }
19710    };
19711    if (json.has("code")) {
19712      JsonArray array = getJArray(json, "code");
19713      for (int i = 0; i < array.size(); i++) {
19714        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19715      }
19716    };
19717    if (json.has("name")) {
19718      JsonArray array = getJArray(json, "name");
19719      for (int i = 0; i < array.size(); i++) {
19720        res.getName().add(parseInventoryItemNameComponent(array.get(i).getAsJsonObject()));
19721      }
19722    };
19723    if (json.has("responsibleOrganization")) {
19724      JsonArray array = getJArray(json, "responsibleOrganization");
19725      for (int i = 0; i < array.size(); i++) {
19726        res.getResponsibleOrganization().add(parseInventoryItemResponsibleOrganizationComponent(array.get(i).getAsJsonObject()));
19727      }
19728    };
19729    if (json.has("description"))
19730      res.setDescription(parseInventoryItemDescriptionComponent(getJObject(json, "description")));
19731    if (json.has("inventoryStatus")) {
19732      JsonArray array = getJArray(json, "inventoryStatus");
19733      for (int i = 0; i < array.size(); i++) {
19734        res.getInventoryStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19735      }
19736    };
19737    if (json.has("baseUnit"))
19738      res.setBaseUnit(parseCodeableConcept(getJObject(json, "baseUnit")));
19739    if (json.has("netContent"))
19740      res.setNetContent(parseQuantity(getJObject(json, "netContent")));
19741    if (json.has("association")) {
19742      JsonArray array = getJArray(json, "association");
19743      for (int i = 0; i < array.size(); i++) {
19744        res.getAssociation().add(parseInventoryItemAssociationComponent(array.get(i).getAsJsonObject()));
19745      }
19746    };
19747    if (json.has("characteristic")) {
19748      JsonArray array = getJArray(json, "characteristic");
19749      for (int i = 0; i < array.size(); i++) {
19750        res.getCharacteristic().add(parseInventoryItemCharacteristicComponent(array.get(i).getAsJsonObject()));
19751      }
19752    };
19753    if (json.has("instance"))
19754      res.setInstance(parseInventoryItemInstanceComponent(getJObject(json, "instance")));
19755    if (json.has("productReference"))
19756      res.setProductReference(parseReference(getJObject(json, "productReference")));
19757  }
19758
19759  protected InventoryItem.InventoryItemNameComponent parseInventoryItemNameComponent(JsonObject json) throws IOException, FHIRFormatError {
19760    InventoryItem.InventoryItemNameComponent res = new InventoryItem.InventoryItemNameComponent();
19761    parseInventoryItemNameComponentProperties(json, res);
19762    return res;
19763  }
19764
19765  protected void parseInventoryItemNameComponentProperties(JsonObject json, InventoryItem.InventoryItemNameComponent res) throws IOException, FHIRFormatError {
19766    parseBackboneElementProperties(json, res);
19767    if (json.has("nameType"))
19768      res.setNameType(parseCoding(getJObject(json, "nameType")));
19769    if (json.has("language"))
19770      res.setLanguageElement(parseEnumeration(json.get("language").getAsString(), Enumerations.CommonLanguages.NULL, new Enumerations.CommonLanguagesEnumFactory()));
19771    if (json.has("_language"))
19772      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
19773    if (json.has("name"))
19774      res.setNameElement(parseString(json.get("name").getAsString()));
19775    if (json.has("_name"))
19776      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19777  }
19778
19779  protected InventoryItem.InventoryItemResponsibleOrganizationComponent parseInventoryItemResponsibleOrganizationComponent(JsonObject json) throws IOException, FHIRFormatError {
19780    InventoryItem.InventoryItemResponsibleOrganizationComponent res = new InventoryItem.InventoryItemResponsibleOrganizationComponent();
19781    parseInventoryItemResponsibleOrganizationComponentProperties(json, res);
19782    return res;
19783  }
19784
19785  protected void parseInventoryItemResponsibleOrganizationComponentProperties(JsonObject json, InventoryItem.InventoryItemResponsibleOrganizationComponent res) throws IOException, FHIRFormatError {
19786    parseBackboneElementProperties(json, res);
19787    if (json.has("role"))
19788      res.setRole(parseCodeableConcept(getJObject(json, "role")));
19789    if (json.has("organization"))
19790      res.setOrganization(parseReference(getJObject(json, "organization")));
19791  }
19792
19793  protected InventoryItem.InventoryItemDescriptionComponent parseInventoryItemDescriptionComponent(JsonObject json) throws IOException, FHIRFormatError {
19794    InventoryItem.InventoryItemDescriptionComponent res = new InventoryItem.InventoryItemDescriptionComponent();
19795    parseInventoryItemDescriptionComponentProperties(json, res);
19796    return res;
19797  }
19798
19799  protected void parseInventoryItemDescriptionComponentProperties(JsonObject json, InventoryItem.InventoryItemDescriptionComponent res) throws IOException, FHIRFormatError {
19800    parseBackboneElementProperties(json, res);
19801    if (json.has("language"))
19802      res.setLanguageElement(parseEnumeration(json.get("language").getAsString(), Enumerations.CommonLanguages.NULL, new Enumerations.CommonLanguagesEnumFactory()));
19803    if (json.has("_language"))
19804      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
19805    if (json.has("description"))
19806      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19807    if (json.has("_description"))
19808      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19809  }
19810
19811  protected InventoryItem.InventoryItemAssociationComponent parseInventoryItemAssociationComponent(JsonObject json) throws IOException, FHIRFormatError {
19812    InventoryItem.InventoryItemAssociationComponent res = new InventoryItem.InventoryItemAssociationComponent();
19813    parseInventoryItemAssociationComponentProperties(json, res);
19814    return res;
19815  }
19816
19817  protected void parseInventoryItemAssociationComponentProperties(JsonObject json, InventoryItem.InventoryItemAssociationComponent res) throws IOException, FHIRFormatError {
19818    parseBackboneElementProperties(json, res);
19819    if (json.has("associationType"))
19820      res.setAssociationType(parseCodeableConcept(getJObject(json, "associationType")));
19821    if (json.has("relatedItem"))
19822      res.setRelatedItem(parseReference(getJObject(json, "relatedItem")));
19823    if (json.has("quantity"))
19824      res.setQuantity(parseRatio(getJObject(json, "quantity")));
19825  }
19826
19827  protected InventoryItem.InventoryItemCharacteristicComponent parseInventoryItemCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
19828    InventoryItem.InventoryItemCharacteristicComponent res = new InventoryItem.InventoryItemCharacteristicComponent();
19829    parseInventoryItemCharacteristicComponentProperties(json, res);
19830    return res;
19831  }
19832
19833  protected void parseInventoryItemCharacteristicComponentProperties(JsonObject json, InventoryItem.InventoryItemCharacteristicComponent res) throws IOException, FHIRFormatError {
19834    parseBackboneElementProperties(json, res);
19835    if (json.has("characteristicType"))
19836      res.setCharacteristicType(parseCodeableConcept(getJObject(json, "characteristicType")));
19837    DataType value = parseType("value", json);
19838    if (value != null)
19839      res.setValue(value);
19840  }
19841
19842  protected InventoryItem.InventoryItemInstanceComponent parseInventoryItemInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
19843    InventoryItem.InventoryItemInstanceComponent res = new InventoryItem.InventoryItemInstanceComponent();
19844    parseInventoryItemInstanceComponentProperties(json, res);
19845    return res;
19846  }
19847
19848  protected void parseInventoryItemInstanceComponentProperties(JsonObject json, InventoryItem.InventoryItemInstanceComponent res) throws IOException, FHIRFormatError {
19849    parseBackboneElementProperties(json, res);
19850    if (json.has("identifier")) {
19851      JsonArray array = getJArray(json, "identifier");
19852      for (int i = 0; i < array.size(); i++) {
19853        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19854      }
19855    };
19856    if (json.has("lotNumber"))
19857      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
19858    if (json.has("_lotNumber"))
19859      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
19860    if (json.has("expiry"))
19861      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
19862    if (json.has("_expiry"))
19863      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
19864    if (json.has("subject"))
19865      res.setSubject(parseReference(getJObject(json, "subject")));
19866    if (json.has("location"))
19867      res.setLocation(parseReference(getJObject(json, "location")));
19868  }
19869
19870  protected InventoryReport parseInventoryReport(JsonObject json) throws IOException, FHIRFormatError {
19871    InventoryReport res = new InventoryReport();
19872    parseInventoryReportProperties(json, res);
19873    return res;
19874  }
19875
19876  protected void parseInventoryReportProperties(JsonObject json, InventoryReport res) throws IOException, FHIRFormatError {
19877    parseDomainResourceProperties(json, res);
19878    if (json.has("identifier")) {
19879      JsonArray array = getJArray(json, "identifier");
19880      for (int i = 0; i < array.size(); i++) {
19881        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19882      }
19883    };
19884    if (json.has("status"))
19885      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), InventoryReport.InventoryReportStatus.NULL, new InventoryReport.InventoryReportStatusEnumFactory()));
19886    if (json.has("_status"))
19887      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19888    if (json.has("countType"))
19889      res.setCountTypeElement(parseEnumeration(json.get("countType").getAsString(), InventoryReport.InventoryCountType.NULL, new InventoryReport.InventoryCountTypeEnumFactory()));
19890    if (json.has("_countType"))
19891      parseElementProperties(getJObject(json, "_countType"), res.getCountTypeElement());
19892    if (json.has("operationType"))
19893      res.setOperationType(parseCodeableConcept(getJObject(json, "operationType")));
19894    if (json.has("operationTypeReason"))
19895      res.setOperationTypeReason(parseCodeableConcept(getJObject(json, "operationTypeReason")));
19896    if (json.has("reportedDateTime"))
19897      res.setReportedDateTimeElement(parseDateTime(json.get("reportedDateTime").getAsString()));
19898    if (json.has("_reportedDateTime"))
19899      parseElementProperties(getJObject(json, "_reportedDateTime"), res.getReportedDateTimeElement());
19900    if (json.has("reporter"))
19901      res.setReporter(parseReference(getJObject(json, "reporter")));
19902    if (json.has("reportingPeriod"))
19903      res.setReportingPeriod(parsePeriod(getJObject(json, "reportingPeriod")));
19904    if (json.has("inventoryListing")) {
19905      JsonArray array = getJArray(json, "inventoryListing");
19906      for (int i = 0; i < array.size(); i++) {
19907        res.getInventoryListing().add(parseInventoryReportInventoryListingComponent(array.get(i).getAsJsonObject()));
19908      }
19909    };
19910    if (json.has("note")) {
19911      JsonArray array = getJArray(json, "note");
19912      for (int i = 0; i < array.size(); i++) {
19913        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19914      }
19915    };
19916  }
19917
19918  protected InventoryReport.InventoryReportInventoryListingComponent parseInventoryReportInventoryListingComponent(JsonObject json) throws IOException, FHIRFormatError {
19919    InventoryReport.InventoryReportInventoryListingComponent res = new InventoryReport.InventoryReportInventoryListingComponent();
19920    parseInventoryReportInventoryListingComponentProperties(json, res);
19921    return res;
19922  }
19923
19924  protected void parseInventoryReportInventoryListingComponentProperties(JsonObject json, InventoryReport.InventoryReportInventoryListingComponent res) throws IOException, FHIRFormatError {
19925    parseBackboneElementProperties(json, res);
19926    if (json.has("location"))
19927      res.setLocation(parseReference(getJObject(json, "location")));
19928    if (json.has("itemStatus"))
19929      res.setItemStatus(parseCodeableConcept(getJObject(json, "itemStatus")));
19930    if (json.has("countingDateTime"))
19931      res.setCountingDateTimeElement(parseDateTime(json.get("countingDateTime").getAsString()));
19932    if (json.has("_countingDateTime"))
19933      parseElementProperties(getJObject(json, "_countingDateTime"), res.getCountingDateTimeElement());
19934    if (json.has("item")) {
19935      JsonArray array = getJArray(json, "item");
19936      for (int i = 0; i < array.size(); i++) {
19937        res.getItem().add(parseInventoryReportInventoryListingItemComponent(array.get(i).getAsJsonObject()));
19938      }
19939    };
19940  }
19941
19942  protected InventoryReport.InventoryReportInventoryListingItemComponent parseInventoryReportInventoryListingItemComponent(JsonObject json) throws IOException, FHIRFormatError {
19943    InventoryReport.InventoryReportInventoryListingItemComponent res = new InventoryReport.InventoryReportInventoryListingItemComponent();
19944    parseInventoryReportInventoryListingItemComponentProperties(json, res);
19945    return res;
19946  }
19947
19948  protected void parseInventoryReportInventoryListingItemComponentProperties(JsonObject json, InventoryReport.InventoryReportInventoryListingItemComponent res) throws IOException, FHIRFormatError {
19949    parseBackboneElementProperties(json, res);
19950    if (json.has("category"))
19951      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
19952    if (json.has("quantity"))
19953      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19954    if (json.has("item"))
19955      res.setItem(parseCodeableReference(getJObject(json, "item")));
19956  }
19957
19958  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
19959    Invoice res = new Invoice();
19960    parseInvoiceProperties(json, res);
19961    return res;
19962  }
19963
19964  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
19965    parseDomainResourceProperties(json, res);
19966    if (json.has("identifier")) {
19967      JsonArray array = getJArray(json, "identifier");
19968      for (int i = 0; i < array.size(); i++) {
19969        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19970      }
19971    };
19972    if (json.has("status"))
19973      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
19974    if (json.has("_status"))
19975      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19976    if (json.has("cancelledReason"))
19977      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
19978    if (json.has("_cancelledReason"))
19979      parseElementProperties(getJObject(json, "_cancelledReason"), res.getCancelledReasonElement());
19980    if (json.has("type"))
19981      res.setType(parseCodeableConcept(getJObject(json, "type")));
19982    if (json.has("subject"))
19983      res.setSubject(parseReference(getJObject(json, "subject")));
19984    if (json.has("recipient"))
19985      res.setRecipient(parseReference(getJObject(json, "recipient")));
19986    if (json.has("date"))
19987      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19988    if (json.has("_date"))
19989      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19990    if (json.has("creation"))
19991      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
19992    if (json.has("_creation"))
19993      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
19994    DataType period = parseType("period", json);
19995    if (period != null)
19996      res.setPeriod(period);
19997    if (json.has("participant")) {
19998      JsonArray array = getJArray(json, "participant");
19999      for (int i = 0; i < array.size(); i++) {
20000        res.getParticipant().add(parseInvoiceParticipantComponent(array.get(i).getAsJsonObject()));
20001      }
20002    };
20003    if (json.has("issuer"))
20004      res.setIssuer(parseReference(getJObject(json, "issuer")));
20005    if (json.has("account"))
20006      res.setAccount(parseReference(getJObject(json, "account")));
20007    if (json.has("lineItem")) {
20008      JsonArray array = getJArray(json, "lineItem");
20009      for (int i = 0; i < array.size(); i++) {
20010        res.getLineItem().add(parseInvoiceLineItemComponent(array.get(i).getAsJsonObject()));
20011      }
20012    };
20013    if (json.has("totalPriceComponent")) {
20014      JsonArray array = getJArray(json, "totalPriceComponent");
20015      for (int i = 0; i < array.size(); i++) {
20016        res.getTotalPriceComponent().add(parseMonetaryComponent(array.get(i).getAsJsonObject()));
20017      }
20018    };
20019    if (json.has("totalNet"))
20020      res.setTotalNet(parseMoney(getJObject(json, "totalNet")));
20021    if (json.has("totalGross"))
20022      res.setTotalGross(parseMoney(getJObject(json, "totalGross")));
20023    if (json.has("paymentTerms"))
20024      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
20025    if (json.has("_paymentTerms"))
20026      parseElementProperties(getJObject(json, "_paymentTerms"), res.getPaymentTermsElement());
20027    if (json.has("note")) {
20028      JsonArray array = getJArray(json, "note");
20029      for (int i = 0; i < array.size(); i++) {
20030        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20031      }
20032    };
20033  }
20034
20035  protected Invoice.InvoiceParticipantComponent parseInvoiceParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
20036    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
20037    parseInvoiceParticipantComponentProperties(json, res);
20038    return res;
20039  }
20040
20041  protected void parseInvoiceParticipantComponentProperties(JsonObject json, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
20042    parseBackboneElementProperties(json, res);
20043    if (json.has("role"))
20044      res.setRole(parseCodeableConcept(getJObject(json, "role")));
20045    if (json.has("actor"))
20046      res.setActor(parseReference(getJObject(json, "actor")));
20047  }
20048
20049  protected Invoice.InvoiceLineItemComponent parseInvoiceLineItemComponent(JsonObject json) throws IOException, FHIRFormatError {
20050    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
20051    parseInvoiceLineItemComponentProperties(json, res);
20052    return res;
20053  }
20054
20055  protected void parseInvoiceLineItemComponentProperties(JsonObject json, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
20056    parseBackboneElementProperties(json, res);
20057    if (json.has("sequence"))
20058      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
20059    if (json.has("_sequence"))
20060      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
20061    DataType serviced = parseType("serviced", json);
20062    if (serviced != null)
20063      res.setServiced(serviced);
20064    DataType chargeItem = parseType("chargeItem", json);
20065    if (chargeItem != null)
20066      res.setChargeItem(chargeItem);
20067    if (json.has("priceComponent")) {
20068      JsonArray array = getJArray(json, "priceComponent");
20069      for (int i = 0; i < array.size(); i++) {
20070        res.getPriceComponent().add(parseMonetaryComponent(array.get(i).getAsJsonObject()));
20071      }
20072    };
20073  }
20074
20075  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
20076    Library res = new Library();
20077    parseLibraryProperties(json, res);
20078    return res;
20079  }
20080
20081  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
20082    parseMetadataResourceProperties(json, res);
20083    if (json.has("url"))
20084      res.setUrlElement(parseUri(json.get("url").getAsString()));
20085    if (json.has("_url"))
20086      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
20087    if (json.has("identifier")) {
20088      JsonArray array = getJArray(json, "identifier");
20089      for (int i = 0; i < array.size(); i++) {
20090        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20091      }
20092    };
20093    if (json.has("version"))
20094      res.setVersionElement(parseString(json.get("version").getAsString()));
20095    if (json.has("_version"))
20096      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
20097    DataType versionAlgorithm = parseType("versionAlgorithm", json);
20098    if (versionAlgorithm != null)
20099      res.setVersionAlgorithm(versionAlgorithm);
20100    if (json.has("name"))
20101      res.setNameElement(parseString(json.get("name").getAsString()));
20102    if (json.has("_name"))
20103      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20104    if (json.has("title"))
20105      res.setTitleElement(parseString(json.get("title").getAsString()));
20106    if (json.has("_title"))
20107      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20108    if (json.has("subtitle"))
20109      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
20110    if (json.has("_subtitle"))
20111      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
20112    if (json.has("status"))
20113      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20114    if (json.has("_status"))
20115      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20116    if (json.has("experimental"))
20117      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20118    if (json.has("_experimental"))
20119      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
20120    if (json.has("type"))
20121      res.setType(parseCodeableConcept(getJObject(json, "type")));
20122    DataType subject = parseType("subject", json);
20123    if (subject != null)
20124      res.setSubject(subject);
20125    if (json.has("date"))
20126      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20127    if (json.has("_date"))
20128      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20129    if (json.has("publisher"))
20130      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20131    if (json.has("_publisher"))
20132      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
20133    if (json.has("contact")) {
20134      JsonArray array = getJArray(json, "contact");
20135      for (int i = 0; i < array.size(); i++) {
20136        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20137      }
20138    };
20139    if (json.has("description"))
20140      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20141    if (json.has("_description"))
20142      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20143    if (json.has("useContext")) {
20144      JsonArray array = getJArray(json, "useContext");
20145      for (int i = 0; i < array.size(); i++) {
20146        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20147      }
20148    };
20149    if (json.has("jurisdiction")) {
20150      JsonArray array = getJArray(json, "jurisdiction");
20151      for (int i = 0; i < array.size(); i++) {
20152        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20153      }
20154    };
20155    if (json.has("purpose"))
20156      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20157    if (json.has("_purpose"))
20158      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
20159    if (json.has("usage"))
20160      res.setUsageElement(parseMarkdown(json.get("usage").getAsString()));
20161    if (json.has("_usage"))
20162      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
20163    if (json.has("copyright"))
20164      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20165    if (json.has("_copyright"))
20166      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
20167    if (json.has("copyrightLabel"))
20168      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
20169    if (json.has("_copyrightLabel"))
20170      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
20171    if (json.has("approvalDate"))
20172      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20173    if (json.has("_approvalDate"))
20174      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
20175    if (json.has("lastReviewDate"))
20176      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20177    if (json.has("_lastReviewDate"))
20178      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
20179    if (json.has("effectivePeriod"))
20180      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
20181    if (json.has("topic")) {
20182      JsonArray array = getJArray(json, "topic");
20183      for (int i = 0; i < array.size(); i++) {
20184        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20185      }
20186    };
20187    if (json.has("author")) {
20188      JsonArray array = getJArray(json, "author");
20189      for (int i = 0; i < array.size(); i++) {
20190        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20191      }
20192    };
20193    if (json.has("editor")) {
20194      JsonArray array = getJArray(json, "editor");
20195      for (int i = 0; i < array.size(); i++) {
20196        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20197      }
20198    };
20199    if (json.has("reviewer")) {
20200      JsonArray array = getJArray(json, "reviewer");
20201      for (int i = 0; i < array.size(); i++) {
20202        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
20203      }
20204    };
20205    if (json.has("endorser")) {
20206      JsonArray array = getJArray(json, "endorser");
20207      for (int i = 0; i < array.size(); i++) {
20208        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
20209      }
20210    };
20211    if (json.has("relatedArtifact")) {
20212      JsonArray array = getJArray(json, "relatedArtifact");
20213      for (int i = 0; i < array.size(); i++) {
20214        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20215      }
20216    };
20217    if (json.has("parameter")) {
20218      JsonArray array = getJArray(json, "parameter");
20219      for (int i = 0; i < array.size(); i++) {
20220        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
20221      }
20222    };
20223    if (json.has("dataRequirement")) {
20224      JsonArray array = getJArray(json, "dataRequirement");
20225      for (int i = 0; i < array.size(); i++) {
20226        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20227      }
20228    };
20229    if (json.has("content")) {
20230      JsonArray array = getJArray(json, "content");
20231      for (int i = 0; i < array.size(); i++) {
20232        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
20233      }
20234    };
20235  }
20236
20237  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
20238    Linkage res = new Linkage();
20239    parseLinkageProperties(json, res);
20240    return res;
20241  }
20242
20243  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
20244    parseDomainResourceProperties(json, res);
20245    if (json.has("active"))
20246      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20247    if (json.has("_active"))
20248      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20249    if (json.has("author"))
20250      res.setAuthor(parseReference(getJObject(json, "author")));
20251    if (json.has("item")) {
20252      JsonArray array = getJArray(json, "item");
20253      for (int i = 0; i < array.size(); i++) {
20254        res.getItem().add(parseLinkageItemComponent(array.get(i).getAsJsonObject()));
20255      }
20256    };
20257  }
20258
20259  protected Linkage.LinkageItemComponent parseLinkageItemComponent(JsonObject json) throws IOException, FHIRFormatError {
20260    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
20261    parseLinkageItemComponentProperties(json, res);
20262    return res;
20263  }
20264
20265  protected void parseLinkageItemComponentProperties(JsonObject json, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
20266    parseBackboneElementProperties(json, res);
20267    if (json.has("type"))
20268      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
20269    if (json.has("_type"))
20270      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
20271    if (json.has("resource"))
20272      res.setResource(parseReference(getJObject(json, "resource")));
20273  }
20274
20275  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
20276    ListResource res = new ListResource();
20277    parseListResourceProperties(json, res);
20278    return res;
20279  }
20280
20281  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
20282    parseDomainResourceProperties(json, res);
20283    if (json.has("identifier")) {
20284      JsonArray array = getJArray(json, "identifier");
20285      for (int i = 0; i < array.size(); i++) {
20286        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20287      }
20288    };
20289    if (json.has("status"))
20290      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
20291    if (json.has("_status"))
20292      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20293    if (json.has("mode"))
20294      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
20295    if (json.has("_mode"))
20296      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
20297    if (json.has("title"))
20298      res.setTitleElement(parseString(json.get("title").getAsString()));
20299    if (json.has("_title"))
20300      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20301    if (json.has("code"))
20302      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20303    if (json.has("subject")) {
20304      JsonArray array = getJArray(json, "subject");
20305      for (int i = 0; i < array.size(); i++) {
20306        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
20307      }
20308    };
20309    if (json.has("encounter"))
20310      res.setEncounter(parseReference(getJObject(json, "encounter")));
20311    if (json.has("date"))
20312      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20313    if (json.has("_date"))
20314      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20315    if (json.has("source"))
20316      res.setSource(parseReference(getJObject(json, "source")));
20317    if (json.has("orderedBy"))
20318      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
20319    if (json.has("note")) {
20320      JsonArray array = getJArray(json, "note");
20321      for (int i = 0; i < array.size(); i++) {
20322        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20323      }
20324    };
20325    if (json.has("entry")) {
20326      JsonArray array = getJArray(json, "entry");
20327      for (int i = 0; i < array.size(); i++) {
20328        res.getEntry().add(parseListResourceEntryComponent(array.get(i).getAsJsonObject()));
20329      }
20330    };
20331    if (json.has("emptyReason"))
20332      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
20333  }
20334
20335  protected ListResource.ListResourceEntryComponent parseListResourceEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
20336    ListResource.ListResourceEntryComponent res = new ListResource.ListResourceEntryComponent();
20337    parseListResourceEntryComponentProperties(json, res);
20338    return res;
20339  }
20340
20341  protected void parseListResourceEntryComponentProperties(JsonObject json, ListResource.ListResourceEntryComponent res) throws IOException, FHIRFormatError {
20342    parseBackboneElementProperties(json, res);
20343    if (json.has("flag"))
20344      res.setFlag(parseCodeableConcept(getJObject(json, "flag")));
20345    if (json.has("deleted"))
20346      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
20347    if (json.has("_deleted"))
20348      parseElementProperties(getJObject(json, "_deleted"), res.getDeletedElement());
20349    if (json.has("date"))
20350      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20351    if (json.has("_date"))
20352      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20353    if (json.has("item"))
20354      res.setItem(parseReference(getJObject(json, "item")));
20355  }
20356
20357  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
20358    Location res = new Location();
20359    parseLocationProperties(json, res);
20360    return res;
20361  }
20362
20363  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
20364    parseDomainResourceProperties(json, res);
20365    if (json.has("identifier")) {
20366      JsonArray array = getJArray(json, "identifier");
20367      for (int i = 0; i < array.size(); i++) {
20368        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20369      }
20370    };
20371    if (json.has("status"))
20372      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
20373    if (json.has("_status"))
20374      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20375    if (json.has("operationalStatus"))
20376      res.setOperationalStatus(parseCoding(getJObject(json, "operationalStatus")));
20377    if (json.has("name"))
20378      res.setNameElement(parseString(json.get("name").getAsString()));
20379    if (json.has("_name"))
20380      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20381    if (json.has("alias")) {
20382      JsonArray array = getJArray(json, "alias");
20383      for (int i = 0; i < array.size(); i++) {
20384        if (array.get(i).isJsonNull()) {
20385          res.getAlias().add(new StringType());
20386        } else {;
20387          res.getAlias().add(parseString(array.get(i).getAsString()));
20388        }
20389      }
20390    };
20391    if (json.has("_alias")) {
20392      JsonArray array = getJArray(json, "_alias");
20393      for (int i = 0; i < array.size(); i++) {
20394        if (i == res.getAlias().size())
20395          res.getAlias().add(parseString(null));
20396        if (array.get(i) instanceof JsonObject) 
20397          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
20398      }
20399    };
20400    if (json.has("description"))
20401      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20402    if (json.has("_description"))
20403      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20404    if (json.has("mode"))
20405      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
20406    if (json.has("_mode"))
20407      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
20408    if (json.has("type")) {
20409      JsonArray array = getJArray(json, "type");
20410      for (int i = 0; i < array.size(); i++) {
20411        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20412      }
20413    };
20414    if (json.has("contact")) {
20415      JsonArray array = getJArray(json, "contact");
20416      for (int i = 0; i < array.size(); i++) {
20417        res.getContact().add(parseExtendedContactDetail(array.get(i).getAsJsonObject()));
20418      }
20419    };
20420    if (json.has("address"))
20421      res.setAddress(parseAddress(getJObject(json, "address")));
20422    if (json.has("form"))
20423      res.setForm(parseCodeableConcept(getJObject(json, "form")));
20424    if (json.has("position"))
20425      res.setPosition(parseLocationPositionComponent(getJObject(json, "position")));
20426    if (json.has("managingOrganization"))
20427      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
20428    if (json.has("partOf"))
20429      res.setPartOf(parseReference(getJObject(json, "partOf")));
20430    if (json.has("characteristic")) {
20431      JsonArray array = getJArray(json, "characteristic");
20432      for (int i = 0; i < array.size(); i++) {
20433        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20434      }
20435    };
20436    if (json.has("hoursOfOperation")) {
20437      JsonArray array = getJArray(json, "hoursOfOperation");
20438      for (int i = 0; i < array.size(); i++) {
20439        res.getHoursOfOperation().add(parseAvailability(array.get(i).getAsJsonObject()));
20440      }
20441    };
20442    if (json.has("virtualService")) {
20443      JsonArray array = getJArray(json, "virtualService");
20444      for (int i = 0; i < array.size(); i++) {
20445        res.getVirtualService().add(parseVirtualServiceDetail(array.get(i).getAsJsonObject()));
20446      }
20447    };
20448    if (json.has("endpoint")) {
20449      JsonArray array = getJArray(json, "endpoint");
20450      for (int i = 0; i < array.size(); i++) {
20451        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20452      }
20453    };
20454  }
20455
20456  protected Location.LocationPositionComponent parseLocationPositionComponent(JsonObject json) throws IOException, FHIRFormatError {
20457    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
20458    parseLocationPositionComponentProperties(json, res);
20459    return res;
20460  }
20461
20462  protected void parseLocationPositionComponentProperties(JsonObject json, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
20463    parseBackboneElementProperties(json, res);
20464    if (json.has("longitude"))
20465      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
20466    if (json.has("_longitude"))
20467      parseElementProperties(getJObject(json, "_longitude"), res.getLongitudeElement());
20468    if (json.has("latitude"))
20469      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
20470    if (json.has("_latitude"))
20471      parseElementProperties(getJObject(json, "_latitude"), res.getLatitudeElement());
20472    if (json.has("altitude"))
20473      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
20474    if (json.has("_altitude"))
20475      parseElementProperties(getJObject(json, "_altitude"), res.getAltitudeElement());
20476  }
20477
20478  protected ManufacturedItemDefinition parseManufacturedItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
20479    ManufacturedItemDefinition res = new ManufacturedItemDefinition();
20480    parseManufacturedItemDefinitionProperties(json, res);
20481    return res;
20482  }
20483
20484  protected void parseManufacturedItemDefinitionProperties(JsonObject json, ManufacturedItemDefinition res) throws IOException, FHIRFormatError {
20485    parseDomainResourceProperties(json, res);
20486    if (json.has("identifier")) {
20487      JsonArray array = getJArray(json, "identifier");
20488      for (int i = 0; i < array.size(); i++) {
20489        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20490      }
20491    };
20492    if (json.has("status"))
20493      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20494    if (json.has("_status"))
20495      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20496    if (json.has("name"))
20497      res.setNameElement(parseString(json.get("name").getAsString()));
20498    if (json.has("_name"))
20499      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20500    if (json.has("manufacturedDoseForm"))
20501      res.setManufacturedDoseForm(parseCodeableConcept(getJObject(json, "manufacturedDoseForm")));
20502    if (json.has("unitOfPresentation"))
20503      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
20504    if (json.has("manufacturer")) {
20505      JsonArray array = getJArray(json, "manufacturer");
20506      for (int i = 0; i < array.size(); i++) {
20507        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20508      }
20509    };
20510    if (json.has("marketingStatus")) {
20511      JsonArray array = getJArray(json, "marketingStatus");
20512      for (int i = 0; i < array.size(); i++) {
20513        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
20514      }
20515    };
20516    if (json.has("ingredient")) {
20517      JsonArray array = getJArray(json, "ingredient");
20518      for (int i = 0; i < array.size(); i++) {
20519        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20520      }
20521    };
20522    if (json.has("property")) {
20523      JsonArray array = getJArray(json, "property");
20524      for (int i = 0; i < array.size(); i++) {
20525        res.getProperty().add(parseManufacturedItemDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
20526      }
20527    };
20528    if (json.has("component")) {
20529      JsonArray array = getJArray(json, "component");
20530      for (int i = 0; i < array.size(); i++) {
20531        res.getComponent().add(parseManufacturedItemDefinitionComponentComponent(array.get(i).getAsJsonObject()));
20532      }
20533    };
20534  }
20535
20536  protected ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent parseManufacturedItemDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
20537    ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent res = new ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent();
20538    parseManufacturedItemDefinitionPropertyComponentProperties(json, res);
20539    return res;
20540  }
20541
20542  protected void parseManufacturedItemDefinitionPropertyComponentProperties(JsonObject json, ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
20543    parseBackboneElementProperties(json, res);
20544    if (json.has("type"))
20545      res.setType(parseCodeableConcept(getJObject(json, "type")));
20546    DataType value = parseType("value", json);
20547    if (value != null)
20548      res.setValue(value);
20549  }
20550
20551  protected ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent parseManufacturedItemDefinitionComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
20552    ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent res = new ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent();
20553    parseManufacturedItemDefinitionComponentComponentProperties(json, res);
20554    return res;
20555  }
20556
20557  protected void parseManufacturedItemDefinitionComponentComponentProperties(JsonObject json, ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent res) throws IOException, FHIRFormatError {
20558    parseBackboneElementProperties(json, res);
20559    if (json.has("type"))
20560      res.setType(parseCodeableConcept(getJObject(json, "type")));
20561    if (json.has("function")) {
20562      JsonArray array = getJArray(json, "function");
20563      for (int i = 0; i < array.size(); i++) {
20564        res.getFunction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20565      }
20566    };
20567    if (json.has("amount")) {
20568      JsonArray array = getJArray(json, "amount");
20569      for (int i = 0; i < array.size(); i++) {
20570        res.getAmount().add(parseQuantity(array.get(i).getAsJsonObject()));
20571      }
20572    };
20573    if (json.has("constituent")) {
20574      JsonArray array = getJArray(json, "constituent");
20575      for (int i = 0; i < array.size(); i++) {
20576        res.getConstituent().add(parseManufacturedItemDefinitionComponentConstituentComponent(array.get(i).getAsJsonObject()));
20577      }
20578    };
20579    if (json.has("property")) {
20580      JsonArray array = getJArray(json, "property");
20581      for (int i = 0; i < array.size(); i++) {
20582        res.getProperty().add(parseManufacturedItemDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
20583      }
20584    };
20585    if (json.has("component")) {
20586      JsonArray array = getJArray(json, "component");
20587      for (int i = 0; i < array.size(); i++) {
20588        res.getComponent().add(parseManufacturedItemDefinitionComponentComponent(array.get(i).getAsJsonObject()));
20589      }
20590    };
20591  }
20592
20593  protected ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent parseManufacturedItemDefinitionComponentConstituentComponent(JsonObject json) throws IOException, FHIRFormatError {
20594    ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent res = new ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent();
20595    parseManufacturedItemDefinitionComponentConstituentComponentProperties(json, res);
20596    return res;
20597  }
20598
20599  protected void parseManufacturedItemDefinitionComponentConstituentComponentProperties(JsonObject json, ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent res) throws IOException, FHIRFormatError {
20600    parseBackboneElementProperties(json, res);
20601    if (json.has("amount")) {
20602      JsonArray array = getJArray(json, "amount");
20603      for (int i = 0; i < array.size(); i++) {
20604        res.getAmount().add(parseQuantity(array.get(i).getAsJsonObject()));
20605      }
20606    };
20607    if (json.has("location")) {
20608      JsonArray array = getJArray(json, "location");
20609      for (int i = 0; i < array.size(); i++) {
20610        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20611      }
20612    };
20613    if (json.has("function")) {
20614      JsonArray array = getJArray(json, "function");
20615      for (int i = 0; i < array.size(); i++) {
20616        res.getFunction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20617      }
20618    };
20619    if (json.has("hasIngredient")) {
20620      JsonArray array = getJArray(json, "hasIngredient");
20621      for (int i = 0; i < array.size(); i++) {
20622        res.getHasIngredient().add(parseCodeableReference(array.get(i).getAsJsonObject()));
20623      }
20624    };
20625  }
20626
20627  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
20628    Measure res = new Measure();
20629    parseMeasureProperties(json, res);
20630    return res;
20631  }
20632
20633  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
20634    parseMetadataResourceProperties(json, res);
20635    if (json.has("url"))
20636      res.setUrlElement(parseUri(json.get("url").getAsString()));
20637    if (json.has("_url"))
20638      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
20639    if (json.has("identifier")) {
20640      JsonArray array = getJArray(json, "identifier");
20641      for (int i = 0; i < array.size(); i++) {
20642        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20643      }
20644    };
20645    if (json.has("version"))
20646      res.setVersionElement(parseString(json.get("version").getAsString()));
20647    if (json.has("_version"))
20648      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
20649    DataType versionAlgorithm = parseType("versionAlgorithm", json);
20650    if (versionAlgorithm != null)
20651      res.setVersionAlgorithm(versionAlgorithm);
20652    if (json.has("name"))
20653      res.setNameElement(parseString(json.get("name").getAsString()));
20654    if (json.has("_name"))
20655      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20656    if (json.has("title"))
20657      res.setTitleElement(parseString(json.get("title").getAsString()));
20658    if (json.has("_title"))
20659      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20660    if (json.has("subtitle"))
20661      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
20662    if (json.has("_subtitle"))
20663      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
20664    if (json.has("status"))
20665      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20666    if (json.has("_status"))
20667      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20668    if (json.has("experimental"))
20669      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20670    if (json.has("_experimental"))
20671      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
20672    DataType subject = parseType("subject", json);
20673    if (subject != null)
20674      res.setSubject(subject);
20675    if (json.has("basis"))
20676      res.setBasisElement(parseEnumeration(json.get("basis").getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
20677    if (json.has("_basis"))
20678      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
20679    if (json.has("date"))
20680      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20681    if (json.has("_date"))
20682      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20683    if (json.has("publisher"))
20684      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20685    if (json.has("_publisher"))
20686      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
20687    if (json.has("contact")) {
20688      JsonArray array = getJArray(json, "contact");
20689      for (int i = 0; i < array.size(); i++) {
20690        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20691      }
20692    };
20693    if (json.has("description"))
20694      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20695    if (json.has("_description"))
20696      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20697    if (json.has("useContext")) {
20698      JsonArray array = getJArray(json, "useContext");
20699      for (int i = 0; i < array.size(); i++) {
20700        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20701      }
20702    };
20703    if (json.has("jurisdiction")) {
20704      JsonArray array = getJArray(json, "jurisdiction");
20705      for (int i = 0; i < array.size(); i++) {
20706        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20707      }
20708    };
20709    if (json.has("purpose"))
20710      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20711    if (json.has("_purpose"))
20712      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
20713    if (json.has("usage"))
20714      res.setUsageElement(parseMarkdown(json.get("usage").getAsString()));
20715    if (json.has("_usage"))
20716      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
20717    if (json.has("copyright"))
20718      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20719    if (json.has("_copyright"))
20720      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
20721    if (json.has("copyrightLabel"))
20722      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
20723    if (json.has("_copyrightLabel"))
20724      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
20725    if (json.has("approvalDate"))
20726      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20727    if (json.has("_approvalDate"))
20728      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
20729    if (json.has("lastReviewDate"))
20730      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20731    if (json.has("_lastReviewDate"))
20732      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
20733    if (json.has("effectivePeriod"))
20734      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
20735    if (json.has("topic")) {
20736      JsonArray array = getJArray(json, "topic");
20737      for (int i = 0; i < array.size(); i++) {
20738        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20739      }
20740    };
20741    if (json.has("author")) {
20742      JsonArray array = getJArray(json, "author");
20743      for (int i = 0; i < array.size(); i++) {
20744        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20745      }
20746    };
20747    if (json.has("editor")) {
20748      JsonArray array = getJArray(json, "editor");
20749      for (int i = 0; i < array.size(); i++) {
20750        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20751      }
20752    };
20753    if (json.has("reviewer")) {
20754      JsonArray array = getJArray(json, "reviewer");
20755      for (int i = 0; i < array.size(); i++) {
20756        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
20757      }
20758    };
20759    if (json.has("endorser")) {
20760      JsonArray array = getJArray(json, "endorser");
20761      for (int i = 0; i < array.size(); i++) {
20762        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
20763      }
20764    };
20765    if (json.has("relatedArtifact")) {
20766      JsonArray array = getJArray(json, "relatedArtifact");
20767      for (int i = 0; i < array.size(); i++) {
20768        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20769      }
20770    };
20771    if (json.has("library")) {
20772      JsonArray array = getJArray(json, "library");
20773      for (int i = 0; i < array.size(); i++) {
20774        if (array.get(i).isJsonNull()) {
20775          res.getLibrary().add(new CanonicalType());
20776        } else {;
20777          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
20778        }
20779      }
20780    };
20781    if (json.has("_library")) {
20782      JsonArray array = getJArray(json, "_library");
20783      for (int i = 0; i < array.size(); i++) {
20784        if (i == res.getLibrary().size())
20785          res.getLibrary().add(parseCanonical(null));
20786        if (array.get(i) instanceof JsonObject) 
20787          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
20788      }
20789    };
20790    if (json.has("disclaimer"))
20791      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
20792    if (json.has("_disclaimer"))
20793      parseElementProperties(getJObject(json, "_disclaimer"), res.getDisclaimerElement());
20794    if (json.has("scoring"))
20795      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
20796    if (json.has("scoringUnit"))
20797      res.setScoringUnit(parseCodeableConcept(getJObject(json, "scoringUnit")));
20798    if (json.has("compositeScoring"))
20799      res.setCompositeScoring(parseCodeableConcept(getJObject(json, "compositeScoring")));
20800    if (json.has("type")) {
20801      JsonArray array = getJArray(json, "type");
20802      for (int i = 0; i < array.size(); i++) {
20803        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20804      }
20805    };
20806    if (json.has("riskAdjustment"))
20807      res.setRiskAdjustmentElement(parseMarkdown(json.get("riskAdjustment").getAsString()));
20808    if (json.has("_riskAdjustment"))
20809      parseElementProperties(getJObject(json, "_riskAdjustment"), res.getRiskAdjustmentElement());
20810    if (json.has("rateAggregation"))
20811      res.setRateAggregationElement(parseMarkdown(json.get("rateAggregation").getAsString()));
20812    if (json.has("_rateAggregation"))
20813      parseElementProperties(getJObject(json, "_rateAggregation"), res.getRateAggregationElement());
20814    if (json.has("rationale"))
20815      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
20816    if (json.has("_rationale"))
20817      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
20818    if (json.has("clinicalRecommendationStatement"))
20819      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
20820    if (json.has("_clinicalRecommendationStatement"))
20821      parseElementProperties(getJObject(json, "_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
20822    if (json.has("improvementNotation"))
20823      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
20824    if (json.has("term")) {
20825      JsonArray array = getJArray(json, "term");
20826      for (int i = 0; i < array.size(); i++) {
20827        res.getTerm().add(parseMeasureTermComponent(array.get(i).getAsJsonObject()));
20828      }
20829    };
20830    if (json.has("guidance"))
20831      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
20832    if (json.has("_guidance"))
20833      parseElementProperties(getJObject(json, "_guidance"), res.getGuidanceElement());
20834    if (json.has("group")) {
20835      JsonArray array = getJArray(json, "group");
20836      for (int i = 0; i < array.size(); i++) {
20837        res.getGroup().add(parseMeasureGroupComponent(array.get(i).getAsJsonObject()));
20838      }
20839    };
20840    if (json.has("supplementalData")) {
20841      JsonArray array = getJArray(json, "supplementalData");
20842      for (int i = 0; i < array.size(); i++) {
20843        res.getSupplementalData().add(parseMeasureSupplementalDataComponent(array.get(i).getAsJsonObject()));
20844      }
20845    };
20846  }
20847
20848  protected Measure.MeasureTermComponent parseMeasureTermComponent(JsonObject json) throws IOException, FHIRFormatError {
20849    Measure.MeasureTermComponent res = new Measure.MeasureTermComponent();
20850    parseMeasureTermComponentProperties(json, res);
20851    return res;
20852  }
20853
20854  protected void parseMeasureTermComponentProperties(JsonObject json, Measure.MeasureTermComponent res) throws IOException, FHIRFormatError {
20855    parseBackboneElementProperties(json, res);
20856    if (json.has("code"))
20857      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20858    if (json.has("definition"))
20859      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
20860    if (json.has("_definition"))
20861      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
20862  }
20863
20864  protected Measure.MeasureGroupComponent parseMeasureGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
20865    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
20866    parseMeasureGroupComponentProperties(json, res);
20867    return res;
20868  }
20869
20870  protected void parseMeasureGroupComponentProperties(JsonObject json, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
20871    parseBackboneElementProperties(json, res);
20872    if (json.has("linkId"))
20873      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
20874    if (json.has("_linkId"))
20875      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
20876    if (json.has("code"))
20877      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20878    if (json.has("description"))
20879      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20880    if (json.has("_description"))
20881      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20882    if (json.has("type")) {
20883      JsonArray array = getJArray(json, "type");
20884      for (int i = 0; i < array.size(); i++) {
20885        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20886      }
20887    };
20888    DataType subject = parseType("subject", json);
20889    if (subject != null)
20890      res.setSubject(subject);
20891    if (json.has("basis"))
20892      res.setBasisElement(parseEnumeration(json.get("basis").getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
20893    if (json.has("_basis"))
20894      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
20895    if (json.has("scoring"))
20896      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
20897    if (json.has("scoringUnit"))
20898      res.setScoringUnit(parseCodeableConcept(getJObject(json, "scoringUnit")));
20899    if (json.has("rateAggregation"))
20900      res.setRateAggregationElement(parseMarkdown(json.get("rateAggregation").getAsString()));
20901    if (json.has("_rateAggregation"))
20902      parseElementProperties(getJObject(json, "_rateAggregation"), res.getRateAggregationElement());
20903    if (json.has("improvementNotation"))
20904      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
20905    if (json.has("library")) {
20906      JsonArray array = getJArray(json, "library");
20907      for (int i = 0; i < array.size(); i++) {
20908        if (array.get(i).isJsonNull()) {
20909          res.getLibrary().add(new CanonicalType());
20910        } else {;
20911          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
20912        }
20913      }
20914    };
20915    if (json.has("_library")) {
20916      JsonArray array = getJArray(json, "_library");
20917      for (int i = 0; i < array.size(); i++) {
20918        if (i == res.getLibrary().size())
20919          res.getLibrary().add(parseCanonical(null));
20920        if (array.get(i) instanceof JsonObject) 
20921          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
20922      }
20923    };
20924    if (json.has("population")) {
20925      JsonArray array = getJArray(json, "population");
20926      for (int i = 0; i < array.size(); i++) {
20927        res.getPopulation().add(parseMeasureGroupPopulationComponent(array.get(i).getAsJsonObject()));
20928      }
20929    };
20930    if (json.has("stratifier")) {
20931      JsonArray array = getJArray(json, "stratifier");
20932      for (int i = 0; i < array.size(); i++) {
20933        res.getStratifier().add(parseMeasureGroupStratifierComponent(array.get(i).getAsJsonObject()));
20934      }
20935    };
20936  }
20937
20938  protected Measure.MeasureGroupPopulationComponent parseMeasureGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
20939    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
20940    parseMeasureGroupPopulationComponentProperties(json, res);
20941    return res;
20942  }
20943
20944  protected void parseMeasureGroupPopulationComponentProperties(JsonObject json, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
20945    parseBackboneElementProperties(json, res);
20946    if (json.has("linkId"))
20947      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
20948    if (json.has("_linkId"))
20949      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
20950    if (json.has("code"))
20951      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20952    if (json.has("description"))
20953      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20954    if (json.has("_description"))
20955      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20956    if (json.has("criteria"))
20957      res.setCriteria(parseExpression(getJObject(json, "criteria")));
20958    if (json.has("groupDefinition"))
20959      res.setGroupDefinition(parseReference(getJObject(json, "groupDefinition")));
20960    if (json.has("inputPopulationId"))
20961      res.setInputPopulationIdElement(parseString(json.get("inputPopulationId").getAsString()));
20962    if (json.has("_inputPopulationId"))
20963      parseElementProperties(getJObject(json, "_inputPopulationId"), res.getInputPopulationIdElement());
20964    if (json.has("aggregateMethod"))
20965      res.setAggregateMethod(parseCodeableConcept(getJObject(json, "aggregateMethod")));
20966  }
20967
20968  protected Measure.MeasureGroupStratifierComponent parseMeasureGroupStratifierComponent(JsonObject json) throws IOException, FHIRFormatError {
20969    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
20970    parseMeasureGroupStratifierComponentProperties(json, res);
20971    return res;
20972  }
20973
20974  protected void parseMeasureGroupStratifierComponentProperties(JsonObject json, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
20975    parseBackboneElementProperties(json, res);
20976    if (json.has("linkId"))
20977      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
20978    if (json.has("_linkId"))
20979      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
20980    if (json.has("code"))
20981      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20982    if (json.has("description"))
20983      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20984    if (json.has("_description"))
20985      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20986    if (json.has("criteria"))
20987      res.setCriteria(parseExpression(getJObject(json, "criteria")));
20988    if (json.has("groupDefinition"))
20989      res.setGroupDefinition(parseReference(getJObject(json, "groupDefinition")));
20990    if (json.has("component")) {
20991      JsonArray array = getJArray(json, "component");
20992      for (int i = 0; i < array.size(); i++) {
20993        res.getComponent().add(parseMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject()));
20994      }
20995    };
20996  }
20997
20998  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureGroupStratifierComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
20999    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
21000    parseMeasureGroupStratifierComponentComponentProperties(json, res);
21001    return res;
21002  }
21003
21004  protected void parseMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
21005    parseBackboneElementProperties(json, res);
21006    if (json.has("linkId"))
21007      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21008    if (json.has("_linkId"))
21009      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21010    if (json.has("code"))
21011      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21012    if (json.has("description"))
21013      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21014    if (json.has("_description"))
21015      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21016    if (json.has("criteria"))
21017      res.setCriteria(parseExpression(getJObject(json, "criteria")));
21018    if (json.has("groupDefinition"))
21019      res.setGroupDefinition(parseReference(getJObject(json, "groupDefinition")));
21020  }
21021
21022  protected Measure.MeasureSupplementalDataComponent parseMeasureSupplementalDataComponent(JsonObject json) throws IOException, FHIRFormatError {
21023    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
21024    parseMeasureSupplementalDataComponentProperties(json, res);
21025    return res;
21026  }
21027
21028  protected void parseMeasureSupplementalDataComponentProperties(JsonObject json, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
21029    parseBackboneElementProperties(json, res);
21030    if (json.has("linkId"))
21031      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21032    if (json.has("_linkId"))
21033      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21034    if (json.has("code"))
21035      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21036    if (json.has("usage")) {
21037      JsonArray array = getJArray(json, "usage");
21038      for (int i = 0; i < array.size(); i++) {
21039        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21040      }
21041    };
21042    if (json.has("description"))
21043      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21044    if (json.has("_description"))
21045      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21046    if (json.has("criteria"))
21047      res.setCriteria(parseExpression(getJObject(json, "criteria")));
21048  }
21049
21050  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
21051    MeasureReport res = new MeasureReport();
21052    parseMeasureReportProperties(json, res);
21053    return res;
21054  }
21055
21056  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
21057    parseDomainResourceProperties(json, res);
21058    if (json.has("identifier")) {
21059      JsonArray array = getJArray(json, "identifier");
21060      for (int i = 0; i < array.size(); i++) {
21061        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21062      }
21063    };
21064    if (json.has("status"))
21065      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
21066    if (json.has("_status"))
21067      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21068    if (json.has("type"))
21069      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
21070    if (json.has("_type"))
21071      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21072    if (json.has("dataUpdateType"))
21073      res.setDataUpdateTypeElement(parseEnumeration(json.get("dataUpdateType").getAsString(), MeasureReport.SubmitDataUpdateType.NULL, new MeasureReport.SubmitDataUpdateTypeEnumFactory()));
21074    if (json.has("_dataUpdateType"))
21075      parseElementProperties(getJObject(json, "_dataUpdateType"), res.getDataUpdateTypeElement());
21076    if (json.has("measure"))
21077      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
21078    if (json.has("_measure"))
21079      parseElementProperties(getJObject(json, "_measure"), res.getMeasureElement());
21080    if (json.has("subject"))
21081      res.setSubject(parseReference(getJObject(json, "subject")));
21082    if (json.has("date"))
21083      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21084    if (json.has("_date"))
21085      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21086    if (json.has("reporter"))
21087      res.setReporter(parseReference(getJObject(json, "reporter")));
21088    if (json.has("reportingVendor"))
21089      res.setReportingVendor(parseReference(getJObject(json, "reportingVendor")));
21090    if (json.has("location"))
21091      res.setLocation(parseReference(getJObject(json, "location")));
21092    if (json.has("period"))
21093      res.setPeriod(parsePeriod(getJObject(json, "period")));
21094    if (json.has("inputParameters"))
21095      res.setInputParameters(parseReference(getJObject(json, "inputParameters")));
21096    if (json.has("scoring"))
21097      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
21098    if (json.has("improvementNotation"))
21099      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
21100    if (json.has("group")) {
21101      JsonArray array = getJArray(json, "group");
21102      for (int i = 0; i < array.size(); i++) {
21103        res.getGroup().add(parseMeasureReportGroupComponent(array.get(i).getAsJsonObject()));
21104      }
21105    };
21106    if (json.has("supplementalData")) {
21107      JsonArray array = getJArray(json, "supplementalData");
21108      for (int i = 0; i < array.size(); i++) {
21109        res.getSupplementalData().add(parseReference(array.get(i).getAsJsonObject()));
21110      }
21111    };
21112    if (json.has("evaluatedResource")) {
21113      JsonArray array = getJArray(json, "evaluatedResource");
21114      for (int i = 0; i < array.size(); i++) {
21115        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
21116      }
21117    };
21118  }
21119
21120  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
21121    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
21122    parseMeasureReportGroupComponentProperties(json, res);
21123    return res;
21124  }
21125
21126  protected void parseMeasureReportGroupComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
21127    parseBackboneElementProperties(json, res);
21128    if (json.has("linkId"))
21129      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21130    if (json.has("_linkId"))
21131      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21132    if (json.has("code"))
21133      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21134    if (json.has("subject"))
21135      res.setSubject(parseReference(getJObject(json, "subject")));
21136    if (json.has("population")) {
21137      JsonArray array = getJArray(json, "population");
21138      for (int i = 0; i < array.size(); i++) {
21139        res.getPopulation().add(parseMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject()));
21140      }
21141    };
21142    DataType measureScore = parseType("measureScore", json);
21143    if (measureScore != null)
21144      res.setMeasureScore(measureScore);
21145    if (json.has("stratifier")) {
21146      JsonArray array = getJArray(json, "stratifier");
21147      for (int i = 0; i < array.size(); i++) {
21148        res.getStratifier().add(parseMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject()));
21149      }
21150    };
21151  }
21152
21153  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
21154    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
21155    parseMeasureReportGroupPopulationComponentProperties(json, res);
21156    return res;
21157  }
21158
21159  protected void parseMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
21160    parseBackboneElementProperties(json, res);
21161    if (json.has("linkId"))
21162      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21163    if (json.has("_linkId"))
21164      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21165    if (json.has("code"))
21166      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21167    if (json.has("count"))
21168      res.setCountElement(parseInteger(json.get("count").getAsLong()));
21169    if (json.has("_count"))
21170      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
21171    if (json.has("subjectResults"))
21172      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
21173    if (json.has("subjectReport")) {
21174      JsonArray array = getJArray(json, "subjectReport");
21175      for (int i = 0; i < array.size(); i++) {
21176        res.getSubjectReport().add(parseReference(array.get(i).getAsJsonObject()));
21177      }
21178    };
21179    if (json.has("subjects"))
21180      res.setSubjects(parseReference(getJObject(json, "subjects")));
21181  }
21182
21183  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportGroupStratifierComponent(JsonObject json) throws IOException, FHIRFormatError {
21184    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
21185    parseMeasureReportGroupStratifierComponentProperties(json, res);
21186    return res;
21187  }
21188
21189  protected void parseMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
21190    parseBackboneElementProperties(json, res);
21191    if (json.has("linkId"))
21192      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21193    if (json.has("_linkId"))
21194      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21195    if (json.has("code"))
21196      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21197    if (json.has("stratum")) {
21198      JsonArray array = getJArray(json, "stratum");
21199      for (int i = 0; i < array.size(); i++) {
21200        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject()));
21201      }
21202    };
21203  }
21204
21205  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
21206    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
21207    parseMeasureReportStratifierGroupComponentProperties(json, res);
21208    return res;
21209  }
21210
21211  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
21212    parseBackboneElementProperties(json, res);
21213    DataType value = parseType("value", json);
21214    if (value != null)
21215      res.setValue(value);
21216    if (json.has("component")) {
21217      JsonArray array = getJArray(json, "component");
21218      for (int i = 0; i < array.size(); i++) {
21219        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject()));
21220      }
21221    };
21222    if (json.has("population")) {
21223      JsonArray array = getJArray(json, "population");
21224      for (int i = 0; i < array.size(); i++) {
21225        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject()));
21226      }
21227    };
21228    DataType measureScore = parseType("measureScore", json);
21229    if (measureScore != null)
21230      res.setMeasureScore(measureScore);
21231  }
21232
21233  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
21234    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
21235    parseMeasureReportStratifierGroupComponentComponentProperties(json, res);
21236    return res;
21237  }
21238
21239  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
21240    parseBackboneElementProperties(json, res);
21241    if (json.has("linkId"))
21242      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21243    if (json.has("_linkId"))
21244      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21245    if (json.has("code"))
21246      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21247    DataType value = parseType("value", json);
21248    if (value != null)
21249      res.setValue(value);
21250  }
21251
21252  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
21253    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
21254    parseMeasureReportStratifierGroupPopulationComponentProperties(json, res);
21255    return res;
21256  }
21257
21258  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
21259    parseBackboneElementProperties(json, res);
21260    if (json.has("linkId"))
21261      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21262    if (json.has("_linkId"))
21263      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21264    if (json.has("code"))
21265      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21266    if (json.has("count"))
21267      res.setCountElement(parseInteger(json.get("count").getAsLong()));
21268    if (json.has("_count"))
21269      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
21270    if (json.has("subjectResults"))
21271      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
21272    if (json.has("subjectReport")) {
21273      JsonArray array = getJArray(json, "subjectReport");
21274      for (int i = 0; i < array.size(); i++) {
21275        res.getSubjectReport().add(parseReference(array.get(i).getAsJsonObject()));
21276      }
21277    };
21278    if (json.has("subjects"))
21279      res.setSubjects(parseReference(getJObject(json, "subjects")));
21280  }
21281
21282  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
21283    Medication res = new Medication();
21284    parseMedicationProperties(json, res);
21285    return res;
21286  }
21287
21288  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
21289    parseDomainResourceProperties(json, res);
21290    if (json.has("identifier")) {
21291      JsonArray array = getJArray(json, "identifier");
21292      for (int i = 0; i < array.size(); i++) {
21293        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21294      }
21295    };
21296    if (json.has("code"))
21297      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21298    if (json.has("status"))
21299      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatusCodes.NULL, new Medication.MedicationStatusCodesEnumFactory()));
21300    if (json.has("_status"))
21301      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21302    if (json.has("marketingAuthorizationHolder"))
21303      res.setMarketingAuthorizationHolder(parseReference(getJObject(json, "marketingAuthorizationHolder")));
21304    if (json.has("doseForm"))
21305      res.setDoseForm(parseCodeableConcept(getJObject(json, "doseForm")));
21306    if (json.has("totalVolume"))
21307      res.setTotalVolume(parseQuantity(getJObject(json, "totalVolume")));
21308    if (json.has("ingredient")) {
21309      JsonArray array = getJArray(json, "ingredient");
21310      for (int i = 0; i < array.size(); i++) {
21311        res.getIngredient().add(parseMedicationIngredientComponent(array.get(i).getAsJsonObject()));
21312      }
21313    };
21314    if (json.has("batch"))
21315      res.setBatch(parseMedicationBatchComponent(getJObject(json, "batch")));
21316    if (json.has("definition"))
21317      res.setDefinition(parseReference(getJObject(json, "definition")));
21318  }
21319
21320  protected Medication.MedicationIngredientComponent parseMedicationIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
21321    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
21322    parseMedicationIngredientComponentProperties(json, res);
21323    return res;
21324  }
21325
21326  protected void parseMedicationIngredientComponentProperties(JsonObject json, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
21327    parseBackboneElementProperties(json, res);
21328    if (json.has("item"))
21329      res.setItem(parseCodeableReference(getJObject(json, "item")));
21330    if (json.has("isActive"))
21331      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
21332    if (json.has("_isActive"))
21333      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
21334    DataType strength = parseType("strength", json);
21335    if (strength != null)
21336      res.setStrength(strength);
21337  }
21338
21339  protected Medication.MedicationBatchComponent parseMedicationBatchComponent(JsonObject json) throws IOException, FHIRFormatError {
21340    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
21341    parseMedicationBatchComponentProperties(json, res);
21342    return res;
21343  }
21344
21345  protected void parseMedicationBatchComponentProperties(JsonObject json, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
21346    parseBackboneElementProperties(json, res);
21347    if (json.has("lotNumber"))
21348      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
21349    if (json.has("_lotNumber"))
21350      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
21351    if (json.has("expirationDate"))
21352      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
21353    if (json.has("_expirationDate"))
21354      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
21355  }
21356
21357  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
21358    MedicationAdministration res = new MedicationAdministration();
21359    parseMedicationAdministrationProperties(json, res);
21360    return res;
21361  }
21362
21363  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
21364    parseDomainResourceProperties(json, res);
21365    if (json.has("identifier")) {
21366      JsonArray array = getJArray(json, "identifier");
21367      for (int i = 0; i < array.size(); i++) {
21368        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21369      }
21370    };
21371    if (json.has("basedOn")) {
21372      JsonArray array = getJArray(json, "basedOn");
21373      for (int i = 0; i < array.size(); i++) {
21374        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21375      }
21376    };
21377    if (json.has("partOf")) {
21378      JsonArray array = getJArray(json, "partOf");
21379      for (int i = 0; i < array.size(); i++) {
21380        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21381      }
21382    };
21383    if (json.has("status"))
21384      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatusCodes.NULL, new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory()));
21385    if (json.has("_status"))
21386      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21387    if (json.has("statusReason")) {
21388      JsonArray array = getJArray(json, "statusReason");
21389      for (int i = 0; i < array.size(); i++) {
21390        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21391      }
21392    };
21393    if (json.has("category")) {
21394      JsonArray array = getJArray(json, "category");
21395      for (int i = 0; i < array.size(); i++) {
21396        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21397      }
21398    };
21399    if (json.has("medication"))
21400      res.setMedication(parseCodeableReference(getJObject(json, "medication")));
21401    if (json.has("subject"))
21402      res.setSubject(parseReference(getJObject(json, "subject")));
21403    if (json.has("encounter"))
21404      res.setEncounter(parseReference(getJObject(json, "encounter")));
21405    if (json.has("supportingInformation")) {
21406      JsonArray array = getJArray(json, "supportingInformation");
21407      for (int i = 0; i < array.size(); i++) {
21408        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
21409      }
21410    };
21411    DataType occurence = parseType("occurence", json);
21412    if (occurence != null)
21413      res.setOccurence(occurence);
21414    if (json.has("recorded"))
21415      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
21416    if (json.has("_recorded"))
21417      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
21418    if (json.has("isSubPotent"))
21419      res.setIsSubPotentElement(parseBoolean(json.get("isSubPotent").getAsBoolean()));
21420    if (json.has("_isSubPotent"))
21421      parseElementProperties(getJObject(json, "_isSubPotent"), res.getIsSubPotentElement());
21422    if (json.has("subPotentReason")) {
21423      JsonArray array = getJArray(json, "subPotentReason");
21424      for (int i = 0; i < array.size(); i++) {
21425        res.getSubPotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21426      }
21427    };
21428    if (json.has("performer")) {
21429      JsonArray array = getJArray(json, "performer");
21430      for (int i = 0; i < array.size(); i++) {
21431        res.getPerformer().add(parseMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject()));
21432      }
21433    };
21434    if (json.has("reason")) {
21435      JsonArray array = getJArray(json, "reason");
21436      for (int i = 0; i < array.size(); i++) {
21437        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
21438      }
21439    };
21440    if (json.has("request"))
21441      res.setRequest(parseReference(getJObject(json, "request")));
21442    if (json.has("device")) {
21443      JsonArray array = getJArray(json, "device");
21444      for (int i = 0; i < array.size(); i++) {
21445        res.getDevice().add(parseCodeableReference(array.get(i).getAsJsonObject()));
21446      }
21447    };
21448    if (json.has("note")) {
21449      JsonArray array = getJArray(json, "note");
21450      for (int i = 0; i < array.size(); i++) {
21451        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21452      }
21453    };
21454    if (json.has("dosage"))
21455      res.setDosage(parseMedicationAdministrationDosageComponent(getJObject(json, "dosage")));
21456    if (json.has("eventHistory")) {
21457      JsonArray array = getJArray(json, "eventHistory");
21458      for (int i = 0; i < array.size(); i++) {
21459        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
21460      }
21461    };
21462  }
21463
21464  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
21465    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
21466    parseMedicationAdministrationPerformerComponentProperties(json, res);
21467    return res;
21468  }
21469
21470  protected void parseMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
21471    parseBackboneElementProperties(json, res);
21472    if (json.has("function"))
21473      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
21474    if (json.has("actor"))
21475      res.setActor(parseCodeableReference(getJObject(json, "actor")));
21476  }
21477
21478  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationDosageComponent(JsonObject json) throws IOException, FHIRFormatError {
21479    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
21480    parseMedicationAdministrationDosageComponentProperties(json, res);
21481    return res;
21482  }
21483
21484  protected void parseMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
21485    parseBackboneElementProperties(json, res);
21486    if (json.has("text"))
21487      res.setTextElement(parseString(json.get("text").getAsString()));
21488    if (json.has("_text"))
21489      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
21490    if (json.has("site"))
21491      res.setSite(parseCodeableConcept(getJObject(json, "site")));
21492    if (json.has("route"))
21493      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
21494    if (json.has("method"))
21495      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
21496    if (json.has("dose"))
21497      res.setDose(parseQuantity(getJObject(json, "dose")));
21498    DataType rate = parseType("rate", json);
21499    if (rate != null)
21500      res.setRate(rate);
21501  }
21502
21503  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
21504    MedicationDispense res = new MedicationDispense();
21505    parseMedicationDispenseProperties(json, res);
21506    return res;
21507  }
21508
21509  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
21510    parseDomainResourceProperties(json, res);
21511    if (json.has("identifier")) {
21512      JsonArray array = getJArray(json, "identifier");
21513      for (int i = 0; i < array.size(); i++) {
21514        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21515      }
21516    };
21517    if (json.has("basedOn")) {
21518      JsonArray array = getJArray(json, "basedOn");
21519      for (int i = 0; i < array.size(); i++) {
21520        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21521      }
21522    };
21523    if (json.has("partOf")) {
21524      JsonArray array = getJArray(json, "partOf");
21525      for (int i = 0; i < array.size(); i++) {
21526        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21527      }
21528    };
21529    if (json.has("status"))
21530      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatusCodes.NULL, new MedicationDispense.MedicationDispenseStatusCodesEnumFactory()));
21531    if (json.has("_status"))
21532      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21533    if (json.has("notPerformedReason"))
21534      res.setNotPerformedReason(parseCodeableReference(getJObject(json, "notPerformedReason")));
21535    if (json.has("statusChanged"))
21536      res.setStatusChangedElement(parseDateTime(json.get("statusChanged").getAsString()));
21537    if (json.has("_statusChanged"))
21538      parseElementProperties(getJObject(json, "_statusChanged"), res.getStatusChangedElement());
21539    if (json.has("category")) {
21540      JsonArray array = getJArray(json, "category");
21541      for (int i = 0; i < array.size(); i++) {
21542        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21543      }
21544    };
21545    if (json.has("medication"))
21546      res.setMedication(parseCodeableReference(getJObject(json, "medication")));
21547    if (json.has("subject"))
21548      res.setSubject(parseReference(getJObject(json, "subject")));
21549    if (json.has("encounter"))
21550      res.setEncounter(parseReference(getJObject(json, "encounter")));
21551    if (json.has("supportingInformation")) {
21552      JsonArray array = getJArray(json, "supportingInformation");
21553      for (int i = 0; i < array.size(); i++) {
21554        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
21555      }
21556    };
21557    if (json.has("performer")) {
21558      JsonArray array = getJArray(json, "performer");
21559      for (int i = 0; i < array.size(); i++) {
21560        res.getPerformer().add(parseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject()));
21561      }
21562    };
21563    if (json.has("location"))
21564      res.setLocation(parseReference(getJObject(json, "location")));
21565    if (json.has("authorizingPrescription")) {
21566      JsonArray array = getJArray(json, "authorizingPrescription");
21567      for (int i = 0; i < array.size(); i++) {
21568        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
21569      }
21570    };
21571    if (json.has("type"))
21572      res.setType(parseCodeableConcept(getJObject(json, "type")));
21573    if (json.has("quantity"))
21574      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
21575    if (json.has("daysSupply"))
21576      res.setDaysSupply(parseQuantity(getJObject(json, "daysSupply")));
21577    if (json.has("recorded"))
21578      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
21579    if (json.has("_recorded"))
21580      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
21581    if (json.has("whenPrepared"))
21582      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
21583    if (json.has("_whenPrepared"))
21584      parseElementProperties(getJObject(json, "_whenPrepared"), res.getWhenPreparedElement());
21585    if (json.has("whenHandedOver"))
21586      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
21587    if (json.has("_whenHandedOver"))
21588      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
21589    if (json.has("destination"))
21590      res.setDestination(parseReference(getJObject(json, "destination")));
21591    if (json.has("receiver")) {
21592      JsonArray array = getJArray(json, "receiver");
21593      for (int i = 0; i < array.size(); i++) {
21594        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
21595      }
21596    };
21597    if (json.has("note")) {
21598      JsonArray array = getJArray(json, "note");
21599      for (int i = 0; i < array.size(); i++) {
21600        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21601      }
21602    };
21603    if (json.has("renderedDosageInstruction"))
21604      res.setRenderedDosageInstructionElement(parseMarkdown(json.get("renderedDosageInstruction").getAsString()));
21605    if (json.has("_renderedDosageInstruction"))
21606      parseElementProperties(getJObject(json, "_renderedDosageInstruction"), res.getRenderedDosageInstructionElement());
21607    if (json.has("dosageInstruction")) {
21608      JsonArray array = getJArray(json, "dosageInstruction");
21609      for (int i = 0; i < array.size(); i++) {
21610        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
21611      }
21612    };
21613    if (json.has("substitution"))
21614      res.setSubstitution(parseMedicationDispenseSubstitutionComponent(getJObject(json, "substitution")));
21615    if (json.has("eventHistory")) {
21616      JsonArray array = getJArray(json, "eventHistory");
21617      for (int i = 0; i < array.size(); i++) {
21618        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
21619      }
21620    };
21621  }
21622
21623  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispensePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
21624    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
21625    parseMedicationDispensePerformerComponentProperties(json, res);
21626    return res;
21627  }
21628
21629  protected void parseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
21630    parseBackboneElementProperties(json, res);
21631    if (json.has("function"))
21632      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
21633    if (json.has("actor"))
21634      res.setActor(parseReference(getJObject(json, "actor")));
21635  }
21636
21637  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseSubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
21638    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
21639    parseMedicationDispenseSubstitutionComponentProperties(json, res);
21640    return res;
21641  }
21642
21643  protected void parseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
21644    parseBackboneElementProperties(json, res);
21645    if (json.has("wasSubstituted"))
21646      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
21647    if (json.has("_wasSubstituted"))
21648      parseElementProperties(getJObject(json, "_wasSubstituted"), res.getWasSubstitutedElement());
21649    if (json.has("type"))
21650      res.setType(parseCodeableConcept(getJObject(json, "type")));
21651    if (json.has("reason")) {
21652      JsonArray array = getJArray(json, "reason");
21653      for (int i = 0; i < array.size(); i++) {
21654        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21655      }
21656    };
21657    if (json.has("responsibleParty"))
21658      res.setResponsibleParty(parseReference(getJObject(json, "responsibleParty")));
21659  }
21660
21661  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
21662    MedicationKnowledge res = new MedicationKnowledge();
21663    parseMedicationKnowledgeProperties(json, res);
21664    return res;
21665  }
21666
21667  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
21668    parseDomainResourceProperties(json, res);
21669    if (json.has("identifier")) {
21670      JsonArray array = getJArray(json, "identifier");
21671      for (int i = 0; i < array.size(); i++) {
21672        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21673      }
21674    };
21675    if (json.has("code"))
21676      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21677    if (json.has("status"))
21678      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatusCodes.NULL, new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory()));
21679    if (json.has("_status"))
21680      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21681    if (json.has("author"))
21682      res.setAuthor(parseReference(getJObject(json, "author")));
21683    if (json.has("intendedJurisdiction")) {
21684      JsonArray array = getJArray(json, "intendedJurisdiction");
21685      for (int i = 0; i < array.size(); i++) {
21686        res.getIntendedJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21687      }
21688    };
21689    if (json.has("name")) {
21690      JsonArray array = getJArray(json, "name");
21691      for (int i = 0; i < array.size(); i++) {
21692        if (array.get(i).isJsonNull()) {
21693          res.getName().add(new StringType());
21694        } else {;
21695          res.getName().add(parseString(array.get(i).getAsString()));
21696        }
21697      }
21698    };
21699    if (json.has("_name")) {
21700      JsonArray array = getJArray(json, "_name");
21701      for (int i = 0; i < array.size(); i++) {
21702        if (i == res.getName().size())
21703          res.getName().add(parseString(null));
21704        if (array.get(i) instanceof JsonObject) 
21705          parseElementProperties(array.get(i).getAsJsonObject(), res.getName().get(i));
21706      }
21707    };
21708    if (json.has("relatedMedicationKnowledge")) {
21709      JsonArray array = getJArray(json, "relatedMedicationKnowledge");
21710      for (int i = 0; i < array.size(); i++) {
21711        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject()));
21712      }
21713    };
21714    if (json.has("associatedMedication")) {
21715      JsonArray array = getJArray(json, "associatedMedication");
21716      for (int i = 0; i < array.size(); i++) {
21717        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
21718      }
21719    };
21720    if (json.has("productType")) {
21721      JsonArray array = getJArray(json, "productType");
21722      for (int i = 0; i < array.size(); i++) {
21723        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21724      }
21725    };
21726    if (json.has("monograph")) {
21727      JsonArray array = getJArray(json, "monograph");
21728      for (int i = 0; i < array.size(); i++) {
21729        res.getMonograph().add(parseMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject()));
21730      }
21731    };
21732    if (json.has("preparationInstruction"))
21733      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
21734    if (json.has("_preparationInstruction"))
21735      parseElementProperties(getJObject(json, "_preparationInstruction"), res.getPreparationInstructionElement());
21736    if (json.has("cost")) {
21737      JsonArray array = getJArray(json, "cost");
21738      for (int i = 0; i < array.size(); i++) {
21739        res.getCost().add(parseMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject()));
21740      }
21741    };
21742    if (json.has("monitoringProgram")) {
21743      JsonArray array = getJArray(json, "monitoringProgram");
21744      for (int i = 0; i < array.size(); i++) {
21745        res.getMonitoringProgram().add(parseMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject()));
21746      }
21747    };
21748    if (json.has("indicationGuideline")) {
21749      JsonArray array = getJArray(json, "indicationGuideline");
21750      for (int i = 0; i < array.size(); i++) {
21751        res.getIndicationGuideline().add(parseMedicationKnowledgeIndicationGuidelineComponent(array.get(i).getAsJsonObject()));
21752      }
21753    };
21754    if (json.has("medicineClassification")) {
21755      JsonArray array = getJArray(json, "medicineClassification");
21756      for (int i = 0; i < array.size(); i++) {
21757        res.getMedicineClassification().add(parseMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject()));
21758      }
21759    };
21760    if (json.has("packaging")) {
21761      JsonArray array = getJArray(json, "packaging");
21762      for (int i = 0; i < array.size(); i++) {
21763        res.getPackaging().add(parseMedicationKnowledgePackagingComponent(array.get(i).getAsJsonObject()));
21764      }
21765    };
21766    if (json.has("clinicalUseIssue")) {
21767      JsonArray array = getJArray(json, "clinicalUseIssue");
21768      for (int i = 0; i < array.size(); i++) {
21769        res.getClinicalUseIssue().add(parseReference(array.get(i).getAsJsonObject()));
21770      }
21771    };
21772    if (json.has("storageGuideline")) {
21773      JsonArray array = getJArray(json, "storageGuideline");
21774      for (int i = 0; i < array.size(); i++) {
21775        res.getStorageGuideline().add(parseMedicationKnowledgeStorageGuidelineComponent(array.get(i).getAsJsonObject()));
21776      }
21777    };
21778    if (json.has("regulatory")) {
21779      JsonArray array = getJArray(json, "regulatory");
21780      for (int i = 0; i < array.size(); i++) {
21781        res.getRegulatory().add(parseMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject()));
21782      }
21783    };
21784    if (json.has("definitional"))
21785      res.setDefinitional(parseMedicationKnowledgeDefinitionalComponent(getJObject(json, "definitional")));
21786  }
21787
21788  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json) throws IOException, FHIRFormatError {
21789    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
21790    parseMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, res);
21791    return res;
21792  }
21793
21794  protected void parseMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
21795    parseBackboneElementProperties(json, res);
21796    if (json.has("type"))
21797      res.setType(parseCodeableConcept(getJObject(json, "type")));
21798    if (json.has("reference")) {
21799      JsonArray array = getJArray(json, "reference");
21800      for (int i = 0; i < array.size(); i++) {
21801        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
21802      }
21803    };
21804  }
21805
21806  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMonographComponent(JsonObject json) throws IOException, FHIRFormatError {
21807    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
21808    parseMedicationKnowledgeMonographComponentProperties(json, res);
21809    return res;
21810  }
21811
21812  protected void parseMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
21813    parseBackboneElementProperties(json, res);
21814    if (json.has("type"))
21815      res.setType(parseCodeableConcept(getJObject(json, "type")));
21816    if (json.has("source"))
21817      res.setSource(parseReference(getJObject(json, "source")));
21818  }
21819
21820  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeCostComponent(JsonObject json) throws IOException, FHIRFormatError {
21821    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
21822    parseMedicationKnowledgeCostComponentProperties(json, res);
21823    return res;
21824  }
21825
21826  protected void parseMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
21827    parseBackboneElementProperties(json, res);
21828    if (json.has("effectiveDate")) {
21829      JsonArray array = getJArray(json, "effectiveDate");
21830      for (int i = 0; i < array.size(); i++) {
21831        res.getEffectiveDate().add(parsePeriod(array.get(i).getAsJsonObject()));
21832      }
21833    };
21834    if (json.has("type"))
21835      res.setType(parseCodeableConcept(getJObject(json, "type")));
21836    if (json.has("source"))
21837      res.setSourceElement(parseString(json.get("source").getAsString()));
21838    if (json.has("_source"))
21839      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
21840    DataType cost = parseType("cost", json);
21841    if (cost != null)
21842      res.setCost(cost);
21843  }
21844
21845  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMonitoringProgramComponent(JsonObject json) throws IOException, FHIRFormatError {
21846    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
21847    parseMedicationKnowledgeMonitoringProgramComponentProperties(json, res);
21848    return res;
21849  }
21850
21851  protected void parseMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
21852    parseBackboneElementProperties(json, res);
21853    if (json.has("type"))
21854      res.setType(parseCodeableConcept(getJObject(json, "type")));
21855    if (json.has("name"))
21856      res.setNameElement(parseString(json.get("name").getAsString()));
21857    if (json.has("_name"))
21858      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21859  }
21860
21861  protected MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent parseMedicationKnowledgeIndicationGuidelineComponent(JsonObject json) throws IOException, FHIRFormatError {
21862    MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent res = new MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent();
21863    parseMedicationKnowledgeIndicationGuidelineComponentProperties(json, res);
21864    return res;
21865  }
21866
21867  protected void parseMedicationKnowledgeIndicationGuidelineComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent res) throws IOException, FHIRFormatError {
21868    parseBackboneElementProperties(json, res);
21869    if (json.has("indication")) {
21870      JsonArray array = getJArray(json, "indication");
21871      for (int i = 0; i < array.size(); i++) {
21872        res.getIndication().add(parseCodeableReference(array.get(i).getAsJsonObject()));
21873      }
21874    };
21875    if (json.has("dosingGuideline")) {
21876      JsonArray array = getJArray(json, "dosingGuideline");
21877      for (int i = 0; i < array.size(); i++) {
21878        res.getDosingGuideline().add(parseMedicationKnowledgeIndicationGuidelineDosingGuidelineComponent(array.get(i).getAsJsonObject()));
21879      }
21880    };
21881  }
21882
21883  protected MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent parseMedicationKnowledgeIndicationGuidelineDosingGuidelineComponent(JsonObject json) throws IOException, FHIRFormatError {
21884    MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent res = new MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent();
21885    parseMedicationKnowledgeIndicationGuidelineDosingGuidelineComponentProperties(json, res);
21886    return res;
21887  }
21888
21889  protected void parseMedicationKnowledgeIndicationGuidelineDosingGuidelineComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent res) throws IOException, FHIRFormatError {
21890    parseBackboneElementProperties(json, res);
21891    if (json.has("treatmentIntent"))
21892      res.setTreatmentIntent(parseCodeableConcept(getJObject(json, "treatmentIntent")));
21893    if (json.has("dosage")) {
21894      JsonArray array = getJArray(json, "dosage");
21895      for (int i = 0; i < array.size(); i++) {
21896        res.getDosage().add(parseMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent(array.get(i).getAsJsonObject()));
21897      }
21898    };
21899    if (json.has("administrationTreatment"))
21900      res.setAdministrationTreatment(parseCodeableConcept(getJObject(json, "administrationTreatment")));
21901    if (json.has("patientCharacteristic")) {
21902      JsonArray array = getJArray(json, "patientCharacteristic");
21903      for (int i = 0; i < array.size(); i++) {
21904        res.getPatientCharacteristic().add(parseMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent(array.get(i).getAsJsonObject()));
21905      }
21906    };
21907  }
21908
21909  protected MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent parseMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent(JsonObject json) throws IOException, FHIRFormatError {
21910    MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent res = new MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent();
21911    parseMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponentProperties(json, res);
21912    return res;
21913  }
21914
21915  protected void parseMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent res) throws IOException, FHIRFormatError {
21916    parseBackboneElementProperties(json, res);
21917    if (json.has("type"))
21918      res.setType(parseCodeableConcept(getJObject(json, "type")));
21919    if (json.has("dosage")) {
21920      JsonArray array = getJArray(json, "dosage");
21921      for (int i = 0; i < array.size(); i++) {
21922        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
21923      }
21924    };
21925  }
21926
21927  protected MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent parseMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
21928    MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent();
21929    parseMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponentProperties(json, res);
21930    return res;
21931  }
21932
21933  protected void parseMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent res) throws IOException, FHIRFormatError {
21934    parseBackboneElementProperties(json, res);
21935    if (json.has("type"))
21936      res.setType(parseCodeableConcept(getJObject(json, "type")));
21937    DataType value = parseType("value", json);
21938    if (value != null)
21939      res.setValue(value);
21940  }
21941
21942  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicineClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
21943    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
21944    parseMedicationKnowledgeMedicineClassificationComponentProperties(json, res);
21945    return res;
21946  }
21947
21948  protected void parseMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
21949    parseBackboneElementProperties(json, res);
21950    if (json.has("type"))
21951      res.setType(parseCodeableConcept(getJObject(json, "type")));
21952    DataType source = parseType("source", json);
21953    if (source != null)
21954      res.setSource(source);
21955    if (json.has("classification")) {
21956      JsonArray array = getJArray(json, "classification");
21957      for (int i = 0; i < array.size(); i++) {
21958        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21959      }
21960    };
21961  }
21962
21963  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgePackagingComponent(JsonObject json) throws IOException, FHIRFormatError {
21964    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
21965    parseMedicationKnowledgePackagingComponentProperties(json, res);
21966    return res;
21967  }
21968
21969  protected void parseMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
21970    parseBackboneElementProperties(json, res);
21971    if (json.has("cost")) {
21972      JsonArray array = getJArray(json, "cost");
21973      for (int i = 0; i < array.size(); i++) {
21974        res.getCost().add(parseMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject()));
21975      }
21976    };
21977    if (json.has("packagedProduct"))
21978      res.setPackagedProduct(parseReference(getJObject(json, "packagedProduct")));
21979  }
21980
21981  protected MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent parseMedicationKnowledgeStorageGuidelineComponent(JsonObject json) throws IOException, FHIRFormatError {
21982    MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent res = new MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent();
21983    parseMedicationKnowledgeStorageGuidelineComponentProperties(json, res);
21984    return res;
21985  }
21986
21987  protected void parseMedicationKnowledgeStorageGuidelineComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent res) throws IOException, FHIRFormatError {
21988    parseBackboneElementProperties(json, res);
21989    if (json.has("reference"))
21990      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
21991    if (json.has("_reference"))
21992      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
21993    if (json.has("note")) {
21994      JsonArray array = getJArray(json, "note");
21995      for (int i = 0; i < array.size(); i++) {
21996        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21997      }
21998    };
21999    if (json.has("stabilityDuration"))
22000      res.setStabilityDuration(parseDuration(getJObject(json, "stabilityDuration")));
22001    if (json.has("environmentalSetting")) {
22002      JsonArray array = getJArray(json, "environmentalSetting");
22003      for (int i = 0; i < array.size(); i++) {
22004        res.getEnvironmentalSetting().add(parseMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent(array.get(i).getAsJsonObject()));
22005      }
22006    };
22007  }
22008
22009  protected MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent parseMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent(JsonObject json) throws IOException, FHIRFormatError {
22010    MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent res = new MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent();
22011    parseMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponentProperties(json, res);
22012    return res;
22013  }
22014
22015  protected void parseMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent res) throws IOException, FHIRFormatError {
22016    parseBackboneElementProperties(json, res);
22017    if (json.has("type"))
22018      res.setType(parseCodeableConcept(getJObject(json, "type")));
22019    DataType value = parseType("value", json);
22020    if (value != null)
22021      res.setValue(value);
22022  }
22023
22024  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeRegulatoryComponent(JsonObject json) throws IOException, FHIRFormatError {
22025    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
22026    parseMedicationKnowledgeRegulatoryComponentProperties(json, res);
22027    return res;
22028  }
22029
22030  protected void parseMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
22031    parseBackboneElementProperties(json, res);
22032    if (json.has("regulatoryAuthority"))
22033      res.setRegulatoryAuthority(parseReference(getJObject(json, "regulatoryAuthority")));
22034    if (json.has("substitution")) {
22035      JsonArray array = getJArray(json, "substitution");
22036      for (int i = 0; i < array.size(); i++) {
22037        res.getSubstitution().add(parseMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject()));
22038      }
22039    };
22040    if (json.has("schedule")) {
22041      JsonArray array = getJArray(json, "schedule");
22042      for (int i = 0; i < array.size(); i++) {
22043        res.getSchedule().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22044      }
22045    };
22046    if (json.has("maxDispense"))
22047      res.setMaxDispense(parseMedicationKnowledgeRegulatoryMaxDispenseComponent(getJObject(json, "maxDispense")));
22048  }
22049
22050  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
22051    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
22052    parseMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, res);
22053    return res;
22054  }
22055
22056  protected void parseMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
22057    parseBackboneElementProperties(json, res);
22058    if (json.has("type"))
22059      res.setType(parseCodeableConcept(getJObject(json, "type")));
22060    if (json.has("allowed"))
22061      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
22062    if (json.has("_allowed"))
22063      parseElementProperties(getJObject(json, "_allowed"), res.getAllowedElement());
22064  }
22065
22066  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json) throws IOException, FHIRFormatError {
22067    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
22068    parseMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, res);
22069    return res;
22070  }
22071
22072  protected void parseMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
22073    parseBackboneElementProperties(json, res);
22074    if (json.has("quantity"))
22075      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
22076    if (json.has("period"))
22077      res.setPeriod(parseDuration(getJObject(json, "period")));
22078  }
22079
22080  protected MedicationKnowledge.MedicationKnowledgeDefinitionalComponent parseMedicationKnowledgeDefinitionalComponent(JsonObject json) throws IOException, FHIRFormatError {
22081    MedicationKnowledge.MedicationKnowledgeDefinitionalComponent res = new MedicationKnowledge.MedicationKnowledgeDefinitionalComponent();
22082    parseMedicationKnowledgeDefinitionalComponentProperties(json, res);
22083    return res;
22084  }
22085
22086  protected void parseMedicationKnowledgeDefinitionalComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeDefinitionalComponent res) throws IOException, FHIRFormatError {
22087    parseBackboneElementProperties(json, res);
22088    if (json.has("definition")) {
22089      JsonArray array = getJArray(json, "definition");
22090      for (int i = 0; i < array.size(); i++) {
22091        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
22092      }
22093    };
22094    if (json.has("doseForm"))
22095      res.setDoseForm(parseCodeableConcept(getJObject(json, "doseForm")));
22096    if (json.has("intendedRoute")) {
22097      JsonArray array = getJArray(json, "intendedRoute");
22098      for (int i = 0; i < array.size(); i++) {
22099        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22100      }
22101    };
22102    if (json.has("ingredient")) {
22103      JsonArray array = getJArray(json, "ingredient");
22104      for (int i = 0; i < array.size(); i++) {
22105        res.getIngredient().add(parseMedicationKnowledgeDefinitionalIngredientComponent(array.get(i).getAsJsonObject()));
22106      }
22107    };
22108    if (json.has("drugCharacteristic")) {
22109      JsonArray array = getJArray(json, "drugCharacteristic");
22110      for (int i = 0; i < array.size(); i++) {
22111        res.getDrugCharacteristic().add(parseMedicationKnowledgeDefinitionalDrugCharacteristicComponent(array.get(i).getAsJsonObject()));
22112      }
22113    };
22114  }
22115
22116  protected MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent parseMedicationKnowledgeDefinitionalIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
22117    MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent();
22118    parseMedicationKnowledgeDefinitionalIngredientComponentProperties(json, res);
22119    return res;
22120  }
22121
22122  protected void parseMedicationKnowledgeDefinitionalIngredientComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent res) throws IOException, FHIRFormatError {
22123    parseBackboneElementProperties(json, res);
22124    if (json.has("item"))
22125      res.setItem(parseCodeableReference(getJObject(json, "item")));
22126    if (json.has("type"))
22127      res.setType(parseCodeableConcept(getJObject(json, "type")));
22128    DataType strength = parseType("strength", json);
22129    if (strength != null)
22130      res.setStrength(strength);
22131  }
22132
22133  protected MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent parseMedicationKnowledgeDefinitionalDrugCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
22134    MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent();
22135    parseMedicationKnowledgeDefinitionalDrugCharacteristicComponentProperties(json, res);
22136    return res;
22137  }
22138
22139  protected void parseMedicationKnowledgeDefinitionalDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
22140    parseBackboneElementProperties(json, res);
22141    if (json.has("type"))
22142      res.setType(parseCodeableConcept(getJObject(json, "type")));
22143    DataType value = parseType("value", json);
22144    if (value != null)
22145      res.setValue(value);
22146  }
22147
22148  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
22149    MedicationRequest res = new MedicationRequest();
22150    parseMedicationRequestProperties(json, res);
22151    return res;
22152  }
22153
22154  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
22155    parseDomainResourceProperties(json, res);
22156    if (json.has("identifier")) {
22157      JsonArray array = getJArray(json, "identifier");
22158      for (int i = 0; i < array.size(); i++) {
22159        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22160      }
22161    };
22162    if (json.has("basedOn")) {
22163      JsonArray array = getJArray(json, "basedOn");
22164      for (int i = 0; i < array.size(); i++) {
22165        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22166      }
22167    };
22168    if (json.has("priorPrescription"))
22169      res.setPriorPrescription(parseReference(getJObject(json, "priorPrescription")));
22170    if (json.has("groupIdentifier"))
22171      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
22172    if (json.has("status"))
22173      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationrequestStatus.NULL, new MedicationRequest.MedicationrequestStatusEnumFactory()));
22174    if (json.has("_status"))
22175      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22176    if (json.has("statusReason"))
22177      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
22178    if (json.has("statusChanged"))
22179      res.setStatusChangedElement(parseDateTime(json.get("statusChanged").getAsString()));
22180    if (json.has("_statusChanged"))
22181      parseElementProperties(getJObject(json, "_statusChanged"), res.getStatusChangedElement());
22182    if (json.has("intent"))
22183      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
22184    if (json.has("_intent"))
22185      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
22186    if (json.has("category")) {
22187      JsonArray array = getJArray(json, "category");
22188      for (int i = 0; i < array.size(); i++) {
22189        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22190      }
22191    };
22192    if (json.has("priority"))
22193      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
22194    if (json.has("_priority"))
22195      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
22196    if (json.has("doNotPerform"))
22197      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
22198    if (json.has("_doNotPerform"))
22199      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
22200    if (json.has("medication"))
22201      res.setMedication(parseCodeableReference(getJObject(json, "medication")));
22202    if (json.has("subject"))
22203      res.setSubject(parseReference(getJObject(json, "subject")));
22204    if (json.has("informationSource")) {
22205      JsonArray array = getJArray(json, "informationSource");
22206      for (int i = 0; i < array.size(); i++) {
22207        res.getInformationSource().add(parseReference(array.get(i).getAsJsonObject()));
22208      }
22209    };
22210    if (json.has("encounter"))
22211      res.setEncounter(parseReference(getJObject(json, "encounter")));
22212    if (json.has("supportingInformation")) {
22213      JsonArray array = getJArray(json, "supportingInformation");
22214      for (int i = 0; i < array.size(); i++) {
22215        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
22216      }
22217    };
22218    if (json.has("authoredOn"))
22219      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
22220    if (json.has("_authoredOn"))
22221      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
22222    if (json.has("requester"))
22223      res.setRequester(parseReference(getJObject(json, "requester")));
22224    if (json.has("reported"))
22225      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
22226    if (json.has("_reported"))
22227      parseElementProperties(getJObject(json, "_reported"), res.getReportedElement());
22228    if (json.has("performerType"))
22229      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
22230    if (json.has("performer")) {
22231      JsonArray array = getJArray(json, "performer");
22232      for (int i = 0; i < array.size(); i++) {
22233        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
22234      }
22235    };
22236    if (json.has("device")) {
22237      JsonArray array = getJArray(json, "device");
22238      for (int i = 0; i < array.size(); i++) {
22239        res.getDevice().add(parseCodeableReference(array.get(i).getAsJsonObject()));
22240      }
22241    };
22242    if (json.has("recorder"))
22243      res.setRecorder(parseReference(getJObject(json, "recorder")));
22244    if (json.has("reason")) {
22245      JsonArray array = getJArray(json, "reason");
22246      for (int i = 0; i < array.size(); i++) {
22247        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
22248      }
22249    };
22250    if (json.has("courseOfTherapyType"))
22251      res.setCourseOfTherapyType(parseCodeableConcept(getJObject(json, "courseOfTherapyType")));
22252    if (json.has("insurance")) {
22253      JsonArray array = getJArray(json, "insurance");
22254      for (int i = 0; i < array.size(); i++) {
22255        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
22256      }
22257    };
22258    if (json.has("note")) {
22259      JsonArray array = getJArray(json, "note");
22260      for (int i = 0; i < array.size(); i++) {
22261        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22262      }
22263    };
22264    if (json.has("renderedDosageInstruction"))
22265      res.setRenderedDosageInstructionElement(parseMarkdown(json.get("renderedDosageInstruction").getAsString()));
22266    if (json.has("_renderedDosageInstruction"))
22267      parseElementProperties(getJObject(json, "_renderedDosageInstruction"), res.getRenderedDosageInstructionElement());
22268    if (json.has("effectiveDosePeriod"))
22269      res.setEffectiveDosePeriod(parsePeriod(getJObject(json, "effectiveDosePeriod")));
22270    if (json.has("dosageInstruction")) {
22271      JsonArray array = getJArray(json, "dosageInstruction");
22272      for (int i = 0; i < array.size(); i++) {
22273        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
22274      }
22275    };
22276    if (json.has("dispenseRequest"))
22277      res.setDispenseRequest(parseMedicationRequestDispenseRequestComponent(getJObject(json, "dispenseRequest")));
22278    if (json.has("substitution"))
22279      res.setSubstitution(parseMedicationRequestSubstitutionComponent(getJObject(json, "substitution")));
22280    if (json.has("eventHistory")) {
22281      JsonArray array = getJArray(json, "eventHistory");
22282      for (int i = 0; i < array.size(); i++) {
22283        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
22284      }
22285    };
22286  }
22287
22288  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestDispenseRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
22289    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
22290    parseMedicationRequestDispenseRequestComponentProperties(json, res);
22291    return res;
22292  }
22293
22294  protected void parseMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
22295    parseBackboneElementProperties(json, res);
22296    if (json.has("initialFill"))
22297      res.setInitialFill(parseMedicationRequestDispenseRequestInitialFillComponent(getJObject(json, "initialFill")));
22298    if (json.has("dispenseInterval"))
22299      res.setDispenseInterval(parseDuration(getJObject(json, "dispenseInterval")));
22300    if (json.has("validityPeriod"))
22301      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
22302    if (json.has("numberOfRepeatsAllowed"))
22303      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
22304    if (json.has("_numberOfRepeatsAllowed"))
22305      parseElementProperties(getJObject(json, "_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
22306    if (json.has("quantity"))
22307      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
22308    if (json.has("expectedSupplyDuration"))
22309      res.setExpectedSupplyDuration(parseDuration(getJObject(json, "expectedSupplyDuration")));
22310    if (json.has("dispenser"))
22311      res.setDispenser(parseReference(getJObject(json, "dispenser")));
22312    if (json.has("dispenserInstruction")) {
22313      JsonArray array = getJArray(json, "dispenserInstruction");
22314      for (int i = 0; i < array.size(); i++) {
22315        res.getDispenserInstruction().add(parseAnnotation(array.get(i).getAsJsonObject()));
22316      }
22317    };
22318    if (json.has("doseAdministrationAid"))
22319      res.setDoseAdministrationAid(parseCodeableConcept(getJObject(json, "doseAdministrationAid")));
22320  }
22321
22322  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestDispenseRequestInitialFillComponent(JsonObject json) throws IOException, FHIRFormatError {
22323    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
22324    parseMedicationRequestDispenseRequestInitialFillComponentProperties(json, res);
22325    return res;
22326  }
22327
22328  protected void parseMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
22329    parseBackboneElementProperties(json, res);
22330    if (json.has("quantity"))
22331      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
22332    if (json.has("duration"))
22333      res.setDuration(parseDuration(getJObject(json, "duration")));
22334  }
22335
22336  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestSubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
22337    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
22338    parseMedicationRequestSubstitutionComponentProperties(json, res);
22339    return res;
22340  }
22341
22342  protected void parseMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
22343    parseBackboneElementProperties(json, res);
22344    DataType allowed = parseType("allowed", json);
22345    if (allowed != null)
22346      res.setAllowed(allowed);
22347    if (json.has("reason"))
22348      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
22349  }
22350
22351  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
22352    MedicationStatement res = new MedicationStatement();
22353    parseMedicationStatementProperties(json, res);
22354    return res;
22355  }
22356
22357  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
22358    parseDomainResourceProperties(json, res);
22359    if (json.has("identifier")) {
22360      JsonArray array = getJArray(json, "identifier");
22361      for (int i = 0; i < array.size(); i++) {
22362        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22363      }
22364    };
22365    if (json.has("partOf")) {
22366      JsonArray array = getJArray(json, "partOf");
22367      for (int i = 0; i < array.size(); i++) {
22368        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22369      }
22370    };
22371    if (json.has("status"))
22372      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatusCodes.NULL, new MedicationStatement.MedicationStatementStatusCodesEnumFactory()));
22373    if (json.has("_status"))
22374      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22375    if (json.has("category")) {
22376      JsonArray array = getJArray(json, "category");
22377      for (int i = 0; i < array.size(); i++) {
22378        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22379      }
22380    };
22381    if (json.has("medication"))
22382      res.setMedication(parseCodeableReference(getJObject(json, "medication")));
22383    if (json.has("subject"))
22384      res.setSubject(parseReference(getJObject(json, "subject")));
22385    if (json.has("encounter"))
22386      res.setEncounter(parseReference(getJObject(json, "encounter")));
22387    DataType effective = parseType("effective", json);
22388    if (effective != null)
22389      res.setEffective(effective);
22390    if (json.has("dateAsserted"))
22391      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
22392    if (json.has("_dateAsserted"))
22393      parseElementProperties(getJObject(json, "_dateAsserted"), res.getDateAssertedElement());
22394    if (json.has("informationSource")) {
22395      JsonArray array = getJArray(json, "informationSource");
22396      for (int i = 0; i < array.size(); i++) {
22397        res.getInformationSource().add(parseReference(array.get(i).getAsJsonObject()));
22398      }
22399    };
22400    if (json.has("derivedFrom")) {
22401      JsonArray array = getJArray(json, "derivedFrom");
22402      for (int i = 0; i < array.size(); i++) {
22403        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
22404      }
22405    };
22406    if (json.has("reason")) {
22407      JsonArray array = getJArray(json, "reason");
22408      for (int i = 0; i < array.size(); i++) {
22409        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
22410      }
22411    };
22412    if (json.has("note")) {
22413      JsonArray array = getJArray(json, "note");
22414      for (int i = 0; i < array.size(); i++) {
22415        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22416      }
22417    };
22418    if (json.has("relatedClinicalInformation")) {
22419      JsonArray array = getJArray(json, "relatedClinicalInformation");
22420      for (int i = 0; i < array.size(); i++) {
22421        res.getRelatedClinicalInformation().add(parseReference(array.get(i).getAsJsonObject()));
22422      }
22423    };
22424    if (json.has("renderedDosageInstruction"))
22425      res.setRenderedDosageInstructionElement(parseMarkdown(json.get("renderedDosageInstruction").getAsString()));
22426    if (json.has("_renderedDosageInstruction"))
22427      parseElementProperties(getJObject(json, "_renderedDosageInstruction"), res.getRenderedDosageInstructionElement());
22428    if (json.has("dosage")) {
22429      JsonArray array = getJArray(json, "dosage");
22430      for (int i = 0; i < array.size(); i++) {
22431        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
22432      }
22433    };
22434    if (json.has("adherence"))
22435      res.setAdherence(parseMedicationStatementAdherenceComponent(getJObject(json, "adherence")));
22436  }
22437
22438  protected MedicationStatement.MedicationStatementAdherenceComponent parseMedicationStatementAdherenceComponent(JsonObject json) throws IOException, FHIRFormatError {
22439    MedicationStatement.MedicationStatementAdherenceComponent res = new MedicationStatement.MedicationStatementAdherenceComponent();
22440    parseMedicationStatementAdherenceComponentProperties(json, res);
22441    return res;
22442  }
22443
22444  protected void parseMedicationStatementAdherenceComponentProperties(JsonObject json, MedicationStatement.MedicationStatementAdherenceComponent res) throws IOException, FHIRFormatError {
22445    parseBackboneElementProperties(json, res);
22446    if (json.has("code"))
22447      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22448    if (json.has("reason"))
22449      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
22450  }
22451
22452  protected MedicinalProductDefinition parseMedicinalProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
22453    MedicinalProductDefinition res = new MedicinalProductDefinition();
22454    parseMedicinalProductDefinitionProperties(json, res);
22455    return res;
22456  }
22457
22458  protected void parseMedicinalProductDefinitionProperties(JsonObject json, MedicinalProductDefinition res) throws IOException, FHIRFormatError {
22459    parseDomainResourceProperties(json, res);
22460    if (json.has("identifier")) {
22461      JsonArray array = getJArray(json, "identifier");
22462      for (int i = 0; i < array.size(); i++) {
22463        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22464      }
22465    };
22466    if (json.has("type"))
22467      res.setType(parseCodeableConcept(getJObject(json, "type")));
22468    if (json.has("domain"))
22469      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
22470    if (json.has("version"))
22471      res.setVersionElement(parseString(json.get("version").getAsString()));
22472    if (json.has("_version"))
22473      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22474    if (json.has("status"))
22475      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
22476    if (json.has("statusDate"))
22477      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
22478    if (json.has("_statusDate"))
22479      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
22480    if (json.has("description"))
22481      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22482    if (json.has("_description"))
22483      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22484    if (json.has("combinedPharmaceuticalDoseForm"))
22485      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(getJObject(json, "combinedPharmaceuticalDoseForm")));
22486    if (json.has("route")) {
22487      JsonArray array = getJArray(json, "route");
22488      for (int i = 0; i < array.size(); i++) {
22489        res.getRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22490      }
22491    };
22492    if (json.has("indication"))
22493      res.setIndicationElement(parseMarkdown(json.get("indication").getAsString()));
22494    if (json.has("_indication"))
22495      parseElementProperties(getJObject(json, "_indication"), res.getIndicationElement());
22496    if (json.has("legalStatusOfSupply"))
22497      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
22498    if (json.has("additionalMonitoringIndicator"))
22499      res.setAdditionalMonitoringIndicator(parseCodeableConcept(getJObject(json, "additionalMonitoringIndicator")));
22500    if (json.has("specialMeasures")) {
22501      JsonArray array = getJArray(json, "specialMeasures");
22502      for (int i = 0; i < array.size(); i++) {
22503        res.getSpecialMeasures().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22504      }
22505    };
22506    if (json.has("pediatricUseIndicator"))
22507      res.setPediatricUseIndicator(parseCodeableConcept(getJObject(json, "pediatricUseIndicator")));
22508    if (json.has("classification")) {
22509      JsonArray array = getJArray(json, "classification");
22510      for (int i = 0; i < array.size(); i++) {
22511        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22512      }
22513    };
22514    if (json.has("marketingStatus")) {
22515      JsonArray array = getJArray(json, "marketingStatus");
22516      for (int i = 0; i < array.size(); i++) {
22517        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
22518      }
22519    };
22520    if (json.has("packagedMedicinalProduct")) {
22521      JsonArray array = getJArray(json, "packagedMedicinalProduct");
22522      for (int i = 0; i < array.size(); i++) {
22523        res.getPackagedMedicinalProduct().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22524      }
22525    };
22526    if (json.has("comprisedOf")) {
22527      JsonArray array = getJArray(json, "comprisedOf");
22528      for (int i = 0; i < array.size(); i++) {
22529        res.getComprisedOf().add(parseReference(array.get(i).getAsJsonObject()));
22530      }
22531    };
22532    if (json.has("ingredient")) {
22533      JsonArray array = getJArray(json, "ingredient");
22534      for (int i = 0; i < array.size(); i++) {
22535        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22536      }
22537    };
22538    if (json.has("impurity")) {
22539      JsonArray array = getJArray(json, "impurity");
22540      for (int i = 0; i < array.size(); i++) {
22541        res.getImpurity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
22542      }
22543    };
22544    if (json.has("attachedDocument")) {
22545      JsonArray array = getJArray(json, "attachedDocument");
22546      for (int i = 0; i < array.size(); i++) {
22547        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
22548      }
22549    };
22550    if (json.has("masterFile")) {
22551      JsonArray array = getJArray(json, "masterFile");
22552      for (int i = 0; i < array.size(); i++) {
22553        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
22554      }
22555    };
22556    if (json.has("contact")) {
22557      JsonArray array = getJArray(json, "contact");
22558      for (int i = 0; i < array.size(); i++) {
22559        res.getContact().add(parseMedicinalProductDefinitionContactComponent(array.get(i).getAsJsonObject()));
22560      }
22561    };
22562    if (json.has("clinicalTrial")) {
22563      JsonArray array = getJArray(json, "clinicalTrial");
22564      for (int i = 0; i < array.size(); i++) {
22565        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
22566      }
22567    };
22568    if (json.has("code")) {
22569      JsonArray array = getJArray(json, "code");
22570      for (int i = 0; i < array.size(); i++) {
22571        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
22572      }
22573    };
22574    if (json.has("name")) {
22575      JsonArray array = getJArray(json, "name");
22576      for (int i = 0; i < array.size(); i++) {
22577        res.getName().add(parseMedicinalProductDefinitionNameComponent(array.get(i).getAsJsonObject()));
22578      }
22579    };
22580    if (json.has("crossReference")) {
22581      JsonArray array = getJArray(json, "crossReference");
22582      for (int i = 0; i < array.size(); i++) {
22583        res.getCrossReference().add(parseMedicinalProductDefinitionCrossReferenceComponent(array.get(i).getAsJsonObject()));
22584      }
22585    };
22586    if (json.has("operation")) {
22587      JsonArray array = getJArray(json, "operation");
22588      for (int i = 0; i < array.size(); i++) {
22589        res.getOperation().add(parseMedicinalProductDefinitionOperationComponent(array.get(i).getAsJsonObject()));
22590      }
22591    };
22592    if (json.has("characteristic")) {
22593      JsonArray array = getJArray(json, "characteristic");
22594      for (int i = 0; i < array.size(); i++) {
22595        res.getCharacteristic().add(parseMedicinalProductDefinitionCharacteristicComponent(array.get(i).getAsJsonObject()));
22596      }
22597    };
22598  }
22599
22600  protected MedicinalProductDefinition.MedicinalProductDefinitionContactComponent parseMedicinalProductDefinitionContactComponent(JsonObject json) throws IOException, FHIRFormatError {
22601    MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionContactComponent();
22602    parseMedicinalProductDefinitionContactComponentProperties(json, res);
22603    return res;
22604  }
22605
22606  protected void parseMedicinalProductDefinitionContactComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res) throws IOException, FHIRFormatError {
22607    parseBackboneElementProperties(json, res);
22608    if (json.has("type"))
22609      res.setType(parseCodeableConcept(getJObject(json, "type")));
22610    if (json.has("contact"))
22611      res.setContact(parseReference(getJObject(json, "contact")));
22612  }
22613
22614  protected MedicinalProductDefinition.MedicinalProductDefinitionNameComponent parseMedicinalProductDefinitionNameComponent(JsonObject json) throws IOException, FHIRFormatError {
22615    MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameComponent();
22616    parseMedicinalProductDefinitionNameComponentProperties(json, res);
22617    return res;
22618  }
22619
22620  protected void parseMedicinalProductDefinitionNameComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res) throws IOException, FHIRFormatError {
22621    parseBackboneElementProperties(json, res);
22622    if (json.has("productName"))
22623      res.setProductNameElement(parseString(json.get("productName").getAsString()));
22624    if (json.has("_productName"))
22625      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
22626    if (json.has("type"))
22627      res.setType(parseCodeableConcept(getJObject(json, "type")));
22628    if (json.has("part")) {
22629      JsonArray array = getJArray(json, "part");
22630      for (int i = 0; i < array.size(); i++) {
22631        res.getPart().add(parseMedicinalProductDefinitionNamePartComponent(array.get(i).getAsJsonObject()));
22632      }
22633    };
22634    if (json.has("usage")) {
22635      JsonArray array = getJArray(json, "usage");
22636      for (int i = 0; i < array.size(); i++) {
22637        res.getUsage().add(parseMedicinalProductDefinitionNameUsageComponent(array.get(i).getAsJsonObject()));
22638      }
22639    };
22640  }
22641
22642  protected MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent parseMedicinalProductDefinitionNamePartComponent(JsonObject json) throws IOException, FHIRFormatError {
22643    MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent();
22644    parseMedicinalProductDefinitionNamePartComponentProperties(json, res);
22645    return res;
22646  }
22647
22648  protected void parseMedicinalProductDefinitionNamePartComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent res) throws IOException, FHIRFormatError {
22649    parseBackboneElementProperties(json, res);
22650    if (json.has("part"))
22651      res.setPartElement(parseString(json.get("part").getAsString()));
22652    if (json.has("_part"))
22653      parseElementProperties(getJObject(json, "_part"), res.getPartElement());
22654    if (json.has("type"))
22655      res.setType(parseCodeableConcept(getJObject(json, "type")));
22656  }
22657
22658  protected MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent parseMedicinalProductDefinitionNameUsageComponent(JsonObject json) throws IOException, FHIRFormatError {
22659    MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent();
22660    parseMedicinalProductDefinitionNameUsageComponentProperties(json, res);
22661    return res;
22662  }
22663
22664  protected void parseMedicinalProductDefinitionNameUsageComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent res) throws IOException, FHIRFormatError {
22665    parseBackboneElementProperties(json, res);
22666    if (json.has("country"))
22667      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
22668    if (json.has("jurisdiction"))
22669      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
22670    if (json.has("language"))
22671      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
22672  }
22673
22674  protected MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent parseMedicinalProductDefinitionCrossReferenceComponent(JsonObject json) throws IOException, FHIRFormatError {
22675    MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent();
22676    parseMedicinalProductDefinitionCrossReferenceComponentProperties(json, res);
22677    return res;
22678  }
22679
22680  protected void parseMedicinalProductDefinitionCrossReferenceComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res) throws IOException, FHIRFormatError {
22681    parseBackboneElementProperties(json, res);
22682    if (json.has("product"))
22683      res.setProduct(parseCodeableReference(getJObject(json, "product")));
22684    if (json.has("type"))
22685      res.setType(parseCodeableConcept(getJObject(json, "type")));
22686  }
22687
22688  protected MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent parseMedicinalProductDefinitionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
22689    MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent();
22690    parseMedicinalProductDefinitionOperationComponentProperties(json, res);
22691    return res;
22692  }
22693
22694  protected void parseMedicinalProductDefinitionOperationComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent res) throws IOException, FHIRFormatError {
22695    parseBackboneElementProperties(json, res);
22696    if (json.has("type"))
22697      res.setType(parseCodeableReference(getJObject(json, "type")));
22698    if (json.has("effectiveDate"))
22699      res.setEffectiveDate(parsePeriod(getJObject(json, "effectiveDate")));
22700    if (json.has("organization")) {
22701      JsonArray array = getJArray(json, "organization");
22702      for (int i = 0; i < array.size(); i++) {
22703        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
22704      }
22705    };
22706    if (json.has("confidentialityIndicator"))
22707      res.setConfidentialityIndicator(parseCodeableConcept(getJObject(json, "confidentialityIndicator")));
22708  }
22709
22710  protected MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent parseMedicinalProductDefinitionCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
22711    MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent();
22712    parseMedicinalProductDefinitionCharacteristicComponentProperties(json, res);
22713    return res;
22714  }
22715
22716  protected void parseMedicinalProductDefinitionCharacteristicComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
22717    parseBackboneElementProperties(json, res);
22718    if (json.has("type"))
22719      res.setType(parseCodeableConcept(getJObject(json, "type")));
22720    DataType value = parseType("value", json);
22721    if (value != null)
22722      res.setValue(value);
22723  }
22724
22725  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
22726    MessageDefinition res = new MessageDefinition();
22727    parseMessageDefinitionProperties(json, res);
22728    return res;
22729  }
22730
22731  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
22732    parseCanonicalResourceProperties(json, res);
22733    if (json.has("url"))
22734      res.setUrlElement(parseUri(json.get("url").getAsString()));
22735    if (json.has("_url"))
22736      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
22737    if (json.has("identifier")) {
22738      JsonArray array = getJArray(json, "identifier");
22739      for (int i = 0; i < array.size(); i++) {
22740        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22741      }
22742    };
22743    if (json.has("version"))
22744      res.setVersionElement(parseString(json.get("version").getAsString()));
22745    if (json.has("_version"))
22746      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22747    DataType versionAlgorithm = parseType("versionAlgorithm", json);
22748    if (versionAlgorithm != null)
22749      res.setVersionAlgorithm(versionAlgorithm);
22750    if (json.has("name"))
22751      res.setNameElement(parseString(json.get("name").getAsString()));
22752    if (json.has("_name"))
22753      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22754    if (json.has("title"))
22755      res.setTitleElement(parseString(json.get("title").getAsString()));
22756    if (json.has("_title"))
22757      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22758    if (json.has("replaces")) {
22759      JsonArray array = getJArray(json, "replaces");
22760      for (int i = 0; i < array.size(); i++) {
22761        if (array.get(i).isJsonNull()) {
22762          res.getReplaces().add(new CanonicalType());
22763        } else {;
22764          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
22765        }
22766      }
22767    };
22768    if (json.has("_replaces")) {
22769      JsonArray array = getJArray(json, "_replaces");
22770      for (int i = 0; i < array.size(); i++) {
22771        if (i == res.getReplaces().size())
22772          res.getReplaces().add(parseCanonical(null));
22773        if (array.get(i) instanceof JsonObject) 
22774          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
22775      }
22776    };
22777    if (json.has("status"))
22778      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22779    if (json.has("_status"))
22780      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22781    if (json.has("experimental"))
22782      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22783    if (json.has("_experimental"))
22784      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
22785    if (json.has("date"))
22786      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22787    if (json.has("_date"))
22788      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
22789    if (json.has("publisher"))
22790      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22791    if (json.has("_publisher"))
22792      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
22793    if (json.has("contact")) {
22794      JsonArray array = getJArray(json, "contact");
22795      for (int i = 0; i < array.size(); i++) {
22796        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22797      }
22798    };
22799    if (json.has("description"))
22800      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22801    if (json.has("_description"))
22802      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22803    if (json.has("useContext")) {
22804      JsonArray array = getJArray(json, "useContext");
22805      for (int i = 0; i < array.size(); i++) {
22806        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22807      }
22808    };
22809    if (json.has("jurisdiction")) {
22810      JsonArray array = getJArray(json, "jurisdiction");
22811      for (int i = 0; i < array.size(); i++) {
22812        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22813      }
22814    };
22815    if (json.has("purpose"))
22816      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22817    if (json.has("_purpose"))
22818      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
22819    if (json.has("copyright"))
22820      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22821    if (json.has("_copyright"))
22822      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
22823    if (json.has("copyrightLabel"))
22824      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
22825    if (json.has("_copyrightLabel"))
22826      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
22827    if (json.has("base"))
22828      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
22829    if (json.has("_base"))
22830      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
22831    if (json.has("parent")) {
22832      JsonArray array = getJArray(json, "parent");
22833      for (int i = 0; i < array.size(); i++) {
22834        if (array.get(i).isJsonNull()) {
22835          res.getParent().add(new CanonicalType());
22836        } else {;
22837          res.getParent().add(parseCanonical(array.get(i).getAsString()));
22838        }
22839      }
22840    };
22841    if (json.has("_parent")) {
22842      JsonArray array = getJArray(json, "_parent");
22843      for (int i = 0; i < array.size(); i++) {
22844        if (i == res.getParent().size())
22845          res.getParent().add(parseCanonical(null));
22846        if (array.get(i) instanceof JsonObject) 
22847          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
22848      }
22849    };
22850    DataType event = parseType("event", json);
22851    if (event != null)
22852      res.setEvent(event);
22853    if (json.has("category"))
22854      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
22855    if (json.has("_category"))
22856      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
22857    if (json.has("focus")) {
22858      JsonArray array = getJArray(json, "focus");
22859      for (int i = 0; i < array.size(); i++) {
22860        res.getFocus().add(parseMessageDefinitionFocusComponent(array.get(i).getAsJsonObject()));
22861      }
22862    };
22863    if (json.has("responseRequired"))
22864      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
22865    if (json.has("_responseRequired"))
22866      parseElementProperties(getJObject(json, "_responseRequired"), res.getResponseRequiredElement());
22867    if (json.has("allowedResponse")) {
22868      JsonArray array = getJArray(json, "allowedResponse");
22869      for (int i = 0; i < array.size(); i++) {
22870        res.getAllowedResponse().add(parseMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject()));
22871      }
22872    };
22873    if (json.has("graph"))
22874      res.setGraphElement(parseCanonical(json.get("graph").getAsString()));
22875    if (json.has("_graph"))
22876      parseElementProperties(getJObject(json, "_graph"), res.getGraphElement());
22877  }
22878
22879  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionFocusComponent(JsonObject json) throws IOException, FHIRFormatError {
22880    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
22881    parseMessageDefinitionFocusComponentProperties(json, res);
22882    return res;
22883  }
22884
22885  protected void parseMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
22886    parseBackboneElementProperties(json, res);
22887    if (json.has("code"))
22888      res.setCodeElement(parseCode(json.get("code").getAsString()));
22889    if (json.has("_code"))
22890      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
22891    if (json.has("profile"))
22892      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
22893    if (json.has("_profile"))
22894      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
22895    if (json.has("min"))
22896      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
22897    if (json.has("_min"))
22898      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
22899    if (json.has("max"))
22900      res.setMaxElement(parseString(json.get("max").getAsString()));
22901    if (json.has("_max"))
22902      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
22903  }
22904
22905  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionAllowedResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
22906    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
22907    parseMessageDefinitionAllowedResponseComponentProperties(json, res);
22908    return res;
22909  }
22910
22911  protected void parseMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
22912    parseBackboneElementProperties(json, res);
22913    if (json.has("message"))
22914      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
22915    if (json.has("_message"))
22916      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
22917    if (json.has("situation"))
22918      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
22919    if (json.has("_situation"))
22920      parseElementProperties(getJObject(json, "_situation"), res.getSituationElement());
22921  }
22922
22923  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
22924    MessageHeader res = new MessageHeader();
22925    parseMessageHeaderProperties(json, res);
22926    return res;
22927  }
22928
22929  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
22930    parseDomainResourceProperties(json, res);
22931    DataType event = parseType("event", json);
22932    if (event != null)
22933      res.setEvent(event);
22934    if (json.has("destination")) {
22935      JsonArray array = getJArray(json, "destination");
22936      for (int i = 0; i < array.size(); i++) {
22937        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject()));
22938      }
22939    };
22940    if (json.has("sender"))
22941      res.setSender(parseReference(getJObject(json, "sender")));
22942    if (json.has("author"))
22943      res.setAuthor(parseReference(getJObject(json, "author")));
22944    if (json.has("source"))
22945      res.setSource(parseMessageHeaderMessageSourceComponent(getJObject(json, "source")));
22946    if (json.has("responsible"))
22947      res.setResponsible(parseReference(getJObject(json, "responsible")));
22948    if (json.has("reason"))
22949      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
22950    if (json.has("response"))
22951      res.setResponse(parseMessageHeaderResponseComponent(getJObject(json, "response")));
22952    if (json.has("focus")) {
22953      JsonArray array = getJArray(json, "focus");
22954      for (int i = 0; i < array.size(); i++) {
22955        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
22956      }
22957    };
22958    if (json.has("definition"))
22959      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
22960    if (json.has("_definition"))
22961      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
22962  }
22963
22964  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json) throws IOException, FHIRFormatError {
22965    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
22966    parseMessageHeaderMessageDestinationComponentProperties(json, res);
22967    return res;
22968  }
22969
22970  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
22971    parseBackboneElementProperties(json, res);
22972    DataType endpoint = parseType("endpoint", json);
22973    if (endpoint != null)
22974      res.setEndpoint(endpoint);
22975    if (json.has("name"))
22976      res.setNameElement(parseString(json.get("name").getAsString()));
22977    if (json.has("_name"))
22978      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22979    if (json.has("target"))
22980      res.setTarget(parseReference(getJObject(json, "target")));
22981    if (json.has("receiver"))
22982      res.setReceiver(parseReference(getJObject(json, "receiver")));
22983  }
22984
22985  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
22986    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
22987    parseMessageHeaderMessageSourceComponentProperties(json, res);
22988    return res;
22989  }
22990
22991  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
22992    parseBackboneElementProperties(json, res);
22993    DataType endpoint = parseType("endpoint", json);
22994    if (endpoint != null)
22995      res.setEndpoint(endpoint);
22996    if (json.has("name"))
22997      res.setNameElement(parseString(json.get("name").getAsString()));
22998    if (json.has("_name"))
22999      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23000    if (json.has("software"))
23001      res.setSoftwareElement(parseString(json.get("software").getAsString()));
23002    if (json.has("_software"))
23003      parseElementProperties(getJObject(json, "_software"), res.getSoftwareElement());
23004    if (json.has("version"))
23005      res.setVersionElement(parseString(json.get("version").getAsString()));
23006    if (json.has("_version"))
23007      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23008    if (json.has("contact"))
23009      res.setContact(parseContactPoint(getJObject(json, "contact")));
23010  }
23011
23012  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
23013    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
23014    parseMessageHeaderResponseComponentProperties(json, res);
23015    return res;
23016  }
23017
23018  protected void parseMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
23019    parseBackboneElementProperties(json, res);
23020    if (json.has("identifier"))
23021      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
23022    if (json.has("code"))
23023      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
23024    if (json.has("_code"))
23025      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
23026    if (json.has("details"))
23027      res.setDetails(parseReference(getJObject(json, "details")));
23028  }
23029
23030  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
23031    MolecularSequence res = new MolecularSequence();
23032    parseMolecularSequenceProperties(json, res);
23033    return res;
23034  }
23035
23036  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
23037    parseDomainResourceProperties(json, res);
23038    if (json.has("identifier")) {
23039      JsonArray array = getJArray(json, "identifier");
23040      for (int i = 0; i < array.size(); i++) {
23041        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23042      }
23043    };
23044    if (json.has("type"))
23045      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
23046    if (json.has("_type"))
23047      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23048    if (json.has("subject"))
23049      res.setSubject(parseReference(getJObject(json, "subject")));
23050    if (json.has("focus")) {
23051      JsonArray array = getJArray(json, "focus");
23052      for (int i = 0; i < array.size(); i++) {
23053        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
23054      }
23055    };
23056    if (json.has("specimen"))
23057      res.setSpecimen(parseReference(getJObject(json, "specimen")));
23058    if (json.has("device"))
23059      res.setDevice(parseReference(getJObject(json, "device")));
23060    if (json.has("performer"))
23061      res.setPerformer(parseReference(getJObject(json, "performer")));
23062    if (json.has("literal"))
23063      res.setLiteralElement(parseString(json.get("literal").getAsString()));
23064    if (json.has("_literal"))
23065      parseElementProperties(getJObject(json, "_literal"), res.getLiteralElement());
23066    if (json.has("formatted")) {
23067      JsonArray array = getJArray(json, "formatted");
23068      for (int i = 0; i < array.size(); i++) {
23069        res.getFormatted().add(parseAttachment(array.get(i).getAsJsonObject()));
23070      }
23071    };
23072    if (json.has("relative")) {
23073      JsonArray array = getJArray(json, "relative");
23074      for (int i = 0; i < array.size(); i++) {
23075        res.getRelative().add(parseMolecularSequenceRelativeComponent(array.get(i).getAsJsonObject()));
23076      }
23077    };
23078  }
23079
23080  protected MolecularSequence.MolecularSequenceRelativeComponent parseMolecularSequenceRelativeComponent(JsonObject json) throws IOException, FHIRFormatError {
23081    MolecularSequence.MolecularSequenceRelativeComponent res = new MolecularSequence.MolecularSequenceRelativeComponent();
23082    parseMolecularSequenceRelativeComponentProperties(json, res);
23083    return res;
23084  }
23085
23086  protected void parseMolecularSequenceRelativeComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceRelativeComponent res) throws IOException, FHIRFormatError {
23087    parseBackboneElementProperties(json, res);
23088    if (json.has("coordinateSystem"))
23089      res.setCoordinateSystem(parseCodeableConcept(getJObject(json, "coordinateSystem")));
23090    if (json.has("ordinalPosition"))
23091      res.setOrdinalPositionElement(parseInteger(json.get("ordinalPosition").getAsLong()));
23092    if (json.has("_ordinalPosition"))
23093      parseElementProperties(getJObject(json, "_ordinalPosition"), res.getOrdinalPositionElement());
23094    if (json.has("sequenceRange"))
23095      res.setSequenceRange(parseRange(getJObject(json, "sequenceRange")));
23096    if (json.has("startingSequence"))
23097      res.setStartingSequence(parseMolecularSequenceRelativeStartingSequenceComponent(getJObject(json, "startingSequence")));
23098    if (json.has("edit")) {
23099      JsonArray array = getJArray(json, "edit");
23100      for (int i = 0; i < array.size(); i++) {
23101        res.getEdit().add(parseMolecularSequenceRelativeEditComponent(array.get(i).getAsJsonObject()));
23102      }
23103    };
23104  }
23105
23106  protected MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent parseMolecularSequenceRelativeStartingSequenceComponent(JsonObject json) throws IOException, FHIRFormatError {
23107    MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent res = new MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent();
23108    parseMolecularSequenceRelativeStartingSequenceComponentProperties(json, res);
23109    return res;
23110  }
23111
23112  protected void parseMolecularSequenceRelativeStartingSequenceComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent res) throws IOException, FHIRFormatError {
23113    parseBackboneElementProperties(json, res);
23114    if (json.has("genomeAssembly"))
23115      res.setGenomeAssembly(parseCodeableConcept(getJObject(json, "genomeAssembly")));
23116    if (json.has("chromosome"))
23117      res.setChromosome(parseCodeableConcept(getJObject(json, "chromosome")));
23118    DataType sequence = parseType("sequence", json);
23119    if (sequence != null)
23120      res.setSequence(sequence);
23121    if (json.has("windowStart"))
23122      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
23123    if (json.has("_windowStart"))
23124      parseElementProperties(getJObject(json, "_windowStart"), res.getWindowStartElement());
23125    if (json.has("windowEnd"))
23126      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
23127    if (json.has("_windowEnd"))
23128      parseElementProperties(getJObject(json, "_windowEnd"), res.getWindowEndElement());
23129    if (json.has("orientation"))
23130      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
23131    if (json.has("_orientation"))
23132      parseElementProperties(getJObject(json, "_orientation"), res.getOrientationElement());
23133    if (json.has("strand"))
23134      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
23135    if (json.has("_strand"))
23136      parseElementProperties(getJObject(json, "_strand"), res.getStrandElement());
23137  }
23138
23139  protected MolecularSequence.MolecularSequenceRelativeEditComponent parseMolecularSequenceRelativeEditComponent(JsonObject json) throws IOException, FHIRFormatError {
23140    MolecularSequence.MolecularSequenceRelativeEditComponent res = new MolecularSequence.MolecularSequenceRelativeEditComponent();
23141    parseMolecularSequenceRelativeEditComponentProperties(json, res);
23142    return res;
23143  }
23144
23145  protected void parseMolecularSequenceRelativeEditComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceRelativeEditComponent res) throws IOException, FHIRFormatError {
23146    parseBackboneElementProperties(json, res);
23147    if (json.has("start"))
23148      res.setStartElement(parseInteger(json.get("start").getAsLong()));
23149    if (json.has("_start"))
23150      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
23151    if (json.has("end"))
23152      res.setEndElement(parseInteger(json.get("end").getAsLong()));
23153    if (json.has("_end"))
23154      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
23155    if (json.has("replacementSequence"))
23156      res.setReplacementSequenceElement(parseString(json.get("replacementSequence").getAsString()));
23157    if (json.has("_replacementSequence"))
23158      parseElementProperties(getJObject(json, "_replacementSequence"), res.getReplacementSequenceElement());
23159    if (json.has("replacedSequence"))
23160      res.setReplacedSequenceElement(parseString(json.get("replacedSequence").getAsString()));
23161    if (json.has("_replacedSequence"))
23162      parseElementProperties(getJObject(json, "_replacedSequence"), res.getReplacedSequenceElement());
23163  }
23164
23165  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
23166    NamingSystem res = new NamingSystem();
23167    parseNamingSystemProperties(json, res);
23168    return res;
23169  }
23170
23171  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
23172    parseMetadataResourceProperties(json, res);
23173    if (json.has("url"))
23174      res.setUrlElement(parseUri(json.get("url").getAsString()));
23175    if (json.has("_url"))
23176      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23177    if (json.has("identifier")) {
23178      JsonArray array = getJArray(json, "identifier");
23179      for (int i = 0; i < array.size(); i++) {
23180        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23181      }
23182    };
23183    if (json.has("version"))
23184      res.setVersionElement(parseString(json.get("version").getAsString()));
23185    if (json.has("_version"))
23186      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23187    DataType versionAlgorithm = parseType("versionAlgorithm", json);
23188    if (versionAlgorithm != null)
23189      res.setVersionAlgorithm(versionAlgorithm);
23190    if (json.has("name"))
23191      res.setNameElement(parseString(json.get("name").getAsString()));
23192    if (json.has("_name"))
23193      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23194    if (json.has("title"))
23195      res.setTitleElement(parseString(json.get("title").getAsString()));
23196    if (json.has("_title"))
23197      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23198    if (json.has("status"))
23199      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23200    if (json.has("_status"))
23201      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23202    if (json.has("kind"))
23203      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
23204    if (json.has("_kind"))
23205      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
23206    if (json.has("experimental"))
23207      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23208    if (json.has("_experimental"))
23209      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
23210    if (json.has("date"))
23211      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23212    if (json.has("_date"))
23213      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23214    if (json.has("publisher"))
23215      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23216    if (json.has("_publisher"))
23217      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23218    if (json.has("contact")) {
23219      JsonArray array = getJArray(json, "contact");
23220      for (int i = 0; i < array.size(); i++) {
23221        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23222      }
23223    };
23224    if (json.has("responsible"))
23225      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
23226    if (json.has("_responsible"))
23227      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
23228    if (json.has("type"))
23229      res.setType(parseCodeableConcept(getJObject(json, "type")));
23230    if (json.has("description"))
23231      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23232    if (json.has("_description"))
23233      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23234    if (json.has("useContext")) {
23235      JsonArray array = getJArray(json, "useContext");
23236      for (int i = 0; i < array.size(); i++) {
23237        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23238      }
23239    };
23240    if (json.has("jurisdiction")) {
23241      JsonArray array = getJArray(json, "jurisdiction");
23242      for (int i = 0; i < array.size(); i++) {
23243        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23244      }
23245    };
23246    if (json.has("purpose"))
23247      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23248    if (json.has("_purpose"))
23249      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
23250    if (json.has("copyright"))
23251      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23252    if (json.has("_copyright"))
23253      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
23254    if (json.has("copyrightLabel"))
23255      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
23256    if (json.has("_copyrightLabel"))
23257      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
23258    if (json.has("approvalDate"))
23259      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
23260    if (json.has("_approvalDate"))
23261      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
23262    if (json.has("lastReviewDate"))
23263      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
23264    if (json.has("_lastReviewDate"))
23265      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
23266    if (json.has("effectivePeriod"))
23267      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
23268    if (json.has("topic")) {
23269      JsonArray array = getJArray(json, "topic");
23270      for (int i = 0; i < array.size(); i++) {
23271        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23272      }
23273    };
23274    if (json.has("author")) {
23275      JsonArray array = getJArray(json, "author");
23276      for (int i = 0; i < array.size(); i++) {
23277        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23278      }
23279    };
23280    if (json.has("editor")) {
23281      JsonArray array = getJArray(json, "editor");
23282      for (int i = 0; i < array.size(); i++) {
23283        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23284      }
23285    };
23286    if (json.has("reviewer")) {
23287      JsonArray array = getJArray(json, "reviewer");
23288      for (int i = 0; i < array.size(); i++) {
23289        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
23290      }
23291    };
23292    if (json.has("endorser")) {
23293      JsonArray array = getJArray(json, "endorser");
23294      for (int i = 0; i < array.size(); i++) {
23295        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
23296      }
23297    };
23298    if (json.has("relatedArtifact")) {
23299      JsonArray array = getJArray(json, "relatedArtifact");
23300      for (int i = 0; i < array.size(); i++) {
23301        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23302      }
23303    };
23304    if (json.has("usage"))
23305      res.setUsageElement(parseString(json.get("usage").getAsString()));
23306    if (json.has("_usage"))
23307      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
23308    if (json.has("uniqueId")) {
23309      JsonArray array = getJArray(json, "uniqueId");
23310      for (int i = 0; i < array.size(); i++) {
23311        res.getUniqueId().add(parseNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject()));
23312      }
23313    };
23314  }
23315
23316  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemUniqueIdComponent(JsonObject json) throws IOException, FHIRFormatError {
23317    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
23318    parseNamingSystemUniqueIdComponentProperties(json, res);
23319    return res;
23320  }
23321
23322  protected void parseNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
23323    parseBackboneElementProperties(json, res);
23324    if (json.has("type"))
23325      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
23326    if (json.has("_type"))
23327      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23328    if (json.has("value"))
23329      res.setValueElement(parseString(json.get("value").getAsString()));
23330    if (json.has("_value"))
23331      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
23332    if (json.has("preferred"))
23333      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
23334    if (json.has("_preferred"))
23335      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
23336    if (json.has("comment"))
23337      res.setCommentElement(parseString(json.get("comment").getAsString()));
23338    if (json.has("_comment"))
23339      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
23340    if (json.has("period"))
23341      res.setPeriod(parsePeriod(getJObject(json, "period")));
23342    if (json.has("authoritative"))
23343      res.setAuthoritativeElement(parseBoolean(json.get("authoritative").getAsBoolean()));
23344    if (json.has("_authoritative"))
23345      parseElementProperties(getJObject(json, "_authoritative"), res.getAuthoritativeElement());
23346  }
23347
23348  protected NutritionIntake parseNutritionIntake(JsonObject json) throws IOException, FHIRFormatError {
23349    NutritionIntake res = new NutritionIntake();
23350    parseNutritionIntakeProperties(json, res);
23351    return res;
23352  }
23353
23354  protected void parseNutritionIntakeProperties(JsonObject json, NutritionIntake res) throws IOException, FHIRFormatError {
23355    parseDomainResourceProperties(json, res);
23356    if (json.has("identifier")) {
23357      JsonArray array = getJArray(json, "identifier");
23358      for (int i = 0; i < array.size(); i++) {
23359        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23360      }
23361    };
23362    if (json.has("instantiatesCanonical")) {
23363      JsonArray array = getJArray(json, "instantiatesCanonical");
23364      for (int i = 0; i < array.size(); i++) {
23365        if (array.get(i).isJsonNull()) {
23366          res.getInstantiatesCanonical().add(new CanonicalType());
23367        } else {;
23368          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
23369        }
23370      }
23371    };
23372    if (json.has("_instantiatesCanonical")) {
23373      JsonArray array = getJArray(json, "_instantiatesCanonical");
23374      for (int i = 0; i < array.size(); i++) {
23375        if (i == res.getInstantiatesCanonical().size())
23376          res.getInstantiatesCanonical().add(parseCanonical(null));
23377        if (array.get(i) instanceof JsonObject) 
23378          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
23379      }
23380    };
23381    if (json.has("instantiatesUri")) {
23382      JsonArray array = getJArray(json, "instantiatesUri");
23383      for (int i = 0; i < array.size(); i++) {
23384        if (array.get(i).isJsonNull()) {
23385          res.getInstantiatesUri().add(new UriType());
23386        } else {;
23387          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
23388        }
23389      }
23390    };
23391    if (json.has("_instantiatesUri")) {
23392      JsonArray array = getJArray(json, "_instantiatesUri");
23393      for (int i = 0; i < array.size(); i++) {
23394        if (i == res.getInstantiatesUri().size())
23395          res.getInstantiatesUri().add(parseUri(null));
23396        if (array.get(i) instanceof JsonObject) 
23397          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
23398      }
23399    };
23400    if (json.has("basedOn")) {
23401      JsonArray array = getJArray(json, "basedOn");
23402      for (int i = 0; i < array.size(); i++) {
23403        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23404      }
23405    };
23406    if (json.has("partOf")) {
23407      JsonArray array = getJArray(json, "partOf");
23408      for (int i = 0; i < array.size(); i++) {
23409        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
23410      }
23411    };
23412    if (json.has("status"))
23413      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
23414    if (json.has("_status"))
23415      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23416    if (json.has("statusReason")) {
23417      JsonArray array = getJArray(json, "statusReason");
23418      for (int i = 0; i < array.size(); i++) {
23419        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23420      }
23421    };
23422    if (json.has("code"))
23423      res.setCode(parseCodeableConcept(getJObject(json, "code")));
23424    if (json.has("subject"))
23425      res.setSubject(parseReference(getJObject(json, "subject")));
23426    if (json.has("encounter"))
23427      res.setEncounter(parseReference(getJObject(json, "encounter")));
23428    DataType occurrence = parseType("occurrence", json);
23429    if (occurrence != null)
23430      res.setOccurrence(occurrence);
23431    if (json.has("recorded"))
23432      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
23433    if (json.has("_recorded"))
23434      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
23435    DataType reported = parseType("reported", json);
23436    if (reported != null)
23437      res.setReported(reported);
23438    if (json.has("consumedItem")) {
23439      JsonArray array = getJArray(json, "consumedItem");
23440      for (int i = 0; i < array.size(); i++) {
23441        res.getConsumedItem().add(parseNutritionIntakeConsumedItemComponent(array.get(i).getAsJsonObject()));
23442      }
23443    };
23444    if (json.has("ingredientLabel")) {
23445      JsonArray array = getJArray(json, "ingredientLabel");
23446      for (int i = 0; i < array.size(); i++) {
23447        res.getIngredientLabel().add(parseNutritionIntakeIngredientLabelComponent(array.get(i).getAsJsonObject()));
23448      }
23449    };
23450    if (json.has("performer")) {
23451      JsonArray array = getJArray(json, "performer");
23452      for (int i = 0; i < array.size(); i++) {
23453        res.getPerformer().add(parseNutritionIntakePerformerComponent(array.get(i).getAsJsonObject()));
23454      }
23455    };
23456    if (json.has("location"))
23457      res.setLocation(parseReference(getJObject(json, "location")));
23458    if (json.has("derivedFrom")) {
23459      JsonArray array = getJArray(json, "derivedFrom");
23460      for (int i = 0; i < array.size(); i++) {
23461        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
23462      }
23463    };
23464    if (json.has("reason")) {
23465      JsonArray array = getJArray(json, "reason");
23466      for (int i = 0; i < array.size(); i++) {
23467        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
23468      }
23469    };
23470    if (json.has("note")) {
23471      JsonArray array = getJArray(json, "note");
23472      for (int i = 0; i < array.size(); i++) {
23473        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23474      }
23475    };
23476  }
23477
23478  protected NutritionIntake.NutritionIntakeConsumedItemComponent parseNutritionIntakeConsumedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
23479    NutritionIntake.NutritionIntakeConsumedItemComponent res = new NutritionIntake.NutritionIntakeConsumedItemComponent();
23480    parseNutritionIntakeConsumedItemComponentProperties(json, res);
23481    return res;
23482  }
23483
23484  protected void parseNutritionIntakeConsumedItemComponentProperties(JsonObject json, NutritionIntake.NutritionIntakeConsumedItemComponent res) throws IOException, FHIRFormatError {
23485    parseBackboneElementProperties(json, res);
23486    if (json.has("type"))
23487      res.setType(parseCodeableConcept(getJObject(json, "type")));
23488    if (json.has("nutritionProduct"))
23489      res.setNutritionProduct(parseCodeableReference(getJObject(json, "nutritionProduct")));
23490    if (json.has("schedule"))
23491      res.setSchedule(parseTiming(getJObject(json, "schedule")));
23492    if (json.has("amount"))
23493      res.setAmount(parseQuantity(getJObject(json, "amount")));
23494    if (json.has("rate"))
23495      res.setRate(parseQuantity(getJObject(json, "rate")));
23496    if (json.has("notConsumed"))
23497      res.setNotConsumedElement(parseBoolean(json.get("notConsumed").getAsBoolean()));
23498    if (json.has("_notConsumed"))
23499      parseElementProperties(getJObject(json, "_notConsumed"), res.getNotConsumedElement());
23500    if (json.has("notConsumedReason"))
23501      res.setNotConsumedReason(parseCodeableConcept(getJObject(json, "notConsumedReason")));
23502  }
23503
23504  protected NutritionIntake.NutritionIntakeIngredientLabelComponent parseNutritionIntakeIngredientLabelComponent(JsonObject json) throws IOException, FHIRFormatError {
23505    NutritionIntake.NutritionIntakeIngredientLabelComponent res = new NutritionIntake.NutritionIntakeIngredientLabelComponent();
23506    parseNutritionIntakeIngredientLabelComponentProperties(json, res);
23507    return res;
23508  }
23509
23510  protected void parseNutritionIntakeIngredientLabelComponentProperties(JsonObject json, NutritionIntake.NutritionIntakeIngredientLabelComponent res) throws IOException, FHIRFormatError {
23511    parseBackboneElementProperties(json, res);
23512    if (json.has("nutrient"))
23513      res.setNutrient(parseCodeableReference(getJObject(json, "nutrient")));
23514    if (json.has("amount"))
23515      res.setAmount(parseQuantity(getJObject(json, "amount")));
23516  }
23517
23518  protected NutritionIntake.NutritionIntakePerformerComponent parseNutritionIntakePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
23519    NutritionIntake.NutritionIntakePerformerComponent res = new NutritionIntake.NutritionIntakePerformerComponent();
23520    parseNutritionIntakePerformerComponentProperties(json, res);
23521    return res;
23522  }
23523
23524  protected void parseNutritionIntakePerformerComponentProperties(JsonObject json, NutritionIntake.NutritionIntakePerformerComponent res) throws IOException, FHIRFormatError {
23525    parseBackboneElementProperties(json, res);
23526    if (json.has("function"))
23527      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
23528    if (json.has("actor"))
23529      res.setActor(parseReference(getJObject(json, "actor")));
23530  }
23531
23532  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
23533    NutritionOrder res = new NutritionOrder();
23534    parseNutritionOrderProperties(json, res);
23535    return res;
23536  }
23537
23538  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
23539    parseDomainResourceProperties(json, res);
23540    if (json.has("identifier")) {
23541      JsonArray array = getJArray(json, "identifier");
23542      for (int i = 0; i < array.size(); i++) {
23543        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23544      }
23545    };
23546    if (json.has("instantiatesCanonical")) {
23547      JsonArray array = getJArray(json, "instantiatesCanonical");
23548      for (int i = 0; i < array.size(); i++) {
23549        if (array.get(i).isJsonNull()) {
23550          res.getInstantiatesCanonical().add(new CanonicalType());
23551        } else {;
23552          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
23553        }
23554      }
23555    };
23556    if (json.has("_instantiatesCanonical")) {
23557      JsonArray array = getJArray(json, "_instantiatesCanonical");
23558      for (int i = 0; i < array.size(); i++) {
23559        if (i == res.getInstantiatesCanonical().size())
23560          res.getInstantiatesCanonical().add(parseCanonical(null));
23561        if (array.get(i) instanceof JsonObject) 
23562          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
23563      }
23564    };
23565    if (json.has("instantiatesUri")) {
23566      JsonArray array = getJArray(json, "instantiatesUri");
23567      for (int i = 0; i < array.size(); i++) {
23568        if (array.get(i).isJsonNull()) {
23569          res.getInstantiatesUri().add(new UriType());
23570        } else {;
23571          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
23572        }
23573      }
23574    };
23575    if (json.has("_instantiatesUri")) {
23576      JsonArray array = getJArray(json, "_instantiatesUri");
23577      for (int i = 0; i < array.size(); i++) {
23578        if (i == res.getInstantiatesUri().size())
23579          res.getInstantiatesUri().add(parseUri(null));
23580        if (array.get(i) instanceof JsonObject) 
23581          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
23582      }
23583    };
23584    if (json.has("instantiates")) {
23585      JsonArray array = getJArray(json, "instantiates");
23586      for (int i = 0; i < array.size(); i++) {
23587        if (array.get(i).isJsonNull()) {
23588          res.getInstantiates().add(new UriType());
23589        } else {;
23590          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
23591        }
23592      }
23593    };
23594    if (json.has("_instantiates")) {
23595      JsonArray array = getJArray(json, "_instantiates");
23596      for (int i = 0; i < array.size(); i++) {
23597        if (i == res.getInstantiates().size())
23598          res.getInstantiates().add(parseUri(null));
23599        if (array.get(i) instanceof JsonObject) 
23600          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
23601      }
23602    };
23603    if (json.has("basedOn")) {
23604      JsonArray array = getJArray(json, "basedOn");
23605      for (int i = 0; i < array.size(); i++) {
23606        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23607      }
23608    };
23609    if (json.has("groupIdentifier"))
23610      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
23611    if (json.has("status"))
23612      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
23613    if (json.has("_status"))
23614      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23615    if (json.has("intent"))
23616      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
23617    if (json.has("_intent"))
23618      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
23619    if (json.has("priority"))
23620      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
23621    if (json.has("_priority"))
23622      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
23623    if (json.has("subject"))
23624      res.setSubject(parseReference(getJObject(json, "subject")));
23625    if (json.has("encounter"))
23626      res.setEncounter(parseReference(getJObject(json, "encounter")));
23627    if (json.has("supportingInformation")) {
23628      JsonArray array = getJArray(json, "supportingInformation");
23629      for (int i = 0; i < array.size(); i++) {
23630        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
23631      }
23632    };
23633    if (json.has("dateTime"))
23634      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
23635    if (json.has("_dateTime"))
23636      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
23637    if (json.has("orderer"))
23638      res.setOrderer(parseReference(getJObject(json, "orderer")));
23639    if (json.has("performer")) {
23640      JsonArray array = getJArray(json, "performer");
23641      for (int i = 0; i < array.size(); i++) {
23642        res.getPerformer().add(parseCodeableReference(array.get(i).getAsJsonObject()));
23643      }
23644    };
23645    if (json.has("allergyIntolerance")) {
23646      JsonArray array = getJArray(json, "allergyIntolerance");
23647      for (int i = 0; i < array.size(); i++) {
23648        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
23649      }
23650    };
23651    if (json.has("foodPreferenceModifier")) {
23652      JsonArray array = getJArray(json, "foodPreferenceModifier");
23653      for (int i = 0; i < array.size(); i++) {
23654        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23655      }
23656    };
23657    if (json.has("excludeFoodModifier")) {
23658      JsonArray array = getJArray(json, "excludeFoodModifier");
23659      for (int i = 0; i < array.size(); i++) {
23660        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23661      }
23662    };
23663    if (json.has("outsideFoodAllowed"))
23664      res.setOutsideFoodAllowedElement(parseBoolean(json.get("outsideFoodAllowed").getAsBoolean()));
23665    if (json.has("_outsideFoodAllowed"))
23666      parseElementProperties(getJObject(json, "_outsideFoodAllowed"), res.getOutsideFoodAllowedElement());
23667    if (json.has("oralDiet"))
23668      res.setOralDiet(parseNutritionOrderOralDietComponent(getJObject(json, "oralDiet")));
23669    if (json.has("supplement")) {
23670      JsonArray array = getJArray(json, "supplement");
23671      for (int i = 0; i < array.size(); i++) {
23672        res.getSupplement().add(parseNutritionOrderSupplementComponent(array.get(i).getAsJsonObject()));
23673      }
23674    };
23675    if (json.has("enteralFormula"))
23676      res.setEnteralFormula(parseNutritionOrderEnteralFormulaComponent(getJObject(json, "enteralFormula")));
23677    if (json.has("note")) {
23678      JsonArray array = getJArray(json, "note");
23679      for (int i = 0; i < array.size(); i++) {
23680        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23681      }
23682    };
23683  }
23684
23685  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderOralDietComponent(JsonObject json) throws IOException, FHIRFormatError {
23686    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
23687    parseNutritionOrderOralDietComponentProperties(json, res);
23688    return res;
23689  }
23690
23691  protected void parseNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
23692    parseBackboneElementProperties(json, res);
23693    if (json.has("type")) {
23694      JsonArray array = getJArray(json, "type");
23695      for (int i = 0; i < array.size(); i++) {
23696        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23697      }
23698    };
23699    if (json.has("schedule"))
23700      res.setSchedule(parseNutritionOrderOralDietScheduleComponent(getJObject(json, "schedule")));
23701    if (json.has("nutrient")) {
23702      JsonArray array = getJArray(json, "nutrient");
23703      for (int i = 0; i < array.size(); i++) {
23704        res.getNutrient().add(parseNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject()));
23705      }
23706    };
23707    if (json.has("texture")) {
23708      JsonArray array = getJArray(json, "texture");
23709      for (int i = 0; i < array.size(); i++) {
23710        res.getTexture().add(parseNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject()));
23711      }
23712    };
23713    if (json.has("fluidConsistencyType")) {
23714      JsonArray array = getJArray(json, "fluidConsistencyType");
23715      for (int i = 0; i < array.size(); i++) {
23716        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23717      }
23718    };
23719    if (json.has("instruction"))
23720      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
23721    if (json.has("_instruction"))
23722      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
23723  }
23724
23725  protected NutritionOrder.OralDietScheduleComponent parseNutritionOrderOralDietScheduleComponent(JsonObject json) throws IOException, FHIRFormatError {
23726    NutritionOrder.OralDietScheduleComponent res = new NutritionOrder.OralDietScheduleComponent();
23727    parseNutritionOrderOralDietScheduleComponentProperties(json, res);
23728    return res;
23729  }
23730
23731  protected void parseNutritionOrderOralDietScheduleComponentProperties(JsonObject json, NutritionOrder.OralDietScheduleComponent res) throws IOException, FHIRFormatError {
23732    parseBackboneElementProperties(json, res);
23733    if (json.has("timing")) {
23734      JsonArray array = getJArray(json, "timing");
23735      for (int i = 0; i < array.size(); i++) {
23736        res.getTiming().add(parseTiming(array.get(i).getAsJsonObject()));
23737      }
23738    };
23739    if (json.has("asNeeded"))
23740      res.setAsNeededElement(parseBoolean(json.get("asNeeded").getAsBoolean()));
23741    if (json.has("_asNeeded"))
23742      parseElementProperties(getJObject(json, "_asNeeded"), res.getAsNeededElement());
23743    if (json.has("asNeededFor"))
23744      res.setAsNeededFor(parseCodeableConcept(getJObject(json, "asNeededFor")));
23745  }
23746
23747  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderOralDietNutrientComponent(JsonObject json) throws IOException, FHIRFormatError {
23748    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
23749    parseNutritionOrderOralDietNutrientComponentProperties(json, res);
23750    return res;
23751  }
23752
23753  protected void parseNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
23754    parseBackboneElementProperties(json, res);
23755    if (json.has("modifier"))
23756      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
23757    if (json.has("amount"))
23758      res.setAmount(parseQuantity(getJObject(json, "amount")));
23759  }
23760
23761  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderOralDietTextureComponent(JsonObject json) throws IOException, FHIRFormatError {
23762    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
23763    parseNutritionOrderOralDietTextureComponentProperties(json, res);
23764    return res;
23765  }
23766
23767  protected void parseNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
23768    parseBackboneElementProperties(json, res);
23769    if (json.has("modifier"))
23770      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
23771    if (json.has("foodType"))
23772      res.setFoodType(parseCodeableConcept(getJObject(json, "foodType")));
23773  }
23774
23775  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderSupplementComponent(JsonObject json) throws IOException, FHIRFormatError {
23776    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
23777    parseNutritionOrderSupplementComponentProperties(json, res);
23778    return res;
23779  }
23780
23781  protected void parseNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
23782    parseBackboneElementProperties(json, res);
23783    if (json.has("type"))
23784      res.setType(parseCodeableReference(getJObject(json, "type")));
23785    if (json.has("productName"))
23786      res.setProductNameElement(parseString(json.get("productName").getAsString()));
23787    if (json.has("_productName"))
23788      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
23789    if (json.has("schedule"))
23790      res.setSchedule(parseNutritionOrderSupplementScheduleComponent(getJObject(json, "schedule")));
23791    if (json.has("quantity"))
23792      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
23793    if (json.has("instruction"))
23794      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
23795    if (json.has("_instruction"))
23796      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
23797  }
23798
23799  protected NutritionOrder.SupplementScheduleComponent parseNutritionOrderSupplementScheduleComponent(JsonObject json) throws IOException, FHIRFormatError {
23800    NutritionOrder.SupplementScheduleComponent res = new NutritionOrder.SupplementScheduleComponent();
23801    parseNutritionOrderSupplementScheduleComponentProperties(json, res);
23802    return res;
23803  }
23804
23805  protected void parseNutritionOrderSupplementScheduleComponentProperties(JsonObject json, NutritionOrder.SupplementScheduleComponent res) throws IOException, FHIRFormatError {
23806    parseBackboneElementProperties(json, res);
23807    if (json.has("timing")) {
23808      JsonArray array = getJArray(json, "timing");
23809      for (int i = 0; i < array.size(); i++) {
23810        res.getTiming().add(parseTiming(array.get(i).getAsJsonObject()));
23811      }
23812    };
23813    if (json.has("asNeeded"))
23814      res.setAsNeededElement(parseBoolean(json.get("asNeeded").getAsBoolean()));
23815    if (json.has("_asNeeded"))
23816      parseElementProperties(getJObject(json, "_asNeeded"), res.getAsNeededElement());
23817    if (json.has("asNeededFor"))
23818      res.setAsNeededFor(parseCodeableConcept(getJObject(json, "asNeededFor")));
23819  }
23820
23821  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderEnteralFormulaComponent(JsonObject json) throws IOException, FHIRFormatError {
23822    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
23823    parseNutritionOrderEnteralFormulaComponentProperties(json, res);
23824    return res;
23825  }
23826
23827  protected void parseNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
23828    parseBackboneElementProperties(json, res);
23829    if (json.has("baseFormulaType"))
23830      res.setBaseFormulaType(parseCodeableReference(getJObject(json, "baseFormulaType")));
23831    if (json.has("baseFormulaProductName"))
23832      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
23833    if (json.has("_baseFormulaProductName"))
23834      parseElementProperties(getJObject(json, "_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
23835    if (json.has("deliveryDevice")) {
23836      JsonArray array = getJArray(json, "deliveryDevice");
23837      for (int i = 0; i < array.size(); i++) {
23838        res.getDeliveryDevice().add(parseCodeableReference(array.get(i).getAsJsonObject()));
23839      }
23840    };
23841    if (json.has("additive")) {
23842      JsonArray array = getJArray(json, "additive");
23843      for (int i = 0; i < array.size(); i++) {
23844        res.getAdditive().add(parseNutritionOrderEnteralFormulaAdditiveComponent(array.get(i).getAsJsonObject()));
23845      }
23846    };
23847    if (json.has("caloricDensity"))
23848      res.setCaloricDensity(parseQuantity(getJObject(json, "caloricDensity")));
23849    if (json.has("routeOfAdministration"))
23850      res.setRouteOfAdministration(parseCodeableConcept(getJObject(json, "routeOfAdministration")));
23851    if (json.has("administration")) {
23852      JsonArray array = getJArray(json, "administration");
23853      for (int i = 0; i < array.size(); i++) {
23854        res.getAdministration().add(parseNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject()));
23855      }
23856    };
23857    if (json.has("maxVolumeToDeliver"))
23858      res.setMaxVolumeToDeliver(parseQuantity(getJObject(json, "maxVolumeToDeliver")));
23859    if (json.has("administrationInstruction"))
23860      res.setAdministrationInstructionElement(parseMarkdown(json.get("administrationInstruction").getAsString()));
23861    if (json.has("_administrationInstruction"))
23862      parseElementProperties(getJObject(json, "_administrationInstruction"), res.getAdministrationInstructionElement());
23863  }
23864
23865  protected NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent parseNutritionOrderEnteralFormulaAdditiveComponent(JsonObject json) throws IOException, FHIRFormatError {
23866    NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent();
23867    parseNutritionOrderEnteralFormulaAdditiveComponentProperties(json, res);
23868    return res;
23869  }
23870
23871  protected void parseNutritionOrderEnteralFormulaAdditiveComponentProperties(JsonObject json, NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent res) throws IOException, FHIRFormatError {
23872    parseBackboneElementProperties(json, res);
23873    if (json.has("type"))
23874      res.setType(parseCodeableReference(getJObject(json, "type")));
23875    if (json.has("productName"))
23876      res.setProductNameElement(parseString(json.get("productName").getAsString()));
23877    if (json.has("_productName"))
23878      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
23879    if (json.has("quantity"))
23880      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
23881  }
23882
23883  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
23884    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
23885    parseNutritionOrderEnteralFormulaAdministrationComponentProperties(json, res);
23886    return res;
23887  }
23888
23889  protected void parseNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
23890    parseBackboneElementProperties(json, res);
23891    if (json.has("schedule"))
23892      res.setSchedule(parseNutritionOrderEnteralFormulaScheduleComponent(getJObject(json, "schedule")));
23893    if (json.has("quantity"))
23894      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
23895    DataType rate = parseType("rate", json);
23896    if (rate != null)
23897      res.setRate(rate);
23898  }
23899
23900  protected NutritionOrder.EnteralFormulaScheduleComponent parseNutritionOrderEnteralFormulaScheduleComponent(JsonObject json) throws IOException, FHIRFormatError {
23901    NutritionOrder.EnteralFormulaScheduleComponent res = new NutritionOrder.EnteralFormulaScheduleComponent();
23902    parseNutritionOrderEnteralFormulaScheduleComponentProperties(json, res);
23903    return res;
23904  }
23905
23906  protected void parseNutritionOrderEnteralFormulaScheduleComponentProperties(JsonObject json, NutritionOrder.EnteralFormulaScheduleComponent res) throws IOException, FHIRFormatError {
23907    parseBackboneElementProperties(json, res);
23908    if (json.has("timing")) {
23909      JsonArray array = getJArray(json, "timing");
23910      for (int i = 0; i < array.size(); i++) {
23911        res.getTiming().add(parseTiming(array.get(i).getAsJsonObject()));
23912      }
23913    };
23914    if (json.has("asNeeded"))
23915      res.setAsNeededElement(parseBoolean(json.get("asNeeded").getAsBoolean()));
23916    if (json.has("_asNeeded"))
23917      parseElementProperties(getJObject(json, "_asNeeded"), res.getAsNeededElement());
23918    if (json.has("asNeededFor"))
23919      res.setAsNeededFor(parseCodeableConcept(getJObject(json, "asNeededFor")));
23920  }
23921
23922  protected NutritionProduct parseNutritionProduct(JsonObject json) throws IOException, FHIRFormatError {
23923    NutritionProduct res = new NutritionProduct();
23924    parseNutritionProductProperties(json, res);
23925    return res;
23926  }
23927
23928  protected void parseNutritionProductProperties(JsonObject json, NutritionProduct res) throws IOException, FHIRFormatError {
23929    parseDomainResourceProperties(json, res);
23930    if (json.has("code"))
23931      res.setCode(parseCodeableConcept(getJObject(json, "code")));
23932    if (json.has("status"))
23933      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionProduct.NutritionProductStatus.NULL, new NutritionProduct.NutritionProductStatusEnumFactory()));
23934    if (json.has("_status"))
23935      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23936    if (json.has("category")) {
23937      JsonArray array = getJArray(json, "category");
23938      for (int i = 0; i < array.size(); i++) {
23939        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23940      }
23941    };
23942    if (json.has("manufacturer")) {
23943      JsonArray array = getJArray(json, "manufacturer");
23944      for (int i = 0; i < array.size(); i++) {
23945        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
23946      }
23947    };
23948    if (json.has("nutrient")) {
23949      JsonArray array = getJArray(json, "nutrient");
23950      for (int i = 0; i < array.size(); i++) {
23951        res.getNutrient().add(parseNutritionProductNutrientComponent(array.get(i).getAsJsonObject()));
23952      }
23953    };
23954    if (json.has("ingredient")) {
23955      JsonArray array = getJArray(json, "ingredient");
23956      for (int i = 0; i < array.size(); i++) {
23957        res.getIngredient().add(parseNutritionProductIngredientComponent(array.get(i).getAsJsonObject()));
23958      }
23959    };
23960    if (json.has("knownAllergen")) {
23961      JsonArray array = getJArray(json, "knownAllergen");
23962      for (int i = 0; i < array.size(); i++) {
23963        res.getKnownAllergen().add(parseCodeableReference(array.get(i).getAsJsonObject()));
23964      }
23965    };
23966    if (json.has("characteristic")) {
23967      JsonArray array = getJArray(json, "characteristic");
23968      for (int i = 0; i < array.size(); i++) {
23969        res.getCharacteristic().add(parseNutritionProductCharacteristicComponent(array.get(i).getAsJsonObject()));
23970      }
23971    };
23972    if (json.has("instance")) {
23973      JsonArray array = getJArray(json, "instance");
23974      for (int i = 0; i < array.size(); i++) {
23975        res.getInstance().add(parseNutritionProductInstanceComponent(array.get(i).getAsJsonObject()));
23976      }
23977    };
23978    if (json.has("note")) {
23979      JsonArray array = getJArray(json, "note");
23980      for (int i = 0; i < array.size(); i++) {
23981        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23982      }
23983    };
23984  }
23985
23986  protected NutritionProduct.NutritionProductNutrientComponent parseNutritionProductNutrientComponent(JsonObject json) throws IOException, FHIRFormatError {
23987    NutritionProduct.NutritionProductNutrientComponent res = new NutritionProduct.NutritionProductNutrientComponent();
23988    parseNutritionProductNutrientComponentProperties(json, res);
23989    return res;
23990  }
23991
23992  protected void parseNutritionProductNutrientComponentProperties(JsonObject json, NutritionProduct.NutritionProductNutrientComponent res) throws IOException, FHIRFormatError {
23993    parseBackboneElementProperties(json, res);
23994    if (json.has("item"))
23995      res.setItem(parseCodeableReference(getJObject(json, "item")));
23996    if (json.has("amount")) {
23997      JsonArray array = getJArray(json, "amount");
23998      for (int i = 0; i < array.size(); i++) {
23999        res.getAmount().add(parseRatio(array.get(i).getAsJsonObject()));
24000      }
24001    };
24002  }
24003
24004  protected NutritionProduct.NutritionProductIngredientComponent parseNutritionProductIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
24005    NutritionProduct.NutritionProductIngredientComponent res = new NutritionProduct.NutritionProductIngredientComponent();
24006    parseNutritionProductIngredientComponentProperties(json, res);
24007    return res;
24008  }
24009
24010  protected void parseNutritionProductIngredientComponentProperties(JsonObject json, NutritionProduct.NutritionProductIngredientComponent res) throws IOException, FHIRFormatError {
24011    parseBackboneElementProperties(json, res);
24012    if (json.has("item"))
24013      res.setItem(parseCodeableReference(getJObject(json, "item")));
24014    if (json.has("amount")) {
24015      JsonArray array = getJArray(json, "amount");
24016      for (int i = 0; i < array.size(); i++) {
24017        res.getAmount().add(parseRatio(array.get(i).getAsJsonObject()));
24018      }
24019    };
24020  }
24021
24022  protected NutritionProduct.NutritionProductCharacteristicComponent parseNutritionProductCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
24023    NutritionProduct.NutritionProductCharacteristicComponent res = new NutritionProduct.NutritionProductCharacteristicComponent();
24024    parseNutritionProductCharacteristicComponentProperties(json, res);
24025    return res;
24026  }
24027
24028  protected void parseNutritionProductCharacteristicComponentProperties(JsonObject json, NutritionProduct.NutritionProductCharacteristicComponent res) throws IOException, FHIRFormatError {
24029    parseBackboneElementProperties(json, res);
24030    if (json.has("type"))
24031      res.setType(parseCodeableConcept(getJObject(json, "type")));
24032    DataType value = parseType("value", json);
24033    if (value != null)
24034      res.setValue(value);
24035  }
24036
24037  protected NutritionProduct.NutritionProductInstanceComponent parseNutritionProductInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
24038    NutritionProduct.NutritionProductInstanceComponent res = new NutritionProduct.NutritionProductInstanceComponent();
24039    parseNutritionProductInstanceComponentProperties(json, res);
24040    return res;
24041  }
24042
24043  protected void parseNutritionProductInstanceComponentProperties(JsonObject json, NutritionProduct.NutritionProductInstanceComponent res) throws IOException, FHIRFormatError {
24044    parseBackboneElementProperties(json, res);
24045    if (json.has("quantity"))
24046      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
24047    if (json.has("identifier")) {
24048      JsonArray array = getJArray(json, "identifier");
24049      for (int i = 0; i < array.size(); i++) {
24050        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24051      }
24052    };
24053    if (json.has("name"))
24054      res.setNameElement(parseString(json.get("name").getAsString()));
24055    if (json.has("_name"))
24056      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24057    if (json.has("lotNumber"))
24058      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
24059    if (json.has("_lotNumber"))
24060      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
24061    if (json.has("expiry"))
24062      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
24063    if (json.has("_expiry"))
24064      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
24065    if (json.has("useBy"))
24066      res.setUseByElement(parseDateTime(json.get("useBy").getAsString()));
24067    if (json.has("_useBy"))
24068      parseElementProperties(getJObject(json, "_useBy"), res.getUseByElement());
24069    if (json.has("biologicalSourceEvent"))
24070      res.setBiologicalSourceEvent(parseIdentifier(getJObject(json, "biologicalSourceEvent")));
24071  }
24072
24073  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
24074    Observation res = new Observation();
24075    parseObservationProperties(json, res);
24076    return res;
24077  }
24078
24079  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
24080    parseDomainResourceProperties(json, res);
24081    if (json.has("identifier")) {
24082      JsonArray array = getJArray(json, "identifier");
24083      for (int i = 0; i < array.size(); i++) {
24084        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24085      }
24086    };
24087    DataType instantiates = parseType("instantiates", json);
24088    if (instantiates != null)
24089      res.setInstantiates(instantiates);
24090    if (json.has("basedOn")) {
24091      JsonArray array = getJArray(json, "basedOn");
24092      for (int i = 0; i < array.size(); i++) {
24093        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
24094      }
24095    };
24096    if (json.has("triggeredBy")) {
24097      JsonArray array = getJArray(json, "triggeredBy");
24098      for (int i = 0; i < array.size(); i++) {
24099        res.getTriggeredBy().add(parseObservationTriggeredByComponent(array.get(i).getAsJsonObject()));
24100      }
24101    };
24102    if (json.has("partOf")) {
24103      JsonArray array = getJArray(json, "partOf");
24104      for (int i = 0; i < array.size(); i++) {
24105        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
24106      }
24107    };
24108    if (json.has("status"))
24109      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
24110    if (json.has("_status"))
24111      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24112    if (json.has("category")) {
24113      JsonArray array = getJArray(json, "category");
24114      for (int i = 0; i < array.size(); i++) {
24115        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24116      }
24117    };
24118    if (json.has("code"))
24119      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24120    if (json.has("subject"))
24121      res.setSubject(parseReference(getJObject(json, "subject")));
24122    if (json.has("focus")) {
24123      JsonArray array = getJArray(json, "focus");
24124      for (int i = 0; i < array.size(); i++) {
24125        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
24126      }
24127    };
24128    if (json.has("encounter"))
24129      res.setEncounter(parseReference(getJObject(json, "encounter")));
24130    DataType effective = parseType("effective", json);
24131    if (effective != null)
24132      res.setEffective(effective);
24133    if (json.has("issued"))
24134      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
24135    if (json.has("_issued"))
24136      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
24137    if (json.has("performer")) {
24138      JsonArray array = getJArray(json, "performer");
24139      for (int i = 0; i < array.size(); i++) {
24140        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
24141      }
24142    };
24143    DataType value = parseType("value", json);
24144    if (value != null)
24145      res.setValue(value);
24146    if (json.has("dataAbsentReason"))
24147      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
24148    if (json.has("interpretation")) {
24149      JsonArray array = getJArray(json, "interpretation");
24150      for (int i = 0; i < array.size(); i++) {
24151        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24152      }
24153    };
24154    if (json.has("note")) {
24155      JsonArray array = getJArray(json, "note");
24156      for (int i = 0; i < array.size(); i++) {
24157        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24158      }
24159    };
24160    if (json.has("bodySite"))
24161      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
24162    if (json.has("bodyStructure"))
24163      res.setBodyStructure(parseReference(getJObject(json, "bodyStructure")));
24164    if (json.has("method"))
24165      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
24166    if (json.has("specimen"))
24167      res.setSpecimen(parseReference(getJObject(json, "specimen")));
24168    if (json.has("device"))
24169      res.setDevice(parseReference(getJObject(json, "device")));
24170    if (json.has("referenceRange")) {
24171      JsonArray array = getJArray(json, "referenceRange");
24172      for (int i = 0; i < array.size(); i++) {
24173        res.getReferenceRange().add(parseObservationReferenceRangeComponent(array.get(i).getAsJsonObject()));
24174      }
24175    };
24176    if (json.has("hasMember")) {
24177      JsonArray array = getJArray(json, "hasMember");
24178      for (int i = 0; i < array.size(); i++) {
24179        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
24180      }
24181    };
24182    if (json.has("derivedFrom")) {
24183      JsonArray array = getJArray(json, "derivedFrom");
24184      for (int i = 0; i < array.size(); i++) {
24185        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
24186      }
24187    };
24188    if (json.has("component")) {
24189      JsonArray array = getJArray(json, "component");
24190      for (int i = 0; i < array.size(); i++) {
24191        res.getComponent().add(parseObservationComponentComponent(array.get(i).getAsJsonObject()));
24192      }
24193    };
24194  }
24195
24196  protected Observation.ObservationTriggeredByComponent parseObservationTriggeredByComponent(JsonObject json) throws IOException, FHIRFormatError {
24197    Observation.ObservationTriggeredByComponent res = new Observation.ObservationTriggeredByComponent();
24198    parseObservationTriggeredByComponentProperties(json, res);
24199    return res;
24200  }
24201
24202  protected void parseObservationTriggeredByComponentProperties(JsonObject json, Observation.ObservationTriggeredByComponent res) throws IOException, FHIRFormatError {
24203    parseBackboneElementProperties(json, res);
24204    if (json.has("observation"))
24205      res.setObservation(parseReference(getJObject(json, "observation")));
24206    if (json.has("type"))
24207      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Observation.TriggeredBytype.NULL, new Observation.TriggeredBytypeEnumFactory()));
24208    if (json.has("_type"))
24209      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24210    if (json.has("reason"))
24211      res.setReasonElement(parseString(json.get("reason").getAsString()));
24212    if (json.has("_reason"))
24213      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
24214  }
24215
24216  protected Observation.ObservationReferenceRangeComponent parseObservationReferenceRangeComponent(JsonObject json) throws IOException, FHIRFormatError {
24217    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
24218    parseObservationReferenceRangeComponentProperties(json, res);
24219    return res;
24220  }
24221
24222  protected void parseObservationReferenceRangeComponentProperties(JsonObject json, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
24223    parseBackboneElementProperties(json, res);
24224    if (json.has("low"))
24225      res.setLow(parseQuantity(getJObject(json, "low")));
24226    if (json.has("high"))
24227      res.setHigh(parseQuantity(getJObject(json, "high")));
24228    if (json.has("normalValue"))
24229      res.setNormalValue(parseCodeableConcept(getJObject(json, "normalValue")));
24230    if (json.has("type"))
24231      res.setType(parseCodeableConcept(getJObject(json, "type")));
24232    if (json.has("appliesTo")) {
24233      JsonArray array = getJArray(json, "appliesTo");
24234      for (int i = 0; i < array.size(); i++) {
24235        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24236      }
24237    };
24238    if (json.has("age"))
24239      res.setAge(parseRange(getJObject(json, "age")));
24240    if (json.has("text"))
24241      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
24242    if (json.has("_text"))
24243      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
24244  }
24245
24246  protected Observation.ObservationComponentComponent parseObservationComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
24247    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
24248    parseObservationComponentComponentProperties(json, res);
24249    return res;
24250  }
24251
24252  protected void parseObservationComponentComponentProperties(JsonObject json, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
24253    parseBackboneElementProperties(json, res);
24254    if (json.has("code"))
24255      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24256    DataType value = parseType("value", json);
24257    if (value != null)
24258      res.setValue(value);
24259    if (json.has("dataAbsentReason"))
24260      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
24261    if (json.has("interpretation")) {
24262      JsonArray array = getJArray(json, "interpretation");
24263      for (int i = 0; i < array.size(); i++) {
24264        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24265      }
24266    };
24267    if (json.has("referenceRange")) {
24268      JsonArray array = getJArray(json, "referenceRange");
24269      for (int i = 0; i < array.size(); i++) {
24270        res.getReferenceRange().add(parseObservationReferenceRangeComponent(array.get(i).getAsJsonObject()));
24271      }
24272    };
24273  }
24274
24275  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
24276    ObservationDefinition res = new ObservationDefinition();
24277    parseObservationDefinitionProperties(json, res);
24278    return res;
24279  }
24280
24281  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
24282    parseDomainResourceProperties(json, res);
24283    if (json.has("url"))
24284      res.setUrlElement(parseUri(json.get("url").getAsString()));
24285    if (json.has("_url"))
24286      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24287    if (json.has("identifier"))
24288      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24289    if (json.has("version"))
24290      res.setVersionElement(parseString(json.get("version").getAsString()));
24291    if (json.has("_version"))
24292      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
24293    DataType versionAlgorithm = parseType("versionAlgorithm", json);
24294    if (versionAlgorithm != null)
24295      res.setVersionAlgorithm(versionAlgorithm);
24296    if (json.has("name"))
24297      res.setNameElement(parseString(json.get("name").getAsString()));
24298    if (json.has("_name"))
24299      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24300    if (json.has("title"))
24301      res.setTitleElement(parseString(json.get("title").getAsString()));
24302    if (json.has("_title"))
24303      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
24304    if (json.has("status"))
24305      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24306    if (json.has("_status"))
24307      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24308    if (json.has("experimental"))
24309      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24310    if (json.has("_experimental"))
24311      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
24312    if (json.has("date"))
24313      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24314    if (json.has("_date"))
24315      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
24316    if (json.has("publisher"))
24317      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24318    if (json.has("_publisher"))
24319      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
24320    if (json.has("contact")) {
24321      JsonArray array = getJArray(json, "contact");
24322      for (int i = 0; i < array.size(); i++) {
24323        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24324      }
24325    };
24326    if (json.has("description"))
24327      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24328    if (json.has("_description"))
24329      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24330    if (json.has("useContext")) {
24331      JsonArray array = getJArray(json, "useContext");
24332      for (int i = 0; i < array.size(); i++) {
24333        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24334      }
24335    };
24336    if (json.has("jurisdiction")) {
24337      JsonArray array = getJArray(json, "jurisdiction");
24338      for (int i = 0; i < array.size(); i++) {
24339        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24340      }
24341    };
24342    if (json.has("purpose"))
24343      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24344    if (json.has("_purpose"))
24345      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
24346    if (json.has("copyright"))
24347      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24348    if (json.has("_copyright"))
24349      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
24350    if (json.has("copyrightLabel"))
24351      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
24352    if (json.has("_copyrightLabel"))
24353      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
24354    if (json.has("approvalDate"))
24355      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
24356    if (json.has("_approvalDate"))
24357      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
24358    if (json.has("lastReviewDate"))
24359      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
24360    if (json.has("_lastReviewDate"))
24361      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
24362    if (json.has("effectivePeriod"))
24363      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
24364    if (json.has("derivedFromCanonical")) {
24365      JsonArray array = getJArray(json, "derivedFromCanonical");
24366      for (int i = 0; i < array.size(); i++) {
24367        if (array.get(i).isJsonNull()) {
24368          res.getDerivedFromCanonical().add(new CanonicalType());
24369        } else {;
24370          res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
24371        }
24372      }
24373    };
24374    if (json.has("_derivedFromCanonical")) {
24375      JsonArray array = getJArray(json, "_derivedFromCanonical");
24376      for (int i = 0; i < array.size(); i++) {
24377        if (i == res.getDerivedFromCanonical().size())
24378          res.getDerivedFromCanonical().add(parseCanonical(null));
24379        if (array.get(i) instanceof JsonObject) 
24380          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
24381      }
24382    };
24383    if (json.has("derivedFromUri")) {
24384      JsonArray array = getJArray(json, "derivedFromUri");
24385      for (int i = 0; i < array.size(); i++) {
24386        if (array.get(i).isJsonNull()) {
24387          res.getDerivedFromUri().add(new UriType());
24388        } else {;
24389          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
24390        }
24391      }
24392    };
24393    if (json.has("_derivedFromUri")) {
24394      JsonArray array = getJArray(json, "_derivedFromUri");
24395      for (int i = 0; i < array.size(); i++) {
24396        if (i == res.getDerivedFromUri().size())
24397          res.getDerivedFromUri().add(parseUri(null));
24398        if (array.get(i) instanceof JsonObject) 
24399          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
24400      }
24401    };
24402    if (json.has("subject")) {
24403      JsonArray array = getJArray(json, "subject");
24404      for (int i = 0; i < array.size(); i++) {
24405        res.getSubject().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24406      }
24407    };
24408    if (json.has("performerType"))
24409      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
24410    if (json.has("category")) {
24411      JsonArray array = getJArray(json, "category");
24412      for (int i = 0; i < array.size(); i++) {
24413        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24414      }
24415    };
24416    if (json.has("code"))
24417      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24418    if (json.has("permittedDataType")) {
24419      JsonArray array = getJArray(json, "permittedDataType");
24420      for (int i = 0; i < array.size(); i++) {
24421        if (array.get(i).isJsonNull()) {
24422          res.getPermittedDataType().add(new Enumeration<ObservationDefinition.ObservationDataType>(new ObservationDefinition.ObservationDataTypeEnumFactory(), ObservationDefinition.ObservationDataType.NULL));
24423        } else {;
24424          res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
24425        }
24426      }
24427    };
24428    if (json.has("_permittedDataType")) {
24429      JsonArray array = getJArray(json, "_permittedDataType");
24430      for (int i = 0; i < array.size(); i++) {
24431        if (i == res.getPermittedDataType().size())
24432          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
24433        if (array.get(i) instanceof JsonObject) 
24434          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
24435      }
24436    };
24437    if (json.has("multipleResultsAllowed"))
24438      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
24439    if (json.has("_multipleResultsAllowed"))
24440      parseElementProperties(getJObject(json, "_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
24441    if (json.has("bodySite"))
24442      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
24443    if (json.has("method"))
24444      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
24445    if (json.has("specimen")) {
24446      JsonArray array = getJArray(json, "specimen");
24447      for (int i = 0; i < array.size(); i++) {
24448        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
24449      }
24450    };
24451    if (json.has("device")) {
24452      JsonArray array = getJArray(json, "device");
24453      for (int i = 0; i < array.size(); i++) {
24454        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
24455      }
24456    };
24457    if (json.has("preferredReportName"))
24458      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
24459    if (json.has("_preferredReportName"))
24460      parseElementProperties(getJObject(json, "_preferredReportName"), res.getPreferredReportNameElement());
24461    if (json.has("permittedUnit")) {
24462      JsonArray array = getJArray(json, "permittedUnit");
24463      for (int i = 0; i < array.size(); i++) {
24464        res.getPermittedUnit().add(parseCoding(array.get(i).getAsJsonObject()));
24465      }
24466    };
24467    if (json.has("qualifiedValue")) {
24468      JsonArray array = getJArray(json, "qualifiedValue");
24469      for (int i = 0; i < array.size(); i++) {
24470        res.getQualifiedValue().add(parseObservationDefinitionQualifiedValueComponent(array.get(i).getAsJsonObject()));
24471      }
24472    };
24473    if (json.has("hasMember")) {
24474      JsonArray array = getJArray(json, "hasMember");
24475      for (int i = 0; i < array.size(); i++) {
24476        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
24477      }
24478    };
24479    if (json.has("component")) {
24480      JsonArray array = getJArray(json, "component");
24481      for (int i = 0; i < array.size(); i++) {
24482        res.getComponent().add(parseObservationDefinitionComponentComponent(array.get(i).getAsJsonObject()));
24483      }
24484    };
24485  }
24486
24487  protected ObservationDefinition.ObservationDefinitionQualifiedValueComponent parseObservationDefinitionQualifiedValueComponent(JsonObject json) throws IOException, FHIRFormatError {
24488    ObservationDefinition.ObservationDefinitionQualifiedValueComponent res = new ObservationDefinition.ObservationDefinitionQualifiedValueComponent();
24489    parseObservationDefinitionQualifiedValueComponentProperties(json, res);
24490    return res;
24491  }
24492
24493  protected void parseObservationDefinitionQualifiedValueComponentProperties(JsonObject json, ObservationDefinition.ObservationDefinitionQualifiedValueComponent res) throws IOException, FHIRFormatError {
24494    parseBackboneElementProperties(json, res);
24495    if (json.has("context"))
24496      res.setContext(parseCodeableConcept(getJObject(json, "context")));
24497    if (json.has("appliesTo")) {
24498      JsonArray array = getJArray(json, "appliesTo");
24499      for (int i = 0; i < array.size(); i++) {
24500        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24501      }
24502    };
24503    if (json.has("gender"))
24504      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
24505    if (json.has("_gender"))
24506      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
24507    if (json.has("age"))
24508      res.setAge(parseRange(getJObject(json, "age")));
24509    if (json.has("gestationalAge"))
24510      res.setGestationalAge(parseRange(getJObject(json, "gestationalAge")));
24511    if (json.has("condition"))
24512      res.setConditionElement(parseString(json.get("condition").getAsString()));
24513    if (json.has("_condition"))
24514      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
24515    if (json.has("rangeCategory"))
24516      res.setRangeCategoryElement(parseEnumeration(json.get("rangeCategory").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
24517    if (json.has("_rangeCategory"))
24518      parseElementProperties(getJObject(json, "_rangeCategory"), res.getRangeCategoryElement());
24519    if (json.has("range"))
24520      res.setRange(parseRange(getJObject(json, "range")));
24521    if (json.has("validCodedValueSet"))
24522      res.setValidCodedValueSetElement(parseCanonical(json.get("validCodedValueSet").getAsString()));
24523    if (json.has("_validCodedValueSet"))
24524      parseElementProperties(getJObject(json, "_validCodedValueSet"), res.getValidCodedValueSetElement());
24525    if (json.has("normalCodedValueSet"))
24526      res.setNormalCodedValueSetElement(parseCanonical(json.get("normalCodedValueSet").getAsString()));
24527    if (json.has("_normalCodedValueSet"))
24528      parseElementProperties(getJObject(json, "_normalCodedValueSet"), res.getNormalCodedValueSetElement());
24529    if (json.has("abnormalCodedValueSet"))
24530      res.setAbnormalCodedValueSetElement(parseCanonical(json.get("abnormalCodedValueSet").getAsString()));
24531    if (json.has("_abnormalCodedValueSet"))
24532      parseElementProperties(getJObject(json, "_abnormalCodedValueSet"), res.getAbnormalCodedValueSetElement());
24533    if (json.has("criticalCodedValueSet"))
24534      res.setCriticalCodedValueSetElement(parseCanonical(json.get("criticalCodedValueSet").getAsString()));
24535    if (json.has("_criticalCodedValueSet"))
24536      parseElementProperties(getJObject(json, "_criticalCodedValueSet"), res.getCriticalCodedValueSetElement());
24537  }
24538
24539  protected ObservationDefinition.ObservationDefinitionComponentComponent parseObservationDefinitionComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
24540    ObservationDefinition.ObservationDefinitionComponentComponent res = new ObservationDefinition.ObservationDefinitionComponentComponent();
24541    parseObservationDefinitionComponentComponentProperties(json, res);
24542    return res;
24543  }
24544
24545  protected void parseObservationDefinitionComponentComponentProperties(JsonObject json, ObservationDefinition.ObservationDefinitionComponentComponent res) throws IOException, FHIRFormatError {
24546    parseBackboneElementProperties(json, res);
24547    if (json.has("code"))
24548      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24549    if (json.has("permittedDataType")) {
24550      JsonArray array = getJArray(json, "permittedDataType");
24551      for (int i = 0; i < array.size(); i++) {
24552        if (array.get(i).isJsonNull()) {
24553          res.getPermittedDataType().add(new Enumeration<ObservationDefinition.ObservationDataType>(new ObservationDefinition.ObservationDataTypeEnumFactory(), ObservationDefinition.ObservationDataType.NULL));
24554        } else {;
24555          res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
24556        }
24557      }
24558    };
24559    if (json.has("_permittedDataType")) {
24560      JsonArray array = getJArray(json, "_permittedDataType");
24561      for (int i = 0; i < array.size(); i++) {
24562        if (i == res.getPermittedDataType().size())
24563          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
24564        if (array.get(i) instanceof JsonObject) 
24565          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
24566      }
24567    };
24568    if (json.has("permittedUnit")) {
24569      JsonArray array = getJArray(json, "permittedUnit");
24570      for (int i = 0; i < array.size(); i++) {
24571        res.getPermittedUnit().add(parseCoding(array.get(i).getAsJsonObject()));
24572      }
24573    };
24574    if (json.has("qualifiedValue")) {
24575      JsonArray array = getJArray(json, "qualifiedValue");
24576      for (int i = 0; i < array.size(); i++) {
24577        res.getQualifiedValue().add(parseObservationDefinitionQualifiedValueComponent(array.get(i).getAsJsonObject()));
24578      }
24579    };
24580  }
24581
24582  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
24583    OperationDefinition res = new OperationDefinition();
24584    parseOperationDefinitionProperties(json, res);
24585    return res;
24586  }
24587
24588  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
24589    parseCanonicalResourceProperties(json, res);
24590    if (json.has("url"))
24591      res.setUrlElement(parseUri(json.get("url").getAsString()));
24592    if (json.has("_url"))
24593      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24594    if (json.has("identifier")) {
24595      JsonArray array = getJArray(json, "identifier");
24596      for (int i = 0; i < array.size(); i++) {
24597        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24598      }
24599    };
24600    if (json.has("version"))
24601      res.setVersionElement(parseString(json.get("version").getAsString()));
24602    if (json.has("_version"))
24603      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
24604    DataType versionAlgorithm = parseType("versionAlgorithm", json);
24605    if (versionAlgorithm != null)
24606      res.setVersionAlgorithm(versionAlgorithm);
24607    if (json.has("name"))
24608      res.setNameElement(parseString(json.get("name").getAsString()));
24609    if (json.has("_name"))
24610      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24611    if (json.has("title"))
24612      res.setTitleElement(parseString(json.get("title").getAsString()));
24613    if (json.has("_title"))
24614      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
24615    if (json.has("status"))
24616      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24617    if (json.has("_status"))
24618      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24619    if (json.has("kind"))
24620      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
24621    if (json.has("_kind"))
24622      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
24623    if (json.has("experimental"))
24624      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24625    if (json.has("_experimental"))
24626      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
24627    if (json.has("date"))
24628      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24629    if (json.has("_date"))
24630      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
24631    if (json.has("publisher"))
24632      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24633    if (json.has("_publisher"))
24634      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
24635    if (json.has("contact")) {
24636      JsonArray array = getJArray(json, "contact");
24637      for (int i = 0; i < array.size(); i++) {
24638        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24639      }
24640    };
24641    if (json.has("description"))
24642      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24643    if (json.has("_description"))
24644      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24645    if (json.has("useContext")) {
24646      JsonArray array = getJArray(json, "useContext");
24647      for (int i = 0; i < array.size(); i++) {
24648        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24649      }
24650    };
24651    if (json.has("jurisdiction")) {
24652      JsonArray array = getJArray(json, "jurisdiction");
24653      for (int i = 0; i < array.size(); i++) {
24654        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24655      }
24656    };
24657    if (json.has("purpose"))
24658      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24659    if (json.has("_purpose"))
24660      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
24661    if (json.has("copyright"))
24662      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24663    if (json.has("_copyright"))
24664      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
24665    if (json.has("copyrightLabel"))
24666      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
24667    if (json.has("_copyrightLabel"))
24668      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
24669    if (json.has("affectsState"))
24670      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
24671    if (json.has("_affectsState"))
24672      parseElementProperties(getJObject(json, "_affectsState"), res.getAffectsStateElement());
24673    if (json.has("code"))
24674      res.setCodeElement(parseCode(json.get("code").getAsString()));
24675    if (json.has("_code"))
24676      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
24677    if (json.has("comment"))
24678      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
24679    if (json.has("_comment"))
24680      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
24681    if (json.has("base"))
24682      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
24683    if (json.has("_base"))
24684      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
24685    if (json.has("resource")) {
24686      JsonArray array = getJArray(json, "resource");
24687      for (int i = 0; i < array.size(); i++) {
24688        if (array.get(i).isJsonNull()) {
24689          res.getResource().add(new Enumeration<Enumerations.VersionIndependentResourceTypesAll>(new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), Enumerations.VersionIndependentResourceTypesAll.NULL));
24690        } else {;
24691          res.getResource().add(parseEnumeration(array.get(i).getAsString(), Enumerations.VersionIndependentResourceTypesAll.NULL, new Enumerations.VersionIndependentResourceTypesAllEnumFactory()));
24692        }
24693      }
24694    };
24695    if (json.has("_resource")) {
24696      JsonArray array = getJArray(json, "_resource");
24697      for (int i = 0; i < array.size(); i++) {
24698        if (i == res.getResource().size())
24699          res.getResource().add(parseEnumeration(null, Enumerations.VersionIndependentResourceTypesAll.NULL, new Enumerations.VersionIndependentResourceTypesAllEnumFactory()));
24700        if (array.get(i) instanceof JsonObject) 
24701          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
24702      }
24703    };
24704    if (json.has("system"))
24705      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
24706    if (json.has("_system"))
24707      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
24708    if (json.has("type"))
24709      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
24710    if (json.has("_type"))
24711      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24712    if (json.has("instance"))
24713      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
24714    if (json.has("_instance"))
24715      parseElementProperties(getJObject(json, "_instance"), res.getInstanceElement());
24716    if (json.has("inputProfile"))
24717      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
24718    if (json.has("_inputProfile"))
24719      parseElementProperties(getJObject(json, "_inputProfile"), res.getInputProfileElement());
24720    if (json.has("outputProfile"))
24721      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
24722    if (json.has("_outputProfile"))
24723      parseElementProperties(getJObject(json, "_outputProfile"), res.getOutputProfileElement());
24724    if (json.has("parameter")) {
24725      JsonArray array = getJArray(json, "parameter");
24726      for (int i = 0; i < array.size(); i++) {
24727        res.getParameter().add(parseOperationDefinitionParameterComponent(array.get(i).getAsJsonObject()));
24728      }
24729    };
24730    if (json.has("overload")) {
24731      JsonArray array = getJArray(json, "overload");
24732      for (int i = 0; i < array.size(); i++) {
24733        res.getOverload().add(parseOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject()));
24734      }
24735    };
24736  }
24737
24738  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
24739    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
24740    parseOperationDefinitionParameterComponentProperties(json, res);
24741    return res;
24742  }
24743
24744  protected void parseOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
24745    parseBackboneElementProperties(json, res);
24746    if (json.has("name"))
24747      res.setNameElement(parseCode(json.get("name").getAsString()));
24748    if (json.has("_name"))
24749      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24750    if (json.has("use"))
24751      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
24752    if (json.has("_use"))
24753      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
24754    if (json.has("scope")) {
24755      JsonArray array = getJArray(json, "scope");
24756      for (int i = 0; i < array.size(); i++) {
24757        if (array.get(i).isJsonNull()) {
24758          res.getScope().add(new Enumeration<OperationDefinition.OperationParameterScope>(new OperationDefinition.OperationParameterScopeEnumFactory(), OperationDefinition.OperationParameterScope.NULL));
24759        } else {;
24760          res.getScope().add(parseEnumeration(array.get(i).getAsString(), OperationDefinition.OperationParameterScope.NULL, new OperationDefinition.OperationParameterScopeEnumFactory()));
24761        }
24762      }
24763    };
24764    if (json.has("_scope")) {
24765      JsonArray array = getJArray(json, "_scope");
24766      for (int i = 0; i < array.size(); i++) {
24767        if (i == res.getScope().size())
24768          res.getScope().add(parseEnumeration(null, OperationDefinition.OperationParameterScope.NULL, new OperationDefinition.OperationParameterScopeEnumFactory()));
24769        if (array.get(i) instanceof JsonObject) 
24770          parseElementProperties(array.get(i).getAsJsonObject(), res.getScope().get(i));
24771      }
24772    };
24773    if (json.has("min"))
24774      res.setMinElement(parseInteger(json.get("min").getAsLong()));
24775    if (json.has("_min"))
24776      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
24777    if (json.has("max"))
24778      res.setMaxElement(parseString(json.get("max").getAsString()));
24779    if (json.has("_max"))
24780      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
24781    if (json.has("documentation"))
24782      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
24783    if (json.has("_documentation"))
24784      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
24785    if (json.has("type"))
24786      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
24787    if (json.has("_type"))
24788      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24789    if (json.has("allowedType")) {
24790      JsonArray array = getJArray(json, "allowedType");
24791      for (int i = 0; i < array.size(); i++) {
24792        if (array.get(i).isJsonNull()) {
24793          res.getAllowedType().add(new Enumeration<Enumerations.FHIRTypes>(new Enumerations.FHIRTypesEnumFactory(), Enumerations.FHIRTypes.NULL));
24794        } else {;
24795          res.getAllowedType().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
24796        }
24797      }
24798    };
24799    if (json.has("_allowedType")) {
24800      JsonArray array = getJArray(json, "_allowedType");
24801      for (int i = 0; i < array.size(); i++) {
24802        if (i == res.getAllowedType().size())
24803          res.getAllowedType().add(parseEnumeration(null, Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
24804        if (array.get(i) instanceof JsonObject) 
24805          parseElementProperties(array.get(i).getAsJsonObject(), res.getAllowedType().get(i));
24806      }
24807    };
24808    if (json.has("targetProfile")) {
24809      JsonArray array = getJArray(json, "targetProfile");
24810      for (int i = 0; i < array.size(); i++) {
24811        if (array.get(i).isJsonNull()) {
24812          res.getTargetProfile().add(new CanonicalType());
24813        } else {;
24814          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
24815        }
24816      }
24817    };
24818    if (json.has("_targetProfile")) {
24819      JsonArray array = getJArray(json, "_targetProfile");
24820      for (int i = 0; i < array.size(); i++) {
24821        if (i == res.getTargetProfile().size())
24822          res.getTargetProfile().add(parseCanonical(null));
24823        if (array.get(i) instanceof JsonObject) 
24824          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
24825      }
24826    };
24827    if (json.has("searchType"))
24828      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
24829    if (json.has("_searchType"))
24830      parseElementProperties(getJObject(json, "_searchType"), res.getSearchTypeElement());
24831    if (json.has("binding"))
24832      res.setBinding(parseOperationDefinitionParameterBindingComponent(getJObject(json, "binding")));
24833    if (json.has("referencedFrom")) {
24834      JsonArray array = getJArray(json, "referencedFrom");
24835      for (int i = 0; i < array.size(); i++) {
24836        res.getReferencedFrom().add(parseOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject()));
24837      }
24838    };
24839    if (json.has("part")) {
24840      JsonArray array = getJArray(json, "part");
24841      for (int i = 0; i < array.size(); i++) {
24842        res.getPart().add(parseOperationDefinitionParameterComponent(array.get(i).getAsJsonObject()));
24843      }
24844    };
24845  }
24846
24847  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionParameterBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
24848    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
24849    parseOperationDefinitionParameterBindingComponentProperties(json, res);
24850    return res;
24851  }
24852
24853  protected void parseOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
24854    parseBackboneElementProperties(json, res);
24855    if (json.has("strength"))
24856      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
24857    if (json.has("_strength"))
24858      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
24859    if (json.has("valueSet"))
24860      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
24861    if (json.has("_valueSet"))
24862      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
24863  }
24864
24865  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionParameterReferencedFromComponent(JsonObject json) throws IOException, FHIRFormatError {
24866    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
24867    parseOperationDefinitionParameterReferencedFromComponentProperties(json, res);
24868    return res;
24869  }
24870
24871  protected void parseOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
24872    parseBackboneElementProperties(json, res);
24873    if (json.has("source"))
24874      res.setSourceElement(parseString(json.get("source").getAsString()));
24875    if (json.has("_source"))
24876      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
24877    if (json.has("sourceId"))
24878      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
24879    if (json.has("_sourceId"))
24880      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
24881  }
24882
24883  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOverloadComponent(JsonObject json) throws IOException, FHIRFormatError {
24884    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
24885    parseOperationDefinitionOverloadComponentProperties(json, res);
24886    return res;
24887  }
24888
24889  protected void parseOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
24890    parseBackboneElementProperties(json, res);
24891    if (json.has("parameterName")) {
24892      JsonArray array = getJArray(json, "parameterName");
24893      for (int i = 0; i < array.size(); i++) {
24894        if (array.get(i).isJsonNull()) {
24895          res.getParameterName().add(new StringType());
24896        } else {;
24897          res.getParameterName().add(parseString(array.get(i).getAsString()));
24898        }
24899      }
24900    };
24901    if (json.has("_parameterName")) {
24902      JsonArray array = getJArray(json, "_parameterName");
24903      for (int i = 0; i < array.size(); i++) {
24904        if (i == res.getParameterName().size())
24905          res.getParameterName().add(parseString(null));
24906        if (array.get(i) instanceof JsonObject) 
24907          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
24908      }
24909    };
24910    if (json.has("comment"))
24911      res.setCommentElement(parseString(json.get("comment").getAsString()));
24912    if (json.has("_comment"))
24913      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
24914  }
24915
24916  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
24917    OperationOutcome res = new OperationOutcome();
24918    parseOperationOutcomeProperties(json, res);
24919    return res;
24920  }
24921
24922  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
24923    parseDomainResourceProperties(json, res);
24924    if (json.has("issue")) {
24925      JsonArray array = getJArray(json, "issue");
24926      for (int i = 0; i < array.size(); i++) {
24927        res.getIssue().add(parseOperationOutcomeIssueComponent(array.get(i).getAsJsonObject()));
24928      }
24929    };
24930  }
24931
24932  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeIssueComponent(JsonObject json) throws IOException, FHIRFormatError {
24933    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
24934    parseOperationOutcomeIssueComponentProperties(json, res);
24935    return res;
24936  }
24937
24938  protected void parseOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
24939    parseBackboneElementProperties(json, res);
24940    if (json.has("severity"))
24941      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
24942    if (json.has("_severity"))
24943      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
24944    if (json.has("code"))
24945      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
24946    if (json.has("_code"))
24947      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
24948    if (json.has("details"))
24949      res.setDetails(parseCodeableConcept(getJObject(json, "details")));
24950    if (json.has("diagnostics"))
24951      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
24952    if (json.has("_diagnostics"))
24953      parseElementProperties(getJObject(json, "_diagnostics"), res.getDiagnosticsElement());
24954    if (json.has("location")) {
24955      JsonArray array = getJArray(json, "location");
24956      for (int i = 0; i < array.size(); i++) {
24957        if (array.get(i).isJsonNull()) {
24958          res.getLocation().add(new StringType());
24959        } else {;
24960          res.getLocation().add(parseString(array.get(i).getAsString()));
24961        }
24962      }
24963    };
24964    if (json.has("_location")) {
24965      JsonArray array = getJArray(json, "_location");
24966      for (int i = 0; i < array.size(); i++) {
24967        if (i == res.getLocation().size())
24968          res.getLocation().add(parseString(null));
24969        if (array.get(i) instanceof JsonObject) 
24970          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
24971      }
24972    };
24973    if (json.has("expression")) {
24974      JsonArray array = getJArray(json, "expression");
24975      for (int i = 0; i < array.size(); i++) {
24976        if (array.get(i).isJsonNull()) {
24977          res.getExpression().add(new StringType());
24978        } else {;
24979          res.getExpression().add(parseString(array.get(i).getAsString()));
24980        }
24981      }
24982    };
24983    if (json.has("_expression")) {
24984      JsonArray array = getJArray(json, "_expression");
24985      for (int i = 0; i < array.size(); i++) {
24986        if (i == res.getExpression().size())
24987          res.getExpression().add(parseString(null));
24988        if (array.get(i) instanceof JsonObject) 
24989          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
24990      }
24991    };
24992  }
24993
24994  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
24995    Organization res = new Organization();
24996    parseOrganizationProperties(json, res);
24997    return res;
24998  }
24999
25000  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
25001    parseDomainResourceProperties(json, res);
25002    if (json.has("identifier")) {
25003      JsonArray array = getJArray(json, "identifier");
25004      for (int i = 0; i < array.size(); i++) {
25005        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25006      }
25007    };
25008    if (json.has("active"))
25009      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
25010    if (json.has("_active"))
25011      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
25012    if (json.has("type")) {
25013      JsonArray array = getJArray(json, "type");
25014      for (int i = 0; i < array.size(); i++) {
25015        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25016      }
25017    };
25018    if (json.has("name"))
25019      res.setNameElement(parseString(json.get("name").getAsString()));
25020    if (json.has("_name"))
25021      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25022    if (json.has("alias")) {
25023      JsonArray array = getJArray(json, "alias");
25024      for (int i = 0; i < array.size(); i++) {
25025        if (array.get(i).isJsonNull()) {
25026          res.getAlias().add(new StringType());
25027        } else {;
25028          res.getAlias().add(parseString(array.get(i).getAsString()));
25029        }
25030      }
25031    };
25032    if (json.has("_alias")) {
25033      JsonArray array = getJArray(json, "_alias");
25034      for (int i = 0; i < array.size(); i++) {
25035        if (i == res.getAlias().size())
25036          res.getAlias().add(parseString(null));
25037        if (array.get(i) instanceof JsonObject) 
25038          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
25039      }
25040    };
25041    if (json.has("description"))
25042      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25043    if (json.has("_description"))
25044      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25045    if (json.has("contact")) {
25046      JsonArray array = getJArray(json, "contact");
25047      for (int i = 0; i < array.size(); i++) {
25048        res.getContact().add(parseExtendedContactDetail(array.get(i).getAsJsonObject()));
25049      }
25050    };
25051    if (json.has("partOf"))
25052      res.setPartOf(parseReference(getJObject(json, "partOf")));
25053    if (json.has("endpoint")) {
25054      JsonArray array = getJArray(json, "endpoint");
25055      for (int i = 0; i < array.size(); i++) {
25056        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
25057      }
25058    };
25059    if (json.has("qualification")) {
25060      JsonArray array = getJArray(json, "qualification");
25061      for (int i = 0; i < array.size(); i++) {
25062        res.getQualification().add(parseOrganizationQualificationComponent(array.get(i).getAsJsonObject()));
25063      }
25064    };
25065  }
25066
25067  protected Organization.OrganizationQualificationComponent parseOrganizationQualificationComponent(JsonObject json) throws IOException, FHIRFormatError {
25068    Organization.OrganizationQualificationComponent res = new Organization.OrganizationQualificationComponent();
25069    parseOrganizationQualificationComponentProperties(json, res);
25070    return res;
25071  }
25072
25073  protected void parseOrganizationQualificationComponentProperties(JsonObject json, Organization.OrganizationQualificationComponent res) throws IOException, FHIRFormatError {
25074    parseBackboneElementProperties(json, res);
25075    if (json.has("identifier")) {
25076      JsonArray array = getJArray(json, "identifier");
25077      for (int i = 0; i < array.size(); i++) {
25078        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25079      }
25080    };
25081    if (json.has("code"))
25082      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25083    if (json.has("period"))
25084      res.setPeriod(parsePeriod(getJObject(json, "period")));
25085    if (json.has("issuer"))
25086      res.setIssuer(parseReference(getJObject(json, "issuer")));
25087  }
25088
25089  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
25090    OrganizationAffiliation res = new OrganizationAffiliation();
25091    parseOrganizationAffiliationProperties(json, res);
25092    return res;
25093  }
25094
25095  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
25096    parseDomainResourceProperties(json, res);
25097    if (json.has("identifier")) {
25098      JsonArray array = getJArray(json, "identifier");
25099      for (int i = 0; i < array.size(); i++) {
25100        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25101      }
25102    };
25103    if (json.has("active"))
25104      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
25105    if (json.has("_active"))
25106      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
25107    if (json.has("period"))
25108      res.setPeriod(parsePeriod(getJObject(json, "period")));
25109    if (json.has("organization"))
25110      res.setOrganization(parseReference(getJObject(json, "organization")));
25111    if (json.has("participatingOrganization"))
25112      res.setParticipatingOrganization(parseReference(getJObject(json, "participatingOrganization")));
25113    if (json.has("network")) {
25114      JsonArray array = getJArray(json, "network");
25115      for (int i = 0; i < array.size(); i++) {
25116        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
25117      }
25118    };
25119    if (json.has("code")) {
25120      JsonArray array = getJArray(json, "code");
25121      for (int i = 0; i < array.size(); i++) {
25122        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25123      }
25124    };
25125    if (json.has("specialty")) {
25126      JsonArray array = getJArray(json, "specialty");
25127      for (int i = 0; i < array.size(); i++) {
25128        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25129      }
25130    };
25131    if (json.has("location")) {
25132      JsonArray array = getJArray(json, "location");
25133      for (int i = 0; i < array.size(); i++) {
25134        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
25135      }
25136    };
25137    if (json.has("healthcareService")) {
25138      JsonArray array = getJArray(json, "healthcareService");
25139      for (int i = 0; i < array.size(); i++) {
25140        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
25141      }
25142    };
25143    if (json.has("contact")) {
25144      JsonArray array = getJArray(json, "contact");
25145      for (int i = 0; i < array.size(); i++) {
25146        res.getContact().add(parseExtendedContactDetail(array.get(i).getAsJsonObject()));
25147      }
25148    };
25149    if (json.has("endpoint")) {
25150      JsonArray array = getJArray(json, "endpoint");
25151      for (int i = 0; i < array.size(); i++) {
25152        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
25153      }
25154    };
25155  }
25156
25157  protected PackagedProductDefinition parsePackagedProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
25158    PackagedProductDefinition res = new PackagedProductDefinition();
25159    parsePackagedProductDefinitionProperties(json, res);
25160    return res;
25161  }
25162
25163  protected void parsePackagedProductDefinitionProperties(JsonObject json, PackagedProductDefinition res) throws IOException, FHIRFormatError {
25164    parseDomainResourceProperties(json, res);
25165    if (json.has("identifier")) {
25166      JsonArray array = getJArray(json, "identifier");
25167      for (int i = 0; i < array.size(); i++) {
25168        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25169      }
25170    };
25171    if (json.has("name"))
25172      res.setNameElement(parseString(json.get("name").getAsString()));
25173    if (json.has("_name"))
25174      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25175    if (json.has("type"))
25176      res.setType(parseCodeableConcept(getJObject(json, "type")));
25177    if (json.has("packageFor")) {
25178      JsonArray array = getJArray(json, "packageFor");
25179      for (int i = 0; i < array.size(); i++) {
25180        res.getPackageFor().add(parseReference(array.get(i).getAsJsonObject()));
25181      }
25182    };
25183    if (json.has("status"))
25184      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
25185    if (json.has("statusDate"))
25186      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
25187    if (json.has("_statusDate"))
25188      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
25189    if (json.has("containedItemQuantity")) {
25190      JsonArray array = getJArray(json, "containedItemQuantity");
25191      for (int i = 0; i < array.size(); i++) {
25192        res.getContainedItemQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
25193      }
25194    };
25195    if (json.has("description"))
25196      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25197    if (json.has("_description"))
25198      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25199    if (json.has("legalStatusOfSupply")) {
25200      JsonArray array = getJArray(json, "legalStatusOfSupply");
25201      for (int i = 0; i < array.size(); i++) {
25202        res.getLegalStatusOfSupply().add(parsePackagedProductDefinitionLegalStatusOfSupplyComponent(array.get(i).getAsJsonObject()));
25203      }
25204    };
25205    if (json.has("marketingStatus")) {
25206      JsonArray array = getJArray(json, "marketingStatus");
25207      for (int i = 0; i < array.size(); i++) {
25208        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
25209      }
25210    };
25211    if (json.has("copackagedIndicator"))
25212      res.setCopackagedIndicatorElement(parseBoolean(json.get("copackagedIndicator").getAsBoolean()));
25213    if (json.has("_copackagedIndicator"))
25214      parseElementProperties(getJObject(json, "_copackagedIndicator"), res.getCopackagedIndicatorElement());
25215    if (json.has("manufacturer")) {
25216      JsonArray array = getJArray(json, "manufacturer");
25217      for (int i = 0; i < array.size(); i++) {
25218        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
25219      }
25220    };
25221    if (json.has("attachedDocument")) {
25222      JsonArray array = getJArray(json, "attachedDocument");
25223      for (int i = 0; i < array.size(); i++) {
25224        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
25225      }
25226    };
25227    if (json.has("packaging"))
25228      res.setPackaging(parsePackagedProductDefinitionPackagingComponent(getJObject(json, "packaging")));
25229    if (json.has("characteristic")) {
25230      JsonArray array = getJArray(json, "characteristic");
25231      for (int i = 0; i < array.size(); i++) {
25232        res.getCharacteristic().add(parsePackagedProductDefinitionPackagingPropertyComponent(array.get(i).getAsJsonObject()));
25233      }
25234    };
25235  }
25236
25237  protected PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent parsePackagedProductDefinitionLegalStatusOfSupplyComponent(JsonObject json) throws IOException, FHIRFormatError {
25238    PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent res = new PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent();
25239    parsePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(json, res);
25240    return res;
25241  }
25242
25243  protected void parsePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent res) throws IOException, FHIRFormatError {
25244    parseBackboneElementProperties(json, res);
25245    if (json.has("code"))
25246      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25247    if (json.has("jurisdiction"))
25248      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
25249  }
25250
25251  protected PackagedProductDefinition.PackagedProductDefinitionPackagingComponent parsePackagedProductDefinitionPackagingComponent(JsonObject json) throws IOException, FHIRFormatError {
25252    PackagedProductDefinition.PackagedProductDefinitionPackagingComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackagingComponent();
25253    parsePackagedProductDefinitionPackagingComponentProperties(json, res);
25254    return res;
25255  }
25256
25257  protected void parsePackagedProductDefinitionPackagingComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackagingComponent res) throws IOException, FHIRFormatError {
25258    parseBackboneElementProperties(json, res);
25259    if (json.has("identifier")) {
25260      JsonArray array = getJArray(json, "identifier");
25261      for (int i = 0; i < array.size(); i++) {
25262        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25263      }
25264    };
25265    if (json.has("type"))
25266      res.setType(parseCodeableConcept(getJObject(json, "type")));
25267    if (json.has("componentPart"))
25268      res.setComponentPartElement(parseBoolean(json.get("componentPart").getAsBoolean()));
25269    if (json.has("_componentPart"))
25270      parseElementProperties(getJObject(json, "_componentPart"), res.getComponentPartElement());
25271    if (json.has("quantity"))
25272      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
25273    if (json.has("_quantity"))
25274      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
25275    if (json.has("material")) {
25276      JsonArray array = getJArray(json, "material");
25277      for (int i = 0; i < array.size(); i++) {
25278        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25279      }
25280    };
25281    if (json.has("alternateMaterial")) {
25282      JsonArray array = getJArray(json, "alternateMaterial");
25283      for (int i = 0; i < array.size(); i++) {
25284        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25285      }
25286    };
25287    if (json.has("shelfLifeStorage")) {
25288      JsonArray array = getJArray(json, "shelfLifeStorage");
25289      for (int i = 0; i < array.size(); i++) {
25290        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
25291      }
25292    };
25293    if (json.has("manufacturer")) {
25294      JsonArray array = getJArray(json, "manufacturer");
25295      for (int i = 0; i < array.size(); i++) {
25296        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
25297      }
25298    };
25299    if (json.has("property")) {
25300      JsonArray array = getJArray(json, "property");
25301      for (int i = 0; i < array.size(); i++) {
25302        res.getProperty().add(parsePackagedProductDefinitionPackagingPropertyComponent(array.get(i).getAsJsonObject()));
25303      }
25304    };
25305    if (json.has("containedItem")) {
25306      JsonArray array = getJArray(json, "containedItem");
25307      for (int i = 0; i < array.size(); i++) {
25308        res.getContainedItem().add(parsePackagedProductDefinitionPackagingContainedItemComponent(array.get(i).getAsJsonObject()));
25309      }
25310    };
25311    if (json.has("packaging")) {
25312      JsonArray array = getJArray(json, "packaging");
25313      for (int i = 0; i < array.size(); i++) {
25314        res.getPackaging().add(parsePackagedProductDefinitionPackagingComponent(array.get(i).getAsJsonObject()));
25315      }
25316    };
25317  }
25318
25319  protected PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent parsePackagedProductDefinitionPackagingPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
25320    PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent();
25321    parsePackagedProductDefinitionPackagingPropertyComponentProperties(json, res);
25322    return res;
25323  }
25324
25325  protected void parsePackagedProductDefinitionPackagingPropertyComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent res) throws IOException, FHIRFormatError {
25326    parseBackboneElementProperties(json, res);
25327    if (json.has("type"))
25328      res.setType(parseCodeableConcept(getJObject(json, "type")));
25329    DataType value = parseType("value", json);
25330    if (value != null)
25331      res.setValue(value);
25332  }
25333
25334  protected PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent parsePackagedProductDefinitionPackagingContainedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
25335    PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent();
25336    parsePackagedProductDefinitionPackagingContainedItemComponentProperties(json, res);
25337    return res;
25338  }
25339
25340  protected void parsePackagedProductDefinitionPackagingContainedItemComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent res) throws IOException, FHIRFormatError {
25341    parseBackboneElementProperties(json, res);
25342    if (json.has("item"))
25343      res.setItem(parseCodeableReference(getJObject(json, "item")));
25344    if (json.has("amount"))
25345      res.setAmount(parseQuantity(getJObject(json, "amount")));
25346  }
25347
25348  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
25349    Parameters res = new Parameters();
25350    parseParametersProperties(json, res);
25351    return res;
25352  }
25353
25354  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
25355    parseResourceProperties(json, res);
25356    if (json.has("parameter")) {
25357      JsonArray array = getJArray(json, "parameter");
25358      for (int i = 0; i < array.size(); i++) {
25359        res.getParameter().add(parseParametersParameterComponent(array.get(i).getAsJsonObject()));
25360      }
25361    };
25362  }
25363
25364  protected Parameters.ParametersParameterComponent parseParametersParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
25365    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
25366    parseParametersParameterComponentProperties(json, res);
25367    return res;
25368  }
25369
25370  protected void parseParametersParameterComponentProperties(JsonObject json, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
25371    parseBackboneElementProperties(json, res);
25372    if (json.has("name"))
25373      res.setNameElement(parseString(json.get("name").getAsString()));
25374    if (json.has("_name"))
25375      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25376    DataType value = parseType("value", json);
25377    if (value != null)
25378      res.setValue(value);
25379    if (json.has("resource"))
25380      res.setResource(parseResource(getJObject(json, "resource")));
25381    if (json.has("part")) {
25382      JsonArray array = getJArray(json, "part");
25383      for (int i = 0; i < array.size(); i++) {
25384        res.getPart().add(parseParametersParameterComponent(array.get(i).getAsJsonObject()));
25385      }
25386    };
25387  }
25388
25389  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
25390    Patient res = new Patient();
25391    parsePatientProperties(json, res);
25392    return res;
25393  }
25394
25395  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
25396    parseDomainResourceProperties(json, res);
25397    if (json.has("identifier")) {
25398      JsonArray array = getJArray(json, "identifier");
25399      for (int i = 0; i < array.size(); i++) {
25400        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25401      }
25402    };
25403    if (json.has("active"))
25404      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
25405    if (json.has("_active"))
25406      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
25407    if (json.has("name")) {
25408      JsonArray array = getJArray(json, "name");
25409      for (int i = 0; i < array.size(); i++) {
25410        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
25411      }
25412    };
25413    if (json.has("telecom")) {
25414      JsonArray array = getJArray(json, "telecom");
25415      for (int i = 0; i < array.size(); i++) {
25416        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
25417      }
25418    };
25419    if (json.has("gender"))
25420      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
25421    if (json.has("_gender"))
25422      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
25423    if (json.has("birthDate"))
25424      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
25425    if (json.has("_birthDate"))
25426      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
25427    DataType deceased = parseType("deceased", json);
25428    if (deceased != null)
25429      res.setDeceased(deceased);
25430    if (json.has("address")) {
25431      JsonArray array = getJArray(json, "address");
25432      for (int i = 0; i < array.size(); i++) {
25433        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
25434      }
25435    };
25436    if (json.has("maritalStatus"))
25437      res.setMaritalStatus(parseCodeableConcept(getJObject(json, "maritalStatus")));
25438    DataType multipleBirth = parseType("multipleBirth", json);
25439    if (multipleBirth != null)
25440      res.setMultipleBirth(multipleBirth);
25441    if (json.has("photo")) {
25442      JsonArray array = getJArray(json, "photo");
25443      for (int i = 0; i < array.size(); i++) {
25444        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
25445      }
25446    };
25447    if (json.has("contact")) {
25448      JsonArray array = getJArray(json, "contact");
25449      for (int i = 0; i < array.size(); i++) {
25450        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject()));
25451      }
25452    };
25453    if (json.has("communication")) {
25454      JsonArray array = getJArray(json, "communication");
25455      for (int i = 0; i < array.size(); i++) {
25456        res.getCommunication().add(parsePatientCommunicationComponent(array.get(i).getAsJsonObject()));
25457      }
25458    };
25459    if (json.has("generalPractitioner")) {
25460      JsonArray array = getJArray(json, "generalPractitioner");
25461      for (int i = 0; i < array.size(); i++) {
25462        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
25463      }
25464    };
25465    if (json.has("managingOrganization"))
25466      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
25467    if (json.has("link")) {
25468      JsonArray array = getJArray(json, "link");
25469      for (int i = 0; i < array.size(); i++) {
25470        res.getLink().add(parsePatientLinkComponent(array.get(i).getAsJsonObject()));
25471      }
25472    };
25473  }
25474
25475  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json) throws IOException, FHIRFormatError {
25476    Patient.ContactComponent res = new Patient.ContactComponent();
25477    parsePatientContactComponentProperties(json, res);
25478    return res;
25479  }
25480
25481  protected void parsePatientContactComponentProperties(JsonObject json, Patient.ContactComponent res) throws IOException, FHIRFormatError {
25482    parseBackboneElementProperties(json, res);
25483    if (json.has("relationship")) {
25484      JsonArray array = getJArray(json, "relationship");
25485      for (int i = 0; i < array.size(); i++) {
25486        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25487      }
25488    };
25489    if (json.has("name"))
25490      res.setName(parseHumanName(getJObject(json, "name")));
25491    if (json.has("telecom")) {
25492      JsonArray array = getJArray(json, "telecom");
25493      for (int i = 0; i < array.size(); i++) {
25494        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
25495      }
25496    };
25497    if (json.has("address"))
25498      res.setAddress(parseAddress(getJObject(json, "address")));
25499    if (json.has("gender"))
25500      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
25501    if (json.has("_gender"))
25502      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
25503    if (json.has("organization"))
25504      res.setOrganization(parseReference(getJObject(json, "organization")));
25505    if (json.has("period"))
25506      res.setPeriod(parsePeriod(getJObject(json, "period")));
25507  }
25508
25509  protected Patient.PatientCommunicationComponent parsePatientCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
25510    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
25511    parsePatientCommunicationComponentProperties(json, res);
25512    return res;
25513  }
25514
25515  protected void parsePatientCommunicationComponentProperties(JsonObject json, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
25516    parseBackboneElementProperties(json, res);
25517    if (json.has("language"))
25518      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
25519    if (json.has("preferred"))
25520      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
25521    if (json.has("_preferred"))
25522      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
25523  }
25524
25525  protected Patient.PatientLinkComponent parsePatientLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
25526    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
25527    parsePatientLinkComponentProperties(json, res);
25528    return res;
25529  }
25530
25531  protected void parsePatientLinkComponentProperties(JsonObject json, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
25532    parseBackboneElementProperties(json, res);
25533    if (json.has("other"))
25534      res.setOther(parseReference(getJObject(json, "other")));
25535    if (json.has("type"))
25536      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
25537    if (json.has("_type"))
25538      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25539  }
25540
25541  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
25542    PaymentNotice res = new PaymentNotice();
25543    parsePaymentNoticeProperties(json, res);
25544    return res;
25545  }
25546
25547  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
25548    parseDomainResourceProperties(json, res);
25549    if (json.has("identifier")) {
25550      JsonArray array = getJArray(json, "identifier");
25551      for (int i = 0; i < array.size(); i++) {
25552        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25553      }
25554    };
25555    if (json.has("status"))
25556      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
25557    if (json.has("_status"))
25558      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25559    if (json.has("request"))
25560      res.setRequest(parseReference(getJObject(json, "request")));
25561    if (json.has("response"))
25562      res.setResponse(parseReference(getJObject(json, "response")));
25563    if (json.has("created"))
25564      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
25565    if (json.has("_created"))
25566      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
25567    if (json.has("reporter"))
25568      res.setReporter(parseReference(getJObject(json, "reporter")));
25569    if (json.has("payment"))
25570      res.setPayment(parseReference(getJObject(json, "payment")));
25571    if (json.has("paymentDate"))
25572      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
25573    if (json.has("_paymentDate"))
25574      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
25575    if (json.has("payee"))
25576      res.setPayee(parseReference(getJObject(json, "payee")));
25577    if (json.has("recipient"))
25578      res.setRecipient(parseReference(getJObject(json, "recipient")));
25579    if (json.has("amount"))
25580      res.setAmount(parseMoney(getJObject(json, "amount")));
25581    if (json.has("paymentStatus"))
25582      res.setPaymentStatus(parseCodeableConcept(getJObject(json, "paymentStatus")));
25583  }
25584
25585  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
25586    PaymentReconciliation res = new PaymentReconciliation();
25587    parsePaymentReconciliationProperties(json, res);
25588    return res;
25589  }
25590
25591  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
25592    parseDomainResourceProperties(json, res);
25593    if (json.has("identifier")) {
25594      JsonArray array = getJArray(json, "identifier");
25595      for (int i = 0; i < array.size(); i++) {
25596        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25597      }
25598    };
25599    if (json.has("type"))
25600      res.setType(parseCodeableConcept(getJObject(json, "type")));
25601    if (json.has("status"))
25602      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
25603    if (json.has("_status"))
25604      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25605    if (json.has("kind"))
25606      res.setKind(parseCodeableConcept(getJObject(json, "kind")));
25607    if (json.has("period"))
25608      res.setPeriod(parsePeriod(getJObject(json, "period")));
25609    if (json.has("created"))
25610      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
25611    if (json.has("_created"))
25612      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
25613    if (json.has("enterer"))
25614      res.setEnterer(parseReference(getJObject(json, "enterer")));
25615    if (json.has("issuerType"))
25616      res.setIssuerType(parseCodeableConcept(getJObject(json, "issuerType")));
25617    if (json.has("paymentIssuer"))
25618      res.setPaymentIssuer(parseReference(getJObject(json, "paymentIssuer")));
25619    if (json.has("request"))
25620      res.setRequest(parseReference(getJObject(json, "request")));
25621    if (json.has("requestor"))
25622      res.setRequestor(parseReference(getJObject(json, "requestor")));
25623    if (json.has("outcome"))
25624      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), PaymentReconciliation.PaymentOutcome.NULL, new PaymentReconciliation.PaymentOutcomeEnumFactory()));
25625    if (json.has("_outcome"))
25626      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
25627    if (json.has("disposition"))
25628      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
25629    if (json.has("_disposition"))
25630      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
25631    if (json.has("date"))
25632      res.setDateElement(parseDate(json.get("date").getAsString()));
25633    if (json.has("_date"))
25634      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25635    if (json.has("location"))
25636      res.setLocation(parseReference(getJObject(json, "location")));
25637    if (json.has("method"))
25638      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
25639    if (json.has("cardBrand"))
25640      res.setCardBrandElement(parseString(json.get("cardBrand").getAsString()));
25641    if (json.has("_cardBrand"))
25642      parseElementProperties(getJObject(json, "_cardBrand"), res.getCardBrandElement());
25643    if (json.has("accountNumber"))
25644      res.setAccountNumberElement(parseString(json.get("accountNumber").getAsString()));
25645    if (json.has("_accountNumber"))
25646      parseElementProperties(getJObject(json, "_accountNumber"), res.getAccountNumberElement());
25647    if (json.has("expirationDate"))
25648      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
25649    if (json.has("_expirationDate"))
25650      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
25651    if (json.has("processor"))
25652      res.setProcessorElement(parseString(json.get("processor").getAsString()));
25653    if (json.has("_processor"))
25654      parseElementProperties(getJObject(json, "_processor"), res.getProcessorElement());
25655    if (json.has("referenceNumber"))
25656      res.setReferenceNumberElement(parseString(json.get("referenceNumber").getAsString()));
25657    if (json.has("_referenceNumber"))
25658      parseElementProperties(getJObject(json, "_referenceNumber"), res.getReferenceNumberElement());
25659    if (json.has("authorization"))
25660      res.setAuthorizationElement(parseString(json.get("authorization").getAsString()));
25661    if (json.has("_authorization"))
25662      parseElementProperties(getJObject(json, "_authorization"), res.getAuthorizationElement());
25663    if (json.has("tenderedAmount"))
25664      res.setTenderedAmount(parseMoney(getJObject(json, "tenderedAmount")));
25665    if (json.has("returnedAmount"))
25666      res.setReturnedAmount(parseMoney(getJObject(json, "returnedAmount")));
25667    if (json.has("amount"))
25668      res.setAmount(parseMoney(getJObject(json, "amount")));
25669    if (json.has("paymentIdentifier"))
25670      res.setPaymentIdentifier(parseIdentifier(getJObject(json, "paymentIdentifier")));
25671    if (json.has("allocation")) {
25672      JsonArray array = getJArray(json, "allocation");
25673      for (int i = 0; i < array.size(); i++) {
25674        res.getAllocation().add(parsePaymentReconciliationAllocationComponent(array.get(i).getAsJsonObject()));
25675      }
25676    };
25677    if (json.has("formCode"))
25678      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
25679    if (json.has("processNote")) {
25680      JsonArray array = getJArray(json, "processNote");
25681      for (int i = 0; i < array.size(); i++) {
25682        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject()));
25683      }
25684    };
25685  }
25686
25687  protected PaymentReconciliation.PaymentReconciliationAllocationComponent parsePaymentReconciliationAllocationComponent(JsonObject json) throws IOException, FHIRFormatError {
25688    PaymentReconciliation.PaymentReconciliationAllocationComponent res = new PaymentReconciliation.PaymentReconciliationAllocationComponent();
25689    parsePaymentReconciliationAllocationComponentProperties(json, res);
25690    return res;
25691  }
25692
25693  protected void parsePaymentReconciliationAllocationComponentProperties(JsonObject json, PaymentReconciliation.PaymentReconciliationAllocationComponent res) throws IOException, FHIRFormatError {
25694    parseBackboneElementProperties(json, res);
25695    if (json.has("identifier"))
25696      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
25697    if (json.has("predecessor"))
25698      res.setPredecessor(parseIdentifier(getJObject(json, "predecessor")));
25699    if (json.has("target"))
25700      res.setTarget(parseReference(getJObject(json, "target")));
25701    DataType targetItem = parseType("targetItem", json);
25702    if (targetItem != null)
25703      res.setTargetItem(targetItem);
25704    if (json.has("encounter"))
25705      res.setEncounter(parseReference(getJObject(json, "encounter")));
25706    if (json.has("account"))
25707      res.setAccount(parseReference(getJObject(json, "account")));
25708    if (json.has("type"))
25709      res.setType(parseCodeableConcept(getJObject(json, "type")));
25710    if (json.has("submitter"))
25711      res.setSubmitter(parseReference(getJObject(json, "submitter")));
25712    if (json.has("response"))
25713      res.setResponse(parseReference(getJObject(json, "response")));
25714    if (json.has("date"))
25715      res.setDateElement(parseDate(json.get("date").getAsString()));
25716    if (json.has("_date"))
25717      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25718    if (json.has("responsible"))
25719      res.setResponsible(parseReference(getJObject(json, "responsible")));
25720    if (json.has("payee"))
25721      res.setPayee(parseReference(getJObject(json, "payee")));
25722    if (json.has("amount"))
25723      res.setAmount(parseMoney(getJObject(json, "amount")));
25724  }
25725
25726  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json) throws IOException, FHIRFormatError {
25727    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
25728    parsePaymentReconciliationNotesComponentProperties(json, res);
25729    return res;
25730  }
25731
25732  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
25733    parseBackboneElementProperties(json, res);
25734    if (json.has("type"))
25735      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PaymentReconciliation.NoteType.NULL, new PaymentReconciliation.NoteTypeEnumFactory()));
25736    if (json.has("_type"))
25737      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25738    if (json.has("text"))
25739      res.setTextElement(parseString(json.get("text").getAsString()));
25740    if (json.has("_text"))
25741      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
25742  }
25743
25744  protected Permission parsePermission(JsonObject json) throws IOException, FHIRFormatError {
25745    Permission res = new Permission();
25746    parsePermissionProperties(json, res);
25747    return res;
25748  }
25749
25750  protected void parsePermissionProperties(JsonObject json, Permission res) throws IOException, FHIRFormatError {
25751    parseDomainResourceProperties(json, res);
25752    if (json.has("status"))
25753      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Permission.PermissionStatus.NULL, new Permission.PermissionStatusEnumFactory()));
25754    if (json.has("_status"))
25755      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25756    if (json.has("asserter"))
25757      res.setAsserter(parseReference(getJObject(json, "asserter")));
25758    if (json.has("date")) {
25759      JsonArray array = getJArray(json, "date");
25760      for (int i = 0; i < array.size(); i++) {
25761        if (array.get(i).isJsonNull()) {
25762          res.getDate().add(new DateTimeType());
25763        } else {;
25764          res.getDate().add(parseDateTime(array.get(i).getAsString()));
25765        }
25766      }
25767    };
25768    if (json.has("_date")) {
25769      JsonArray array = getJArray(json, "_date");
25770      for (int i = 0; i < array.size(); i++) {
25771        if (i == res.getDate().size())
25772          res.getDate().add(parseDateTime(null));
25773        if (array.get(i) instanceof JsonObject) 
25774          parseElementProperties(array.get(i).getAsJsonObject(), res.getDate().get(i));
25775      }
25776    };
25777    if (json.has("validity"))
25778      res.setValidity(parsePeriod(getJObject(json, "validity")));
25779    if (json.has("justification"))
25780      res.setJustification(parsePermissionJustificationComponent(getJObject(json, "justification")));
25781    if (json.has("combining"))
25782      res.setCombiningElement(parseEnumeration(json.get("combining").getAsString(), Permission.PermissionRuleCombining.NULL, new Permission.PermissionRuleCombiningEnumFactory()));
25783    if (json.has("_combining"))
25784      parseElementProperties(getJObject(json, "_combining"), res.getCombiningElement());
25785    if (json.has("rule")) {
25786      JsonArray array = getJArray(json, "rule");
25787      for (int i = 0; i < array.size(); i++) {
25788        res.getRule().add(parsePermissionRuleComponent(array.get(i).getAsJsonObject()));
25789      }
25790    };
25791  }
25792
25793  protected Permission.PermissionJustificationComponent parsePermissionJustificationComponent(JsonObject json) throws IOException, FHIRFormatError {
25794    Permission.PermissionJustificationComponent res = new Permission.PermissionJustificationComponent();
25795    parsePermissionJustificationComponentProperties(json, res);
25796    return res;
25797  }
25798
25799  protected void parsePermissionJustificationComponentProperties(JsonObject json, Permission.PermissionJustificationComponent res) throws IOException, FHIRFormatError {
25800    parseBackboneElementProperties(json, res);
25801    if (json.has("basis")) {
25802      JsonArray array = getJArray(json, "basis");
25803      for (int i = 0; i < array.size(); i++) {
25804        res.getBasis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25805      }
25806    };
25807    if (json.has("evidence")) {
25808      JsonArray array = getJArray(json, "evidence");
25809      for (int i = 0; i < array.size(); i++) {
25810        res.getEvidence().add(parseReference(array.get(i).getAsJsonObject()));
25811      }
25812    };
25813  }
25814
25815  protected Permission.RuleComponent parsePermissionRuleComponent(JsonObject json) throws IOException, FHIRFormatError {
25816    Permission.RuleComponent res = new Permission.RuleComponent();
25817    parsePermissionRuleComponentProperties(json, res);
25818    return res;
25819  }
25820
25821  protected void parsePermissionRuleComponentProperties(JsonObject json, Permission.RuleComponent res) throws IOException, FHIRFormatError {
25822    parseBackboneElementProperties(json, res);
25823    if (json.has("type"))
25824      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ConsentProvisionType.NULL, new Enumerations.ConsentProvisionTypeEnumFactory()));
25825    if (json.has("_type"))
25826      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25827    if (json.has("data")) {
25828      JsonArray array = getJArray(json, "data");
25829      for (int i = 0; i < array.size(); i++) {
25830        res.getData().add(parsePermissionRuleDataComponent(array.get(i).getAsJsonObject()));
25831      }
25832    };
25833    if (json.has("activity")) {
25834      JsonArray array = getJArray(json, "activity");
25835      for (int i = 0; i < array.size(); i++) {
25836        res.getActivity().add(parsePermissionRuleActivityComponent(array.get(i).getAsJsonObject()));
25837      }
25838    };
25839    if (json.has("limit")) {
25840      JsonArray array = getJArray(json, "limit");
25841      for (int i = 0; i < array.size(); i++) {
25842        res.getLimit().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25843      }
25844    };
25845  }
25846
25847  protected Permission.RuleDataComponent parsePermissionRuleDataComponent(JsonObject json) throws IOException, FHIRFormatError {
25848    Permission.RuleDataComponent res = new Permission.RuleDataComponent();
25849    parsePermissionRuleDataComponentProperties(json, res);
25850    return res;
25851  }
25852
25853  protected void parsePermissionRuleDataComponentProperties(JsonObject json, Permission.RuleDataComponent res) throws IOException, FHIRFormatError {
25854    parseBackboneElementProperties(json, res);
25855    if (json.has("resource")) {
25856      JsonArray array = getJArray(json, "resource");
25857      for (int i = 0; i < array.size(); i++) {
25858        res.getResource().add(parsePermissionRuleDataResourceComponent(array.get(i).getAsJsonObject()));
25859      }
25860    };
25861    if (json.has("security")) {
25862      JsonArray array = getJArray(json, "security");
25863      for (int i = 0; i < array.size(); i++) {
25864        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
25865      }
25866    };
25867    if (json.has("period")) {
25868      JsonArray array = getJArray(json, "period");
25869      for (int i = 0; i < array.size(); i++) {
25870        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
25871      }
25872    };
25873    if (json.has("expression"))
25874      res.setExpression(parseExpression(getJObject(json, "expression")));
25875  }
25876
25877  protected Permission.RuleDataResourceComponent parsePermissionRuleDataResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
25878    Permission.RuleDataResourceComponent res = new Permission.RuleDataResourceComponent();
25879    parsePermissionRuleDataResourceComponentProperties(json, res);
25880    return res;
25881  }
25882
25883  protected void parsePermissionRuleDataResourceComponentProperties(JsonObject json, Permission.RuleDataResourceComponent res) throws IOException, FHIRFormatError {
25884    parseBackboneElementProperties(json, res);
25885    if (json.has("meaning"))
25886      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Enumerations.ConsentDataMeaning.NULL, new Enumerations.ConsentDataMeaningEnumFactory()));
25887    if (json.has("_meaning"))
25888      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
25889    if (json.has("reference"))
25890      res.setReference(parseReference(getJObject(json, "reference")));
25891  }
25892
25893  protected Permission.RuleActivityComponent parsePermissionRuleActivityComponent(JsonObject json) throws IOException, FHIRFormatError {
25894    Permission.RuleActivityComponent res = new Permission.RuleActivityComponent();
25895    parsePermissionRuleActivityComponentProperties(json, res);
25896    return res;
25897  }
25898
25899  protected void parsePermissionRuleActivityComponentProperties(JsonObject json, Permission.RuleActivityComponent res) throws IOException, FHIRFormatError {
25900    parseBackboneElementProperties(json, res);
25901    if (json.has("actor")) {
25902      JsonArray array = getJArray(json, "actor");
25903      for (int i = 0; i < array.size(); i++) {
25904        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
25905      }
25906    };
25907    if (json.has("action")) {
25908      JsonArray array = getJArray(json, "action");
25909      for (int i = 0; i < array.size(); i++) {
25910        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25911      }
25912    };
25913    if (json.has("purpose")) {
25914      JsonArray array = getJArray(json, "purpose");
25915      for (int i = 0; i < array.size(); i++) {
25916        res.getPurpose().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25917      }
25918    };
25919  }
25920
25921  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
25922    Person res = new Person();
25923    parsePersonProperties(json, res);
25924    return res;
25925  }
25926
25927  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
25928    parseDomainResourceProperties(json, res);
25929    if (json.has("identifier")) {
25930      JsonArray array = getJArray(json, "identifier");
25931      for (int i = 0; i < array.size(); i++) {
25932        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25933      }
25934    };
25935    if (json.has("active"))
25936      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
25937    if (json.has("_active"))
25938      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
25939    if (json.has("name")) {
25940      JsonArray array = getJArray(json, "name");
25941      for (int i = 0; i < array.size(); i++) {
25942        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
25943      }
25944    };
25945    if (json.has("telecom")) {
25946      JsonArray array = getJArray(json, "telecom");
25947      for (int i = 0; i < array.size(); i++) {
25948        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
25949      }
25950    };
25951    if (json.has("gender"))
25952      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
25953    if (json.has("_gender"))
25954      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
25955    if (json.has("birthDate"))
25956      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
25957    if (json.has("_birthDate"))
25958      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
25959    DataType deceased = parseType("deceased", json);
25960    if (deceased != null)
25961      res.setDeceased(deceased);
25962    if (json.has("address")) {
25963      JsonArray array = getJArray(json, "address");
25964      for (int i = 0; i < array.size(); i++) {
25965        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
25966      }
25967    };
25968    if (json.has("maritalStatus"))
25969      res.setMaritalStatus(parseCodeableConcept(getJObject(json, "maritalStatus")));
25970    if (json.has("photo")) {
25971      JsonArray array = getJArray(json, "photo");
25972      for (int i = 0; i < array.size(); i++) {
25973        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
25974      }
25975    };
25976    if (json.has("communication")) {
25977      JsonArray array = getJArray(json, "communication");
25978      for (int i = 0; i < array.size(); i++) {
25979        res.getCommunication().add(parsePersonCommunicationComponent(array.get(i).getAsJsonObject()));
25980      }
25981    };
25982    if (json.has("managingOrganization"))
25983      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
25984    if (json.has("link")) {
25985      JsonArray array = getJArray(json, "link");
25986      for (int i = 0; i < array.size(); i++) {
25987        res.getLink().add(parsePersonLinkComponent(array.get(i).getAsJsonObject()));
25988      }
25989    };
25990  }
25991
25992  protected Person.PersonCommunicationComponent parsePersonCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
25993    Person.PersonCommunicationComponent res = new Person.PersonCommunicationComponent();
25994    parsePersonCommunicationComponentProperties(json, res);
25995    return res;
25996  }
25997
25998  protected void parsePersonCommunicationComponentProperties(JsonObject json, Person.PersonCommunicationComponent res) throws IOException, FHIRFormatError {
25999    parseBackboneElementProperties(json, res);
26000    if (json.has("language"))
26001      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
26002    if (json.has("preferred"))
26003      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
26004    if (json.has("_preferred"))
26005      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
26006  }
26007
26008  protected Person.PersonLinkComponent parsePersonLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
26009    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
26010    parsePersonLinkComponentProperties(json, res);
26011    return res;
26012  }
26013
26014  protected void parsePersonLinkComponentProperties(JsonObject json, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
26015    parseBackboneElementProperties(json, res);
26016    if (json.has("target"))
26017      res.setTarget(parseReference(getJObject(json, "target")));
26018    if (json.has("assurance"))
26019      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
26020    if (json.has("_assurance"))
26021      parseElementProperties(getJObject(json, "_assurance"), res.getAssuranceElement());
26022  }
26023
26024  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
26025    PlanDefinition res = new PlanDefinition();
26026    parsePlanDefinitionProperties(json, res);
26027    return res;
26028  }
26029
26030  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
26031    parseMetadataResourceProperties(json, res);
26032    if (json.has("url"))
26033      res.setUrlElement(parseUri(json.get("url").getAsString()));
26034    if (json.has("_url"))
26035      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26036    if (json.has("identifier")) {
26037      JsonArray array = getJArray(json, "identifier");
26038      for (int i = 0; i < array.size(); i++) {
26039        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26040      }
26041    };
26042    if (json.has("version"))
26043      res.setVersionElement(parseString(json.get("version").getAsString()));
26044    if (json.has("_version"))
26045      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26046    DataType versionAlgorithm = parseType("versionAlgorithm", json);
26047    if (versionAlgorithm != null)
26048      res.setVersionAlgorithm(versionAlgorithm);
26049    if (json.has("name"))
26050      res.setNameElement(parseString(json.get("name").getAsString()));
26051    if (json.has("_name"))
26052      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26053    if (json.has("title"))
26054      res.setTitleElement(parseString(json.get("title").getAsString()));
26055    if (json.has("_title"))
26056      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26057    if (json.has("subtitle"))
26058      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
26059    if (json.has("_subtitle"))
26060      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
26061    if (json.has("type"))
26062      res.setType(parseCodeableConcept(getJObject(json, "type")));
26063    if (json.has("status"))
26064      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26065    if (json.has("_status"))
26066      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26067    if (json.has("experimental"))
26068      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26069    if (json.has("_experimental"))
26070      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
26071    DataType subject = parseType("subject", json);
26072    if (subject != null)
26073      res.setSubject(subject);
26074    if (json.has("date"))
26075      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26076    if (json.has("_date"))
26077      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26078    if (json.has("publisher"))
26079      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26080    if (json.has("_publisher"))
26081      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26082    if (json.has("contact")) {
26083      JsonArray array = getJArray(json, "contact");
26084      for (int i = 0; i < array.size(); i++) {
26085        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26086      }
26087    };
26088    if (json.has("description"))
26089      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26090    if (json.has("_description"))
26091      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26092    if (json.has("useContext")) {
26093      JsonArray array = getJArray(json, "useContext");
26094      for (int i = 0; i < array.size(); i++) {
26095        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26096      }
26097    };
26098    if (json.has("jurisdiction")) {
26099      JsonArray array = getJArray(json, "jurisdiction");
26100      for (int i = 0; i < array.size(); i++) {
26101        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26102      }
26103    };
26104    if (json.has("purpose"))
26105      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26106    if (json.has("_purpose"))
26107      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
26108    if (json.has("usage"))
26109      res.setUsageElement(parseMarkdown(json.get("usage").getAsString()));
26110    if (json.has("_usage"))
26111      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
26112    if (json.has("copyright"))
26113      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26114    if (json.has("_copyright"))
26115      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
26116    if (json.has("copyrightLabel"))
26117      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
26118    if (json.has("_copyrightLabel"))
26119      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
26120    if (json.has("approvalDate"))
26121      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
26122    if (json.has("_approvalDate"))
26123      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
26124    if (json.has("lastReviewDate"))
26125      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
26126    if (json.has("_lastReviewDate"))
26127      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
26128    if (json.has("effectivePeriod"))
26129      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
26130    if (json.has("topic")) {
26131      JsonArray array = getJArray(json, "topic");
26132      for (int i = 0; i < array.size(); i++) {
26133        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26134      }
26135    };
26136    if (json.has("author")) {
26137      JsonArray array = getJArray(json, "author");
26138      for (int i = 0; i < array.size(); i++) {
26139        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
26140      }
26141    };
26142    if (json.has("editor")) {
26143      JsonArray array = getJArray(json, "editor");
26144      for (int i = 0; i < array.size(); i++) {
26145        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
26146      }
26147    };
26148    if (json.has("reviewer")) {
26149      JsonArray array = getJArray(json, "reviewer");
26150      for (int i = 0; i < array.size(); i++) {
26151        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
26152      }
26153    };
26154    if (json.has("endorser")) {
26155      JsonArray array = getJArray(json, "endorser");
26156      for (int i = 0; i < array.size(); i++) {
26157        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
26158      }
26159    };
26160    if (json.has("relatedArtifact")) {
26161      JsonArray array = getJArray(json, "relatedArtifact");
26162      for (int i = 0; i < array.size(); i++) {
26163        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
26164      }
26165    };
26166    if (json.has("library")) {
26167      JsonArray array = getJArray(json, "library");
26168      for (int i = 0; i < array.size(); i++) {
26169        if (array.get(i).isJsonNull()) {
26170          res.getLibrary().add(new CanonicalType());
26171        } else {;
26172          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
26173        }
26174      }
26175    };
26176    if (json.has("_library")) {
26177      JsonArray array = getJArray(json, "_library");
26178      for (int i = 0; i < array.size(); i++) {
26179        if (i == res.getLibrary().size())
26180          res.getLibrary().add(parseCanonical(null));
26181        if (array.get(i) instanceof JsonObject) 
26182          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
26183      }
26184    };
26185    if (json.has("goal")) {
26186      JsonArray array = getJArray(json, "goal");
26187      for (int i = 0; i < array.size(); i++) {
26188        res.getGoal().add(parsePlanDefinitionGoalComponent(array.get(i).getAsJsonObject()));
26189      }
26190    };
26191    if (json.has("actor")) {
26192      JsonArray array = getJArray(json, "actor");
26193      for (int i = 0; i < array.size(); i++) {
26194        res.getActor().add(parsePlanDefinitionActorComponent(array.get(i).getAsJsonObject()));
26195      }
26196    };
26197    if (json.has("action")) {
26198      JsonArray array = getJArray(json, "action");
26199      for (int i = 0; i < array.size(); i++) {
26200        res.getAction().add(parsePlanDefinitionActionComponent(array.get(i).getAsJsonObject()));
26201      }
26202    };
26203    DataType asNeeded = parseType("asNeeded", json);
26204    if (asNeeded != null)
26205      res.setAsNeeded(asNeeded);
26206  }
26207
26208  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionGoalComponent(JsonObject json) throws IOException, FHIRFormatError {
26209    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
26210    parsePlanDefinitionGoalComponentProperties(json, res);
26211    return res;
26212  }
26213
26214  protected void parsePlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
26215    parseBackboneElementProperties(json, res);
26216    if (json.has("category"))
26217      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
26218    if (json.has("description"))
26219      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
26220    if (json.has("priority"))
26221      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
26222    if (json.has("start"))
26223      res.setStart(parseCodeableConcept(getJObject(json, "start")));
26224    if (json.has("addresses")) {
26225      JsonArray array = getJArray(json, "addresses");
26226      for (int i = 0; i < array.size(); i++) {
26227        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26228      }
26229    };
26230    if (json.has("documentation")) {
26231      JsonArray array = getJArray(json, "documentation");
26232      for (int i = 0; i < array.size(); i++) {
26233        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
26234      }
26235    };
26236    if (json.has("target")) {
26237      JsonArray array = getJArray(json, "target");
26238      for (int i = 0; i < array.size(); i++) {
26239        res.getTarget().add(parsePlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject()));
26240      }
26241    };
26242  }
26243
26244  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionGoalTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
26245    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
26246    parsePlanDefinitionGoalTargetComponentProperties(json, res);
26247    return res;
26248  }
26249
26250  protected void parsePlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
26251    parseBackboneElementProperties(json, res);
26252    if (json.has("measure"))
26253      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
26254    DataType detail = parseType("detail", json);
26255    if (detail != null)
26256      res.setDetail(detail);
26257    if (json.has("due"))
26258      res.setDue(parseDuration(getJObject(json, "due")));
26259  }
26260
26261  protected PlanDefinition.PlanDefinitionActorComponent parsePlanDefinitionActorComponent(JsonObject json) throws IOException, FHIRFormatError {
26262    PlanDefinition.PlanDefinitionActorComponent res = new PlanDefinition.PlanDefinitionActorComponent();
26263    parsePlanDefinitionActorComponentProperties(json, res);
26264    return res;
26265  }
26266
26267  protected void parsePlanDefinitionActorComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActorComponent res) throws IOException, FHIRFormatError {
26268    parseBackboneElementProperties(json, res);
26269    if (json.has("title"))
26270      res.setTitleElement(parseString(json.get("title").getAsString()));
26271    if (json.has("_title"))
26272      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26273    if (json.has("description"))
26274      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26275    if (json.has("_description"))
26276      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26277    if (json.has("option")) {
26278      JsonArray array = getJArray(json, "option");
26279      for (int i = 0; i < array.size(); i++) {
26280        res.getOption().add(parsePlanDefinitionActorOptionComponent(array.get(i).getAsJsonObject()));
26281      }
26282    };
26283  }
26284
26285  protected PlanDefinition.PlanDefinitionActorOptionComponent parsePlanDefinitionActorOptionComponent(JsonObject json) throws IOException, FHIRFormatError {
26286    PlanDefinition.PlanDefinitionActorOptionComponent res = new PlanDefinition.PlanDefinitionActorOptionComponent();
26287    parsePlanDefinitionActorOptionComponentProperties(json, res);
26288    return res;
26289  }
26290
26291  protected void parsePlanDefinitionActorOptionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActorOptionComponent res) throws IOException, FHIRFormatError {
26292    parseBackboneElementProperties(json, res);
26293    if (json.has("type"))
26294      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
26295    if (json.has("_type"))
26296      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
26297    if (json.has("typeCanonical"))
26298      res.setTypeCanonicalElement(parseCanonical(json.get("typeCanonical").getAsString()));
26299    if (json.has("_typeCanonical"))
26300      parseElementProperties(getJObject(json, "_typeCanonical"), res.getTypeCanonicalElement());
26301    if (json.has("typeReference"))
26302      res.setTypeReference(parseReference(getJObject(json, "typeReference")));
26303    if (json.has("role"))
26304      res.setRole(parseCodeableConcept(getJObject(json, "role")));
26305  }
26306
26307  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionActionComponent(JsonObject json) throws IOException, FHIRFormatError {
26308    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
26309    parsePlanDefinitionActionComponentProperties(json, res);
26310    return res;
26311  }
26312
26313  protected void parsePlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
26314    parseBackboneElementProperties(json, res);
26315    if (json.has("linkId"))
26316      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
26317    if (json.has("_linkId"))
26318      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
26319    if (json.has("prefix"))
26320      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
26321    if (json.has("_prefix"))
26322      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
26323    if (json.has("title"))
26324      res.setTitleElement(parseString(json.get("title").getAsString()));
26325    if (json.has("_title"))
26326      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26327    if (json.has("description"))
26328      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26329    if (json.has("_description"))
26330      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26331    if (json.has("textEquivalent"))
26332      res.setTextEquivalentElement(parseMarkdown(json.get("textEquivalent").getAsString()));
26333    if (json.has("_textEquivalent"))
26334      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
26335    if (json.has("priority"))
26336      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
26337    if (json.has("_priority"))
26338      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
26339    if (json.has("code"))
26340      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26341    if (json.has("reason")) {
26342      JsonArray array = getJArray(json, "reason");
26343      for (int i = 0; i < array.size(); i++) {
26344        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26345      }
26346    };
26347    if (json.has("documentation")) {
26348      JsonArray array = getJArray(json, "documentation");
26349      for (int i = 0; i < array.size(); i++) {
26350        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
26351      }
26352    };
26353    if (json.has("goalId")) {
26354      JsonArray array = getJArray(json, "goalId");
26355      for (int i = 0; i < array.size(); i++) {
26356        if (array.get(i).isJsonNull()) {
26357          res.getGoalId().add(new IdType());
26358        } else {;
26359          res.getGoalId().add(parseId(array.get(i).getAsString()));
26360        }
26361      }
26362    };
26363    if (json.has("_goalId")) {
26364      JsonArray array = getJArray(json, "_goalId");
26365      for (int i = 0; i < array.size(); i++) {
26366        if (i == res.getGoalId().size())
26367          res.getGoalId().add(parseId(null));
26368        if (array.get(i) instanceof JsonObject) 
26369          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
26370      }
26371    };
26372    DataType subject = parseType("subject", json);
26373    if (subject != null)
26374      res.setSubject(subject);
26375    if (json.has("trigger")) {
26376      JsonArray array = getJArray(json, "trigger");
26377      for (int i = 0; i < array.size(); i++) {
26378        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
26379      }
26380    };
26381    if (json.has("condition")) {
26382      JsonArray array = getJArray(json, "condition");
26383      for (int i = 0; i < array.size(); i++) {
26384        res.getCondition().add(parsePlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject()));
26385      }
26386    };
26387    if (json.has("input")) {
26388      JsonArray array = getJArray(json, "input");
26389      for (int i = 0; i < array.size(); i++) {
26390        res.getInput().add(parsePlanDefinitionActionInputComponent(array.get(i).getAsJsonObject()));
26391      }
26392    };
26393    if (json.has("output")) {
26394      JsonArray array = getJArray(json, "output");
26395      for (int i = 0; i < array.size(); i++) {
26396        res.getOutput().add(parsePlanDefinitionActionOutputComponent(array.get(i).getAsJsonObject()));
26397      }
26398    };
26399    if (json.has("relatedAction")) {
26400      JsonArray array = getJArray(json, "relatedAction");
26401      for (int i = 0; i < array.size(); i++) {
26402        res.getRelatedAction().add(parsePlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject()));
26403      }
26404    };
26405    DataType timing = parseType("timing", json);
26406    if (timing != null)
26407      res.setTiming(timing);
26408    if (json.has("location"))
26409      res.setLocation(parseCodeableReference(getJObject(json, "location")));
26410    if (json.has("participant")) {
26411      JsonArray array = getJArray(json, "participant");
26412      for (int i = 0; i < array.size(); i++) {
26413        res.getParticipant().add(parsePlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject()));
26414      }
26415    };
26416    if (json.has("type"))
26417      res.setType(parseCodeableConcept(getJObject(json, "type")));
26418    if (json.has("groupingBehavior"))
26419      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
26420    if (json.has("_groupingBehavior"))
26421      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
26422    if (json.has("selectionBehavior"))
26423      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
26424    if (json.has("_selectionBehavior"))
26425      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
26426    if (json.has("requiredBehavior"))
26427      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
26428    if (json.has("_requiredBehavior"))
26429      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
26430    if (json.has("precheckBehavior"))
26431      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
26432    if (json.has("_precheckBehavior"))
26433      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
26434    if (json.has("cardinalityBehavior"))
26435      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.ActionCardinalityBehaviorEnumFactory()));
26436    if (json.has("_cardinalityBehavior"))
26437      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
26438    DataType definition = parseType("definition", json);
26439    if (definition != null)
26440      res.setDefinition(definition);
26441    if (json.has("transform"))
26442      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
26443    if (json.has("_transform"))
26444      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
26445    if (json.has("dynamicValue")) {
26446      JsonArray array = getJArray(json, "dynamicValue");
26447      for (int i = 0; i < array.size(); i++) {
26448        res.getDynamicValue().add(parsePlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject()));
26449      }
26450    };
26451    if (json.has("action")) {
26452      JsonArray array = getJArray(json, "action");
26453      for (int i = 0; i < array.size(); i++) {
26454        res.getAction().add(parsePlanDefinitionActionComponent(array.get(i).getAsJsonObject()));
26455      }
26456    };
26457  }
26458
26459  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionActionConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
26460    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
26461    parsePlanDefinitionActionConditionComponentProperties(json, res);
26462    return res;
26463  }
26464
26465  protected void parsePlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
26466    parseBackboneElementProperties(json, res);
26467    if (json.has("kind"))
26468      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.ActionConditionKind.NULL, new Enumerations.ActionConditionKindEnumFactory()));
26469    if (json.has("_kind"))
26470      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
26471    if (json.has("expression"))
26472      res.setExpression(parseExpression(getJObject(json, "expression")));
26473  }
26474
26475  protected PlanDefinition.PlanDefinitionActionInputComponent parsePlanDefinitionActionInputComponent(JsonObject json) throws IOException, FHIRFormatError {
26476    PlanDefinition.PlanDefinitionActionInputComponent res = new PlanDefinition.PlanDefinitionActionInputComponent();
26477    parsePlanDefinitionActionInputComponentProperties(json, res);
26478    return res;
26479  }
26480
26481  protected void parsePlanDefinitionActionInputComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionInputComponent res) throws IOException, FHIRFormatError {
26482    parseBackboneElementProperties(json, res);
26483    if (json.has("title"))
26484      res.setTitleElement(parseString(json.get("title").getAsString()));
26485    if (json.has("_title"))
26486      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26487    if (json.has("requirement"))
26488      res.setRequirement(parseDataRequirement(getJObject(json, "requirement")));
26489    if (json.has("relatedData"))
26490      res.setRelatedDataElement(parseId(json.get("relatedData").getAsString()));
26491    if (json.has("_relatedData"))
26492      parseElementProperties(getJObject(json, "_relatedData"), res.getRelatedDataElement());
26493  }
26494
26495  protected PlanDefinition.PlanDefinitionActionOutputComponent parsePlanDefinitionActionOutputComponent(JsonObject json) throws IOException, FHIRFormatError {
26496    PlanDefinition.PlanDefinitionActionOutputComponent res = new PlanDefinition.PlanDefinitionActionOutputComponent();
26497    parsePlanDefinitionActionOutputComponentProperties(json, res);
26498    return res;
26499  }
26500
26501  protected void parsePlanDefinitionActionOutputComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionOutputComponent res) throws IOException, FHIRFormatError {
26502    parseBackboneElementProperties(json, res);
26503    if (json.has("title"))
26504      res.setTitleElement(parseString(json.get("title").getAsString()));
26505    if (json.has("_title"))
26506      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26507    if (json.has("requirement"))
26508      res.setRequirement(parseDataRequirement(getJObject(json, "requirement")));
26509    if (json.has("relatedData"))
26510      res.setRelatedDataElement(parseString(json.get("relatedData").getAsString()));
26511    if (json.has("_relatedData"))
26512      parseElementProperties(getJObject(json, "_relatedData"), res.getRelatedDataElement());
26513  }
26514
26515  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionActionRelatedActionComponent(JsonObject json) throws IOException, FHIRFormatError {
26516    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
26517    parsePlanDefinitionActionRelatedActionComponentProperties(json, res);
26518    return res;
26519  }
26520
26521  protected void parsePlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
26522    parseBackboneElementProperties(json, res);
26523    if (json.has("targetId"))
26524      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
26525    if (json.has("_targetId"))
26526      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
26527    if (json.has("relationship"))
26528      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
26529    if (json.has("_relationship"))
26530      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
26531    if (json.has("endRelationship"))
26532      res.setEndRelationshipElement(parseEnumeration(json.get("endRelationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
26533    if (json.has("_endRelationship"))
26534      parseElementProperties(getJObject(json, "_endRelationship"), res.getEndRelationshipElement());
26535    DataType offset = parseType("offset", json);
26536    if (offset != null)
26537      res.setOffset(offset);
26538  }
26539
26540  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionActionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
26541    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
26542    parsePlanDefinitionActionParticipantComponentProperties(json, res);
26543    return res;
26544  }
26545
26546  protected void parsePlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
26547    parseBackboneElementProperties(json, res);
26548    if (json.has("actorId"))
26549      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
26550    if (json.has("_actorId"))
26551      parseElementProperties(getJObject(json, "_actorId"), res.getActorIdElement());
26552    if (json.has("type"))
26553      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
26554    if (json.has("_type"))
26555      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
26556    if (json.has("typeCanonical"))
26557      res.setTypeCanonicalElement(parseCanonical(json.get("typeCanonical").getAsString()));
26558    if (json.has("_typeCanonical"))
26559      parseElementProperties(getJObject(json, "_typeCanonical"), res.getTypeCanonicalElement());
26560    if (json.has("typeReference"))
26561      res.setTypeReference(parseReference(getJObject(json, "typeReference")));
26562    if (json.has("role"))
26563      res.setRole(parseCodeableConcept(getJObject(json, "role")));
26564    if (json.has("function"))
26565      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
26566  }
26567
26568  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionActionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
26569    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
26570    parsePlanDefinitionActionDynamicValueComponentProperties(json, res);
26571    return res;
26572  }
26573
26574  protected void parsePlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
26575    parseBackboneElementProperties(json, res);
26576    if (json.has("path"))
26577      res.setPathElement(parseString(json.get("path").getAsString()));
26578    if (json.has("_path"))
26579      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
26580    if (json.has("expression"))
26581      res.setExpression(parseExpression(getJObject(json, "expression")));
26582  }
26583
26584  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
26585    Practitioner res = new Practitioner();
26586    parsePractitionerProperties(json, res);
26587    return res;
26588  }
26589
26590  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
26591    parseDomainResourceProperties(json, res);
26592    if (json.has("identifier")) {
26593      JsonArray array = getJArray(json, "identifier");
26594      for (int i = 0; i < array.size(); i++) {
26595        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26596      }
26597    };
26598    if (json.has("active"))
26599      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
26600    if (json.has("_active"))
26601      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
26602    if (json.has("name")) {
26603      JsonArray array = getJArray(json, "name");
26604      for (int i = 0; i < array.size(); i++) {
26605        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
26606      }
26607    };
26608    if (json.has("telecom")) {
26609      JsonArray array = getJArray(json, "telecom");
26610      for (int i = 0; i < array.size(); i++) {
26611        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
26612      }
26613    };
26614    if (json.has("gender"))
26615      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
26616    if (json.has("_gender"))
26617      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
26618    if (json.has("birthDate"))
26619      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
26620    if (json.has("_birthDate"))
26621      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
26622    DataType deceased = parseType("deceased", json);
26623    if (deceased != null)
26624      res.setDeceased(deceased);
26625    if (json.has("address")) {
26626      JsonArray array = getJArray(json, "address");
26627      for (int i = 0; i < array.size(); i++) {
26628        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
26629      }
26630    };
26631    if (json.has("photo")) {
26632      JsonArray array = getJArray(json, "photo");
26633      for (int i = 0; i < array.size(); i++) {
26634        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
26635      }
26636    };
26637    if (json.has("qualification")) {
26638      JsonArray array = getJArray(json, "qualification");
26639      for (int i = 0; i < array.size(); i++) {
26640        res.getQualification().add(parsePractitionerQualificationComponent(array.get(i).getAsJsonObject()));
26641      }
26642    };
26643    if (json.has("communication")) {
26644      JsonArray array = getJArray(json, "communication");
26645      for (int i = 0; i < array.size(); i++) {
26646        res.getCommunication().add(parsePractitionerCommunicationComponent(array.get(i).getAsJsonObject()));
26647      }
26648    };
26649  }
26650
26651  protected Practitioner.PractitionerQualificationComponent parsePractitionerQualificationComponent(JsonObject json) throws IOException, FHIRFormatError {
26652    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
26653    parsePractitionerQualificationComponentProperties(json, res);
26654    return res;
26655  }
26656
26657  protected void parsePractitionerQualificationComponentProperties(JsonObject json, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
26658    parseBackboneElementProperties(json, res);
26659    if (json.has("identifier")) {
26660      JsonArray array = getJArray(json, "identifier");
26661      for (int i = 0; i < array.size(); i++) {
26662        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26663      }
26664    };
26665    if (json.has("code"))
26666      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26667    if (json.has("period"))
26668      res.setPeriod(parsePeriod(getJObject(json, "period")));
26669    if (json.has("issuer"))
26670      res.setIssuer(parseReference(getJObject(json, "issuer")));
26671  }
26672
26673  protected Practitioner.PractitionerCommunicationComponent parsePractitionerCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
26674    Practitioner.PractitionerCommunicationComponent res = new Practitioner.PractitionerCommunicationComponent();
26675    parsePractitionerCommunicationComponentProperties(json, res);
26676    return res;
26677  }
26678
26679  protected void parsePractitionerCommunicationComponentProperties(JsonObject json, Practitioner.PractitionerCommunicationComponent res) throws IOException, FHIRFormatError {
26680    parseBackboneElementProperties(json, res);
26681    if (json.has("language"))
26682      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
26683    if (json.has("preferred"))
26684      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
26685    if (json.has("_preferred"))
26686      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
26687  }
26688
26689  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
26690    PractitionerRole res = new PractitionerRole();
26691    parsePractitionerRoleProperties(json, res);
26692    return res;
26693  }
26694
26695  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
26696    parseDomainResourceProperties(json, res);
26697    if (json.has("identifier")) {
26698      JsonArray array = getJArray(json, "identifier");
26699      for (int i = 0; i < array.size(); i++) {
26700        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26701      }
26702    };
26703    if (json.has("active"))
26704      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
26705    if (json.has("_active"))
26706      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
26707    if (json.has("period"))
26708      res.setPeriod(parsePeriod(getJObject(json, "period")));
26709    if (json.has("practitioner"))
26710      res.setPractitioner(parseReference(getJObject(json, "practitioner")));
26711    if (json.has("organization"))
26712      res.setOrganization(parseReference(getJObject(json, "organization")));
26713    if (json.has("code")) {
26714      JsonArray array = getJArray(json, "code");
26715      for (int i = 0; i < array.size(); i++) {
26716        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26717      }
26718    };
26719    if (json.has("specialty")) {
26720      JsonArray array = getJArray(json, "specialty");
26721      for (int i = 0; i < array.size(); i++) {
26722        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26723      }
26724    };
26725    if (json.has("location")) {
26726      JsonArray array = getJArray(json, "location");
26727      for (int i = 0; i < array.size(); i++) {
26728        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
26729      }
26730    };
26731    if (json.has("healthcareService")) {
26732      JsonArray array = getJArray(json, "healthcareService");
26733      for (int i = 0; i < array.size(); i++) {
26734        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
26735      }
26736    };
26737    if (json.has("contact")) {
26738      JsonArray array = getJArray(json, "contact");
26739      for (int i = 0; i < array.size(); i++) {
26740        res.getContact().add(parseExtendedContactDetail(array.get(i).getAsJsonObject()));
26741      }
26742    };
26743    if (json.has("characteristic")) {
26744      JsonArray array = getJArray(json, "characteristic");
26745      for (int i = 0; i < array.size(); i++) {
26746        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26747      }
26748    };
26749    if (json.has("communication")) {
26750      JsonArray array = getJArray(json, "communication");
26751      for (int i = 0; i < array.size(); i++) {
26752        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26753      }
26754    };
26755    if (json.has("availability")) {
26756      JsonArray array = getJArray(json, "availability");
26757      for (int i = 0; i < array.size(); i++) {
26758        res.getAvailability().add(parseAvailability(array.get(i).getAsJsonObject()));
26759      }
26760    };
26761    if (json.has("endpoint")) {
26762      JsonArray array = getJArray(json, "endpoint");
26763      for (int i = 0; i < array.size(); i++) {
26764        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
26765      }
26766    };
26767  }
26768
26769  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
26770    Procedure res = new Procedure();
26771    parseProcedureProperties(json, res);
26772    return res;
26773  }
26774
26775  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
26776    parseDomainResourceProperties(json, res);
26777    if (json.has("identifier")) {
26778      JsonArray array = getJArray(json, "identifier");
26779      for (int i = 0; i < array.size(); i++) {
26780        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26781      }
26782    };
26783    if (json.has("instantiatesCanonical")) {
26784      JsonArray array = getJArray(json, "instantiatesCanonical");
26785      for (int i = 0; i < array.size(); i++) {
26786        if (array.get(i).isJsonNull()) {
26787          res.getInstantiatesCanonical().add(new CanonicalType());
26788        } else {;
26789          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
26790        }
26791      }
26792    };
26793    if (json.has("_instantiatesCanonical")) {
26794      JsonArray array = getJArray(json, "_instantiatesCanonical");
26795      for (int i = 0; i < array.size(); i++) {
26796        if (i == res.getInstantiatesCanonical().size())
26797          res.getInstantiatesCanonical().add(parseCanonical(null));
26798        if (array.get(i) instanceof JsonObject) 
26799          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
26800      }
26801    };
26802    if (json.has("instantiatesUri")) {
26803      JsonArray array = getJArray(json, "instantiatesUri");
26804      for (int i = 0; i < array.size(); i++) {
26805        if (array.get(i).isJsonNull()) {
26806          res.getInstantiatesUri().add(new UriType());
26807        } else {;
26808          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
26809        }
26810      }
26811    };
26812    if (json.has("_instantiatesUri")) {
26813      JsonArray array = getJArray(json, "_instantiatesUri");
26814      for (int i = 0; i < array.size(); i++) {
26815        if (i == res.getInstantiatesUri().size())
26816          res.getInstantiatesUri().add(parseUri(null));
26817        if (array.get(i) instanceof JsonObject) 
26818          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
26819      }
26820    };
26821    if (json.has("basedOn")) {
26822      JsonArray array = getJArray(json, "basedOn");
26823      for (int i = 0; i < array.size(); i++) {
26824        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
26825      }
26826    };
26827    if (json.has("partOf")) {
26828      JsonArray array = getJArray(json, "partOf");
26829      for (int i = 0; i < array.size(); i++) {
26830        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
26831      }
26832    };
26833    if (json.has("status"))
26834      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
26835    if (json.has("_status"))
26836      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26837    if (json.has("statusReason"))
26838      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
26839    if (json.has("category")) {
26840      JsonArray array = getJArray(json, "category");
26841      for (int i = 0; i < array.size(); i++) {
26842        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26843      }
26844    };
26845    if (json.has("code"))
26846      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26847    if (json.has("subject"))
26848      res.setSubject(parseReference(getJObject(json, "subject")));
26849    if (json.has("focus"))
26850      res.setFocus(parseReference(getJObject(json, "focus")));
26851    if (json.has("encounter"))
26852      res.setEncounter(parseReference(getJObject(json, "encounter")));
26853    DataType occurrence = parseType("occurrence", json);
26854    if (occurrence != null)
26855      res.setOccurrence(occurrence);
26856    if (json.has("recorded"))
26857      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
26858    if (json.has("_recorded"))
26859      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
26860    if (json.has("recorder"))
26861      res.setRecorder(parseReference(getJObject(json, "recorder")));
26862    DataType reported = parseType("reported", json);
26863    if (reported != null)
26864      res.setReported(reported);
26865    if (json.has("performer")) {
26866      JsonArray array = getJArray(json, "performer");
26867      for (int i = 0; i < array.size(); i++) {
26868        res.getPerformer().add(parseProcedurePerformerComponent(array.get(i).getAsJsonObject()));
26869      }
26870    };
26871    if (json.has("location"))
26872      res.setLocation(parseReference(getJObject(json, "location")));
26873    if (json.has("reason")) {
26874      JsonArray array = getJArray(json, "reason");
26875      for (int i = 0; i < array.size(); i++) {
26876        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
26877      }
26878    };
26879    if (json.has("bodySite")) {
26880      JsonArray array = getJArray(json, "bodySite");
26881      for (int i = 0; i < array.size(); i++) {
26882        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26883      }
26884    };
26885    if (json.has("outcome"))
26886      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
26887    if (json.has("report")) {
26888      JsonArray array = getJArray(json, "report");
26889      for (int i = 0; i < array.size(); i++) {
26890        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
26891      }
26892    };
26893    if (json.has("complication")) {
26894      JsonArray array = getJArray(json, "complication");
26895      for (int i = 0; i < array.size(); i++) {
26896        res.getComplication().add(parseCodeableReference(array.get(i).getAsJsonObject()));
26897      }
26898    };
26899    if (json.has("followUp")) {
26900      JsonArray array = getJArray(json, "followUp");
26901      for (int i = 0; i < array.size(); i++) {
26902        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26903      }
26904    };
26905    if (json.has("note")) {
26906      JsonArray array = getJArray(json, "note");
26907      for (int i = 0; i < array.size(); i++) {
26908        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26909      }
26910    };
26911    if (json.has("focalDevice")) {
26912      JsonArray array = getJArray(json, "focalDevice");
26913      for (int i = 0; i < array.size(); i++) {
26914        res.getFocalDevice().add(parseProcedureFocalDeviceComponent(array.get(i).getAsJsonObject()));
26915      }
26916    };
26917    if (json.has("used")) {
26918      JsonArray array = getJArray(json, "used");
26919      for (int i = 0; i < array.size(); i++) {
26920        res.getUsed().add(parseCodeableReference(array.get(i).getAsJsonObject()));
26921      }
26922    };
26923    if (json.has("supportingInfo")) {
26924      JsonArray array = getJArray(json, "supportingInfo");
26925      for (int i = 0; i < array.size(); i++) {
26926        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
26927      }
26928    };
26929  }
26930
26931  protected Procedure.ProcedurePerformerComponent parseProcedurePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
26932    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
26933    parseProcedurePerformerComponentProperties(json, res);
26934    return res;
26935  }
26936
26937  protected void parseProcedurePerformerComponentProperties(JsonObject json, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
26938    parseBackboneElementProperties(json, res);
26939    if (json.has("function"))
26940      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
26941    if (json.has("actor"))
26942      res.setActor(parseReference(getJObject(json, "actor")));
26943    if (json.has("onBehalfOf"))
26944      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
26945    if (json.has("period"))
26946      res.setPeriod(parsePeriod(getJObject(json, "period")));
26947  }
26948
26949  protected Procedure.ProcedureFocalDeviceComponent parseProcedureFocalDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
26950    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
26951    parseProcedureFocalDeviceComponentProperties(json, res);
26952    return res;
26953  }
26954
26955  protected void parseProcedureFocalDeviceComponentProperties(JsonObject json, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
26956    parseBackboneElementProperties(json, res);
26957    if (json.has("action"))
26958      res.setAction(parseCodeableConcept(getJObject(json, "action")));
26959    if (json.has("manipulated"))
26960      res.setManipulated(parseReference(getJObject(json, "manipulated")));
26961  }
26962
26963  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
26964    Provenance res = new Provenance();
26965    parseProvenanceProperties(json, res);
26966    return res;
26967  }
26968
26969  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
26970    parseDomainResourceProperties(json, res);
26971    if (json.has("target")) {
26972      JsonArray array = getJArray(json, "target");
26973      for (int i = 0; i < array.size(); i++) {
26974        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
26975      }
26976    };
26977    DataType occurred = parseType("occurred", json);
26978    if (occurred != null)
26979      res.setOccurred(occurred);
26980    if (json.has("recorded"))
26981      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
26982    if (json.has("_recorded"))
26983      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
26984    if (json.has("policy")) {
26985      JsonArray array = getJArray(json, "policy");
26986      for (int i = 0; i < array.size(); i++) {
26987        if (array.get(i).isJsonNull()) {
26988          res.getPolicy().add(new UriType());
26989        } else {;
26990          res.getPolicy().add(parseUri(array.get(i).getAsString()));
26991        }
26992      }
26993    };
26994    if (json.has("_policy")) {
26995      JsonArray array = getJArray(json, "_policy");
26996      for (int i = 0; i < array.size(); i++) {
26997        if (i == res.getPolicy().size())
26998          res.getPolicy().add(parseUri(null));
26999        if (array.get(i) instanceof JsonObject) 
27000          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
27001      }
27002    };
27003    if (json.has("location"))
27004      res.setLocation(parseReference(getJObject(json, "location")));
27005    if (json.has("authorization")) {
27006      JsonArray array = getJArray(json, "authorization");
27007      for (int i = 0; i < array.size(); i++) {
27008        res.getAuthorization().add(parseCodeableReference(array.get(i).getAsJsonObject()));
27009      }
27010    };
27011    if (json.has("activity"))
27012      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
27013    if (json.has("basedOn")) {
27014      JsonArray array = getJArray(json, "basedOn");
27015      for (int i = 0; i < array.size(); i++) {
27016        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
27017      }
27018    };
27019    if (json.has("patient"))
27020      res.setPatient(parseReference(getJObject(json, "patient")));
27021    if (json.has("encounter"))
27022      res.setEncounter(parseReference(getJObject(json, "encounter")));
27023    if (json.has("agent")) {
27024      JsonArray array = getJArray(json, "agent");
27025      for (int i = 0; i < array.size(); i++) {
27026        res.getAgent().add(parseProvenanceAgentComponent(array.get(i).getAsJsonObject()));
27027      }
27028    };
27029    if (json.has("entity")) {
27030      JsonArray array = getJArray(json, "entity");
27031      for (int i = 0; i < array.size(); i++) {
27032        res.getEntity().add(parseProvenanceEntityComponent(array.get(i).getAsJsonObject()));
27033      }
27034    };
27035    if (json.has("signature")) {
27036      JsonArray array = getJArray(json, "signature");
27037      for (int i = 0; i < array.size(); i++) {
27038        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
27039      }
27040    };
27041  }
27042
27043  protected Provenance.ProvenanceAgentComponent parseProvenanceAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
27044    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
27045    parseProvenanceAgentComponentProperties(json, res);
27046    return res;
27047  }
27048
27049  protected void parseProvenanceAgentComponentProperties(JsonObject json, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
27050    parseBackboneElementProperties(json, res);
27051    if (json.has("type"))
27052      res.setType(parseCodeableConcept(getJObject(json, "type")));
27053    if (json.has("role")) {
27054      JsonArray array = getJArray(json, "role");
27055      for (int i = 0; i < array.size(); i++) {
27056        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27057      }
27058    };
27059    if (json.has("who"))
27060      res.setWho(parseReference(getJObject(json, "who")));
27061    if (json.has("onBehalfOf"))
27062      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
27063  }
27064
27065  protected Provenance.ProvenanceEntityComponent parseProvenanceEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
27066    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
27067    parseProvenanceEntityComponentProperties(json, res);
27068    return res;
27069  }
27070
27071  protected void parseProvenanceEntityComponentProperties(JsonObject json, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
27072    parseBackboneElementProperties(json, res);
27073    if (json.has("role"))
27074      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
27075    if (json.has("_role"))
27076      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
27077    if (json.has("what"))
27078      res.setWhat(parseReference(getJObject(json, "what")));
27079    if (json.has("agent")) {
27080      JsonArray array = getJArray(json, "agent");
27081      for (int i = 0; i < array.size(); i++) {
27082        res.getAgent().add(parseProvenanceAgentComponent(array.get(i).getAsJsonObject()));
27083      }
27084    };
27085  }
27086
27087  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
27088    Questionnaire res = new Questionnaire();
27089    parseQuestionnaireProperties(json, res);
27090    return res;
27091  }
27092
27093  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
27094    parseMetadataResourceProperties(json, res);
27095    if (json.has("url"))
27096      res.setUrlElement(parseUri(json.get("url").getAsString()));
27097    if (json.has("_url"))
27098      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27099    if (json.has("identifier")) {
27100      JsonArray array = getJArray(json, "identifier");
27101      for (int i = 0; i < array.size(); i++) {
27102        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27103      }
27104    };
27105    if (json.has("version"))
27106      res.setVersionElement(parseString(json.get("version").getAsString()));
27107    if (json.has("_version"))
27108      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27109    DataType versionAlgorithm = parseType("versionAlgorithm", json);
27110    if (versionAlgorithm != null)
27111      res.setVersionAlgorithm(versionAlgorithm);
27112    if (json.has("name"))
27113      res.setNameElement(parseString(json.get("name").getAsString()));
27114    if (json.has("_name"))
27115      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27116    if (json.has("title"))
27117      res.setTitleElement(parseString(json.get("title").getAsString()));
27118    if (json.has("_title"))
27119      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27120    if (json.has("derivedFrom")) {
27121      JsonArray array = getJArray(json, "derivedFrom");
27122      for (int i = 0; i < array.size(); i++) {
27123        if (array.get(i).isJsonNull()) {
27124          res.getDerivedFrom().add(new CanonicalType());
27125        } else {;
27126          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
27127        }
27128      }
27129    };
27130    if (json.has("_derivedFrom")) {
27131      JsonArray array = getJArray(json, "_derivedFrom");
27132      for (int i = 0; i < array.size(); i++) {
27133        if (i == res.getDerivedFrom().size())
27134          res.getDerivedFrom().add(parseCanonical(null));
27135        if (array.get(i) instanceof JsonObject) 
27136          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
27137      }
27138    };
27139    if (json.has("status"))
27140      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
27141    if (json.has("_status"))
27142      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27143    if (json.has("experimental"))
27144      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27145    if (json.has("_experimental"))
27146      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
27147    if (json.has("subjectType")) {
27148      JsonArray array = getJArray(json, "subjectType");
27149      for (int i = 0; i < array.size(); i++) {
27150        if (array.get(i).isJsonNull()) {
27151          res.getSubjectType().add(new CodeType());
27152        } else {;
27153          res.getSubjectType().add(parseCode(array.get(i).getAsString()));
27154        }
27155      }
27156    };
27157    if (json.has("_subjectType")) {
27158      JsonArray array = getJArray(json, "_subjectType");
27159      for (int i = 0; i < array.size(); i++) {
27160        if (i == res.getSubjectType().size())
27161          res.getSubjectType().add(parseCode(null));
27162        if (array.get(i) instanceof JsonObject) 
27163          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
27164      }
27165    };
27166    if (json.has("date"))
27167      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27168    if (json.has("_date"))
27169      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
27170    if (json.has("publisher"))
27171      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
27172    if (json.has("_publisher"))
27173      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
27174    if (json.has("contact")) {
27175      JsonArray array = getJArray(json, "contact");
27176      for (int i = 0; i < array.size(); i++) {
27177        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27178      }
27179    };
27180    if (json.has("description"))
27181      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27182    if (json.has("_description"))
27183      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27184    if (json.has("useContext")) {
27185      JsonArray array = getJArray(json, "useContext");
27186      for (int i = 0; i < array.size(); i++) {
27187        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27188      }
27189    };
27190    if (json.has("jurisdiction")) {
27191      JsonArray array = getJArray(json, "jurisdiction");
27192      for (int i = 0; i < array.size(); i++) {
27193        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27194      }
27195    };
27196    if (json.has("purpose"))
27197      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27198    if (json.has("_purpose"))
27199      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
27200    if (json.has("copyright"))
27201      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27202    if (json.has("_copyright"))
27203      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
27204    if (json.has("copyrightLabel"))
27205      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
27206    if (json.has("_copyrightLabel"))
27207      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
27208    if (json.has("approvalDate"))
27209      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
27210    if (json.has("_approvalDate"))
27211      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
27212    if (json.has("lastReviewDate"))
27213      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
27214    if (json.has("_lastReviewDate"))
27215      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
27216    if (json.has("effectivePeriod"))
27217      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
27218    if (json.has("code")) {
27219      JsonArray array = getJArray(json, "code");
27220      for (int i = 0; i < array.size(); i++) {
27221        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
27222      }
27223    };
27224    if (json.has("item")) {
27225      JsonArray array = getJArray(json, "item");
27226      for (int i = 0; i < array.size(); i++) {
27227        res.getItem().add(parseQuestionnaireItemComponent(array.get(i).getAsJsonObject()));
27228      }
27229    };
27230  }
27231
27232  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireItemComponent(JsonObject json) throws IOException, FHIRFormatError {
27233    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
27234    parseQuestionnaireItemComponentProperties(json, res);
27235    return res;
27236  }
27237
27238  protected void parseQuestionnaireItemComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
27239    parseBackboneElementProperties(json, res);
27240    if (json.has("linkId"))
27241      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
27242    if (json.has("_linkId"))
27243      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
27244    if (json.has("definition"))
27245      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
27246    if (json.has("_definition"))
27247      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
27248    if (json.has("code")) {
27249      JsonArray array = getJArray(json, "code");
27250      for (int i = 0; i < array.size(); i++) {
27251        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
27252      }
27253    };
27254    if (json.has("prefix"))
27255      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
27256    if (json.has("_prefix"))
27257      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
27258    if (json.has("text"))
27259      res.setTextElement(parseString(json.get("text").getAsString()));
27260    if (json.has("_text"))
27261      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
27262    if (json.has("type"))
27263      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
27264    if (json.has("_type"))
27265      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27266    if (json.has("enableWhen")) {
27267      JsonArray array = getJArray(json, "enableWhen");
27268      for (int i = 0; i < array.size(); i++) {
27269        res.getEnableWhen().add(parseQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject()));
27270      }
27271    };
27272    if (json.has("enableBehavior"))
27273      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
27274    if (json.has("_enableBehavior"))
27275      parseElementProperties(getJObject(json, "_enableBehavior"), res.getEnableBehaviorElement());
27276    if (json.has("disabledDisplay"))
27277      res.setDisabledDisplayElement(parseEnumeration(json.get("disabledDisplay").getAsString(), Questionnaire.QuestionnaireItemDisabledDisplay.NULL, new Questionnaire.QuestionnaireItemDisabledDisplayEnumFactory()));
27278    if (json.has("_disabledDisplay"))
27279      parseElementProperties(getJObject(json, "_disabledDisplay"), res.getDisabledDisplayElement());
27280    if (json.has("required"))
27281      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
27282    if (json.has("_required"))
27283      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
27284    if (json.has("repeats"))
27285      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
27286    if (json.has("_repeats"))
27287      parseElementProperties(getJObject(json, "_repeats"), res.getRepeatsElement());
27288    if (json.has("readOnly"))
27289      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
27290    if (json.has("_readOnly"))
27291      parseElementProperties(getJObject(json, "_readOnly"), res.getReadOnlyElement());
27292    if (json.has("maxLength"))
27293      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
27294    if (json.has("_maxLength"))
27295      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
27296    if (json.has("answerConstraint"))
27297      res.setAnswerConstraintElement(parseEnumeration(json.get("answerConstraint").getAsString(), Questionnaire.QuestionnaireAnswerConstraint.NULL, new Questionnaire.QuestionnaireAnswerConstraintEnumFactory()));
27298    if (json.has("_answerConstraint"))
27299      parseElementProperties(getJObject(json, "_answerConstraint"), res.getAnswerConstraintElement());
27300    if (json.has("answerValueSet"))
27301      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
27302    if (json.has("_answerValueSet"))
27303      parseElementProperties(getJObject(json, "_answerValueSet"), res.getAnswerValueSetElement());
27304    if (json.has("answerOption")) {
27305      JsonArray array = getJArray(json, "answerOption");
27306      for (int i = 0; i < array.size(); i++) {
27307        res.getAnswerOption().add(parseQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject()));
27308      }
27309    };
27310    if (json.has("initial")) {
27311      JsonArray array = getJArray(json, "initial");
27312      for (int i = 0; i < array.size(); i++) {
27313        res.getInitial().add(parseQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject()));
27314      }
27315    };
27316    if (json.has("item")) {
27317      JsonArray array = getJArray(json, "item");
27318      for (int i = 0; i < array.size(); i++) {
27319        res.getItem().add(parseQuestionnaireItemComponent(array.get(i).getAsJsonObject()));
27320      }
27321    };
27322  }
27323
27324  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireItemEnableWhenComponent(JsonObject json) throws IOException, FHIRFormatError {
27325    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
27326    parseQuestionnaireItemEnableWhenComponentProperties(json, res);
27327    return res;
27328  }
27329
27330  protected void parseQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
27331    parseBackboneElementProperties(json, res);
27332    if (json.has("question"))
27333      res.setQuestionElement(parseString(json.get("question").getAsString()));
27334    if (json.has("_question"))
27335      parseElementProperties(getJObject(json, "_question"), res.getQuestionElement());
27336    if (json.has("operator"))
27337      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
27338    if (json.has("_operator"))
27339      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
27340    DataType answer = parseType("answer", json);
27341    if (answer != null)
27342      res.setAnswer(answer);
27343  }
27344
27345  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireItemAnswerOptionComponent(JsonObject json) throws IOException, FHIRFormatError {
27346    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
27347    parseQuestionnaireItemAnswerOptionComponentProperties(json, res);
27348    return res;
27349  }
27350
27351  protected void parseQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
27352    parseBackboneElementProperties(json, res);
27353    DataType value = parseType("value", json);
27354    if (value != null)
27355      res.setValue(value);
27356    if (json.has("initialSelected"))
27357      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
27358    if (json.has("_initialSelected"))
27359      parseElementProperties(getJObject(json, "_initialSelected"), res.getInitialSelectedElement());
27360  }
27361
27362  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireItemInitialComponent(JsonObject json) throws IOException, FHIRFormatError {
27363    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
27364    parseQuestionnaireItemInitialComponentProperties(json, res);
27365    return res;
27366  }
27367
27368  protected void parseQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
27369    parseBackboneElementProperties(json, res);
27370    DataType value = parseType("value", json);
27371    if (value != null)
27372      res.setValue(value);
27373  }
27374
27375  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
27376    QuestionnaireResponse res = new QuestionnaireResponse();
27377    parseQuestionnaireResponseProperties(json, res);
27378    return res;
27379  }
27380
27381  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
27382    parseDomainResourceProperties(json, res);
27383    if (json.has("identifier")) {
27384      JsonArray array = getJArray(json, "identifier");
27385      for (int i = 0; i < array.size(); i++) {
27386        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27387      }
27388    };
27389    if (json.has("basedOn")) {
27390      JsonArray array = getJArray(json, "basedOn");
27391      for (int i = 0; i < array.size(); i++) {
27392        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
27393      }
27394    };
27395    if (json.has("partOf")) {
27396      JsonArray array = getJArray(json, "partOf");
27397      for (int i = 0; i < array.size(); i++) {
27398        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
27399      }
27400    };
27401    if (json.has("questionnaire"))
27402      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
27403    if (json.has("_questionnaire"))
27404      parseElementProperties(getJObject(json, "_questionnaire"), res.getQuestionnaireElement());
27405    if (json.has("status"))
27406      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
27407    if (json.has("_status"))
27408      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27409    if (json.has("subject"))
27410      res.setSubject(parseReference(getJObject(json, "subject")));
27411    if (json.has("encounter"))
27412      res.setEncounter(parseReference(getJObject(json, "encounter")));
27413    if (json.has("authored"))
27414      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
27415    if (json.has("_authored"))
27416      parseElementProperties(getJObject(json, "_authored"), res.getAuthoredElement());
27417    if (json.has("author"))
27418      res.setAuthor(parseReference(getJObject(json, "author")));
27419    if (json.has("source"))
27420      res.setSource(parseReference(getJObject(json, "source")));
27421    if (json.has("item")) {
27422      JsonArray array = getJArray(json, "item");
27423      for (int i = 0; i < array.size(); i++) {
27424        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
27425      }
27426    };
27427  }
27428
27429  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
27430    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
27431    parseQuestionnaireResponseItemComponentProperties(json, res);
27432    return res;
27433  }
27434
27435  protected void parseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
27436    parseBackboneElementProperties(json, res);
27437    if (json.has("linkId"))
27438      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
27439    if (json.has("_linkId"))
27440      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
27441    if (json.has("definition"))
27442      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
27443    if (json.has("_definition"))
27444      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
27445    if (json.has("text"))
27446      res.setTextElement(parseString(json.get("text").getAsString()));
27447    if (json.has("_text"))
27448      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
27449    if (json.has("answer")) {
27450      JsonArray array = getJArray(json, "answer");
27451      for (int i = 0; i < array.size(); i++) {
27452        res.getAnswer().add(parseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject()));
27453      }
27454    };
27455    if (json.has("item")) {
27456      JsonArray array = getJArray(json, "item");
27457      for (int i = 0; i < array.size(); i++) {
27458        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
27459      }
27460    };
27461  }
27462
27463  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseItemAnswerComponent(JsonObject json) throws IOException, FHIRFormatError {
27464    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
27465    parseQuestionnaireResponseItemAnswerComponentProperties(json, res);
27466    return res;
27467  }
27468
27469  protected void parseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
27470    parseBackboneElementProperties(json, res);
27471    DataType value = parseType("value", json);
27472    if (value != null)
27473      res.setValue(value);
27474    if (json.has("item")) {
27475      JsonArray array = getJArray(json, "item");
27476      for (int i = 0; i < array.size(); i++) {
27477        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
27478      }
27479    };
27480  }
27481
27482  protected RegulatedAuthorization parseRegulatedAuthorization(JsonObject json) throws IOException, FHIRFormatError {
27483    RegulatedAuthorization res = new RegulatedAuthorization();
27484    parseRegulatedAuthorizationProperties(json, res);
27485    return res;
27486  }
27487
27488  protected void parseRegulatedAuthorizationProperties(JsonObject json, RegulatedAuthorization res) throws IOException, FHIRFormatError {
27489    parseDomainResourceProperties(json, res);
27490    if (json.has("identifier")) {
27491      JsonArray array = getJArray(json, "identifier");
27492      for (int i = 0; i < array.size(); i++) {
27493        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27494      }
27495    };
27496    if (json.has("subject")) {
27497      JsonArray array = getJArray(json, "subject");
27498      for (int i = 0; i < array.size(); i++) {
27499        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
27500      }
27501    };
27502    if (json.has("type"))
27503      res.setType(parseCodeableConcept(getJObject(json, "type")));
27504    if (json.has("description"))
27505      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27506    if (json.has("_description"))
27507      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27508    if (json.has("region")) {
27509      JsonArray array = getJArray(json, "region");
27510      for (int i = 0; i < array.size(); i++) {
27511        res.getRegion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27512      }
27513    };
27514    if (json.has("status"))
27515      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
27516    if (json.has("statusDate"))
27517      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
27518    if (json.has("_statusDate"))
27519      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
27520    if (json.has("validityPeriod"))
27521      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
27522    if (json.has("indication")) {
27523      JsonArray array = getJArray(json, "indication");
27524      for (int i = 0; i < array.size(); i++) {
27525        res.getIndication().add(parseCodeableReference(array.get(i).getAsJsonObject()));
27526      }
27527    };
27528    if (json.has("intendedUse"))
27529      res.setIntendedUse(parseCodeableConcept(getJObject(json, "intendedUse")));
27530    if (json.has("basis")) {
27531      JsonArray array = getJArray(json, "basis");
27532      for (int i = 0; i < array.size(); i++) {
27533        res.getBasis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27534      }
27535    };
27536    if (json.has("holder"))
27537      res.setHolder(parseReference(getJObject(json, "holder")));
27538    if (json.has("regulator"))
27539      res.setRegulator(parseReference(getJObject(json, "regulator")));
27540    if (json.has("attachedDocument")) {
27541      JsonArray array = getJArray(json, "attachedDocument");
27542      for (int i = 0; i < array.size(); i++) {
27543        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
27544      }
27545    };
27546    if (json.has("case"))
27547      res.setCase(parseRegulatedAuthorizationCaseComponent(getJObject(json, "case")));
27548  }
27549
27550  protected RegulatedAuthorization.RegulatedAuthorizationCaseComponent parseRegulatedAuthorizationCaseComponent(JsonObject json) throws IOException, FHIRFormatError {
27551    RegulatedAuthorization.RegulatedAuthorizationCaseComponent res = new RegulatedAuthorization.RegulatedAuthorizationCaseComponent();
27552    parseRegulatedAuthorizationCaseComponentProperties(json, res);
27553    return res;
27554  }
27555
27556  protected void parseRegulatedAuthorizationCaseComponentProperties(JsonObject json, RegulatedAuthorization.RegulatedAuthorizationCaseComponent res) throws IOException, FHIRFormatError {
27557    parseBackboneElementProperties(json, res);
27558    if (json.has("identifier"))
27559      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
27560    if (json.has("type"))
27561      res.setType(parseCodeableConcept(getJObject(json, "type")));
27562    if (json.has("status"))
27563      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
27564    DataType date = parseType("date", json);
27565    if (date != null)
27566      res.setDate(date);
27567    if (json.has("application")) {
27568      JsonArray array = getJArray(json, "application");
27569      for (int i = 0; i < array.size(); i++) {
27570        res.getApplication().add(parseRegulatedAuthorizationCaseComponent(array.get(i).getAsJsonObject()));
27571      }
27572    };
27573  }
27574
27575  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
27576    RelatedPerson res = new RelatedPerson();
27577    parseRelatedPersonProperties(json, res);
27578    return res;
27579  }
27580
27581  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
27582    parseDomainResourceProperties(json, res);
27583    if (json.has("identifier")) {
27584      JsonArray array = getJArray(json, "identifier");
27585      for (int i = 0; i < array.size(); i++) {
27586        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27587      }
27588    };
27589    if (json.has("active"))
27590      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
27591    if (json.has("_active"))
27592      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
27593    if (json.has("patient"))
27594      res.setPatient(parseReference(getJObject(json, "patient")));
27595    if (json.has("relationship")) {
27596      JsonArray array = getJArray(json, "relationship");
27597      for (int i = 0; i < array.size(); i++) {
27598        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27599      }
27600    };
27601    if (json.has("name")) {
27602      JsonArray array = getJArray(json, "name");
27603      for (int i = 0; i < array.size(); i++) {
27604        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
27605      }
27606    };
27607    if (json.has("telecom")) {
27608      JsonArray array = getJArray(json, "telecom");
27609      for (int i = 0; i < array.size(); i++) {
27610        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
27611      }
27612    };
27613    if (json.has("gender"))
27614      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
27615    if (json.has("_gender"))
27616      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
27617    if (json.has("birthDate"))
27618      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
27619    if (json.has("_birthDate"))
27620      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
27621    if (json.has("address")) {
27622      JsonArray array = getJArray(json, "address");
27623      for (int i = 0; i < array.size(); i++) {
27624        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
27625      }
27626    };
27627    if (json.has("photo")) {
27628      JsonArray array = getJArray(json, "photo");
27629      for (int i = 0; i < array.size(); i++) {
27630        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
27631      }
27632    };
27633    if (json.has("period"))
27634      res.setPeriod(parsePeriod(getJObject(json, "period")));
27635    if (json.has("communication")) {
27636      JsonArray array = getJArray(json, "communication");
27637      for (int i = 0; i < array.size(); i++) {
27638        res.getCommunication().add(parseRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject()));
27639      }
27640    };
27641  }
27642
27643  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
27644    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
27645    parseRelatedPersonCommunicationComponentProperties(json, res);
27646    return res;
27647  }
27648
27649  protected void parseRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
27650    parseBackboneElementProperties(json, res);
27651    if (json.has("language"))
27652      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
27653    if (json.has("preferred"))
27654      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
27655    if (json.has("_preferred"))
27656      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
27657  }
27658
27659  protected RequestOrchestration parseRequestOrchestration(JsonObject json) throws IOException, FHIRFormatError {
27660    RequestOrchestration res = new RequestOrchestration();
27661    parseRequestOrchestrationProperties(json, res);
27662    return res;
27663  }
27664
27665  protected void parseRequestOrchestrationProperties(JsonObject json, RequestOrchestration res) throws IOException, FHIRFormatError {
27666    parseDomainResourceProperties(json, res);
27667    if (json.has("identifier")) {
27668      JsonArray array = getJArray(json, "identifier");
27669      for (int i = 0; i < array.size(); i++) {
27670        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27671      }
27672    };
27673    if (json.has("instantiatesCanonical")) {
27674      JsonArray array = getJArray(json, "instantiatesCanonical");
27675      for (int i = 0; i < array.size(); i++) {
27676        if (array.get(i).isJsonNull()) {
27677          res.getInstantiatesCanonical().add(new CanonicalType());
27678        } else {;
27679          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
27680        }
27681      }
27682    };
27683    if (json.has("_instantiatesCanonical")) {
27684      JsonArray array = getJArray(json, "_instantiatesCanonical");
27685      for (int i = 0; i < array.size(); i++) {
27686        if (i == res.getInstantiatesCanonical().size())
27687          res.getInstantiatesCanonical().add(parseCanonical(null));
27688        if (array.get(i) instanceof JsonObject) 
27689          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
27690      }
27691    };
27692    if (json.has("instantiatesUri")) {
27693      JsonArray array = getJArray(json, "instantiatesUri");
27694      for (int i = 0; i < array.size(); i++) {
27695        if (array.get(i).isJsonNull()) {
27696          res.getInstantiatesUri().add(new UriType());
27697        } else {;
27698          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
27699        }
27700      }
27701    };
27702    if (json.has("_instantiatesUri")) {
27703      JsonArray array = getJArray(json, "_instantiatesUri");
27704      for (int i = 0; i < array.size(); i++) {
27705        if (i == res.getInstantiatesUri().size())
27706          res.getInstantiatesUri().add(parseUri(null));
27707        if (array.get(i) instanceof JsonObject) 
27708          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
27709      }
27710    };
27711    if (json.has("basedOn")) {
27712      JsonArray array = getJArray(json, "basedOn");
27713      for (int i = 0; i < array.size(); i++) {
27714        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
27715      }
27716    };
27717    if (json.has("replaces")) {
27718      JsonArray array = getJArray(json, "replaces");
27719      for (int i = 0; i < array.size(); i++) {
27720        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
27721      }
27722    };
27723    if (json.has("groupIdentifier"))
27724      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
27725    if (json.has("status"))
27726      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
27727    if (json.has("_status"))
27728      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27729    if (json.has("intent"))
27730      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
27731    if (json.has("_intent"))
27732      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
27733    if (json.has("priority"))
27734      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
27735    if (json.has("_priority"))
27736      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
27737    if (json.has("code"))
27738      res.setCode(parseCodeableConcept(getJObject(json, "code")));
27739    if (json.has("subject"))
27740      res.setSubject(parseReference(getJObject(json, "subject")));
27741    if (json.has("encounter"))
27742      res.setEncounter(parseReference(getJObject(json, "encounter")));
27743    if (json.has("authoredOn"))
27744      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
27745    if (json.has("_authoredOn"))
27746      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
27747    if (json.has("author"))
27748      res.setAuthor(parseReference(getJObject(json, "author")));
27749    if (json.has("reason")) {
27750      JsonArray array = getJArray(json, "reason");
27751      for (int i = 0; i < array.size(); i++) {
27752        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
27753      }
27754    };
27755    if (json.has("goal")) {
27756      JsonArray array = getJArray(json, "goal");
27757      for (int i = 0; i < array.size(); i++) {
27758        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
27759      }
27760    };
27761    if (json.has("note")) {
27762      JsonArray array = getJArray(json, "note");
27763      for (int i = 0; i < array.size(); i++) {
27764        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
27765      }
27766    };
27767    if (json.has("action")) {
27768      JsonArray array = getJArray(json, "action");
27769      for (int i = 0; i < array.size(); i++) {
27770        res.getAction().add(parseRequestOrchestrationActionComponent(array.get(i).getAsJsonObject()));
27771      }
27772    };
27773  }
27774
27775  protected RequestOrchestration.RequestOrchestrationActionComponent parseRequestOrchestrationActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27776    RequestOrchestration.RequestOrchestrationActionComponent res = new RequestOrchestration.RequestOrchestrationActionComponent();
27777    parseRequestOrchestrationActionComponentProperties(json, res);
27778    return res;
27779  }
27780
27781  protected void parseRequestOrchestrationActionComponentProperties(JsonObject json, RequestOrchestration.RequestOrchestrationActionComponent res) throws IOException, FHIRFormatError {
27782    parseBackboneElementProperties(json, res);
27783    if (json.has("linkId"))
27784      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
27785    if (json.has("_linkId"))
27786      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
27787    if (json.has("prefix"))
27788      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
27789    if (json.has("_prefix"))
27790      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
27791    if (json.has("title"))
27792      res.setTitleElement(parseString(json.get("title").getAsString()));
27793    if (json.has("_title"))
27794      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27795    if (json.has("description"))
27796      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27797    if (json.has("_description"))
27798      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27799    if (json.has("textEquivalent"))
27800      res.setTextEquivalentElement(parseMarkdown(json.get("textEquivalent").getAsString()));
27801    if (json.has("_textEquivalent"))
27802      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
27803    if (json.has("priority"))
27804      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
27805    if (json.has("_priority"))
27806      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
27807    if (json.has("code")) {
27808      JsonArray array = getJArray(json, "code");
27809      for (int i = 0; i < array.size(); i++) {
27810        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27811      }
27812    };
27813    if (json.has("documentation")) {
27814      JsonArray array = getJArray(json, "documentation");
27815      for (int i = 0; i < array.size(); i++) {
27816        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
27817      }
27818    };
27819    if (json.has("goal")) {
27820      JsonArray array = getJArray(json, "goal");
27821      for (int i = 0; i < array.size(); i++) {
27822        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
27823      }
27824    };
27825    if (json.has("condition")) {
27826      JsonArray array = getJArray(json, "condition");
27827      for (int i = 0; i < array.size(); i++) {
27828        res.getCondition().add(parseRequestOrchestrationActionConditionComponent(array.get(i).getAsJsonObject()));
27829      }
27830    };
27831    if (json.has("input")) {
27832      JsonArray array = getJArray(json, "input");
27833      for (int i = 0; i < array.size(); i++) {
27834        res.getInput().add(parseRequestOrchestrationActionInputComponent(array.get(i).getAsJsonObject()));
27835      }
27836    };
27837    if (json.has("output")) {
27838      JsonArray array = getJArray(json, "output");
27839      for (int i = 0; i < array.size(); i++) {
27840        res.getOutput().add(parseRequestOrchestrationActionOutputComponent(array.get(i).getAsJsonObject()));
27841      }
27842    };
27843    if (json.has("relatedAction")) {
27844      JsonArray array = getJArray(json, "relatedAction");
27845      for (int i = 0; i < array.size(); i++) {
27846        res.getRelatedAction().add(parseRequestOrchestrationActionRelatedActionComponent(array.get(i).getAsJsonObject()));
27847      }
27848    };
27849    DataType timing = parseType("timing", json);
27850    if (timing != null)
27851      res.setTiming(timing);
27852    if (json.has("location"))
27853      res.setLocation(parseCodeableReference(getJObject(json, "location")));
27854    if (json.has("participant")) {
27855      JsonArray array = getJArray(json, "participant");
27856      for (int i = 0; i < array.size(); i++) {
27857        res.getParticipant().add(parseRequestOrchestrationActionParticipantComponent(array.get(i).getAsJsonObject()));
27858      }
27859    };
27860    if (json.has("type"))
27861      res.setType(parseCodeableConcept(getJObject(json, "type")));
27862    if (json.has("groupingBehavior"))
27863      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
27864    if (json.has("_groupingBehavior"))
27865      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
27866    if (json.has("selectionBehavior"))
27867      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
27868    if (json.has("_selectionBehavior"))
27869      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
27870    if (json.has("requiredBehavior"))
27871      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
27872    if (json.has("_requiredBehavior"))
27873      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
27874    if (json.has("precheckBehavior"))
27875      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
27876    if (json.has("_precheckBehavior"))
27877      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
27878    if (json.has("cardinalityBehavior"))
27879      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.ActionCardinalityBehaviorEnumFactory()));
27880    if (json.has("_cardinalityBehavior"))
27881      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
27882    if (json.has("resource"))
27883      res.setResource(parseReference(getJObject(json, "resource")));
27884    DataType definition = parseType("definition", json);
27885    if (definition != null)
27886      res.setDefinition(definition);
27887    if (json.has("transform"))
27888      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
27889    if (json.has("_transform"))
27890      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
27891    if (json.has("dynamicValue")) {
27892      JsonArray array = getJArray(json, "dynamicValue");
27893      for (int i = 0; i < array.size(); i++) {
27894        res.getDynamicValue().add(parseRequestOrchestrationActionDynamicValueComponent(array.get(i).getAsJsonObject()));
27895      }
27896    };
27897    if (json.has("action")) {
27898      JsonArray array = getJArray(json, "action");
27899      for (int i = 0; i < array.size(); i++) {
27900        res.getAction().add(parseRequestOrchestrationActionComponent(array.get(i).getAsJsonObject()));
27901      }
27902    };
27903  }
27904
27905  protected RequestOrchestration.RequestOrchestrationActionConditionComponent parseRequestOrchestrationActionConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
27906    RequestOrchestration.RequestOrchestrationActionConditionComponent res = new RequestOrchestration.RequestOrchestrationActionConditionComponent();
27907    parseRequestOrchestrationActionConditionComponentProperties(json, res);
27908    return res;
27909  }
27910
27911  protected void parseRequestOrchestrationActionConditionComponentProperties(JsonObject json, RequestOrchestration.RequestOrchestrationActionConditionComponent res) throws IOException, FHIRFormatError {
27912    parseBackboneElementProperties(json, res);
27913    if (json.has("kind"))
27914      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.ActionConditionKind.NULL, new Enumerations.ActionConditionKindEnumFactory()));
27915    if (json.has("_kind"))
27916      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
27917    if (json.has("expression"))
27918      res.setExpression(parseExpression(getJObject(json, "expression")));
27919  }
27920
27921  protected RequestOrchestration.RequestOrchestrationActionInputComponent parseRequestOrchestrationActionInputComponent(JsonObject json) throws IOException, FHIRFormatError {
27922    RequestOrchestration.RequestOrchestrationActionInputComponent res = new RequestOrchestration.RequestOrchestrationActionInputComponent();
27923    parseRequestOrchestrationActionInputComponentProperties(json, res);
27924    return res;
27925  }
27926
27927  protected void parseRequestOrchestrationActionInputComponentProperties(JsonObject json, RequestOrchestration.RequestOrchestrationActionInputComponent res) throws IOException, FHIRFormatError {
27928    parseBackboneElementProperties(json, res);
27929    if (json.has("title"))
27930      res.setTitleElement(parseString(json.get("title").getAsString()));
27931    if (json.has("_title"))
27932      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27933    if (json.has("requirement"))
27934      res.setRequirement(parseDataRequirement(getJObject(json, "requirement")));
27935    if (json.has("relatedData"))
27936      res.setRelatedDataElement(parseId(json.get("relatedData").getAsString()));
27937    if (json.has("_relatedData"))
27938      parseElementProperties(getJObject(json, "_relatedData"), res.getRelatedDataElement());
27939  }
27940
27941  protected RequestOrchestration.RequestOrchestrationActionOutputComponent parseRequestOrchestrationActionOutputComponent(JsonObject json) throws IOException, FHIRFormatError {
27942    RequestOrchestration.RequestOrchestrationActionOutputComponent res = new RequestOrchestration.RequestOrchestrationActionOutputComponent();
27943    parseRequestOrchestrationActionOutputComponentProperties(json, res);
27944    return res;
27945  }
27946
27947  protected void parseRequestOrchestrationActionOutputComponentProperties(JsonObject json, RequestOrchestration.RequestOrchestrationActionOutputComponent res) throws IOException, FHIRFormatError {
27948    parseBackboneElementProperties(json, res);
27949    if (json.has("title"))
27950      res.setTitleElement(parseString(json.get("title").getAsString()));
27951    if (json.has("_title"))
27952      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27953    if (json.has("requirement"))
27954      res.setRequirement(parseDataRequirement(getJObject(json, "requirement")));
27955    if (json.has("relatedData"))
27956      res.setRelatedDataElement(parseString(json.get("relatedData").getAsString()));
27957    if (json.has("_relatedData"))
27958      parseElementProperties(getJObject(json, "_relatedData"), res.getRelatedDataElement());
27959  }
27960
27961  protected RequestOrchestration.RequestOrchestrationActionRelatedActionComponent parseRequestOrchestrationActionRelatedActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27962    RequestOrchestration.RequestOrchestrationActionRelatedActionComponent res = new RequestOrchestration.RequestOrchestrationActionRelatedActionComponent();
27963    parseRequestOrchestrationActionRelatedActionComponentProperties(json, res);
27964    return res;
27965  }
27966
27967  protected void parseRequestOrchestrationActionRelatedActionComponentProperties(JsonObject json, RequestOrchestration.RequestOrchestrationActionRelatedActionComponent res) throws IOException, FHIRFormatError {
27968    parseBackboneElementProperties(json, res);
27969    if (json.has("targetId"))
27970      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
27971    if (json.has("_targetId"))
27972      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
27973    if (json.has("relationship"))
27974      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
27975    if (json.has("_relationship"))
27976      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
27977    if (json.has("endRelationship"))
27978      res.setEndRelationshipElement(parseEnumeration(json.get("endRelationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
27979    if (json.has("_endRelationship"))
27980      parseElementProperties(getJObject(json, "_endRelationship"), res.getEndRelationshipElement());
27981    DataType offset = parseType("offset", json);
27982    if (offset != null)
27983      res.setOffset(offset);
27984  }
27985
27986  protected RequestOrchestration.RequestOrchestrationActionParticipantComponent parseRequestOrchestrationActionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
27987    RequestOrchestration.RequestOrchestrationActionParticipantComponent res = new RequestOrchestration.RequestOrchestrationActionParticipantComponent();
27988    parseRequestOrchestrationActionParticipantComponentProperties(json, res);
27989    return res;
27990  }
27991
27992  protected void parseRequestOrchestrationActionParticipantComponentProperties(JsonObject json, RequestOrchestration.RequestOrchestrationActionParticipantComponent res) throws IOException, FHIRFormatError {
27993    parseBackboneElementProperties(json, res);
27994    if (json.has("type"))
27995      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
27996    if (json.has("_type"))
27997      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27998    if (json.has("typeCanonical"))
27999      res.setTypeCanonicalElement(parseCanonical(json.get("typeCanonical").getAsString()));
28000    if (json.has("_typeCanonical"))
28001      parseElementProperties(getJObject(json, "_typeCanonical"), res.getTypeCanonicalElement());
28002    if (json.has("typeReference"))
28003      res.setTypeReference(parseReference(getJObject(json, "typeReference")));
28004    if (json.has("role"))
28005      res.setRole(parseCodeableConcept(getJObject(json, "role")));
28006    if (json.has("function"))
28007      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
28008    DataType actor = parseType("actor", json);
28009    if (actor != null)
28010      res.setActor(actor);
28011  }
28012
28013  protected RequestOrchestration.RequestOrchestrationActionDynamicValueComponent parseRequestOrchestrationActionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
28014    RequestOrchestration.RequestOrchestrationActionDynamicValueComponent res = new RequestOrchestration.RequestOrchestrationActionDynamicValueComponent();
28015    parseRequestOrchestrationActionDynamicValueComponentProperties(json, res);
28016    return res;
28017  }
28018
28019  protected void parseRequestOrchestrationActionDynamicValueComponentProperties(JsonObject json, RequestOrchestration.RequestOrchestrationActionDynamicValueComponent res) throws IOException, FHIRFormatError {
28020    parseBackboneElementProperties(json, res);
28021    if (json.has("path"))
28022      res.setPathElement(parseString(json.get("path").getAsString()));
28023    if (json.has("_path"))
28024      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
28025    if (json.has("expression"))
28026      res.setExpression(parseExpression(getJObject(json, "expression")));
28027  }
28028
28029  protected Requirements parseRequirements(JsonObject json) throws IOException, FHIRFormatError {
28030    Requirements res = new Requirements();
28031    parseRequirementsProperties(json, res);
28032    return res;
28033  }
28034
28035  protected void parseRequirementsProperties(JsonObject json, Requirements res) throws IOException, FHIRFormatError {
28036    parseCanonicalResourceProperties(json, res);
28037    if (json.has("url"))
28038      res.setUrlElement(parseUri(json.get("url").getAsString()));
28039    if (json.has("_url"))
28040      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
28041    if (json.has("identifier")) {
28042      JsonArray array = getJArray(json, "identifier");
28043      for (int i = 0; i < array.size(); i++) {
28044        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28045      }
28046    };
28047    if (json.has("version"))
28048      res.setVersionElement(parseString(json.get("version").getAsString()));
28049    if (json.has("_version"))
28050      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
28051    DataType versionAlgorithm = parseType("versionAlgorithm", json);
28052    if (versionAlgorithm != null)
28053      res.setVersionAlgorithm(versionAlgorithm);
28054    if (json.has("name"))
28055      res.setNameElement(parseString(json.get("name").getAsString()));
28056    if (json.has("_name"))
28057      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28058    if (json.has("title"))
28059      res.setTitleElement(parseString(json.get("title").getAsString()));
28060    if (json.has("_title"))
28061      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
28062    if (json.has("status"))
28063      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
28064    if (json.has("_status"))
28065      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28066    if (json.has("experimental"))
28067      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
28068    if (json.has("_experimental"))
28069      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
28070    if (json.has("date"))
28071      res.setDateElement(parseDateTime(json.get("date").getAsString()));
28072    if (json.has("_date"))
28073      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
28074    if (json.has("publisher"))
28075      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
28076    if (json.has("_publisher"))
28077      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
28078    if (json.has("contact")) {
28079      JsonArray array = getJArray(json, "contact");
28080      for (int i = 0; i < array.size(); i++) {
28081        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
28082      }
28083    };
28084    if (json.has("description"))
28085      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28086    if (json.has("_description"))
28087      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28088    if (json.has("useContext")) {
28089      JsonArray array = getJArray(json, "useContext");
28090      for (int i = 0; i < array.size(); i++) {
28091        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
28092      }
28093    };
28094    if (json.has("jurisdiction")) {
28095      JsonArray array = getJArray(json, "jurisdiction");
28096      for (int i = 0; i < array.size(); i++) {
28097        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28098      }
28099    };
28100    if (json.has("purpose"))
28101      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
28102    if (json.has("_purpose"))
28103      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
28104    if (json.has("copyright"))
28105      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
28106    if (json.has("_copyright"))
28107      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
28108    if (json.has("copyrightLabel"))
28109      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
28110    if (json.has("_copyrightLabel"))
28111      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
28112    if (json.has("derivedFrom")) {
28113      JsonArray array = getJArray(json, "derivedFrom");
28114      for (int i = 0; i < array.size(); i++) {
28115        if (array.get(i).isJsonNull()) {
28116          res.getDerivedFrom().add(new CanonicalType());
28117        } else {;
28118          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
28119        }
28120      }
28121    };
28122    if (json.has("_derivedFrom")) {
28123      JsonArray array = getJArray(json, "_derivedFrom");
28124      for (int i = 0; i < array.size(); i++) {
28125        if (i == res.getDerivedFrom().size())
28126          res.getDerivedFrom().add(parseCanonical(null));
28127        if (array.get(i) instanceof JsonObject) 
28128          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
28129      }
28130    };
28131    if (json.has("reference")) {
28132      JsonArray array = getJArray(json, "reference");
28133      for (int i = 0; i < array.size(); i++) {
28134        if (array.get(i).isJsonNull()) {
28135          res.getReference().add(new UrlType());
28136        } else {;
28137          res.getReference().add(parseUrl(array.get(i).getAsString()));
28138        }
28139      }
28140    };
28141    if (json.has("_reference")) {
28142      JsonArray array = getJArray(json, "_reference");
28143      for (int i = 0; i < array.size(); i++) {
28144        if (i == res.getReference().size())
28145          res.getReference().add(parseUrl(null));
28146        if (array.get(i) instanceof JsonObject) 
28147          parseElementProperties(array.get(i).getAsJsonObject(), res.getReference().get(i));
28148      }
28149    };
28150    if (json.has("actor")) {
28151      JsonArray array = getJArray(json, "actor");
28152      for (int i = 0; i < array.size(); i++) {
28153        if (array.get(i).isJsonNull()) {
28154          res.getActor().add(new CanonicalType());
28155        } else {;
28156          res.getActor().add(parseCanonical(array.get(i).getAsString()));
28157        }
28158      }
28159    };
28160    if (json.has("_actor")) {
28161      JsonArray array = getJArray(json, "_actor");
28162      for (int i = 0; i < array.size(); i++) {
28163        if (i == res.getActor().size())
28164          res.getActor().add(parseCanonical(null));
28165        if (array.get(i) instanceof JsonObject) 
28166          parseElementProperties(array.get(i).getAsJsonObject(), res.getActor().get(i));
28167      }
28168    };
28169    if (json.has("statement")) {
28170      JsonArray array = getJArray(json, "statement");
28171      for (int i = 0; i < array.size(); i++) {
28172        res.getStatement().add(parseRequirementsStatementComponent(array.get(i).getAsJsonObject()));
28173      }
28174    };
28175  }
28176
28177  protected Requirements.RequirementsStatementComponent parseRequirementsStatementComponent(JsonObject json) throws IOException, FHIRFormatError {
28178    Requirements.RequirementsStatementComponent res = new Requirements.RequirementsStatementComponent();
28179    parseRequirementsStatementComponentProperties(json, res);
28180    return res;
28181  }
28182
28183  protected void parseRequirementsStatementComponentProperties(JsonObject json, Requirements.RequirementsStatementComponent res) throws IOException, FHIRFormatError {
28184    parseBackboneElementProperties(json, res);
28185    if (json.has("key"))
28186      res.setKeyElement(parseId(json.get("key").getAsString()));
28187    if (json.has("_key"))
28188      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
28189    if (json.has("label"))
28190      res.setLabelElement(parseString(json.get("label").getAsString()));
28191    if (json.has("_label"))
28192      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
28193    if (json.has("conformance")) {
28194      JsonArray array = getJArray(json, "conformance");
28195      for (int i = 0; i < array.size(); i++) {
28196        if (array.get(i).isJsonNull()) {
28197          res.getConformance().add(new Enumeration<Requirements.ConformanceExpectation>(new Requirements.ConformanceExpectationEnumFactory(), Requirements.ConformanceExpectation.NULL));
28198        } else {;
28199          res.getConformance().add(parseEnumeration(array.get(i).getAsString(), Requirements.ConformanceExpectation.NULL, new Requirements.ConformanceExpectationEnumFactory()));
28200        }
28201      }
28202    };
28203    if (json.has("_conformance")) {
28204      JsonArray array = getJArray(json, "_conformance");
28205      for (int i = 0; i < array.size(); i++) {
28206        if (i == res.getConformance().size())
28207          res.getConformance().add(parseEnumeration(null, Requirements.ConformanceExpectation.NULL, new Requirements.ConformanceExpectationEnumFactory()));
28208        if (array.get(i) instanceof JsonObject) 
28209          parseElementProperties(array.get(i).getAsJsonObject(), res.getConformance().get(i));
28210      }
28211    };
28212    if (json.has("conditionality"))
28213      res.setConditionalityElement(parseBoolean(json.get("conditionality").getAsBoolean()));
28214    if (json.has("_conditionality"))
28215      parseElementProperties(getJObject(json, "_conditionality"), res.getConditionalityElement());
28216    if (json.has("requirement"))
28217      res.setRequirementElement(parseMarkdown(json.get("requirement").getAsString()));
28218    if (json.has("_requirement"))
28219      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
28220    if (json.has("derivedFrom"))
28221      res.setDerivedFromElement(parseString(json.get("derivedFrom").getAsString()));
28222    if (json.has("_derivedFrom"))
28223      parseElementProperties(getJObject(json, "_derivedFrom"), res.getDerivedFromElement());
28224    if (json.has("parent"))
28225      res.setParentElement(parseString(json.get("parent").getAsString()));
28226    if (json.has("_parent"))
28227      parseElementProperties(getJObject(json, "_parent"), res.getParentElement());
28228    if (json.has("satisfiedBy")) {
28229      JsonArray array = getJArray(json, "satisfiedBy");
28230      for (int i = 0; i < array.size(); i++) {
28231        if (array.get(i).isJsonNull()) {
28232          res.getSatisfiedBy().add(new UrlType());
28233        } else {;
28234          res.getSatisfiedBy().add(parseUrl(array.get(i).getAsString()));
28235        }
28236      }
28237    };
28238    if (json.has("_satisfiedBy")) {
28239      JsonArray array = getJArray(json, "_satisfiedBy");
28240      for (int i = 0; i < array.size(); i++) {
28241        if (i == res.getSatisfiedBy().size())
28242          res.getSatisfiedBy().add(parseUrl(null));
28243        if (array.get(i) instanceof JsonObject) 
28244          parseElementProperties(array.get(i).getAsJsonObject(), res.getSatisfiedBy().get(i));
28245      }
28246    };
28247    if (json.has("reference")) {
28248      JsonArray array = getJArray(json, "reference");
28249      for (int i = 0; i < array.size(); i++) {
28250        if (array.get(i).isJsonNull()) {
28251          res.getReference().add(new UrlType());
28252        } else {;
28253          res.getReference().add(parseUrl(array.get(i).getAsString()));
28254        }
28255      }
28256    };
28257    if (json.has("_reference")) {
28258      JsonArray array = getJArray(json, "_reference");
28259      for (int i = 0; i < array.size(); i++) {
28260        if (i == res.getReference().size())
28261          res.getReference().add(parseUrl(null));
28262        if (array.get(i) instanceof JsonObject) 
28263          parseElementProperties(array.get(i).getAsJsonObject(), res.getReference().get(i));
28264      }
28265    };
28266    if (json.has("source")) {
28267      JsonArray array = getJArray(json, "source");
28268      for (int i = 0; i < array.size(); i++) {
28269        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
28270      }
28271    };
28272  }
28273
28274  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
28275    ResearchStudy res = new ResearchStudy();
28276    parseResearchStudyProperties(json, res);
28277    return res;
28278  }
28279
28280  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
28281    parseDomainResourceProperties(json, res);
28282    if (json.has("url"))
28283      res.setUrlElement(parseUri(json.get("url").getAsString()));
28284    if (json.has("_url"))
28285      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
28286    if (json.has("identifier")) {
28287      JsonArray array = getJArray(json, "identifier");
28288      for (int i = 0; i < array.size(); i++) {
28289        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28290      }
28291    };
28292    if (json.has("version"))
28293      res.setVersionElement(parseString(json.get("version").getAsString()));
28294    if (json.has("_version"))
28295      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
28296    if (json.has("name"))
28297      res.setNameElement(parseString(json.get("name").getAsString()));
28298    if (json.has("_name"))
28299      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28300    if (json.has("title"))
28301      res.setTitleElement(parseString(json.get("title").getAsString()));
28302    if (json.has("_title"))
28303      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
28304    if (json.has("label")) {
28305      JsonArray array = getJArray(json, "label");
28306      for (int i = 0; i < array.size(); i++) {
28307        res.getLabel().add(parseResearchStudyLabelComponent(array.get(i).getAsJsonObject()));
28308      }
28309    };
28310    if (json.has("protocol")) {
28311      JsonArray array = getJArray(json, "protocol");
28312      for (int i = 0; i < array.size(); i++) {
28313        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
28314      }
28315    };
28316    if (json.has("partOf")) {
28317      JsonArray array = getJArray(json, "partOf");
28318      for (int i = 0; i < array.size(); i++) {
28319        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
28320      }
28321    };
28322    if (json.has("relatedArtifact")) {
28323      JsonArray array = getJArray(json, "relatedArtifact");
28324      for (int i = 0; i < array.size(); i++) {
28325        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
28326      }
28327    };
28328    if (json.has("date"))
28329      res.setDateElement(parseDateTime(json.get("date").getAsString()));
28330    if (json.has("_date"))
28331      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
28332    if (json.has("status"))
28333      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
28334    if (json.has("_status"))
28335      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28336    if (json.has("primaryPurposeType"))
28337      res.setPrimaryPurposeType(parseCodeableConcept(getJObject(json, "primaryPurposeType")));
28338    if (json.has("phase"))
28339      res.setPhase(parseCodeableConcept(getJObject(json, "phase")));
28340    if (json.has("studyDesign")) {
28341      JsonArray array = getJArray(json, "studyDesign");
28342      for (int i = 0; i < array.size(); i++) {
28343        res.getStudyDesign().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28344      }
28345    };
28346    if (json.has("focus")) {
28347      JsonArray array = getJArray(json, "focus");
28348      for (int i = 0; i < array.size(); i++) {
28349        res.getFocus().add(parseCodeableReference(array.get(i).getAsJsonObject()));
28350      }
28351    };
28352    if (json.has("condition")) {
28353      JsonArray array = getJArray(json, "condition");
28354      for (int i = 0; i < array.size(); i++) {
28355        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28356      }
28357    };
28358    if (json.has("keyword")) {
28359      JsonArray array = getJArray(json, "keyword");
28360      for (int i = 0; i < array.size(); i++) {
28361        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28362      }
28363    };
28364    if (json.has("region")) {
28365      JsonArray array = getJArray(json, "region");
28366      for (int i = 0; i < array.size(); i++) {
28367        res.getRegion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28368      }
28369    };
28370    if (json.has("descriptionSummary"))
28371      res.setDescriptionSummaryElement(parseMarkdown(json.get("descriptionSummary").getAsString()));
28372    if (json.has("_descriptionSummary"))
28373      parseElementProperties(getJObject(json, "_descriptionSummary"), res.getDescriptionSummaryElement());
28374    if (json.has("description"))
28375      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28376    if (json.has("_description"))
28377      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28378    if (json.has("period"))
28379      res.setPeriod(parsePeriod(getJObject(json, "period")));
28380    if (json.has("site")) {
28381      JsonArray array = getJArray(json, "site");
28382      for (int i = 0; i < array.size(); i++) {
28383        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
28384      }
28385    };
28386    if (json.has("note")) {
28387      JsonArray array = getJArray(json, "note");
28388      for (int i = 0; i < array.size(); i++) {
28389        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
28390      }
28391    };
28392    if (json.has("classifier")) {
28393      JsonArray array = getJArray(json, "classifier");
28394      for (int i = 0; i < array.size(); i++) {
28395        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28396      }
28397    };
28398    if (json.has("associatedParty")) {
28399      JsonArray array = getJArray(json, "associatedParty");
28400      for (int i = 0; i < array.size(); i++) {
28401        res.getAssociatedParty().add(parseResearchStudyAssociatedPartyComponent(array.get(i).getAsJsonObject()));
28402      }
28403    };
28404    if (json.has("progressStatus")) {
28405      JsonArray array = getJArray(json, "progressStatus");
28406      for (int i = 0; i < array.size(); i++) {
28407        res.getProgressStatus().add(parseResearchStudyProgressStatusComponent(array.get(i).getAsJsonObject()));
28408      }
28409    };
28410    if (json.has("whyStopped"))
28411      res.setWhyStopped(parseCodeableConcept(getJObject(json, "whyStopped")));
28412    if (json.has("recruitment"))
28413      res.setRecruitment(parseResearchStudyRecruitmentComponent(getJObject(json, "recruitment")));
28414    if (json.has("comparisonGroup")) {
28415      JsonArray array = getJArray(json, "comparisonGroup");
28416      for (int i = 0; i < array.size(); i++) {
28417        res.getComparisonGroup().add(parseResearchStudyComparisonGroupComponent(array.get(i).getAsJsonObject()));
28418      }
28419    };
28420    if (json.has("objective")) {
28421      JsonArray array = getJArray(json, "objective");
28422      for (int i = 0; i < array.size(); i++) {
28423        res.getObjective().add(parseResearchStudyObjectiveComponent(array.get(i).getAsJsonObject()));
28424      }
28425    };
28426    if (json.has("outcomeMeasure")) {
28427      JsonArray array = getJArray(json, "outcomeMeasure");
28428      for (int i = 0; i < array.size(); i++) {
28429        res.getOutcomeMeasure().add(parseResearchStudyOutcomeMeasureComponent(array.get(i).getAsJsonObject()));
28430      }
28431    };
28432    if (json.has("result")) {
28433      JsonArray array = getJArray(json, "result");
28434      for (int i = 0; i < array.size(); i++) {
28435        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
28436      }
28437    };
28438  }
28439
28440  protected ResearchStudy.ResearchStudyLabelComponent parseResearchStudyLabelComponent(JsonObject json) throws IOException, FHIRFormatError {
28441    ResearchStudy.ResearchStudyLabelComponent res = new ResearchStudy.ResearchStudyLabelComponent();
28442    parseResearchStudyLabelComponentProperties(json, res);
28443    return res;
28444  }
28445
28446  protected void parseResearchStudyLabelComponentProperties(JsonObject json, ResearchStudy.ResearchStudyLabelComponent res) throws IOException, FHIRFormatError {
28447    parseBackboneElementProperties(json, res);
28448    if (json.has("type"))
28449      res.setType(parseCodeableConcept(getJObject(json, "type")));
28450    if (json.has("value"))
28451      res.setValueElement(parseString(json.get("value").getAsString()));
28452    if (json.has("_value"))
28453      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
28454  }
28455
28456  protected ResearchStudy.ResearchStudyAssociatedPartyComponent parseResearchStudyAssociatedPartyComponent(JsonObject json) throws IOException, FHIRFormatError {
28457    ResearchStudy.ResearchStudyAssociatedPartyComponent res = new ResearchStudy.ResearchStudyAssociatedPartyComponent();
28458    parseResearchStudyAssociatedPartyComponentProperties(json, res);
28459    return res;
28460  }
28461
28462  protected void parseResearchStudyAssociatedPartyComponentProperties(JsonObject json, ResearchStudy.ResearchStudyAssociatedPartyComponent res) throws IOException, FHIRFormatError {
28463    parseBackboneElementProperties(json, res);
28464    if (json.has("name"))
28465      res.setNameElement(parseString(json.get("name").getAsString()));
28466    if (json.has("_name"))
28467      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28468    if (json.has("role"))
28469      res.setRole(parseCodeableConcept(getJObject(json, "role")));
28470    if (json.has("period")) {
28471      JsonArray array = getJArray(json, "period");
28472      for (int i = 0; i < array.size(); i++) {
28473        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
28474      }
28475    };
28476    if (json.has("classifier")) {
28477      JsonArray array = getJArray(json, "classifier");
28478      for (int i = 0; i < array.size(); i++) {
28479        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28480      }
28481    };
28482    if (json.has("party"))
28483      res.setParty(parseReference(getJObject(json, "party")));
28484  }
28485
28486  protected ResearchStudy.ResearchStudyProgressStatusComponent parseResearchStudyProgressStatusComponent(JsonObject json) throws IOException, FHIRFormatError {
28487    ResearchStudy.ResearchStudyProgressStatusComponent res = new ResearchStudy.ResearchStudyProgressStatusComponent();
28488    parseResearchStudyProgressStatusComponentProperties(json, res);
28489    return res;
28490  }
28491
28492  protected void parseResearchStudyProgressStatusComponentProperties(JsonObject json, ResearchStudy.ResearchStudyProgressStatusComponent res) throws IOException, FHIRFormatError {
28493    parseBackboneElementProperties(json, res);
28494    if (json.has("state"))
28495      res.setState(parseCodeableConcept(getJObject(json, "state")));
28496    if (json.has("actual"))
28497      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
28498    if (json.has("_actual"))
28499      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
28500    if (json.has("period"))
28501      res.setPeriod(parsePeriod(getJObject(json, "period")));
28502  }
28503
28504  protected ResearchStudy.ResearchStudyRecruitmentComponent parseResearchStudyRecruitmentComponent(JsonObject json) throws IOException, FHIRFormatError {
28505    ResearchStudy.ResearchStudyRecruitmentComponent res = new ResearchStudy.ResearchStudyRecruitmentComponent();
28506    parseResearchStudyRecruitmentComponentProperties(json, res);
28507    return res;
28508  }
28509
28510  protected void parseResearchStudyRecruitmentComponentProperties(JsonObject json, ResearchStudy.ResearchStudyRecruitmentComponent res) throws IOException, FHIRFormatError {
28511    parseBackboneElementProperties(json, res);
28512    if (json.has("targetNumber"))
28513      res.setTargetNumberElement(parseUnsignedInt(json.get("targetNumber").getAsString()));
28514    if (json.has("_targetNumber"))
28515      parseElementProperties(getJObject(json, "_targetNumber"), res.getTargetNumberElement());
28516    if (json.has("actualNumber"))
28517      res.setActualNumberElement(parseUnsignedInt(json.get("actualNumber").getAsString()));
28518    if (json.has("_actualNumber"))
28519      parseElementProperties(getJObject(json, "_actualNumber"), res.getActualNumberElement());
28520    if (json.has("eligibility"))
28521      res.setEligibility(parseReference(getJObject(json, "eligibility")));
28522    if (json.has("actualGroup"))
28523      res.setActualGroup(parseReference(getJObject(json, "actualGroup")));
28524  }
28525
28526  protected ResearchStudy.ResearchStudyComparisonGroupComponent parseResearchStudyComparisonGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
28527    ResearchStudy.ResearchStudyComparisonGroupComponent res = new ResearchStudy.ResearchStudyComparisonGroupComponent();
28528    parseResearchStudyComparisonGroupComponentProperties(json, res);
28529    return res;
28530  }
28531
28532  protected void parseResearchStudyComparisonGroupComponentProperties(JsonObject json, ResearchStudy.ResearchStudyComparisonGroupComponent res) throws IOException, FHIRFormatError {
28533    parseBackboneElementProperties(json, res);
28534    if (json.has("linkId"))
28535      res.setLinkIdElement(parseId(json.get("linkId").getAsString()));
28536    if (json.has("_linkId"))
28537      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
28538    if (json.has("name"))
28539      res.setNameElement(parseString(json.get("name").getAsString()));
28540    if (json.has("_name"))
28541      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28542    if (json.has("type"))
28543      res.setType(parseCodeableConcept(getJObject(json, "type")));
28544    if (json.has("description"))
28545      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28546    if (json.has("_description"))
28547      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28548    if (json.has("intendedExposure")) {
28549      JsonArray array = getJArray(json, "intendedExposure");
28550      for (int i = 0; i < array.size(); i++) {
28551        res.getIntendedExposure().add(parseReference(array.get(i).getAsJsonObject()));
28552      }
28553    };
28554    if (json.has("observedGroup"))
28555      res.setObservedGroup(parseReference(getJObject(json, "observedGroup")));
28556  }
28557
28558  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyObjectiveComponent(JsonObject json) throws IOException, FHIRFormatError {
28559    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
28560    parseResearchStudyObjectiveComponentProperties(json, res);
28561    return res;
28562  }
28563
28564  protected void parseResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
28565    parseBackboneElementProperties(json, res);
28566    if (json.has("name"))
28567      res.setNameElement(parseString(json.get("name").getAsString()));
28568    if (json.has("_name"))
28569      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28570    if (json.has("type"))
28571      res.setType(parseCodeableConcept(getJObject(json, "type")));
28572    if (json.has("description"))
28573      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28574    if (json.has("_description"))
28575      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28576  }
28577
28578  protected ResearchStudy.ResearchStudyOutcomeMeasureComponent parseResearchStudyOutcomeMeasureComponent(JsonObject json) throws IOException, FHIRFormatError {
28579    ResearchStudy.ResearchStudyOutcomeMeasureComponent res = new ResearchStudy.ResearchStudyOutcomeMeasureComponent();
28580    parseResearchStudyOutcomeMeasureComponentProperties(json, res);
28581    return res;
28582  }
28583
28584  protected void parseResearchStudyOutcomeMeasureComponentProperties(JsonObject json, ResearchStudy.ResearchStudyOutcomeMeasureComponent res) throws IOException, FHIRFormatError {
28585    parseBackboneElementProperties(json, res);
28586    if (json.has("name"))
28587      res.setNameElement(parseString(json.get("name").getAsString()));
28588    if (json.has("_name"))
28589      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28590    if (json.has("type")) {
28591      JsonArray array = getJArray(json, "type");
28592      for (int i = 0; i < array.size(); i++) {
28593        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28594      }
28595    };
28596    if (json.has("description"))
28597      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28598    if (json.has("_description"))
28599      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28600    if (json.has("reference"))
28601      res.setReference(parseReference(getJObject(json, "reference")));
28602  }
28603
28604  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
28605    ResearchSubject res = new ResearchSubject();
28606    parseResearchSubjectProperties(json, res);
28607    return res;
28608  }
28609
28610  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
28611    parseDomainResourceProperties(json, res);
28612    if (json.has("identifier")) {
28613      JsonArray array = getJArray(json, "identifier");
28614      for (int i = 0; i < array.size(); i++) {
28615        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28616      }
28617    };
28618    if (json.has("status"))
28619      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
28620    if (json.has("_status"))
28621      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28622    if (json.has("progress")) {
28623      JsonArray array = getJArray(json, "progress");
28624      for (int i = 0; i < array.size(); i++) {
28625        res.getProgress().add(parseResearchSubjectProgressComponent(array.get(i).getAsJsonObject()));
28626      }
28627    };
28628    if (json.has("period"))
28629      res.setPeriod(parsePeriod(getJObject(json, "period")));
28630    if (json.has("study"))
28631      res.setStudy(parseReference(getJObject(json, "study")));
28632    if (json.has("subject"))
28633      res.setSubject(parseReference(getJObject(json, "subject")));
28634    if (json.has("assignedComparisonGroup"))
28635      res.setAssignedComparisonGroupElement(parseId(json.get("assignedComparisonGroup").getAsString()));
28636    if (json.has("_assignedComparisonGroup"))
28637      parseElementProperties(getJObject(json, "_assignedComparisonGroup"), res.getAssignedComparisonGroupElement());
28638    if (json.has("actualComparisonGroup"))
28639      res.setActualComparisonGroupElement(parseId(json.get("actualComparisonGroup").getAsString()));
28640    if (json.has("_actualComparisonGroup"))
28641      parseElementProperties(getJObject(json, "_actualComparisonGroup"), res.getActualComparisonGroupElement());
28642    if (json.has("consent")) {
28643      JsonArray array = getJArray(json, "consent");
28644      for (int i = 0; i < array.size(); i++) {
28645        res.getConsent().add(parseReference(array.get(i).getAsJsonObject()));
28646      }
28647    };
28648  }
28649
28650  protected ResearchSubject.ResearchSubjectProgressComponent parseResearchSubjectProgressComponent(JsonObject json) throws IOException, FHIRFormatError {
28651    ResearchSubject.ResearchSubjectProgressComponent res = new ResearchSubject.ResearchSubjectProgressComponent();
28652    parseResearchSubjectProgressComponentProperties(json, res);
28653    return res;
28654  }
28655
28656  protected void parseResearchSubjectProgressComponentProperties(JsonObject json, ResearchSubject.ResearchSubjectProgressComponent res) throws IOException, FHIRFormatError {
28657    parseBackboneElementProperties(json, res);
28658    if (json.has("type"))
28659      res.setType(parseCodeableConcept(getJObject(json, "type")));
28660    if (json.has("subjectState"))
28661      res.setSubjectState(parseCodeableConcept(getJObject(json, "subjectState")));
28662    if (json.has("milestone"))
28663      res.setMilestone(parseCodeableConcept(getJObject(json, "milestone")));
28664    if (json.has("reason"))
28665      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
28666    if (json.has("startDate"))
28667      res.setStartDateElement(parseDateTime(json.get("startDate").getAsString()));
28668    if (json.has("_startDate"))
28669      parseElementProperties(getJObject(json, "_startDate"), res.getStartDateElement());
28670    if (json.has("endDate"))
28671      res.setEndDateElement(parseDateTime(json.get("endDate").getAsString()));
28672    if (json.has("_endDate"))
28673      parseElementProperties(getJObject(json, "_endDate"), res.getEndDateElement());
28674  }
28675
28676  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
28677    RiskAssessment res = new RiskAssessment();
28678    parseRiskAssessmentProperties(json, res);
28679    return res;
28680  }
28681
28682  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
28683    parseDomainResourceProperties(json, res);
28684    if (json.has("identifier")) {
28685      JsonArray array = getJArray(json, "identifier");
28686      for (int i = 0; i < array.size(); i++) {
28687        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28688      }
28689    };
28690    if (json.has("basedOn"))
28691      res.setBasedOn(parseReference(getJObject(json, "basedOn")));
28692    if (json.has("parent"))
28693      res.setParent(parseReference(getJObject(json, "parent")));
28694    if (json.has("status"))
28695      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
28696    if (json.has("_status"))
28697      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28698    if (json.has("method"))
28699      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
28700    if (json.has("code"))
28701      res.setCode(parseCodeableConcept(getJObject(json, "code")));
28702    if (json.has("subject"))
28703      res.setSubject(parseReference(getJObject(json, "subject")));
28704    if (json.has("encounter"))
28705      res.setEncounter(parseReference(getJObject(json, "encounter")));
28706    DataType occurrence = parseType("occurrence", json);
28707    if (occurrence != null)
28708      res.setOccurrence(occurrence);
28709    if (json.has("condition"))
28710      res.setCondition(parseReference(getJObject(json, "condition")));
28711    if (json.has("performer"))
28712      res.setPerformer(parseReference(getJObject(json, "performer")));
28713    if (json.has("reason")) {
28714      JsonArray array = getJArray(json, "reason");
28715      for (int i = 0; i < array.size(); i++) {
28716        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
28717      }
28718    };
28719    if (json.has("basis")) {
28720      JsonArray array = getJArray(json, "basis");
28721      for (int i = 0; i < array.size(); i++) {
28722        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
28723      }
28724    };
28725    if (json.has("prediction")) {
28726      JsonArray array = getJArray(json, "prediction");
28727      for (int i = 0; i < array.size(); i++) {
28728        res.getPrediction().add(parseRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject()));
28729      }
28730    };
28731    if (json.has("mitigation"))
28732      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
28733    if (json.has("_mitigation"))
28734      parseElementProperties(getJObject(json, "_mitigation"), res.getMitigationElement());
28735    if (json.has("note")) {
28736      JsonArray array = getJArray(json, "note");
28737      for (int i = 0; i < array.size(); i++) {
28738        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
28739      }
28740    };
28741  }
28742
28743  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentPredictionComponent(JsonObject json) throws IOException, FHIRFormatError {
28744    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
28745    parseRiskAssessmentPredictionComponentProperties(json, res);
28746    return res;
28747  }
28748
28749  protected void parseRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
28750    parseBackboneElementProperties(json, res);
28751    if (json.has("outcome"))
28752      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
28753    DataType probability = parseType("probability", json);
28754    if (probability != null)
28755      res.setProbability(probability);
28756    if (json.has("qualitativeRisk"))
28757      res.setQualitativeRisk(parseCodeableConcept(getJObject(json, "qualitativeRisk")));
28758    if (json.has("relativeRisk"))
28759      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
28760    if (json.has("_relativeRisk"))
28761      parseElementProperties(getJObject(json, "_relativeRisk"), res.getRelativeRiskElement());
28762    DataType when = parseType("when", json);
28763    if (when != null)
28764      res.setWhen(when);
28765    if (json.has("rationale"))
28766      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
28767    if (json.has("_rationale"))
28768      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
28769  }
28770
28771  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
28772    Schedule res = new Schedule();
28773    parseScheduleProperties(json, res);
28774    return res;
28775  }
28776
28777  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
28778    parseDomainResourceProperties(json, res);
28779    if (json.has("identifier")) {
28780      JsonArray array = getJArray(json, "identifier");
28781      for (int i = 0; i < array.size(); i++) {
28782        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28783      }
28784    };
28785    if (json.has("active"))
28786      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
28787    if (json.has("_active"))
28788      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
28789    if (json.has("serviceCategory")) {
28790      JsonArray array = getJArray(json, "serviceCategory");
28791      for (int i = 0; i < array.size(); i++) {
28792        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28793      }
28794    };
28795    if (json.has("serviceType")) {
28796      JsonArray array = getJArray(json, "serviceType");
28797      for (int i = 0; i < array.size(); i++) {
28798        res.getServiceType().add(parseCodeableReference(array.get(i).getAsJsonObject()));
28799      }
28800    };
28801    if (json.has("specialty")) {
28802      JsonArray array = getJArray(json, "specialty");
28803      for (int i = 0; i < array.size(); i++) {
28804        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28805      }
28806    };
28807    if (json.has("name"))
28808      res.setNameElement(parseString(json.get("name").getAsString()));
28809    if (json.has("_name"))
28810      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28811    if (json.has("actor")) {
28812      JsonArray array = getJArray(json, "actor");
28813      for (int i = 0; i < array.size(); i++) {
28814        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
28815      }
28816    };
28817    if (json.has("planningHorizon"))
28818      res.setPlanningHorizon(parsePeriod(getJObject(json, "planningHorizon")));
28819    if (json.has("comment"))
28820      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
28821    if (json.has("_comment"))
28822      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
28823  }
28824
28825  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
28826    SearchParameter res = new SearchParameter();
28827    parseSearchParameterProperties(json, res);
28828    return res;
28829  }
28830
28831  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
28832    parseCanonicalResourceProperties(json, res);
28833    if (json.has("url"))
28834      res.setUrlElement(parseUri(json.get("url").getAsString()));
28835    if (json.has("_url"))
28836      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
28837    if (json.has("identifier")) {
28838      JsonArray array = getJArray(json, "identifier");
28839      for (int i = 0; i < array.size(); i++) {
28840        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28841      }
28842    };
28843    if (json.has("version"))
28844      res.setVersionElement(parseString(json.get("version").getAsString()));
28845    if (json.has("_version"))
28846      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
28847    DataType versionAlgorithm = parseType("versionAlgorithm", json);
28848    if (versionAlgorithm != null)
28849      res.setVersionAlgorithm(versionAlgorithm);
28850    if (json.has("name"))
28851      res.setNameElement(parseString(json.get("name").getAsString()));
28852    if (json.has("_name"))
28853      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28854    if (json.has("title"))
28855      res.setTitleElement(parseString(json.get("title").getAsString()));
28856    if (json.has("_title"))
28857      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
28858    if (json.has("derivedFrom"))
28859      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
28860    if (json.has("_derivedFrom"))
28861      parseElementProperties(getJObject(json, "_derivedFrom"), res.getDerivedFromElement());
28862    if (json.has("status"))
28863      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
28864    if (json.has("_status"))
28865      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28866    if (json.has("experimental"))
28867      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
28868    if (json.has("_experimental"))
28869      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
28870    if (json.has("date"))
28871      res.setDateElement(parseDateTime(json.get("date").getAsString()));
28872    if (json.has("_date"))
28873      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
28874    if (json.has("publisher"))
28875      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
28876    if (json.has("_publisher"))
28877      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
28878    if (json.has("contact")) {
28879      JsonArray array = getJArray(json, "contact");
28880      for (int i = 0; i < array.size(); i++) {
28881        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
28882      }
28883    };
28884    if (json.has("description"))
28885      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28886    if (json.has("_description"))
28887      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28888    if (json.has("useContext")) {
28889      JsonArray array = getJArray(json, "useContext");
28890      for (int i = 0; i < array.size(); i++) {
28891        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
28892      }
28893    };
28894    if (json.has("jurisdiction")) {
28895      JsonArray array = getJArray(json, "jurisdiction");
28896      for (int i = 0; i < array.size(); i++) {
28897        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28898      }
28899    };
28900    if (json.has("purpose"))
28901      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
28902    if (json.has("_purpose"))
28903      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
28904    if (json.has("copyright"))
28905      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
28906    if (json.has("_copyright"))
28907      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
28908    if (json.has("copyrightLabel"))
28909      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
28910    if (json.has("_copyrightLabel"))
28911      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
28912    if (json.has("code"))
28913      res.setCodeElement(parseCode(json.get("code").getAsString()));
28914    if (json.has("_code"))
28915      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
28916    if (json.has("base")) {
28917      JsonArray array = getJArray(json, "base");
28918      for (int i = 0; i < array.size(); i++) {
28919        if (array.get(i).isJsonNull()) {
28920          res.getBase().add(new Enumeration<Enumerations.VersionIndependentResourceTypesAll>(new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), Enumerations.VersionIndependentResourceTypesAll.NULL));
28921        } else {;
28922          res.getBase().add(parseEnumeration(array.get(i).getAsString(), Enumerations.VersionIndependentResourceTypesAll.NULL, new Enumerations.VersionIndependentResourceTypesAllEnumFactory()));
28923        }
28924      }
28925    };
28926    if (json.has("_base")) {
28927      JsonArray array = getJArray(json, "_base");
28928      for (int i = 0; i < array.size(); i++) {
28929        if (i == res.getBase().size())
28930          res.getBase().add(parseEnumeration(null, Enumerations.VersionIndependentResourceTypesAll.NULL, new Enumerations.VersionIndependentResourceTypesAllEnumFactory()));
28931        if (array.get(i) instanceof JsonObject) 
28932          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
28933      }
28934    };
28935    if (json.has("type"))
28936      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
28937    if (json.has("_type"))
28938      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
28939    if (json.has("expression"))
28940      res.setExpressionElement(parseString(json.get("expression").getAsString()));
28941    if (json.has("_expression"))
28942      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
28943    if (json.has("processingMode"))
28944      res.setProcessingModeElement(parseEnumeration(json.get("processingMode").getAsString(), SearchParameter.SearchProcessingModeType.NULL, new SearchParameter.SearchProcessingModeTypeEnumFactory()));
28945    if (json.has("_processingMode"))
28946      parseElementProperties(getJObject(json, "_processingMode"), res.getProcessingModeElement());
28947    if (json.has("constraint"))
28948      res.setConstraintElement(parseString(json.get("constraint").getAsString()));
28949    if (json.has("_constraint"))
28950      parseElementProperties(getJObject(json, "_constraint"), res.getConstraintElement());
28951    if (json.has("target")) {
28952      JsonArray array = getJArray(json, "target");
28953      for (int i = 0; i < array.size(); i++) {
28954        if (array.get(i).isJsonNull()) {
28955          res.getTarget().add(new Enumeration<Enumerations.VersionIndependentResourceTypesAll>(new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), Enumerations.VersionIndependentResourceTypesAll.NULL));
28956        } else {;
28957          res.getTarget().add(parseEnumeration(array.get(i).getAsString(), Enumerations.VersionIndependentResourceTypesAll.NULL, new Enumerations.VersionIndependentResourceTypesAllEnumFactory()));
28958        }
28959      }
28960    };
28961    if (json.has("_target")) {
28962      JsonArray array = getJArray(json, "_target");
28963      for (int i = 0; i < array.size(); i++) {
28964        if (i == res.getTarget().size())
28965          res.getTarget().add(parseEnumeration(null, Enumerations.VersionIndependentResourceTypesAll.NULL, new Enumerations.VersionIndependentResourceTypesAllEnumFactory()));
28966        if (array.get(i) instanceof JsonObject) 
28967          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
28968      }
28969    };
28970    if (json.has("multipleOr"))
28971      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
28972    if (json.has("_multipleOr"))
28973      parseElementProperties(getJObject(json, "_multipleOr"), res.getMultipleOrElement());
28974    if (json.has("multipleAnd"))
28975      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
28976    if (json.has("_multipleAnd"))
28977      parseElementProperties(getJObject(json, "_multipleAnd"), res.getMultipleAndElement());
28978    if (json.has("comparator")) {
28979      JsonArray array = getJArray(json, "comparator");
28980      for (int i = 0; i < array.size(); i++) {
28981        if (array.get(i).isJsonNull()) {
28982          res.getComparator().add(new Enumeration<Enumerations.SearchComparator>(new Enumerations.SearchComparatorEnumFactory(), Enumerations.SearchComparator.NULL));
28983        } else {;
28984          res.getComparator().add(parseEnumeration(array.get(i).getAsString(), Enumerations.SearchComparator.NULL, new Enumerations.SearchComparatorEnumFactory()));
28985        }
28986      }
28987    };
28988    if (json.has("_comparator")) {
28989      JsonArray array = getJArray(json, "_comparator");
28990      for (int i = 0; i < array.size(); i++) {
28991        if (i == res.getComparator().size())
28992          res.getComparator().add(parseEnumeration(null, Enumerations.SearchComparator.NULL, new Enumerations.SearchComparatorEnumFactory()));
28993        if (array.get(i) instanceof JsonObject) 
28994          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
28995      }
28996    };
28997    if (json.has("modifier")) {
28998      JsonArray array = getJArray(json, "modifier");
28999      for (int i = 0; i < array.size(); i++) {
29000        if (array.get(i).isJsonNull()) {
29001          res.getModifier().add(new Enumeration<Enumerations.SearchModifierCode>(new Enumerations.SearchModifierCodeEnumFactory(), Enumerations.SearchModifierCode.NULL));
29002        } else {;
29003          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), Enumerations.SearchModifierCode.NULL, new Enumerations.SearchModifierCodeEnumFactory()));
29004        }
29005      }
29006    };
29007    if (json.has("_modifier")) {
29008      JsonArray array = getJArray(json, "_modifier");
29009      for (int i = 0; i < array.size(); i++) {
29010        if (i == res.getModifier().size())
29011          res.getModifier().add(parseEnumeration(null, Enumerations.SearchModifierCode.NULL, new Enumerations.SearchModifierCodeEnumFactory()));
29012        if (array.get(i) instanceof JsonObject) 
29013          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
29014      }
29015    };
29016    if (json.has("chain")) {
29017      JsonArray array = getJArray(json, "chain");
29018      for (int i = 0; i < array.size(); i++) {
29019        if (array.get(i).isJsonNull()) {
29020          res.getChain().add(new StringType());
29021        } else {;
29022          res.getChain().add(parseString(array.get(i).getAsString()));
29023        }
29024      }
29025    };
29026    if (json.has("_chain")) {
29027      JsonArray array = getJArray(json, "_chain");
29028      for (int i = 0; i < array.size(); i++) {
29029        if (i == res.getChain().size())
29030          res.getChain().add(parseString(null));
29031        if (array.get(i) instanceof JsonObject) 
29032          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
29033      }
29034    };
29035    if (json.has("component")) {
29036      JsonArray array = getJArray(json, "component");
29037      for (int i = 0; i < array.size(); i++) {
29038        res.getComponent().add(parseSearchParameterComponentComponent(array.get(i).getAsJsonObject()));
29039      }
29040    };
29041  }
29042
29043  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
29044    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
29045    parseSearchParameterComponentComponentProperties(json, res);
29046    return res;
29047  }
29048
29049  protected void parseSearchParameterComponentComponentProperties(JsonObject json, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
29050    parseBackboneElementProperties(json, res);
29051    if (json.has("definition"))
29052      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
29053    if (json.has("_definition"))
29054      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
29055    if (json.has("expression"))
29056      res.setExpressionElement(parseString(json.get("expression").getAsString()));
29057    if (json.has("_expression"))
29058      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
29059  }
29060
29061  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
29062    ServiceRequest res = new ServiceRequest();
29063    parseServiceRequestProperties(json, res);
29064    return res;
29065  }
29066
29067  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
29068    parseDomainResourceProperties(json, res);
29069    if (json.has("identifier")) {
29070      JsonArray array = getJArray(json, "identifier");
29071      for (int i = 0; i < array.size(); i++) {
29072        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
29073      }
29074    };
29075    if (json.has("instantiatesCanonical")) {
29076      JsonArray array = getJArray(json, "instantiatesCanonical");
29077      for (int i = 0; i < array.size(); i++) {
29078        if (array.get(i).isJsonNull()) {
29079          res.getInstantiatesCanonical().add(new CanonicalType());
29080        } else {;
29081          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
29082        }
29083      }
29084    };
29085    if (json.has("_instantiatesCanonical")) {
29086      JsonArray array = getJArray(json, "_instantiatesCanonical");
29087      for (int i = 0; i < array.size(); i++) {
29088        if (i == res.getInstantiatesCanonical().size())
29089          res.getInstantiatesCanonical().add(parseCanonical(null));
29090        if (array.get(i) instanceof JsonObject) 
29091          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
29092      }
29093    };
29094    if (json.has("instantiatesUri")) {
29095      JsonArray array = getJArray(json, "instantiatesUri");
29096      for (int i = 0; i < array.size(); i++) {
29097        if (array.get(i).isJsonNull()) {
29098          res.getInstantiatesUri().add(new UriType());
29099        } else {;
29100          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
29101        }
29102      }
29103    };
29104    if (json.has("_instantiatesUri")) {
29105      JsonArray array = getJArray(json, "_instantiatesUri");
29106      for (int i = 0; i < array.size(); i++) {
29107        if (i == res.getInstantiatesUri().size())
29108          res.getInstantiatesUri().add(parseUri(null));
29109        if (array.get(i) instanceof JsonObject) 
29110          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
29111      }
29112    };
29113    if (json.has("basedOn")) {
29114      JsonArray array = getJArray(json, "basedOn");
29115      for (int i = 0; i < array.size(); i++) {
29116        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
29117      }
29118    };
29119    if (json.has("replaces")) {
29120      JsonArray array = getJArray(json, "replaces");
29121      for (int i = 0; i < array.size(); i++) {
29122        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
29123      }
29124    };
29125    if (json.has("requisition"))
29126      res.setRequisition(parseIdentifier(getJObject(json, "requisition")));
29127    if (json.has("status"))
29128      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
29129    if (json.has("_status"))
29130      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29131    if (json.has("intent"))
29132      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
29133    if (json.has("_intent"))
29134      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
29135    if (json.has("category")) {
29136      JsonArray array = getJArray(json, "category");
29137      for (int i = 0; i < array.size(); i++) {
29138        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29139      }
29140    };
29141    if (json.has("priority"))
29142      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
29143    if (json.has("_priority"))
29144      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
29145    if (json.has("doNotPerform"))
29146      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
29147    if (json.has("_doNotPerform"))
29148      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
29149    if (json.has("code"))
29150      res.setCode(parseCodeableReference(getJObject(json, "code")));
29151    if (json.has("orderDetail")) {
29152      JsonArray array = getJArray(json, "orderDetail");
29153      for (int i = 0; i < array.size(); i++) {
29154        res.getOrderDetail().add(parseServiceRequestOrderDetailComponent(array.get(i).getAsJsonObject()));
29155      }
29156    };
29157    DataType quantity = parseType("quantity", json);
29158    if (quantity != null)
29159      res.setQuantity(quantity);
29160    if (json.has("subject"))
29161      res.setSubject(parseReference(getJObject(json, "subject")));
29162    if (json.has("focus")) {
29163      JsonArray array = getJArray(json, "focus");
29164      for (int i = 0; i < array.size(); i++) {
29165        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
29166      }
29167    };
29168    if (json.has("encounter"))
29169      res.setEncounter(parseReference(getJObject(json, "encounter")));
29170    DataType occurrence = parseType("occurrence", json);
29171    if (occurrence != null)
29172      res.setOccurrence(occurrence);
29173    DataType asNeeded = parseType("asNeeded", json);
29174    if (asNeeded != null)
29175      res.setAsNeeded(asNeeded);
29176    if (json.has("authoredOn"))
29177      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
29178    if (json.has("_authoredOn"))
29179      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
29180    if (json.has("requester"))
29181      res.setRequester(parseReference(getJObject(json, "requester")));
29182    if (json.has("performerType"))
29183      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
29184    if (json.has("performer")) {
29185      JsonArray array = getJArray(json, "performer");
29186      for (int i = 0; i < array.size(); i++) {
29187        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
29188      }
29189    };
29190    if (json.has("location")) {
29191      JsonArray array = getJArray(json, "location");
29192      for (int i = 0; i < array.size(); i++) {
29193        res.getLocation().add(parseCodeableReference(array.get(i).getAsJsonObject()));
29194      }
29195    };
29196    if (json.has("reason")) {
29197      JsonArray array = getJArray(json, "reason");
29198      for (int i = 0; i < array.size(); i++) {
29199        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
29200      }
29201    };
29202    if (json.has("insurance")) {
29203      JsonArray array = getJArray(json, "insurance");
29204      for (int i = 0; i < array.size(); i++) {
29205        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
29206      }
29207    };
29208    if (json.has("supportingInfo")) {
29209      JsonArray array = getJArray(json, "supportingInfo");
29210      for (int i = 0; i < array.size(); i++) {
29211        res.getSupportingInfo().add(parseCodeableReference(array.get(i).getAsJsonObject()));
29212      }
29213    };
29214    if (json.has("specimen")) {
29215      JsonArray array = getJArray(json, "specimen");
29216      for (int i = 0; i < array.size(); i++) {
29217        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
29218      }
29219    };
29220    if (json.has("bodySite")) {
29221      JsonArray array = getJArray(json, "bodySite");
29222      for (int i = 0; i < array.size(); i++) {
29223        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29224      }
29225    };
29226    if (json.has("bodyStructure"))
29227      res.setBodyStructure(parseReference(getJObject(json, "bodyStructure")));
29228    if (json.has("note")) {
29229      JsonArray array = getJArray(json, "note");
29230      for (int i = 0; i < array.size(); i++) {
29231        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
29232      }
29233    };
29234    if (json.has("patientInstruction")) {
29235      JsonArray array = getJArray(json, "patientInstruction");
29236      for (int i = 0; i < array.size(); i++) {
29237        res.getPatientInstruction().add(parseServiceRequestPatientInstructionComponent(array.get(i).getAsJsonObject()));
29238      }
29239    };
29240    if (json.has("relevantHistory")) {
29241      JsonArray array = getJArray(json, "relevantHistory");
29242      for (int i = 0; i < array.size(); i++) {
29243        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
29244      }
29245    };
29246  }
29247
29248  protected ServiceRequest.ServiceRequestOrderDetailComponent parseServiceRequestOrderDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
29249    ServiceRequest.ServiceRequestOrderDetailComponent res = new ServiceRequest.ServiceRequestOrderDetailComponent();
29250    parseServiceRequestOrderDetailComponentProperties(json, res);
29251    return res;
29252  }
29253
29254  protected void parseServiceRequestOrderDetailComponentProperties(JsonObject json, ServiceRequest.ServiceRequestOrderDetailComponent res) throws IOException, FHIRFormatError {
29255    parseBackboneElementProperties(json, res);
29256    if (json.has("parameterFocus"))
29257      res.setParameterFocus(parseCodeableReference(getJObject(json, "parameterFocus")));
29258    if (json.has("parameter")) {
29259      JsonArray array = getJArray(json, "parameter");
29260      for (int i = 0; i < array.size(); i++) {
29261        res.getParameter().add(parseServiceRequestOrderDetailParameterComponent(array.get(i).getAsJsonObject()));
29262      }
29263    };
29264  }
29265
29266  protected ServiceRequest.ServiceRequestOrderDetailParameterComponent parseServiceRequestOrderDetailParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
29267    ServiceRequest.ServiceRequestOrderDetailParameterComponent res = new ServiceRequest.ServiceRequestOrderDetailParameterComponent();
29268    parseServiceRequestOrderDetailParameterComponentProperties(json, res);
29269    return res;
29270  }
29271
29272  protected void parseServiceRequestOrderDetailParameterComponentProperties(JsonObject json, ServiceRequest.ServiceRequestOrderDetailParameterComponent res) throws IOException, FHIRFormatError {
29273    parseBackboneElementProperties(json, res);
29274    if (json.has("code"))
29275      res.setCode(parseCodeableConcept(getJObject(json, "code")));
29276    DataType value = parseType("value", json);
29277    if (value != null)
29278      res.setValue(value);
29279  }
29280
29281  protected ServiceRequest.ServiceRequestPatientInstructionComponent parseServiceRequestPatientInstructionComponent(JsonObject json) throws IOException, FHIRFormatError {
29282    ServiceRequest.ServiceRequestPatientInstructionComponent res = new ServiceRequest.ServiceRequestPatientInstructionComponent();
29283    parseServiceRequestPatientInstructionComponentProperties(json, res);
29284    return res;
29285  }
29286
29287  protected void parseServiceRequestPatientInstructionComponentProperties(JsonObject json, ServiceRequest.ServiceRequestPatientInstructionComponent res) throws IOException, FHIRFormatError {
29288    parseBackboneElementProperties(json, res);
29289    DataType instruction = parseType("instruction", json);
29290    if (instruction != null)
29291      res.setInstruction(instruction);
29292  }
29293
29294  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
29295    Slot res = new Slot();
29296    parseSlotProperties(json, res);
29297    return res;
29298  }
29299
29300  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
29301    parseDomainResourceProperties(json, res);
29302    if (json.has("identifier")) {
29303      JsonArray array = getJArray(json, "identifier");
29304      for (int i = 0; i < array.size(); i++) {
29305        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
29306      }
29307    };
29308    if (json.has("serviceCategory")) {
29309      JsonArray array = getJArray(json, "serviceCategory");
29310      for (int i = 0; i < array.size(); i++) {
29311        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29312      }
29313    };
29314    if (json.has("serviceType")) {
29315      JsonArray array = getJArray(json, "serviceType");
29316      for (int i = 0; i < array.size(); i++) {
29317        res.getServiceType().add(parseCodeableReference(array.get(i).getAsJsonObject()));
29318      }
29319    };
29320    if (json.has("specialty")) {
29321      JsonArray array = getJArray(json, "specialty");
29322      for (int i = 0; i < array.size(); i++) {
29323        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29324      }
29325    };
29326    if (json.has("appointmentType")) {
29327      JsonArray array = getJArray(json, "appointmentType");
29328      for (int i = 0; i < array.size(); i++) {
29329        res.getAppointmentType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29330      }
29331    };
29332    if (json.has("schedule"))
29333      res.setSchedule(parseReference(getJObject(json, "schedule")));
29334    if (json.has("status"))
29335      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
29336    if (json.has("_status"))
29337      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29338    if (json.has("start"))
29339      res.setStartElement(parseInstant(json.get("start").getAsString()));
29340    if (json.has("_start"))
29341      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
29342    if (json.has("end"))
29343      res.setEndElement(parseInstant(json.get("end").getAsString()));
29344    if (json.has("_end"))
29345      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
29346    if (json.has("overbooked"))
29347      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
29348    if (json.has("_overbooked"))
29349      parseElementProperties(getJObject(json, "_overbooked"), res.getOverbookedElement());
29350    if (json.has("comment"))
29351      res.setCommentElement(parseString(json.get("comment").getAsString()));
29352    if (json.has("_comment"))
29353      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
29354  }
29355
29356  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
29357    Specimen res = new Specimen();
29358    parseSpecimenProperties(json, res);
29359    return res;
29360  }
29361
29362  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
29363    parseDomainResourceProperties(json, res);
29364    if (json.has("identifier")) {
29365      JsonArray array = getJArray(json, "identifier");
29366      for (int i = 0; i < array.size(); i++) {
29367        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
29368      }
29369    };
29370    if (json.has("accessionIdentifier"))
29371      res.setAccessionIdentifier(parseIdentifier(getJObject(json, "accessionIdentifier")));
29372    if (json.has("status"))
29373      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
29374    if (json.has("_status"))
29375      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29376    if (json.has("type"))
29377      res.setType(parseCodeableConcept(getJObject(json, "type")));
29378    if (json.has("subject"))
29379      res.setSubject(parseReference(getJObject(json, "subject")));
29380    if (json.has("receivedTime"))
29381      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
29382    if (json.has("_receivedTime"))
29383      parseElementProperties(getJObject(json, "_receivedTime"), res.getReceivedTimeElement());
29384    if (json.has("parent")) {
29385      JsonArray array = getJArray(json, "parent");
29386      for (int i = 0; i < array.size(); i++) {
29387        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
29388      }
29389    };
29390    if (json.has("request")) {
29391      JsonArray array = getJArray(json, "request");
29392      for (int i = 0; i < array.size(); i++) {
29393        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
29394      }
29395    };
29396    if (json.has("combined"))
29397      res.setCombinedElement(parseEnumeration(json.get("combined").getAsString(), Specimen.SpecimenCombined.NULL, new Specimen.SpecimenCombinedEnumFactory()));
29398    if (json.has("_combined"))
29399      parseElementProperties(getJObject(json, "_combined"), res.getCombinedElement());
29400    if (json.has("role")) {
29401      JsonArray array = getJArray(json, "role");
29402      for (int i = 0; i < array.size(); i++) {
29403        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29404      }
29405    };
29406    if (json.has("feature")) {
29407      JsonArray array = getJArray(json, "feature");
29408      for (int i = 0; i < array.size(); i++) {
29409        res.getFeature().add(parseSpecimenFeatureComponent(array.get(i).getAsJsonObject()));
29410      }
29411    };
29412    if (json.has("collection"))
29413      res.setCollection(parseSpecimenCollectionComponent(getJObject(json, "collection")));
29414    if (json.has("processing")) {
29415      JsonArray array = getJArray(json, "processing");
29416      for (int i = 0; i < array.size(); i++) {
29417        res.getProcessing().add(parseSpecimenProcessingComponent(array.get(i).getAsJsonObject()));
29418      }
29419    };
29420    if (json.has("container")) {
29421      JsonArray array = getJArray(json, "container");
29422      for (int i = 0; i < array.size(); i++) {
29423        res.getContainer().add(parseSpecimenContainerComponent(array.get(i).getAsJsonObject()));
29424      }
29425    };
29426    if (json.has("condition")) {
29427      JsonArray array = getJArray(json, "condition");
29428      for (int i = 0; i < array.size(); i++) {
29429        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29430      }
29431    };
29432    if (json.has("note")) {
29433      JsonArray array = getJArray(json, "note");
29434      for (int i = 0; i < array.size(); i++) {
29435        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
29436      }
29437    };
29438  }
29439
29440  protected Specimen.SpecimenFeatureComponent parseSpecimenFeatureComponent(JsonObject json) throws IOException, FHIRFormatError {
29441    Specimen.SpecimenFeatureComponent res = new Specimen.SpecimenFeatureComponent();
29442    parseSpecimenFeatureComponentProperties(json, res);
29443    return res;
29444  }
29445
29446  protected void parseSpecimenFeatureComponentProperties(JsonObject json, Specimen.SpecimenFeatureComponent res) throws IOException, FHIRFormatError {
29447    parseBackboneElementProperties(json, res);
29448    if (json.has("type"))
29449      res.setType(parseCodeableConcept(getJObject(json, "type")));
29450    if (json.has("description"))
29451      res.setDescriptionElement(parseString(json.get("description").getAsString()));
29452    if (json.has("_description"))
29453      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29454  }
29455
29456  protected Specimen.SpecimenCollectionComponent parseSpecimenCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
29457    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
29458    parseSpecimenCollectionComponentProperties(json, res);
29459    return res;
29460  }
29461
29462  protected void parseSpecimenCollectionComponentProperties(JsonObject json, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
29463    parseBackboneElementProperties(json, res);
29464    if (json.has("collector"))
29465      res.setCollector(parseReference(getJObject(json, "collector")));
29466    DataType collected = parseType("collected", json);
29467    if (collected != null)
29468      res.setCollected(collected);
29469    if (json.has("duration"))
29470      res.setDuration(parseDuration(getJObject(json, "duration")));
29471    if (json.has("quantity"))
29472      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
29473    if (json.has("method"))
29474      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
29475    if (json.has("device"))
29476      res.setDevice(parseCodeableReference(getJObject(json, "device")));
29477    if (json.has("procedure"))
29478      res.setProcedure(parseReference(getJObject(json, "procedure")));
29479    if (json.has("bodySite"))
29480      res.setBodySite(parseCodeableReference(getJObject(json, "bodySite")));
29481    DataType fastingStatus = parseType("fastingStatus", json);
29482    if (fastingStatus != null)
29483      res.setFastingStatus(fastingStatus);
29484  }
29485
29486  protected Specimen.SpecimenProcessingComponent parseSpecimenProcessingComponent(JsonObject json) throws IOException, FHIRFormatError {
29487    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
29488    parseSpecimenProcessingComponentProperties(json, res);
29489    return res;
29490  }
29491
29492  protected void parseSpecimenProcessingComponentProperties(JsonObject json, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
29493    parseBackboneElementProperties(json, res);
29494    if (json.has("description"))
29495      res.setDescriptionElement(parseString(json.get("description").getAsString()));
29496    if (json.has("_description"))
29497      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29498    if (json.has("method"))
29499      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
29500    if (json.has("additive")) {
29501      JsonArray array = getJArray(json, "additive");
29502      for (int i = 0; i < array.size(); i++) {
29503        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
29504      }
29505    };
29506    DataType time = parseType("time", json);
29507    if (time != null)
29508      res.setTime(time);
29509  }
29510
29511  protected Specimen.SpecimenContainerComponent parseSpecimenContainerComponent(JsonObject json) throws IOException, FHIRFormatError {
29512    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
29513    parseSpecimenContainerComponentProperties(json, res);
29514    return res;
29515  }
29516
29517  protected void parseSpecimenContainerComponentProperties(JsonObject json, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
29518    parseBackboneElementProperties(json, res);
29519    if (json.has("device"))
29520      res.setDevice(parseReference(getJObject(json, "device")));
29521    if (json.has("location"))
29522      res.setLocation(parseReference(getJObject(json, "location")));
29523    if (json.has("specimenQuantity"))
29524      res.setSpecimenQuantity(parseQuantity(getJObject(json, "specimenQuantity")));
29525  }
29526
29527  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
29528    SpecimenDefinition res = new SpecimenDefinition();
29529    parseSpecimenDefinitionProperties(json, res);
29530    return res;
29531  }
29532
29533  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
29534    parseDomainResourceProperties(json, res);
29535    if (json.has("url"))
29536      res.setUrlElement(parseUri(json.get("url").getAsString()));
29537    if (json.has("_url"))
29538      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
29539    if (json.has("identifier"))
29540      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
29541    if (json.has("version"))
29542      res.setVersionElement(parseString(json.get("version").getAsString()));
29543    if (json.has("_version"))
29544      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
29545    DataType versionAlgorithm = parseType("versionAlgorithm", json);
29546    if (versionAlgorithm != null)
29547      res.setVersionAlgorithm(versionAlgorithm);
29548    if (json.has("name"))
29549      res.setNameElement(parseString(json.get("name").getAsString()));
29550    if (json.has("_name"))
29551      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
29552    if (json.has("title"))
29553      res.setTitleElement(parseString(json.get("title").getAsString()));
29554    if (json.has("_title"))
29555      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
29556    if (json.has("derivedFromCanonical")) {
29557      JsonArray array = getJArray(json, "derivedFromCanonical");
29558      for (int i = 0; i < array.size(); i++) {
29559        if (array.get(i).isJsonNull()) {
29560          res.getDerivedFromCanonical().add(new CanonicalType());
29561        } else {;
29562          res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
29563        }
29564      }
29565    };
29566    if (json.has("_derivedFromCanonical")) {
29567      JsonArray array = getJArray(json, "_derivedFromCanonical");
29568      for (int i = 0; i < array.size(); i++) {
29569        if (i == res.getDerivedFromCanonical().size())
29570          res.getDerivedFromCanonical().add(parseCanonical(null));
29571        if (array.get(i) instanceof JsonObject) 
29572          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
29573      }
29574    };
29575    if (json.has("derivedFromUri")) {
29576      JsonArray array = getJArray(json, "derivedFromUri");
29577      for (int i = 0; i < array.size(); i++) {
29578        if (array.get(i).isJsonNull()) {
29579          res.getDerivedFromUri().add(new UriType());
29580        } else {;
29581          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
29582        }
29583      }
29584    };
29585    if (json.has("_derivedFromUri")) {
29586      JsonArray array = getJArray(json, "_derivedFromUri");
29587      for (int i = 0; i < array.size(); i++) {
29588        if (i == res.getDerivedFromUri().size())
29589          res.getDerivedFromUri().add(parseUri(null));
29590        if (array.get(i) instanceof JsonObject) 
29591          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
29592      }
29593    };
29594    if (json.has("status"))
29595      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
29596    if (json.has("_status"))
29597      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29598    if (json.has("experimental"))
29599      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
29600    if (json.has("_experimental"))
29601      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
29602    DataType subject = parseType("subject", json);
29603    if (subject != null)
29604      res.setSubject(subject);
29605    if (json.has("date"))
29606      res.setDateElement(parseDateTime(json.get("date").getAsString()));
29607    if (json.has("_date"))
29608      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
29609    if (json.has("publisher"))
29610      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
29611    if (json.has("_publisher"))
29612      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
29613    if (json.has("contact")) {
29614      JsonArray array = getJArray(json, "contact");
29615      for (int i = 0; i < array.size(); i++) {
29616        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
29617      }
29618    };
29619    if (json.has("description"))
29620      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
29621    if (json.has("_description"))
29622      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29623    if (json.has("useContext")) {
29624      JsonArray array = getJArray(json, "useContext");
29625      for (int i = 0; i < array.size(); i++) {
29626        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
29627      }
29628    };
29629    if (json.has("jurisdiction")) {
29630      JsonArray array = getJArray(json, "jurisdiction");
29631      for (int i = 0; i < array.size(); i++) {
29632        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29633      }
29634    };
29635    if (json.has("purpose"))
29636      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
29637    if (json.has("_purpose"))
29638      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
29639    if (json.has("copyright"))
29640      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
29641    if (json.has("_copyright"))
29642      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
29643    if (json.has("copyrightLabel"))
29644      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
29645    if (json.has("_copyrightLabel"))
29646      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
29647    if (json.has("approvalDate"))
29648      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
29649    if (json.has("_approvalDate"))
29650      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
29651    if (json.has("lastReviewDate"))
29652      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
29653    if (json.has("_lastReviewDate"))
29654      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
29655    if (json.has("effectivePeriod"))
29656      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
29657    if (json.has("typeCollected"))
29658      res.setTypeCollected(parseCodeableConcept(getJObject(json, "typeCollected")));
29659    if (json.has("patientPreparation")) {
29660      JsonArray array = getJArray(json, "patientPreparation");
29661      for (int i = 0; i < array.size(); i++) {
29662        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29663      }
29664    };
29665    if (json.has("timeAspect"))
29666      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
29667    if (json.has("_timeAspect"))
29668      parseElementProperties(getJObject(json, "_timeAspect"), res.getTimeAspectElement());
29669    if (json.has("collection")) {
29670      JsonArray array = getJArray(json, "collection");
29671      for (int i = 0; i < array.size(); i++) {
29672        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29673      }
29674    };
29675    if (json.has("typeTested")) {
29676      JsonArray array = getJArray(json, "typeTested");
29677      for (int i = 0; i < array.size(); i++) {
29678        res.getTypeTested().add(parseSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject()));
29679      }
29680    };
29681  }
29682
29683  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionTypeTestedComponent(JsonObject json) throws IOException, FHIRFormatError {
29684    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
29685    parseSpecimenDefinitionTypeTestedComponentProperties(json, res);
29686    return res;
29687  }
29688
29689  protected void parseSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
29690    parseBackboneElementProperties(json, res);
29691    if (json.has("isDerived"))
29692      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
29693    if (json.has("_isDerived"))
29694      parseElementProperties(getJObject(json, "_isDerived"), res.getIsDerivedElement());
29695    if (json.has("type"))
29696      res.setType(parseCodeableConcept(getJObject(json, "type")));
29697    if (json.has("preference"))
29698      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
29699    if (json.has("_preference"))
29700      parseElementProperties(getJObject(json, "_preference"), res.getPreferenceElement());
29701    if (json.has("container"))
29702      res.setContainer(parseSpecimenDefinitionTypeTestedContainerComponent(getJObject(json, "container")));
29703    if (json.has("requirement"))
29704      res.setRequirementElement(parseMarkdown(json.get("requirement").getAsString()));
29705    if (json.has("_requirement"))
29706      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
29707    if (json.has("retentionTime"))
29708      res.setRetentionTime(parseDuration(getJObject(json, "retentionTime")));
29709    if (json.has("singleUse"))
29710      res.setSingleUseElement(parseBoolean(json.get("singleUse").getAsBoolean()));
29711    if (json.has("_singleUse"))
29712      parseElementProperties(getJObject(json, "_singleUse"), res.getSingleUseElement());
29713    if (json.has("rejectionCriterion")) {
29714      JsonArray array = getJArray(json, "rejectionCriterion");
29715      for (int i = 0; i < array.size(); i++) {
29716        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29717      }
29718    };
29719    if (json.has("handling")) {
29720      JsonArray array = getJArray(json, "handling");
29721      for (int i = 0; i < array.size(); i++) {
29722        res.getHandling().add(parseSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject()));
29723      }
29724    };
29725    if (json.has("testingDestination")) {
29726      JsonArray array = getJArray(json, "testingDestination");
29727      for (int i = 0; i < array.size(); i++) {
29728        res.getTestingDestination().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29729      }
29730    };
29731  }
29732
29733  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionTypeTestedContainerComponent(JsonObject json) throws IOException, FHIRFormatError {
29734    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
29735    parseSpecimenDefinitionTypeTestedContainerComponentProperties(json, res);
29736    return res;
29737  }
29738
29739  protected void parseSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
29740    parseBackboneElementProperties(json, res);
29741    if (json.has("material"))
29742      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
29743    if (json.has("type"))
29744      res.setType(parseCodeableConcept(getJObject(json, "type")));
29745    if (json.has("cap"))
29746      res.setCap(parseCodeableConcept(getJObject(json, "cap")));
29747    if (json.has("description"))
29748      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
29749    if (json.has("_description"))
29750      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29751    if (json.has("capacity"))
29752      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
29753    DataType minimumVolume = parseType("minimumVolume", json);
29754    if (minimumVolume != null)
29755      res.setMinimumVolume(minimumVolume);
29756    if (json.has("additive")) {
29757      JsonArray array = getJArray(json, "additive");
29758      for (int i = 0; i < array.size(); i++) {
29759        res.getAdditive().add(parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject()));
29760      }
29761    };
29762    if (json.has("preparation"))
29763      res.setPreparationElement(parseMarkdown(json.get("preparation").getAsString()));
29764    if (json.has("_preparation"))
29765      parseElementProperties(getJObject(json, "_preparation"), res.getPreparationElement());
29766  }
29767
29768  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json) throws IOException, FHIRFormatError {
29769    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
29770    parseSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, res);
29771    return res;
29772  }
29773
29774  protected void parseSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
29775    parseBackboneElementProperties(json, res);
29776    DataType additive = parseType("additive", json);
29777    if (additive != null)
29778      res.setAdditive(additive);
29779  }
29780
29781  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json) throws IOException, FHIRFormatError {
29782    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
29783    parseSpecimenDefinitionTypeTestedHandlingComponentProperties(json, res);
29784    return res;
29785  }
29786
29787  protected void parseSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
29788    parseBackboneElementProperties(json, res);
29789    if (json.has("temperatureQualifier"))
29790      res.setTemperatureQualifier(parseCodeableConcept(getJObject(json, "temperatureQualifier")));
29791    if (json.has("temperatureRange"))
29792      res.setTemperatureRange(parseRange(getJObject(json, "temperatureRange")));
29793    if (json.has("maxDuration"))
29794      res.setMaxDuration(parseDuration(getJObject(json, "maxDuration")));
29795    if (json.has("instruction"))
29796      res.setInstructionElement(parseMarkdown(json.get("instruction").getAsString()));
29797    if (json.has("_instruction"))
29798      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
29799  }
29800
29801  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
29802    StructureDefinition res = new StructureDefinition();
29803    parseStructureDefinitionProperties(json, res);
29804    return res;
29805  }
29806
29807  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
29808    parseCanonicalResourceProperties(json, res);
29809    if (json.has("url"))
29810      res.setUrlElement(parseUri(json.get("url").getAsString()));
29811    if (json.has("_url"))
29812      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
29813    if (json.has("identifier")) {
29814      JsonArray array = getJArray(json, "identifier");
29815      for (int i = 0; i < array.size(); i++) {
29816        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
29817      }
29818    };
29819    if (json.has("version"))
29820      res.setVersionElement(parseString(json.get("version").getAsString()));
29821    if (json.has("_version"))
29822      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
29823    DataType versionAlgorithm = parseType("versionAlgorithm", json);
29824    if (versionAlgorithm != null)
29825      res.setVersionAlgorithm(versionAlgorithm);
29826    if (json.has("name"))
29827      res.setNameElement(parseString(json.get("name").getAsString()));
29828    if (json.has("_name"))
29829      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
29830    if (json.has("title"))
29831      res.setTitleElement(parseString(json.get("title").getAsString()));
29832    if (json.has("_title"))
29833      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
29834    if (json.has("status"))
29835      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
29836    if (json.has("_status"))
29837      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29838    if (json.has("experimental"))
29839      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
29840    if (json.has("_experimental"))
29841      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
29842    if (json.has("date"))
29843      res.setDateElement(parseDateTime(json.get("date").getAsString()));
29844    if (json.has("_date"))
29845      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
29846    if (json.has("publisher"))
29847      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
29848    if (json.has("_publisher"))
29849      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
29850    if (json.has("contact")) {
29851      JsonArray array = getJArray(json, "contact");
29852      for (int i = 0; i < array.size(); i++) {
29853        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
29854      }
29855    };
29856    if (json.has("description"))
29857      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
29858    if (json.has("_description"))
29859      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29860    if (json.has("useContext")) {
29861      JsonArray array = getJArray(json, "useContext");
29862      for (int i = 0; i < array.size(); i++) {
29863        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
29864      }
29865    };
29866    if (json.has("jurisdiction")) {
29867      JsonArray array = getJArray(json, "jurisdiction");
29868      for (int i = 0; i < array.size(); i++) {
29869        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29870      }
29871    };
29872    if (json.has("purpose"))
29873      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
29874    if (json.has("_purpose"))
29875      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
29876    if (json.has("copyright"))
29877      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
29878    if (json.has("_copyright"))
29879      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
29880    if (json.has("copyrightLabel"))
29881      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
29882    if (json.has("_copyrightLabel"))
29883      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
29884    if (json.has("keyword")) {
29885      JsonArray array = getJArray(json, "keyword");
29886      for (int i = 0; i < array.size(); i++) {
29887        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
29888      }
29889    };
29890    if (json.has("fhirVersion"))
29891      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
29892    if (json.has("_fhirVersion"))
29893      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
29894    if (json.has("mapping")) {
29895      JsonArray array = getJArray(json, "mapping");
29896      for (int i = 0; i < array.size(); i++) {
29897        res.getMapping().add(parseStructureDefinitionMappingComponent(array.get(i).getAsJsonObject()));
29898      }
29899    };
29900    if (json.has("kind"))
29901      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
29902    if (json.has("_kind"))
29903      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
29904    if (json.has("abstract"))
29905      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
29906    if (json.has("_abstract"))
29907      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
29908    if (json.has("context")) {
29909      JsonArray array = getJArray(json, "context");
29910      for (int i = 0; i < array.size(); i++) {
29911        res.getContext().add(parseStructureDefinitionContextComponent(array.get(i).getAsJsonObject()));
29912      }
29913    };
29914    if (json.has("contextInvariant")) {
29915      JsonArray array = getJArray(json, "contextInvariant");
29916      for (int i = 0; i < array.size(); i++) {
29917        if (array.get(i).isJsonNull()) {
29918          res.getContextInvariant().add(new StringType());
29919        } else {;
29920          res.getContextInvariant().add(parseString(array.get(i).getAsString()));
29921        }
29922      }
29923    };
29924    if (json.has("_contextInvariant")) {
29925      JsonArray array = getJArray(json, "_contextInvariant");
29926      for (int i = 0; i < array.size(); i++) {
29927        if (i == res.getContextInvariant().size())
29928          res.getContextInvariant().add(parseString(null));
29929        if (array.get(i) instanceof JsonObject) 
29930          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
29931      }
29932    };
29933    if (json.has("type"))
29934      res.setTypeElement(parseUri(json.get("type").getAsString()));
29935    if (json.has("_type"))
29936      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
29937    if (json.has("baseDefinition"))
29938      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
29939    if (json.has("_baseDefinition"))
29940      parseElementProperties(getJObject(json, "_baseDefinition"), res.getBaseDefinitionElement());
29941    if (json.has("derivation"))
29942      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
29943    if (json.has("_derivation"))
29944      parseElementProperties(getJObject(json, "_derivation"), res.getDerivationElement());
29945    if (json.has("snapshot"))
29946      res.setSnapshot(parseStructureDefinitionSnapshotComponent(getJObject(json, "snapshot")));
29947    if (json.has("differential"))
29948      res.setDifferential(parseStructureDefinitionDifferentialComponent(getJObject(json, "differential")));
29949  }
29950
29951  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
29952    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
29953    parseStructureDefinitionMappingComponentProperties(json, res);
29954    return res;
29955  }
29956
29957  protected void parseStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
29958    parseBackboneElementProperties(json, res);
29959    if (json.has("identity"))
29960      res.setIdentityElement(parseId(json.get("identity").getAsString()));
29961    if (json.has("_identity"))
29962      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
29963    if (json.has("uri"))
29964      res.setUriElement(parseUri(json.get("uri").getAsString()));
29965    if (json.has("_uri"))
29966      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
29967    if (json.has("name"))
29968      res.setNameElement(parseString(json.get("name").getAsString()));
29969    if (json.has("_name"))
29970      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
29971    if (json.has("comment"))
29972      res.setCommentElement(parseString(json.get("comment").getAsString()));
29973    if (json.has("_comment"))
29974      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
29975  }
29976
29977  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionContextComponent(JsonObject json) throws IOException, FHIRFormatError {
29978    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
29979    parseStructureDefinitionContextComponentProperties(json, res);
29980    return res;
29981  }
29982
29983  protected void parseStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
29984    parseBackboneElementProperties(json, res);
29985    if (json.has("type"))
29986      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
29987    if (json.has("_type"))
29988      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
29989    if (json.has("expression"))
29990      res.setExpressionElement(parseString(json.get("expression").getAsString()));
29991    if (json.has("_expression"))
29992      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
29993  }
29994
29995  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionSnapshotComponent(JsonObject json) throws IOException, FHIRFormatError {
29996    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
29997    parseStructureDefinitionSnapshotComponentProperties(json, res);
29998    return res;
29999  }
30000
30001  protected void parseStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
30002    parseBackboneElementProperties(json, res);
30003    if (json.has("element")) {
30004      JsonArray array = getJArray(json, "element");
30005      for (int i = 0; i < array.size(); i++) {
30006        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
30007      }
30008    };
30009  }
30010
30011  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionDifferentialComponent(JsonObject json) throws IOException, FHIRFormatError {
30012    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
30013    parseStructureDefinitionDifferentialComponentProperties(json, res);
30014    return res;
30015  }
30016
30017  protected void parseStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
30018    parseBackboneElementProperties(json, res);
30019    if (json.has("element")) {
30020      JsonArray array = getJArray(json, "element");
30021      for (int i = 0; i < array.size(); i++) {
30022        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
30023      }
30024    };
30025  }
30026
30027  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
30028    StructureMap res = new StructureMap();
30029    parseStructureMapProperties(json, res);
30030    return res;
30031  }
30032
30033  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
30034    parseCanonicalResourceProperties(json, res);
30035    if (json.has("url"))
30036      res.setUrlElement(parseUri(json.get("url").getAsString()));
30037    if (json.has("_url"))
30038      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
30039    if (json.has("identifier")) {
30040      JsonArray array = getJArray(json, "identifier");
30041      for (int i = 0; i < array.size(); i++) {
30042        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
30043      }
30044    };
30045    if (json.has("version"))
30046      res.setVersionElement(parseString(json.get("version").getAsString()));
30047    if (json.has("_version"))
30048      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
30049    DataType versionAlgorithm = parseType("versionAlgorithm", json);
30050    if (versionAlgorithm != null)
30051      res.setVersionAlgorithm(versionAlgorithm);
30052    if (json.has("name"))
30053      res.setNameElement(parseString(json.get("name").getAsString()));
30054    if (json.has("_name"))
30055      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30056    if (json.has("title"))
30057      res.setTitleElement(parseString(json.get("title").getAsString()));
30058    if (json.has("_title"))
30059      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
30060    if (json.has("status"))
30061      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
30062    if (json.has("_status"))
30063      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
30064    if (json.has("experimental"))
30065      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
30066    if (json.has("_experimental"))
30067      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
30068    if (json.has("date"))
30069      res.setDateElement(parseDateTime(json.get("date").getAsString()));
30070    if (json.has("_date"))
30071      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
30072    if (json.has("publisher"))
30073      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
30074    if (json.has("_publisher"))
30075      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
30076    if (json.has("contact")) {
30077      JsonArray array = getJArray(json, "contact");
30078      for (int i = 0; i < array.size(); i++) {
30079        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
30080      }
30081    };
30082    if (json.has("description"))
30083      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
30084    if (json.has("_description"))
30085      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30086    if (json.has("useContext")) {
30087      JsonArray array = getJArray(json, "useContext");
30088      for (int i = 0; i < array.size(); i++) {
30089        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
30090      }
30091    };
30092    if (json.has("jurisdiction")) {
30093      JsonArray array = getJArray(json, "jurisdiction");
30094      for (int i = 0; i < array.size(); i++) {
30095        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
30096      }
30097    };
30098    if (json.has("purpose"))
30099      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
30100    if (json.has("_purpose"))
30101      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
30102    if (json.has("copyright"))
30103      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
30104    if (json.has("_copyright"))
30105      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
30106    if (json.has("copyrightLabel"))
30107      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
30108    if (json.has("_copyrightLabel"))
30109      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
30110    if (json.has("structure")) {
30111      JsonArray array = getJArray(json, "structure");
30112      for (int i = 0; i < array.size(); i++) {
30113        res.getStructure().add(parseStructureMapStructureComponent(array.get(i).getAsJsonObject()));
30114      }
30115    };
30116    if (json.has("import")) {
30117      JsonArray array = getJArray(json, "import");
30118      for (int i = 0; i < array.size(); i++) {
30119        if (array.get(i).isJsonNull()) {
30120          res.getImport().add(new CanonicalType());
30121        } else {;
30122          res.getImport().add(parseCanonical(array.get(i).getAsString()));
30123        }
30124      }
30125    };
30126    if (json.has("_import")) {
30127      JsonArray array = getJArray(json, "_import");
30128      for (int i = 0; i < array.size(); i++) {
30129        if (i == res.getImport().size())
30130          res.getImport().add(parseCanonical(null));
30131        if (array.get(i) instanceof JsonObject) 
30132          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
30133      }
30134    };
30135    if (json.has("const")) {
30136      JsonArray array = getJArray(json, "const");
30137      for (int i = 0; i < array.size(); i++) {
30138        res.getConst().add(parseStructureMapConstComponent(array.get(i).getAsJsonObject()));
30139      }
30140    };
30141    if (json.has("group")) {
30142      JsonArray array = getJArray(json, "group");
30143      for (int i = 0; i < array.size(); i++) {
30144        res.getGroup().add(parseStructureMapGroupComponent(array.get(i).getAsJsonObject()));
30145      }
30146    };
30147  }
30148
30149  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
30150    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
30151    parseStructureMapStructureComponentProperties(json, res);
30152    return res;
30153  }
30154
30155  protected void parseStructureMapStructureComponentProperties(JsonObject json, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
30156    parseBackboneElementProperties(json, res);
30157    if (json.has("url"))
30158      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
30159    if (json.has("_url"))
30160      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
30161    if (json.has("mode"))
30162      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
30163    if (json.has("_mode"))
30164      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
30165    if (json.has("alias"))
30166      res.setAliasElement(parseString(json.get("alias").getAsString()));
30167    if (json.has("_alias"))
30168      parseElementProperties(getJObject(json, "_alias"), res.getAliasElement());
30169    if (json.has("documentation"))
30170      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
30171    if (json.has("_documentation"))
30172      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
30173  }
30174
30175  protected StructureMap.StructureMapConstComponent parseStructureMapConstComponent(JsonObject json) throws IOException, FHIRFormatError {
30176    StructureMap.StructureMapConstComponent res = new StructureMap.StructureMapConstComponent();
30177    parseStructureMapConstComponentProperties(json, res);
30178    return res;
30179  }
30180
30181  protected void parseStructureMapConstComponentProperties(JsonObject json, StructureMap.StructureMapConstComponent res) throws IOException, FHIRFormatError {
30182    parseBackboneElementProperties(json, res);
30183    if (json.has("name"))
30184      res.setNameElement(parseId(json.get("name").getAsString()));
30185    if (json.has("_name"))
30186      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30187    if (json.has("value"))
30188      res.setValueElement(parseString(json.get("value").getAsString()));
30189    if (json.has("_value"))
30190      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
30191  }
30192
30193  protected StructureMap.StructureMapGroupComponent parseStructureMapGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
30194    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
30195    parseStructureMapGroupComponentProperties(json, res);
30196    return res;
30197  }
30198
30199  protected void parseStructureMapGroupComponentProperties(JsonObject json, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
30200    parseBackboneElementProperties(json, res);
30201    if (json.has("name"))
30202      res.setNameElement(parseId(json.get("name").getAsString()));
30203    if (json.has("_name"))
30204      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30205    if (json.has("extends"))
30206      res.setExtendsElement(parseId(json.get("extends").getAsString()));
30207    if (json.has("_extends"))
30208      parseElementProperties(getJObject(json, "_extends"), res.getExtendsElement());
30209    if (json.has("typeMode"))
30210      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
30211    if (json.has("_typeMode"))
30212      parseElementProperties(getJObject(json, "_typeMode"), res.getTypeModeElement());
30213    if (json.has("documentation"))
30214      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
30215    if (json.has("_documentation"))
30216      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
30217    if (json.has("input")) {
30218      JsonArray array = getJArray(json, "input");
30219      for (int i = 0; i < array.size(); i++) {
30220        res.getInput().add(parseStructureMapGroupInputComponent(array.get(i).getAsJsonObject()));
30221      }
30222    };
30223    if (json.has("rule")) {
30224      JsonArray array = getJArray(json, "rule");
30225      for (int i = 0; i < array.size(); i++) {
30226        res.getRule().add(parseStructureMapGroupRuleComponent(array.get(i).getAsJsonObject()));
30227      }
30228    };
30229  }
30230
30231  protected StructureMap.StructureMapGroupInputComponent parseStructureMapGroupInputComponent(JsonObject json) throws IOException, FHIRFormatError {
30232    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
30233    parseStructureMapGroupInputComponentProperties(json, res);
30234    return res;
30235  }
30236
30237  protected void parseStructureMapGroupInputComponentProperties(JsonObject json, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
30238    parseBackboneElementProperties(json, res);
30239    if (json.has("name"))
30240      res.setNameElement(parseId(json.get("name").getAsString()));
30241    if (json.has("_name"))
30242      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30243    if (json.has("type"))
30244      res.setTypeElement(parseString(json.get("type").getAsString()));
30245    if (json.has("_type"))
30246      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
30247    if (json.has("mode"))
30248      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
30249    if (json.has("_mode"))
30250      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
30251    if (json.has("documentation"))
30252      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
30253    if (json.has("_documentation"))
30254      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
30255  }
30256
30257  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapGroupRuleComponent(JsonObject json) throws IOException, FHIRFormatError {
30258    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
30259    parseStructureMapGroupRuleComponentProperties(json, res);
30260    return res;
30261  }
30262
30263  protected void parseStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
30264    parseBackboneElementProperties(json, res);
30265    if (json.has("name"))
30266      res.setNameElement(parseId(json.get("name").getAsString()));
30267    if (json.has("_name"))
30268      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30269    if (json.has("source")) {
30270      JsonArray array = getJArray(json, "source");
30271      for (int i = 0; i < array.size(); i++) {
30272        res.getSource().add(parseStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject()));
30273      }
30274    };
30275    if (json.has("target")) {
30276      JsonArray array = getJArray(json, "target");
30277      for (int i = 0; i < array.size(); i++) {
30278        res.getTarget().add(parseStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject()));
30279      }
30280    };
30281    if (json.has("rule")) {
30282      JsonArray array = getJArray(json, "rule");
30283      for (int i = 0; i < array.size(); i++) {
30284        res.getRule().add(parseStructureMapGroupRuleComponent(array.get(i).getAsJsonObject()));
30285      }
30286    };
30287    if (json.has("dependent")) {
30288      JsonArray array = getJArray(json, "dependent");
30289      for (int i = 0; i < array.size(); i++) {
30290        res.getDependent().add(parseStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject()));
30291      }
30292    };
30293    if (json.has("documentation"))
30294      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
30295    if (json.has("_documentation"))
30296      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
30297  }
30298
30299  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapGroupRuleSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
30300    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
30301    parseStructureMapGroupRuleSourceComponentProperties(json, res);
30302    return res;
30303  }
30304
30305  protected void parseStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
30306    parseBackboneElementProperties(json, res);
30307    if (json.has("context"))
30308      res.setContextElement(parseId(json.get("context").getAsString()));
30309    if (json.has("_context"))
30310      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
30311    if (json.has("min"))
30312      res.setMinElement(parseInteger(json.get("min").getAsLong()));
30313    if (json.has("_min"))
30314      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
30315    if (json.has("max"))
30316      res.setMaxElement(parseString(json.get("max").getAsString()));
30317    if (json.has("_max"))
30318      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
30319    if (json.has("type"))
30320      res.setTypeElement(parseString(json.get("type").getAsString()));
30321    if (json.has("_type"))
30322      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
30323    if (json.has("defaultValue"))
30324      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
30325    if (json.has("_defaultValue"))
30326      parseElementProperties(getJObject(json, "_defaultValue"), res.getDefaultValueElement());
30327    if (json.has("element"))
30328      res.setElementElement(parseString(json.get("element").getAsString()));
30329    if (json.has("_element"))
30330      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
30331    if (json.has("listMode"))
30332      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
30333    if (json.has("_listMode"))
30334      parseElementProperties(getJObject(json, "_listMode"), res.getListModeElement());
30335    if (json.has("variable"))
30336      res.setVariableElement(parseId(json.get("variable").getAsString()));
30337    if (json.has("_variable"))
30338      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
30339    if (json.has("condition"))
30340      res.setConditionElement(parseString(json.get("condition").getAsString()));
30341    if (json.has("_condition"))
30342      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
30343    if (json.has("check"))
30344      res.setCheckElement(parseString(json.get("check").getAsString()));
30345    if (json.has("_check"))
30346      parseElementProperties(getJObject(json, "_check"), res.getCheckElement());
30347    if (json.has("logMessage"))
30348      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
30349    if (json.has("_logMessage"))
30350      parseElementProperties(getJObject(json, "_logMessage"), res.getLogMessageElement());
30351  }
30352
30353  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapGroupRuleTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
30354    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
30355    parseStructureMapGroupRuleTargetComponentProperties(json, res);
30356    return res;
30357  }
30358
30359  protected void parseStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
30360    parseBackboneElementProperties(json, res);
30361    if (json.has("context"))
30362      res.setContextElement(parseString(json.get("context").getAsString()));
30363    if (json.has("_context"))
30364      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
30365    if (json.has("element"))
30366      res.setElementElement(parseString(json.get("element").getAsString()));
30367    if (json.has("_element"))
30368      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
30369    if (json.has("variable"))
30370      res.setVariableElement(parseId(json.get("variable").getAsString()));
30371    if (json.has("_variable"))
30372      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
30373    if (json.has("listMode")) {
30374      JsonArray array = getJArray(json, "listMode");
30375      for (int i = 0; i < array.size(); i++) {
30376        if (array.get(i).isJsonNull()) {
30377          res.getListMode().add(new Enumeration<StructureMap.StructureMapTargetListMode>(new StructureMap.StructureMapTargetListModeEnumFactory(), StructureMap.StructureMapTargetListMode.NULL));
30378        } else {;
30379          res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
30380        }
30381      }
30382    };
30383    if (json.has("_listMode")) {
30384      JsonArray array = getJArray(json, "_listMode");
30385      for (int i = 0; i < array.size(); i++) {
30386        if (i == res.getListMode().size())
30387          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
30388        if (array.get(i) instanceof JsonObject) 
30389          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
30390      }
30391    };
30392    if (json.has("listRuleId"))
30393      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
30394    if (json.has("_listRuleId"))
30395      parseElementProperties(getJObject(json, "_listRuleId"), res.getListRuleIdElement());
30396    if (json.has("transform"))
30397      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
30398    if (json.has("_transform"))
30399      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
30400    if (json.has("parameter")) {
30401      JsonArray array = getJArray(json, "parameter");
30402      for (int i = 0; i < array.size(); i++) {
30403        res.getParameter().add(parseStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject()));
30404      }
30405    };
30406  }
30407
30408  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapGroupRuleTargetParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
30409    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
30410    parseStructureMapGroupRuleTargetParameterComponentProperties(json, res);
30411    return res;
30412  }
30413
30414  protected void parseStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
30415    parseBackboneElementProperties(json, res);
30416    DataType value = parseType("value", json);
30417    if (value != null)
30418      res.setValue(value);
30419  }
30420
30421  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapGroupRuleDependentComponent(JsonObject json) throws IOException, FHIRFormatError {
30422    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
30423    parseStructureMapGroupRuleDependentComponentProperties(json, res);
30424    return res;
30425  }
30426
30427  protected void parseStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
30428    parseBackboneElementProperties(json, res);
30429    if (json.has("name"))
30430      res.setNameElement(parseId(json.get("name").getAsString()));
30431    if (json.has("_name"))
30432      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30433    if (json.has("parameter")) {
30434      JsonArray array = getJArray(json, "parameter");
30435      for (int i = 0; i < array.size(); i++) {
30436        res.getParameter().add(parseStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject()));
30437      }
30438    };
30439  }
30440
30441  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
30442    Subscription res = new Subscription();
30443    parseSubscriptionProperties(json, res);
30444    return res;
30445  }
30446
30447  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
30448    parseDomainResourceProperties(json, res);
30449    if (json.has("identifier")) {
30450      JsonArray array = getJArray(json, "identifier");
30451      for (int i = 0; i < array.size(); i++) {
30452        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
30453      }
30454    };
30455    if (json.has("name"))
30456      res.setNameElement(parseString(json.get("name").getAsString()));
30457    if (json.has("_name"))
30458      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30459    if (json.has("status"))
30460      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.SubscriptionStatusCodes.NULL, new Enumerations.SubscriptionStatusCodesEnumFactory()));
30461    if (json.has("_status"))
30462      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
30463    if (json.has("topic"))
30464      res.setTopicElement(parseCanonical(json.get("topic").getAsString()));
30465    if (json.has("_topic"))
30466      parseElementProperties(getJObject(json, "_topic"), res.getTopicElement());
30467    if (json.has("contact")) {
30468      JsonArray array = getJArray(json, "contact");
30469      for (int i = 0; i < array.size(); i++) {
30470        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
30471      }
30472    };
30473    if (json.has("end"))
30474      res.setEndElement(parseInstant(json.get("end").getAsString()));
30475    if (json.has("_end"))
30476      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
30477    if (json.has("managingEntity"))
30478      res.setManagingEntity(parseReference(getJObject(json, "managingEntity")));
30479    if (json.has("reason"))
30480      res.setReasonElement(parseString(json.get("reason").getAsString()));
30481    if (json.has("_reason"))
30482      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
30483    if (json.has("filterBy")) {
30484      JsonArray array = getJArray(json, "filterBy");
30485      for (int i = 0; i < array.size(); i++) {
30486        res.getFilterBy().add(parseSubscriptionFilterByComponent(array.get(i).getAsJsonObject()));
30487      }
30488    };
30489    if (json.has("channelType"))
30490      res.setChannelType(parseCoding(getJObject(json, "channelType")));
30491    if (json.has("endpoint"))
30492      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
30493    if (json.has("_endpoint"))
30494      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
30495    if (json.has("parameter")) {
30496      JsonArray array = getJArray(json, "parameter");
30497      for (int i = 0; i < array.size(); i++) {
30498        res.getParameter().add(parseSubscriptionParameterComponent(array.get(i).getAsJsonObject()));
30499      }
30500    };
30501    if (json.has("heartbeatPeriod"))
30502      res.setHeartbeatPeriodElement(parseUnsignedInt(json.get("heartbeatPeriod").getAsString()));
30503    if (json.has("_heartbeatPeriod"))
30504      parseElementProperties(getJObject(json, "_heartbeatPeriod"), res.getHeartbeatPeriodElement());
30505    if (json.has("timeout"))
30506      res.setTimeoutElement(parseUnsignedInt(json.get("timeout").getAsString()));
30507    if (json.has("_timeout"))
30508      parseElementProperties(getJObject(json, "_timeout"), res.getTimeoutElement());
30509    if (json.has("contentType"))
30510      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
30511    if (json.has("_contentType"))
30512      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
30513    if (json.has("content"))
30514      res.setContentElement(parseEnumeration(json.get("content").getAsString(), Subscription.SubscriptionPayloadContent.NULL, new Subscription.SubscriptionPayloadContentEnumFactory()));
30515    if (json.has("_content"))
30516      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
30517    if (json.has("maxCount"))
30518      res.setMaxCountElement(parsePositiveInt(json.get("maxCount").getAsString()));
30519    if (json.has("_maxCount"))
30520      parseElementProperties(getJObject(json, "_maxCount"), res.getMaxCountElement());
30521  }
30522
30523  protected Subscription.SubscriptionFilterByComponent parseSubscriptionFilterByComponent(JsonObject json) throws IOException, FHIRFormatError {
30524    Subscription.SubscriptionFilterByComponent res = new Subscription.SubscriptionFilterByComponent();
30525    parseSubscriptionFilterByComponentProperties(json, res);
30526    return res;
30527  }
30528
30529  protected void parseSubscriptionFilterByComponentProperties(JsonObject json, Subscription.SubscriptionFilterByComponent res) throws IOException, FHIRFormatError {
30530    parseBackboneElementProperties(json, res);
30531    if (json.has("resourceType"))
30532      res.setResourceTypeElement(parseUri(json.get("resourceType").getAsString()));
30533    if (json.has("_resourceType"))
30534      parseElementProperties(getJObject(json, "_resourceType"), res.getResourceTypeElement());
30535    if (json.has("filterParameter"))
30536      res.setFilterParameterElement(parseString(json.get("filterParameter").getAsString()));
30537    if (json.has("_filterParameter"))
30538      parseElementProperties(getJObject(json, "_filterParameter"), res.getFilterParameterElement());
30539    if (json.has("comparator"))
30540      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Enumerations.SearchComparator.NULL, new Enumerations.SearchComparatorEnumFactory()));
30541    if (json.has("_comparator"))
30542      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
30543    if (json.has("modifier"))
30544      res.setModifierElement(parseEnumeration(json.get("modifier").getAsString(), Enumerations.SearchModifierCode.NULL, new Enumerations.SearchModifierCodeEnumFactory()));
30545    if (json.has("_modifier"))
30546      parseElementProperties(getJObject(json, "_modifier"), res.getModifierElement());
30547    if (json.has("value"))
30548      res.setValueElement(parseString(json.get("value").getAsString()));
30549    if (json.has("_value"))
30550      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
30551  }
30552
30553  protected Subscription.SubscriptionParameterComponent parseSubscriptionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
30554    Subscription.SubscriptionParameterComponent res = new Subscription.SubscriptionParameterComponent();
30555    parseSubscriptionParameterComponentProperties(json, res);
30556    return res;
30557  }
30558
30559  protected void parseSubscriptionParameterComponentProperties(JsonObject json, Subscription.SubscriptionParameterComponent res) throws IOException, FHIRFormatError {
30560    parseBackboneElementProperties(json, res);
30561    if (json.has("name"))
30562      res.setNameElement(parseString(json.get("name").getAsString()));
30563    if (json.has("_name"))
30564      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30565    if (json.has("value"))
30566      res.setValueElement(parseString(json.get("value").getAsString()));
30567    if (json.has("_value"))
30568      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
30569  }
30570
30571  protected SubscriptionStatus parseSubscriptionStatus(JsonObject json) throws IOException, FHIRFormatError {
30572    SubscriptionStatus res = new SubscriptionStatus();
30573    parseSubscriptionStatusProperties(json, res);
30574    return res;
30575  }
30576
30577  protected void parseSubscriptionStatusProperties(JsonObject json, SubscriptionStatus res) throws IOException, FHIRFormatError {
30578    parseDomainResourceProperties(json, res);
30579    if (json.has("status"))
30580      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.SubscriptionStatusCodes.NULL, new Enumerations.SubscriptionStatusCodesEnumFactory()));
30581    if (json.has("_status"))
30582      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
30583    if (json.has("type"))
30584      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), SubscriptionStatus.SubscriptionNotificationType.NULL, new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory()));
30585    if (json.has("_type"))
30586      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
30587    if (json.has("eventsSinceSubscriptionStart"))
30588      res.setEventsSinceSubscriptionStartElement(parseInteger64(json.get("eventsSinceSubscriptionStart").getAsLong()));
30589    if (json.has("_eventsSinceSubscriptionStart"))
30590      parseElementProperties(getJObject(json, "_eventsSinceSubscriptionStart"), res.getEventsSinceSubscriptionStartElement());
30591    if (json.has("notificationEvent")) {
30592      JsonArray array = getJArray(json, "notificationEvent");
30593      for (int i = 0; i < array.size(); i++) {
30594        res.getNotificationEvent().add(parseSubscriptionStatusNotificationEventComponent(array.get(i).getAsJsonObject()));
30595      }
30596    };
30597    if (json.has("subscription"))
30598      res.setSubscription(parseReference(getJObject(json, "subscription")));
30599    if (json.has("topic"))
30600      res.setTopicElement(parseCanonical(json.get("topic").getAsString()));
30601    if (json.has("_topic"))
30602      parseElementProperties(getJObject(json, "_topic"), res.getTopicElement());
30603    if (json.has("error")) {
30604      JsonArray array = getJArray(json, "error");
30605      for (int i = 0; i < array.size(); i++) {
30606        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
30607      }
30608    };
30609  }
30610
30611  protected SubscriptionStatus.SubscriptionStatusNotificationEventComponent parseSubscriptionStatusNotificationEventComponent(JsonObject json) throws IOException, FHIRFormatError {
30612    SubscriptionStatus.SubscriptionStatusNotificationEventComponent res = new SubscriptionStatus.SubscriptionStatusNotificationEventComponent();
30613    parseSubscriptionStatusNotificationEventComponentProperties(json, res);
30614    return res;
30615  }
30616
30617  protected void parseSubscriptionStatusNotificationEventComponentProperties(JsonObject json, SubscriptionStatus.SubscriptionStatusNotificationEventComponent res) throws IOException, FHIRFormatError {
30618    parseBackboneElementProperties(json, res);
30619    if (json.has("eventNumber"))
30620      res.setEventNumberElement(parseInteger64(json.get("eventNumber").getAsLong()));
30621    if (json.has("_eventNumber"))
30622      parseElementProperties(getJObject(json, "_eventNumber"), res.getEventNumberElement());
30623    if (json.has("timestamp"))
30624      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
30625    if (json.has("_timestamp"))
30626      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
30627    if (json.has("focus"))
30628      res.setFocus(parseReference(getJObject(json, "focus")));
30629    if (json.has("additionalContext")) {
30630      JsonArray array = getJArray(json, "additionalContext");
30631      for (int i = 0; i < array.size(); i++) {
30632        res.getAdditionalContext().add(parseReference(array.get(i).getAsJsonObject()));
30633      }
30634    };
30635  }
30636
30637  protected SubscriptionTopic parseSubscriptionTopic(JsonObject json) throws IOException, FHIRFormatError {
30638    SubscriptionTopic res = new SubscriptionTopic();
30639    parseSubscriptionTopicProperties(json, res);
30640    return res;
30641  }
30642
30643  protected void parseSubscriptionTopicProperties(JsonObject json, SubscriptionTopic res) throws IOException, FHIRFormatError {
30644    parseCanonicalResourceProperties(json, res);
30645    if (json.has("url"))
30646      res.setUrlElement(parseUri(json.get("url").getAsString()));
30647    if (json.has("_url"))
30648      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
30649    if (json.has("identifier")) {
30650      JsonArray array = getJArray(json, "identifier");
30651      for (int i = 0; i < array.size(); i++) {
30652        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
30653      }
30654    };
30655    if (json.has("version"))
30656      res.setVersionElement(parseString(json.get("version").getAsString()));
30657    if (json.has("_version"))
30658      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
30659    DataType versionAlgorithm = parseType("versionAlgorithm", json);
30660    if (versionAlgorithm != null)
30661      res.setVersionAlgorithm(versionAlgorithm);
30662    if (json.has("name"))
30663      res.setNameElement(parseString(json.get("name").getAsString()));
30664    if (json.has("_name"))
30665      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30666    if (json.has("title"))
30667      res.setTitleElement(parseString(json.get("title").getAsString()));
30668    if (json.has("_title"))
30669      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
30670    if (json.has("derivedFrom")) {
30671      JsonArray array = getJArray(json, "derivedFrom");
30672      for (int i = 0; i < array.size(); i++) {
30673        if (array.get(i).isJsonNull()) {
30674          res.getDerivedFrom().add(new CanonicalType());
30675        } else {;
30676          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
30677        }
30678      }
30679    };
30680    if (json.has("_derivedFrom")) {
30681      JsonArray array = getJArray(json, "_derivedFrom");
30682      for (int i = 0; i < array.size(); i++) {
30683        if (i == res.getDerivedFrom().size())
30684          res.getDerivedFrom().add(parseCanonical(null));
30685        if (array.get(i) instanceof JsonObject) 
30686          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
30687      }
30688    };
30689    if (json.has("status"))
30690      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
30691    if (json.has("_status"))
30692      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
30693    if (json.has("experimental"))
30694      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
30695    if (json.has("_experimental"))
30696      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
30697    if (json.has("date"))
30698      res.setDateElement(parseDateTime(json.get("date").getAsString()));
30699    if (json.has("_date"))
30700      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
30701    if (json.has("publisher"))
30702      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
30703    if (json.has("_publisher"))
30704      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
30705    if (json.has("contact")) {
30706      JsonArray array = getJArray(json, "contact");
30707      for (int i = 0; i < array.size(); i++) {
30708        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
30709      }
30710    };
30711    if (json.has("description"))
30712      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
30713    if (json.has("_description"))
30714      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30715    if (json.has("useContext")) {
30716      JsonArray array = getJArray(json, "useContext");
30717      for (int i = 0; i < array.size(); i++) {
30718        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
30719      }
30720    };
30721    if (json.has("jurisdiction")) {
30722      JsonArray array = getJArray(json, "jurisdiction");
30723      for (int i = 0; i < array.size(); i++) {
30724        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
30725      }
30726    };
30727    if (json.has("purpose"))
30728      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
30729    if (json.has("_purpose"))
30730      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
30731    if (json.has("copyright"))
30732      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
30733    if (json.has("_copyright"))
30734      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
30735    if (json.has("copyrightLabel"))
30736      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
30737    if (json.has("_copyrightLabel"))
30738      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
30739    if (json.has("approvalDate"))
30740      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
30741    if (json.has("_approvalDate"))
30742      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
30743    if (json.has("lastReviewDate"))
30744      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
30745    if (json.has("_lastReviewDate"))
30746      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
30747    if (json.has("effectivePeriod"))
30748      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
30749    if (json.has("resourceTrigger")) {
30750      JsonArray array = getJArray(json, "resourceTrigger");
30751      for (int i = 0; i < array.size(); i++) {
30752        res.getResourceTrigger().add(parseSubscriptionTopicResourceTriggerComponent(array.get(i).getAsJsonObject()));
30753      }
30754    };
30755    if (json.has("eventTrigger")) {
30756      JsonArray array = getJArray(json, "eventTrigger");
30757      for (int i = 0; i < array.size(); i++) {
30758        res.getEventTrigger().add(parseSubscriptionTopicEventTriggerComponent(array.get(i).getAsJsonObject()));
30759      }
30760    };
30761    if (json.has("canFilterBy")) {
30762      JsonArray array = getJArray(json, "canFilterBy");
30763      for (int i = 0; i < array.size(); i++) {
30764        res.getCanFilterBy().add(parseSubscriptionTopicCanFilterByComponent(array.get(i).getAsJsonObject()));
30765      }
30766    };
30767    if (json.has("notificationShape")) {
30768      JsonArray array = getJArray(json, "notificationShape");
30769      for (int i = 0; i < array.size(); i++) {
30770        res.getNotificationShape().add(parseSubscriptionTopicNotificationShapeComponent(array.get(i).getAsJsonObject()));
30771      }
30772    };
30773  }
30774
30775  protected SubscriptionTopic.SubscriptionTopicResourceTriggerComponent parseSubscriptionTopicResourceTriggerComponent(JsonObject json) throws IOException, FHIRFormatError {
30776    SubscriptionTopic.SubscriptionTopicResourceTriggerComponent res = new SubscriptionTopic.SubscriptionTopicResourceTriggerComponent();
30777    parseSubscriptionTopicResourceTriggerComponentProperties(json, res);
30778    return res;
30779  }
30780
30781  protected void parseSubscriptionTopicResourceTriggerComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicResourceTriggerComponent res) throws IOException, FHIRFormatError {
30782    parseBackboneElementProperties(json, res);
30783    if (json.has("description"))
30784      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
30785    if (json.has("_description"))
30786      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30787    if (json.has("resource"))
30788      res.setResourceElement(parseUri(json.get("resource").getAsString()));
30789    if (json.has("_resource"))
30790      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
30791    if (json.has("supportedInteraction")) {
30792      JsonArray array = getJArray(json, "supportedInteraction");
30793      for (int i = 0; i < array.size(); i++) {
30794        if (array.get(i).isJsonNull()) {
30795          res.getSupportedInteraction().add(new Enumeration<SubscriptionTopic.InteractionTrigger>(new SubscriptionTopic.InteractionTriggerEnumFactory(), SubscriptionTopic.InteractionTrigger.NULL));
30796        } else {;
30797          res.getSupportedInteraction().add(parseEnumeration(array.get(i).getAsString(), SubscriptionTopic.InteractionTrigger.NULL, new SubscriptionTopic.InteractionTriggerEnumFactory()));
30798        }
30799      }
30800    };
30801    if (json.has("_supportedInteraction")) {
30802      JsonArray array = getJArray(json, "_supportedInteraction");
30803      for (int i = 0; i < array.size(); i++) {
30804        if (i == res.getSupportedInteraction().size())
30805          res.getSupportedInteraction().add(parseEnumeration(null, SubscriptionTopic.InteractionTrigger.NULL, new SubscriptionTopic.InteractionTriggerEnumFactory()));
30806        if (array.get(i) instanceof JsonObject) 
30807          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedInteraction().get(i));
30808      }
30809    };
30810    if (json.has("queryCriteria"))
30811      res.setQueryCriteria(parseSubscriptionTopicResourceTriggerQueryCriteriaComponent(getJObject(json, "queryCriteria")));
30812    if (json.has("fhirPathCriteria"))
30813      res.setFhirPathCriteriaElement(parseString(json.get("fhirPathCriteria").getAsString()));
30814    if (json.has("_fhirPathCriteria"))
30815      parseElementProperties(getJObject(json, "_fhirPathCriteria"), res.getFhirPathCriteriaElement());
30816  }
30817
30818  protected SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent parseSubscriptionTopicResourceTriggerQueryCriteriaComponent(JsonObject json) throws IOException, FHIRFormatError {
30819    SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent res = new SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent();
30820    parseSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(json, res);
30821    return res;
30822  }
30823
30824  protected void parseSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent res) throws IOException, FHIRFormatError {
30825    parseBackboneElementProperties(json, res);
30826    if (json.has("previous"))
30827      res.setPreviousElement(parseString(json.get("previous").getAsString()));
30828    if (json.has("_previous"))
30829      parseElementProperties(getJObject(json, "_previous"), res.getPreviousElement());
30830    if (json.has("resultForCreate"))
30831      res.setResultForCreateElement(parseEnumeration(json.get("resultForCreate").getAsString(), SubscriptionTopic.CriteriaNotExistsBehavior.NULL, new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory()));
30832    if (json.has("_resultForCreate"))
30833      parseElementProperties(getJObject(json, "_resultForCreate"), res.getResultForCreateElement());
30834    if (json.has("current"))
30835      res.setCurrentElement(parseString(json.get("current").getAsString()));
30836    if (json.has("_current"))
30837      parseElementProperties(getJObject(json, "_current"), res.getCurrentElement());
30838    if (json.has("resultForDelete"))
30839      res.setResultForDeleteElement(parseEnumeration(json.get("resultForDelete").getAsString(), SubscriptionTopic.CriteriaNotExistsBehavior.NULL, new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory()));
30840    if (json.has("_resultForDelete"))
30841      parseElementProperties(getJObject(json, "_resultForDelete"), res.getResultForDeleteElement());
30842    if (json.has("requireBoth"))
30843      res.setRequireBothElement(parseBoolean(json.get("requireBoth").getAsBoolean()));
30844    if (json.has("_requireBoth"))
30845      parseElementProperties(getJObject(json, "_requireBoth"), res.getRequireBothElement());
30846  }
30847
30848  protected SubscriptionTopic.SubscriptionTopicEventTriggerComponent parseSubscriptionTopicEventTriggerComponent(JsonObject json) throws IOException, FHIRFormatError {
30849    SubscriptionTopic.SubscriptionTopicEventTriggerComponent res = new SubscriptionTopic.SubscriptionTopicEventTriggerComponent();
30850    parseSubscriptionTopicEventTriggerComponentProperties(json, res);
30851    return res;
30852  }
30853
30854  protected void parseSubscriptionTopicEventTriggerComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicEventTriggerComponent res) throws IOException, FHIRFormatError {
30855    parseBackboneElementProperties(json, res);
30856    if (json.has("description"))
30857      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
30858    if (json.has("_description"))
30859      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30860    if (json.has("event"))
30861      res.setEvent(parseCodeableConcept(getJObject(json, "event")));
30862    if (json.has("resource"))
30863      res.setResourceElement(parseUri(json.get("resource").getAsString()));
30864    if (json.has("_resource"))
30865      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
30866  }
30867
30868  protected SubscriptionTopic.SubscriptionTopicCanFilterByComponent parseSubscriptionTopicCanFilterByComponent(JsonObject json) throws IOException, FHIRFormatError {
30869    SubscriptionTopic.SubscriptionTopicCanFilterByComponent res = new SubscriptionTopic.SubscriptionTopicCanFilterByComponent();
30870    parseSubscriptionTopicCanFilterByComponentProperties(json, res);
30871    return res;
30872  }
30873
30874  protected void parseSubscriptionTopicCanFilterByComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicCanFilterByComponent res) throws IOException, FHIRFormatError {
30875    parseBackboneElementProperties(json, res);
30876    if (json.has("description"))
30877      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
30878    if (json.has("_description"))
30879      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30880    if (json.has("resource"))
30881      res.setResourceElement(parseUri(json.get("resource").getAsString()));
30882    if (json.has("_resource"))
30883      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
30884    if (json.has("filterParameter"))
30885      res.setFilterParameterElement(parseString(json.get("filterParameter").getAsString()));
30886    if (json.has("_filterParameter"))
30887      parseElementProperties(getJObject(json, "_filterParameter"), res.getFilterParameterElement());
30888    if (json.has("filterDefinition"))
30889      res.setFilterDefinitionElement(parseUri(json.get("filterDefinition").getAsString()));
30890    if (json.has("_filterDefinition"))
30891      parseElementProperties(getJObject(json, "_filterDefinition"), res.getFilterDefinitionElement());
30892    if (json.has("comparator")) {
30893      JsonArray array = getJArray(json, "comparator");
30894      for (int i = 0; i < array.size(); i++) {
30895        if (array.get(i).isJsonNull()) {
30896          res.getComparator().add(new Enumeration<Enumerations.SearchComparator>(new Enumerations.SearchComparatorEnumFactory(), Enumerations.SearchComparator.NULL));
30897        } else {;
30898          res.getComparator().add(parseEnumeration(array.get(i).getAsString(), Enumerations.SearchComparator.NULL, new Enumerations.SearchComparatorEnumFactory()));
30899        }
30900      }
30901    };
30902    if (json.has("_comparator")) {
30903      JsonArray array = getJArray(json, "_comparator");
30904      for (int i = 0; i < array.size(); i++) {
30905        if (i == res.getComparator().size())
30906          res.getComparator().add(parseEnumeration(null, Enumerations.SearchComparator.NULL, new Enumerations.SearchComparatorEnumFactory()));
30907        if (array.get(i) instanceof JsonObject) 
30908          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
30909      }
30910    };
30911    if (json.has("modifier")) {
30912      JsonArray array = getJArray(json, "modifier");
30913      for (int i = 0; i < array.size(); i++) {
30914        if (array.get(i).isJsonNull()) {
30915          res.getModifier().add(new Enumeration<Enumerations.SearchModifierCode>(new Enumerations.SearchModifierCodeEnumFactory(), Enumerations.SearchModifierCode.NULL));
30916        } else {;
30917          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), Enumerations.SearchModifierCode.NULL, new Enumerations.SearchModifierCodeEnumFactory()));
30918        }
30919      }
30920    };
30921    if (json.has("_modifier")) {
30922      JsonArray array = getJArray(json, "_modifier");
30923      for (int i = 0; i < array.size(); i++) {
30924        if (i == res.getModifier().size())
30925          res.getModifier().add(parseEnumeration(null, Enumerations.SearchModifierCode.NULL, new Enumerations.SearchModifierCodeEnumFactory()));
30926        if (array.get(i) instanceof JsonObject) 
30927          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
30928      }
30929    };
30930  }
30931
30932  protected SubscriptionTopic.SubscriptionTopicNotificationShapeComponent parseSubscriptionTopicNotificationShapeComponent(JsonObject json) throws IOException, FHIRFormatError {
30933    SubscriptionTopic.SubscriptionTopicNotificationShapeComponent res = new SubscriptionTopic.SubscriptionTopicNotificationShapeComponent();
30934    parseSubscriptionTopicNotificationShapeComponentProperties(json, res);
30935    return res;
30936  }
30937
30938  protected void parseSubscriptionTopicNotificationShapeComponentProperties(JsonObject json, SubscriptionTopic.SubscriptionTopicNotificationShapeComponent res) throws IOException, FHIRFormatError {
30939    parseBackboneElementProperties(json, res);
30940    if (json.has("resource"))
30941      res.setResourceElement(parseUri(json.get("resource").getAsString()));
30942    if (json.has("_resource"))
30943      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
30944    if (json.has("include")) {
30945      JsonArray array = getJArray(json, "include");
30946      for (int i = 0; i < array.size(); i++) {
30947        if (array.get(i).isJsonNull()) {
30948          res.getInclude().add(new StringType());
30949        } else {;
30950          res.getInclude().add(parseString(array.get(i).getAsString()));
30951        }
30952      }
30953    };
30954    if (json.has("_include")) {
30955      JsonArray array = getJArray(json, "_include");
30956      for (int i = 0; i < array.size(); i++) {
30957        if (i == res.getInclude().size())
30958          res.getInclude().add(parseString(null));
30959        if (array.get(i) instanceof JsonObject) 
30960          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
30961      }
30962    };
30963    if (json.has("revInclude")) {
30964      JsonArray array = getJArray(json, "revInclude");
30965      for (int i = 0; i < array.size(); i++) {
30966        if (array.get(i).isJsonNull()) {
30967          res.getRevInclude().add(new StringType());
30968        } else {;
30969          res.getRevInclude().add(parseString(array.get(i).getAsString()));
30970        }
30971      }
30972    };
30973    if (json.has("_revInclude")) {
30974      JsonArray array = getJArray(json, "_revInclude");
30975      for (int i = 0; i < array.size(); i++) {
30976        if (i == res.getRevInclude().size())
30977          res.getRevInclude().add(parseString(null));
30978        if (array.get(i) instanceof JsonObject) 
30979          parseElementProperties(array.get(i).getAsJsonObject(), res.getRevInclude().get(i));
30980      }
30981    };
30982  }
30983
30984  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
30985    Substance res = new Substance();
30986    parseSubstanceProperties(json, res);
30987    return res;
30988  }
30989
30990  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
30991    parseDomainResourceProperties(json, res);
30992    if (json.has("identifier")) {
30993      JsonArray array = getJArray(json, "identifier");
30994      for (int i = 0; i < array.size(); i++) {
30995        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
30996      }
30997    };
30998    if (json.has("instance"))
30999      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
31000    if (json.has("_instance"))
31001      parseElementProperties(getJObject(json, "_instance"), res.getInstanceElement());
31002    if (json.has("status"))
31003      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
31004    if (json.has("_status"))
31005      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
31006    if (json.has("category")) {
31007      JsonArray array = getJArray(json, "category");
31008      for (int i = 0; i < array.size(); i++) {
31009        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31010      }
31011    };
31012    if (json.has("code"))
31013      res.setCode(parseCodeableReference(getJObject(json, "code")));
31014    if (json.has("description"))
31015      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
31016    if (json.has("_description"))
31017      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
31018    if (json.has("expiry"))
31019      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
31020    if (json.has("_expiry"))
31021      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
31022    if (json.has("quantity"))
31023      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
31024    if (json.has("ingredient")) {
31025      JsonArray array = getJArray(json, "ingredient");
31026      for (int i = 0; i < array.size(); i++) {
31027        res.getIngredient().add(parseSubstanceIngredientComponent(array.get(i).getAsJsonObject()));
31028      }
31029    };
31030  }
31031
31032  protected Substance.SubstanceIngredientComponent parseSubstanceIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
31033    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
31034    parseSubstanceIngredientComponentProperties(json, res);
31035    return res;
31036  }
31037
31038  protected void parseSubstanceIngredientComponentProperties(JsonObject json, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
31039    parseBackboneElementProperties(json, res);
31040    if (json.has("quantity"))
31041      res.setQuantity(parseRatio(getJObject(json, "quantity")));
31042    DataType substance = parseType("substance", json);
31043    if (substance != null)
31044      res.setSubstance(substance);
31045  }
31046
31047  protected SubstanceDefinition parseSubstanceDefinition(JsonObject json) throws IOException, FHIRFormatError {
31048    SubstanceDefinition res = new SubstanceDefinition();
31049    parseSubstanceDefinitionProperties(json, res);
31050    return res;
31051  }
31052
31053  protected void parseSubstanceDefinitionProperties(JsonObject json, SubstanceDefinition res) throws IOException, FHIRFormatError {
31054    parseDomainResourceProperties(json, res);
31055    if (json.has("identifier")) {
31056      JsonArray array = getJArray(json, "identifier");
31057      for (int i = 0; i < array.size(); i++) {
31058        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
31059      }
31060    };
31061    if (json.has("version"))
31062      res.setVersionElement(parseString(json.get("version").getAsString()));
31063    if (json.has("_version"))
31064      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
31065    if (json.has("status"))
31066      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
31067    if (json.has("classification")) {
31068      JsonArray array = getJArray(json, "classification");
31069      for (int i = 0; i < array.size(); i++) {
31070        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31071      }
31072    };
31073    if (json.has("domain"))
31074      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
31075    if (json.has("grade")) {
31076      JsonArray array = getJArray(json, "grade");
31077      for (int i = 0; i < array.size(); i++) {
31078        res.getGrade().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31079      }
31080    };
31081    if (json.has("description"))
31082      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
31083    if (json.has("_description"))
31084      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
31085    if (json.has("informationSource")) {
31086      JsonArray array = getJArray(json, "informationSource");
31087      for (int i = 0; i < array.size(); i++) {
31088        res.getInformationSource().add(parseReference(array.get(i).getAsJsonObject()));
31089      }
31090    };
31091    if (json.has("note")) {
31092      JsonArray array = getJArray(json, "note");
31093      for (int i = 0; i < array.size(); i++) {
31094        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
31095      }
31096    };
31097    if (json.has("manufacturer")) {
31098      JsonArray array = getJArray(json, "manufacturer");
31099      for (int i = 0; i < array.size(); i++) {
31100        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
31101      }
31102    };
31103    if (json.has("supplier")) {
31104      JsonArray array = getJArray(json, "supplier");
31105      for (int i = 0; i < array.size(); i++) {
31106        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
31107      }
31108    };
31109    if (json.has("moiety")) {
31110      JsonArray array = getJArray(json, "moiety");
31111      for (int i = 0; i < array.size(); i++) {
31112        res.getMoiety().add(parseSubstanceDefinitionMoietyComponent(array.get(i).getAsJsonObject()));
31113      }
31114    };
31115    if (json.has("characterization")) {
31116      JsonArray array = getJArray(json, "characterization");
31117      for (int i = 0; i < array.size(); i++) {
31118        res.getCharacterization().add(parseSubstanceDefinitionCharacterizationComponent(array.get(i).getAsJsonObject()));
31119      }
31120    };
31121    if (json.has("property")) {
31122      JsonArray array = getJArray(json, "property");
31123      for (int i = 0; i < array.size(); i++) {
31124        res.getProperty().add(parseSubstanceDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
31125      }
31126    };
31127    if (json.has("referenceInformation"))
31128      res.setReferenceInformation(parseReference(getJObject(json, "referenceInformation")));
31129    if (json.has("molecularWeight")) {
31130      JsonArray array = getJArray(json, "molecularWeight");
31131      for (int i = 0; i < array.size(); i++) {
31132        res.getMolecularWeight().add(parseSubstanceDefinitionMolecularWeightComponent(array.get(i).getAsJsonObject()));
31133      }
31134    };
31135    if (json.has("structure"))
31136      res.setStructure(parseSubstanceDefinitionStructureComponent(getJObject(json, "structure")));
31137    if (json.has("code")) {
31138      JsonArray array = getJArray(json, "code");
31139      for (int i = 0; i < array.size(); i++) {
31140        res.getCode().add(parseSubstanceDefinitionCodeComponent(array.get(i).getAsJsonObject()));
31141      }
31142    };
31143    if (json.has("name")) {
31144      JsonArray array = getJArray(json, "name");
31145      for (int i = 0; i < array.size(); i++) {
31146        res.getName().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
31147      }
31148    };
31149    if (json.has("relationship")) {
31150      JsonArray array = getJArray(json, "relationship");
31151      for (int i = 0; i < array.size(); i++) {
31152        res.getRelationship().add(parseSubstanceDefinitionRelationshipComponent(array.get(i).getAsJsonObject()));
31153      }
31154    };
31155    if (json.has("nucleicAcid"))
31156      res.setNucleicAcid(parseReference(getJObject(json, "nucleicAcid")));
31157    if (json.has("polymer"))
31158      res.setPolymer(parseReference(getJObject(json, "polymer")));
31159    if (json.has("protein"))
31160      res.setProtein(parseReference(getJObject(json, "protein")));
31161    if (json.has("sourceMaterial"))
31162      res.setSourceMaterial(parseSubstanceDefinitionSourceMaterialComponent(getJObject(json, "sourceMaterial")));
31163  }
31164
31165  protected SubstanceDefinition.SubstanceDefinitionMoietyComponent parseSubstanceDefinitionMoietyComponent(JsonObject json) throws IOException, FHIRFormatError {
31166    SubstanceDefinition.SubstanceDefinitionMoietyComponent res = new SubstanceDefinition.SubstanceDefinitionMoietyComponent();
31167    parseSubstanceDefinitionMoietyComponentProperties(json, res);
31168    return res;
31169  }
31170
31171  protected void parseSubstanceDefinitionMoietyComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionMoietyComponent res) throws IOException, FHIRFormatError {
31172    parseBackboneElementProperties(json, res);
31173    if (json.has("role"))
31174      res.setRole(parseCodeableConcept(getJObject(json, "role")));
31175    if (json.has("identifier"))
31176      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
31177    if (json.has("name"))
31178      res.setNameElement(parseString(json.get("name").getAsString()));
31179    if (json.has("_name"))
31180      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
31181    if (json.has("stereochemistry"))
31182      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
31183    if (json.has("opticalActivity"))
31184      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
31185    if (json.has("molecularFormula"))
31186      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
31187    if (json.has("_molecularFormula"))
31188      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
31189    DataType amount = parseType("amount", json);
31190    if (amount != null)
31191      res.setAmount(amount);
31192    if (json.has("measurementType"))
31193      res.setMeasurementType(parseCodeableConcept(getJObject(json, "measurementType")));
31194  }
31195
31196  protected SubstanceDefinition.SubstanceDefinitionCharacterizationComponent parseSubstanceDefinitionCharacterizationComponent(JsonObject json) throws IOException, FHIRFormatError {
31197    SubstanceDefinition.SubstanceDefinitionCharacterizationComponent res = new SubstanceDefinition.SubstanceDefinitionCharacterizationComponent();
31198    parseSubstanceDefinitionCharacterizationComponentProperties(json, res);
31199    return res;
31200  }
31201
31202  protected void parseSubstanceDefinitionCharacterizationComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionCharacterizationComponent res) throws IOException, FHIRFormatError {
31203    parseBackboneElementProperties(json, res);
31204    if (json.has("technique"))
31205      res.setTechnique(parseCodeableConcept(getJObject(json, "technique")));
31206    if (json.has("form"))
31207      res.setForm(parseCodeableConcept(getJObject(json, "form")));
31208    if (json.has("description"))
31209      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
31210    if (json.has("_description"))
31211      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
31212    if (json.has("file")) {
31213      JsonArray array = getJArray(json, "file");
31214      for (int i = 0; i < array.size(); i++) {
31215        res.getFile().add(parseAttachment(array.get(i).getAsJsonObject()));
31216      }
31217    };
31218  }
31219
31220  protected SubstanceDefinition.SubstanceDefinitionPropertyComponent parseSubstanceDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
31221    SubstanceDefinition.SubstanceDefinitionPropertyComponent res = new SubstanceDefinition.SubstanceDefinitionPropertyComponent();
31222    parseSubstanceDefinitionPropertyComponentProperties(json, res);
31223    return res;
31224  }
31225
31226  protected void parseSubstanceDefinitionPropertyComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
31227    parseBackboneElementProperties(json, res);
31228    if (json.has("type"))
31229      res.setType(parseCodeableConcept(getJObject(json, "type")));
31230    DataType value = parseType("value", json);
31231    if (value != null)
31232      res.setValue(value);
31233  }
31234
31235  protected SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent parseSubstanceDefinitionMolecularWeightComponent(JsonObject json) throws IOException, FHIRFormatError {
31236    SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent res = new SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent();
31237    parseSubstanceDefinitionMolecularWeightComponentProperties(json, res);
31238    return res;
31239  }
31240
31241  protected void parseSubstanceDefinitionMolecularWeightComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent res) throws IOException, FHIRFormatError {
31242    parseBackboneElementProperties(json, res);
31243    if (json.has("method"))
31244      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
31245    if (json.has("type"))
31246      res.setType(parseCodeableConcept(getJObject(json, "type")));
31247    if (json.has("amount"))
31248      res.setAmount(parseQuantity(getJObject(json, "amount")));
31249  }
31250
31251  protected SubstanceDefinition.SubstanceDefinitionStructureComponent parseSubstanceDefinitionStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
31252    SubstanceDefinition.SubstanceDefinitionStructureComponent res = new SubstanceDefinition.SubstanceDefinitionStructureComponent();
31253    parseSubstanceDefinitionStructureComponentProperties(json, res);
31254    return res;
31255  }
31256
31257  protected void parseSubstanceDefinitionStructureComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureComponent res) throws IOException, FHIRFormatError {
31258    parseBackboneElementProperties(json, res);
31259    if (json.has("stereochemistry"))
31260      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
31261    if (json.has("opticalActivity"))
31262      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
31263    if (json.has("molecularFormula"))
31264      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
31265    if (json.has("_molecularFormula"))
31266      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
31267    if (json.has("molecularFormulaByMoiety"))
31268      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
31269    if (json.has("_molecularFormulaByMoiety"))
31270      parseElementProperties(getJObject(json, "_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
31271    if (json.has("molecularWeight"))
31272      res.setMolecularWeight(parseSubstanceDefinitionMolecularWeightComponent(getJObject(json, "molecularWeight")));
31273    if (json.has("technique")) {
31274      JsonArray array = getJArray(json, "technique");
31275      for (int i = 0; i < array.size(); i++) {
31276        res.getTechnique().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31277      }
31278    };
31279    if (json.has("sourceDocument")) {
31280      JsonArray array = getJArray(json, "sourceDocument");
31281      for (int i = 0; i < array.size(); i++) {
31282        res.getSourceDocument().add(parseReference(array.get(i).getAsJsonObject()));
31283      }
31284    };
31285    if (json.has("representation")) {
31286      JsonArray array = getJArray(json, "representation");
31287      for (int i = 0; i < array.size(); i++) {
31288        res.getRepresentation().add(parseSubstanceDefinitionStructureRepresentationComponent(array.get(i).getAsJsonObject()));
31289      }
31290    };
31291  }
31292
31293  protected SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent parseSubstanceDefinitionStructureRepresentationComponent(JsonObject json) throws IOException, FHIRFormatError {
31294    SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res = new SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent();
31295    parseSubstanceDefinitionStructureRepresentationComponentProperties(json, res);
31296    return res;
31297  }
31298
31299  protected void parseSubstanceDefinitionStructureRepresentationComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res) throws IOException, FHIRFormatError {
31300    parseBackboneElementProperties(json, res);
31301    if (json.has("type"))
31302      res.setType(parseCodeableConcept(getJObject(json, "type")));
31303    if (json.has("representation"))
31304      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
31305    if (json.has("_representation"))
31306      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
31307    if (json.has("format"))
31308      res.setFormat(parseCodeableConcept(getJObject(json, "format")));
31309    if (json.has("document"))
31310      res.setDocument(parseReference(getJObject(json, "document")));
31311  }
31312
31313  protected SubstanceDefinition.SubstanceDefinitionCodeComponent parseSubstanceDefinitionCodeComponent(JsonObject json) throws IOException, FHIRFormatError {
31314    SubstanceDefinition.SubstanceDefinitionCodeComponent res = new SubstanceDefinition.SubstanceDefinitionCodeComponent();
31315    parseSubstanceDefinitionCodeComponentProperties(json, res);
31316    return res;
31317  }
31318
31319  protected void parseSubstanceDefinitionCodeComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionCodeComponent res) throws IOException, FHIRFormatError {
31320    parseBackboneElementProperties(json, res);
31321    if (json.has("code"))
31322      res.setCode(parseCodeableConcept(getJObject(json, "code")));
31323    if (json.has("status"))
31324      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
31325    if (json.has("statusDate"))
31326      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
31327    if (json.has("_statusDate"))
31328      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
31329    if (json.has("note")) {
31330      JsonArray array = getJArray(json, "note");
31331      for (int i = 0; i < array.size(); i++) {
31332        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
31333      }
31334    };
31335    if (json.has("source")) {
31336      JsonArray array = getJArray(json, "source");
31337      for (int i = 0; i < array.size(); i++) {
31338        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
31339      }
31340    };
31341  }
31342
31343  protected SubstanceDefinition.SubstanceDefinitionNameComponent parseSubstanceDefinitionNameComponent(JsonObject json) throws IOException, FHIRFormatError {
31344    SubstanceDefinition.SubstanceDefinitionNameComponent res = new SubstanceDefinition.SubstanceDefinitionNameComponent();
31345    parseSubstanceDefinitionNameComponentProperties(json, res);
31346    return res;
31347  }
31348
31349  protected void parseSubstanceDefinitionNameComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionNameComponent res) throws IOException, FHIRFormatError {
31350    parseBackboneElementProperties(json, res);
31351    if (json.has("name"))
31352      res.setNameElement(parseString(json.get("name").getAsString()));
31353    if (json.has("_name"))
31354      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
31355    if (json.has("type"))
31356      res.setType(parseCodeableConcept(getJObject(json, "type")));
31357    if (json.has("status"))
31358      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
31359    if (json.has("preferred"))
31360      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
31361    if (json.has("_preferred"))
31362      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
31363    if (json.has("language")) {
31364      JsonArray array = getJArray(json, "language");
31365      for (int i = 0; i < array.size(); i++) {
31366        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31367      }
31368    };
31369    if (json.has("domain")) {
31370      JsonArray array = getJArray(json, "domain");
31371      for (int i = 0; i < array.size(); i++) {
31372        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31373      }
31374    };
31375    if (json.has("jurisdiction")) {
31376      JsonArray array = getJArray(json, "jurisdiction");
31377      for (int i = 0; i < array.size(); i++) {
31378        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31379      }
31380    };
31381    if (json.has("synonym")) {
31382      JsonArray array = getJArray(json, "synonym");
31383      for (int i = 0; i < array.size(); i++) {
31384        res.getSynonym().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
31385      }
31386    };
31387    if (json.has("translation")) {
31388      JsonArray array = getJArray(json, "translation");
31389      for (int i = 0; i < array.size(); i++) {
31390        res.getTranslation().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
31391      }
31392    };
31393    if (json.has("official")) {
31394      JsonArray array = getJArray(json, "official");
31395      for (int i = 0; i < array.size(); i++) {
31396        res.getOfficial().add(parseSubstanceDefinitionNameOfficialComponent(array.get(i).getAsJsonObject()));
31397      }
31398    };
31399    if (json.has("source")) {
31400      JsonArray array = getJArray(json, "source");
31401      for (int i = 0; i < array.size(); i++) {
31402        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
31403      }
31404    };
31405  }
31406
31407  protected SubstanceDefinition.SubstanceDefinitionNameOfficialComponent parseSubstanceDefinitionNameOfficialComponent(JsonObject json) throws IOException, FHIRFormatError {
31408    SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res = new SubstanceDefinition.SubstanceDefinitionNameOfficialComponent();
31409    parseSubstanceDefinitionNameOfficialComponentProperties(json, res);
31410    return res;
31411  }
31412
31413  protected void parseSubstanceDefinitionNameOfficialComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res) throws IOException, FHIRFormatError {
31414    parseBackboneElementProperties(json, res);
31415    if (json.has("authority"))
31416      res.setAuthority(parseCodeableConcept(getJObject(json, "authority")));
31417    if (json.has("status"))
31418      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
31419    if (json.has("date"))
31420      res.setDateElement(parseDateTime(json.get("date").getAsString()));
31421    if (json.has("_date"))
31422      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
31423  }
31424
31425  protected SubstanceDefinition.SubstanceDefinitionRelationshipComponent parseSubstanceDefinitionRelationshipComponent(JsonObject json) throws IOException, FHIRFormatError {
31426    SubstanceDefinition.SubstanceDefinitionRelationshipComponent res = new SubstanceDefinition.SubstanceDefinitionRelationshipComponent();
31427    parseSubstanceDefinitionRelationshipComponentProperties(json, res);
31428    return res;
31429  }
31430
31431  protected void parseSubstanceDefinitionRelationshipComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionRelationshipComponent res) throws IOException, FHIRFormatError {
31432    parseBackboneElementProperties(json, res);
31433    DataType substanceDefinition = parseType("substanceDefinition", json);
31434    if (substanceDefinition != null)
31435      res.setSubstanceDefinition(substanceDefinition);
31436    if (json.has("type"))
31437      res.setType(parseCodeableConcept(getJObject(json, "type")));
31438    if (json.has("isDefining"))
31439      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
31440    if (json.has("_isDefining"))
31441      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
31442    DataType amount = parseType("amount", json);
31443    if (amount != null)
31444      res.setAmount(amount);
31445    if (json.has("ratioHighLimitAmount"))
31446      res.setRatioHighLimitAmount(parseRatio(getJObject(json, "ratioHighLimitAmount")));
31447    if (json.has("comparator"))
31448      res.setComparator(parseCodeableConcept(getJObject(json, "comparator")));
31449    if (json.has("source")) {
31450      JsonArray array = getJArray(json, "source");
31451      for (int i = 0; i < array.size(); i++) {
31452        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
31453      }
31454    };
31455  }
31456
31457  protected SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent parseSubstanceDefinitionSourceMaterialComponent(JsonObject json) throws IOException, FHIRFormatError {
31458    SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent res = new SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent();
31459    parseSubstanceDefinitionSourceMaterialComponentProperties(json, res);
31460    return res;
31461  }
31462
31463  protected void parseSubstanceDefinitionSourceMaterialComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent res) throws IOException, FHIRFormatError {
31464    parseBackboneElementProperties(json, res);
31465    if (json.has("type"))
31466      res.setType(parseCodeableConcept(getJObject(json, "type")));
31467    if (json.has("genus"))
31468      res.setGenus(parseCodeableConcept(getJObject(json, "genus")));
31469    if (json.has("species"))
31470      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
31471    if (json.has("part"))
31472      res.setPart(parseCodeableConcept(getJObject(json, "part")));
31473    if (json.has("countryOfOrigin")) {
31474      JsonArray array = getJArray(json, "countryOfOrigin");
31475      for (int i = 0; i < array.size(); i++) {
31476        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31477      }
31478    };
31479  }
31480
31481  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
31482    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
31483    parseSubstanceNucleicAcidProperties(json, res);
31484    return res;
31485  }
31486
31487  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res) throws IOException, FHIRFormatError {
31488    parseDomainResourceProperties(json, res);
31489    if (json.has("sequenceType"))
31490      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
31491    if (json.has("numberOfSubunits"))
31492      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
31493    if (json.has("_numberOfSubunits"))
31494      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
31495    if (json.has("areaOfHybridisation"))
31496      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
31497    if (json.has("_areaOfHybridisation"))
31498      parseElementProperties(getJObject(json, "_areaOfHybridisation"), res.getAreaOfHybridisationElement());
31499    if (json.has("oligoNucleotideType"))
31500      res.setOligoNucleotideType(parseCodeableConcept(getJObject(json, "oligoNucleotideType")));
31501    if (json.has("subunit")) {
31502      JsonArray array = getJArray(json, "subunit");
31503      for (int i = 0; i < array.size(); i++) {
31504        res.getSubunit().add(parseSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject()));
31505      }
31506    };
31507  }
31508
31509  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubunitComponent(JsonObject json) throws IOException, FHIRFormatError {
31510    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
31511    parseSubstanceNucleicAcidSubunitComponentProperties(json, res);
31512    return res;
31513  }
31514
31515  protected void parseSubstanceNucleicAcidSubunitComponentProperties(JsonObject json, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res) throws IOException, FHIRFormatError {
31516    parseBackboneElementProperties(json, res);
31517    if (json.has("subunit"))
31518      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
31519    if (json.has("_subunit"))
31520      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
31521    if (json.has("sequence"))
31522      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
31523    if (json.has("_sequence"))
31524      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
31525    if (json.has("length"))
31526      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
31527    if (json.has("_length"))
31528      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
31529    if (json.has("sequenceAttachment"))
31530      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
31531    if (json.has("fivePrime"))
31532      res.setFivePrime(parseCodeableConcept(getJObject(json, "fivePrime")));
31533    if (json.has("threePrime"))
31534      res.setThreePrime(parseCodeableConcept(getJObject(json, "threePrime")));
31535    if (json.has("linkage")) {
31536      JsonArray array = getJArray(json, "linkage");
31537      for (int i = 0; i < array.size(); i++) {
31538        res.getLinkage().add(parseSubstanceNucleicAcidSubunitLinkageComponent(array.get(i).getAsJsonObject()));
31539      }
31540    };
31541    if (json.has("sugar")) {
31542      JsonArray array = getJArray(json, "sugar");
31543      for (int i = 0; i < array.size(); i++) {
31544        res.getSugar().add(parseSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject()));
31545      }
31546    };
31547  }
31548
31549  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubunitLinkageComponent(JsonObject json) throws IOException, FHIRFormatError {
31550    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
31551    parseSubstanceNucleicAcidSubunitLinkageComponentProperties(json, res);
31552    return res;
31553  }
31554
31555  protected void parseSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res) throws IOException, FHIRFormatError {
31556    parseBackboneElementProperties(json, res);
31557    if (json.has("connectivity"))
31558      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
31559    if (json.has("_connectivity"))
31560      parseElementProperties(getJObject(json, "_connectivity"), res.getConnectivityElement());
31561    if (json.has("identifier"))
31562      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
31563    if (json.has("name"))
31564      res.setNameElement(parseString(json.get("name").getAsString()));
31565    if (json.has("_name"))
31566      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
31567    if (json.has("residueSite"))
31568      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
31569    if (json.has("_residueSite"))
31570      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
31571  }
31572
31573  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubunitSugarComponent(JsonObject json) throws IOException, FHIRFormatError {
31574    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
31575    parseSubstanceNucleicAcidSubunitSugarComponentProperties(json, res);
31576    return res;
31577  }
31578
31579  protected void parseSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res) throws IOException, FHIRFormatError {
31580    parseBackboneElementProperties(json, res);
31581    if (json.has("identifier"))
31582      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
31583    if (json.has("name"))
31584      res.setNameElement(parseString(json.get("name").getAsString()));
31585    if (json.has("_name"))
31586      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
31587    if (json.has("residueSite"))
31588      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
31589    if (json.has("_residueSite"))
31590      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
31591  }
31592
31593  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
31594    SubstancePolymer res = new SubstancePolymer();
31595    parseSubstancePolymerProperties(json, res);
31596    return res;
31597  }
31598
31599  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
31600    parseDomainResourceProperties(json, res);
31601    if (json.has("identifier"))
31602      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
31603    if (json.has("class"))
31604      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
31605    if (json.has("geometry"))
31606      res.setGeometry(parseCodeableConcept(getJObject(json, "geometry")));
31607    if (json.has("copolymerConnectivity")) {
31608      JsonArray array = getJArray(json, "copolymerConnectivity");
31609      for (int i = 0; i < array.size(); i++) {
31610        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31611      }
31612    };
31613    if (json.has("modification"))
31614      res.setModificationElement(parseString(json.get("modification").getAsString()));
31615    if (json.has("_modification"))
31616      parseElementProperties(getJObject(json, "_modification"), res.getModificationElement());
31617    if (json.has("monomerSet")) {
31618      JsonArray array = getJArray(json, "monomerSet");
31619      for (int i = 0; i < array.size(); i++) {
31620        res.getMonomerSet().add(parseSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject()));
31621      }
31622    };
31623    if (json.has("repeat")) {
31624      JsonArray array = getJArray(json, "repeat");
31625      for (int i = 0; i < array.size(); i++) {
31626        res.getRepeat().add(parseSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject()));
31627      }
31628    };
31629  }
31630
31631  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerMonomerSetComponent(JsonObject json) throws IOException, FHIRFormatError {
31632    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
31633    parseSubstancePolymerMonomerSetComponentProperties(json, res);
31634    return res;
31635  }
31636
31637  protected void parseSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
31638    parseBackboneElementProperties(json, res);
31639    if (json.has("ratioType"))
31640      res.setRatioType(parseCodeableConcept(getJObject(json, "ratioType")));
31641    if (json.has("startingMaterial")) {
31642      JsonArray array = getJArray(json, "startingMaterial");
31643      for (int i = 0; i < array.size(); i++) {
31644        res.getStartingMaterial().add(parseSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject()));
31645      }
31646    };
31647  }
31648
31649  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json) throws IOException, FHIRFormatError {
31650    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
31651    parseSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, res);
31652    return res;
31653  }
31654
31655  protected void parseSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
31656    parseBackboneElementProperties(json, res);
31657    if (json.has("code"))
31658      res.setCode(parseCodeableConcept(getJObject(json, "code")));
31659    if (json.has("category"))
31660      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
31661    if (json.has("isDefining"))
31662      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
31663    if (json.has("_isDefining"))
31664      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
31665    if (json.has("amount"))
31666      res.setAmount(parseQuantity(getJObject(json, "amount")));
31667  }
31668
31669  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerRepeatComponent(JsonObject json) throws IOException, FHIRFormatError {
31670    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
31671    parseSubstancePolymerRepeatComponentProperties(json, res);
31672    return res;
31673  }
31674
31675  protected void parseSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
31676    parseBackboneElementProperties(json, res);
31677    if (json.has("averageMolecularFormula"))
31678      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
31679    if (json.has("_averageMolecularFormula"))
31680      parseElementProperties(getJObject(json, "_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
31681    if (json.has("repeatUnitAmountType"))
31682      res.setRepeatUnitAmountType(parseCodeableConcept(getJObject(json, "repeatUnitAmountType")));
31683    if (json.has("repeatUnit")) {
31684      JsonArray array = getJArray(json, "repeatUnit");
31685      for (int i = 0; i < array.size(); i++) {
31686        res.getRepeatUnit().add(parseSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject()));
31687      }
31688    };
31689  }
31690
31691  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerRepeatRepeatUnitComponent(JsonObject json) throws IOException, FHIRFormatError {
31692    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
31693    parseSubstancePolymerRepeatRepeatUnitComponentProperties(json, res);
31694    return res;
31695  }
31696
31697  protected void parseSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
31698    parseBackboneElementProperties(json, res);
31699    if (json.has("unit"))
31700      res.setUnitElement(parseString(json.get("unit").getAsString()));
31701    if (json.has("_unit"))
31702      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
31703    if (json.has("orientation"))
31704      res.setOrientation(parseCodeableConcept(getJObject(json, "orientation")));
31705    if (json.has("amount"))
31706      res.setAmountElement(parseInteger(json.get("amount").getAsLong()));
31707    if (json.has("_amount"))
31708      parseElementProperties(getJObject(json, "_amount"), res.getAmountElement());
31709    if (json.has("degreeOfPolymerisation")) {
31710      JsonArray array = getJArray(json, "degreeOfPolymerisation");
31711      for (int i = 0; i < array.size(); i++) {
31712        res.getDegreeOfPolymerisation().add(parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject()));
31713      }
31714    };
31715    if (json.has("structuralRepresentation")) {
31716      JsonArray array = getJArray(json, "structuralRepresentation");
31717      for (int i = 0; i < array.size(); i++) {
31718        res.getStructuralRepresentation().add(parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject()));
31719      }
31720    };
31721  }
31722
31723  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json) throws IOException, FHIRFormatError {
31724    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
31725    parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, res);
31726    return res;
31727  }
31728
31729  protected void parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
31730    parseBackboneElementProperties(json, res);
31731    if (json.has("type"))
31732      res.setType(parseCodeableConcept(getJObject(json, "type")));
31733    if (json.has("average"))
31734      res.setAverageElement(parseInteger(json.get("average").getAsLong()));
31735    if (json.has("_average"))
31736      parseElementProperties(getJObject(json, "_average"), res.getAverageElement());
31737    if (json.has("low"))
31738      res.setLowElement(parseInteger(json.get("low").getAsLong()));
31739    if (json.has("_low"))
31740      parseElementProperties(getJObject(json, "_low"), res.getLowElement());
31741    if (json.has("high"))
31742      res.setHighElement(parseInteger(json.get("high").getAsLong()));
31743    if (json.has("_high"))
31744      parseElementProperties(getJObject(json, "_high"), res.getHighElement());
31745  }
31746
31747  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json) throws IOException, FHIRFormatError {
31748    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
31749    parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, res);
31750    return res;
31751  }
31752
31753  protected void parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
31754    parseBackboneElementProperties(json, res);
31755    if (json.has("type"))
31756      res.setType(parseCodeableConcept(getJObject(json, "type")));
31757    if (json.has("representation"))
31758      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
31759    if (json.has("_representation"))
31760      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
31761    if (json.has("format"))
31762      res.setFormat(parseCodeableConcept(getJObject(json, "format")));
31763    if (json.has("attachment"))
31764      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
31765  }
31766
31767  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
31768    SubstanceProtein res = new SubstanceProtein();
31769    parseSubstanceProteinProperties(json, res);
31770    return res;
31771  }
31772
31773  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res) throws IOException, FHIRFormatError {
31774    parseDomainResourceProperties(json, res);
31775    if (json.has("sequenceType"))
31776      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
31777    if (json.has("numberOfSubunits"))
31778      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
31779    if (json.has("_numberOfSubunits"))
31780      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
31781    if (json.has("disulfideLinkage")) {
31782      JsonArray array = getJArray(json, "disulfideLinkage");
31783      for (int i = 0; i < array.size(); i++) {
31784        if (array.get(i).isJsonNull()) {
31785          res.getDisulfideLinkage().add(new StringType());
31786        } else {;
31787          res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
31788        }
31789      }
31790    };
31791    if (json.has("_disulfideLinkage")) {
31792      JsonArray array = getJArray(json, "_disulfideLinkage");
31793      for (int i = 0; i < array.size(); i++) {
31794        if (i == res.getDisulfideLinkage().size())
31795          res.getDisulfideLinkage().add(parseString(null));
31796        if (array.get(i) instanceof JsonObject) 
31797          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
31798      }
31799    };
31800    if (json.has("subunit")) {
31801      JsonArray array = getJArray(json, "subunit");
31802      for (int i = 0; i < array.size(); i++) {
31803        res.getSubunit().add(parseSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject()));
31804      }
31805    };
31806  }
31807
31808  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubunitComponent(JsonObject json) throws IOException, FHIRFormatError {
31809    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
31810    parseSubstanceProteinSubunitComponentProperties(json, res);
31811    return res;
31812  }
31813
31814  protected void parseSubstanceProteinSubunitComponentProperties(JsonObject json, SubstanceProtein.SubstanceProteinSubunitComponent res) throws IOException, FHIRFormatError {
31815    parseBackboneElementProperties(json, res);
31816    if (json.has("subunit"))
31817      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
31818    if (json.has("_subunit"))
31819      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
31820    if (json.has("sequence"))
31821      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
31822    if (json.has("_sequence"))
31823      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
31824    if (json.has("length"))
31825      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
31826    if (json.has("_length"))
31827      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
31828    if (json.has("sequenceAttachment"))
31829      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
31830    if (json.has("nTerminalModificationId"))
31831      res.setNTerminalModificationId(parseIdentifier(getJObject(json, "nTerminalModificationId")));
31832    if (json.has("nTerminalModification"))
31833      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
31834    if (json.has("_nTerminalModification"))
31835      parseElementProperties(getJObject(json, "_nTerminalModification"), res.getNTerminalModificationElement());
31836    if (json.has("cTerminalModificationId"))
31837      res.setCTerminalModificationId(parseIdentifier(getJObject(json, "cTerminalModificationId")));
31838    if (json.has("cTerminalModification"))
31839      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
31840    if (json.has("_cTerminalModification"))
31841      parseElementProperties(getJObject(json, "_cTerminalModification"), res.getCTerminalModificationElement());
31842  }
31843
31844  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
31845    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
31846    parseSubstanceReferenceInformationProperties(json, res);
31847    return res;
31848  }
31849
31850  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
31851    parseDomainResourceProperties(json, res);
31852    if (json.has("comment"))
31853      res.setCommentElement(parseString(json.get("comment").getAsString()));
31854    if (json.has("_comment"))
31855      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
31856    if (json.has("gene")) {
31857      JsonArray array = getJArray(json, "gene");
31858      for (int i = 0; i < array.size(); i++) {
31859        res.getGene().add(parseSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject()));
31860      }
31861    };
31862    if (json.has("geneElement")) {
31863      JsonArray array = getJArray(json, "geneElement");
31864      for (int i = 0; i < array.size(); i++) {
31865        res.getGeneElement().add(parseSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject()));
31866      }
31867    };
31868    if (json.has("target")) {
31869      JsonArray array = getJArray(json, "target");
31870      for (int i = 0; i < array.size(); i++) {
31871        res.getTarget().add(parseSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject()));
31872      }
31873    };
31874  }
31875
31876  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationGeneComponent(JsonObject json) throws IOException, FHIRFormatError {
31877    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
31878    parseSubstanceReferenceInformationGeneComponentProperties(json, res);
31879    return res;
31880  }
31881
31882  protected void parseSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
31883    parseBackboneElementProperties(json, res);
31884    if (json.has("geneSequenceOrigin"))
31885      res.setGeneSequenceOrigin(parseCodeableConcept(getJObject(json, "geneSequenceOrigin")));
31886    if (json.has("gene"))
31887      res.setGene(parseCodeableConcept(getJObject(json, "gene")));
31888    if (json.has("source")) {
31889      JsonArray array = getJArray(json, "source");
31890      for (int i = 0; i < array.size(); i++) {
31891        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
31892      }
31893    };
31894  }
31895
31896  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationGeneElementComponent(JsonObject json) throws IOException, FHIRFormatError {
31897    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
31898    parseSubstanceReferenceInformationGeneElementComponentProperties(json, res);
31899    return res;
31900  }
31901
31902  protected void parseSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
31903    parseBackboneElementProperties(json, res);
31904    if (json.has("type"))
31905      res.setType(parseCodeableConcept(getJObject(json, "type")));
31906    if (json.has("element"))
31907      res.setElement(parseIdentifier(getJObject(json, "element")));
31908    if (json.has("source")) {
31909      JsonArray array = getJArray(json, "source");
31910      for (int i = 0; i < array.size(); i++) {
31911        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
31912      }
31913    };
31914  }
31915
31916  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
31917    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
31918    parseSubstanceReferenceInformationTargetComponentProperties(json, res);
31919    return res;
31920  }
31921
31922  protected void parseSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
31923    parseBackboneElementProperties(json, res);
31924    if (json.has("target"))
31925      res.setTarget(parseIdentifier(getJObject(json, "target")));
31926    if (json.has("type"))
31927      res.setType(parseCodeableConcept(getJObject(json, "type")));
31928    if (json.has("interaction"))
31929      res.setInteraction(parseCodeableConcept(getJObject(json, "interaction")));
31930    if (json.has("organism"))
31931      res.setOrganism(parseCodeableConcept(getJObject(json, "organism")));
31932    if (json.has("organismType"))
31933      res.setOrganismType(parseCodeableConcept(getJObject(json, "organismType")));
31934    DataType amount = parseType("amount", json);
31935    if (amount != null)
31936      res.setAmount(amount);
31937    if (json.has("amountType"))
31938      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
31939    if (json.has("source")) {
31940      JsonArray array = getJArray(json, "source");
31941      for (int i = 0; i < array.size(); i++) {
31942        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
31943      }
31944    };
31945  }
31946
31947  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
31948    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
31949    parseSubstanceSourceMaterialProperties(json, res);
31950    return res;
31951  }
31952
31953  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res) throws IOException, FHIRFormatError {
31954    parseDomainResourceProperties(json, res);
31955    if (json.has("sourceMaterialClass"))
31956      res.setSourceMaterialClass(parseCodeableConcept(getJObject(json, "sourceMaterialClass")));
31957    if (json.has("sourceMaterialType"))
31958      res.setSourceMaterialType(parseCodeableConcept(getJObject(json, "sourceMaterialType")));
31959    if (json.has("sourceMaterialState"))
31960      res.setSourceMaterialState(parseCodeableConcept(getJObject(json, "sourceMaterialState")));
31961    if (json.has("organismId"))
31962      res.setOrganismId(parseIdentifier(getJObject(json, "organismId")));
31963    if (json.has("organismName"))
31964      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
31965    if (json.has("_organismName"))
31966      parseElementProperties(getJObject(json, "_organismName"), res.getOrganismNameElement());
31967    if (json.has("parentSubstanceId")) {
31968      JsonArray array = getJArray(json, "parentSubstanceId");
31969      for (int i = 0; i < array.size(); i++) {
31970        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
31971      }
31972    };
31973    if (json.has("parentSubstanceName")) {
31974      JsonArray array = getJArray(json, "parentSubstanceName");
31975      for (int i = 0; i < array.size(); i++) {
31976        if (array.get(i).isJsonNull()) {
31977          res.getParentSubstanceName().add(new StringType());
31978        } else {;
31979          res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
31980        }
31981      }
31982    };
31983    if (json.has("_parentSubstanceName")) {
31984      JsonArray array = getJArray(json, "_parentSubstanceName");
31985      for (int i = 0; i < array.size(); i++) {
31986        if (i == res.getParentSubstanceName().size())
31987          res.getParentSubstanceName().add(parseString(null));
31988        if (array.get(i) instanceof JsonObject) 
31989          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
31990      }
31991    };
31992    if (json.has("countryOfOrigin")) {
31993      JsonArray array = getJArray(json, "countryOfOrigin");
31994      for (int i = 0; i < array.size(); i++) {
31995        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31996      }
31997    };
31998    if (json.has("geographicalLocation")) {
31999      JsonArray array = getJArray(json, "geographicalLocation");
32000      for (int i = 0; i < array.size(); i++) {
32001        if (array.get(i).isJsonNull()) {
32002          res.getGeographicalLocation().add(new StringType());
32003        } else {;
32004          res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
32005        }
32006      }
32007    };
32008    if (json.has("_geographicalLocation")) {
32009      JsonArray array = getJArray(json, "_geographicalLocation");
32010      for (int i = 0; i < array.size(); i++) {
32011        if (i == res.getGeographicalLocation().size())
32012          res.getGeographicalLocation().add(parseString(null));
32013        if (array.get(i) instanceof JsonObject) 
32014          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
32015      }
32016    };
32017    if (json.has("developmentStage"))
32018      res.setDevelopmentStage(parseCodeableConcept(getJObject(json, "developmentStage")));
32019    if (json.has("fractionDescription")) {
32020      JsonArray array = getJArray(json, "fractionDescription");
32021      for (int i = 0; i < array.size(); i++) {
32022        res.getFractionDescription().add(parseSubstanceSourceMaterialFractionDescriptionComponent(array.get(i).getAsJsonObject()));
32023      }
32024    };
32025    if (json.has("organism"))
32026      res.setOrganism(parseSubstanceSourceMaterialOrganismComponent(getJObject(json, "organism")));
32027    if (json.has("partDescription")) {
32028      JsonArray array = getJArray(json, "partDescription");
32029      for (int i = 0; i < array.size(); i++) {
32030        res.getPartDescription().add(parseSubstanceSourceMaterialPartDescriptionComponent(array.get(i).getAsJsonObject()));
32031      }
32032    };
32033  }
32034
32035  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialFractionDescriptionComponent(JsonObject json) throws IOException, FHIRFormatError {
32036    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
32037    parseSubstanceSourceMaterialFractionDescriptionComponentProperties(json, res);
32038    return res;
32039  }
32040
32041  protected void parseSubstanceSourceMaterialFractionDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res) throws IOException, FHIRFormatError {
32042    parseBackboneElementProperties(json, res);
32043    if (json.has("fraction"))
32044      res.setFractionElement(parseString(json.get("fraction").getAsString()));
32045    if (json.has("_fraction"))
32046      parseElementProperties(getJObject(json, "_fraction"), res.getFractionElement());
32047    if (json.has("materialType"))
32048      res.setMaterialType(parseCodeableConcept(getJObject(json, "materialType")));
32049  }
32050
32051  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialOrganismComponent(JsonObject json) throws IOException, FHIRFormatError {
32052    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
32053    parseSubstanceSourceMaterialOrganismComponentProperties(json, res);
32054    return res;
32055  }
32056
32057  protected void parseSubstanceSourceMaterialOrganismComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res) throws IOException, FHIRFormatError {
32058    parseBackboneElementProperties(json, res);
32059    if (json.has("family"))
32060      res.setFamily(parseCodeableConcept(getJObject(json, "family")));
32061    if (json.has("genus"))
32062      res.setGenus(parseCodeableConcept(getJObject(json, "genus")));
32063    if (json.has("species"))
32064      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
32065    if (json.has("intraspecificType"))
32066      res.setIntraspecificType(parseCodeableConcept(getJObject(json, "intraspecificType")));
32067    if (json.has("intraspecificDescription"))
32068      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
32069    if (json.has("_intraspecificDescription"))
32070      parseElementProperties(getJObject(json, "_intraspecificDescription"), res.getIntraspecificDescriptionElement());
32071    if (json.has("author")) {
32072      JsonArray array = getJArray(json, "author");
32073      for (int i = 0; i < array.size(); i++) {
32074        res.getAuthor().add(parseSubstanceSourceMaterialOrganismAuthorComponent(array.get(i).getAsJsonObject()));
32075      }
32076    };
32077    if (json.has("hybrid"))
32078      res.setHybrid(parseSubstanceSourceMaterialOrganismHybridComponent(getJObject(json, "hybrid")));
32079    if (json.has("organismGeneral"))
32080      res.setOrganismGeneral(parseSubstanceSourceMaterialOrganismOrganismGeneralComponent(getJObject(json, "organismGeneral")));
32081  }
32082
32083  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialOrganismAuthorComponent(JsonObject json) throws IOException, FHIRFormatError {
32084    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
32085    parseSubstanceSourceMaterialOrganismAuthorComponentProperties(json, res);
32086    return res;
32087  }
32088
32089  protected void parseSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res) throws IOException, FHIRFormatError {
32090    parseBackboneElementProperties(json, res);
32091    if (json.has("authorType"))
32092      res.setAuthorType(parseCodeableConcept(getJObject(json, "authorType")));
32093    if (json.has("authorDescription"))
32094      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
32095    if (json.has("_authorDescription"))
32096      parseElementProperties(getJObject(json, "_authorDescription"), res.getAuthorDescriptionElement());
32097  }
32098
32099  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialOrganismHybridComponent(JsonObject json) throws IOException, FHIRFormatError {
32100    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
32101    parseSubstanceSourceMaterialOrganismHybridComponentProperties(json, res);
32102    return res;
32103  }
32104
32105  protected void parseSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res) throws IOException, FHIRFormatError {
32106    parseBackboneElementProperties(json, res);
32107    if (json.has("maternalOrganismId"))
32108      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
32109    if (json.has("_maternalOrganismId"))
32110      parseElementProperties(getJObject(json, "_maternalOrganismId"), res.getMaternalOrganismIdElement());
32111    if (json.has("maternalOrganismName"))
32112      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
32113    if (json.has("_maternalOrganismName"))
32114      parseElementProperties(getJObject(json, "_maternalOrganismName"), res.getMaternalOrganismNameElement());
32115    if (json.has("paternalOrganismId"))
32116      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
32117    if (json.has("_paternalOrganismId"))
32118      parseElementProperties(getJObject(json, "_paternalOrganismId"), res.getPaternalOrganismIdElement());
32119    if (json.has("paternalOrganismName"))
32120      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
32121    if (json.has("_paternalOrganismName"))
32122      parseElementProperties(getJObject(json, "_paternalOrganismName"), res.getPaternalOrganismNameElement());
32123    if (json.has("hybridType"))
32124      res.setHybridType(parseCodeableConcept(getJObject(json, "hybridType")));
32125  }
32126
32127  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialOrganismOrganismGeneralComponent(JsonObject json) throws IOException, FHIRFormatError {
32128    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
32129    parseSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, res);
32130    return res;
32131  }
32132
32133  protected void parseSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res) throws IOException, FHIRFormatError {
32134    parseBackboneElementProperties(json, res);
32135    if (json.has("kingdom"))
32136      res.setKingdom(parseCodeableConcept(getJObject(json, "kingdom")));
32137    if (json.has("phylum"))
32138      res.setPhylum(parseCodeableConcept(getJObject(json, "phylum")));
32139    if (json.has("class"))
32140      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
32141    if (json.has("order"))
32142      res.setOrder(parseCodeableConcept(getJObject(json, "order")));
32143  }
32144
32145  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialPartDescriptionComponent(JsonObject json) throws IOException, FHIRFormatError {
32146    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
32147    parseSubstanceSourceMaterialPartDescriptionComponentProperties(json, res);
32148    return res;
32149  }
32150
32151  protected void parseSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res) throws IOException, FHIRFormatError {
32152    parseBackboneElementProperties(json, res);
32153    if (json.has("part"))
32154      res.setPart(parseCodeableConcept(getJObject(json, "part")));
32155    if (json.has("partLocation"))
32156      res.setPartLocation(parseCodeableConcept(getJObject(json, "partLocation")));
32157  }
32158
32159  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
32160    SupplyDelivery res = new SupplyDelivery();
32161    parseSupplyDeliveryProperties(json, res);
32162    return res;
32163  }
32164
32165  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
32166    parseDomainResourceProperties(json, res);
32167    if (json.has("identifier")) {
32168      JsonArray array = getJArray(json, "identifier");
32169      for (int i = 0; i < array.size(); i++) {
32170        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
32171      }
32172    };
32173    if (json.has("basedOn")) {
32174      JsonArray array = getJArray(json, "basedOn");
32175      for (int i = 0; i < array.size(); i++) {
32176        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
32177      }
32178    };
32179    if (json.has("partOf")) {
32180      JsonArray array = getJArray(json, "partOf");
32181      for (int i = 0; i < array.size(); i++) {
32182        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
32183      }
32184    };
32185    if (json.has("status"))
32186      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
32187    if (json.has("_status"))
32188      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
32189    if (json.has("patient"))
32190      res.setPatient(parseReference(getJObject(json, "patient")));
32191    if (json.has("type"))
32192      res.setType(parseCodeableConcept(getJObject(json, "type")));
32193    if (json.has("suppliedItem")) {
32194      JsonArray array = getJArray(json, "suppliedItem");
32195      for (int i = 0; i < array.size(); i++) {
32196        res.getSuppliedItem().add(parseSupplyDeliverySuppliedItemComponent(array.get(i).getAsJsonObject()));
32197      }
32198    };
32199    DataType occurrence = parseType("occurrence", json);
32200    if (occurrence != null)
32201      res.setOccurrence(occurrence);
32202    if (json.has("supplier"))
32203      res.setSupplier(parseReference(getJObject(json, "supplier")));
32204    if (json.has("destination"))
32205      res.setDestination(parseReference(getJObject(json, "destination")));
32206    if (json.has("receiver")) {
32207      JsonArray array = getJArray(json, "receiver");
32208      for (int i = 0; i < array.size(); i++) {
32209        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
32210      }
32211    };
32212  }
32213
32214  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySuppliedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
32215    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
32216    parseSupplyDeliverySuppliedItemComponentProperties(json, res);
32217    return res;
32218  }
32219
32220  protected void parseSupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
32221    parseBackboneElementProperties(json, res);
32222    if (json.has("quantity"))
32223      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
32224    DataType item = parseType("item", json);
32225    if (item != null)
32226      res.setItem(item);
32227  }
32228
32229  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
32230    SupplyRequest res = new SupplyRequest();
32231    parseSupplyRequestProperties(json, res);
32232    return res;
32233  }
32234
32235  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
32236    parseDomainResourceProperties(json, res);
32237    if (json.has("identifier")) {
32238      JsonArray array = getJArray(json, "identifier");
32239      for (int i = 0; i < array.size(); i++) {
32240        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
32241      }
32242    };
32243    if (json.has("status"))
32244      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
32245    if (json.has("_status"))
32246      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
32247    if (json.has("basedOn")) {
32248      JsonArray array = getJArray(json, "basedOn");
32249      for (int i = 0; i < array.size(); i++) {
32250        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
32251      }
32252    };
32253    if (json.has("category"))
32254      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
32255    if (json.has("priority"))
32256      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
32257    if (json.has("_priority"))
32258      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
32259    if (json.has("deliverFor"))
32260      res.setDeliverFor(parseReference(getJObject(json, "deliverFor")));
32261    if (json.has("item"))
32262      res.setItem(parseCodeableReference(getJObject(json, "item")));
32263    if (json.has("quantity"))
32264      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
32265    if (json.has("parameter")) {
32266      JsonArray array = getJArray(json, "parameter");
32267      for (int i = 0; i < array.size(); i++) {
32268        res.getParameter().add(parseSupplyRequestParameterComponent(array.get(i).getAsJsonObject()));
32269      }
32270    };
32271    DataType occurrence = parseType("occurrence", json);
32272    if (occurrence != null)
32273      res.setOccurrence(occurrence);
32274    if (json.has("authoredOn"))
32275      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
32276    if (json.has("_authoredOn"))
32277      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
32278    if (json.has("requester"))
32279      res.setRequester(parseReference(getJObject(json, "requester")));
32280    if (json.has("supplier")) {
32281      JsonArray array = getJArray(json, "supplier");
32282      for (int i = 0; i < array.size(); i++) {
32283        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
32284      }
32285    };
32286    if (json.has("reason")) {
32287      JsonArray array = getJArray(json, "reason");
32288      for (int i = 0; i < array.size(); i++) {
32289        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
32290      }
32291    };
32292    if (json.has("deliverFrom"))
32293      res.setDeliverFrom(parseReference(getJObject(json, "deliverFrom")));
32294    if (json.has("deliverTo"))
32295      res.setDeliverTo(parseReference(getJObject(json, "deliverTo")));
32296  }
32297
32298  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
32299    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
32300    parseSupplyRequestParameterComponentProperties(json, res);
32301    return res;
32302  }
32303
32304  protected void parseSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
32305    parseBackboneElementProperties(json, res);
32306    if (json.has("code"))
32307      res.setCode(parseCodeableConcept(getJObject(json, "code")));
32308    DataType value = parseType("value", json);
32309    if (value != null)
32310      res.setValue(value);
32311  }
32312
32313  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
32314    Task res = new Task();
32315    parseTaskProperties(json, res);
32316    return res;
32317  }
32318
32319  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
32320    parseDomainResourceProperties(json, res);
32321    if (json.has("identifier")) {
32322      JsonArray array = getJArray(json, "identifier");
32323      for (int i = 0; i < array.size(); i++) {
32324        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
32325      }
32326    };
32327    if (json.has("instantiatesCanonical"))
32328      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
32329    if (json.has("_instantiatesCanonical"))
32330      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
32331    if (json.has("instantiatesUri"))
32332      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
32333    if (json.has("_instantiatesUri"))
32334      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
32335    if (json.has("basedOn")) {
32336      JsonArray array = getJArray(json, "basedOn");
32337      for (int i = 0; i < array.size(); i++) {
32338        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
32339      }
32340    };
32341    if (json.has("groupIdentifier"))
32342      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
32343    if (json.has("partOf")) {
32344      JsonArray array = getJArray(json, "partOf");
32345      for (int i = 0; i < array.size(); i++) {
32346        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
32347      }
32348    };
32349    if (json.has("status"))
32350      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
32351    if (json.has("_status"))
32352      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
32353    if (json.has("statusReason"))
32354      res.setStatusReason(parseCodeableReference(getJObject(json, "statusReason")));
32355    if (json.has("businessStatus"))
32356      res.setBusinessStatus(parseCodeableConcept(getJObject(json, "businessStatus")));
32357    if (json.has("intent"))
32358      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
32359    if (json.has("_intent"))
32360      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
32361    if (json.has("priority"))
32362      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
32363    if (json.has("_priority"))
32364      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
32365    if (json.has("doNotPerform"))
32366      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
32367    if (json.has("_doNotPerform"))
32368      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
32369    if (json.has("code"))
32370      res.setCode(parseCodeableConcept(getJObject(json, "code")));
32371    if (json.has("description"))
32372      res.setDescriptionElement(parseString(json.get("description").getAsString()));
32373    if (json.has("_description"))
32374      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
32375    if (json.has("focus"))
32376      res.setFocus(parseReference(getJObject(json, "focus")));
32377    if (json.has("for"))
32378      res.setFor(parseReference(getJObject(json, "for")));
32379    if (json.has("encounter"))
32380      res.setEncounter(parseReference(getJObject(json, "encounter")));
32381    if (json.has("requestedPeriod"))
32382      res.setRequestedPeriod(parsePeriod(getJObject(json, "requestedPeriod")));
32383    if (json.has("executionPeriod"))
32384      res.setExecutionPeriod(parsePeriod(getJObject(json, "executionPeriod")));
32385    if (json.has("authoredOn"))
32386      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
32387    if (json.has("_authoredOn"))
32388      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
32389    if (json.has("lastModified"))
32390      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
32391    if (json.has("_lastModified"))
32392      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
32393    if (json.has("requester"))
32394      res.setRequester(parseReference(getJObject(json, "requester")));
32395    if (json.has("requestedPerformer")) {
32396      JsonArray array = getJArray(json, "requestedPerformer");
32397      for (int i = 0; i < array.size(); i++) {
32398        res.getRequestedPerformer().add(parseCodeableReference(array.get(i).getAsJsonObject()));
32399      }
32400    };
32401    if (json.has("owner"))
32402      res.setOwner(parseReference(getJObject(json, "owner")));
32403    if (json.has("performer")) {
32404      JsonArray array = getJArray(json, "performer");
32405      for (int i = 0; i < array.size(); i++) {
32406        res.getPerformer().add(parseTaskPerformerComponent(array.get(i).getAsJsonObject()));
32407      }
32408    };
32409    if (json.has("location"))
32410      res.setLocation(parseReference(getJObject(json, "location")));
32411    if (json.has("reason")) {
32412      JsonArray array = getJArray(json, "reason");
32413      for (int i = 0; i < array.size(); i++) {
32414        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
32415      }
32416    };
32417    if (json.has("insurance")) {
32418      JsonArray array = getJArray(json, "insurance");
32419      for (int i = 0; i < array.size(); i++) {
32420        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
32421      }
32422    };
32423    if (json.has("note")) {
32424      JsonArray array = getJArray(json, "note");
32425      for (int i = 0; i < array.size(); i++) {
32426        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
32427      }
32428    };
32429    if (json.has("relevantHistory")) {
32430      JsonArray array = getJArray(json, "relevantHistory");
32431      for (int i = 0; i < array.size(); i++) {
32432        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
32433      }
32434    };
32435    if (json.has("restriction"))
32436      res.setRestriction(parseTaskRestrictionComponent(getJObject(json, "restriction")));
32437    if (json.has("input")) {
32438      JsonArray array = getJArray(json, "input");
32439      for (int i = 0; i < array.size(); i++) {
32440        res.getInput().add(parseTaskInputComponent(array.get(i).getAsJsonObject()));
32441      }
32442    };
32443    if (json.has("output")) {
32444      JsonArray array = getJArray(json, "output");
32445      for (int i = 0; i < array.size(); i++) {
32446        res.getOutput().add(parseTaskOutputComponent(array.get(i).getAsJsonObject()));
32447      }
32448    };
32449  }
32450
32451  protected Task.TaskPerformerComponent parseTaskPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
32452    Task.TaskPerformerComponent res = new Task.TaskPerformerComponent();
32453    parseTaskPerformerComponentProperties(json, res);
32454    return res;
32455  }
32456
32457  protected void parseTaskPerformerComponentProperties(JsonObject json, Task.TaskPerformerComponent res) throws IOException, FHIRFormatError {
32458    parseBackboneElementProperties(json, res);
32459    if (json.has("function"))
32460      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
32461    if (json.has("actor"))
32462      res.setActor(parseReference(getJObject(json, "actor")));
32463  }
32464
32465  protected Task.TaskRestrictionComponent parseTaskRestrictionComponent(JsonObject json) throws IOException, FHIRFormatError {
32466    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
32467    parseTaskRestrictionComponentProperties(json, res);
32468    return res;
32469  }
32470
32471  protected void parseTaskRestrictionComponentProperties(JsonObject json, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
32472    parseBackboneElementProperties(json, res);
32473    if (json.has("repetitions"))
32474      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
32475    if (json.has("_repetitions"))
32476      parseElementProperties(getJObject(json, "_repetitions"), res.getRepetitionsElement());
32477    if (json.has("period"))
32478      res.setPeriod(parsePeriod(getJObject(json, "period")));
32479    if (json.has("recipient")) {
32480      JsonArray array = getJArray(json, "recipient");
32481      for (int i = 0; i < array.size(); i++) {
32482        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
32483      }
32484    };
32485  }
32486
32487  protected Task.TaskInputComponent parseTaskInputComponent(JsonObject json) throws IOException, FHIRFormatError {
32488    Task.TaskInputComponent res = new Task.TaskInputComponent();
32489    parseTaskInputComponentProperties(json, res);
32490    return res;
32491  }
32492
32493  protected void parseTaskInputComponentProperties(JsonObject json, Task.TaskInputComponent res) throws IOException, FHIRFormatError {
32494    parseBackboneElementProperties(json, res);
32495    if (json.has("type"))
32496      res.setType(parseCodeableConcept(getJObject(json, "type")));
32497    DataType value = parseType("value", json);
32498    if (value != null)
32499      res.setValue(value);
32500  }
32501
32502  protected Task.TaskOutputComponent parseTaskOutputComponent(JsonObject json) throws IOException, FHIRFormatError {
32503    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
32504    parseTaskOutputComponentProperties(json, res);
32505    return res;
32506  }
32507
32508  protected void parseTaskOutputComponentProperties(JsonObject json, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
32509    parseBackboneElementProperties(json, res);
32510    if (json.has("type"))
32511      res.setType(parseCodeableConcept(getJObject(json, "type")));
32512    DataType value = parseType("value", json);
32513    if (value != null)
32514      res.setValue(value);
32515  }
32516
32517  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
32518    TerminologyCapabilities res = new TerminologyCapabilities();
32519    parseTerminologyCapabilitiesProperties(json, res);
32520    return res;
32521  }
32522
32523  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
32524    parseCanonicalResourceProperties(json, res);
32525    if (json.has("url"))
32526      res.setUrlElement(parseUri(json.get("url").getAsString()));
32527    if (json.has("_url"))
32528      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
32529    if (json.has("identifier")) {
32530      JsonArray array = getJArray(json, "identifier");
32531      for (int i = 0; i < array.size(); i++) {
32532        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
32533      }
32534    };
32535    if (json.has("version"))
32536      res.setVersionElement(parseString(json.get("version").getAsString()));
32537    if (json.has("_version"))
32538      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
32539    DataType versionAlgorithm = parseType("versionAlgorithm", json);
32540    if (versionAlgorithm != null)
32541      res.setVersionAlgorithm(versionAlgorithm);
32542    if (json.has("name"))
32543      res.setNameElement(parseString(json.get("name").getAsString()));
32544    if (json.has("_name"))
32545      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
32546    if (json.has("title"))
32547      res.setTitleElement(parseString(json.get("title").getAsString()));
32548    if (json.has("_title"))
32549      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
32550    if (json.has("status"))
32551      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
32552    if (json.has("_status"))
32553      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
32554    if (json.has("experimental"))
32555      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
32556    if (json.has("_experimental"))
32557      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
32558    if (json.has("date"))
32559      res.setDateElement(parseDateTime(json.get("date").getAsString()));
32560    if (json.has("_date"))
32561      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
32562    if (json.has("publisher"))
32563      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
32564    if (json.has("_publisher"))
32565      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
32566    if (json.has("contact")) {
32567      JsonArray array = getJArray(json, "contact");
32568      for (int i = 0; i < array.size(); i++) {
32569        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
32570      }
32571    };
32572    if (json.has("description"))
32573      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
32574    if (json.has("_description"))
32575      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
32576    if (json.has("useContext")) {
32577      JsonArray array = getJArray(json, "useContext");
32578      for (int i = 0; i < array.size(); i++) {
32579        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
32580      }
32581    };
32582    if (json.has("jurisdiction")) {
32583      JsonArray array = getJArray(json, "jurisdiction");
32584      for (int i = 0; i < array.size(); i++) {
32585        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
32586      }
32587    };
32588    if (json.has("purpose"))
32589      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
32590    if (json.has("_purpose"))
32591      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
32592    if (json.has("copyright"))
32593      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
32594    if (json.has("_copyright"))
32595      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
32596    if (json.has("copyrightLabel"))
32597      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
32598    if (json.has("_copyrightLabel"))
32599      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
32600    if (json.has("kind"))
32601      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
32602    if (json.has("_kind"))
32603      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
32604    if (json.has("software"))
32605      res.setSoftware(parseTerminologyCapabilitiesSoftwareComponent(getJObject(json, "software")));
32606    if (json.has("implementation"))
32607      res.setImplementation(parseTerminologyCapabilitiesImplementationComponent(getJObject(json, "implementation")));
32608    if (json.has("lockedDate"))
32609      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
32610    if (json.has("_lockedDate"))
32611      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
32612    if (json.has("codeSystem")) {
32613      JsonArray array = getJArray(json, "codeSystem");
32614      for (int i = 0; i < array.size(); i++) {
32615        res.getCodeSystem().add(parseTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject()));
32616      }
32617    };
32618    if (json.has("expansion"))
32619      res.setExpansion(parseTerminologyCapabilitiesExpansionComponent(getJObject(json, "expansion")));
32620    if (json.has("codeSearch"))
32621      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
32622    if (json.has("_codeSearch"))
32623      parseElementProperties(getJObject(json, "_codeSearch"), res.getCodeSearchElement());
32624    if (json.has("validateCode"))
32625      res.setValidateCode(parseTerminologyCapabilitiesValidateCodeComponent(getJObject(json, "validateCode")));
32626    if (json.has("translation"))
32627      res.setTranslation(parseTerminologyCapabilitiesTranslationComponent(getJObject(json, "translation")));
32628    if (json.has("closure"))
32629      res.setClosure(parseTerminologyCapabilitiesClosureComponent(getJObject(json, "closure")));
32630  }
32631
32632  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
32633    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
32634    parseTerminologyCapabilitiesSoftwareComponentProperties(json, res);
32635    return res;
32636  }
32637
32638  protected void parseTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
32639    parseBackboneElementProperties(json, res);
32640    if (json.has("name"))
32641      res.setNameElement(parseString(json.get("name").getAsString()));
32642    if (json.has("_name"))
32643      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
32644    if (json.has("version"))
32645      res.setVersionElement(parseString(json.get("version").getAsString()));
32646    if (json.has("_version"))
32647      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
32648  }
32649
32650  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
32651    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
32652    parseTerminologyCapabilitiesImplementationComponentProperties(json, res);
32653    return res;
32654  }
32655
32656  protected void parseTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
32657    parseBackboneElementProperties(json, res);
32658    if (json.has("description"))
32659      res.setDescriptionElement(parseString(json.get("description").getAsString()));
32660    if (json.has("_description"))
32661      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
32662    if (json.has("url"))
32663      res.setUrlElement(parseUrl(json.get("url").getAsString()));
32664    if (json.has("_url"))
32665      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
32666  }
32667
32668  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesCodeSystemComponent(JsonObject json) throws IOException, FHIRFormatError {
32669    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
32670    parseTerminologyCapabilitiesCodeSystemComponentProperties(json, res);
32671    return res;
32672  }
32673
32674  protected void parseTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
32675    parseBackboneElementProperties(json, res);
32676    if (json.has("uri"))
32677      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
32678    if (json.has("_uri"))
32679      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
32680    if (json.has("version")) {
32681      JsonArray array = getJArray(json, "version");
32682      for (int i = 0; i < array.size(); i++) {
32683        res.getVersion().add(parseTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject()));
32684      }
32685    };
32686    if (json.has("content"))
32687      res.setContentElement(parseEnumeration(json.get("content").getAsString(), Enumerations.CodeSystemContentMode.NULL, new Enumerations.CodeSystemContentModeEnumFactory()));
32688    if (json.has("_content"))
32689      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
32690    if (json.has("subsumption"))
32691      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
32692    if (json.has("_subsumption"))
32693      parseElementProperties(getJObject(json, "_subsumption"), res.getSubsumptionElement());
32694  }
32695
32696  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
32697    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
32698    parseTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, res);
32699    return res;
32700  }
32701
32702  protected void parseTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
32703    parseBackboneElementProperties(json, res);
32704    if (json.has("code"))
32705      res.setCodeElement(parseString(json.get("code").getAsString()));
32706    if (json.has("_code"))
32707      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
32708    if (json.has("isDefault"))
32709      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
32710    if (json.has("_isDefault"))
32711      parseElementProperties(getJObject(json, "_isDefault"), res.getIsDefaultElement());
32712    if (json.has("compositional"))
32713      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
32714    if (json.has("_compositional"))
32715      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
32716    if (json.has("language")) {
32717      JsonArray array = getJArray(json, "language");
32718      for (int i = 0; i < array.size(); i++) {
32719        if (array.get(i).isJsonNull()) {
32720          res.getLanguage().add(new Enumeration<Enumerations.CommonLanguages>(new Enumerations.CommonLanguagesEnumFactory(), Enumerations.CommonLanguages.NULL));
32721        } else {;
32722          res.getLanguage().add(parseEnumeration(array.get(i).getAsString(), Enumerations.CommonLanguages.NULL, new Enumerations.CommonLanguagesEnumFactory()));
32723        }
32724      }
32725    };
32726    if (json.has("_language")) {
32727      JsonArray array = getJArray(json, "_language");
32728      for (int i = 0; i < array.size(); i++) {
32729        if (i == res.getLanguage().size())
32730          res.getLanguage().add(parseEnumeration(null, Enumerations.CommonLanguages.NULL, new Enumerations.CommonLanguagesEnumFactory()));
32731        if (array.get(i) instanceof JsonObject) 
32732          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
32733      }
32734    };
32735    if (json.has("filter")) {
32736      JsonArray array = getJArray(json, "filter");
32737      for (int i = 0; i < array.size(); i++) {
32738        res.getFilter().add(parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject()));
32739      }
32740    };
32741    if (json.has("property")) {
32742      JsonArray array = getJArray(json, "property");
32743      for (int i = 0; i < array.size(); i++) {
32744        if (array.get(i).isJsonNull()) {
32745          res.getProperty().add(new CodeType());
32746        } else {;
32747          res.getProperty().add(parseCode(array.get(i).getAsString()));
32748        }
32749      }
32750    };
32751    if (json.has("_property")) {
32752      JsonArray array = getJArray(json, "_property");
32753      for (int i = 0; i < array.size(); i++) {
32754        if (i == res.getProperty().size())
32755          res.getProperty().add(parseCode(null));
32756        if (array.get(i) instanceof JsonObject) 
32757          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
32758      }
32759    };
32760  }
32761
32762  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
32763    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
32764    parseTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, res);
32765    return res;
32766  }
32767
32768  protected void parseTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
32769    parseBackboneElementProperties(json, res);
32770    if (json.has("code"))
32771      res.setCodeElement(parseCode(json.get("code").getAsString()));
32772    if (json.has("_code"))
32773      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
32774    if (json.has("op")) {
32775      JsonArray array = getJArray(json, "op");
32776      for (int i = 0; i < array.size(); i++) {
32777        if (array.get(i).isJsonNull()) {
32778          res.getOp().add(new CodeType());
32779        } else {;
32780          res.getOp().add(parseCode(array.get(i).getAsString()));
32781        }
32782      }
32783    };
32784    if (json.has("_op")) {
32785      JsonArray array = getJArray(json, "_op");
32786      for (int i = 0; i < array.size(); i++) {
32787        if (i == res.getOp().size())
32788          res.getOp().add(parseCode(null));
32789        if (array.get(i) instanceof JsonObject) 
32790          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
32791      }
32792    };
32793  }
32794
32795  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesExpansionComponent(JsonObject json) throws IOException, FHIRFormatError {
32796    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
32797    parseTerminologyCapabilitiesExpansionComponentProperties(json, res);
32798    return res;
32799  }
32800
32801  protected void parseTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
32802    parseBackboneElementProperties(json, res);
32803    if (json.has("hierarchical"))
32804      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
32805    if (json.has("_hierarchical"))
32806      parseElementProperties(getJObject(json, "_hierarchical"), res.getHierarchicalElement());
32807    if (json.has("paging"))
32808      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
32809    if (json.has("_paging"))
32810      parseElementProperties(getJObject(json, "_paging"), res.getPagingElement());
32811    if (json.has("incomplete"))
32812      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
32813    if (json.has("_incomplete"))
32814      parseElementProperties(getJObject(json, "_incomplete"), res.getIncompleteElement());
32815    if (json.has("parameter")) {
32816      JsonArray array = getJArray(json, "parameter");
32817      for (int i = 0; i < array.size(); i++) {
32818        res.getParameter().add(parseTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject()));
32819      }
32820    };
32821    if (json.has("textFilter"))
32822      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
32823    if (json.has("_textFilter"))
32824      parseElementProperties(getJObject(json, "_textFilter"), res.getTextFilterElement());
32825  }
32826
32827  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesExpansionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
32828    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
32829    parseTerminologyCapabilitiesExpansionParameterComponentProperties(json, res);
32830    return res;
32831  }
32832
32833  protected void parseTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
32834    parseBackboneElementProperties(json, res);
32835    if (json.has("name"))
32836      res.setNameElement(parseCode(json.get("name").getAsString()));
32837    if (json.has("_name"))
32838      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
32839    if (json.has("documentation"))
32840      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
32841    if (json.has("_documentation"))
32842      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
32843  }
32844
32845  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesValidateCodeComponent(JsonObject json) throws IOException, FHIRFormatError {
32846    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
32847    parseTerminologyCapabilitiesValidateCodeComponentProperties(json, res);
32848    return res;
32849  }
32850
32851  protected void parseTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
32852    parseBackboneElementProperties(json, res);
32853    if (json.has("translations"))
32854      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
32855    if (json.has("_translations"))
32856      parseElementProperties(getJObject(json, "_translations"), res.getTranslationsElement());
32857  }
32858
32859  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTranslationComponent(JsonObject json) throws IOException, FHIRFormatError {
32860    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
32861    parseTerminologyCapabilitiesTranslationComponentProperties(json, res);
32862    return res;
32863  }
32864
32865  protected void parseTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
32866    parseBackboneElementProperties(json, res);
32867    if (json.has("needsMap"))
32868      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
32869    if (json.has("_needsMap"))
32870      parseElementProperties(getJObject(json, "_needsMap"), res.getNeedsMapElement());
32871  }
32872
32873  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesClosureComponent(JsonObject json) throws IOException, FHIRFormatError {
32874    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
32875    parseTerminologyCapabilitiesClosureComponentProperties(json, res);
32876    return res;
32877  }
32878
32879  protected void parseTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
32880    parseBackboneElementProperties(json, res);
32881    if (json.has("translation"))
32882      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
32883    if (json.has("_translation"))
32884      parseElementProperties(getJObject(json, "_translation"), res.getTranslationElement());
32885  }
32886
32887  protected TestPlan parseTestPlan(JsonObject json) throws IOException, FHIRFormatError {
32888    TestPlan res = new TestPlan();
32889    parseTestPlanProperties(json, res);
32890    return res;
32891  }
32892
32893  protected void parseTestPlanProperties(JsonObject json, TestPlan res) throws IOException, FHIRFormatError {
32894    parseCanonicalResourceProperties(json, res);
32895    if (json.has("url"))
32896      res.setUrlElement(parseUri(json.get("url").getAsString()));
32897    if (json.has("_url"))
32898      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
32899    if (json.has("identifier")) {
32900      JsonArray array = getJArray(json, "identifier");
32901      for (int i = 0; i < array.size(); i++) {
32902        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
32903      }
32904    };
32905    if (json.has("version"))
32906      res.setVersionElement(parseString(json.get("version").getAsString()));
32907    if (json.has("_version"))
32908      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
32909    DataType versionAlgorithm = parseType("versionAlgorithm", json);
32910    if (versionAlgorithm != null)
32911      res.setVersionAlgorithm(versionAlgorithm);
32912    if (json.has("name"))
32913      res.setNameElement(parseString(json.get("name").getAsString()));
32914    if (json.has("_name"))
32915      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
32916    if (json.has("title"))
32917      res.setTitleElement(parseString(json.get("title").getAsString()));
32918    if (json.has("_title"))
32919      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
32920    if (json.has("status"))
32921      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
32922    if (json.has("_status"))
32923      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
32924    if (json.has("experimental"))
32925      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
32926    if (json.has("_experimental"))
32927      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
32928    if (json.has("date"))
32929      res.setDateElement(parseDateTime(json.get("date").getAsString()));
32930    if (json.has("_date"))
32931      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
32932    if (json.has("publisher"))
32933      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
32934    if (json.has("_publisher"))
32935      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
32936    if (json.has("contact")) {
32937      JsonArray array = getJArray(json, "contact");
32938      for (int i = 0; i < array.size(); i++) {
32939        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
32940      }
32941    };
32942    if (json.has("description"))
32943      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
32944    if (json.has("_description"))
32945      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
32946    if (json.has("useContext")) {
32947      JsonArray array = getJArray(json, "useContext");
32948      for (int i = 0; i < array.size(); i++) {
32949        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
32950      }
32951    };
32952    if (json.has("jurisdiction")) {
32953      JsonArray array = getJArray(json, "jurisdiction");
32954      for (int i = 0; i < array.size(); i++) {
32955        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
32956      }
32957    };
32958    if (json.has("purpose"))
32959      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
32960    if (json.has("_purpose"))
32961      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
32962    if (json.has("copyright"))
32963      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
32964    if (json.has("_copyright"))
32965      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
32966    if (json.has("copyrightLabel"))
32967      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
32968    if (json.has("_copyrightLabel"))
32969      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
32970    if (json.has("category")) {
32971      JsonArray array = getJArray(json, "category");
32972      for (int i = 0; i < array.size(); i++) {
32973        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
32974      }
32975    };
32976    if (json.has("scope")) {
32977      JsonArray array = getJArray(json, "scope");
32978      for (int i = 0; i < array.size(); i++) {
32979        res.getScope().add(parseReference(array.get(i).getAsJsonObject()));
32980      }
32981    };
32982    if (json.has("testTools"))
32983      res.setTestToolsElement(parseMarkdown(json.get("testTools").getAsString()));
32984    if (json.has("_testTools"))
32985      parseElementProperties(getJObject(json, "_testTools"), res.getTestToolsElement());
32986    if (json.has("dependency")) {
32987      JsonArray array = getJArray(json, "dependency");
32988      for (int i = 0; i < array.size(); i++) {
32989        res.getDependency().add(parseTestPlanDependencyComponent(array.get(i).getAsJsonObject()));
32990      }
32991    };
32992    if (json.has("exitCriteria"))
32993      res.setExitCriteriaElement(parseMarkdown(json.get("exitCriteria").getAsString()));
32994    if (json.has("_exitCriteria"))
32995      parseElementProperties(getJObject(json, "_exitCriteria"), res.getExitCriteriaElement());
32996    if (json.has("testCase")) {
32997      JsonArray array = getJArray(json, "testCase");
32998      for (int i = 0; i < array.size(); i++) {
32999        res.getTestCase().add(parseTestPlanTestCaseComponent(array.get(i).getAsJsonObject()));
33000      }
33001    };
33002  }
33003
33004  protected TestPlan.TestPlanDependencyComponent parseTestPlanDependencyComponent(JsonObject json) throws IOException, FHIRFormatError {
33005    TestPlan.TestPlanDependencyComponent res = new TestPlan.TestPlanDependencyComponent();
33006    parseTestPlanDependencyComponentProperties(json, res);
33007    return res;
33008  }
33009
33010  protected void parseTestPlanDependencyComponentProperties(JsonObject json, TestPlan.TestPlanDependencyComponent res) throws IOException, FHIRFormatError {
33011    parseBackboneElementProperties(json, res);
33012    if (json.has("description"))
33013      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
33014    if (json.has("_description"))
33015      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33016    if (json.has("predecessor"))
33017      res.setPredecessor(parseReference(getJObject(json, "predecessor")));
33018  }
33019
33020  protected TestPlan.TestPlanTestCaseComponent parseTestPlanTestCaseComponent(JsonObject json) throws IOException, FHIRFormatError {
33021    TestPlan.TestPlanTestCaseComponent res = new TestPlan.TestPlanTestCaseComponent();
33022    parseTestPlanTestCaseComponentProperties(json, res);
33023    return res;
33024  }
33025
33026  protected void parseTestPlanTestCaseComponentProperties(JsonObject json, TestPlan.TestPlanTestCaseComponent res) throws IOException, FHIRFormatError {
33027    parseBackboneElementProperties(json, res);
33028    if (json.has("sequence"))
33029      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
33030    if (json.has("_sequence"))
33031      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
33032    if (json.has("scope")) {
33033      JsonArray array = getJArray(json, "scope");
33034      for (int i = 0; i < array.size(); i++) {
33035        res.getScope().add(parseReference(array.get(i).getAsJsonObject()));
33036      }
33037    };
33038    if (json.has("dependency")) {
33039      JsonArray array = getJArray(json, "dependency");
33040      for (int i = 0; i < array.size(); i++) {
33041        res.getDependency().add(parseTestPlanTestCaseDependencyComponent(array.get(i).getAsJsonObject()));
33042      }
33043    };
33044    if (json.has("testRun")) {
33045      JsonArray array = getJArray(json, "testRun");
33046      for (int i = 0; i < array.size(); i++) {
33047        res.getTestRun().add(parseTestPlanTestCaseTestRunComponent(array.get(i).getAsJsonObject()));
33048      }
33049    };
33050    if (json.has("testData")) {
33051      JsonArray array = getJArray(json, "testData");
33052      for (int i = 0; i < array.size(); i++) {
33053        res.getTestData().add(parseTestPlanTestCaseTestDataComponent(array.get(i).getAsJsonObject()));
33054      }
33055    };
33056    if (json.has("assertion")) {
33057      JsonArray array = getJArray(json, "assertion");
33058      for (int i = 0; i < array.size(); i++) {
33059        res.getAssertion().add(parseTestPlanTestCaseAssertionComponent(array.get(i).getAsJsonObject()));
33060      }
33061    };
33062  }
33063
33064  protected TestPlan.TestCaseDependencyComponent parseTestPlanTestCaseDependencyComponent(JsonObject json) throws IOException, FHIRFormatError {
33065    TestPlan.TestCaseDependencyComponent res = new TestPlan.TestCaseDependencyComponent();
33066    parseTestPlanTestCaseDependencyComponentProperties(json, res);
33067    return res;
33068  }
33069
33070  protected void parseTestPlanTestCaseDependencyComponentProperties(JsonObject json, TestPlan.TestCaseDependencyComponent res) throws IOException, FHIRFormatError {
33071    parseBackboneElementProperties(json, res);
33072    if (json.has("description"))
33073      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
33074    if (json.has("_description"))
33075      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33076    if (json.has("predecessor"))
33077      res.setPredecessor(parseReference(getJObject(json, "predecessor")));
33078  }
33079
33080  protected TestPlan.TestPlanTestCaseTestRunComponent parseTestPlanTestCaseTestRunComponent(JsonObject json) throws IOException, FHIRFormatError {
33081    TestPlan.TestPlanTestCaseTestRunComponent res = new TestPlan.TestPlanTestCaseTestRunComponent();
33082    parseTestPlanTestCaseTestRunComponentProperties(json, res);
33083    return res;
33084  }
33085
33086  protected void parseTestPlanTestCaseTestRunComponentProperties(JsonObject json, TestPlan.TestPlanTestCaseTestRunComponent res) throws IOException, FHIRFormatError {
33087    parseBackboneElementProperties(json, res);
33088    if (json.has("narrative"))
33089      res.setNarrativeElement(parseMarkdown(json.get("narrative").getAsString()));
33090    if (json.has("_narrative"))
33091      parseElementProperties(getJObject(json, "_narrative"), res.getNarrativeElement());
33092    if (json.has("script"))
33093      res.setScript(parseTestPlanTestCaseTestRunScriptComponent(getJObject(json, "script")));
33094  }
33095
33096  protected TestPlan.TestPlanTestCaseTestRunScriptComponent parseTestPlanTestCaseTestRunScriptComponent(JsonObject json) throws IOException, FHIRFormatError {
33097    TestPlan.TestPlanTestCaseTestRunScriptComponent res = new TestPlan.TestPlanTestCaseTestRunScriptComponent();
33098    parseTestPlanTestCaseTestRunScriptComponentProperties(json, res);
33099    return res;
33100  }
33101
33102  protected void parseTestPlanTestCaseTestRunScriptComponentProperties(JsonObject json, TestPlan.TestPlanTestCaseTestRunScriptComponent res) throws IOException, FHIRFormatError {
33103    parseBackboneElementProperties(json, res);
33104    if (json.has("language"))
33105      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
33106    DataType source = parseType("source", json);
33107    if (source != null)
33108      res.setSource(source);
33109  }
33110
33111  protected TestPlan.TestPlanTestCaseTestDataComponent parseTestPlanTestCaseTestDataComponent(JsonObject json) throws IOException, FHIRFormatError {
33112    TestPlan.TestPlanTestCaseTestDataComponent res = new TestPlan.TestPlanTestCaseTestDataComponent();
33113    parseTestPlanTestCaseTestDataComponentProperties(json, res);
33114    return res;
33115  }
33116
33117  protected void parseTestPlanTestCaseTestDataComponentProperties(JsonObject json, TestPlan.TestPlanTestCaseTestDataComponent res) throws IOException, FHIRFormatError {
33118    parseBackboneElementProperties(json, res);
33119    if (json.has("type"))
33120      res.setType(parseCoding(getJObject(json, "type")));
33121    if (json.has("content"))
33122      res.setContent(parseReference(getJObject(json, "content")));
33123    DataType source = parseType("source", json);
33124    if (source != null)
33125      res.setSource(source);
33126  }
33127
33128  protected TestPlan.TestPlanTestCaseAssertionComponent parseTestPlanTestCaseAssertionComponent(JsonObject json) throws IOException, FHIRFormatError {
33129    TestPlan.TestPlanTestCaseAssertionComponent res = new TestPlan.TestPlanTestCaseAssertionComponent();
33130    parseTestPlanTestCaseAssertionComponentProperties(json, res);
33131    return res;
33132  }
33133
33134  protected void parseTestPlanTestCaseAssertionComponentProperties(JsonObject json, TestPlan.TestPlanTestCaseAssertionComponent res) throws IOException, FHIRFormatError {
33135    parseBackboneElementProperties(json, res);
33136    if (json.has("type")) {
33137      JsonArray array = getJArray(json, "type");
33138      for (int i = 0; i < array.size(); i++) {
33139        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
33140      }
33141    };
33142    if (json.has("object")) {
33143      JsonArray array = getJArray(json, "object");
33144      for (int i = 0; i < array.size(); i++) {
33145        res.getObject().add(parseCodeableReference(array.get(i).getAsJsonObject()));
33146      }
33147    };
33148    if (json.has("result")) {
33149      JsonArray array = getJArray(json, "result");
33150      for (int i = 0; i < array.size(); i++) {
33151        res.getResult().add(parseCodeableReference(array.get(i).getAsJsonObject()));
33152      }
33153    };
33154  }
33155
33156  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
33157    TestReport res = new TestReport();
33158    parseTestReportProperties(json, res);
33159    return res;
33160  }
33161
33162  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
33163    parseDomainResourceProperties(json, res);
33164    if (json.has("identifier"))
33165      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
33166    if (json.has("name"))
33167      res.setNameElement(parseString(json.get("name").getAsString()));
33168    if (json.has("_name"))
33169      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
33170    if (json.has("status"))
33171      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
33172    if (json.has("_status"))
33173      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
33174    if (json.has("testScript"))
33175      res.setTestScriptElement(parseCanonical(json.get("testScript").getAsString()));
33176    if (json.has("_testScript"))
33177      parseElementProperties(getJObject(json, "_testScript"), res.getTestScriptElement());
33178    if (json.has("result"))
33179      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
33180    if (json.has("_result"))
33181      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
33182    if (json.has("score"))
33183      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
33184    if (json.has("_score"))
33185      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
33186    if (json.has("tester"))
33187      res.setTesterElement(parseString(json.get("tester").getAsString()));
33188    if (json.has("_tester"))
33189      parseElementProperties(getJObject(json, "_tester"), res.getTesterElement());
33190    if (json.has("issued"))
33191      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
33192    if (json.has("_issued"))
33193      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
33194    if (json.has("participant")) {
33195      JsonArray array = getJArray(json, "participant");
33196      for (int i = 0; i < array.size(); i++) {
33197        res.getParticipant().add(parseTestReportParticipantComponent(array.get(i).getAsJsonObject()));
33198      }
33199    };
33200    if (json.has("setup"))
33201      res.setSetup(parseTestReportSetupComponent(getJObject(json, "setup")));
33202    if (json.has("test")) {
33203      JsonArray array = getJArray(json, "test");
33204      for (int i = 0; i < array.size(); i++) {
33205        res.getTest().add(parseTestReportTestComponent(array.get(i).getAsJsonObject()));
33206      }
33207    };
33208    if (json.has("teardown"))
33209      res.setTeardown(parseTestReportTeardownComponent(getJObject(json, "teardown")));
33210  }
33211
33212  protected TestReport.TestReportParticipantComponent parseTestReportParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
33213    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
33214    parseTestReportParticipantComponentProperties(json, res);
33215    return res;
33216  }
33217
33218  protected void parseTestReportParticipantComponentProperties(JsonObject json, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
33219    parseBackboneElementProperties(json, res);
33220    if (json.has("type"))
33221      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
33222    if (json.has("_type"))
33223      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
33224    if (json.has("uri"))
33225      res.setUriElement(parseUri(json.get("uri").getAsString()));
33226    if (json.has("_uri"))
33227      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
33228    if (json.has("display"))
33229      res.setDisplayElement(parseString(json.get("display").getAsString()));
33230    if (json.has("_display"))
33231      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
33232  }
33233
33234  protected TestReport.TestReportSetupComponent parseTestReportSetupComponent(JsonObject json) throws IOException, FHIRFormatError {
33235    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
33236    parseTestReportSetupComponentProperties(json, res);
33237    return res;
33238  }
33239
33240  protected void parseTestReportSetupComponentProperties(JsonObject json, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
33241    parseBackboneElementProperties(json, res);
33242    if (json.has("action")) {
33243      JsonArray array = getJArray(json, "action");
33244      for (int i = 0; i < array.size(); i++) {
33245        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject()));
33246      }
33247    };
33248  }
33249
33250  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
33251    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
33252    parseTestReportSetupActionComponentProperties(json, res);
33253    return res;
33254  }
33255
33256  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
33257    parseBackboneElementProperties(json, res);
33258    if (json.has("operation"))
33259      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation")));
33260    if (json.has("assert"))
33261      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert")));
33262  }
33263
33264  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
33265    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
33266    parseTestReportSetupActionOperationComponentProperties(json, res);
33267    return res;
33268  }
33269
33270  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
33271    parseBackboneElementProperties(json, res);
33272    if (json.has("result"))
33273      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
33274    if (json.has("_result"))
33275      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
33276    if (json.has("message"))
33277      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
33278    if (json.has("_message"))
33279      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
33280    if (json.has("detail"))
33281      res.setDetailElement(parseUri(json.get("detail").getAsString()));
33282    if (json.has("_detail"))
33283      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
33284  }
33285
33286  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json) throws IOException, FHIRFormatError {
33287    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
33288    parseTestReportSetupActionAssertComponentProperties(json, res);
33289    return res;
33290  }
33291
33292  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
33293    parseBackboneElementProperties(json, res);
33294    if (json.has("result"))
33295      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
33296    if (json.has("_result"))
33297      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
33298    if (json.has("message"))
33299      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
33300    if (json.has("_message"))
33301      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
33302    if (json.has("detail"))
33303      res.setDetailElement(parseString(json.get("detail").getAsString()));
33304    if (json.has("_detail"))
33305      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
33306    if (json.has("requirement")) {
33307      JsonArray array = getJArray(json, "requirement");
33308      for (int i = 0; i < array.size(); i++) {
33309        res.getRequirement().add(parseTestReportSetupActionAssertRequirementComponent(array.get(i).getAsJsonObject()));
33310      }
33311    };
33312  }
33313
33314  protected TestReport.SetupActionAssertRequirementComponent parseTestReportSetupActionAssertRequirementComponent(JsonObject json) throws IOException, FHIRFormatError {
33315    TestReport.SetupActionAssertRequirementComponent res = new TestReport.SetupActionAssertRequirementComponent();
33316    parseTestReportSetupActionAssertRequirementComponentProperties(json, res);
33317    return res;
33318  }
33319
33320  protected void parseTestReportSetupActionAssertRequirementComponentProperties(JsonObject json, TestReport.SetupActionAssertRequirementComponent res) throws IOException, FHIRFormatError {
33321    parseBackboneElementProperties(json, res);
33322    DataType link = parseType("link", json);
33323    if (link != null)
33324      res.setLink(link);
33325  }
33326
33327  protected TestReport.TestReportTestComponent parseTestReportTestComponent(JsonObject json) throws IOException, FHIRFormatError {
33328    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
33329    parseTestReportTestComponentProperties(json, res);
33330    return res;
33331  }
33332
33333  protected void parseTestReportTestComponentProperties(JsonObject json, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
33334    parseBackboneElementProperties(json, res);
33335    if (json.has("name"))
33336      res.setNameElement(parseString(json.get("name").getAsString()));
33337    if (json.has("_name"))
33338      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
33339    if (json.has("description"))
33340      res.setDescriptionElement(parseString(json.get("description").getAsString()));
33341    if (json.has("_description"))
33342      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33343    if (json.has("action")) {
33344      JsonArray array = getJArray(json, "action");
33345      for (int i = 0; i < array.size(); i++) {
33346        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject()));
33347      }
33348    };
33349  }
33350
33351  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json) throws IOException, FHIRFormatError {
33352    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
33353    parseTestReportTestActionComponentProperties(json, res);
33354    return res;
33355  }
33356
33357  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
33358    parseBackboneElementProperties(json, res);
33359    if (json.has("operation"))
33360      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation")));
33361    if (json.has("assert"))
33362      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert")));
33363  }
33364
33365  protected TestReport.TestReportTeardownComponent parseTestReportTeardownComponent(JsonObject json) throws IOException, FHIRFormatError {
33366    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
33367    parseTestReportTeardownComponentProperties(json, res);
33368    return res;
33369  }
33370
33371  protected void parseTestReportTeardownComponentProperties(JsonObject json, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
33372    parseBackboneElementProperties(json, res);
33373    if (json.has("action")) {
33374      JsonArray array = getJArray(json, "action");
33375      for (int i = 0; i < array.size(); i++) {
33376        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject()));
33377      }
33378    };
33379  }
33380
33381  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json) throws IOException, FHIRFormatError {
33382    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
33383    parseTestReportTeardownActionComponentProperties(json, res);
33384    return res;
33385  }
33386
33387  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
33388    parseBackboneElementProperties(json, res);
33389    if (json.has("operation"))
33390      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation")));
33391  }
33392
33393  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
33394    TestScript res = new TestScript();
33395    parseTestScriptProperties(json, res);
33396    return res;
33397  }
33398
33399  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
33400    parseCanonicalResourceProperties(json, res);
33401    if (json.has("url"))
33402      res.setUrlElement(parseUri(json.get("url").getAsString()));
33403    if (json.has("_url"))
33404      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
33405    if (json.has("identifier")) {
33406      JsonArray array = getJArray(json, "identifier");
33407      for (int i = 0; i < array.size(); i++) {
33408        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
33409      }
33410    };
33411    if (json.has("version"))
33412      res.setVersionElement(parseString(json.get("version").getAsString()));
33413    if (json.has("_version"))
33414      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
33415    DataType versionAlgorithm = parseType("versionAlgorithm", json);
33416    if (versionAlgorithm != null)
33417      res.setVersionAlgorithm(versionAlgorithm);
33418    if (json.has("name"))
33419      res.setNameElement(parseString(json.get("name").getAsString()));
33420    if (json.has("_name"))
33421      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
33422    if (json.has("title"))
33423      res.setTitleElement(parseString(json.get("title").getAsString()));
33424    if (json.has("_title"))
33425      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
33426    if (json.has("status"))
33427      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
33428    if (json.has("_status"))
33429      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
33430    if (json.has("experimental"))
33431      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
33432    if (json.has("_experimental"))
33433      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
33434    if (json.has("date"))
33435      res.setDateElement(parseDateTime(json.get("date").getAsString()));
33436    if (json.has("_date"))
33437      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
33438    if (json.has("publisher"))
33439      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
33440    if (json.has("_publisher"))
33441      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
33442    if (json.has("contact")) {
33443      JsonArray array = getJArray(json, "contact");
33444      for (int i = 0; i < array.size(); i++) {
33445        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
33446      }
33447    };
33448    if (json.has("description"))
33449      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
33450    if (json.has("_description"))
33451      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33452    if (json.has("useContext")) {
33453      JsonArray array = getJArray(json, "useContext");
33454      for (int i = 0; i < array.size(); i++) {
33455        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
33456      }
33457    };
33458    if (json.has("jurisdiction")) {
33459      JsonArray array = getJArray(json, "jurisdiction");
33460      for (int i = 0; i < array.size(); i++) {
33461        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
33462      }
33463    };
33464    if (json.has("purpose"))
33465      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
33466    if (json.has("_purpose"))
33467      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
33468    if (json.has("copyright"))
33469      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
33470    if (json.has("_copyright"))
33471      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
33472    if (json.has("copyrightLabel"))
33473      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
33474    if (json.has("_copyrightLabel"))
33475      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
33476    if (json.has("origin")) {
33477      JsonArray array = getJArray(json, "origin");
33478      for (int i = 0; i < array.size(); i++) {
33479        res.getOrigin().add(parseTestScriptOriginComponent(array.get(i).getAsJsonObject()));
33480      }
33481    };
33482    if (json.has("destination")) {
33483      JsonArray array = getJArray(json, "destination");
33484      for (int i = 0; i < array.size(); i++) {
33485        res.getDestination().add(parseTestScriptDestinationComponent(array.get(i).getAsJsonObject()));
33486      }
33487    };
33488    if (json.has("metadata"))
33489      res.setMetadata(parseTestScriptMetadataComponent(getJObject(json, "metadata")));
33490    if (json.has("scope")) {
33491      JsonArray array = getJArray(json, "scope");
33492      for (int i = 0; i < array.size(); i++) {
33493        res.getScope().add(parseTestScriptScopeComponent(array.get(i).getAsJsonObject()));
33494      }
33495    };
33496    if (json.has("fixture")) {
33497      JsonArray array = getJArray(json, "fixture");
33498      for (int i = 0; i < array.size(); i++) {
33499        res.getFixture().add(parseTestScriptFixtureComponent(array.get(i).getAsJsonObject()));
33500      }
33501    };
33502    if (json.has("profile")) {
33503      JsonArray array = getJArray(json, "profile");
33504      for (int i = 0; i < array.size(); i++) {
33505        if (array.get(i).isJsonNull()) {
33506          res.getProfile().add(new CanonicalType());
33507        } else {;
33508          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
33509        }
33510      }
33511    };
33512    if (json.has("_profile")) {
33513      JsonArray array = getJArray(json, "_profile");
33514      for (int i = 0; i < array.size(); i++) {
33515        if (i == res.getProfile().size())
33516          res.getProfile().add(parseCanonical(null));
33517        if (array.get(i) instanceof JsonObject) 
33518          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
33519      }
33520    };
33521    if (json.has("variable")) {
33522      JsonArray array = getJArray(json, "variable");
33523      for (int i = 0; i < array.size(); i++) {
33524        res.getVariable().add(parseTestScriptVariableComponent(array.get(i).getAsJsonObject()));
33525      }
33526    };
33527    if (json.has("setup"))
33528      res.setSetup(parseTestScriptSetupComponent(getJObject(json, "setup")));
33529    if (json.has("test")) {
33530      JsonArray array = getJArray(json, "test");
33531      for (int i = 0; i < array.size(); i++) {
33532        res.getTest().add(parseTestScriptTestComponent(array.get(i).getAsJsonObject()));
33533      }
33534    };
33535    if (json.has("teardown"))
33536      res.setTeardown(parseTestScriptTeardownComponent(getJObject(json, "teardown")));
33537  }
33538
33539  protected TestScript.TestScriptOriginComponent parseTestScriptOriginComponent(JsonObject json) throws IOException, FHIRFormatError {
33540    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
33541    parseTestScriptOriginComponentProperties(json, res);
33542    return res;
33543  }
33544
33545  protected void parseTestScriptOriginComponentProperties(JsonObject json, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
33546    parseBackboneElementProperties(json, res);
33547    if (json.has("index"))
33548      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
33549    if (json.has("_index"))
33550      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
33551    if (json.has("profile"))
33552      res.setProfile(parseCoding(getJObject(json, "profile")));
33553    if (json.has("url"))
33554      res.setUrlElement(parseUrl(json.get("url").getAsString()));
33555    if (json.has("_url"))
33556      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
33557  }
33558
33559  protected TestScript.TestScriptDestinationComponent parseTestScriptDestinationComponent(JsonObject json) throws IOException, FHIRFormatError {
33560    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
33561    parseTestScriptDestinationComponentProperties(json, res);
33562    return res;
33563  }
33564
33565  protected void parseTestScriptDestinationComponentProperties(JsonObject json, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
33566    parseBackboneElementProperties(json, res);
33567    if (json.has("index"))
33568      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
33569    if (json.has("_index"))
33570      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
33571    if (json.has("profile"))
33572      res.setProfile(parseCoding(getJObject(json, "profile")));
33573    if (json.has("url"))
33574      res.setUrlElement(parseUrl(json.get("url").getAsString()));
33575    if (json.has("_url"))
33576      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
33577  }
33578
33579  protected TestScript.TestScriptMetadataComponent parseTestScriptMetadataComponent(JsonObject json) throws IOException, FHIRFormatError {
33580    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
33581    parseTestScriptMetadataComponentProperties(json, res);
33582    return res;
33583  }
33584
33585  protected void parseTestScriptMetadataComponentProperties(JsonObject json, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
33586    parseBackboneElementProperties(json, res);
33587    if (json.has("link")) {
33588      JsonArray array = getJArray(json, "link");
33589      for (int i = 0; i < array.size(); i++) {
33590        res.getLink().add(parseTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject()));
33591      }
33592    };
33593    if (json.has("capability")) {
33594      JsonArray array = getJArray(json, "capability");
33595      for (int i = 0; i < array.size(); i++) {
33596        res.getCapability().add(parseTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject()));
33597      }
33598    };
33599  }
33600
33601  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptMetadataLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
33602    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
33603    parseTestScriptMetadataLinkComponentProperties(json, res);
33604    return res;
33605  }
33606
33607  protected void parseTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
33608    parseBackboneElementProperties(json, res);
33609    if (json.has("url"))
33610      res.setUrlElement(parseUri(json.get("url").getAsString()));
33611    if (json.has("_url"))
33612      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
33613    if (json.has("description"))
33614      res.setDescriptionElement(parseString(json.get("description").getAsString()));
33615    if (json.has("_description"))
33616      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33617  }
33618
33619  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptMetadataCapabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
33620    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
33621    parseTestScriptMetadataCapabilityComponentProperties(json, res);
33622    return res;
33623  }
33624
33625  protected void parseTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
33626    parseBackboneElementProperties(json, res);
33627    if (json.has("required"))
33628      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
33629    if (json.has("_required"))
33630      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
33631    if (json.has("validated"))
33632      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
33633    if (json.has("_validated"))
33634      parseElementProperties(getJObject(json, "_validated"), res.getValidatedElement());
33635    if (json.has("description"))
33636      res.setDescriptionElement(parseString(json.get("description").getAsString()));
33637    if (json.has("_description"))
33638      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33639    if (json.has("origin")) {
33640      JsonArray array = getJArray(json, "origin");
33641      for (int i = 0; i < array.size(); i++) {
33642        if (array.get(i).isJsonNull()) {
33643          res.getOrigin().add(new IntegerType());
33644        } else {;
33645          res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
33646        }
33647      }
33648    };
33649    if (json.has("_origin")) {
33650      JsonArray array = getJArray(json, "_origin");
33651      for (int i = 0; i < array.size(); i++) {
33652        if (i == res.getOrigin().size())
33653          res.getOrigin().add(parseInteger(null));
33654        if (array.get(i) instanceof JsonObject) 
33655          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
33656      }
33657    };
33658    if (json.has("destination"))
33659      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
33660    if (json.has("_destination"))
33661      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
33662    if (json.has("link")) {
33663      JsonArray array = getJArray(json, "link");
33664      for (int i = 0; i < array.size(); i++) {
33665        if (array.get(i).isJsonNull()) {
33666          res.getLink().add(new UriType());
33667        } else {;
33668          res.getLink().add(parseUri(array.get(i).getAsString()));
33669        }
33670      }
33671    };
33672    if (json.has("_link")) {
33673      JsonArray array = getJArray(json, "_link");
33674      for (int i = 0; i < array.size(); i++) {
33675        if (i == res.getLink().size())
33676          res.getLink().add(parseUri(null));
33677        if (array.get(i) instanceof JsonObject) 
33678          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
33679      }
33680    };
33681    if (json.has("capabilities"))
33682      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
33683    if (json.has("_capabilities"))
33684      parseElementProperties(getJObject(json, "_capabilities"), res.getCapabilitiesElement());
33685  }
33686
33687  protected TestScript.TestScriptScopeComponent parseTestScriptScopeComponent(JsonObject json) throws IOException, FHIRFormatError {
33688    TestScript.TestScriptScopeComponent res = new TestScript.TestScriptScopeComponent();
33689    parseTestScriptScopeComponentProperties(json, res);
33690    return res;
33691  }
33692
33693  protected void parseTestScriptScopeComponentProperties(JsonObject json, TestScript.TestScriptScopeComponent res) throws IOException, FHIRFormatError {
33694    parseBackboneElementProperties(json, res);
33695    if (json.has("artifact"))
33696      res.setArtifactElement(parseCanonical(json.get("artifact").getAsString()));
33697    if (json.has("_artifact"))
33698      parseElementProperties(getJObject(json, "_artifact"), res.getArtifactElement());
33699    if (json.has("conformance"))
33700      res.setConformance(parseCodeableConcept(getJObject(json, "conformance")));
33701    if (json.has("phase"))
33702      res.setPhase(parseCodeableConcept(getJObject(json, "phase")));
33703  }
33704
33705  protected TestScript.TestScriptFixtureComponent parseTestScriptFixtureComponent(JsonObject json) throws IOException, FHIRFormatError {
33706    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
33707    parseTestScriptFixtureComponentProperties(json, res);
33708    return res;
33709  }
33710
33711  protected void parseTestScriptFixtureComponentProperties(JsonObject json, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
33712    parseBackboneElementProperties(json, res);
33713    if (json.has("autocreate"))
33714      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
33715    if (json.has("_autocreate"))
33716      parseElementProperties(getJObject(json, "_autocreate"), res.getAutocreateElement());
33717    if (json.has("autodelete"))
33718      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
33719    if (json.has("_autodelete"))
33720      parseElementProperties(getJObject(json, "_autodelete"), res.getAutodeleteElement());
33721    if (json.has("resource"))
33722      res.setResource(parseReference(getJObject(json, "resource")));
33723  }
33724
33725  protected TestScript.TestScriptVariableComponent parseTestScriptVariableComponent(JsonObject json) throws IOException, FHIRFormatError {
33726    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
33727    parseTestScriptVariableComponentProperties(json, res);
33728    return res;
33729  }
33730
33731  protected void parseTestScriptVariableComponentProperties(JsonObject json, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
33732    parseBackboneElementProperties(json, res);
33733    if (json.has("name"))
33734      res.setNameElement(parseString(json.get("name").getAsString()));
33735    if (json.has("_name"))
33736      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
33737    if (json.has("defaultValue"))
33738      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
33739    if (json.has("_defaultValue"))
33740      parseElementProperties(getJObject(json, "_defaultValue"), res.getDefaultValueElement());
33741    if (json.has("description"))
33742      res.setDescriptionElement(parseString(json.get("description").getAsString()));
33743    if (json.has("_description"))
33744      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33745    if (json.has("expression"))
33746      res.setExpressionElement(parseString(json.get("expression").getAsString()));
33747    if (json.has("_expression"))
33748      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
33749    if (json.has("headerField"))
33750      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
33751    if (json.has("_headerField"))
33752      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
33753    if (json.has("hint"))
33754      res.setHintElement(parseString(json.get("hint").getAsString()));
33755    if (json.has("_hint"))
33756      parseElementProperties(getJObject(json, "_hint"), res.getHintElement());
33757    if (json.has("path"))
33758      res.setPathElement(parseString(json.get("path").getAsString()));
33759    if (json.has("_path"))
33760      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
33761    if (json.has("sourceId"))
33762      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
33763    if (json.has("_sourceId"))
33764      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
33765  }
33766
33767  protected TestScript.TestScriptSetupComponent parseTestScriptSetupComponent(JsonObject json) throws IOException, FHIRFormatError {
33768    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
33769    parseTestScriptSetupComponentProperties(json, res);
33770    return res;
33771  }
33772
33773  protected void parseTestScriptSetupComponentProperties(JsonObject json, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
33774    parseBackboneElementProperties(json, res);
33775    if (json.has("action")) {
33776      JsonArray array = getJArray(json, "action");
33777      for (int i = 0; i < array.size(); i++) {
33778        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject()));
33779      }
33780    };
33781  }
33782
33783  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
33784    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
33785    parseTestScriptSetupActionComponentProperties(json, res);
33786    return res;
33787  }
33788
33789  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
33790    parseBackboneElementProperties(json, res);
33791    if (json.has("operation"))
33792      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation")));
33793    if (json.has("assert"))
33794      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert")));
33795  }
33796
33797  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
33798    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
33799    parseTestScriptSetupActionOperationComponentProperties(json, res);
33800    return res;
33801  }
33802
33803  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
33804    parseBackboneElementProperties(json, res);
33805    if (json.has("type"))
33806      res.setType(parseCoding(getJObject(json, "type")));
33807    if (json.has("resource"))
33808      res.setResourceElement(parseUri(json.get("resource").getAsString()));
33809    if (json.has("_resource"))
33810      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
33811    if (json.has("label"))
33812      res.setLabelElement(parseString(json.get("label").getAsString()));
33813    if (json.has("_label"))
33814      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
33815    if (json.has("description"))
33816      res.setDescriptionElement(parseString(json.get("description").getAsString()));
33817    if (json.has("_description"))
33818      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33819    if (json.has("accept"))
33820      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
33821    if (json.has("_accept"))
33822      parseElementProperties(getJObject(json, "_accept"), res.getAcceptElement());
33823    if (json.has("contentType"))
33824      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
33825    if (json.has("_contentType"))
33826      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
33827    if (json.has("destination"))
33828      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
33829    if (json.has("_destination"))
33830      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
33831    if (json.has("encodeRequestUrl"))
33832      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
33833    if (json.has("_encodeRequestUrl"))
33834      parseElementProperties(getJObject(json, "_encodeRequestUrl"), res.getEncodeRequestUrlElement());
33835    if (json.has("method"))
33836      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
33837    if (json.has("_method"))
33838      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
33839    if (json.has("origin"))
33840      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
33841    if (json.has("_origin"))
33842      parseElementProperties(getJObject(json, "_origin"), res.getOriginElement());
33843    if (json.has("params"))
33844      res.setParamsElement(parseString(json.get("params").getAsString()));
33845    if (json.has("_params"))
33846      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
33847    if (json.has("requestHeader")) {
33848      JsonArray array = getJArray(json, "requestHeader");
33849      for (int i = 0; i < array.size(); i++) {
33850        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject()));
33851      }
33852    };
33853    if (json.has("requestId"))
33854      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
33855    if (json.has("_requestId"))
33856      parseElementProperties(getJObject(json, "_requestId"), res.getRequestIdElement());
33857    if (json.has("responseId"))
33858      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
33859    if (json.has("_responseId"))
33860      parseElementProperties(getJObject(json, "_responseId"), res.getResponseIdElement());
33861    if (json.has("sourceId"))
33862      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
33863    if (json.has("_sourceId"))
33864      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
33865    if (json.has("targetId"))
33866      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
33867    if (json.has("_targetId"))
33868      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
33869    if (json.has("url"))
33870      res.setUrlElement(parseString(json.get("url").getAsString()));
33871    if (json.has("_url"))
33872      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
33873  }
33874
33875  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json) throws IOException, FHIRFormatError {
33876    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
33877    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, res);
33878    return res;
33879  }
33880
33881  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
33882    parseBackboneElementProperties(json, res);
33883    if (json.has("field"))
33884      res.setFieldElement(parseString(json.get("field").getAsString()));
33885    if (json.has("_field"))
33886      parseElementProperties(getJObject(json, "_field"), res.getFieldElement());
33887    if (json.has("value"))
33888      res.setValueElement(parseString(json.get("value").getAsString()));
33889    if (json.has("_value"))
33890      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
33891  }
33892
33893  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json) throws IOException, FHIRFormatError {
33894    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
33895    parseTestScriptSetupActionAssertComponentProperties(json, res);
33896    return res;
33897  }
33898
33899  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
33900    parseBackboneElementProperties(json, res);
33901    if (json.has("label"))
33902      res.setLabelElement(parseString(json.get("label").getAsString()));
33903    if (json.has("_label"))
33904      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
33905    if (json.has("description"))
33906      res.setDescriptionElement(parseString(json.get("description").getAsString()));
33907    if (json.has("_description"))
33908      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
33909    if (json.has("direction"))
33910      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
33911    if (json.has("_direction"))
33912      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
33913    if (json.has("compareToSourceId"))
33914      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
33915    if (json.has("_compareToSourceId"))
33916      parseElementProperties(getJObject(json, "_compareToSourceId"), res.getCompareToSourceIdElement());
33917    if (json.has("compareToSourceExpression"))
33918      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
33919    if (json.has("_compareToSourceExpression"))
33920      parseElementProperties(getJObject(json, "_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
33921    if (json.has("compareToSourcePath"))
33922      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
33923    if (json.has("_compareToSourcePath"))
33924      parseElementProperties(getJObject(json, "_compareToSourcePath"), res.getCompareToSourcePathElement());
33925    if (json.has("contentType"))
33926      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
33927    if (json.has("_contentType"))
33928      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
33929    if (json.has("defaultManualCompletion"))
33930      res.setDefaultManualCompletionElement(parseEnumeration(json.get("defaultManualCompletion").getAsString(), TestScript.AssertionManualCompletionType.NULL, new TestScript.AssertionManualCompletionTypeEnumFactory()));
33931    if (json.has("_defaultManualCompletion"))
33932      parseElementProperties(getJObject(json, "_defaultManualCompletion"), res.getDefaultManualCompletionElement());
33933    if (json.has("expression"))
33934      res.setExpressionElement(parseString(json.get("expression").getAsString()));
33935    if (json.has("_expression"))
33936      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
33937    if (json.has("headerField"))
33938      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
33939    if (json.has("_headerField"))
33940      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
33941    if (json.has("minimumId"))
33942      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
33943    if (json.has("_minimumId"))
33944      parseElementProperties(getJObject(json, "_minimumId"), res.getMinimumIdElement());
33945    if (json.has("navigationLinks"))
33946      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
33947    if (json.has("_navigationLinks"))
33948      parseElementProperties(getJObject(json, "_navigationLinks"), res.getNavigationLinksElement());
33949    if (json.has("operator"))
33950      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
33951    if (json.has("_operator"))
33952      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
33953    if (json.has("path"))
33954      res.setPathElement(parseString(json.get("path").getAsString()));
33955    if (json.has("_path"))
33956      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
33957    if (json.has("requestMethod"))
33958      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
33959    if (json.has("_requestMethod"))
33960      parseElementProperties(getJObject(json, "_requestMethod"), res.getRequestMethodElement());
33961    if (json.has("requestURL"))
33962      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
33963    if (json.has("_requestURL"))
33964      parseElementProperties(getJObject(json, "_requestURL"), res.getRequestURLElement());
33965    if (json.has("resource"))
33966      res.setResourceElement(parseUri(json.get("resource").getAsString()));
33967    if (json.has("_resource"))
33968      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
33969    if (json.has("response"))
33970      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
33971    if (json.has("_response"))
33972      parseElementProperties(getJObject(json, "_response"), res.getResponseElement());
33973    if (json.has("responseCode"))
33974      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
33975    if (json.has("_responseCode"))
33976      parseElementProperties(getJObject(json, "_responseCode"), res.getResponseCodeElement());
33977    if (json.has("sourceId"))
33978      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
33979    if (json.has("_sourceId"))
33980      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
33981    if (json.has("stopTestOnFail"))
33982      res.setStopTestOnFailElement(parseBoolean(json.get("stopTestOnFail").getAsBoolean()));
33983    if (json.has("_stopTestOnFail"))
33984      parseElementProperties(getJObject(json, "_stopTestOnFail"), res.getStopTestOnFailElement());
33985    if (json.has("validateProfileId"))
33986      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
33987    if (json.has("_validateProfileId"))
33988      parseElementProperties(getJObject(json, "_validateProfileId"), res.getValidateProfileIdElement());
33989    if (json.has("value"))
33990      res.setValueElement(parseString(json.get("value").getAsString()));
33991    if (json.has("_value"))
33992      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
33993    if (json.has("warningOnly"))
33994      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
33995    if (json.has("_warningOnly"))
33996      parseElementProperties(getJObject(json, "_warningOnly"), res.getWarningOnlyElement());
33997    if (json.has("requirement")) {
33998      JsonArray array = getJArray(json, "requirement");
33999      for (int i = 0; i < array.size(); i++) {
34000        res.getRequirement().add(parseTestScriptSetupActionAssertRequirementComponent(array.get(i).getAsJsonObject()));
34001      }
34002    };
34003  }
34004
34005  protected TestScript.SetupActionAssertRequirementComponent parseTestScriptSetupActionAssertRequirementComponent(JsonObject json) throws IOException, FHIRFormatError {
34006    TestScript.SetupActionAssertRequirementComponent res = new TestScript.SetupActionAssertRequirementComponent();
34007    parseTestScriptSetupActionAssertRequirementComponentProperties(json, res);
34008    return res;
34009  }
34010
34011  protected void parseTestScriptSetupActionAssertRequirementComponentProperties(JsonObject json, TestScript.SetupActionAssertRequirementComponent res) throws IOException, FHIRFormatError {
34012    parseBackboneElementProperties(json, res);
34013    DataType link = parseType("link", json);
34014    if (link != null)
34015      res.setLink(link);
34016  }
34017
34018  protected TestScript.TestScriptTestComponent parseTestScriptTestComponent(JsonObject json) throws IOException, FHIRFormatError {
34019    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
34020    parseTestScriptTestComponentProperties(json, res);
34021    return res;
34022  }
34023
34024  protected void parseTestScriptTestComponentProperties(JsonObject json, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
34025    parseBackboneElementProperties(json, res);
34026    if (json.has("name"))
34027      res.setNameElement(parseString(json.get("name").getAsString()));
34028    if (json.has("_name"))
34029      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
34030    if (json.has("description"))
34031      res.setDescriptionElement(parseString(json.get("description").getAsString()));
34032    if (json.has("_description"))
34033      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
34034    if (json.has("action")) {
34035      JsonArray array = getJArray(json, "action");
34036      for (int i = 0; i < array.size(); i++) {
34037        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject()));
34038      }
34039    };
34040  }
34041
34042  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json) throws IOException, FHIRFormatError {
34043    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
34044    parseTestScriptTestActionComponentProperties(json, res);
34045    return res;
34046  }
34047
34048  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
34049    parseBackboneElementProperties(json, res);
34050    if (json.has("operation"))
34051      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation")));
34052    if (json.has("assert"))
34053      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert")));
34054  }
34055
34056  protected TestScript.TestScriptTeardownComponent parseTestScriptTeardownComponent(JsonObject json) throws IOException, FHIRFormatError {
34057    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
34058    parseTestScriptTeardownComponentProperties(json, res);
34059    return res;
34060  }
34061
34062  protected void parseTestScriptTeardownComponentProperties(JsonObject json, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
34063    parseBackboneElementProperties(json, res);
34064    if (json.has("action")) {
34065      JsonArray array = getJArray(json, "action");
34066      for (int i = 0; i < array.size(); i++) {
34067        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject()));
34068      }
34069    };
34070  }
34071
34072  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json) throws IOException, FHIRFormatError {
34073    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
34074    parseTestScriptTeardownActionComponentProperties(json, res);
34075    return res;
34076  }
34077
34078  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
34079    parseBackboneElementProperties(json, res);
34080    if (json.has("operation"))
34081      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation")));
34082  }
34083
34084  protected Transport parseTransport(JsonObject json) throws IOException, FHIRFormatError {
34085    Transport res = new Transport();
34086    parseTransportProperties(json, res);
34087    return res;
34088  }
34089
34090  protected void parseTransportProperties(JsonObject json, Transport res) throws IOException, FHIRFormatError {
34091    parseDomainResourceProperties(json, res);
34092    if (json.has("identifier")) {
34093      JsonArray array = getJArray(json, "identifier");
34094      for (int i = 0; i < array.size(); i++) {
34095        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
34096      }
34097    };
34098    if (json.has("instantiatesCanonical"))
34099      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
34100    if (json.has("_instantiatesCanonical"))
34101      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
34102    if (json.has("instantiatesUri"))
34103      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
34104    if (json.has("_instantiatesUri"))
34105      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
34106    if (json.has("basedOn")) {
34107      JsonArray array = getJArray(json, "basedOn");
34108      for (int i = 0; i < array.size(); i++) {
34109        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
34110      }
34111    };
34112    if (json.has("groupIdentifier"))
34113      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
34114    if (json.has("partOf")) {
34115      JsonArray array = getJArray(json, "partOf");
34116      for (int i = 0; i < array.size(); i++) {
34117        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
34118      }
34119    };
34120    if (json.has("status"))
34121      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Transport.TransportStatus.NULL, new Transport.TransportStatusEnumFactory()));
34122    if (json.has("_status"))
34123      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
34124    if (json.has("statusReason"))
34125      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
34126    if (json.has("intent"))
34127      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Transport.TransportIntent.NULL, new Transport.TransportIntentEnumFactory()));
34128    if (json.has("_intent"))
34129      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
34130    if (json.has("priority"))
34131      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
34132    if (json.has("_priority"))
34133      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
34134    if (json.has("code"))
34135      res.setCode(parseCodeableConcept(getJObject(json, "code")));
34136    if (json.has("description"))
34137      res.setDescriptionElement(parseString(json.get("description").getAsString()));
34138    if (json.has("_description"))
34139      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
34140    if (json.has("focus"))
34141      res.setFocus(parseReference(getJObject(json, "focus")));
34142    if (json.has("for"))
34143      res.setFor(parseReference(getJObject(json, "for")));
34144    if (json.has("encounter"))
34145      res.setEncounter(parseReference(getJObject(json, "encounter")));
34146    if (json.has("completionTime"))
34147      res.setCompletionTimeElement(parseDateTime(json.get("completionTime").getAsString()));
34148    if (json.has("_completionTime"))
34149      parseElementProperties(getJObject(json, "_completionTime"), res.getCompletionTimeElement());
34150    if (json.has("authoredOn"))
34151      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
34152    if (json.has("_authoredOn"))
34153      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
34154    if (json.has("lastModified"))
34155      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
34156    if (json.has("_lastModified"))
34157      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
34158    if (json.has("requester"))
34159      res.setRequester(parseReference(getJObject(json, "requester")));
34160    if (json.has("performerType")) {
34161      JsonArray array = getJArray(json, "performerType");
34162      for (int i = 0; i < array.size(); i++) {
34163        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
34164      }
34165    };
34166    if (json.has("owner"))
34167      res.setOwner(parseReference(getJObject(json, "owner")));
34168    if (json.has("location"))
34169      res.setLocation(parseReference(getJObject(json, "location")));
34170    if (json.has("insurance")) {
34171      JsonArray array = getJArray(json, "insurance");
34172      for (int i = 0; i < array.size(); i++) {
34173        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
34174      }
34175    };
34176    if (json.has("note")) {
34177      JsonArray array = getJArray(json, "note");
34178      for (int i = 0; i < array.size(); i++) {
34179        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
34180      }
34181    };
34182    if (json.has("relevantHistory")) {
34183      JsonArray array = getJArray(json, "relevantHistory");
34184      for (int i = 0; i < array.size(); i++) {
34185        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
34186      }
34187    };
34188    if (json.has("restriction"))
34189      res.setRestriction(parseTransportRestrictionComponent(getJObject(json, "restriction")));
34190    if (json.has("input")) {
34191      JsonArray array = getJArray(json, "input");
34192      for (int i = 0; i < array.size(); i++) {
34193        res.getInput().add(parseTransportParameterComponent(array.get(i).getAsJsonObject()));
34194      }
34195    };
34196    if (json.has("output")) {
34197      JsonArray array = getJArray(json, "output");
34198      for (int i = 0; i < array.size(); i++) {
34199        res.getOutput().add(parseTransportOutputComponent(array.get(i).getAsJsonObject()));
34200      }
34201    };
34202    if (json.has("requestedLocation"))
34203      res.setRequestedLocation(parseReference(getJObject(json, "requestedLocation")));
34204    if (json.has("currentLocation"))
34205      res.setCurrentLocation(parseReference(getJObject(json, "currentLocation")));
34206    if (json.has("reason"))
34207      res.setReason(parseCodeableReference(getJObject(json, "reason")));
34208    if (json.has("history"))
34209      res.setHistory(parseReference(getJObject(json, "history")));
34210  }
34211
34212  protected Transport.TransportRestrictionComponent parseTransportRestrictionComponent(JsonObject json) throws IOException, FHIRFormatError {
34213    Transport.TransportRestrictionComponent res = new Transport.TransportRestrictionComponent();
34214    parseTransportRestrictionComponentProperties(json, res);
34215    return res;
34216  }
34217
34218  protected void parseTransportRestrictionComponentProperties(JsonObject json, Transport.TransportRestrictionComponent res) throws IOException, FHIRFormatError {
34219    parseBackboneElementProperties(json, res);
34220    if (json.has("repetitions"))
34221      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
34222    if (json.has("_repetitions"))
34223      parseElementProperties(getJObject(json, "_repetitions"), res.getRepetitionsElement());
34224    if (json.has("period"))
34225      res.setPeriod(parsePeriod(getJObject(json, "period")));
34226    if (json.has("recipient")) {
34227      JsonArray array = getJArray(json, "recipient");
34228      for (int i = 0; i < array.size(); i++) {
34229        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
34230      }
34231    };
34232  }
34233
34234  protected Transport.ParameterComponent parseTransportParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
34235    Transport.ParameterComponent res = new Transport.ParameterComponent();
34236    parseTransportParameterComponentProperties(json, res);
34237    return res;
34238  }
34239
34240  protected void parseTransportParameterComponentProperties(JsonObject json, Transport.ParameterComponent res) throws IOException, FHIRFormatError {
34241    parseBackboneElementProperties(json, res);
34242    if (json.has("type"))
34243      res.setType(parseCodeableConcept(getJObject(json, "type")));
34244    DataType value = parseType("value", json);
34245    if (value != null)
34246      res.setValue(value);
34247  }
34248
34249  protected Transport.TransportOutputComponent parseTransportOutputComponent(JsonObject json) throws IOException, FHIRFormatError {
34250    Transport.TransportOutputComponent res = new Transport.TransportOutputComponent();
34251    parseTransportOutputComponentProperties(json, res);
34252    return res;
34253  }
34254
34255  protected void parseTransportOutputComponentProperties(JsonObject json, Transport.TransportOutputComponent res) throws IOException, FHIRFormatError {
34256    parseBackboneElementProperties(json, res);
34257    if (json.has("type"))
34258      res.setType(parseCodeableConcept(getJObject(json, "type")));
34259    DataType value = parseType("value", json);
34260    if (value != null)
34261      res.setValue(value);
34262  }
34263
34264  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
34265    ValueSet res = new ValueSet();
34266    parseValueSetProperties(json, res);
34267    return res;
34268  }
34269
34270  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
34271    parseMetadataResourceProperties(json, res);
34272    if (json.has("url"))
34273      res.setUrlElement(parseUri(json.get("url").getAsString()));
34274    if (json.has("_url"))
34275      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
34276    if (json.has("identifier")) {
34277      JsonArray array = getJArray(json, "identifier");
34278      for (int i = 0; i < array.size(); i++) {
34279        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
34280      }
34281    };
34282    if (json.has("version"))
34283      res.setVersionElement(parseString(json.get("version").getAsString()));
34284    if (json.has("_version"))
34285      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
34286    DataType versionAlgorithm = parseType("versionAlgorithm", json);
34287    if (versionAlgorithm != null)
34288      res.setVersionAlgorithm(versionAlgorithm);
34289    if (json.has("name"))
34290      res.setNameElement(parseString(json.get("name").getAsString()));
34291    if (json.has("_name"))
34292      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
34293    if (json.has("title"))
34294      res.setTitleElement(parseString(json.get("title").getAsString()));
34295    if (json.has("_title"))
34296      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
34297    if (json.has("status"))
34298      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
34299    if (json.has("_status"))
34300      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
34301    if (json.has("experimental"))
34302      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
34303    if (json.has("_experimental"))
34304      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
34305    if (json.has("date"))
34306      res.setDateElement(parseDateTime(json.get("date").getAsString()));
34307    if (json.has("_date"))
34308      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
34309    if (json.has("publisher"))
34310      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
34311    if (json.has("_publisher"))
34312      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
34313    if (json.has("contact")) {
34314      JsonArray array = getJArray(json, "contact");
34315      for (int i = 0; i < array.size(); i++) {
34316        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
34317      }
34318    };
34319    if (json.has("description"))
34320      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
34321    if (json.has("_description"))
34322      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
34323    if (json.has("useContext")) {
34324      JsonArray array = getJArray(json, "useContext");
34325      for (int i = 0; i < array.size(); i++) {
34326        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
34327      }
34328    };
34329    if (json.has("jurisdiction")) {
34330      JsonArray array = getJArray(json, "jurisdiction");
34331      for (int i = 0; i < array.size(); i++) {
34332        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
34333      }
34334    };
34335    if (json.has("immutable"))
34336      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
34337    if (json.has("_immutable"))
34338      parseElementProperties(getJObject(json, "_immutable"), res.getImmutableElement());
34339    if (json.has("purpose"))
34340      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
34341    if (json.has("_purpose"))
34342      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
34343    if (json.has("copyright"))
34344      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
34345    if (json.has("_copyright"))
34346      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
34347    if (json.has("copyrightLabel"))
34348      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
34349    if (json.has("_copyrightLabel"))
34350      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
34351    if (json.has("approvalDate"))
34352      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
34353    if (json.has("_approvalDate"))
34354      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
34355    if (json.has("lastReviewDate"))
34356      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
34357    if (json.has("_lastReviewDate"))
34358      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
34359    if (json.has("effectivePeriod"))
34360      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
34361    if (json.has("topic")) {
34362      JsonArray array = getJArray(json, "topic");
34363      for (int i = 0; i < array.size(); i++) {
34364        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
34365      }
34366    };
34367    if (json.has("author")) {
34368      JsonArray array = getJArray(json, "author");
34369      for (int i = 0; i < array.size(); i++) {
34370        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
34371      }
34372    };
34373    if (json.has("editor")) {
34374      JsonArray array = getJArray(json, "editor");
34375      for (int i = 0; i < array.size(); i++) {
34376        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
34377      }
34378    };
34379    if (json.has("reviewer")) {
34380      JsonArray array = getJArray(json, "reviewer");
34381      for (int i = 0; i < array.size(); i++) {
34382        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
34383      }
34384    };
34385    if (json.has("endorser")) {
34386      JsonArray array = getJArray(json, "endorser");
34387      for (int i = 0; i < array.size(); i++) {
34388        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
34389      }
34390    };
34391    if (json.has("relatedArtifact")) {
34392      JsonArray array = getJArray(json, "relatedArtifact");
34393      for (int i = 0; i < array.size(); i++) {
34394        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
34395      }
34396    };
34397    if (json.has("compose"))
34398      res.setCompose(parseValueSetComposeComponent(getJObject(json, "compose")));
34399    if (json.has("expansion"))
34400      res.setExpansion(parseValueSetExpansionComponent(getJObject(json, "expansion")));
34401    if (json.has("scope"))
34402      res.setScope(parseValueSetScopeComponent(getJObject(json, "scope")));
34403  }
34404
34405  protected ValueSet.ValueSetComposeComponent parseValueSetComposeComponent(JsonObject json) throws IOException, FHIRFormatError {
34406    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
34407    parseValueSetComposeComponentProperties(json, res);
34408    return res;
34409  }
34410
34411  protected void parseValueSetComposeComponentProperties(JsonObject json, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
34412    parseBackboneElementProperties(json, res);
34413    if (json.has("lockedDate"))
34414      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
34415    if (json.has("_lockedDate"))
34416      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
34417    if (json.has("inactive"))
34418      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
34419    if (json.has("_inactive"))
34420      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
34421    if (json.has("include")) {
34422      JsonArray array = getJArray(json, "include");
34423      for (int i = 0; i < array.size(); i++) {
34424        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject()));
34425      }
34426    };
34427    if (json.has("exclude")) {
34428      JsonArray array = getJArray(json, "exclude");
34429      for (int i = 0; i < array.size(); i++) {
34430        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject()));
34431      }
34432    };
34433    if (json.has("property")) {
34434      JsonArray array = getJArray(json, "property");
34435      for (int i = 0; i < array.size(); i++) {
34436        if (array.get(i).isJsonNull()) {
34437          res.getProperty().add(new StringType());
34438        } else {;
34439          res.getProperty().add(parseString(array.get(i).getAsString()));
34440        }
34441      }
34442    };
34443    if (json.has("_property")) {
34444      JsonArray array = getJArray(json, "_property");
34445      for (int i = 0; i < array.size(); i++) {
34446        if (i == res.getProperty().size())
34447          res.getProperty().add(parseString(null));
34448        if (array.get(i) instanceof JsonObject) 
34449          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
34450      }
34451    };
34452  }
34453
34454  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json) throws IOException, FHIRFormatError {
34455    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
34456    parseValueSetConceptSetComponentProperties(json, res);
34457    return res;
34458  }
34459
34460  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
34461    parseBackboneElementProperties(json, res);
34462    if (json.has("system"))
34463      res.setSystemElement(parseUri(json.get("system").getAsString()));
34464    if (json.has("_system"))
34465      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
34466    if (json.has("version"))
34467      res.setVersionElement(parseString(json.get("version").getAsString()));
34468    if (json.has("_version"))
34469      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
34470    if (json.has("concept")) {
34471      JsonArray array = getJArray(json, "concept");
34472      for (int i = 0; i < array.size(); i++) {
34473        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject()));
34474      }
34475    };
34476    if (json.has("filter")) {
34477      JsonArray array = getJArray(json, "filter");
34478      for (int i = 0; i < array.size(); i++) {
34479        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject()));
34480      }
34481    };
34482    if (json.has("valueSet")) {
34483      JsonArray array = getJArray(json, "valueSet");
34484      for (int i = 0; i < array.size(); i++) {
34485        if (array.get(i).isJsonNull()) {
34486          res.getValueSet().add(new CanonicalType());
34487        } else {;
34488          res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
34489        }
34490      }
34491    };
34492    if (json.has("_valueSet")) {
34493      JsonArray array = getJArray(json, "_valueSet");
34494      for (int i = 0; i < array.size(); i++) {
34495        if (i == res.getValueSet().size())
34496          res.getValueSet().add(parseCanonical(null));
34497        if (array.get(i) instanceof JsonObject) 
34498          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
34499      }
34500    };
34501    if (json.has("copyright"))
34502      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
34503    if (json.has("_copyright"))
34504      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
34505  }
34506
34507  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json) throws IOException, FHIRFormatError {
34508    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
34509    parseValueSetConceptReferenceComponentProperties(json, res);
34510    return res;
34511  }
34512
34513  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
34514    parseBackboneElementProperties(json, res);
34515    if (json.has("code"))
34516      res.setCodeElement(parseCode(json.get("code").getAsString()));
34517    if (json.has("_code"))
34518      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
34519    if (json.has("display"))
34520      res.setDisplayElement(parseString(json.get("display").getAsString()));
34521    if (json.has("_display"))
34522      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
34523    if (json.has("designation")) {
34524      JsonArray array = getJArray(json, "designation");
34525      for (int i = 0; i < array.size(); i++) {
34526        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject()));
34527      }
34528    };
34529  }
34530
34531  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
34532    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
34533    parseValueSetConceptReferenceDesignationComponentProperties(json, res);
34534    return res;
34535  }
34536
34537  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
34538    parseBackboneElementProperties(json, res);
34539    if (json.has("language"))
34540      res.setLanguageElement(parseCode(json.get("language").getAsString()));
34541    if (json.has("_language"))
34542      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
34543    if (json.has("use"))
34544      res.setUse(parseCoding(getJObject(json, "use")));
34545    if (json.has("additionalUse")) {
34546      JsonArray array = getJArray(json, "additionalUse");
34547      for (int i = 0; i < array.size(); i++) {
34548        res.getAdditionalUse().add(parseCoding(array.get(i).getAsJsonObject()));
34549      }
34550    };
34551    if (json.has("value"))
34552      res.setValueElement(parseString(json.get("value").getAsString()));
34553    if (json.has("_value"))
34554      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
34555  }
34556
34557  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
34558    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
34559    parseValueSetConceptSetFilterComponentProperties(json, res);
34560    return res;
34561  }
34562
34563  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
34564    parseBackboneElementProperties(json, res);
34565    if (json.has("property"))
34566      res.setPropertyElement(parseCode(json.get("property").getAsString()));
34567    if (json.has("_property"))
34568      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
34569    if (json.has("op"))
34570      res.setOpElement(parseEnumeration(json.get("op").getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
34571    if (json.has("_op"))
34572      parseElementProperties(getJObject(json, "_op"), res.getOpElement());
34573    if (json.has("value"))
34574      res.setValueElement(parseString(json.get("value").getAsString()));
34575    if (json.has("_value"))
34576      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
34577  }
34578
34579  protected ValueSet.ValueSetExpansionComponent parseValueSetExpansionComponent(JsonObject json) throws IOException, FHIRFormatError {
34580    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
34581    parseValueSetExpansionComponentProperties(json, res);
34582    return res;
34583  }
34584
34585  protected void parseValueSetExpansionComponentProperties(JsonObject json, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
34586    parseBackboneElementProperties(json, res);
34587    if (json.has("identifier"))
34588      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
34589    if (json.has("_identifier"))
34590      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
34591    if (json.has("next"))
34592      res.setNextElement(parseUri(json.get("next").getAsString()));
34593    if (json.has("_next"))
34594      parseElementProperties(getJObject(json, "_next"), res.getNextElement());
34595    if (json.has("timestamp"))
34596      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
34597    if (json.has("_timestamp"))
34598      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
34599    if (json.has("total"))
34600      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
34601    if (json.has("_total"))
34602      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
34603    if (json.has("offset"))
34604      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
34605    if (json.has("_offset"))
34606      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
34607    if (json.has("parameter")) {
34608      JsonArray array = getJArray(json, "parameter");
34609      for (int i = 0; i < array.size(); i++) {
34610        res.getParameter().add(parseValueSetExpansionParameterComponent(array.get(i).getAsJsonObject()));
34611      }
34612    };
34613    if (json.has("property")) {
34614      JsonArray array = getJArray(json, "property");
34615      for (int i = 0; i < array.size(); i++) {
34616        res.getProperty().add(parseValueSetExpansionPropertyComponent(array.get(i).getAsJsonObject()));
34617      }
34618    };
34619    if (json.has("contains")) {
34620      JsonArray array = getJArray(json, "contains");
34621      for (int i = 0; i < array.size(); i++) {
34622        res.getContains().add(parseValueSetExpansionContainsComponent(array.get(i).getAsJsonObject()));
34623      }
34624    };
34625  }
34626
34627  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetExpansionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
34628    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
34629    parseValueSetExpansionParameterComponentProperties(json, res);
34630    return res;
34631  }
34632
34633  protected void parseValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
34634    parseBackboneElementProperties(json, res);
34635    if (json.has("name"))
34636      res.setNameElement(parseString(json.get("name").getAsString()));
34637    if (json.has("_name"))
34638      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
34639    DataType value = parseType("value", json);
34640    if (value != null)
34641      res.setValue(value);
34642  }
34643
34644  protected ValueSet.ValueSetExpansionPropertyComponent parseValueSetExpansionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
34645    ValueSet.ValueSetExpansionPropertyComponent res = new ValueSet.ValueSetExpansionPropertyComponent();
34646    parseValueSetExpansionPropertyComponentProperties(json, res);
34647    return res;
34648  }
34649
34650  protected void parseValueSetExpansionPropertyComponentProperties(JsonObject json, ValueSet.ValueSetExpansionPropertyComponent res) throws IOException, FHIRFormatError {
34651    parseBackboneElementProperties(json, res);
34652    if (json.has("code"))
34653      res.setCodeElement(parseCode(json.get("code").getAsString()));
34654    if (json.has("_code"))
34655      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
34656    if (json.has("uri"))
34657      res.setUriElement(parseUri(json.get("uri").getAsString()));
34658    if (json.has("_uri"))
34659      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
34660  }
34661
34662  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetExpansionContainsComponent(JsonObject json) throws IOException, FHIRFormatError {
34663    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
34664    parseValueSetExpansionContainsComponentProperties(json, res);
34665    return res;
34666  }
34667
34668  protected void parseValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
34669    parseBackboneElementProperties(json, res);
34670    if (json.has("system"))
34671      res.setSystemElement(parseUri(json.get("system").getAsString()));
34672    if (json.has("_system"))
34673      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
34674    if (json.has("abstract"))
34675      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
34676    if (json.has("_abstract"))
34677      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
34678    if (json.has("inactive"))
34679      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
34680    if (json.has("_inactive"))
34681      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
34682    if (json.has("version"))
34683      res.setVersionElement(parseString(json.get("version").getAsString()));
34684    if (json.has("_version"))
34685      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
34686    if (json.has("code"))
34687      res.setCodeElement(parseCode(json.get("code").getAsString()));
34688    if (json.has("_code"))
34689      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
34690    if (json.has("display"))
34691      res.setDisplayElement(parseString(json.get("display").getAsString()));
34692    if (json.has("_display"))
34693      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
34694    if (json.has("designation")) {
34695      JsonArray array = getJArray(json, "designation");
34696      for (int i = 0; i < array.size(); i++) {
34697        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject()));
34698      }
34699    };
34700    if (json.has("property")) {
34701      JsonArray array = getJArray(json, "property");
34702      for (int i = 0; i < array.size(); i++) {
34703        res.getProperty().add(parseValueSetConceptPropertyComponent(array.get(i).getAsJsonObject()));
34704      }
34705    };
34706    if (json.has("contains")) {
34707      JsonArray array = getJArray(json, "contains");
34708      for (int i = 0; i < array.size(); i++) {
34709        res.getContains().add(parseValueSetExpansionContainsComponent(array.get(i).getAsJsonObject()));
34710      }
34711    };
34712  }
34713
34714  protected ValueSet.ConceptPropertyComponent parseValueSetConceptPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
34715    ValueSet.ConceptPropertyComponent res = new ValueSet.ConceptPropertyComponent();
34716    parseValueSetConceptPropertyComponentProperties(json, res);
34717    return res;
34718  }
34719
34720  protected void parseValueSetConceptPropertyComponentProperties(JsonObject json, ValueSet.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
34721    parseBackboneElementProperties(json, res);
34722    if (json.has("code"))
34723      res.setCodeElement(parseCode(json.get("code").getAsString()));
34724    if (json.has("_code"))
34725      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
34726    DataType value = parseType("value", json);
34727    if (value != null)
34728      res.setValue(value);
34729    if (json.has("subProperty")) {
34730      JsonArray array = getJArray(json, "subProperty");
34731      for (int i = 0; i < array.size(); i++) {
34732        res.getSubProperty().add(parseValueSetConceptSubPropertyComponent(array.get(i).getAsJsonObject()));
34733      }
34734    };
34735  }
34736
34737  protected ValueSet.ConceptSubPropertyComponent parseValueSetConceptSubPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
34738    ValueSet.ConceptSubPropertyComponent res = new ValueSet.ConceptSubPropertyComponent();
34739    parseValueSetConceptSubPropertyComponentProperties(json, res);
34740    return res;
34741  }
34742
34743  protected void parseValueSetConceptSubPropertyComponentProperties(JsonObject json, ValueSet.ConceptSubPropertyComponent res) throws IOException, FHIRFormatError {
34744    parseBackboneElementProperties(json, res);
34745    if (json.has("code"))
34746      res.setCodeElement(parseCode(json.get("code").getAsString()));
34747    if (json.has("_code"))
34748      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
34749    DataType value = parseType("value", json);
34750    if (value != null)
34751      res.setValue(value);
34752  }
34753
34754  protected ValueSet.ValueSetScopeComponent parseValueSetScopeComponent(JsonObject json) throws IOException, FHIRFormatError {
34755    ValueSet.ValueSetScopeComponent res = new ValueSet.ValueSetScopeComponent();
34756    parseValueSetScopeComponentProperties(json, res);
34757    return res;
34758  }
34759
34760  protected void parseValueSetScopeComponentProperties(JsonObject json, ValueSet.ValueSetScopeComponent res) throws IOException, FHIRFormatError {
34761    parseBackboneElementProperties(json, res);
34762    if (json.has("inclusionCriteria"))
34763      res.setInclusionCriteriaElement(parseString(json.get("inclusionCriteria").getAsString()));
34764    if (json.has("_inclusionCriteria"))
34765      parseElementProperties(getJObject(json, "_inclusionCriteria"), res.getInclusionCriteriaElement());
34766    if (json.has("exclusionCriteria"))
34767      res.setExclusionCriteriaElement(parseString(json.get("exclusionCriteria").getAsString()));
34768    if (json.has("_exclusionCriteria"))
34769      parseElementProperties(getJObject(json, "_exclusionCriteria"), res.getExclusionCriteriaElement());
34770  }
34771
34772  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
34773    VerificationResult res = new VerificationResult();
34774    parseVerificationResultProperties(json, res);
34775    return res;
34776  }
34777
34778  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
34779    parseDomainResourceProperties(json, res);
34780    if (json.has("target")) {
34781      JsonArray array = getJArray(json, "target");
34782      for (int i = 0; i < array.size(); i++) {
34783        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
34784      }
34785    };
34786    if (json.has("targetLocation")) {
34787      JsonArray array = getJArray(json, "targetLocation");
34788      for (int i = 0; i < array.size(); i++) {
34789        if (array.get(i).isJsonNull()) {
34790          res.getTargetLocation().add(new StringType());
34791        } else {;
34792          res.getTargetLocation().add(parseString(array.get(i).getAsString()));
34793        }
34794      }
34795    };
34796    if (json.has("_targetLocation")) {
34797      JsonArray array = getJArray(json, "_targetLocation");
34798      for (int i = 0; i < array.size(); i++) {
34799        if (i == res.getTargetLocation().size())
34800          res.getTargetLocation().add(parseString(null));
34801        if (array.get(i) instanceof JsonObject) 
34802          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
34803      }
34804    };
34805    if (json.has("need"))
34806      res.setNeed(parseCodeableConcept(getJObject(json, "need")));
34807    if (json.has("status"))
34808      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.VerificationResultStatus.NULL, new VerificationResult.VerificationResultStatusEnumFactory()));
34809    if (json.has("_status"))
34810      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
34811    if (json.has("statusDate"))
34812      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
34813    if (json.has("_statusDate"))
34814      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
34815    if (json.has("validationType"))
34816      res.setValidationType(parseCodeableConcept(getJObject(json, "validationType")));
34817    if (json.has("validationProcess")) {
34818      JsonArray array = getJArray(json, "validationProcess");
34819      for (int i = 0; i < array.size(); i++) {
34820        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
34821      }
34822    };
34823    if (json.has("frequency"))
34824      res.setFrequency(parseTiming(getJObject(json, "frequency")));
34825    if (json.has("lastPerformed"))
34826      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
34827    if (json.has("_lastPerformed"))
34828      parseElementProperties(getJObject(json, "_lastPerformed"), res.getLastPerformedElement());
34829    if (json.has("nextScheduled"))
34830      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
34831    if (json.has("_nextScheduled"))
34832      parseElementProperties(getJObject(json, "_nextScheduled"), res.getNextScheduledElement());
34833    if (json.has("failureAction"))
34834      res.setFailureAction(parseCodeableConcept(getJObject(json, "failureAction")));
34835    if (json.has("primarySource")) {
34836      JsonArray array = getJArray(json, "primarySource");
34837      for (int i = 0; i < array.size(); i++) {
34838        res.getPrimarySource().add(parseVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject()));
34839      }
34840    };
34841    if (json.has("attestation"))
34842      res.setAttestation(parseVerificationResultAttestationComponent(getJObject(json, "attestation")));
34843    if (json.has("validator")) {
34844      JsonArray array = getJArray(json, "validator");
34845      for (int i = 0; i < array.size(); i++) {
34846        res.getValidator().add(parseVerificationResultValidatorComponent(array.get(i).getAsJsonObject()));
34847      }
34848    };
34849  }
34850
34851  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultPrimarySourceComponent(JsonObject json) throws IOException, FHIRFormatError {
34852    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
34853    parseVerificationResultPrimarySourceComponentProperties(json, res);
34854    return res;
34855  }
34856
34857  protected void parseVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
34858    parseBackboneElementProperties(json, res);
34859    if (json.has("who"))
34860      res.setWho(parseReference(getJObject(json, "who")));
34861    if (json.has("type")) {
34862      JsonArray array = getJArray(json, "type");
34863      for (int i = 0; i < array.size(); i++) {
34864        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
34865      }
34866    };
34867    if (json.has("communicationMethod")) {
34868      JsonArray array = getJArray(json, "communicationMethod");
34869      for (int i = 0; i < array.size(); i++) {
34870        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
34871      }
34872    };
34873    if (json.has("validationStatus"))
34874      res.setValidationStatus(parseCodeableConcept(getJObject(json, "validationStatus")));
34875    if (json.has("validationDate"))
34876      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
34877    if (json.has("_validationDate"))
34878      parseElementProperties(getJObject(json, "_validationDate"), res.getValidationDateElement());
34879    if (json.has("canPushUpdates"))
34880      res.setCanPushUpdates(parseCodeableConcept(getJObject(json, "canPushUpdates")));
34881    if (json.has("pushTypeAvailable")) {
34882      JsonArray array = getJArray(json, "pushTypeAvailable");
34883      for (int i = 0; i < array.size(); i++) {
34884        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
34885      }
34886    };
34887  }
34888
34889  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultAttestationComponent(JsonObject json) throws IOException, FHIRFormatError {
34890    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
34891    parseVerificationResultAttestationComponentProperties(json, res);
34892    return res;
34893  }
34894
34895  protected void parseVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
34896    parseBackboneElementProperties(json, res);
34897    if (json.has("who"))
34898      res.setWho(parseReference(getJObject(json, "who")));
34899    if (json.has("onBehalfOf"))
34900      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
34901    if (json.has("communicationMethod"))
34902      res.setCommunicationMethod(parseCodeableConcept(getJObject(json, "communicationMethod")));
34903    if (json.has("date"))
34904      res.setDateElement(parseDate(json.get("date").getAsString()));
34905    if (json.has("_date"))
34906      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
34907    if (json.has("sourceIdentityCertificate"))
34908      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
34909    if (json.has("_sourceIdentityCertificate"))
34910      parseElementProperties(getJObject(json, "_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
34911    if (json.has("proxyIdentityCertificate"))
34912      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
34913    if (json.has("_proxyIdentityCertificate"))
34914      parseElementProperties(getJObject(json, "_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
34915    if (json.has("proxySignature"))
34916      res.setProxySignature(parseSignature(getJObject(json, "proxySignature")));
34917    if (json.has("sourceSignature"))
34918      res.setSourceSignature(parseSignature(getJObject(json, "sourceSignature")));
34919  }
34920
34921  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultValidatorComponent(JsonObject json) throws IOException, FHIRFormatError {
34922    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
34923    parseVerificationResultValidatorComponentProperties(json, res);
34924    return res;
34925  }
34926
34927  protected void parseVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
34928    parseBackboneElementProperties(json, res);
34929    if (json.has("organization"))
34930      res.setOrganization(parseReference(getJObject(json, "organization")));
34931    if (json.has("identityCertificate"))
34932      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
34933    if (json.has("_identityCertificate"))
34934      parseElementProperties(getJObject(json, "_identityCertificate"), res.getIdentityCertificateElement());
34935    if (json.has("attestationSignature"))
34936      res.setAttestationSignature(parseSignature(getJObject(json, "attestationSignature")));
34937  }
34938
34939  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
34940    VisionPrescription res = new VisionPrescription();
34941    parseVisionPrescriptionProperties(json, res);
34942    return res;
34943  }
34944
34945  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
34946    parseDomainResourceProperties(json, res);
34947    if (json.has("identifier")) {
34948      JsonArray array = getJArray(json, "identifier");
34949      for (int i = 0; i < array.size(); i++) {
34950        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
34951      }
34952    };
34953    if (json.has("status"))
34954      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
34955    if (json.has("_status"))
34956      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
34957    if (json.has("created"))
34958      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
34959    if (json.has("_created"))
34960      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
34961    if (json.has("patient"))
34962      res.setPatient(parseReference(getJObject(json, "patient")));
34963    if (json.has("encounter"))
34964      res.setEncounter(parseReference(getJObject(json, "encounter")));
34965    if (json.has("dateWritten"))
34966      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
34967    if (json.has("_dateWritten"))
34968      parseElementProperties(getJObject(json, "_dateWritten"), res.getDateWrittenElement());
34969    if (json.has("prescriber"))
34970      res.setPrescriber(parseReference(getJObject(json, "prescriber")));
34971    if (json.has("lensSpecification")) {
34972      JsonArray array = getJArray(json, "lensSpecification");
34973      for (int i = 0; i < array.size(); i++) {
34974        res.getLensSpecification().add(parseVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject()));
34975      }
34976    };
34977  }
34978
34979  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionLensSpecificationComponent(JsonObject json) throws IOException, FHIRFormatError {
34980    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
34981    parseVisionPrescriptionLensSpecificationComponentProperties(json, res);
34982    return res;
34983  }
34984
34985  protected void parseVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
34986    parseBackboneElementProperties(json, res);
34987    if (json.has("product"))
34988      res.setProduct(parseCodeableConcept(getJObject(json, "product")));
34989    if (json.has("eye"))
34990      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
34991    if (json.has("_eye"))
34992      parseElementProperties(getJObject(json, "_eye"), res.getEyeElement());
34993    if (json.has("sphere"))
34994      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
34995    if (json.has("_sphere"))
34996      parseElementProperties(getJObject(json, "_sphere"), res.getSphereElement());
34997    if (json.has("cylinder"))
34998      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
34999    if (json.has("_cylinder"))
35000      parseElementProperties(getJObject(json, "_cylinder"), res.getCylinderElement());
35001    if (json.has("axis"))
35002      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
35003    if (json.has("_axis"))
35004      parseElementProperties(getJObject(json, "_axis"), res.getAxisElement());
35005    if (json.has("prism")) {
35006      JsonArray array = getJArray(json, "prism");
35007      for (int i = 0; i < array.size(); i++) {
35008        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject()));
35009      }
35010    };
35011    if (json.has("add"))
35012      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
35013    if (json.has("_add"))
35014      parseElementProperties(getJObject(json, "_add"), res.getAddElement());
35015    if (json.has("power"))
35016      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
35017    if (json.has("_power"))
35018      parseElementProperties(getJObject(json, "_power"), res.getPowerElement());
35019    if (json.has("backCurve"))
35020      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
35021    if (json.has("_backCurve"))
35022      parseElementProperties(getJObject(json, "_backCurve"), res.getBackCurveElement());
35023    if (json.has("diameter"))
35024      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
35025    if (json.has("_diameter"))
35026      parseElementProperties(getJObject(json, "_diameter"), res.getDiameterElement());
35027    if (json.has("duration"))
35028      res.setDuration(parseQuantity(getJObject(json, "duration")));
35029    if (json.has("color"))
35030      res.setColorElement(parseString(json.get("color").getAsString()));
35031    if (json.has("_color"))
35032      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
35033    if (json.has("brand"))
35034      res.setBrandElement(parseString(json.get("brand").getAsString()));
35035    if (json.has("_brand"))
35036      parseElementProperties(getJObject(json, "_brand"), res.getBrandElement());
35037    if (json.has("note")) {
35038      JsonArray array = getJArray(json, "note");
35039      for (int i = 0; i < array.size(); i++) {
35040        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
35041      }
35042    };
35043  }
35044
35045  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json) throws IOException, FHIRFormatError {
35046    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
35047    parseVisionPrescriptionPrismComponentProperties(json, res);
35048    return res;
35049  }
35050
35051  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
35052    parseBackboneElementProperties(json, res);
35053    if (json.has("amount"))
35054      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
35055    if (json.has("_amount"))
35056      parseElementProperties(getJObject(json, "_amount"), res.getAmountElement());
35057    if (json.has("base"))
35058      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
35059    if (json.has("_base"))
35060      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
35061  }
35062
35063
35064  
35065  @Override
35066  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
35067    if (!json.has("resourceType")) {
35068      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
35069    }
35070    String t = json.get("resourceType").getAsString();
35071    if (Utilities.noString(t)) {
35072      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
35073    } else if (t.equals("Account")) {
35074      return parseAccount(json);
35075    } else if (t.equals("ActivityDefinition")) {
35076      return parseActivityDefinition(json);
35077    } else if (t.equals("ActorDefinition")) {
35078      return parseActorDefinition(json);
35079    } else if (t.equals("AdministrableProductDefinition")) {
35080      return parseAdministrableProductDefinition(json);
35081    } else if (t.equals("AdverseEvent")) {
35082      return parseAdverseEvent(json);
35083    } else if (t.equals("AllergyIntolerance")) {
35084      return parseAllergyIntolerance(json);
35085    } else if (t.equals("Appointment")) {
35086      return parseAppointment(json);
35087    } else if (t.equals("AppointmentResponse")) {
35088      return parseAppointmentResponse(json);
35089    } else if (t.equals("ArtifactAssessment")) {
35090      return parseArtifactAssessment(json);
35091    } else if (t.equals("AuditEvent")) {
35092      return parseAuditEvent(json);
35093    } else if (t.equals("Basic")) {
35094      return parseBasic(json);
35095    } else if (t.equals("Binary")) {
35096      return parseBinary(json);
35097    } else if (t.equals("BiologicallyDerivedProduct")) {
35098      return parseBiologicallyDerivedProduct(json);
35099    } else if (t.equals("BiologicallyDerivedProductDispense")) {
35100      return parseBiologicallyDerivedProductDispense(json);
35101    } else if (t.equals("BodyStructure")) {
35102      return parseBodyStructure(json);
35103    } else if (t.equals("Bundle")) {
35104      return parseBundle(json);
35105    } else if (t.equals("CapabilityStatement")) {
35106      return parseCapabilityStatement(json);
35107    } else if (t.equals("CarePlan")) {
35108      return parseCarePlan(json);
35109    } else if (t.equals("CareTeam")) {
35110      return parseCareTeam(json);
35111    } else if (t.equals("ChargeItem")) {
35112      return parseChargeItem(json);
35113    } else if (t.equals("ChargeItemDefinition")) {
35114      return parseChargeItemDefinition(json);
35115    } else if (t.equals("Citation")) {
35116      return parseCitation(json);
35117    } else if (t.equals("Claim")) {
35118      return parseClaim(json);
35119    } else if (t.equals("ClaimResponse")) {
35120      return parseClaimResponse(json);
35121    } else if (t.equals("ClinicalImpression")) {
35122      return parseClinicalImpression(json);
35123    } else if (t.equals("ClinicalUseDefinition")) {
35124      return parseClinicalUseDefinition(json);
35125    } else if (t.equals("CodeSystem")) {
35126      return parseCodeSystem(json);
35127    } else if (t.equals("Communication")) {
35128      return parseCommunication(json);
35129    } else if (t.equals("CommunicationRequest")) {
35130      return parseCommunicationRequest(json);
35131    } else if (t.equals("CompartmentDefinition")) {
35132      return parseCompartmentDefinition(json);
35133    } else if (t.equals("Composition")) {
35134      return parseComposition(json);
35135    } else if (t.equals("ConceptMap")) {
35136      return parseConceptMap(json);
35137    } else if (t.equals("Condition")) {
35138      return parseCondition(json);
35139    } else if (t.equals("ConditionDefinition")) {
35140      return parseConditionDefinition(json);
35141    } else if (t.equals("Consent")) {
35142      return parseConsent(json);
35143    } else if (t.equals("Contract")) {
35144      return parseContract(json);
35145    } else if (t.equals("Coverage")) {
35146      return parseCoverage(json);
35147    } else if (t.equals("CoverageEligibilityRequest")) {
35148      return parseCoverageEligibilityRequest(json);
35149    } else if (t.equals("CoverageEligibilityResponse")) {
35150      return parseCoverageEligibilityResponse(json);
35151    } else if (t.equals("DetectedIssue")) {
35152      return parseDetectedIssue(json);
35153    } else if (t.equals("Device")) {
35154      return parseDevice(json);
35155    } else if (t.equals("DeviceAssociation")) {
35156      return parseDeviceAssociation(json);
35157    } else if (t.equals("DeviceDefinition")) {
35158      return parseDeviceDefinition(json);
35159    } else if (t.equals("DeviceDispense")) {
35160      return parseDeviceDispense(json);
35161    } else if (t.equals("DeviceMetric")) {
35162      return parseDeviceMetric(json);
35163    } else if (t.equals("DeviceRequest")) {
35164      return parseDeviceRequest(json);
35165    } else if (t.equals("DeviceUsage")) {
35166      return parseDeviceUsage(json);
35167    } else if (t.equals("DiagnosticReport")) {
35168      return parseDiagnosticReport(json);
35169    } else if (t.equals("DocumentReference")) {
35170      return parseDocumentReference(json);
35171    } else if (t.equals("Encounter")) {
35172      return parseEncounter(json);
35173    } else if (t.equals("EncounterHistory")) {
35174      return parseEncounterHistory(json);
35175    } else if (t.equals("Endpoint")) {
35176      return parseEndpoint(json);
35177    } else if (t.equals("EnrollmentRequest")) {
35178      return parseEnrollmentRequest(json);
35179    } else if (t.equals("EnrollmentResponse")) {
35180      return parseEnrollmentResponse(json);
35181    } else if (t.equals("EpisodeOfCare")) {
35182      return parseEpisodeOfCare(json);
35183    } else if (t.equals("EventDefinition")) {
35184      return parseEventDefinition(json);
35185    } else if (t.equals("Evidence")) {
35186      return parseEvidence(json);
35187    } else if (t.equals("EvidenceReport")) {
35188      return parseEvidenceReport(json);
35189    } else if (t.equals("EvidenceVariable")) {
35190      return parseEvidenceVariable(json);
35191    } else if (t.equals("ExampleScenario")) {
35192      return parseExampleScenario(json);
35193    } else if (t.equals("ExplanationOfBenefit")) {
35194      return parseExplanationOfBenefit(json);
35195    } else if (t.equals("FamilyMemberHistory")) {
35196      return parseFamilyMemberHistory(json);
35197    } else if (t.equals("Flag")) {
35198      return parseFlag(json);
35199    } else if (t.equals("FormularyItem")) {
35200      return parseFormularyItem(json);
35201    } else if (t.equals("GenomicStudy")) {
35202      return parseGenomicStudy(json);
35203    } else if (t.equals("Goal")) {
35204      return parseGoal(json);
35205    } else if (t.equals("GraphDefinition")) {
35206      return parseGraphDefinition(json);
35207    } else if (t.equals("Group")) {
35208      return parseGroup(json);
35209    } else if (t.equals("GuidanceResponse")) {
35210      return parseGuidanceResponse(json);
35211    } else if (t.equals("HealthcareService")) {
35212      return parseHealthcareService(json);
35213    } else if (t.equals("ImagingSelection")) {
35214      return parseImagingSelection(json);
35215    } else if (t.equals("ImagingStudy")) {
35216      return parseImagingStudy(json);
35217    } else if (t.equals("Immunization")) {
35218      return parseImmunization(json);
35219    } else if (t.equals("ImmunizationEvaluation")) {
35220      return parseImmunizationEvaluation(json);
35221    } else if (t.equals("ImmunizationRecommendation")) {
35222      return parseImmunizationRecommendation(json);
35223    } else if (t.equals("ImplementationGuide")) {
35224      return parseImplementationGuide(json);
35225    } else if (t.equals("Ingredient")) {
35226      return parseIngredient(json);
35227    } else if (t.equals("InsurancePlan")) {
35228      return parseInsurancePlan(json);
35229    } else if (t.equals("InventoryItem")) {
35230      return parseInventoryItem(json);
35231    } else if (t.equals("InventoryReport")) {
35232      return parseInventoryReport(json);
35233    } else if (t.equals("Invoice")) {
35234      return parseInvoice(json);
35235    } else if (t.equals("Library")) {
35236      return parseLibrary(json);
35237    } else if (t.equals("Linkage")) {
35238      return parseLinkage(json);
35239    } else if (t.equals("List")) {
35240      return parseListResource(json);
35241    } else if (t.equals("Location")) {
35242      return parseLocation(json);
35243    } else if (t.equals("ManufacturedItemDefinition")) {
35244      return parseManufacturedItemDefinition(json);
35245    } else if (t.equals("Measure")) {
35246      return parseMeasure(json);
35247    } else if (t.equals("MeasureReport")) {
35248      return parseMeasureReport(json);
35249    } else if (t.equals("Medication")) {
35250      return parseMedication(json);
35251    } else if (t.equals("MedicationAdministration")) {
35252      return parseMedicationAdministration(json);
35253    } else if (t.equals("MedicationDispense")) {
35254      return parseMedicationDispense(json);
35255    } else if (t.equals("MedicationKnowledge")) {
35256      return parseMedicationKnowledge(json);
35257    } else if (t.equals("MedicationRequest")) {
35258      return parseMedicationRequest(json);
35259    } else if (t.equals("MedicationStatement")) {
35260      return parseMedicationStatement(json);
35261    } else if (t.equals("MedicinalProductDefinition")) {
35262      return parseMedicinalProductDefinition(json);
35263    } else if (t.equals("MessageDefinition")) {
35264      return parseMessageDefinition(json);
35265    } else if (t.equals("MessageHeader")) {
35266      return parseMessageHeader(json);
35267    } else if (t.equals("MolecularSequence")) {
35268      return parseMolecularSequence(json);
35269    } else if (t.equals("NamingSystem")) {
35270      return parseNamingSystem(json);
35271    } else if (t.equals("NutritionIntake")) {
35272      return parseNutritionIntake(json);
35273    } else if (t.equals("NutritionOrder")) {
35274      return parseNutritionOrder(json);
35275    } else if (t.equals("NutritionProduct")) {
35276      return parseNutritionProduct(json);
35277    } else if (t.equals("Observation")) {
35278      return parseObservation(json);
35279    } else if (t.equals("ObservationDefinition")) {
35280      return parseObservationDefinition(json);
35281    } else if (t.equals("OperationDefinition")) {
35282      return parseOperationDefinition(json);
35283    } else if (t.equals("OperationOutcome")) {
35284      return parseOperationOutcome(json);
35285    } else if (t.equals("Organization")) {
35286      return parseOrganization(json);
35287    } else if (t.equals("OrganizationAffiliation")) {
35288      return parseOrganizationAffiliation(json);
35289    } else if (t.equals("PackagedProductDefinition")) {
35290      return parsePackagedProductDefinition(json);
35291    } else if (t.equals("Parameters")) {
35292      return parseParameters(json);
35293    } else if (t.equals("Patient")) {
35294      return parsePatient(json);
35295    } else if (t.equals("PaymentNotice")) {
35296      return parsePaymentNotice(json);
35297    } else if (t.equals("PaymentReconciliation")) {
35298      return parsePaymentReconciliation(json);
35299    } else if (t.equals("Permission")) {
35300      return parsePermission(json);
35301    } else if (t.equals("Person")) {
35302      return parsePerson(json);
35303    } else if (t.equals("PlanDefinition")) {
35304      return parsePlanDefinition(json);
35305    } else if (t.equals("Practitioner")) {
35306      return parsePractitioner(json);
35307    } else if (t.equals("PractitionerRole")) {
35308      return parsePractitionerRole(json);
35309    } else if (t.equals("Procedure")) {
35310      return parseProcedure(json);
35311    } else if (t.equals("Provenance")) {
35312      return parseProvenance(json);
35313    } else if (t.equals("Questionnaire")) {
35314      return parseQuestionnaire(json);
35315    } else if (t.equals("QuestionnaireResponse")) {
35316      return parseQuestionnaireResponse(json);
35317    } else if (t.equals("RegulatedAuthorization")) {
35318      return parseRegulatedAuthorization(json);
35319    } else if (t.equals("RelatedPerson")) {
35320      return parseRelatedPerson(json);
35321    } else if (t.equals("RequestOrchestration")) {
35322      return parseRequestOrchestration(json);
35323    } else if (t.equals("Requirements")) {
35324      return parseRequirements(json);
35325    } else if (t.equals("ResearchStudy")) {
35326      return parseResearchStudy(json);
35327    } else if (t.equals("ResearchSubject")) {
35328      return parseResearchSubject(json);
35329    } else if (t.equals("RiskAssessment")) {
35330      return parseRiskAssessment(json);
35331    } else if (t.equals("Schedule")) {
35332      return parseSchedule(json);
35333    } else if (t.equals("SearchParameter")) {
35334      return parseSearchParameter(json);
35335    } else if (t.equals("ServiceRequest")) {
35336      return parseServiceRequest(json);
35337    } else if (t.equals("Slot")) {
35338      return parseSlot(json);
35339    } else if (t.equals("Specimen")) {
35340      return parseSpecimen(json);
35341    } else if (t.equals("SpecimenDefinition")) {
35342      return parseSpecimenDefinition(json);
35343    } else if (t.equals("StructureDefinition")) {
35344      return parseStructureDefinition(json);
35345    } else if (t.equals("StructureMap")) {
35346      return parseStructureMap(json);
35347    } else if (t.equals("Subscription")) {
35348      return parseSubscription(json);
35349    } else if (t.equals("SubscriptionStatus")) {
35350      return parseSubscriptionStatus(json);
35351    } else if (t.equals("SubscriptionTopic")) {
35352      return parseSubscriptionTopic(json);
35353    } else if (t.equals("Substance")) {
35354      return parseSubstance(json);
35355    } else if (t.equals("SubstanceDefinition")) {
35356      return parseSubstanceDefinition(json);
35357    } else if (t.equals("SubstanceNucleicAcid")) {
35358      return parseSubstanceNucleicAcid(json);
35359    } else if (t.equals("SubstancePolymer")) {
35360      return parseSubstancePolymer(json);
35361    } else if (t.equals("SubstanceProtein")) {
35362      return parseSubstanceProtein(json);
35363    } else if (t.equals("SubstanceReferenceInformation")) {
35364      return parseSubstanceReferenceInformation(json);
35365    } else if (t.equals("SubstanceSourceMaterial")) {
35366      return parseSubstanceSourceMaterial(json);
35367    } else if (t.equals("SupplyDelivery")) {
35368      return parseSupplyDelivery(json);
35369    } else if (t.equals("SupplyRequest")) {
35370      return parseSupplyRequest(json);
35371    } else if (t.equals("Task")) {
35372      return parseTask(json);
35373    } else if (t.equals("TerminologyCapabilities")) {
35374      return parseTerminologyCapabilities(json);
35375    } else if (t.equals("TestPlan")) {
35376      return parseTestPlan(json);
35377    } else if (t.equals("TestReport")) {
35378      return parseTestReport(json);
35379    } else if (t.equals("TestScript")) {
35380      return parseTestScript(json);
35381    } else if (t.equals("Transport")) {
35382      return parseTransport(json);
35383    } else if (t.equals("ValueSet")) {
35384      return parseValueSet(json);
35385    } else if (t.equals("VerificationResult")) {
35386      return parseVerificationResult(json);
35387    } else if (t.equals("VisionPrescription")) {
35388      return parseVisionPrescription(json);
35389
35390    } else {
35391      throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
35392    }
35393  }
35394
35395  protected DataType parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
35396    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
35397      DataType t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
35398      if (json.has("_"+prefix+"Date"))
35399        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
35400      return t;
35401    }
35402    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
35403      DataType t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
35404      if (json.has("_"+prefix+"DateTime"))
35405        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
35406      return t;
35407    }
35408    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
35409      DataType t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
35410      if (json.has("_"+prefix+"Code"))
35411        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
35412      return t;
35413    }
35414    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
35415      DataType t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
35416      if (json.has("_"+prefix+"String"))
35417        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
35418      return t;
35419    }
35420    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
35421      DataType t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
35422      if (json.has("_"+prefix+"Integer"))
35423        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
35424      return t;
35425    }
35426    else if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64")) {
35427      DataType t = json.has(prefix+"Integer64") ? parseInteger64(json.get(prefix+"Integer64").getAsLong()) : new Integer64Type();
35428      if (json.has("_"+prefix+"Integer64"))
35429        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer64"), t);
35430      return t;
35431    }
35432    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
35433      DataType t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
35434      if (json.has("_"+prefix+"Oid"))
35435        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
35436      return t;
35437    }
35438    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
35439      DataType t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
35440      if (json.has("_"+prefix+"Canonical"))
35441        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
35442      return t;
35443    }
35444    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
35445      DataType t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
35446      if (json.has("_"+prefix+"Uri"))
35447        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
35448      return t;
35449    }
35450    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
35451      DataType t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
35452      if (json.has("_"+prefix+"Uuid"))
35453        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
35454      return t;
35455    }
35456    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
35457      DataType t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
35458      if (json.has("_"+prefix+"Url"))
35459        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
35460      return t;
35461    }
35462    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
35463      DataType t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
35464      if (json.has("_"+prefix+"Instant"))
35465        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
35466      return t;
35467    }
35468    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
35469      DataType t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
35470      if (json.has("_"+prefix+"Boolean"))
35471        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
35472      return t;
35473    }
35474    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
35475      DataType t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
35476      if (json.has("_"+prefix+"Base64Binary"))
35477        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
35478      return t;
35479    }
35480    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
35481      DataType t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
35482      if (json.has("_"+prefix+"UnsignedInt"))
35483        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
35484      return t;
35485    }
35486    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
35487      DataType t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
35488      if (json.has("_"+prefix+"Markdown"))
35489        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
35490      return t;
35491    }
35492    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
35493      DataType t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
35494      if (json.has("_"+prefix+"Time"))
35495        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
35496      return t;
35497    }
35498    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
35499      DataType t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
35500      if (json.has("_"+prefix+"Id"))
35501        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
35502      return t;
35503    }
35504    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
35505      DataType t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
35506      if (json.has("_"+prefix+"PositiveInt"))
35507        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
35508      return t;
35509    }
35510    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
35511      DataType t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
35512      if (json.has("_"+prefix+"Decimal"))
35513        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
35514      return t;
35515    } else if (json.has(prefix+"Address")) {
35516      return parseAddress(getJObject(json, prefix+"Address"));
35517    } else if (json.has(prefix+"Age")) {
35518      return parseAge(getJObject(json, prefix+"Age"));
35519    } else if (json.has(prefix+"Annotation")) {
35520      return parseAnnotation(getJObject(json, prefix+"Annotation"));
35521    } else if (json.has(prefix+"Attachment")) {
35522      return parseAttachment(getJObject(json, prefix+"Attachment"));
35523    } else if (json.has(prefix+"Availability")) {
35524      return parseAvailability(getJObject(json, prefix+"Availability"));
35525    } else if (json.has(prefix+"CodeableConcept")) {
35526      return parseCodeableConcept(getJObject(json, prefix+"CodeableConcept"));
35527    } else if (json.has(prefix+"CodeableReference")) {
35528      return parseCodeableReference(getJObject(json, prefix+"CodeableReference"));
35529    } else if (json.has(prefix+"Coding")) {
35530      return parseCoding(getJObject(json, prefix+"Coding"));
35531    } else if (json.has(prefix+"ContactDetail")) {
35532      return parseContactDetail(getJObject(json, prefix+"ContactDetail"));
35533    } else if (json.has(prefix+"ContactPoint")) {
35534      return parseContactPoint(getJObject(json, prefix+"ContactPoint"));
35535    } else if (json.has(prefix+"Contributor")) {
35536      return parseContributor(getJObject(json, prefix+"Contributor"));
35537    } else if (json.has(prefix+"Count")) {
35538      return parseCount(getJObject(json, prefix+"Count"));
35539    } else if (json.has(prefix+"DataRequirement")) {
35540      return parseDataRequirement(getJObject(json, prefix+"DataRequirement"));
35541    } else if (json.has(prefix+"Distance")) {
35542      return parseDistance(getJObject(json, prefix+"Distance"));
35543    } else if (json.has(prefix+"Dosage")) {
35544      return parseDosage(getJObject(json, prefix+"Dosage"));
35545    } else if (json.has(prefix+"Duration")) {
35546      return parseDuration(getJObject(json, prefix+"Duration"));
35547    } else if (json.has(prefix+"ElementDefinition")) {
35548      return parseElementDefinition(getJObject(json, prefix+"ElementDefinition"));
35549    } else if (json.has(prefix+"Expression")) {
35550      return parseExpression(getJObject(json, prefix+"Expression"));
35551    } else if (json.has(prefix+"ExtendedContactDetail")) {
35552      return parseExtendedContactDetail(getJObject(json, prefix+"ExtendedContactDetail"));
35553    } else if (json.has(prefix+"Extension")) {
35554      return parseExtension(getJObject(json, prefix+"Extension"));
35555    } else if (json.has(prefix+"HumanName")) {
35556      return parseHumanName(getJObject(json, prefix+"HumanName"));
35557    } else if (json.has(prefix+"Identifier")) {
35558      return parseIdentifier(getJObject(json, prefix+"Identifier"));
35559    } else if (json.has(prefix+"MarketingStatus")) {
35560      return parseMarketingStatus(getJObject(json, prefix+"MarketingStatus"));
35561    } else if (json.has(prefix+"Meta")) {
35562      return parseMeta(getJObject(json, prefix+"Meta"));
35563    } else if (json.has(prefix+"MonetaryComponent")) {
35564      return parseMonetaryComponent(getJObject(json, prefix+"MonetaryComponent"));
35565    } else if (json.has(prefix+"Money")) {
35566      return parseMoney(getJObject(json, prefix+"Money"));
35567    } else if (json.has(prefix+"Narrative")) {
35568      return parseNarrative(getJObject(json, prefix+"Narrative"));
35569    } else if (json.has(prefix+"ParameterDefinition")) {
35570      return parseParameterDefinition(getJObject(json, prefix+"ParameterDefinition"));
35571    } else if (json.has(prefix+"Period")) {
35572      return parsePeriod(getJObject(json, prefix+"Period"));
35573    } else if (json.has(prefix+"ProductShelfLife")) {
35574      return parseProductShelfLife(getJObject(json, prefix+"ProductShelfLife"));
35575    } else if (json.has(prefix+"Quantity")) {
35576      return parseQuantity(getJObject(json, prefix+"Quantity"));
35577    } else if (json.has(prefix+"Range")) {
35578      return parseRange(getJObject(json, prefix+"Range"));
35579    } else if (json.has(prefix+"Ratio")) {
35580      return parseRatio(getJObject(json, prefix+"Ratio"));
35581    } else if (json.has(prefix+"RatioRange")) {
35582      return parseRatioRange(getJObject(json, prefix+"RatioRange"));
35583    } else if (json.has(prefix+"Reference")) {
35584      return parseReference(getJObject(json, prefix+"Reference"));
35585    } else if (json.has(prefix+"RelatedArtifact")) {
35586      return parseRelatedArtifact(getJObject(json, prefix+"RelatedArtifact"));
35587    } else if (json.has(prefix+"SampledData")) {
35588      return parseSampledData(getJObject(json, prefix+"SampledData"));
35589    } else if (json.has(prefix+"Signature")) {
35590      return parseSignature(getJObject(json, prefix+"Signature"));
35591    } else if (json.has(prefix+"Timing")) {
35592      return parseTiming(getJObject(json, prefix+"Timing"));
35593    } else if (json.has(prefix+"TriggerDefinition")) {
35594      return parseTriggerDefinition(getJObject(json, prefix+"TriggerDefinition"));
35595    } else if (json.has(prefix+"UsageContext")) {
35596      return parseUsageContext(getJObject(json, prefix+"UsageContext"));
35597    } else if (json.has(prefix+"VirtualServiceDetail")) {
35598      return parseVirtualServiceDetail(getJObject(json, prefix+"VirtualServiceDetail"));
35599
35600    } else {
35601      return null;
35602    }
35603  }
35604
35605  protected DataType parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
35606    return parseType(json, type);
35607  }
35608
35609  protected DataType parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
35610    if (Utilities.noString(type)) {
35611      throw new FHIRFormatError("Unable to parse type - type not specified"); 
35612   } else if (type.equals("Address")) {
35613      return parseAddress(json);
35614   } else if (type.equals("Age")) {
35615      return parseAge(json);
35616   } else if (type.equals("Annotation")) {
35617      return parseAnnotation(json);
35618   } else if (type.equals("Attachment")) {
35619      return parseAttachment(json);
35620   } else if (type.equals("Availability")) {
35621      return parseAvailability(json);
35622   } else if (type.equals("CodeableConcept")) {
35623      return parseCodeableConcept(json);
35624   } else if (type.equals("CodeableReference")) {
35625      return parseCodeableReference(json);
35626   } else if (type.equals("Coding")) {
35627      return parseCoding(json);
35628   } else if (type.equals("ContactDetail")) {
35629      return parseContactDetail(json);
35630   } else if (type.equals("ContactPoint")) {
35631      return parseContactPoint(json);
35632   } else if (type.equals("Contributor")) {
35633      return parseContributor(json);
35634   } else if (type.equals("Count")) {
35635      return parseCount(json);
35636   } else if (type.equals("DataRequirement")) {
35637      return parseDataRequirement(json);
35638   } else if (type.equals("Distance")) {
35639      return parseDistance(json);
35640   } else if (type.equals("Dosage")) {
35641      return parseDosage(json);
35642   } else if (type.equals("Duration")) {
35643      return parseDuration(json);
35644   } else if (type.equals("ElementDefinition")) {
35645      return parseElementDefinition(json);
35646   } else if (type.equals("Expression")) {
35647      return parseExpression(json);
35648   } else if (type.equals("ExtendedContactDetail")) {
35649      return parseExtendedContactDetail(json);
35650   } else if (type.equals("Extension")) {
35651      return parseExtension(json);
35652   } else if (type.equals("HumanName")) {
35653      return parseHumanName(json);
35654   } else if (type.equals("Identifier")) {
35655      return parseIdentifier(json);
35656   } else if (type.equals("MarketingStatus")) {
35657      return parseMarketingStatus(json);
35658   } else if (type.equals("Meta")) {
35659      return parseMeta(json);
35660   } else if (type.equals("MonetaryComponent")) {
35661      return parseMonetaryComponent(json);
35662   } else if (type.equals("Money")) {
35663      return parseMoney(json);
35664   } else if (type.equals("Narrative")) {
35665      return parseNarrative(json);
35666   } else if (type.equals("ParameterDefinition")) {
35667      return parseParameterDefinition(json);
35668   } else if (type.equals("Period")) {
35669      return parsePeriod(json);
35670   } else if (type.equals("ProductShelfLife")) {
35671      return parseProductShelfLife(json);
35672   } else if (type.equals("Quantity")) {
35673      return parseQuantity(json);
35674   } else if (type.equals("Range")) {
35675      return parseRange(json);
35676   } else if (type.equals("Ratio")) {
35677      return parseRatio(json);
35678   } else if (type.equals("RatioRange")) {
35679      return parseRatioRange(json);
35680   } else if (type.equals("Reference")) {
35681      return parseReference(json);
35682   } else if (type.equals("RelatedArtifact")) {
35683      return parseRelatedArtifact(json);
35684   } else if (type.equals("SampledData")) {
35685      return parseSampledData(json);
35686   } else if (type.equals("Signature")) {
35687      return parseSignature(json);
35688   } else if (type.equals("Timing")) {
35689      return parseTiming(json);
35690   } else if (type.equals("TriggerDefinition")) {
35691      return parseTriggerDefinition(json);
35692   } else if (type.equals("UsageContext")) {
35693      return parseUsageContext(json);
35694   } else if (type.equals("VirtualServiceDetail")) {
35695      return parseVirtualServiceDetail(json);
35696
35697    } else {
35698      throw new FHIRFormatError("Unknown Type "+type);
35699    }
35700  }
35701
35702  protected boolean hasTypeName(JsonObject json, String prefix) {
35703    if (json.has(prefix+"Address")) {
35704      return true;
35705    };
35706    if (json.has(prefix+"Age")) {
35707      return true;
35708    };
35709    if (json.has(prefix+"Annotation")) {
35710      return true;
35711    };
35712    if (json.has(prefix+"Attachment")) {
35713      return true;
35714    };
35715    if (json.has(prefix+"Availability")) {
35716      return true;
35717    };
35718    if (json.has(prefix+"CodeableConcept")) {
35719      return true;
35720    };
35721    if (json.has(prefix+"CodeableReference")) {
35722      return true;
35723    };
35724    if (json.has(prefix+"Coding")) {
35725      return true;
35726    };
35727    if (json.has(prefix+"ContactDetail")) {
35728      return true;
35729    };
35730    if (json.has(prefix+"ContactPoint")) {
35731      return true;
35732    };
35733    if (json.has(prefix+"Contributor")) {
35734      return true;
35735    };
35736    if (json.has(prefix+"Count")) {
35737      return true;
35738    };
35739    if (json.has(prefix+"DataRequirement")) {
35740      return true;
35741    };
35742    if (json.has(prefix+"Distance")) {
35743      return true;
35744    };
35745    if (json.has(prefix+"Dosage")) {
35746      return true;
35747    };
35748    if (json.has(prefix+"Duration")) {
35749      return true;
35750    };
35751    if (json.has(prefix+"ElementDefinition")) {
35752      return true;
35753    };
35754    if (json.has(prefix+"Expression")) {
35755      return true;
35756    };
35757    if (json.has(prefix+"ExtendedContactDetail")) {
35758      return true;
35759    };
35760    if (json.has(prefix+"Extension")) {
35761      return true;
35762    };
35763    if (json.has(prefix+"HumanName")) {
35764      return true;
35765    };
35766    if (json.has(prefix+"Identifier")) {
35767      return true;
35768    };
35769    if (json.has(prefix+"MarketingStatus")) {
35770      return true;
35771    };
35772    if (json.has(prefix+"Meta")) {
35773      return true;
35774    };
35775    if (json.has(prefix+"MonetaryComponent")) {
35776      return true;
35777    };
35778    if (json.has(prefix+"Money")) {
35779      return true;
35780    };
35781    if (json.has(prefix+"Narrative")) {
35782      return true;
35783    };
35784    if (json.has(prefix+"ParameterDefinition")) {
35785      return true;
35786    };
35787    if (json.has(prefix+"Period")) {
35788      return true;
35789    };
35790    if (json.has(prefix+"ProductShelfLife")) {
35791      return true;
35792    };
35793    if (json.has(prefix+"Quantity")) {
35794      return true;
35795    };
35796    if (json.has(prefix+"Range")) {
35797      return true;
35798    };
35799    if (json.has(prefix+"Ratio")) {
35800      return true;
35801    };
35802    if (json.has(prefix+"RatioRange")) {
35803      return true;
35804    };
35805    if (json.has(prefix+"Reference")) {
35806      return true;
35807    };
35808    if (json.has(prefix+"RelatedArtifact")) {
35809      return true;
35810    };
35811    if (json.has(prefix+"SampledData")) {
35812      return true;
35813    };
35814    if (json.has(prefix+"Signature")) {
35815      return true;
35816    };
35817    if (json.has(prefix+"Timing")) {
35818      return true;
35819    };
35820    if (json.has(prefix+"TriggerDefinition")) {
35821      return true;
35822    };
35823    if (json.has(prefix+"UsageContext")) {
35824      return true;
35825    };
35826    if (json.has(prefix+"VirtualServiceDetail")) {
35827      return true;
35828    };
35829    if (json.has(prefix+"Account")) {
35830      return true;
35831    };
35832    if (json.has(prefix+"ActivityDefinition")) {
35833      return true;
35834    };
35835    if (json.has(prefix+"ActorDefinition")) {
35836      return true;
35837    };
35838    if (json.has(prefix+"AdministrableProductDefinition")) {
35839      return true;
35840    };
35841    if (json.has(prefix+"AdverseEvent")) {
35842      return true;
35843    };
35844    if (json.has(prefix+"AllergyIntolerance")) {
35845      return true;
35846    };
35847    if (json.has(prefix+"Appointment")) {
35848      return true;
35849    };
35850    if (json.has(prefix+"AppointmentResponse")) {
35851      return true;
35852    };
35853    if (json.has(prefix+"ArtifactAssessment")) {
35854      return true;
35855    };
35856    if (json.has(prefix+"AuditEvent")) {
35857      return true;
35858    };
35859    if (json.has(prefix+"Basic")) {
35860      return true;
35861    };
35862    if (json.has(prefix+"Binary")) {
35863      return true;
35864    };
35865    if (json.has(prefix+"BiologicallyDerivedProduct")) {
35866      return true;
35867    };
35868    if (json.has(prefix+"BiologicallyDerivedProductDispense")) {
35869      return true;
35870    };
35871    if (json.has(prefix+"BodyStructure")) {
35872      return true;
35873    };
35874    if (json.has(prefix+"Bundle")) {
35875      return true;
35876    };
35877    if (json.has(prefix+"CapabilityStatement")) {
35878      return true;
35879    };
35880    if (json.has(prefix+"CarePlan")) {
35881      return true;
35882    };
35883    if (json.has(prefix+"CareTeam")) {
35884      return true;
35885    };
35886    if (json.has(prefix+"ChargeItem")) {
35887      return true;
35888    };
35889    if (json.has(prefix+"ChargeItemDefinition")) {
35890      return true;
35891    };
35892    if (json.has(prefix+"Citation")) {
35893      return true;
35894    };
35895    if (json.has(prefix+"Claim")) {
35896      return true;
35897    };
35898    if (json.has(prefix+"ClaimResponse")) {
35899      return true;
35900    };
35901    if (json.has(prefix+"ClinicalImpression")) {
35902      return true;
35903    };
35904    if (json.has(prefix+"ClinicalUseDefinition")) {
35905      return true;
35906    };
35907    if (json.has(prefix+"CodeSystem")) {
35908      return true;
35909    };
35910    if (json.has(prefix+"Communication")) {
35911      return true;
35912    };
35913    if (json.has(prefix+"CommunicationRequest")) {
35914      return true;
35915    };
35916    if (json.has(prefix+"CompartmentDefinition")) {
35917      return true;
35918    };
35919    if (json.has(prefix+"Composition")) {
35920      return true;
35921    };
35922    if (json.has(prefix+"ConceptMap")) {
35923      return true;
35924    };
35925    if (json.has(prefix+"Condition")) {
35926      return true;
35927    };
35928    if (json.has(prefix+"ConditionDefinition")) {
35929      return true;
35930    };
35931    if (json.has(prefix+"Consent")) {
35932      return true;
35933    };
35934    if (json.has(prefix+"Contract")) {
35935      return true;
35936    };
35937    if (json.has(prefix+"Coverage")) {
35938      return true;
35939    };
35940    if (json.has(prefix+"CoverageEligibilityRequest")) {
35941      return true;
35942    };
35943    if (json.has(prefix+"CoverageEligibilityResponse")) {
35944      return true;
35945    };
35946    if (json.has(prefix+"DetectedIssue")) {
35947      return true;
35948    };
35949    if (json.has(prefix+"Device")) {
35950      return true;
35951    };
35952    if (json.has(prefix+"DeviceAssociation")) {
35953      return true;
35954    };
35955    if (json.has(prefix+"DeviceDefinition")) {
35956      return true;
35957    };
35958    if (json.has(prefix+"DeviceDispense")) {
35959      return true;
35960    };
35961    if (json.has(prefix+"DeviceMetric")) {
35962      return true;
35963    };
35964    if (json.has(prefix+"DeviceRequest")) {
35965      return true;
35966    };
35967    if (json.has(prefix+"DeviceUsage")) {
35968      return true;
35969    };
35970    if (json.has(prefix+"DiagnosticReport")) {
35971      return true;
35972    };
35973    if (json.has(prefix+"DocumentReference")) {
35974      return true;
35975    };
35976    if (json.has(prefix+"Encounter")) {
35977      return true;
35978    };
35979    if (json.has(prefix+"EncounterHistory")) {
35980      return true;
35981    };
35982    if (json.has(prefix+"Endpoint")) {
35983      return true;
35984    };
35985    if (json.has(prefix+"EnrollmentRequest")) {
35986      return true;
35987    };
35988    if (json.has(prefix+"EnrollmentResponse")) {
35989      return true;
35990    };
35991    if (json.has(prefix+"EpisodeOfCare")) {
35992      return true;
35993    };
35994    if (json.has(prefix+"EventDefinition")) {
35995      return true;
35996    };
35997    if (json.has(prefix+"Evidence")) {
35998      return true;
35999    };
36000    if (json.has(prefix+"EvidenceReport")) {
36001      return true;
36002    };
36003    if (json.has(prefix+"EvidenceVariable")) {
36004      return true;
36005    };
36006    if (json.has(prefix+"ExampleScenario")) {
36007      return true;
36008    };
36009    if (json.has(prefix+"ExplanationOfBenefit")) {
36010      return true;
36011    };
36012    if (json.has(prefix+"FamilyMemberHistory")) {
36013      return true;
36014    };
36015    if (json.has(prefix+"Flag")) {
36016      return true;
36017    };
36018    if (json.has(prefix+"FormularyItem")) {
36019      return true;
36020    };
36021    if (json.has(prefix+"GenomicStudy")) {
36022      return true;
36023    };
36024    if (json.has(prefix+"Goal")) {
36025      return true;
36026    };
36027    if (json.has(prefix+"GraphDefinition")) {
36028      return true;
36029    };
36030    if (json.has(prefix+"Group")) {
36031      return true;
36032    };
36033    if (json.has(prefix+"GuidanceResponse")) {
36034      return true;
36035    };
36036    if (json.has(prefix+"HealthcareService")) {
36037      return true;
36038    };
36039    if (json.has(prefix+"ImagingSelection")) {
36040      return true;
36041    };
36042    if (json.has(prefix+"ImagingStudy")) {
36043      return true;
36044    };
36045    if (json.has(prefix+"Immunization")) {
36046      return true;
36047    };
36048    if (json.has(prefix+"ImmunizationEvaluation")) {
36049      return true;
36050    };
36051    if (json.has(prefix+"ImmunizationRecommendation")) {
36052      return true;
36053    };
36054    if (json.has(prefix+"ImplementationGuide")) {
36055      return true;
36056    };
36057    if (json.has(prefix+"Ingredient")) {
36058      return true;
36059    };
36060    if (json.has(prefix+"InsurancePlan")) {
36061      return true;
36062    };
36063    if (json.has(prefix+"InventoryItem")) {
36064      return true;
36065    };
36066    if (json.has(prefix+"InventoryReport")) {
36067      return true;
36068    };
36069    if (json.has(prefix+"Invoice")) {
36070      return true;
36071    };
36072    if (json.has(prefix+"Library")) {
36073      return true;
36074    };
36075    if (json.has(prefix+"Linkage")) {
36076      return true;
36077    };
36078    if (json.has(prefix+"List")) {
36079      return true;
36080    };
36081    if (json.has(prefix+"Location")) {
36082      return true;
36083    };
36084    if (json.has(prefix+"ManufacturedItemDefinition")) {
36085      return true;
36086    };
36087    if (json.has(prefix+"Measure")) {
36088      return true;
36089    };
36090    if (json.has(prefix+"MeasureReport")) {
36091      return true;
36092    };
36093    if (json.has(prefix+"Medication")) {
36094      return true;
36095    };
36096    if (json.has(prefix+"MedicationAdministration")) {
36097      return true;
36098    };
36099    if (json.has(prefix+"MedicationDispense")) {
36100      return true;
36101    };
36102    if (json.has(prefix+"MedicationKnowledge")) {
36103      return true;
36104    };
36105    if (json.has(prefix+"MedicationRequest")) {
36106      return true;
36107    };
36108    if (json.has(prefix+"MedicationStatement")) {
36109      return true;
36110    };
36111    if (json.has(prefix+"MedicinalProductDefinition")) {
36112      return true;
36113    };
36114    if (json.has(prefix+"MessageDefinition")) {
36115      return true;
36116    };
36117    if (json.has(prefix+"MessageHeader")) {
36118      return true;
36119    };
36120    if (json.has(prefix+"MolecularSequence")) {
36121      return true;
36122    };
36123    if (json.has(prefix+"NamingSystem")) {
36124      return true;
36125    };
36126    if (json.has(prefix+"NutritionIntake")) {
36127      return true;
36128    };
36129    if (json.has(prefix+"NutritionOrder")) {
36130      return true;
36131    };
36132    if (json.has(prefix+"NutritionProduct")) {
36133      return true;
36134    };
36135    if (json.has(prefix+"Observation")) {
36136      return true;
36137    };
36138    if (json.has(prefix+"ObservationDefinition")) {
36139      return true;
36140    };
36141    if (json.has(prefix+"OperationDefinition")) {
36142      return true;
36143    };
36144    if (json.has(prefix+"OperationOutcome")) {
36145      return true;
36146    };
36147    if (json.has(prefix+"Organization")) {
36148      return true;
36149    };
36150    if (json.has(prefix+"OrganizationAffiliation")) {
36151      return true;
36152    };
36153    if (json.has(prefix+"PackagedProductDefinition")) {
36154      return true;
36155    };
36156    if (json.has(prefix+"Parameters")) {
36157      return true;
36158    };
36159    if (json.has(prefix+"Patient")) {
36160      return true;
36161    };
36162    if (json.has(prefix+"PaymentNotice")) {
36163      return true;
36164    };
36165    if (json.has(prefix+"PaymentReconciliation")) {
36166      return true;
36167    };
36168    if (json.has(prefix+"Permission")) {
36169      return true;
36170    };
36171    if (json.has(prefix+"Person")) {
36172      return true;
36173    };
36174    if (json.has(prefix+"PlanDefinition")) {
36175      return true;
36176    };
36177    if (json.has(prefix+"Practitioner")) {
36178      return true;
36179    };
36180    if (json.has(prefix+"PractitionerRole")) {
36181      return true;
36182    };
36183    if (json.has(prefix+"Procedure")) {
36184      return true;
36185    };
36186    if (json.has(prefix+"Provenance")) {
36187      return true;
36188    };
36189    if (json.has(prefix+"Questionnaire")) {
36190      return true;
36191    };
36192    if (json.has(prefix+"QuestionnaireResponse")) {
36193      return true;
36194    };
36195    if (json.has(prefix+"RegulatedAuthorization")) {
36196      return true;
36197    };
36198    if (json.has(prefix+"RelatedPerson")) {
36199      return true;
36200    };
36201    if (json.has(prefix+"RequestOrchestration")) {
36202      return true;
36203    };
36204    if (json.has(prefix+"Requirements")) {
36205      return true;
36206    };
36207    if (json.has(prefix+"ResearchStudy")) {
36208      return true;
36209    };
36210    if (json.has(prefix+"ResearchSubject")) {
36211      return true;
36212    };
36213    if (json.has(prefix+"RiskAssessment")) {
36214      return true;
36215    };
36216    if (json.has(prefix+"Schedule")) {
36217      return true;
36218    };
36219    if (json.has(prefix+"SearchParameter")) {
36220      return true;
36221    };
36222    if (json.has(prefix+"ServiceRequest")) {
36223      return true;
36224    };
36225    if (json.has(prefix+"Slot")) {
36226      return true;
36227    };
36228    if (json.has(prefix+"Specimen")) {
36229      return true;
36230    };
36231    if (json.has(prefix+"SpecimenDefinition")) {
36232      return true;
36233    };
36234    if (json.has(prefix+"StructureDefinition")) {
36235      return true;
36236    };
36237    if (json.has(prefix+"StructureMap")) {
36238      return true;
36239    };
36240    if (json.has(prefix+"Subscription")) {
36241      return true;
36242    };
36243    if (json.has(prefix+"SubscriptionStatus")) {
36244      return true;
36245    };
36246    if (json.has(prefix+"SubscriptionTopic")) {
36247      return true;
36248    };
36249    if (json.has(prefix+"Substance")) {
36250      return true;
36251    };
36252    if (json.has(prefix+"SubstanceDefinition")) {
36253      return true;
36254    };
36255    if (json.has(prefix+"SubstanceNucleicAcid")) {
36256      return true;
36257    };
36258    if (json.has(prefix+"SubstancePolymer")) {
36259      return true;
36260    };
36261    if (json.has(prefix+"SubstanceProtein")) {
36262      return true;
36263    };
36264    if (json.has(prefix+"SubstanceReferenceInformation")) {
36265      return true;
36266    };
36267    if (json.has(prefix+"SubstanceSourceMaterial")) {
36268      return true;
36269    };
36270    if (json.has(prefix+"SupplyDelivery")) {
36271      return true;
36272    };
36273    if (json.has(prefix+"SupplyRequest")) {
36274      return true;
36275    };
36276    if (json.has(prefix+"Task")) {
36277      return true;
36278    };
36279    if (json.has(prefix+"TerminologyCapabilities")) {
36280      return true;
36281    };
36282    if (json.has(prefix+"TestPlan")) {
36283      return true;
36284    };
36285    if (json.has(prefix+"TestReport")) {
36286      return true;
36287    };
36288    if (json.has(prefix+"TestScript")) {
36289      return true;
36290    };
36291    if (json.has(prefix+"Transport")) {
36292      return true;
36293    };
36294    if (json.has(prefix+"ValueSet")) {
36295      return true;
36296    };
36297    if (json.has(prefix+"VerificationResult")) {
36298      return true;
36299    };
36300    if (json.has(prefix+"VisionPrescription")) {
36301      return true;
36302    };
36303
36304    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
36305      return true;
36306    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
36307      return true;
36308    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
36309      return true;
36310    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
36311      return true;
36312    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
36313      return true;
36314    if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64"))
36315      return true;
36316    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
36317      return true;
36318    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
36319      return true;
36320    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
36321      return true;
36322    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
36323      return true;
36324    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
36325      return true;
36326    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
36327      return true;
36328    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
36329      return true;
36330    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
36331      return true;
36332    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
36333      return true;
36334    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
36335      return true;
36336    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
36337      return true;
36338    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
36339      return true;
36340    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
36341      return true;
36342    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
36343      return true;
36344    return false;
36345  }
36346
36347// -- compose ---------------------------------------------------------------------------------------------------------------------
36348
36349  protected void composeBaseProperties(Base element) throws IOException {
36350  }
36351
36352
36353  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
36354    if (value != null && value.getValue() != null) {
36355      prop(name, e.toCode(value.getValue()));
36356    } else if (inArray)   
36357      writeNull(name);
36358  }    
36359
36360  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
36361    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36362      open(inArray ? null : "_"+name);
36363      composeElementProperties(value);
36364      close();
36365    } else if (inArray)   
36366      writeNull(name);
36367  }    
36368
36369  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
36370    if (value != null && value.hasValue()) {
36371        prop(name, value.asStringValue());
36372    }    
36373    else if (inArray) 
36374      writeNull(name); 
36375  }    
36376
36377  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
36378    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36379      open(inArray ? null : "_"+name);
36380      composeElementProperties(value);
36381      close();
36382    }
36383    else if (inArray) 
36384      writeNull(name); 
36385  }
36386
36387  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
36388    if (value != null && value.hasValue()) {
36389        prop(name, value.asStringValue());
36390    }    
36391    else if (inArray) 
36392      writeNull(name); 
36393  }    
36394
36395  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
36396    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36397      open(inArray ? null : "_"+name);
36398      composeElementProperties(value);
36399      close();
36400    }
36401    else if (inArray) 
36402      writeNull(name); 
36403  }
36404
36405  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
36406    if (value != null && value.hasValue()) {
36407        prop(name, toString(value.getValue()));
36408    }    
36409    else if (inArray) 
36410      writeNull(name); 
36411  }    
36412
36413  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
36414    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36415      open(inArray ? null : "_"+name);
36416      composeElementProperties(value);
36417      close();
36418    }
36419    else if (inArray) 
36420      writeNull(name); 
36421  }
36422
36423  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
36424    if (value != null && value.hasValue()) {
36425        prop(name, toString(value.getValue()));
36426    }    
36427    else if (inArray) 
36428      writeNull(name); 
36429  }    
36430
36431  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
36432    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36433      open(inArray ? null : "_"+name);
36434      composeElementProperties(value);
36435      close();
36436    }
36437    else if (inArray) 
36438      writeNull(name); 
36439  }
36440
36441  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
36442    if (value != null && value.hasValue()) {
36443        prop(name, Integer.valueOf(value.getValue()));
36444    }    
36445    else if (inArray) 
36446      writeNull(name); 
36447  }    
36448
36449  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
36450    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36451      open(inArray ? null : "_"+name);
36452      composeElementProperties(value);
36453      close();
36454    }
36455    else if (inArray) 
36456      writeNull(name); 
36457  }
36458
36459  protected void composeInteger64Core(String name, Integer64Type value, boolean inArray) throws IOException {
36460    if (value != null && value.hasValue()) {
36461        prop(name, value.getValue().toString());
36462    }    
36463    else if (inArray) 
36464      writeNull(name); 
36465  }    
36466
36467  protected void composeInteger64Extras(String name, Integer64Type value, boolean inArray) throws IOException {
36468    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36469      open(inArray ? null : "_"+name);
36470      composeElementProperties(value);
36471      close();
36472    }
36473    else if (inArray) 
36474      writeNull(name); 
36475  }
36476
36477  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
36478    if (value != null && value.hasValue()) {
36479        prop(name, toString(value.getValue()));
36480    }    
36481    else if (inArray) 
36482      writeNull(name); 
36483  }    
36484
36485  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
36486    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36487      open(inArray ? null : "_"+name);
36488      composeElementProperties(value);
36489      close();
36490    }
36491    else if (inArray) 
36492      writeNull(name); 
36493  }
36494
36495  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
36496    if (value != null && value.hasValue()) {
36497        prop(name, toString(value.getValue()));
36498    }    
36499    else if (inArray) 
36500      writeNull(name); 
36501  }    
36502
36503  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
36504    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36505      open(inArray ? null : "_"+name);
36506      composeElementProperties(value);
36507      close();
36508    }
36509    else if (inArray) 
36510      writeNull(name); 
36511  }
36512
36513  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
36514    if (value != null && value.hasValue()) {
36515        prop(name, toString(value.getValue()));
36516    }    
36517    else if (inArray) 
36518      writeNull(name); 
36519  }    
36520
36521  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
36522    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36523      open(inArray ? null : "_"+name);
36524      composeElementProperties(value);
36525      close();
36526    }
36527    else if (inArray) 
36528      writeNull(name); 
36529  }
36530
36531  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
36532    if (value != null && value.hasValue()) {
36533        prop(name, toString(value.getValue()));
36534    }    
36535    else if (inArray) 
36536      writeNull(name); 
36537  }    
36538
36539  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
36540    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36541      open(inArray ? null : "_"+name);
36542      composeElementProperties(value);
36543      close();
36544    }
36545    else if (inArray) 
36546      writeNull(name); 
36547  }
36548
36549  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
36550    if (value != null && value.hasValue()) {
36551        prop(name, toString(value.getValue()));
36552    }    
36553    else if (inArray) 
36554      writeNull(name); 
36555  }    
36556
36557  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
36558    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36559      open(inArray ? null : "_"+name);
36560      composeElementProperties(value);
36561      close();
36562    }
36563    else if (inArray) 
36564      writeNull(name); 
36565  }
36566
36567  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
36568    if (value != null && value.hasValue()) {
36569        prop(name, value.asStringValue());
36570    }    
36571    else if (inArray) 
36572      writeNull(name); 
36573  }    
36574
36575  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
36576    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36577      open(inArray ? null : "_"+name);
36578      composeElementProperties(value);
36579      close();
36580    }
36581    else if (inArray) 
36582      writeNull(name); 
36583  }
36584
36585  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
36586    if (value != null && value.hasValue()) {
36587        prop(name, value.getValue());
36588    }    
36589    else if (inArray) 
36590      writeNull(name); 
36591  }    
36592
36593  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
36594    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36595      open(inArray ? null : "_"+name);
36596      composeElementProperties(value);
36597      close();
36598    }
36599    else if (inArray) 
36600      writeNull(name); 
36601  }
36602
36603  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
36604    if (value != null && value.hasValue()) {
36605        prop(name, toString(value.getValue()));
36606    }    
36607    else if (inArray) 
36608      writeNull(name); 
36609  }    
36610
36611  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
36612    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36613      open(inArray ? null : "_"+name);
36614      composeElementProperties(value);
36615      close();
36616    }
36617    else if (inArray) 
36618      writeNull(name); 
36619  }
36620
36621  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
36622    if (value != null && value.hasValue()) {
36623        prop(name, Integer.valueOf(value.getValue()));
36624    }    
36625    else if (inArray) 
36626      writeNull(name); 
36627  }    
36628
36629  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
36630    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36631      open(inArray ? null : "_"+name);
36632      composeElementProperties(value);
36633      close();
36634    }
36635    else if (inArray) 
36636      writeNull(name); 
36637  }
36638
36639  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
36640    if (value != null && value.hasValue()) {
36641        prop(name, toString(value.getValue()));
36642    }    
36643    else if (inArray) 
36644      writeNull(name); 
36645  }    
36646
36647  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
36648    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36649      open(inArray ? null : "_"+name);
36650      composeElementProperties(value);
36651      close();
36652    }
36653    else if (inArray) 
36654      writeNull(name); 
36655  }
36656
36657  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
36658    if (value != null && value.hasValue()) {
36659        prop(name, value.asStringValue());
36660    }    
36661    else if (inArray) 
36662      writeNull(name); 
36663  }    
36664
36665  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
36666    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36667      open(inArray ? null : "_"+name);
36668      composeElementProperties(value);
36669      close();
36670    }
36671    else if (inArray) 
36672      writeNull(name); 
36673  }
36674
36675  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
36676    if (value != null && value.hasValue()) {
36677        prop(name, toString(value.getValue()));
36678    }    
36679    else if (inArray) 
36680      writeNull(name); 
36681  }    
36682
36683  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
36684    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36685      open(inArray ? null : "_"+name);
36686      composeElementProperties(value);
36687      close();
36688    }
36689    else if (inArray) 
36690      writeNull(name); 
36691  }
36692
36693  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
36694    if (value != null && value.hasValue()) {
36695        prop(name, Integer.valueOf(value.getValue()));
36696    }    
36697    else if (inArray) 
36698      writeNull(name); 
36699  }    
36700
36701  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
36702    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36703      open(inArray ? null : "_"+name);
36704      composeElementProperties(value);
36705      close();
36706    }
36707    else if (inArray) 
36708      writeNull(name); 
36709  }
36710
36711  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
36712    if (value != null && value.hasValue()) {
36713        prop(name, value.getValue());
36714    }    
36715    else if (inArray) 
36716      writeNull(name); 
36717  }    
36718
36719  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
36720    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36721      open(inArray ? null : "_"+name);
36722      composeElementProperties(value);
36723      close();
36724    }
36725    else if (inArray) 
36726      writeNull(name); 
36727  }
36728
36729  protected void composeBackboneElementProperties(BackboneElement element) throws IOException {
36730      composeElementProperties(element);
36731      if (element.hasModifierExtension()) {
36732        openArray("modifierExtension");
36733        for (Extension e : element.getModifierExtension()) 
36734          composeExtension(null, e);
36735        closeArray();
36736      };
36737  }
36738
36739  protected void composeBackboneTypeProperties(BackboneType element) throws IOException {
36740      composeDataTypeProperties(element);
36741      if (element.hasModifierExtension()) {
36742        openArray("modifierExtension");
36743        for (Extension e : element.getModifierExtension()) 
36744          composeExtension(null, e);
36745        closeArray();
36746      };
36747  }
36748
36749  protected void composeDataTypeProperties(DataType element) throws IOException {
36750      composeElementProperties(element);
36751  }
36752
36753  protected void composeElementProperties(Element element) throws IOException {
36754      if (element.hasIdElement()) {
36755        composeStringCore("id", element.getIdElement(), false);
36756        composeStringExtras("id", element.getIdElement(), false);
36757      }
36758      if (element.hasExtension()) {
36759        openArray("extension");
36760        for (Extension e : element.getExtension()) 
36761          composeExtension(null, e);
36762        closeArray();
36763      };
36764  }
36765
36766  protected void composeAddress(String name, Address element) throws IOException {
36767    if (element != null) {
36768      open(name);
36769      composeAddressProperties(element);
36770      close();
36771    }
36772  }
36773
36774  protected void composeAddressProperties(Address element) throws IOException {
36775    composeDataTypeProperties(element);
36776      if (element.hasUseElement()) {
36777        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
36778        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
36779      }
36780      if (element.hasTypeElement()) {
36781        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
36782        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
36783      }
36784      if (element.hasTextElement()) {
36785        composeStringCore("text", element.getTextElement(), false);
36786        composeStringExtras("text", element.getTextElement(), false);
36787      }
36788      if (element.hasLine()) {
36789        if (anyHasValue(element.getLine())) {
36790          openArray("line");
36791          for (StringType e : element.getLine()) 
36792            composeStringCore(null, e, e != element.getLine().get(element.getLine().size()-1));
36793          closeArray();
36794        }
36795        if (anyHasExtras(element.getLine())) {
36796          openArray("_line");
36797          for (StringType e : element.getLine()) 
36798            composeStringExtras(null, e, true);
36799          closeArray();
36800        }
36801      };
36802      if (element.hasCityElement()) {
36803        composeStringCore("city", element.getCityElement(), false);
36804        composeStringExtras("city", element.getCityElement(), false);
36805      }
36806      if (element.hasDistrictElement()) {
36807        composeStringCore("district", element.getDistrictElement(), false);
36808        composeStringExtras("district", element.getDistrictElement(), false);
36809      }
36810      if (element.hasStateElement()) {
36811        composeStringCore("state", element.getStateElement(), false);
36812        composeStringExtras("state", element.getStateElement(), false);
36813      }
36814      if (element.hasPostalCodeElement()) {
36815        composeStringCore("postalCode", element.getPostalCodeElement(), false);
36816        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
36817      }
36818      if (element.hasCountryElement()) {
36819        composeStringCore("country", element.getCountryElement(), false);
36820        composeStringExtras("country", element.getCountryElement(), false);
36821      }
36822      if (element.hasPeriod()) {
36823        composePeriod("period", element.getPeriod());
36824      }
36825  }
36826
36827  protected void composeAge(String name, Age element) throws IOException {
36828    if (element != null) {
36829      open(name);
36830      composeAgeProperties(element);
36831      close();
36832    }
36833  }
36834
36835  protected void composeAgeProperties(Age element) throws IOException {
36836    composeQuantityProperties(element);
36837  }
36838
36839  protected void composeAnnotation(String name, Annotation element) throws IOException {
36840    if (element != null) {
36841      open(name);
36842      composeAnnotationProperties(element);
36843      close();
36844    }
36845  }
36846
36847  protected void composeAnnotationProperties(Annotation element) throws IOException {
36848    composeDataTypeProperties(element);
36849      if (element.hasAuthor()) {
36850        composeType("author", element.getAuthor());
36851      }
36852      if (element.hasTimeElement()) {
36853        composeDateTimeCore("time", element.getTimeElement(), false);
36854        composeDateTimeExtras("time", element.getTimeElement(), false);
36855      }
36856      if (element.hasTextElement()) {
36857        composeMarkdownCore("text", element.getTextElement(), false);
36858        composeMarkdownExtras("text", element.getTextElement(), false);
36859      }
36860  }
36861
36862  protected void composeAttachment(String name, Attachment element) throws IOException {
36863    if (element != null) {
36864      open(name);
36865      composeAttachmentProperties(element);
36866      close();
36867    }
36868  }
36869
36870  protected void composeAttachmentProperties(Attachment element) throws IOException {
36871    composeDataTypeProperties(element);
36872      if (element.hasContentTypeElement()) {
36873        composeCodeCore("contentType", element.getContentTypeElement(), false);
36874        composeCodeExtras("contentType", element.getContentTypeElement(), false);
36875      }
36876      if (element.hasLanguageElement()) {
36877        composeCodeCore("language", element.getLanguageElement(), false);
36878        composeCodeExtras("language", element.getLanguageElement(), false);
36879      }
36880      if (element.hasDataElement()) {
36881        composeBase64BinaryCore("data", element.getDataElement(), false);
36882        composeBase64BinaryExtras("data", element.getDataElement(), false);
36883      }
36884      if (element.hasUrlElement()) {
36885        composeUrlCore("url", element.getUrlElement(), false);
36886        composeUrlExtras("url", element.getUrlElement(), false);
36887      }
36888      if (element.hasSizeElement()) {
36889        composeInteger64Core("size", element.getSizeElement(), false);
36890        composeInteger64Extras("size", element.getSizeElement(), false);
36891      }
36892      if (element.hasHashElement()) {
36893        composeBase64BinaryCore("hash", element.getHashElement(), false);
36894        composeBase64BinaryExtras("hash", element.getHashElement(), false);
36895      }
36896      if (element.hasTitleElement()) {
36897        composeStringCore("title", element.getTitleElement(), false);
36898        composeStringExtras("title", element.getTitleElement(), false);
36899      }
36900      if (element.hasCreationElement()) {
36901        composeDateTimeCore("creation", element.getCreationElement(), false);
36902        composeDateTimeExtras("creation", element.getCreationElement(), false);
36903      }
36904      if (element.hasHeightElement()) {
36905        composePositiveIntCore("height", element.getHeightElement(), false);
36906        composePositiveIntExtras("height", element.getHeightElement(), false);
36907      }
36908      if (element.hasWidthElement()) {
36909        composePositiveIntCore("width", element.getWidthElement(), false);
36910        composePositiveIntExtras("width", element.getWidthElement(), false);
36911      }
36912      if (element.hasFramesElement()) {
36913        composePositiveIntCore("frames", element.getFramesElement(), false);
36914        composePositiveIntExtras("frames", element.getFramesElement(), false);
36915      }
36916      if (element.hasDurationElement()) {
36917        composeDecimalCore("duration", element.getDurationElement(), false);
36918        composeDecimalExtras("duration", element.getDurationElement(), false);
36919      }
36920      if (element.hasPagesElement()) {
36921        composePositiveIntCore("pages", element.getPagesElement(), false);
36922        composePositiveIntExtras("pages", element.getPagesElement(), false);
36923      }
36924  }
36925
36926  protected void composeAvailability(String name, Availability element) throws IOException {
36927    if (element != null) {
36928      open(name);
36929      composeAvailabilityProperties(element);
36930      close();
36931    }
36932  }
36933
36934  protected void composeAvailabilityProperties(Availability element) throws IOException {
36935    composeDataTypeProperties(element);
36936      if (element.hasAvailableTime()) {
36937        openArray("availableTime");
36938        for (Availability.AvailabilityAvailableTimeComponent e : element.getAvailableTime()) 
36939          composeAvailabilityAvailableTimeComponent(null, e);
36940        closeArray();
36941      };
36942      if (element.hasNotAvailableTime()) {
36943        openArray("notAvailableTime");
36944        for (Availability.AvailabilityNotAvailableTimeComponent e : element.getNotAvailableTime()) 
36945          composeAvailabilityNotAvailableTimeComponent(null, e);
36946        closeArray();
36947      };
36948  }
36949
36950  protected void composeAvailabilityAvailableTimeComponent(String name, Availability.AvailabilityAvailableTimeComponent element) throws IOException {
36951    if (element != null) {
36952      open(name);
36953      composeAvailabilityAvailableTimeComponentProperties(element);
36954      close();
36955    }
36956  }
36957
36958  protected void composeAvailabilityAvailableTimeComponentProperties(Availability.AvailabilityAvailableTimeComponent element) throws IOException {
36959    composeElementProperties(element);
36960      if (element.hasDaysOfWeek()) {
36961        openArray("daysOfWeek");
36962        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
36963          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
36964        closeArray();
36965        if (anyHasExtras(element.getDaysOfWeek())) {
36966          openArray("_daysOfWeek");
36967          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
36968            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
36969          closeArray();
36970        }
36971      };
36972      if (element.hasAllDayElement()) {
36973        composeBooleanCore("allDay", element.getAllDayElement(), false);
36974        composeBooleanExtras("allDay", element.getAllDayElement(), false);
36975      }
36976      if (element.hasAvailableStartTimeElement()) {
36977        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
36978        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
36979      }
36980      if (element.hasAvailableEndTimeElement()) {
36981        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
36982        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
36983      }
36984  }
36985
36986  protected void composeAvailabilityNotAvailableTimeComponent(String name, Availability.AvailabilityNotAvailableTimeComponent element) throws IOException {
36987    if (element != null) {
36988      open(name);
36989      composeAvailabilityNotAvailableTimeComponentProperties(element);
36990      close();
36991    }
36992  }
36993
36994  protected void composeAvailabilityNotAvailableTimeComponentProperties(Availability.AvailabilityNotAvailableTimeComponent element) throws IOException {
36995    composeElementProperties(element);
36996      if (element.hasDescriptionElement()) {
36997        composeStringCore("description", element.getDescriptionElement(), false);
36998        composeStringExtras("description", element.getDescriptionElement(), false);
36999      }
37000      if (element.hasDuring()) {
37001        composePeriod("during", element.getDuring());
37002      }
37003  }
37004
37005  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
37006    if (element != null) {
37007      open(name);
37008      composeCodeableConceptProperties(element);
37009      close();
37010    }
37011  }
37012
37013  protected void composeCodeableConceptProperties(CodeableConcept element) throws IOException {
37014    composeDataTypeProperties(element);
37015      if (element.hasCoding()) {
37016        openArray("coding");
37017        for (Coding e : element.getCoding()) 
37018          composeCoding(null, e);
37019        closeArray();
37020      };
37021      if (element.hasTextElement()) {
37022        composeStringCore("text", element.getTextElement(), false);
37023        composeStringExtras("text", element.getTextElement(), false);
37024      }
37025  }
37026
37027  protected void composeCodeableReference(String name, CodeableReference element) throws IOException {
37028    if (element != null) {
37029      open(name);
37030      composeCodeableReferenceProperties(element);
37031      close();
37032    }
37033  }
37034
37035  protected void composeCodeableReferenceProperties(CodeableReference element) throws IOException {
37036    composeDataTypeProperties(element);
37037      if (element.hasConcept()) {
37038        composeCodeableConcept("concept", element.getConcept());
37039      }
37040      if (element.hasReference()) {
37041        composeReference("reference", element.getReference());
37042      }
37043  }
37044
37045  protected void composeCoding(String name, Coding element) throws IOException {
37046    if (element != null) {
37047      open(name);
37048      composeCodingProperties(element);
37049      close();
37050    }
37051  }
37052
37053  protected void composeCodingProperties(Coding element) throws IOException {
37054    composeDataTypeProperties(element);
37055      if (element.hasSystemElement()) {
37056        composeUriCore("system", element.getSystemElement(), false);
37057        composeUriExtras("system", element.getSystemElement(), false);
37058      }
37059      if (element.hasVersionElement()) {
37060        composeStringCore("version", element.getVersionElement(), false);
37061        composeStringExtras("version", element.getVersionElement(), false);
37062      }
37063      if (element.hasCodeElement()) {
37064        composeCodeCore("code", element.getCodeElement(), false);
37065        composeCodeExtras("code", element.getCodeElement(), false);
37066      }
37067      if (element.hasDisplayElement()) {
37068        composeStringCore("display", element.getDisplayElement(), false);
37069        composeStringExtras("display", element.getDisplayElement(), false);
37070      }
37071      if (element.hasUserSelectedElement()) {
37072        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
37073        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
37074      }
37075  }
37076
37077  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
37078    if (element != null) {
37079      open(name);
37080      composeContactDetailProperties(element);
37081      close();
37082    }
37083  }
37084
37085  protected void composeContactDetailProperties(ContactDetail element) throws IOException {
37086    composeDataTypeProperties(element);
37087      if (element.hasNameElement()) {
37088        composeStringCore("name", element.getNameElement(), false);
37089        composeStringExtras("name", element.getNameElement(), false);
37090      }
37091      if (element.hasTelecom()) {
37092        openArray("telecom");
37093        for (ContactPoint e : element.getTelecom()) 
37094          composeContactPoint(null, e);
37095        closeArray();
37096      };
37097  }
37098
37099  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
37100    if (element != null) {
37101      open(name);
37102      composeContactPointProperties(element);
37103      close();
37104    }
37105  }
37106
37107  protected void composeContactPointProperties(ContactPoint element) throws IOException {
37108    composeDataTypeProperties(element);
37109      if (element.hasSystemElement()) {
37110        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
37111        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
37112      }
37113      if (element.hasValueElement()) {
37114        composeStringCore("value", element.getValueElement(), false);
37115        composeStringExtras("value", element.getValueElement(), false);
37116      }
37117      if (element.hasUseElement()) {
37118        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
37119        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
37120      }
37121      if (element.hasRankElement()) {
37122        composePositiveIntCore("rank", element.getRankElement(), false);
37123        composePositiveIntExtras("rank", element.getRankElement(), false);
37124      }
37125      if (element.hasPeriod()) {
37126        composePeriod("period", element.getPeriod());
37127      }
37128  }
37129
37130  protected void composeContributor(String name, Contributor element) throws IOException {
37131    if (element != null) {
37132      open(name);
37133      composeContributorProperties(element);
37134      close();
37135    }
37136  }
37137
37138  protected void composeContributorProperties(Contributor element) throws IOException {
37139    composeDataTypeProperties(element);
37140      if (element.hasTypeElement()) {
37141        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
37142        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
37143      }
37144      if (element.hasNameElement()) {
37145        composeStringCore("name", element.getNameElement(), false);
37146        composeStringExtras("name", element.getNameElement(), false);
37147      }
37148      if (element.hasContact()) {
37149        openArray("contact");
37150        for (ContactDetail e : element.getContact()) 
37151          composeContactDetail(null, e);
37152        closeArray();
37153      };
37154  }
37155
37156  protected void composeCount(String name, Count element) throws IOException {
37157    if (element != null) {
37158      open(name);
37159      composeCountProperties(element);
37160      close();
37161    }
37162  }
37163
37164  protected void composeCountProperties(Count element) throws IOException {
37165    composeQuantityProperties(element);
37166  }
37167
37168  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
37169    if (element != null) {
37170      open(name);
37171      composeDataRequirementProperties(element);
37172      close();
37173    }
37174  }
37175
37176  protected void composeDataRequirementProperties(DataRequirement element) throws IOException {
37177    composeDataTypeProperties(element);
37178      if (element.hasTypeElement()) {
37179        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
37180        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
37181      }
37182      if (element.hasProfile()) {
37183        if (anyHasValue(element.getProfile())) {
37184          openArray("profile");
37185          for (CanonicalType e : element.getProfile()) 
37186            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
37187          closeArray();
37188        }
37189        if (anyHasExtras(element.getProfile())) {
37190          openArray("_profile");
37191          for (CanonicalType e : element.getProfile()) 
37192            composeCanonicalExtras(null, e, true);
37193          closeArray();
37194        }
37195      };
37196      if (element.hasSubject()) {
37197        composeType("subject", element.getSubject());
37198      }
37199      if (element.hasMustSupport()) {
37200        if (anyHasValue(element.getMustSupport())) {
37201          openArray("mustSupport");
37202          for (StringType e : element.getMustSupport()) 
37203            composeStringCore(null, e, e != element.getMustSupport().get(element.getMustSupport().size()-1));
37204          closeArray();
37205        }
37206        if (anyHasExtras(element.getMustSupport())) {
37207          openArray("_mustSupport");
37208          for (StringType e : element.getMustSupport()) 
37209            composeStringExtras(null, e, true);
37210          closeArray();
37211        }
37212      };
37213      if (element.hasCodeFilter()) {
37214        openArray("codeFilter");
37215        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
37216          composeDataRequirementCodeFilterComponent(null, e);
37217        closeArray();
37218      };
37219      if (element.hasDateFilter()) {
37220        openArray("dateFilter");
37221        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
37222          composeDataRequirementDateFilterComponent(null, e);
37223        closeArray();
37224      };
37225      if (element.hasValueFilter()) {
37226        openArray("valueFilter");
37227        for (DataRequirement.DataRequirementValueFilterComponent e : element.getValueFilter()) 
37228          composeDataRequirementValueFilterComponent(null, e);
37229        closeArray();
37230      };
37231      if (element.hasLimitElement()) {
37232        composePositiveIntCore("limit", element.getLimitElement(), false);
37233        composePositiveIntExtras("limit", element.getLimitElement(), false);
37234      }
37235      if (element.hasSort()) {
37236        openArray("sort");
37237        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
37238          composeDataRequirementSortComponent(null, e);
37239        closeArray();
37240      };
37241  }
37242
37243  protected void composeDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
37244    if (element != null) {
37245      open(name);
37246      composeDataRequirementCodeFilterComponentProperties(element);
37247      close();
37248    }
37249  }
37250
37251  protected void composeDataRequirementCodeFilterComponentProperties(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
37252    composeElementProperties(element);
37253      if (element.hasPathElement()) {
37254        composeStringCore("path", element.getPathElement(), false);
37255        composeStringExtras("path", element.getPathElement(), false);
37256      }
37257      if (element.hasSearchParamElement()) {
37258        composeStringCore("searchParam", element.getSearchParamElement(), false);
37259        composeStringExtras("searchParam", element.getSearchParamElement(), false);
37260      }
37261      if (element.hasValueSetElement()) {
37262        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37263        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37264      }
37265      if (element.hasCode()) {
37266        openArray("code");
37267        for (Coding e : element.getCode()) 
37268          composeCoding(null, e);
37269        closeArray();
37270      };
37271  }
37272
37273  protected void composeDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
37274    if (element != null) {
37275      open(name);
37276      composeDataRequirementDateFilterComponentProperties(element);
37277      close();
37278    }
37279  }
37280
37281  protected void composeDataRequirementDateFilterComponentProperties(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
37282    composeElementProperties(element);
37283      if (element.hasPathElement()) {
37284        composeStringCore("path", element.getPathElement(), false);
37285        composeStringExtras("path", element.getPathElement(), false);
37286      }
37287      if (element.hasSearchParamElement()) {
37288        composeStringCore("searchParam", element.getSearchParamElement(), false);
37289        composeStringExtras("searchParam", element.getSearchParamElement(), false);
37290      }
37291      if (element.hasValue()) {
37292        composeType("value", element.getValue());
37293      }
37294  }
37295
37296  protected void composeDataRequirementValueFilterComponent(String name, DataRequirement.DataRequirementValueFilterComponent element) throws IOException {
37297    if (element != null) {
37298      open(name);
37299      composeDataRequirementValueFilterComponentProperties(element);
37300      close();
37301    }
37302  }
37303
37304  protected void composeDataRequirementValueFilterComponentProperties(DataRequirement.DataRequirementValueFilterComponent element) throws IOException {
37305    composeElementProperties(element);
37306      if (element.hasPathElement()) {
37307        composeStringCore("path", element.getPathElement(), false);
37308        composeStringExtras("path", element.getPathElement(), false);
37309      }
37310      if (element.hasSearchParamElement()) {
37311        composeStringCore("searchParam", element.getSearchParamElement(), false);
37312        composeStringExtras("searchParam", element.getSearchParamElement(), false);
37313      }
37314      if (element.hasComparatorElement()) {
37315        composeEnumerationCore("comparator", element.getComparatorElement(), new DataRequirement.ValueFilterComparatorEnumFactory(), false);
37316        composeEnumerationExtras("comparator", element.getComparatorElement(), new DataRequirement.ValueFilterComparatorEnumFactory(), false);
37317      }
37318      if (element.hasValue()) {
37319        composeType("value", element.getValue());
37320      }
37321  }
37322
37323  protected void composeDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
37324    if (element != null) {
37325      open(name);
37326      composeDataRequirementSortComponentProperties(element);
37327      close();
37328    }
37329  }
37330
37331  protected void composeDataRequirementSortComponentProperties(DataRequirement.DataRequirementSortComponent element) throws IOException {
37332    composeElementProperties(element);
37333      if (element.hasPathElement()) {
37334        composeStringCore("path", element.getPathElement(), false);
37335        composeStringExtras("path", element.getPathElement(), false);
37336      }
37337      if (element.hasDirectionElement()) {
37338        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
37339        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
37340      }
37341  }
37342
37343  protected void composeDistance(String name, Distance element) throws IOException {
37344    if (element != null) {
37345      open(name);
37346      composeDistanceProperties(element);
37347      close();
37348    }
37349  }
37350
37351  protected void composeDistanceProperties(Distance element) throws IOException {
37352    composeQuantityProperties(element);
37353  }
37354
37355  protected void composeDosage(String name, Dosage element) throws IOException {
37356    if (element != null) {
37357      open(name);
37358      composeDosageProperties(element);
37359      close();
37360    }
37361  }
37362
37363  protected void composeDosageProperties(Dosage element) throws IOException {
37364    composeBackboneTypeProperties(element);
37365      if (element.hasSequenceElement()) {
37366        composeIntegerCore("sequence", element.getSequenceElement(), false);
37367        composeIntegerExtras("sequence", element.getSequenceElement(), false);
37368      }
37369      if (element.hasTextElement()) {
37370        composeStringCore("text", element.getTextElement(), false);
37371        composeStringExtras("text", element.getTextElement(), false);
37372      }
37373      if (element.hasAdditionalInstruction()) {
37374        openArray("additionalInstruction");
37375        for (CodeableConcept e : element.getAdditionalInstruction()) 
37376          composeCodeableConcept(null, e);
37377        closeArray();
37378      };
37379      if (element.hasPatientInstructionElement()) {
37380        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
37381        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
37382      }
37383      if (element.hasTiming()) {
37384        composeTiming("timing", element.getTiming());
37385      }
37386      if (element.hasAsNeededElement()) {
37387        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
37388        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
37389      }
37390      if (element.hasAsNeededFor()) {
37391        openArray("asNeededFor");
37392        for (CodeableConcept e : element.getAsNeededFor()) 
37393          composeCodeableConcept(null, e);
37394        closeArray();
37395      };
37396      if (element.hasSite()) {
37397        composeCodeableConcept("site", element.getSite());
37398      }
37399      if (element.hasRoute()) {
37400        composeCodeableConcept("route", element.getRoute());
37401      }
37402      if (element.hasMethod()) {
37403        composeCodeableConcept("method", element.getMethod());
37404      }
37405      if (element.hasDoseAndRate()) {
37406        openArray("doseAndRate");
37407        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
37408          composeDosageDoseAndRateComponent(null, e);
37409        closeArray();
37410      };
37411      if (element.hasMaxDosePerPeriod()) {
37412        openArray("maxDosePerPeriod");
37413        for (Ratio e : element.getMaxDosePerPeriod()) 
37414          composeRatio(null, e);
37415        closeArray();
37416      };
37417      if (element.hasMaxDosePerAdministration()) {
37418        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
37419      }
37420      if (element.hasMaxDosePerLifetime()) {
37421        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
37422      }
37423  }
37424
37425  protected void composeDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
37426    if (element != null) {
37427      open(name);
37428      composeDosageDoseAndRateComponentProperties(element);
37429      close();
37430    }
37431  }
37432
37433  protected void composeDosageDoseAndRateComponentProperties(Dosage.DosageDoseAndRateComponent element) throws IOException {
37434    composeElementProperties(element);
37435      if (element.hasType()) {
37436        composeCodeableConcept("type", element.getType());
37437      }
37438      if (element.hasDose()) {
37439        composeType("dose", element.getDose());
37440      }
37441      if (element.hasRate()) {
37442        composeType("rate", element.getRate());
37443      }
37444  }
37445
37446  protected void composeDuration(String name, Duration element) throws IOException {
37447    if (element != null) {
37448      open(name);
37449      composeDurationProperties(element);
37450      close();
37451    }
37452  }
37453
37454  protected void composeDurationProperties(Duration element) throws IOException {
37455    composeQuantityProperties(element);
37456  }
37457
37458  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
37459    if (element != null) {
37460      open(name);
37461      composeElementDefinitionProperties(element);
37462      close();
37463    }
37464  }
37465
37466  protected void composeElementDefinitionProperties(ElementDefinition element) throws IOException {
37467    composeBackboneTypeProperties(element);
37468      if (element.hasPathElement()) {
37469        composeStringCore("path", element.getPathElement(), false);
37470        composeStringExtras("path", element.getPathElement(), false);
37471      }
37472      if (element.hasRepresentation()) {
37473        openArray("representation");
37474        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
37475          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
37476        closeArray();
37477        if (anyHasExtras(element.getRepresentation())) {
37478          openArray("_representation");
37479          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
37480            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
37481          closeArray();
37482        }
37483      };
37484      if (element.hasSliceNameElement()) {
37485        composeStringCore("sliceName", element.getSliceNameElement(), false);
37486        composeStringExtras("sliceName", element.getSliceNameElement(), false);
37487      }
37488      if (element.hasSliceIsConstrainingElement()) {
37489        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
37490        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
37491      }
37492      if (element.hasLabelElement()) {
37493        composeStringCore("label", element.getLabelElement(), false);
37494        composeStringExtras("label", element.getLabelElement(), false);
37495      }
37496      if (element.hasCode()) {
37497        openArray("code");
37498        for (Coding e : element.getCode()) 
37499          composeCoding(null, e);
37500        closeArray();
37501      };
37502      if (element.hasSlicing()) {
37503        composeElementDefinitionSlicingComponent("slicing", element.getSlicing());
37504      }
37505      if (element.hasShortElement()) {
37506        composeStringCore("short", element.getShortElement(), false);
37507        composeStringExtras("short", element.getShortElement(), false);
37508      }
37509      if (element.hasDefinitionElement()) {
37510        composeMarkdownCore("definition", element.getDefinitionElement(), false);
37511        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
37512      }
37513      if (element.hasCommentElement()) {
37514        composeMarkdownCore("comment", element.getCommentElement(), false);
37515        composeMarkdownExtras("comment", element.getCommentElement(), false);
37516      }
37517      if (element.hasRequirementsElement()) {
37518        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
37519        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
37520      }
37521      if (element.hasAlias()) {
37522        if (anyHasValue(element.getAlias())) {
37523          openArray("alias");
37524          for (StringType e : element.getAlias()) 
37525            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
37526          closeArray();
37527        }
37528        if (anyHasExtras(element.getAlias())) {
37529          openArray("_alias");
37530          for (StringType e : element.getAlias()) 
37531            composeStringExtras(null, e, true);
37532          closeArray();
37533        }
37534      };
37535      if (element.hasMinElement()) {
37536        composeUnsignedIntCore("min", element.getMinElement(), false);
37537        composeUnsignedIntExtras("min", element.getMinElement(), false);
37538      }
37539      if (element.hasMaxElement()) {
37540        composeStringCore("max", element.getMaxElement(), false);
37541        composeStringExtras("max", element.getMaxElement(), false);
37542      }
37543      if (element.hasBase()) {
37544        composeElementDefinitionBaseComponent("base", element.getBase());
37545      }
37546      if (element.hasContentReferenceElement()) {
37547        composeUriCore("contentReference", element.getContentReferenceElement(), false);
37548        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
37549      }
37550      if (element.hasType()) {
37551        openArray("type");
37552        for (ElementDefinition.TypeRefComponent e : element.getType()) 
37553          composeTypeRefComponent(null, e);
37554        closeArray();
37555      };
37556      if (element.hasDefaultValue()) {
37557        composeType("defaultValue", element.getDefaultValue());
37558      }
37559      if (element.hasMeaningWhenMissingElement()) {
37560        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
37561        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
37562      }
37563      if (element.hasOrderMeaningElement()) {
37564        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
37565        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
37566      }
37567      if (element.hasFixed()) {
37568        composeType("fixed", element.getFixed());
37569      }
37570      if (element.hasPattern()) {
37571        composeType("pattern", element.getPattern());
37572      }
37573      if (element.hasExample()) {
37574        openArray("example");
37575        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
37576          composeElementDefinitionExampleComponent(null, e);
37577        closeArray();
37578      };
37579      if (element.hasMinValue()) {
37580        composeType("minValue", element.getMinValue());
37581      }
37582      if (element.hasMaxValue()) {
37583        composeType("maxValue", element.getMaxValue());
37584      }
37585      if (element.hasMaxLengthElement()) {
37586        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
37587        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
37588      }
37589      if (element.hasCondition()) {
37590        if (anyHasValue(element.getCondition())) {
37591          openArray("condition");
37592          for (IdType e : element.getCondition()) 
37593            composeIdCore(null, e, e != element.getCondition().get(element.getCondition().size()-1));
37594          closeArray();
37595        }
37596        if (anyHasExtras(element.getCondition())) {
37597          openArray("_condition");
37598          for (IdType e : element.getCondition()) 
37599            composeIdExtras(null, e, true);
37600          closeArray();
37601        }
37602      };
37603      if (element.hasConstraint()) {
37604        openArray("constraint");
37605        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
37606          composeElementDefinitionConstraintComponent(null, e);
37607        closeArray();
37608      };
37609      if (element.hasMustHaveValueElement()) {
37610        composeBooleanCore("mustHaveValue", element.getMustHaveValueElement(), false);
37611        composeBooleanExtras("mustHaveValue", element.getMustHaveValueElement(), false);
37612      }
37613      if (element.hasValueAlternatives()) {
37614        if (anyHasValue(element.getValueAlternatives())) {
37615          openArray("valueAlternatives");
37616          for (CanonicalType e : element.getValueAlternatives()) 
37617            composeCanonicalCore(null, e, e != element.getValueAlternatives().get(element.getValueAlternatives().size()-1));
37618          closeArray();
37619        }
37620        if (anyHasExtras(element.getValueAlternatives())) {
37621          openArray("_valueAlternatives");
37622          for (CanonicalType e : element.getValueAlternatives()) 
37623            composeCanonicalExtras(null, e, true);
37624          closeArray();
37625        }
37626      };
37627      if (element.hasMustSupportElement()) {
37628        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
37629        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
37630      }
37631      if (element.hasIsModifierElement()) {
37632        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
37633        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
37634      }
37635      if (element.hasIsModifierReasonElement()) {
37636        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
37637        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
37638      }
37639      if (element.hasIsSummaryElement()) {
37640        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
37641        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
37642      }
37643      if (element.hasBinding()) {
37644        composeElementDefinitionBindingComponent("binding", element.getBinding());
37645      }
37646      if (element.hasMapping()) {
37647        openArray("mapping");
37648        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
37649          composeElementDefinitionMappingComponent(null, e);
37650        closeArray();
37651      };
37652  }
37653
37654  protected void composeElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
37655    if (element != null) {
37656      open(name);
37657      composeElementDefinitionSlicingComponentProperties(element);
37658      close();
37659    }
37660  }
37661
37662  protected void composeElementDefinitionSlicingComponentProperties(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
37663    composeElementProperties(element);
37664      if (element.hasDiscriminator()) {
37665        openArray("discriminator");
37666        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
37667          composeElementDefinitionSlicingDiscriminatorComponent(null, e);
37668        closeArray();
37669      };
37670      if (element.hasDescriptionElement()) {
37671        composeStringCore("description", element.getDescriptionElement(), false);
37672        composeStringExtras("description", element.getDescriptionElement(), false);
37673      }
37674      if (element.hasOrderedElement()) {
37675        composeBooleanCore("ordered", element.getOrderedElement(), false);
37676        composeBooleanExtras("ordered", element.getOrderedElement(), false);
37677      }
37678      if (element.hasRulesElement()) {
37679        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
37680        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
37681      }
37682  }
37683
37684  protected void composeElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
37685    if (element != null) {
37686      open(name);
37687      composeElementDefinitionSlicingDiscriminatorComponentProperties(element);
37688      close();
37689    }
37690  }
37691
37692  protected void composeElementDefinitionSlicingDiscriminatorComponentProperties(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
37693    composeElementProperties(element);
37694      if (element.hasTypeElement()) {
37695        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
37696        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
37697      }
37698      if (element.hasPathElement()) {
37699        composeStringCore("path", element.getPathElement(), false);
37700        composeStringExtras("path", element.getPathElement(), false);
37701      }
37702  }
37703
37704  protected void composeElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
37705    if (element != null) {
37706      open(name);
37707      composeElementDefinitionBaseComponentProperties(element);
37708      close();
37709    }
37710  }
37711
37712  protected void composeElementDefinitionBaseComponentProperties(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
37713    composeElementProperties(element);
37714      if (element.hasPathElement()) {
37715        composeStringCore("path", element.getPathElement(), false);
37716        composeStringExtras("path", element.getPathElement(), false);
37717      }
37718      if (element.hasMinElement()) {
37719        composeUnsignedIntCore("min", element.getMinElement(), false);
37720        composeUnsignedIntExtras("min", element.getMinElement(), false);
37721      }
37722      if (element.hasMaxElement()) {
37723        composeStringCore("max", element.getMaxElement(), false);
37724        composeStringExtras("max", element.getMaxElement(), false);
37725      }
37726  }
37727
37728  protected void composeTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
37729    if (element != null) {
37730      open(name);
37731      composeTypeRefComponentProperties(element);
37732      close();
37733    }
37734  }
37735
37736  protected void composeTypeRefComponentProperties(ElementDefinition.TypeRefComponent element) throws IOException {
37737    composeElementProperties(element);
37738      if (element.hasCodeElement()) {
37739        composeUriCore("code", element.getCodeElement(), false);
37740        composeUriExtras("code", element.getCodeElement(), false);
37741      }
37742      if (element.hasProfile()) {
37743        if (anyHasValue(element.getProfile())) {
37744          openArray("profile");
37745          for (CanonicalType e : element.getProfile()) 
37746            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
37747          closeArray();
37748        }
37749        if (anyHasExtras(element.getProfile())) {
37750          openArray("_profile");
37751          for (CanonicalType e : element.getProfile()) 
37752            composeCanonicalExtras(null, e, true);
37753          closeArray();
37754        }
37755      };
37756      if (element.hasTargetProfile()) {
37757        if (anyHasValue(element.getTargetProfile())) {
37758          openArray("targetProfile");
37759          for (CanonicalType e : element.getTargetProfile()) 
37760            composeCanonicalCore(null, e, e != element.getTargetProfile().get(element.getTargetProfile().size()-1));
37761          closeArray();
37762        }
37763        if (anyHasExtras(element.getTargetProfile())) {
37764          openArray("_targetProfile");
37765          for (CanonicalType e : element.getTargetProfile()) 
37766            composeCanonicalExtras(null, e, true);
37767          closeArray();
37768        }
37769      };
37770      if (element.hasAggregation()) {
37771        openArray("aggregation");
37772        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
37773          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
37774        closeArray();
37775        if (anyHasExtras(element.getAggregation())) {
37776          openArray("_aggregation");
37777          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
37778            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
37779          closeArray();
37780        }
37781      };
37782      if (element.hasVersioningElement()) {
37783        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
37784        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
37785      }
37786  }
37787
37788  protected void composeElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
37789    if (element != null) {
37790      open(name);
37791      composeElementDefinitionExampleComponentProperties(element);
37792      close();
37793    }
37794  }
37795
37796  protected void composeElementDefinitionExampleComponentProperties(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
37797    composeElementProperties(element);
37798      if (element.hasLabelElement()) {
37799        composeStringCore("label", element.getLabelElement(), false);
37800        composeStringExtras("label", element.getLabelElement(), false);
37801      }
37802      if (element.hasValue()) {
37803        composeType("value", element.getValue());
37804      }
37805  }
37806
37807  protected void composeElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
37808    if (element != null) {
37809      open(name);
37810      composeElementDefinitionConstraintComponentProperties(element);
37811      close();
37812    }
37813  }
37814
37815  protected void composeElementDefinitionConstraintComponentProperties(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
37816    composeElementProperties(element);
37817      if (element.hasKeyElement()) {
37818        composeIdCore("key", element.getKeyElement(), false);
37819        composeIdExtras("key", element.getKeyElement(), false);
37820      }
37821      if (element.hasRequirementsElement()) {
37822        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
37823        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
37824      }
37825      if (element.hasSeverityElement()) {
37826        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
37827        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
37828      }
37829      if (element.hasSuppressElement()) {
37830        composeBooleanCore("suppress", element.getSuppressElement(), false);
37831        composeBooleanExtras("suppress", element.getSuppressElement(), false);
37832      }
37833      if (element.hasHumanElement()) {
37834        composeStringCore("human", element.getHumanElement(), false);
37835        composeStringExtras("human", element.getHumanElement(), false);
37836      }
37837      if (element.hasExpressionElement()) {
37838        composeStringCore("expression", element.getExpressionElement(), false);
37839        composeStringExtras("expression", element.getExpressionElement(), false);
37840      }
37841      if (element.hasSourceElement()) {
37842        composeCanonicalCore("source", element.getSourceElement(), false);
37843        composeCanonicalExtras("source", element.getSourceElement(), false);
37844      }
37845  }
37846
37847  protected void composeElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
37848    if (element != null) {
37849      open(name);
37850      composeElementDefinitionBindingComponentProperties(element);
37851      close();
37852    }
37853  }
37854
37855  protected void composeElementDefinitionBindingComponentProperties(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
37856    composeElementProperties(element);
37857      if (element.hasStrengthElement()) {
37858        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
37859        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
37860      }
37861      if (element.hasDescriptionElement()) {
37862        composeMarkdownCore("description", element.getDescriptionElement(), false);
37863        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37864      }
37865      if (element.hasValueSetElement()) {
37866        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37867        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37868      }
37869      if (element.hasAdditional()) {
37870        openArray("additional");
37871        for (ElementDefinition.ElementDefinitionBindingAdditionalComponent e : element.getAdditional()) 
37872          composeElementDefinitionBindingAdditionalComponent(null, e);
37873        closeArray();
37874      };
37875  }
37876
37877  protected void composeElementDefinitionBindingAdditionalComponent(String name, ElementDefinition.ElementDefinitionBindingAdditionalComponent element) throws IOException {
37878    if (element != null) {
37879      open(name);
37880      composeElementDefinitionBindingAdditionalComponentProperties(element);
37881      close();
37882    }
37883  }
37884
37885  protected void composeElementDefinitionBindingAdditionalComponentProperties(ElementDefinition.ElementDefinitionBindingAdditionalComponent element) throws IOException {
37886    composeElementProperties(element);
37887      if (element.hasPurposeElement()) {
37888        composeEnumerationCore("purpose", element.getPurposeElement(), new ElementDefinition.AdditionalBindingPurposeVSEnumFactory(), false);
37889        composeEnumerationExtras("purpose", element.getPurposeElement(), new ElementDefinition.AdditionalBindingPurposeVSEnumFactory(), false);
37890      }
37891      if (element.hasValueSetElement()) {
37892        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37893        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37894      }
37895      if (element.hasDocumentationElement()) {
37896        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37897        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37898      }
37899      if (element.hasShortDocoElement()) {
37900        composeStringCore("shortDoco", element.getShortDocoElement(), false);
37901        composeStringExtras("shortDoco", element.getShortDocoElement(), false);
37902      }
37903      if (element.hasUsage()) {
37904        openArray("usage");
37905        for (UsageContext e : element.getUsage()) 
37906          composeUsageContext(null, e);
37907        closeArray();
37908      };
37909      if (element.hasAnyElement()) {
37910        composeBooleanCore("any", element.getAnyElement(), false);
37911        composeBooleanExtras("any", element.getAnyElement(), false);
37912      }
37913  }
37914
37915  protected void composeElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
37916    if (element != null) {
37917      open(name);
37918      composeElementDefinitionMappingComponentProperties(element);
37919      close();
37920    }
37921  }
37922
37923  protected void composeElementDefinitionMappingComponentProperties(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
37924    composeElementProperties(element);
37925      if (element.hasIdentityElement()) {
37926        composeIdCore("identity", element.getIdentityElement(), false);
37927        composeIdExtras("identity", element.getIdentityElement(), false);
37928      }
37929      if (element.hasLanguageElement()) {
37930        composeCodeCore("language", element.getLanguageElement(), false);
37931        composeCodeExtras("language", element.getLanguageElement(), false);
37932      }
37933      if (element.hasMapElement()) {
37934        composeStringCore("map", element.getMapElement(), false);
37935        composeStringExtras("map", element.getMapElement(), false);
37936      }
37937      if (element.hasCommentElement()) {
37938        composeMarkdownCore("comment", element.getCommentElement(), false);
37939        composeMarkdownExtras("comment", element.getCommentElement(), false);
37940      }
37941  }
37942
37943  protected void composeExpression(String name, Expression element) throws IOException {
37944    if (element != null) {
37945      open(name);
37946      composeExpressionProperties(element);
37947      close();
37948    }
37949  }
37950
37951  protected void composeExpressionProperties(Expression element) throws IOException {
37952    composeDataTypeProperties(element);
37953      if (element.hasDescriptionElement()) {
37954        composeStringCore("description", element.getDescriptionElement(), false);
37955        composeStringExtras("description", element.getDescriptionElement(), false);
37956      }
37957      if (element.hasNameElement()) {
37958        composeCodeCore("name", element.getNameElement(), false);
37959        composeCodeExtras("name", element.getNameElement(), false);
37960      }
37961      if (element.hasLanguageElement()) {
37962        composeCodeCore("language", element.getLanguageElement(), false);
37963        composeCodeExtras("language", element.getLanguageElement(), false);
37964      }
37965      if (element.hasExpressionElement()) {
37966        composeStringCore("expression", element.getExpressionElement(), false);
37967        composeStringExtras("expression", element.getExpressionElement(), false);
37968      }
37969      if (element.hasReferenceElement()) {
37970        composeUriCore("reference", element.getReferenceElement(), false);
37971        composeUriExtras("reference", element.getReferenceElement(), false);
37972      }
37973  }
37974
37975  protected void composeExtendedContactDetail(String name, ExtendedContactDetail element) throws IOException {
37976    if (element != null) {
37977      open(name);
37978      composeExtendedContactDetailProperties(element);
37979      close();
37980    }
37981  }
37982
37983  protected void composeExtendedContactDetailProperties(ExtendedContactDetail element) throws IOException {
37984    composeDataTypeProperties(element);
37985      if (element.hasPurpose()) {
37986        composeCodeableConcept("purpose", element.getPurpose());
37987      }
37988      if (element.hasName()) {
37989        openArray("name");
37990        for (HumanName e : element.getName()) 
37991          composeHumanName(null, e);
37992        closeArray();
37993      };
37994      if (element.hasTelecom()) {
37995        openArray("telecom");
37996        for (ContactPoint e : element.getTelecom()) 
37997          composeContactPoint(null, e);
37998        closeArray();
37999      };
38000      if (element.hasAddress()) {
38001        composeAddress("address", element.getAddress());
38002      }
38003      if (element.hasOrganization()) {
38004        composeReference("organization", element.getOrganization());
38005      }
38006      if (element.hasPeriod()) {
38007        composePeriod("period", element.getPeriod());
38008      }
38009  }
38010
38011  protected void composeExtension(String name, Extension element) throws IOException {
38012    if (element != null) {
38013      open(name);
38014      composeExtensionProperties(element);
38015      close();
38016    }
38017  }
38018
38019  protected void composeExtensionProperties(Extension element) throws IOException {
38020    composeDataTypeProperties(element);
38021      if (element.hasUrlElement()) {
38022        composeUriCore("url", element.getUrlElement(), false);
38023        composeUriExtras("url", element.getUrlElement(), false);
38024      }
38025      if (element.hasValue()) {
38026        composeType("value", element.getValue());
38027      }
38028  }
38029
38030  protected void composeHumanName(String name, HumanName element) throws IOException {
38031    if (element != null) {
38032      open(name);
38033      composeHumanNameProperties(element);
38034      close();
38035    }
38036  }
38037
38038  protected void composeHumanNameProperties(HumanName element) throws IOException {
38039    composeDataTypeProperties(element);
38040      if (element.hasUseElement()) {
38041        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
38042        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
38043      }
38044      if (element.hasTextElement()) {
38045        composeStringCore("text", element.getTextElement(), false);
38046        composeStringExtras("text", element.getTextElement(), false);
38047      }
38048      if (element.hasFamilyElement()) {
38049        composeStringCore("family", element.getFamilyElement(), false);
38050        composeStringExtras("family", element.getFamilyElement(), false);
38051      }
38052      if (element.hasGiven()) {
38053        if (anyHasValue(element.getGiven())) {
38054          openArray("given");
38055          for (StringType e : element.getGiven()) 
38056            composeStringCore(null, e, e != element.getGiven().get(element.getGiven().size()-1));
38057          closeArray();
38058        }
38059        if (anyHasExtras(element.getGiven())) {
38060          openArray("_given");
38061          for (StringType e : element.getGiven()) 
38062            composeStringExtras(null, e, true);
38063          closeArray();
38064        }
38065      };
38066      if (element.hasPrefix()) {
38067        if (anyHasValue(element.getPrefix())) {
38068          openArray("prefix");
38069          for (StringType e : element.getPrefix()) 
38070            composeStringCore(null, e, e != element.getPrefix().get(element.getPrefix().size()-1));
38071          closeArray();
38072        }
38073        if (anyHasExtras(element.getPrefix())) {
38074          openArray("_prefix");
38075          for (StringType e : element.getPrefix()) 
38076            composeStringExtras(null, e, true);
38077          closeArray();
38078        }
38079      };
38080      if (element.hasSuffix()) {
38081        if (anyHasValue(element.getSuffix())) {
38082          openArray("suffix");
38083          for (StringType e : element.getSuffix()) 
38084            composeStringCore(null, e, e != element.getSuffix().get(element.getSuffix().size()-1));
38085          closeArray();
38086        }
38087        if (anyHasExtras(element.getSuffix())) {
38088          openArray("_suffix");
38089          for (StringType e : element.getSuffix()) 
38090            composeStringExtras(null, e, true);
38091          closeArray();
38092        }
38093      };
38094      if (element.hasPeriod()) {
38095        composePeriod("period", element.getPeriod());
38096      }
38097  }
38098
38099  protected void composeIdentifier(String name, Identifier element) throws IOException {
38100    if (element != null) {
38101      open(name);
38102      composeIdentifierProperties(element);
38103      close();
38104    }
38105  }
38106
38107  protected void composeIdentifierProperties(Identifier element) throws IOException {
38108    composeDataTypeProperties(element);
38109      if (element.hasUseElement()) {
38110        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
38111        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
38112      }
38113      if (element.hasType()) {
38114        composeCodeableConcept("type", element.getType());
38115      }
38116      if (element.hasSystemElement()) {
38117        composeUriCore("system", element.getSystemElement(), false);
38118        composeUriExtras("system", element.getSystemElement(), false);
38119      }
38120      if (element.hasValueElement()) {
38121        composeStringCore("value", element.getValueElement(), false);
38122        composeStringExtras("value", element.getValueElement(), false);
38123      }
38124      if (element.hasPeriod()) {
38125        composePeriod("period", element.getPeriod());
38126      }
38127      if (element.hasAssigner()) {
38128        composeReference("assigner", element.getAssigner());
38129      }
38130  }
38131
38132  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
38133    if (element != null) {
38134      open(name);
38135      composeMarketingStatusProperties(element);
38136      close();
38137    }
38138  }
38139
38140  protected void composeMarketingStatusProperties(MarketingStatus element) throws IOException {
38141    composeBackboneTypeProperties(element);
38142      if (element.hasCountry()) {
38143        composeCodeableConcept("country", element.getCountry());
38144      }
38145      if (element.hasJurisdiction()) {
38146        composeCodeableConcept("jurisdiction", element.getJurisdiction());
38147      }
38148      if (element.hasStatus()) {
38149        composeCodeableConcept("status", element.getStatus());
38150      }
38151      if (element.hasDateRange()) {
38152        composePeriod("dateRange", element.getDateRange());
38153      }
38154      if (element.hasRestoreDateElement()) {
38155        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
38156        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
38157      }
38158  }
38159
38160  protected void composeMeta(String name, Meta element) throws IOException {
38161    if (element != null) {
38162      open(name);
38163      composeMetaProperties(element);
38164      close();
38165    }
38166  }
38167
38168  protected void composeMetaProperties(Meta element) throws IOException {
38169    composeDataTypeProperties(element);
38170      if (element.hasVersionIdElement()) {
38171        composeIdCore("versionId", element.getVersionIdElement(), false);
38172        composeIdExtras("versionId", element.getVersionIdElement(), false);
38173      }
38174      if (element.hasLastUpdatedElement()) {
38175        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
38176        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
38177      }
38178      if (element.hasSourceElement()) {
38179        composeUriCore("source", element.getSourceElement(), false);
38180        composeUriExtras("source", element.getSourceElement(), false);
38181      }
38182      if (element.hasProfile()) {
38183        if (anyHasValue(element.getProfile())) {
38184          openArray("profile");
38185          for (CanonicalType e : element.getProfile()) 
38186            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
38187          closeArray();
38188        }
38189        if (anyHasExtras(element.getProfile())) {
38190          openArray("_profile");
38191          for (CanonicalType e : element.getProfile()) 
38192            composeCanonicalExtras(null, e, true);
38193          closeArray();
38194        }
38195      };
38196      if (element.hasSecurity()) {
38197        openArray("security");
38198        for (Coding e : element.getSecurity()) 
38199          composeCoding(null, e);
38200        closeArray();
38201      };
38202      if (element.hasTag()) {
38203        openArray("tag");
38204        for (Coding e : element.getTag()) 
38205          composeCoding(null, e);
38206        closeArray();
38207      };
38208  }
38209
38210  protected void composeMonetaryComponent(String name, MonetaryComponent element) throws IOException {
38211    if (element != null) {
38212      open(name);
38213      composeMonetaryComponentProperties(element);
38214      close();
38215    }
38216  }
38217
38218  protected void composeMonetaryComponentProperties(MonetaryComponent element) throws IOException {
38219    composeDataTypeProperties(element);
38220      if (element.hasTypeElement()) {
38221        composeEnumerationCore("type", element.getTypeElement(), new MonetaryComponent.PriceComponentTypeEnumFactory(), false);
38222        composeEnumerationExtras("type", element.getTypeElement(), new MonetaryComponent.PriceComponentTypeEnumFactory(), false);
38223      }
38224      if (element.hasCode()) {
38225        composeCodeableConcept("code", element.getCode());
38226      }
38227      if (element.hasFactorElement()) {
38228        composeDecimalCore("factor", element.getFactorElement(), false);
38229        composeDecimalExtras("factor", element.getFactorElement(), false);
38230      }
38231      if (element.hasAmount()) {
38232        composeMoney("amount", element.getAmount());
38233      }
38234  }
38235
38236  protected void composeMoney(String name, Money element) throws IOException {
38237    if (element != null) {
38238      open(name);
38239      composeMoneyProperties(element);
38240      close();
38241    }
38242  }
38243
38244  protected void composeMoneyProperties(Money element) throws IOException {
38245    composeDataTypeProperties(element);
38246      if (element.hasValueElement()) {
38247        composeDecimalCore("value", element.getValueElement(), false);
38248        composeDecimalExtras("value", element.getValueElement(), false);
38249      }
38250      if (element.hasCurrencyElement()) {
38251        composeCodeCore("currency", element.getCurrencyElement(), false);
38252        composeCodeExtras("currency", element.getCurrencyElement(), false);
38253      }
38254  }
38255
38256  protected void composeNarrative(String name, Narrative element) throws IOException {
38257    if (element != null) {
38258      open(name);
38259      composeNarrativeProperties(element);
38260      close();
38261    }
38262  }
38263
38264  protected void composeNarrativeProperties(Narrative element) throws IOException {
38265    composeDataTypeProperties(element);
38266      if (element.hasStatusElement()) {
38267        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
38268        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
38269      }
38270      if (element.hasDiv()) {
38271        XhtmlNode node = element.getDiv();
38272        if (node.getNsDecl() == null) {
38273          node.attribute("xmlns", XHTML_NS);
38274        }
38275        composeXhtml("div", node);
38276      }
38277  }
38278
38279  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
38280    if (element != null) {
38281      open(name);
38282      composeParameterDefinitionProperties(element);
38283      close();
38284    }
38285  }
38286
38287  protected void composeParameterDefinitionProperties(ParameterDefinition element) throws IOException {
38288    composeDataTypeProperties(element);
38289      if (element.hasNameElement()) {
38290        composeCodeCore("name", element.getNameElement(), false);
38291        composeCodeExtras("name", element.getNameElement(), false);
38292      }
38293      if (element.hasUseElement()) {
38294        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
38295        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
38296      }
38297      if (element.hasMinElement()) {
38298        composeIntegerCore("min", element.getMinElement(), false);
38299        composeIntegerExtras("min", element.getMinElement(), false);
38300      }
38301      if (element.hasMaxElement()) {
38302        composeStringCore("max", element.getMaxElement(), false);
38303        composeStringExtras("max", element.getMaxElement(), false);
38304      }
38305      if (element.hasDocumentationElement()) {
38306        composeStringCore("documentation", element.getDocumentationElement(), false);
38307        composeStringExtras("documentation", element.getDocumentationElement(), false);
38308      }
38309      if (element.hasTypeElement()) {
38310        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
38311        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
38312      }
38313      if (element.hasProfileElement()) {
38314        composeCanonicalCore("profile", element.getProfileElement(), false);
38315        composeCanonicalExtras("profile", element.getProfileElement(), false);
38316      }
38317  }
38318
38319  protected void composePeriod(String name, Period element) throws IOException {
38320    if (element != null) {
38321      open(name);
38322      composePeriodProperties(element);
38323      close();
38324    }
38325  }
38326
38327  protected void composePeriodProperties(Period element) throws IOException {
38328    composeDataTypeProperties(element);
38329      if (element.hasStartElement()) {
38330        composeDateTimeCore("start", element.getStartElement(), false);
38331        composeDateTimeExtras("start", element.getStartElement(), false);
38332      }
38333      if (element.hasEndElement()) {
38334        composeDateTimeCore("end", element.getEndElement(), false);
38335        composeDateTimeExtras("end", element.getEndElement(), false);
38336      }
38337  }
38338
38339  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
38340    if (element != null) {
38341      open(name);
38342      composeProductShelfLifeProperties(element);
38343      close();
38344    }
38345  }
38346
38347  protected void composeProductShelfLifeProperties(ProductShelfLife element) throws IOException {
38348    composeBackboneTypeProperties(element);
38349      if (element.hasType()) {
38350        composeCodeableConcept("type", element.getType());
38351      }
38352      if (element.hasPeriod()) {
38353        composeType("period", element.getPeriod());
38354      }
38355      if (element.hasSpecialPrecautionsForStorage()) {
38356        openArray("specialPrecautionsForStorage");
38357        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
38358          composeCodeableConcept(null, e);
38359        closeArray();
38360      };
38361  }
38362
38363  protected void composeQuantity(String name, Quantity element) throws IOException {
38364    if (element != null) {
38365      open(name);
38366      composeQuantityProperties(element);
38367      close();
38368    }
38369  }
38370
38371  protected void composeQuantityProperties(Quantity element) throws IOException {
38372    composeDataTypeProperties(element);
38373      if (element.hasValueElement()) {
38374        composeDecimalCore("value", element.getValueElement(), false);
38375        composeDecimalExtras("value", element.getValueElement(), false);
38376      }
38377      if (element.hasComparatorElement()) {
38378        composeEnumerationCore("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
38379        composeEnumerationExtras("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
38380      }
38381      if (element.hasUnitElement()) {
38382        composeStringCore("unit", element.getUnitElement(), false);
38383        composeStringExtras("unit", element.getUnitElement(), false);
38384      }
38385      if (element.hasSystemElement()) {
38386        composeUriCore("system", element.getSystemElement(), false);
38387        composeUriExtras("system", element.getSystemElement(), false);
38388      }
38389      if (element.hasCodeElement()) {
38390        composeCodeCore("code", element.getCodeElement(), false);
38391        composeCodeExtras("code", element.getCodeElement(), false);
38392      }
38393  }
38394
38395  protected void composeRange(String name, Range element) throws IOException {
38396    if (element != null) {
38397      open(name);
38398      composeRangeProperties(element);
38399      close();
38400    }
38401  }
38402
38403  protected void composeRangeProperties(Range element) throws IOException {
38404    composeDataTypeProperties(element);
38405      if (element.hasLow()) {
38406        composeQuantity("low", element.getLow());
38407      }
38408      if (element.hasHigh()) {
38409        composeQuantity("high", element.getHigh());
38410      }
38411  }
38412
38413  protected void composeRatio(String name, Ratio element) throws IOException {
38414    if (element != null) {
38415      open(name);
38416      composeRatioProperties(element);
38417      close();
38418    }
38419  }
38420
38421  protected void composeRatioProperties(Ratio element) throws IOException {
38422    composeDataTypeProperties(element);
38423      if (element.hasNumerator()) {
38424        composeQuantity("numerator", element.getNumerator());
38425      }
38426      if (element.hasDenominator()) {
38427        composeQuantity("denominator", element.getDenominator());
38428      }
38429  }
38430
38431  protected void composeRatioRange(String name, RatioRange element) throws IOException {
38432    if (element != null) {
38433      open(name);
38434      composeRatioRangeProperties(element);
38435      close();
38436    }
38437  }
38438
38439  protected void composeRatioRangeProperties(RatioRange element) throws IOException {
38440    composeDataTypeProperties(element);
38441      if (element.hasLowNumerator()) {
38442        composeQuantity("lowNumerator", element.getLowNumerator());
38443      }
38444      if (element.hasHighNumerator()) {
38445        composeQuantity("highNumerator", element.getHighNumerator());
38446      }
38447      if (element.hasDenominator()) {
38448        composeQuantity("denominator", element.getDenominator());
38449      }
38450  }
38451
38452  protected void composeReference(String name, Reference element) throws IOException {
38453    if (element != null) {
38454      open(name);
38455      composeReferenceProperties(element);
38456      close();
38457    }
38458  }
38459
38460  protected void composeReferenceProperties(Reference element) throws IOException {
38461    composeDataTypeProperties(element);
38462      if (element.hasReferenceElement()) {
38463        composeStringCore("reference", element.getReferenceElement(), false);
38464        composeStringExtras("reference", element.getReferenceElement(), false);
38465      }
38466      if (element.hasTypeElement()) {
38467        composeUriCore("type", element.getTypeElement(), false);
38468        composeUriExtras("type", element.getTypeElement(), false);
38469      }
38470      if (element.hasIdentifier()) {
38471        composeIdentifier("identifier", element.getIdentifier());
38472      }
38473      if (element.hasDisplayElement()) {
38474        composeStringCore("display", element.getDisplayElement(), false);
38475        composeStringExtras("display", element.getDisplayElement(), false);
38476      }
38477  }
38478
38479  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
38480    if (element != null) {
38481      open(name);
38482      composeRelatedArtifactProperties(element);
38483      close();
38484    }
38485  }
38486
38487  protected void composeRelatedArtifactProperties(RelatedArtifact element) throws IOException {
38488    composeDataTypeProperties(element);
38489      if (element.hasTypeElement()) {
38490        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
38491        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
38492      }
38493      if (element.hasClassifier()) {
38494        openArray("classifier");
38495        for (CodeableConcept e : element.getClassifier()) 
38496          composeCodeableConcept(null, e);
38497        closeArray();
38498      };
38499      if (element.hasLabelElement()) {
38500        composeStringCore("label", element.getLabelElement(), false);
38501        composeStringExtras("label", element.getLabelElement(), false);
38502      }
38503      if (element.hasDisplayElement()) {
38504        composeStringCore("display", element.getDisplayElement(), false);
38505        composeStringExtras("display", element.getDisplayElement(), false);
38506      }
38507      if (element.hasCitationElement()) {
38508        composeMarkdownCore("citation", element.getCitationElement(), false);
38509        composeMarkdownExtras("citation", element.getCitationElement(), false);
38510      }
38511      if (element.hasDocument()) {
38512        composeAttachment("document", element.getDocument());
38513      }
38514      if (element.hasResourceElement()) {
38515        composeCanonicalCore("resource", element.getResourceElement(), false);
38516        composeCanonicalExtras("resource", element.getResourceElement(), false);
38517      }
38518      if (element.hasResourceReference()) {
38519        composeReference("resourceReference", element.getResourceReference());
38520      }
38521      if (element.hasPublicationStatusElement()) {
38522        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38523        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38524      }
38525      if (element.hasPublicationDateElement()) {
38526        composeDateCore("publicationDate", element.getPublicationDateElement(), false);
38527        composeDateExtras("publicationDate", element.getPublicationDateElement(), false);
38528      }
38529  }
38530
38531  protected void composeSampledData(String name, SampledData element) throws IOException {
38532    if (element != null) {
38533      open(name);
38534      composeSampledDataProperties(element);
38535      close();
38536    }
38537  }
38538
38539  protected void composeSampledDataProperties(SampledData element) throws IOException {
38540    composeDataTypeProperties(element);
38541      if (element.hasOrigin()) {
38542        composeQuantity("origin", element.getOrigin());
38543      }
38544      if (element.hasIntervalElement()) {
38545        composeDecimalCore("interval", element.getIntervalElement(), false);
38546        composeDecimalExtras("interval", element.getIntervalElement(), false);
38547      }
38548      if (element.hasIntervalUnitElement()) {
38549        composeCodeCore("intervalUnit", element.getIntervalUnitElement(), false);
38550        composeCodeExtras("intervalUnit", element.getIntervalUnitElement(), false);
38551      }
38552      if (element.hasFactorElement()) {
38553        composeDecimalCore("factor", element.getFactorElement(), false);
38554        composeDecimalExtras("factor", element.getFactorElement(), false);
38555      }
38556      if (element.hasLowerLimitElement()) {
38557        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
38558        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
38559      }
38560      if (element.hasUpperLimitElement()) {
38561        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
38562        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
38563      }
38564      if (element.hasDimensionsElement()) {
38565        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
38566        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
38567      }
38568      if (element.hasCodeMapElement()) {
38569        composeCanonicalCore("codeMap", element.getCodeMapElement(), false);
38570        composeCanonicalExtras("codeMap", element.getCodeMapElement(), false);
38571      }
38572      if (element.hasOffsetsElement()) {
38573        composeStringCore("offsets", element.getOffsetsElement(), false);
38574        composeStringExtras("offsets", element.getOffsetsElement(), false);
38575      }
38576      if (element.hasDataElement()) {
38577        composeStringCore("data", element.getDataElement(), false);
38578        composeStringExtras("data", element.getDataElement(), false);
38579      }
38580  }
38581
38582  protected void composeSignature(String name, Signature element) throws IOException {
38583    if (element != null) {
38584      open(name);
38585      composeSignatureProperties(element);
38586      close();
38587    }
38588  }
38589
38590  protected void composeSignatureProperties(Signature element) throws IOException {
38591    composeDataTypeProperties(element);
38592      if (element.hasType()) {
38593        openArray("type");
38594        for (Coding e : element.getType()) 
38595          composeCoding(null, e);
38596        closeArray();
38597      };
38598      if (element.hasWhenElement()) {
38599        composeInstantCore("when", element.getWhenElement(), false);
38600        composeInstantExtras("when", element.getWhenElement(), false);
38601      }
38602      if (element.hasWho()) {
38603        composeReference("who", element.getWho());
38604      }
38605      if (element.hasOnBehalfOf()) {
38606        composeReference("onBehalfOf", element.getOnBehalfOf());
38607      }
38608      if (element.hasTargetFormatElement()) {
38609        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
38610        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
38611      }
38612      if (element.hasSigFormatElement()) {
38613        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
38614        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
38615      }
38616      if (element.hasDataElement()) {
38617        composeBase64BinaryCore("data", element.getDataElement(), false);
38618        composeBase64BinaryExtras("data", element.getDataElement(), false);
38619      }
38620  }
38621
38622  protected void composeTiming(String name, Timing element) throws IOException {
38623    if (element != null) {
38624      open(name);
38625      composeTimingProperties(element);
38626      close();
38627    }
38628  }
38629
38630  protected void composeTimingProperties(Timing element) throws IOException {
38631    composeBackboneTypeProperties(element);
38632      if (element.hasEvent()) {
38633        if (anyHasValue(element.getEvent())) {
38634          openArray("event");
38635          for (DateTimeType e : element.getEvent()) 
38636            composeDateTimeCore(null, e, e != element.getEvent().get(element.getEvent().size()-1));
38637          closeArray();
38638        }
38639        if (anyHasExtras(element.getEvent())) {
38640          openArray("_event");
38641          for (DateTimeType e : element.getEvent()) 
38642            composeDateTimeExtras(null, e, true);
38643          closeArray();
38644        }
38645      };
38646      if (element.hasRepeat()) {
38647        composeTimingRepeatComponent("repeat", element.getRepeat());
38648      }
38649      if (element.hasCode()) {
38650        composeCodeableConcept("code", element.getCode());
38651      }
38652  }
38653
38654  protected void composeTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
38655    if (element != null) {
38656      open(name);
38657      composeTimingRepeatComponentProperties(element);
38658      close();
38659    }
38660  }
38661
38662  protected void composeTimingRepeatComponentProperties(Timing.TimingRepeatComponent element) throws IOException {
38663    composeElementProperties(element);
38664      if (element.hasBounds()) {
38665        composeType("bounds", element.getBounds());
38666      }
38667      if (element.hasCountElement()) {
38668        composePositiveIntCore("count", element.getCountElement(), false);
38669        composePositiveIntExtras("count", element.getCountElement(), false);
38670      }
38671      if (element.hasCountMaxElement()) {
38672        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
38673        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
38674      }
38675      if (element.hasDurationElement()) {
38676        composeDecimalCore("duration", element.getDurationElement(), false);
38677        composeDecimalExtras("duration", element.getDurationElement(), false);
38678      }
38679      if (element.hasDurationMaxElement()) {
38680        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
38681        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
38682      }
38683      if (element.hasDurationUnitElement()) {
38684        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38685        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38686      }
38687      if (element.hasFrequencyElement()) {
38688        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
38689        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
38690      }
38691      if (element.hasFrequencyMaxElement()) {
38692        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
38693        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
38694      }
38695      if (element.hasPeriodElement()) {
38696        composeDecimalCore("period", element.getPeriodElement(), false);
38697        composeDecimalExtras("period", element.getPeriodElement(), false);
38698      }
38699      if (element.hasPeriodMaxElement()) {
38700        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
38701        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
38702      }
38703      if (element.hasPeriodUnitElement()) {
38704        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38705        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38706      }
38707      if (element.hasDayOfWeek()) {
38708        openArray("dayOfWeek");
38709        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
38710          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
38711        closeArray();
38712        if (anyHasExtras(element.getDayOfWeek())) {
38713          openArray("_dayOfWeek");
38714          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
38715            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
38716          closeArray();
38717        }
38718      };
38719      if (element.hasTimeOfDay()) {
38720        if (anyHasValue(element.getTimeOfDay())) {
38721          openArray("timeOfDay");
38722          for (TimeType e : element.getTimeOfDay()) 
38723            composeTimeCore(null, e, e != element.getTimeOfDay().get(element.getTimeOfDay().size()-1));
38724          closeArray();
38725        }
38726        if (anyHasExtras(element.getTimeOfDay())) {
38727          openArray("_timeOfDay");
38728          for (TimeType e : element.getTimeOfDay()) 
38729            composeTimeExtras(null, e, true);
38730          closeArray();
38731        }
38732      };
38733      if (element.hasWhen()) {
38734        openArray("when");
38735        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
38736          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
38737        closeArray();
38738        if (anyHasExtras(element.getWhen())) {
38739          openArray("_when");
38740          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
38741            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
38742          closeArray();
38743        }
38744      };
38745      if (element.hasOffsetElement()) {
38746        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
38747        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
38748      }
38749  }
38750
38751  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
38752    if (element != null) {
38753      open(name);
38754      composeTriggerDefinitionProperties(element);
38755      close();
38756    }
38757  }
38758
38759  protected void composeTriggerDefinitionProperties(TriggerDefinition element) throws IOException {
38760    composeDataTypeProperties(element);
38761      if (element.hasTypeElement()) {
38762        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
38763        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
38764      }
38765      if (element.hasNameElement()) {
38766        composeStringCore("name", element.getNameElement(), false);
38767        composeStringExtras("name", element.getNameElement(), false);
38768      }
38769      if (element.hasCode()) {
38770        composeCodeableConcept("code", element.getCode());
38771      }
38772      if (element.hasSubscriptionTopicElement()) {
38773        composeCanonicalCore("subscriptionTopic", element.getSubscriptionTopicElement(), false);
38774        composeCanonicalExtras("subscriptionTopic", element.getSubscriptionTopicElement(), false);
38775      }
38776      if (element.hasTiming()) {
38777        composeType("timing", element.getTiming());
38778      }
38779      if (element.hasData()) {
38780        openArray("data");
38781        for (DataRequirement e : element.getData()) 
38782          composeDataRequirement(null, e);
38783        closeArray();
38784      };
38785      if (element.hasCondition()) {
38786        composeExpression("condition", element.getCondition());
38787      }
38788  }
38789
38790  protected void composeUsageContext(String name, UsageContext element) throws IOException {
38791    if (element != null) {
38792      open(name);
38793      composeUsageContextProperties(element);
38794      close();
38795    }
38796  }
38797
38798  protected void composeUsageContextProperties(UsageContext element) throws IOException {
38799    composeDataTypeProperties(element);
38800      if (element.hasCode()) {
38801        composeCoding("code", element.getCode());
38802      }
38803      if (element.hasValue()) {
38804        composeType("value", element.getValue());
38805      }
38806  }
38807
38808  protected void composeVirtualServiceDetail(String name, VirtualServiceDetail element) throws IOException {
38809    if (element != null) {
38810      open(name);
38811      composeVirtualServiceDetailProperties(element);
38812      close();
38813    }
38814  }
38815
38816  protected void composeVirtualServiceDetailProperties(VirtualServiceDetail element) throws IOException {
38817    composeDataTypeProperties(element);
38818      if (element.hasChannelType()) {
38819        composeCoding("channelType", element.getChannelType());
38820      }
38821      if (element.hasAddress()) {
38822        composeType("address", element.getAddress());
38823      }
38824      if (element.hasAdditionalInfo()) {
38825        if (anyHasValue(element.getAdditionalInfo())) {
38826          openArray("additionalInfo");
38827          for (UrlType e : element.getAdditionalInfo()) 
38828            composeUrlCore(null, e, e != element.getAdditionalInfo().get(element.getAdditionalInfo().size()-1));
38829          closeArray();
38830        }
38831        if (anyHasExtras(element.getAdditionalInfo())) {
38832          openArray("_additionalInfo");
38833          for (UrlType e : element.getAdditionalInfo()) 
38834            composeUrlExtras(null, e, true);
38835          closeArray();
38836        }
38837      };
38838      if (element.hasMaxParticipantsElement()) {
38839        composePositiveIntCore("maxParticipants", element.getMaxParticipantsElement(), false);
38840        composePositiveIntExtras("maxParticipants", element.getMaxParticipantsElement(), false);
38841      }
38842      if (element.hasSessionKeyElement()) {
38843        composeStringCore("sessionKey", element.getSessionKeyElement(), false);
38844        composeStringExtras("sessionKey", element.getSessionKeyElement(), false);
38845      }
38846  }
38847
38848  protected void composeCanonicalResourceProperties(CanonicalResource element) throws IOException {
38849      composeDomainResourceProperties(element);
38850  }
38851
38852  protected void composeDomainResourceProperties(DomainResource element) throws IOException {
38853      composeResourceProperties(element);
38854      if (element.hasText()) {
38855        composeNarrative("text", element.getText());
38856      }
38857      if (element.hasContained()) {
38858        openArray("contained");
38859        for (Resource e : element.getContained()) {
38860          open(null);
38861          composeResource(e);
38862          close();
38863        }
38864        closeArray();
38865      };
38866      if (element.hasExtension()) {
38867        openArray("extension");
38868        for (Extension e : element.getExtension()) 
38869          composeExtension(null, e);
38870        closeArray();
38871      };
38872      if (element.hasModifierExtension()) {
38873        openArray("modifierExtension");
38874        for (Extension e : element.getModifierExtension()) 
38875          composeExtension(null, e);
38876        closeArray();
38877      };
38878  }
38879
38880  protected void composeMetadataResourceProperties(MetadataResource element) throws IOException {
38881      composeCanonicalResourceProperties(element);
38882  }
38883
38884  protected void composeResourceProperties(Resource element) throws IOException {
38885      composeBaseProperties(element);
38886      if (element.hasIdElement()) {
38887        composeIdCore("id", element.getIdElement(), false);
38888        composeIdExtras("id", element.getIdElement(), false);
38889      }
38890      if (element.hasMeta()) {
38891        composeMeta("meta", element.getMeta());
38892      }
38893      if (element.hasImplicitRulesElement()) {
38894        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
38895        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
38896      }
38897      if (element.hasLanguageElement()) {
38898        composeCodeCore("language", element.getLanguageElement(), false);
38899        composeCodeExtras("language", element.getLanguageElement(), false);
38900      }
38901  }
38902
38903  protected void composeAccount(String name, Account element) throws IOException {
38904    if (element != null) {
38905      prop("resourceType", name);
38906      composeAccountProperties(element);
38907    }
38908  }
38909
38910  protected void composeAccountProperties(Account element) throws IOException {
38911    composeDomainResourceProperties(element);
38912      if (element.hasIdentifier()) {
38913        openArray("identifier");
38914        for (Identifier e : element.getIdentifier()) 
38915          composeIdentifier(null, e);
38916        closeArray();
38917      };
38918      if (element.hasStatusElement()) {
38919        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
38920        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
38921      }
38922      if (element.hasBillingStatus()) {
38923        composeCodeableConcept("billingStatus", element.getBillingStatus());
38924      }
38925      if (element.hasType()) {
38926        composeCodeableConcept("type", element.getType());
38927      }
38928      if (element.hasNameElement()) {
38929        composeStringCore("name", element.getNameElement(), false);
38930        composeStringExtras("name", element.getNameElement(), false);
38931      }
38932      if (element.hasSubject()) {
38933        openArray("subject");
38934        for (Reference e : element.getSubject()) 
38935          composeReference(null, e);
38936        closeArray();
38937      };
38938      if (element.hasServicePeriod()) {
38939        composePeriod("servicePeriod", element.getServicePeriod());
38940      }
38941      if (element.hasCoverage()) {
38942        openArray("coverage");
38943        for (Account.CoverageComponent e : element.getCoverage()) 
38944          composeCoverageComponent(null, e);
38945        closeArray();
38946      };
38947      if (element.hasOwner()) {
38948        composeReference("owner", element.getOwner());
38949      }
38950      if (element.hasDescriptionElement()) {
38951        composeMarkdownCore("description", element.getDescriptionElement(), false);
38952        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38953      }
38954      if (element.hasGuarantor()) {
38955        openArray("guarantor");
38956        for (Account.GuarantorComponent e : element.getGuarantor()) 
38957          composeGuarantorComponent(null, e);
38958        closeArray();
38959      };
38960      if (element.hasDiagnosis()) {
38961        openArray("diagnosis");
38962        for (Account.AccountDiagnosisComponent e : element.getDiagnosis()) 
38963          composeAccountDiagnosisComponent(null, e);
38964        closeArray();
38965      };
38966      if (element.hasProcedure()) {
38967        openArray("procedure");
38968        for (Account.AccountProcedureComponent e : element.getProcedure()) 
38969          composeAccountProcedureComponent(null, e);
38970        closeArray();
38971      };
38972      if (element.hasRelatedAccount()) {
38973        openArray("relatedAccount");
38974        for (Account.AccountRelatedAccountComponent e : element.getRelatedAccount()) 
38975          composeAccountRelatedAccountComponent(null, e);
38976        closeArray();
38977      };
38978      if (element.hasCurrency()) {
38979        composeCodeableConcept("currency", element.getCurrency());
38980      }
38981      if (element.hasBalance()) {
38982        openArray("balance");
38983        for (Account.AccountBalanceComponent e : element.getBalance()) 
38984          composeAccountBalanceComponent(null, e);
38985        closeArray();
38986      };
38987      if (element.hasCalculatedAtElement()) {
38988        composeInstantCore("calculatedAt", element.getCalculatedAtElement(), false);
38989        composeInstantExtras("calculatedAt", element.getCalculatedAtElement(), false);
38990      }
38991  }
38992
38993  protected void composeCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
38994    if (element != null) {
38995      open(name);
38996      composeCoverageComponentProperties(element);
38997      close();
38998    }
38999  }
39000
39001  protected void composeCoverageComponentProperties(Account.CoverageComponent element) throws IOException {
39002    composeBackboneElementProperties(element);
39003      if (element.hasCoverage()) {
39004        composeReference("coverage", element.getCoverage());
39005      }
39006      if (element.hasPriorityElement()) {
39007        composePositiveIntCore("priority", element.getPriorityElement(), false);
39008        composePositiveIntExtras("priority", element.getPriorityElement(), false);
39009      }
39010  }
39011
39012  protected void composeGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
39013    if (element != null) {
39014      open(name);
39015      composeGuarantorComponentProperties(element);
39016      close();
39017    }
39018  }
39019
39020  protected void composeGuarantorComponentProperties(Account.GuarantorComponent element) throws IOException {
39021    composeBackboneElementProperties(element);
39022      if (element.hasParty()) {
39023        composeReference("party", element.getParty());
39024      }
39025      if (element.hasOnHoldElement()) {
39026        composeBooleanCore("onHold", element.getOnHoldElement(), false);
39027        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
39028      }
39029      if (element.hasPeriod()) {
39030        composePeriod("period", element.getPeriod());
39031      }
39032  }
39033
39034  protected void composeAccountDiagnosisComponent(String name, Account.AccountDiagnosisComponent element) throws IOException {
39035    if (element != null) {
39036      open(name);
39037      composeAccountDiagnosisComponentProperties(element);
39038      close();
39039    }
39040  }
39041
39042  protected void composeAccountDiagnosisComponentProperties(Account.AccountDiagnosisComponent element) throws IOException {
39043    composeBackboneElementProperties(element);
39044      if (element.hasSequenceElement()) {
39045        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39046        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39047      }
39048      if (element.hasCondition()) {
39049        composeCodeableReference("condition", element.getCondition());
39050      }
39051      if (element.hasDateOfDiagnosisElement()) {
39052        composeDateTimeCore("dateOfDiagnosis", element.getDateOfDiagnosisElement(), false);
39053        composeDateTimeExtras("dateOfDiagnosis", element.getDateOfDiagnosisElement(), false);
39054      }
39055      if (element.hasType()) {
39056        openArray("type");
39057        for (CodeableConcept e : element.getType()) 
39058          composeCodeableConcept(null, e);
39059        closeArray();
39060      };
39061      if (element.hasOnAdmissionElement()) {
39062        composeBooleanCore("onAdmission", element.getOnAdmissionElement(), false);
39063        composeBooleanExtras("onAdmission", element.getOnAdmissionElement(), false);
39064      }
39065      if (element.hasPackageCode()) {
39066        openArray("packageCode");
39067        for (CodeableConcept e : element.getPackageCode()) 
39068          composeCodeableConcept(null, e);
39069        closeArray();
39070      };
39071  }
39072
39073  protected void composeAccountProcedureComponent(String name, Account.AccountProcedureComponent element) throws IOException {
39074    if (element != null) {
39075      open(name);
39076      composeAccountProcedureComponentProperties(element);
39077      close();
39078    }
39079  }
39080
39081  protected void composeAccountProcedureComponentProperties(Account.AccountProcedureComponent element) throws IOException {
39082    composeBackboneElementProperties(element);
39083      if (element.hasSequenceElement()) {
39084        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39085        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39086      }
39087      if (element.hasCode()) {
39088        composeCodeableReference("code", element.getCode());
39089      }
39090      if (element.hasDateOfServiceElement()) {
39091        composeDateTimeCore("dateOfService", element.getDateOfServiceElement(), false);
39092        composeDateTimeExtras("dateOfService", element.getDateOfServiceElement(), false);
39093      }
39094      if (element.hasType()) {
39095        openArray("type");
39096        for (CodeableConcept e : element.getType()) 
39097          composeCodeableConcept(null, e);
39098        closeArray();
39099      };
39100      if (element.hasPackageCode()) {
39101        openArray("packageCode");
39102        for (CodeableConcept e : element.getPackageCode()) 
39103          composeCodeableConcept(null, e);
39104        closeArray();
39105      };
39106      if (element.hasDevice()) {
39107        openArray("device");
39108        for (Reference e : element.getDevice()) 
39109          composeReference(null, e);
39110        closeArray();
39111      };
39112  }
39113
39114  protected void composeAccountRelatedAccountComponent(String name, Account.AccountRelatedAccountComponent element) throws IOException {
39115    if (element != null) {
39116      open(name);
39117      composeAccountRelatedAccountComponentProperties(element);
39118      close();
39119    }
39120  }
39121
39122  protected void composeAccountRelatedAccountComponentProperties(Account.AccountRelatedAccountComponent element) throws IOException {
39123    composeBackboneElementProperties(element);
39124      if (element.hasRelationship()) {
39125        composeCodeableConcept("relationship", element.getRelationship());
39126      }
39127      if (element.hasAccount()) {
39128        composeReference("account", element.getAccount());
39129      }
39130  }
39131
39132  protected void composeAccountBalanceComponent(String name, Account.AccountBalanceComponent element) throws IOException {
39133    if (element != null) {
39134      open(name);
39135      composeAccountBalanceComponentProperties(element);
39136      close();
39137    }
39138  }
39139
39140  protected void composeAccountBalanceComponentProperties(Account.AccountBalanceComponent element) throws IOException {
39141    composeBackboneElementProperties(element);
39142      if (element.hasAggregate()) {
39143        composeCodeableConcept("aggregate", element.getAggregate());
39144      }
39145      if (element.hasTerm()) {
39146        composeCodeableConcept("term", element.getTerm());
39147      }
39148      if (element.hasEstimateElement()) {
39149        composeBooleanCore("estimate", element.getEstimateElement(), false);
39150        composeBooleanExtras("estimate", element.getEstimateElement(), false);
39151      }
39152      if (element.hasAmount()) {
39153        composeMoney("amount", element.getAmount());
39154      }
39155  }
39156
39157  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
39158    if (element != null) {
39159      prop("resourceType", name);
39160      composeActivityDefinitionProperties(element);
39161    }
39162  }
39163
39164  protected void composeActivityDefinitionProperties(ActivityDefinition element) throws IOException {
39165    composeMetadataResourceProperties(element);
39166      if (element.hasUrlElement()) {
39167        composeUriCore("url", element.getUrlElement(), false);
39168        composeUriExtras("url", element.getUrlElement(), false);
39169      }
39170      if (element.hasIdentifier()) {
39171        openArray("identifier");
39172        for (Identifier e : element.getIdentifier()) 
39173          composeIdentifier(null, e);
39174        closeArray();
39175      };
39176      if (element.hasVersionElement()) {
39177        composeStringCore("version", element.getVersionElement(), false);
39178        composeStringExtras("version", element.getVersionElement(), false);
39179      }
39180      if (element.hasVersionAlgorithm()) {
39181        composeType("versionAlgorithm", element.getVersionAlgorithm());
39182      }
39183      if (element.hasNameElement()) {
39184        composeStringCore("name", element.getNameElement(), false);
39185        composeStringExtras("name", element.getNameElement(), false);
39186      }
39187      if (element.hasTitleElement()) {
39188        composeStringCore("title", element.getTitleElement(), false);
39189        composeStringExtras("title", element.getTitleElement(), false);
39190      }
39191      if (element.hasSubtitleElement()) {
39192        composeStringCore("subtitle", element.getSubtitleElement(), false);
39193        composeStringExtras("subtitle", element.getSubtitleElement(), false);
39194      }
39195      if (element.hasStatusElement()) {
39196        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39197        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39198      }
39199      if (element.hasExperimentalElement()) {
39200        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39201        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39202      }
39203      if (element.hasSubject()) {
39204        composeType("subject", element.getSubject());
39205      }
39206      if (element.hasDateElement()) {
39207        composeDateTimeCore("date", element.getDateElement(), false);
39208        composeDateTimeExtras("date", element.getDateElement(), false);
39209      }
39210      if (element.hasPublisherElement()) {
39211        composeStringCore("publisher", element.getPublisherElement(), false);
39212        composeStringExtras("publisher", element.getPublisherElement(), false);
39213      }
39214      if (element.hasContact()) {
39215        openArray("contact");
39216        for (ContactDetail e : element.getContact()) 
39217          composeContactDetail(null, e);
39218        closeArray();
39219      };
39220      if (element.hasDescriptionElement()) {
39221        composeMarkdownCore("description", element.getDescriptionElement(), false);
39222        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39223      }
39224      if (element.hasUseContext()) {
39225        openArray("useContext");
39226        for (UsageContext e : element.getUseContext()) 
39227          composeUsageContext(null, e);
39228        closeArray();
39229      };
39230      if (element.hasJurisdiction()) {
39231        openArray("jurisdiction");
39232        for (CodeableConcept e : element.getJurisdiction()) 
39233          composeCodeableConcept(null, e);
39234        closeArray();
39235      };
39236      if (element.hasPurposeElement()) {
39237        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39238        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39239      }
39240      if (element.hasUsageElement()) {
39241        composeMarkdownCore("usage", element.getUsageElement(), false);
39242        composeMarkdownExtras("usage", element.getUsageElement(), false);
39243      }
39244      if (element.hasCopyrightElement()) {
39245        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39246        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39247      }
39248      if (element.hasCopyrightLabelElement()) {
39249        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
39250        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
39251      }
39252      if (element.hasApprovalDateElement()) {
39253        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39254        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39255      }
39256      if (element.hasLastReviewDateElement()) {
39257        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39258        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39259      }
39260      if (element.hasEffectivePeriod()) {
39261        composePeriod("effectivePeriod", element.getEffectivePeriod());
39262      }
39263      if (element.hasTopic()) {
39264        openArray("topic");
39265        for (CodeableConcept e : element.getTopic()) 
39266          composeCodeableConcept(null, e);
39267        closeArray();
39268      };
39269      if (element.hasAuthor()) {
39270        openArray("author");
39271        for (ContactDetail e : element.getAuthor()) 
39272          composeContactDetail(null, e);
39273        closeArray();
39274      };
39275      if (element.hasEditor()) {
39276        openArray("editor");
39277        for (ContactDetail e : element.getEditor()) 
39278          composeContactDetail(null, e);
39279        closeArray();
39280      };
39281      if (element.hasReviewer()) {
39282        openArray("reviewer");
39283        for (ContactDetail e : element.getReviewer()) 
39284          composeContactDetail(null, e);
39285        closeArray();
39286      };
39287      if (element.hasEndorser()) {
39288        openArray("endorser");
39289        for (ContactDetail e : element.getEndorser()) 
39290          composeContactDetail(null, e);
39291        closeArray();
39292      };
39293      if (element.hasRelatedArtifact()) {
39294        openArray("relatedArtifact");
39295        for (RelatedArtifact e : element.getRelatedArtifact()) 
39296          composeRelatedArtifact(null, e);
39297        closeArray();
39298      };
39299      if (element.hasLibrary()) {
39300        if (anyHasValue(element.getLibrary())) {
39301          openArray("library");
39302          for (CanonicalType e : element.getLibrary()) 
39303            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
39304          closeArray();
39305        }
39306        if (anyHasExtras(element.getLibrary())) {
39307          openArray("_library");
39308          for (CanonicalType e : element.getLibrary()) 
39309            composeCanonicalExtras(null, e, true);
39310          closeArray();
39311        }
39312      };
39313      if (element.hasKindElement()) {
39314        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypesEnumFactory(), false);
39315        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypesEnumFactory(), false);
39316      }
39317      if (element.hasProfileElement()) {
39318        composeCanonicalCore("profile", element.getProfileElement(), false);
39319        composeCanonicalExtras("profile", element.getProfileElement(), false);
39320      }
39321      if (element.hasCode()) {
39322        composeCodeableConcept("code", element.getCode());
39323      }
39324      if (element.hasIntentElement()) {
39325        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
39326        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
39327      }
39328      if (element.hasPriorityElement()) {
39329        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
39330        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
39331      }
39332      if (element.hasDoNotPerformElement()) {
39333        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
39334        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
39335      }
39336      if (element.hasTiming()) {
39337        composeType("timing", element.getTiming());
39338      }
39339      if (element.hasAsNeeded()) {
39340        composeType("asNeeded", element.getAsNeeded());
39341      }
39342      if (element.hasLocation()) {
39343        composeCodeableReference("location", element.getLocation());
39344      }
39345      if (element.hasParticipant()) {
39346        openArray("participant");
39347        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
39348          composeActivityDefinitionParticipantComponent(null, e);
39349        closeArray();
39350      };
39351      if (element.hasProduct()) {
39352        composeType("product", element.getProduct());
39353      }
39354      if (element.hasQuantity()) {
39355        composeQuantity("quantity", element.getQuantity());
39356      }
39357      if (element.hasDosage()) {
39358        openArray("dosage");
39359        for (Dosage e : element.getDosage()) 
39360          composeDosage(null, e);
39361        closeArray();
39362      };
39363      if (element.hasBodySite()) {
39364        openArray("bodySite");
39365        for (CodeableConcept e : element.getBodySite()) 
39366          composeCodeableConcept(null, e);
39367        closeArray();
39368      };
39369      if (element.hasSpecimenRequirement()) {
39370        if (anyHasValue(element.getSpecimenRequirement())) {
39371          openArray("specimenRequirement");
39372          for (CanonicalType e : element.getSpecimenRequirement()) 
39373            composeCanonicalCore(null, e, e != element.getSpecimenRequirement().get(element.getSpecimenRequirement().size()-1));
39374          closeArray();
39375        }
39376        if (anyHasExtras(element.getSpecimenRequirement())) {
39377          openArray("_specimenRequirement");
39378          for (CanonicalType e : element.getSpecimenRequirement()) 
39379            composeCanonicalExtras(null, e, true);
39380          closeArray();
39381        }
39382      };
39383      if (element.hasObservationRequirement()) {
39384        if (anyHasValue(element.getObservationRequirement())) {
39385          openArray("observationRequirement");
39386          for (CanonicalType e : element.getObservationRequirement()) 
39387            composeCanonicalCore(null, e, e != element.getObservationRequirement().get(element.getObservationRequirement().size()-1));
39388          closeArray();
39389        }
39390        if (anyHasExtras(element.getObservationRequirement())) {
39391          openArray("_observationRequirement");
39392          for (CanonicalType e : element.getObservationRequirement()) 
39393            composeCanonicalExtras(null, e, true);
39394          closeArray();
39395        }
39396      };
39397      if (element.hasObservationResultRequirement()) {
39398        if (anyHasValue(element.getObservationResultRequirement())) {
39399          openArray("observationResultRequirement");
39400          for (CanonicalType e : element.getObservationResultRequirement()) 
39401            composeCanonicalCore(null, e, e != element.getObservationResultRequirement().get(element.getObservationResultRequirement().size()-1));
39402          closeArray();
39403        }
39404        if (anyHasExtras(element.getObservationResultRequirement())) {
39405          openArray("_observationResultRequirement");
39406          for (CanonicalType e : element.getObservationResultRequirement()) 
39407            composeCanonicalExtras(null, e, true);
39408          closeArray();
39409        }
39410      };
39411      if (element.hasTransformElement()) {
39412        composeCanonicalCore("transform", element.getTransformElement(), false);
39413        composeCanonicalExtras("transform", element.getTransformElement(), false);
39414      }
39415      if (element.hasDynamicValue()) {
39416        openArray("dynamicValue");
39417        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
39418          composeActivityDefinitionDynamicValueComponent(null, e);
39419        closeArray();
39420      };
39421  }
39422
39423  protected void composeActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
39424    if (element != null) {
39425      open(name);
39426      composeActivityDefinitionParticipantComponentProperties(element);
39427      close();
39428    }
39429  }
39430
39431  protected void composeActivityDefinitionParticipantComponentProperties(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
39432    composeBackboneElementProperties(element);
39433      if (element.hasTypeElement()) {
39434        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
39435        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
39436      }
39437      if (element.hasTypeCanonicalElement()) {
39438        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
39439        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
39440      }
39441      if (element.hasTypeReference()) {
39442        composeReference("typeReference", element.getTypeReference());
39443      }
39444      if (element.hasRole()) {
39445        composeCodeableConcept("role", element.getRole());
39446      }
39447      if (element.hasFunction()) {
39448        composeCodeableConcept("function", element.getFunction());
39449      }
39450  }
39451
39452  protected void composeActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
39453    if (element != null) {
39454      open(name);
39455      composeActivityDefinitionDynamicValueComponentProperties(element);
39456      close();
39457    }
39458  }
39459
39460  protected void composeActivityDefinitionDynamicValueComponentProperties(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
39461    composeBackboneElementProperties(element);
39462      if (element.hasPathElement()) {
39463        composeStringCore("path", element.getPathElement(), false);
39464        composeStringExtras("path", element.getPathElement(), false);
39465      }
39466      if (element.hasExpression()) {
39467        composeExpression("expression", element.getExpression());
39468      }
39469  }
39470
39471  protected void composeActorDefinition(String name, ActorDefinition element) throws IOException {
39472    if (element != null) {
39473      prop("resourceType", name);
39474      composeActorDefinitionProperties(element);
39475    }
39476  }
39477
39478  protected void composeActorDefinitionProperties(ActorDefinition element) throws IOException {
39479    composeCanonicalResourceProperties(element);
39480      if (element.hasUrlElement()) {
39481        composeUriCore("url", element.getUrlElement(), false);
39482        composeUriExtras("url", element.getUrlElement(), false);
39483      }
39484      if (element.hasIdentifier()) {
39485        openArray("identifier");
39486        for (Identifier e : element.getIdentifier()) 
39487          composeIdentifier(null, e);
39488        closeArray();
39489      };
39490      if (element.hasVersionElement()) {
39491        composeStringCore("version", element.getVersionElement(), false);
39492        composeStringExtras("version", element.getVersionElement(), false);
39493      }
39494      if (element.hasVersionAlgorithm()) {
39495        composeType("versionAlgorithm", element.getVersionAlgorithm());
39496      }
39497      if (element.hasNameElement()) {
39498        composeStringCore("name", element.getNameElement(), false);
39499        composeStringExtras("name", element.getNameElement(), false);
39500      }
39501      if (element.hasTitleElement()) {
39502        composeStringCore("title", element.getTitleElement(), false);
39503        composeStringExtras("title", element.getTitleElement(), false);
39504      }
39505      if (element.hasStatusElement()) {
39506        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39507        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39508      }
39509      if (element.hasExperimentalElement()) {
39510        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39511        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39512      }
39513      if (element.hasDateElement()) {
39514        composeDateTimeCore("date", element.getDateElement(), false);
39515        composeDateTimeExtras("date", element.getDateElement(), false);
39516      }
39517      if (element.hasPublisherElement()) {
39518        composeStringCore("publisher", element.getPublisherElement(), false);
39519        composeStringExtras("publisher", element.getPublisherElement(), false);
39520      }
39521      if (element.hasContact()) {
39522        openArray("contact");
39523        for (ContactDetail e : element.getContact()) 
39524          composeContactDetail(null, e);
39525        closeArray();
39526      };
39527      if (element.hasDescriptionElement()) {
39528        composeMarkdownCore("description", element.getDescriptionElement(), false);
39529        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39530      }
39531      if (element.hasUseContext()) {
39532        openArray("useContext");
39533        for (UsageContext e : element.getUseContext()) 
39534          composeUsageContext(null, e);
39535        closeArray();
39536      };
39537      if (element.hasJurisdiction()) {
39538        openArray("jurisdiction");
39539        for (CodeableConcept e : element.getJurisdiction()) 
39540          composeCodeableConcept(null, e);
39541        closeArray();
39542      };
39543      if (element.hasPurposeElement()) {
39544        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39545        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39546      }
39547      if (element.hasCopyrightElement()) {
39548        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39549        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39550      }
39551      if (element.hasCopyrightLabelElement()) {
39552        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
39553        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
39554      }
39555      if (element.hasTypeElement()) {
39556        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
39557        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
39558      }
39559      if (element.hasDocumentationElement()) {
39560        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
39561        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
39562      }
39563      if (element.hasReference()) {
39564        if (anyHasValue(element.getReference())) {
39565          openArray("reference");
39566          for (UrlType e : element.getReference()) 
39567            composeUrlCore(null, e, e != element.getReference().get(element.getReference().size()-1));
39568          closeArray();
39569        }
39570        if (anyHasExtras(element.getReference())) {
39571          openArray("_reference");
39572          for (UrlType e : element.getReference()) 
39573            composeUrlExtras(null, e, true);
39574          closeArray();
39575        }
39576      };
39577      if (element.hasCapabilitiesElement()) {
39578        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
39579        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
39580      }
39581      if (element.hasDerivedFrom()) {
39582        if (anyHasValue(element.getDerivedFrom())) {
39583          openArray("derivedFrom");
39584          for (CanonicalType e : element.getDerivedFrom()) 
39585            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
39586          closeArray();
39587        }
39588        if (anyHasExtras(element.getDerivedFrom())) {
39589          openArray("_derivedFrom");
39590          for (CanonicalType e : element.getDerivedFrom()) 
39591            composeCanonicalExtras(null, e, true);
39592          closeArray();
39593        }
39594      };
39595  }
39596
39597  protected void composeAdministrableProductDefinition(String name, AdministrableProductDefinition element) throws IOException {
39598    if (element != null) {
39599      prop("resourceType", name);
39600      composeAdministrableProductDefinitionProperties(element);
39601    }
39602  }
39603
39604  protected void composeAdministrableProductDefinitionProperties(AdministrableProductDefinition element) throws IOException {
39605    composeDomainResourceProperties(element);
39606      if (element.hasIdentifier()) {
39607        openArray("identifier");
39608        for (Identifier e : element.getIdentifier()) 
39609          composeIdentifier(null, e);
39610        closeArray();
39611      };
39612      if (element.hasStatusElement()) {
39613        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39614        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39615      }
39616      if (element.hasFormOf()) {
39617        openArray("formOf");
39618        for (Reference e : element.getFormOf()) 
39619          composeReference(null, e);
39620        closeArray();
39621      };
39622      if (element.hasAdministrableDoseForm()) {
39623        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
39624      }
39625      if (element.hasUnitOfPresentation()) {
39626        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
39627      }
39628      if (element.hasProducedFrom()) {
39629        openArray("producedFrom");
39630        for (Reference e : element.getProducedFrom()) 
39631          composeReference(null, e);
39632        closeArray();
39633      };
39634      if (element.hasIngredient()) {
39635        openArray("ingredient");
39636        for (CodeableConcept e : element.getIngredient()) 
39637          composeCodeableConcept(null, e);
39638        closeArray();
39639      };
39640      if (element.hasDevice()) {
39641        composeReference("device", element.getDevice());
39642      }
39643      if (element.hasDescriptionElement()) {
39644        composeMarkdownCore("description", element.getDescriptionElement(), false);
39645        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39646      }
39647      if (element.hasProperty()) {
39648        openArray("property");
39649        for (AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent e : element.getProperty()) 
39650          composeAdministrableProductDefinitionPropertyComponent(null, e);
39651        closeArray();
39652      };
39653      if (element.hasRouteOfAdministration()) {
39654        openArray("routeOfAdministration");
39655        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
39656          composeAdministrableProductDefinitionRouteOfAdministrationComponent(null, e);
39657        closeArray();
39658      };
39659  }
39660
39661  protected void composeAdministrableProductDefinitionPropertyComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
39662    if (element != null) {
39663      open(name);
39664      composeAdministrableProductDefinitionPropertyComponentProperties(element);
39665      close();
39666    }
39667  }
39668
39669  protected void composeAdministrableProductDefinitionPropertyComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
39670    composeBackboneElementProperties(element);
39671      if (element.hasType()) {
39672        composeCodeableConcept("type", element.getType());
39673      }
39674      if (element.hasValue()) {
39675        composeType("value", element.getValue());
39676      }
39677      if (element.hasStatus()) {
39678        composeCodeableConcept("status", element.getStatus());
39679      }
39680  }
39681
39682  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
39683    if (element != null) {
39684      open(name);
39685      composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(element);
39686      close();
39687    }
39688  }
39689
39690  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
39691    composeBackboneElementProperties(element);
39692      if (element.hasCode()) {
39693        composeCodeableConcept("code", element.getCode());
39694      }
39695      if (element.hasFirstDose()) {
39696        composeQuantity("firstDose", element.getFirstDose());
39697      }
39698      if (element.hasMaxSingleDose()) {
39699        composeQuantity("maxSingleDose", element.getMaxSingleDose());
39700      }
39701      if (element.hasMaxDosePerDay()) {
39702        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
39703      }
39704      if (element.hasMaxDosePerTreatmentPeriod()) {
39705        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
39706      }
39707      if (element.hasMaxTreatmentPeriod()) {
39708        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
39709      }
39710      if (element.hasTargetSpecies()) {
39711        openArray("targetSpecies");
39712        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
39713          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(null, e);
39714        closeArray();
39715      };
39716  }
39717
39718  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
39719    if (element != null) {
39720      open(name);
39721      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(element);
39722      close();
39723    }
39724  }
39725
39726  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
39727    composeBackboneElementProperties(element);
39728      if (element.hasCode()) {
39729        composeCodeableConcept("code", element.getCode());
39730      }
39731      if (element.hasWithdrawalPeriod()) {
39732        openArray("withdrawalPeriod");
39733        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
39734          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
39735        closeArray();
39736      };
39737  }
39738
39739  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
39740    if (element != null) {
39741      open(name);
39742      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(element);
39743      close();
39744    }
39745  }
39746
39747  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
39748    composeBackboneElementProperties(element);
39749      if (element.hasTissue()) {
39750        composeCodeableConcept("tissue", element.getTissue());
39751      }
39752      if (element.hasValue()) {
39753        composeQuantity("value", element.getValue());
39754      }
39755      if (element.hasSupportingInformationElement()) {
39756        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
39757        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
39758      }
39759  }
39760
39761  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
39762    if (element != null) {
39763      prop("resourceType", name);
39764      composeAdverseEventProperties(element);
39765    }
39766  }
39767
39768  protected void composeAdverseEventProperties(AdverseEvent element) throws IOException {
39769    composeDomainResourceProperties(element);
39770      if (element.hasIdentifier()) {
39771        openArray("identifier");
39772        for (Identifier e : element.getIdentifier()) 
39773          composeIdentifier(null, e);
39774        closeArray();
39775      };
39776      if (element.hasStatusElement()) {
39777        composeEnumerationCore("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
39778        composeEnumerationExtras("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
39779      }
39780      if (element.hasActualityElement()) {
39781        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
39782        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
39783      }
39784      if (element.hasCategory()) {
39785        openArray("category");
39786        for (CodeableConcept e : element.getCategory()) 
39787          composeCodeableConcept(null, e);
39788        closeArray();
39789      };
39790      if (element.hasCode()) {
39791        composeCodeableConcept("code", element.getCode());
39792      }
39793      if (element.hasSubject()) {
39794        composeReference("subject", element.getSubject());
39795      }
39796      if (element.hasEncounter()) {
39797        composeReference("encounter", element.getEncounter());
39798      }
39799      if (element.hasOccurrence()) {
39800        composeType("occurrence", element.getOccurrence());
39801      }
39802      if (element.hasDetectedElement()) {
39803        composeDateTimeCore("detected", element.getDetectedElement(), false);
39804        composeDateTimeExtras("detected", element.getDetectedElement(), false);
39805      }
39806      if (element.hasRecordedDateElement()) {
39807        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
39808        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
39809      }
39810      if (element.hasResultingEffect()) {
39811        openArray("resultingEffect");
39812        for (Reference e : element.getResultingEffect()) 
39813          composeReference(null, e);
39814        closeArray();
39815      };
39816      if (element.hasLocation()) {
39817        composeReference("location", element.getLocation());
39818      }
39819      if (element.hasSeriousness()) {
39820        composeCodeableConcept("seriousness", element.getSeriousness());
39821      }
39822      if (element.hasOutcome()) {
39823        openArray("outcome");
39824        for (CodeableConcept e : element.getOutcome()) 
39825          composeCodeableConcept(null, e);
39826        closeArray();
39827      };
39828      if (element.hasRecorder()) {
39829        composeReference("recorder", element.getRecorder());
39830      }
39831      if (element.hasParticipant()) {
39832        openArray("participant");
39833        for (AdverseEvent.AdverseEventParticipantComponent e : element.getParticipant()) 
39834          composeAdverseEventParticipantComponent(null, e);
39835        closeArray();
39836      };
39837      if (element.hasStudy()) {
39838        openArray("study");
39839        for (Reference e : element.getStudy()) 
39840          composeReference(null, e);
39841        closeArray();
39842      };
39843      if (element.hasExpectedInResearchStudyElement()) {
39844        composeBooleanCore("expectedInResearchStudy", element.getExpectedInResearchStudyElement(), false);
39845        composeBooleanExtras("expectedInResearchStudy", element.getExpectedInResearchStudyElement(), false);
39846      }
39847      if (element.hasSuspectEntity()) {
39848        openArray("suspectEntity");
39849        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
39850          composeAdverseEventSuspectEntityComponent(null, e);
39851        closeArray();
39852      };
39853      if (element.hasContributingFactor()) {
39854        openArray("contributingFactor");
39855        for (AdverseEvent.AdverseEventContributingFactorComponent e : element.getContributingFactor()) 
39856          composeAdverseEventContributingFactorComponent(null, e);
39857        closeArray();
39858      };
39859      if (element.hasPreventiveAction()) {
39860        openArray("preventiveAction");
39861        for (AdverseEvent.AdverseEventPreventiveActionComponent e : element.getPreventiveAction()) 
39862          composeAdverseEventPreventiveActionComponent(null, e);
39863        closeArray();
39864      };
39865      if (element.hasMitigatingAction()) {
39866        openArray("mitigatingAction");
39867        for (AdverseEvent.AdverseEventMitigatingActionComponent e : element.getMitigatingAction()) 
39868          composeAdverseEventMitigatingActionComponent(null, e);
39869        closeArray();
39870      };
39871      if (element.hasSupportingInfo()) {
39872        openArray("supportingInfo");
39873        for (AdverseEvent.AdverseEventSupportingInfoComponent e : element.getSupportingInfo()) 
39874          composeAdverseEventSupportingInfoComponent(null, e);
39875        closeArray();
39876      };
39877      if (element.hasNote()) {
39878        openArray("note");
39879        for (Annotation e : element.getNote()) 
39880          composeAnnotation(null, e);
39881        closeArray();
39882      };
39883  }
39884
39885  protected void composeAdverseEventParticipantComponent(String name, AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
39886    if (element != null) {
39887      open(name);
39888      composeAdverseEventParticipantComponentProperties(element);
39889      close();
39890    }
39891  }
39892
39893  protected void composeAdverseEventParticipantComponentProperties(AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
39894    composeBackboneElementProperties(element);
39895      if (element.hasFunction()) {
39896        composeCodeableConcept("function", element.getFunction());
39897      }
39898      if (element.hasActor()) {
39899        composeReference("actor", element.getActor());
39900      }
39901  }
39902
39903  protected void composeAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
39904    if (element != null) {
39905      open(name);
39906      composeAdverseEventSuspectEntityComponentProperties(element);
39907      close();
39908    }
39909  }
39910
39911  protected void composeAdverseEventSuspectEntityComponentProperties(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
39912    composeBackboneElementProperties(element);
39913      if (element.hasInstance()) {
39914        composeType("instance", element.getInstance());
39915      }
39916      if (element.hasCausality()) {
39917        composeAdverseEventSuspectEntityCausalityComponent("causality", element.getCausality());
39918      }
39919  }
39920
39921  protected void composeAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
39922    if (element != null) {
39923      open(name);
39924      composeAdverseEventSuspectEntityCausalityComponentProperties(element);
39925      close();
39926    }
39927  }
39928
39929  protected void composeAdverseEventSuspectEntityCausalityComponentProperties(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
39930    composeBackboneElementProperties(element);
39931      if (element.hasAssessmentMethod()) {
39932        composeCodeableConcept("assessmentMethod", element.getAssessmentMethod());
39933      }
39934      if (element.hasEntityRelatedness()) {
39935        composeCodeableConcept("entityRelatedness", element.getEntityRelatedness());
39936      }
39937      if (element.hasAuthor()) {
39938        composeReference("author", element.getAuthor());
39939      }
39940  }
39941
39942  protected void composeAdverseEventContributingFactorComponent(String name, AdverseEvent.AdverseEventContributingFactorComponent element) throws IOException {
39943    if (element != null) {
39944      open(name);
39945      composeAdverseEventContributingFactorComponentProperties(element);
39946      close();
39947    }
39948  }
39949
39950  protected void composeAdverseEventContributingFactorComponentProperties(AdverseEvent.AdverseEventContributingFactorComponent element) throws IOException {
39951    composeBackboneElementProperties(element);
39952      if (element.hasItem()) {
39953        composeType("item", element.getItem());
39954      }
39955  }
39956
39957  protected void composeAdverseEventPreventiveActionComponent(String name, AdverseEvent.AdverseEventPreventiveActionComponent element) throws IOException {
39958    if (element != null) {
39959      open(name);
39960      composeAdverseEventPreventiveActionComponentProperties(element);
39961      close();
39962    }
39963  }
39964
39965  protected void composeAdverseEventPreventiveActionComponentProperties(AdverseEvent.AdverseEventPreventiveActionComponent element) throws IOException {
39966    composeBackboneElementProperties(element);
39967      if (element.hasItem()) {
39968        composeType("item", element.getItem());
39969      }
39970  }
39971
39972  protected void composeAdverseEventMitigatingActionComponent(String name, AdverseEvent.AdverseEventMitigatingActionComponent element) throws IOException {
39973    if (element != null) {
39974      open(name);
39975      composeAdverseEventMitigatingActionComponentProperties(element);
39976      close();
39977    }
39978  }
39979
39980  protected void composeAdverseEventMitigatingActionComponentProperties(AdverseEvent.AdverseEventMitigatingActionComponent element) throws IOException {
39981    composeBackboneElementProperties(element);
39982      if (element.hasItem()) {
39983        composeType("item", element.getItem());
39984      }
39985  }
39986
39987  protected void composeAdverseEventSupportingInfoComponent(String name, AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
39988    if (element != null) {
39989      open(name);
39990      composeAdverseEventSupportingInfoComponentProperties(element);
39991      close();
39992    }
39993  }
39994
39995  protected void composeAdverseEventSupportingInfoComponentProperties(AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
39996    composeBackboneElementProperties(element);
39997      if (element.hasItem()) {
39998        composeType("item", element.getItem());
39999      }
40000  }
40001
40002  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
40003    if (element != null) {
40004      prop("resourceType", name);
40005      composeAllergyIntoleranceProperties(element);
40006    }
40007  }
40008
40009  protected void composeAllergyIntoleranceProperties(AllergyIntolerance element) throws IOException {
40010    composeDomainResourceProperties(element);
40011      if (element.hasIdentifier()) {
40012        openArray("identifier");
40013        for (Identifier e : element.getIdentifier()) 
40014          composeIdentifier(null, e);
40015        closeArray();
40016      };
40017      if (element.hasClinicalStatus()) {
40018        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
40019      }
40020      if (element.hasVerificationStatus()) {
40021        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
40022      }
40023      if (element.hasType()) {
40024        composeCodeableConcept("type", element.getType());
40025      }
40026      if (element.hasCategory()) {
40027        openArray("category");
40028        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
40029          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
40030        closeArray();
40031        if (anyHasExtras(element.getCategory())) {
40032          openArray("_category");
40033          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
40034            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
40035          closeArray();
40036        }
40037      };
40038      if (element.hasCriticalityElement()) {
40039        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
40040        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
40041      }
40042      if (element.hasCode()) {
40043        composeCodeableConcept("code", element.getCode());
40044      }
40045      if (element.hasPatient()) {
40046        composeReference("patient", element.getPatient());
40047      }
40048      if (element.hasEncounter()) {
40049        composeReference("encounter", element.getEncounter());
40050      }
40051      if (element.hasOnset()) {
40052        composeType("onset", element.getOnset());
40053      }
40054      if (element.hasRecordedDateElement()) {
40055        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
40056        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
40057      }
40058      if (element.hasParticipant()) {
40059        openArray("participant");
40060        for (AllergyIntolerance.AllergyIntoleranceParticipantComponent e : element.getParticipant()) 
40061          composeAllergyIntoleranceParticipantComponent(null, e);
40062        closeArray();
40063      };
40064      if (element.hasLastOccurrenceElement()) {
40065        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
40066        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
40067      }
40068      if (element.hasNote()) {
40069        openArray("note");
40070        for (Annotation e : element.getNote()) 
40071          composeAnnotation(null, e);
40072        closeArray();
40073      };
40074      if (element.hasReaction()) {
40075        openArray("reaction");
40076        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
40077          composeAllergyIntoleranceReactionComponent(null, e);
40078        closeArray();
40079      };
40080  }
40081
40082  protected void composeAllergyIntoleranceParticipantComponent(String name, AllergyIntolerance.AllergyIntoleranceParticipantComponent element) throws IOException {
40083    if (element != null) {
40084      open(name);
40085      composeAllergyIntoleranceParticipantComponentProperties(element);
40086      close();
40087    }
40088  }
40089
40090  protected void composeAllergyIntoleranceParticipantComponentProperties(AllergyIntolerance.AllergyIntoleranceParticipantComponent element) throws IOException {
40091    composeBackboneElementProperties(element);
40092      if (element.hasFunction()) {
40093        composeCodeableConcept("function", element.getFunction());
40094      }
40095      if (element.hasActor()) {
40096        composeReference("actor", element.getActor());
40097      }
40098  }
40099
40100  protected void composeAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
40101    if (element != null) {
40102      open(name);
40103      composeAllergyIntoleranceReactionComponentProperties(element);
40104      close();
40105    }
40106  }
40107
40108  protected void composeAllergyIntoleranceReactionComponentProperties(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
40109    composeBackboneElementProperties(element);
40110      if (element.hasSubstance()) {
40111        composeCodeableConcept("substance", element.getSubstance());
40112      }
40113      if (element.hasManifestation()) {
40114        openArray("manifestation");
40115        for (CodeableReference e : element.getManifestation()) 
40116          composeCodeableReference(null, e);
40117        closeArray();
40118      };
40119      if (element.hasDescriptionElement()) {
40120        composeStringCore("description", element.getDescriptionElement(), false);
40121        composeStringExtras("description", element.getDescriptionElement(), false);
40122      }
40123      if (element.hasOnsetElement()) {
40124        composeDateTimeCore("onset", element.getOnsetElement(), false);
40125        composeDateTimeExtras("onset", element.getOnsetElement(), false);
40126      }
40127      if (element.hasSeverityElement()) {
40128        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
40129        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
40130      }
40131      if (element.hasExposureRoute()) {
40132        composeCodeableConcept("exposureRoute", element.getExposureRoute());
40133      }
40134      if (element.hasNote()) {
40135        openArray("note");
40136        for (Annotation e : element.getNote()) 
40137          composeAnnotation(null, e);
40138        closeArray();
40139      };
40140  }
40141
40142  protected void composeAppointment(String name, Appointment element) throws IOException {
40143    if (element != null) {
40144      prop("resourceType", name);
40145      composeAppointmentProperties(element);
40146    }
40147  }
40148
40149  protected void composeAppointmentProperties(Appointment element) throws IOException {
40150    composeDomainResourceProperties(element);
40151      if (element.hasIdentifier()) {
40152        openArray("identifier");
40153        for (Identifier e : element.getIdentifier()) 
40154          composeIdentifier(null, e);
40155        closeArray();
40156      };
40157      if (element.hasStatusElement()) {
40158        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
40159        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
40160      }
40161      if (element.hasCancellationReason()) {
40162        composeCodeableConcept("cancellationReason", element.getCancellationReason());
40163      }
40164      if (element.hasClass_()) {
40165        openArray("class");
40166        for (CodeableConcept e : element.getClass_()) 
40167          composeCodeableConcept(null, e);
40168        closeArray();
40169      };
40170      if (element.hasServiceCategory()) {
40171        openArray("serviceCategory");
40172        for (CodeableConcept e : element.getServiceCategory()) 
40173          composeCodeableConcept(null, e);
40174        closeArray();
40175      };
40176      if (element.hasServiceType()) {
40177        openArray("serviceType");
40178        for (CodeableReference e : element.getServiceType()) 
40179          composeCodeableReference(null, e);
40180        closeArray();
40181      };
40182      if (element.hasSpecialty()) {
40183        openArray("specialty");
40184        for (CodeableConcept e : element.getSpecialty()) 
40185          composeCodeableConcept(null, e);
40186        closeArray();
40187      };
40188      if (element.hasAppointmentType()) {
40189        composeCodeableConcept("appointmentType", element.getAppointmentType());
40190      }
40191      if (element.hasReason()) {
40192        openArray("reason");
40193        for (CodeableReference e : element.getReason()) 
40194          composeCodeableReference(null, e);
40195        closeArray();
40196      };
40197      if (element.hasPriority()) {
40198        composeCodeableConcept("priority", element.getPriority());
40199      }
40200      if (element.hasDescriptionElement()) {
40201        composeStringCore("description", element.getDescriptionElement(), false);
40202        composeStringExtras("description", element.getDescriptionElement(), false);
40203      }
40204      if (element.hasReplaces()) {
40205        openArray("replaces");
40206        for (Reference e : element.getReplaces()) 
40207          composeReference(null, e);
40208        closeArray();
40209      };
40210      if (element.hasVirtualService()) {
40211        openArray("virtualService");
40212        for (VirtualServiceDetail e : element.getVirtualService()) 
40213          composeVirtualServiceDetail(null, e);
40214        closeArray();
40215      };
40216      if (element.hasSupportingInformation()) {
40217        openArray("supportingInformation");
40218        for (Reference e : element.getSupportingInformation()) 
40219          composeReference(null, e);
40220        closeArray();
40221      };
40222      if (element.hasPreviousAppointment()) {
40223        composeReference("previousAppointment", element.getPreviousAppointment());
40224      }
40225      if (element.hasOriginatingAppointment()) {
40226        composeReference("originatingAppointment", element.getOriginatingAppointment());
40227      }
40228      if (element.hasStartElement()) {
40229        composeInstantCore("start", element.getStartElement(), false);
40230        composeInstantExtras("start", element.getStartElement(), false);
40231      }
40232      if (element.hasEndElement()) {
40233        composeInstantCore("end", element.getEndElement(), false);
40234        composeInstantExtras("end", element.getEndElement(), false);
40235      }
40236      if (element.hasMinutesDurationElement()) {
40237        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
40238        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
40239      }
40240      if (element.hasRequestedPeriod()) {
40241        openArray("requestedPeriod");
40242        for (Period e : element.getRequestedPeriod()) 
40243          composePeriod(null, e);
40244        closeArray();
40245      };
40246      if (element.hasSlot()) {
40247        openArray("slot");
40248        for (Reference e : element.getSlot()) 
40249          composeReference(null, e);
40250        closeArray();
40251      };
40252      if (element.hasAccount()) {
40253        openArray("account");
40254        for (Reference e : element.getAccount()) 
40255          composeReference(null, e);
40256        closeArray();
40257      };
40258      if (element.hasCreatedElement()) {
40259        composeDateTimeCore("created", element.getCreatedElement(), false);
40260        composeDateTimeExtras("created", element.getCreatedElement(), false);
40261      }
40262      if (element.hasCancellationDateElement()) {
40263        composeDateTimeCore("cancellationDate", element.getCancellationDateElement(), false);
40264        composeDateTimeExtras("cancellationDate", element.getCancellationDateElement(), false);
40265      }
40266      if (element.hasNote()) {
40267        openArray("note");
40268        for (Annotation e : element.getNote()) 
40269          composeAnnotation(null, e);
40270        closeArray();
40271      };
40272      if (element.hasPatientInstruction()) {
40273        openArray("patientInstruction");
40274        for (CodeableReference e : element.getPatientInstruction()) 
40275          composeCodeableReference(null, e);
40276        closeArray();
40277      };
40278      if (element.hasBasedOn()) {
40279        openArray("basedOn");
40280        for (Reference e : element.getBasedOn()) 
40281          composeReference(null, e);
40282        closeArray();
40283      };
40284      if (element.hasSubject()) {
40285        composeReference("subject", element.getSubject());
40286      }
40287      if (element.hasParticipant()) {
40288        openArray("participant");
40289        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
40290          composeAppointmentParticipantComponent(null, e);
40291        closeArray();
40292      };
40293      if (element.hasRecurrenceIdElement()) {
40294        composePositiveIntCore("recurrenceId", element.getRecurrenceIdElement(), false);
40295        composePositiveIntExtras("recurrenceId", element.getRecurrenceIdElement(), false);
40296      }
40297      if (element.hasOccurrenceChangedElement()) {
40298        composeBooleanCore("occurrenceChanged", element.getOccurrenceChangedElement(), false);
40299        composeBooleanExtras("occurrenceChanged", element.getOccurrenceChangedElement(), false);
40300      }
40301      if (element.hasRecurrenceTemplate()) {
40302        openArray("recurrenceTemplate");
40303        for (Appointment.AppointmentRecurrenceTemplateComponent e : element.getRecurrenceTemplate()) 
40304          composeAppointmentRecurrenceTemplateComponent(null, e);
40305        closeArray();
40306      };
40307  }
40308
40309  protected void composeAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
40310    if (element != null) {
40311      open(name);
40312      composeAppointmentParticipantComponentProperties(element);
40313      close();
40314    }
40315  }
40316
40317  protected void composeAppointmentParticipantComponentProperties(Appointment.AppointmentParticipantComponent element) throws IOException {
40318    composeBackboneElementProperties(element);
40319      if (element.hasType()) {
40320        openArray("type");
40321        for (CodeableConcept e : element.getType()) 
40322          composeCodeableConcept(null, e);
40323        closeArray();
40324      };
40325      if (element.hasPeriod()) {
40326        composePeriod("period", element.getPeriod());
40327      }
40328      if (element.hasActor()) {
40329        composeReference("actor", element.getActor());
40330      }
40331      if (element.hasRequiredElement()) {
40332        composeBooleanCore("required", element.getRequiredElement(), false);
40333        composeBooleanExtras("required", element.getRequiredElement(), false);
40334      }
40335      if (element.hasStatusElement()) {
40336        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
40337        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
40338      }
40339  }
40340
40341  protected void composeAppointmentRecurrenceTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateComponent element) throws IOException {
40342    if (element != null) {
40343      open(name);
40344      composeAppointmentRecurrenceTemplateComponentProperties(element);
40345      close();
40346    }
40347  }
40348
40349  protected void composeAppointmentRecurrenceTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateComponent element) throws IOException {
40350    composeBackboneElementProperties(element);
40351      if (element.hasTimezone()) {
40352        composeCodeableConcept("timezone", element.getTimezone());
40353      }
40354      if (element.hasRecurrenceType()) {
40355        composeCodeableConcept("recurrenceType", element.getRecurrenceType());
40356      }
40357      if (element.hasLastOccurrenceDateElement()) {
40358        composeDateCore("lastOccurrenceDate", element.getLastOccurrenceDateElement(), false);
40359        composeDateExtras("lastOccurrenceDate", element.getLastOccurrenceDateElement(), false);
40360      }
40361      if (element.hasOccurrenceCountElement()) {
40362        composePositiveIntCore("occurrenceCount", element.getOccurrenceCountElement(), false);
40363        composePositiveIntExtras("occurrenceCount", element.getOccurrenceCountElement(), false);
40364      }
40365      if (element.hasOccurrenceDate()) {
40366        if (anyHasValue(element.getOccurrenceDate())) {
40367          openArray("occurrenceDate");
40368          for (DateType e : element.getOccurrenceDate()) 
40369            composeDateCore(null, e, e != element.getOccurrenceDate().get(element.getOccurrenceDate().size()-1));
40370          closeArray();
40371        }
40372        if (anyHasExtras(element.getOccurrenceDate())) {
40373          openArray("_occurrenceDate");
40374          for (DateType e : element.getOccurrenceDate()) 
40375            composeDateExtras(null, e, true);
40376          closeArray();
40377        }
40378      };
40379      if (element.hasWeeklyTemplate()) {
40380        composeAppointmentRecurrenceTemplateWeeklyTemplateComponent("weeklyTemplate", element.getWeeklyTemplate());
40381      }
40382      if (element.hasMonthlyTemplate()) {
40383        composeAppointmentRecurrenceTemplateMonthlyTemplateComponent("monthlyTemplate", element.getMonthlyTemplate());
40384      }
40385      if (element.hasYearlyTemplate()) {
40386        composeAppointmentRecurrenceTemplateYearlyTemplateComponent("yearlyTemplate", element.getYearlyTemplate());
40387      }
40388      if (element.hasExcludingDate()) {
40389        if (anyHasValue(element.getExcludingDate())) {
40390          openArray("excludingDate");
40391          for (DateType e : element.getExcludingDate()) 
40392            composeDateCore(null, e, e != element.getExcludingDate().get(element.getExcludingDate().size()-1));
40393          closeArray();
40394        }
40395        if (anyHasExtras(element.getExcludingDate())) {
40396          openArray("_excludingDate");
40397          for (DateType e : element.getExcludingDate()) 
40398            composeDateExtras(null, e, true);
40399          closeArray();
40400        }
40401      };
40402      if (element.hasExcludingRecurrenceId()) {
40403        if (anyHasValue(element.getExcludingRecurrenceId())) {
40404          openArray("excludingRecurrenceId");
40405          for (PositiveIntType e : element.getExcludingRecurrenceId()) 
40406            composePositiveIntCore(null, e, e != element.getExcludingRecurrenceId().get(element.getExcludingRecurrenceId().size()-1));
40407          closeArray();
40408        }
40409        if (anyHasExtras(element.getExcludingRecurrenceId())) {
40410          openArray("_excludingRecurrenceId");
40411          for (PositiveIntType e : element.getExcludingRecurrenceId()) 
40412            composePositiveIntExtras(null, e, true);
40413          closeArray();
40414        }
40415      };
40416  }
40417
40418  protected void composeAppointmentRecurrenceTemplateWeeklyTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent element) throws IOException {
40419    if (element != null) {
40420      open(name);
40421      composeAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(element);
40422      close();
40423    }
40424  }
40425
40426  protected void composeAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent element) throws IOException {
40427    composeBackboneElementProperties(element);
40428      if (element.hasMondayElement()) {
40429        composeBooleanCore("monday", element.getMondayElement(), false);
40430        composeBooleanExtras("monday", element.getMondayElement(), false);
40431      }
40432      if (element.hasTuesdayElement()) {
40433        composeBooleanCore("tuesday", element.getTuesdayElement(), false);
40434        composeBooleanExtras("tuesday", element.getTuesdayElement(), false);
40435      }
40436      if (element.hasWednesdayElement()) {
40437        composeBooleanCore("wednesday", element.getWednesdayElement(), false);
40438        composeBooleanExtras("wednesday", element.getWednesdayElement(), false);
40439      }
40440      if (element.hasThursdayElement()) {
40441        composeBooleanCore("thursday", element.getThursdayElement(), false);
40442        composeBooleanExtras("thursday", element.getThursdayElement(), false);
40443      }
40444      if (element.hasFridayElement()) {
40445        composeBooleanCore("friday", element.getFridayElement(), false);
40446        composeBooleanExtras("friday", element.getFridayElement(), false);
40447      }
40448      if (element.hasSaturdayElement()) {
40449        composeBooleanCore("saturday", element.getSaturdayElement(), false);
40450        composeBooleanExtras("saturday", element.getSaturdayElement(), false);
40451      }
40452      if (element.hasSundayElement()) {
40453        composeBooleanCore("sunday", element.getSundayElement(), false);
40454        composeBooleanExtras("sunday", element.getSundayElement(), false);
40455      }
40456      if (element.hasWeekIntervalElement()) {
40457        composePositiveIntCore("weekInterval", element.getWeekIntervalElement(), false);
40458        composePositiveIntExtras("weekInterval", element.getWeekIntervalElement(), false);
40459      }
40460  }
40461
40462  protected void composeAppointmentRecurrenceTemplateMonthlyTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent element) throws IOException {
40463    if (element != null) {
40464      open(name);
40465      composeAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(element);
40466      close();
40467    }
40468  }
40469
40470  protected void composeAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent element) throws IOException {
40471    composeBackboneElementProperties(element);
40472      if (element.hasDayOfMonthElement()) {
40473        composePositiveIntCore("dayOfMonth", element.getDayOfMonthElement(), false);
40474        composePositiveIntExtras("dayOfMonth", element.getDayOfMonthElement(), false);
40475      }
40476      if (element.hasNthWeekOfMonth()) {
40477        composeCoding("nthWeekOfMonth", element.getNthWeekOfMonth());
40478      }
40479      if (element.hasDayOfWeek()) {
40480        composeCoding("dayOfWeek", element.getDayOfWeek());
40481      }
40482      if (element.hasMonthIntervalElement()) {
40483        composePositiveIntCore("monthInterval", element.getMonthIntervalElement(), false);
40484        composePositiveIntExtras("monthInterval", element.getMonthIntervalElement(), false);
40485      }
40486  }
40487
40488  protected void composeAppointmentRecurrenceTemplateYearlyTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent element) throws IOException {
40489    if (element != null) {
40490      open(name);
40491      composeAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(element);
40492      close();
40493    }
40494  }
40495
40496  protected void composeAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent element) throws IOException {
40497    composeBackboneElementProperties(element);
40498      if (element.hasYearIntervalElement()) {
40499        composePositiveIntCore("yearInterval", element.getYearIntervalElement(), false);
40500        composePositiveIntExtras("yearInterval", element.getYearIntervalElement(), false);
40501      }
40502  }
40503
40504  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
40505    if (element != null) {
40506      prop("resourceType", name);
40507      composeAppointmentResponseProperties(element);
40508    }
40509  }
40510
40511  protected void composeAppointmentResponseProperties(AppointmentResponse element) throws IOException {
40512    composeDomainResourceProperties(element);
40513      if (element.hasIdentifier()) {
40514        openArray("identifier");
40515        for (Identifier e : element.getIdentifier()) 
40516          composeIdentifier(null, e);
40517        closeArray();
40518      };
40519      if (element.hasAppointment()) {
40520        composeReference("appointment", element.getAppointment());
40521      }
40522      if (element.hasProposedNewTimeElement()) {
40523        composeBooleanCore("proposedNewTime", element.getProposedNewTimeElement(), false);
40524        composeBooleanExtras("proposedNewTime", element.getProposedNewTimeElement(), false);
40525      }
40526      if (element.hasStartElement()) {
40527        composeInstantCore("start", element.getStartElement(), false);
40528        composeInstantExtras("start", element.getStartElement(), false);
40529      }
40530      if (element.hasEndElement()) {
40531        composeInstantCore("end", element.getEndElement(), false);
40532        composeInstantExtras("end", element.getEndElement(), false);
40533      }
40534      if (element.hasParticipantType()) {
40535        openArray("participantType");
40536        for (CodeableConcept e : element.getParticipantType()) 
40537          composeCodeableConcept(null, e);
40538        closeArray();
40539      };
40540      if (element.hasActor()) {
40541        composeReference("actor", element.getActor());
40542      }
40543      if (element.hasParticipantStatusElement()) {
40544        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.AppointmentResponseStatusEnumFactory(), false);
40545        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.AppointmentResponseStatusEnumFactory(), false);
40546      }
40547      if (element.hasCommentElement()) {
40548        composeMarkdownCore("comment", element.getCommentElement(), false);
40549        composeMarkdownExtras("comment", element.getCommentElement(), false);
40550      }
40551      if (element.hasRecurringElement()) {
40552        composeBooleanCore("recurring", element.getRecurringElement(), false);
40553        composeBooleanExtras("recurring", element.getRecurringElement(), false);
40554      }
40555      if (element.hasOccurrenceDateElement()) {
40556        composeDateCore("occurrenceDate", element.getOccurrenceDateElement(), false);
40557        composeDateExtras("occurrenceDate", element.getOccurrenceDateElement(), false);
40558      }
40559      if (element.hasRecurrenceIdElement()) {
40560        composePositiveIntCore("recurrenceId", element.getRecurrenceIdElement(), false);
40561        composePositiveIntExtras("recurrenceId", element.getRecurrenceIdElement(), false);
40562      }
40563  }
40564
40565  protected void composeArtifactAssessment(String name, ArtifactAssessment element) throws IOException {
40566    if (element != null) {
40567      prop("resourceType", name);
40568      composeArtifactAssessmentProperties(element);
40569    }
40570  }
40571
40572  protected void composeArtifactAssessmentProperties(ArtifactAssessment element) throws IOException {
40573    composeDomainResourceProperties(element);
40574      if (element.hasIdentifier()) {
40575        openArray("identifier");
40576        for (Identifier e : element.getIdentifier()) 
40577          composeIdentifier(null, e);
40578        closeArray();
40579      };
40580      if (element.hasTitleElement()) {
40581        composeStringCore("title", element.getTitleElement(), false);
40582        composeStringExtras("title", element.getTitleElement(), false);
40583      }
40584      if (element.hasCiteAs()) {
40585        composeType("citeAs", element.getCiteAs());
40586      }
40587      if (element.hasDateElement()) {
40588        composeDateTimeCore("date", element.getDateElement(), false);
40589        composeDateTimeExtras("date", element.getDateElement(), false);
40590      }
40591      if (element.hasCopyrightElement()) {
40592        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40593        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40594      }
40595      if (element.hasApprovalDateElement()) {
40596        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40597        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40598      }
40599      if (element.hasLastReviewDateElement()) {
40600        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40601        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40602      }
40603      if (element.hasArtifact()) {
40604        composeType("artifact", element.getArtifact());
40605      }
40606      if (element.hasContent()) {
40607        openArray("content");
40608        for (ArtifactAssessment.ArtifactAssessmentContentComponent e : element.getContent()) 
40609          composeArtifactAssessmentContentComponent(null, e);
40610        closeArray();
40611      };
40612      if (element.hasWorkflowStatusElement()) {
40613        composeEnumerationCore("workflowStatus", element.getWorkflowStatusElement(), new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory(), false);
40614        composeEnumerationExtras("workflowStatus", element.getWorkflowStatusElement(), new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory(), false);
40615      }
40616      if (element.hasDispositionElement()) {
40617        composeEnumerationCore("disposition", element.getDispositionElement(), new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory(), false);
40618        composeEnumerationExtras("disposition", element.getDispositionElement(), new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory(), false);
40619      }
40620  }
40621
40622  protected void composeArtifactAssessmentContentComponent(String name, ArtifactAssessment.ArtifactAssessmentContentComponent element) throws IOException {
40623    if (element != null) {
40624      open(name);
40625      composeArtifactAssessmentContentComponentProperties(element);
40626      close();
40627    }
40628  }
40629
40630  protected void composeArtifactAssessmentContentComponentProperties(ArtifactAssessment.ArtifactAssessmentContentComponent element) throws IOException {
40631    composeBackboneElementProperties(element);
40632      if (element.hasInformationTypeElement()) {
40633        composeEnumerationCore("informationType", element.getInformationTypeElement(), new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory(), false);
40634        composeEnumerationExtras("informationType", element.getInformationTypeElement(), new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory(), false);
40635      }
40636      if (element.hasSummaryElement()) {
40637        composeMarkdownCore("summary", element.getSummaryElement(), false);
40638        composeMarkdownExtras("summary", element.getSummaryElement(), false);
40639      }
40640      if (element.hasType()) {
40641        composeCodeableConcept("type", element.getType());
40642      }
40643      if (element.hasClassifier()) {
40644        openArray("classifier");
40645        for (CodeableConcept e : element.getClassifier()) 
40646          composeCodeableConcept(null, e);
40647        closeArray();
40648      };
40649      if (element.hasQuantity()) {
40650        composeQuantity("quantity", element.getQuantity());
40651      }
40652      if (element.hasAuthor()) {
40653        composeReference("author", element.getAuthor());
40654      }
40655      if (element.hasPath()) {
40656        if (anyHasValue(element.getPath())) {
40657          openArray("path");
40658          for (UriType e : element.getPath()) 
40659            composeUriCore(null, e, e != element.getPath().get(element.getPath().size()-1));
40660          closeArray();
40661        }
40662        if (anyHasExtras(element.getPath())) {
40663          openArray("_path");
40664          for (UriType e : element.getPath()) 
40665            composeUriExtras(null, e, true);
40666          closeArray();
40667        }
40668      };
40669      if (element.hasRelatedArtifact()) {
40670        openArray("relatedArtifact");
40671        for (RelatedArtifact e : element.getRelatedArtifact()) 
40672          composeRelatedArtifact(null, e);
40673        closeArray();
40674      };
40675      if (element.hasFreeToShareElement()) {
40676        composeBooleanCore("freeToShare", element.getFreeToShareElement(), false);
40677        composeBooleanExtras("freeToShare", element.getFreeToShareElement(), false);
40678      }
40679      if (element.hasComponent()) {
40680        openArray("component");
40681        for (ArtifactAssessment.ArtifactAssessmentContentComponent e : element.getComponent()) 
40682          composeArtifactAssessmentContentComponent(null, e);
40683        closeArray();
40684      };
40685  }
40686
40687  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
40688    if (element != null) {
40689      prop("resourceType", name);
40690      composeAuditEventProperties(element);
40691    }
40692  }
40693
40694  protected void composeAuditEventProperties(AuditEvent element) throws IOException {
40695    composeDomainResourceProperties(element);
40696      if (element.hasCategory()) {
40697        openArray("category");
40698        for (CodeableConcept e : element.getCategory()) 
40699          composeCodeableConcept(null, e);
40700        closeArray();
40701      };
40702      if (element.hasCode()) {
40703        composeCodeableConcept("code", element.getCode());
40704      }
40705      if (element.hasActionElement()) {
40706        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
40707        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
40708      }
40709      if (element.hasSeverityElement()) {
40710        composeEnumerationCore("severity", element.getSeverityElement(), new AuditEvent.AuditEventSeverityEnumFactory(), false);
40711        composeEnumerationExtras("severity", element.getSeverityElement(), new AuditEvent.AuditEventSeverityEnumFactory(), false);
40712      }
40713      if (element.hasOccurred()) {
40714        composeType("occurred", element.getOccurred());
40715      }
40716      if (element.hasRecordedElement()) {
40717        composeInstantCore("recorded", element.getRecordedElement(), false);
40718        composeInstantExtras("recorded", element.getRecordedElement(), false);
40719      }
40720      if (element.hasOutcome()) {
40721        composeAuditEventOutcomeComponent("outcome", element.getOutcome());
40722      }
40723      if (element.hasAuthorization()) {
40724        openArray("authorization");
40725        for (CodeableConcept e : element.getAuthorization()) 
40726          composeCodeableConcept(null, e);
40727        closeArray();
40728      };
40729      if (element.hasBasedOn()) {
40730        openArray("basedOn");
40731        for (Reference e : element.getBasedOn()) 
40732          composeReference(null, e);
40733        closeArray();
40734      };
40735      if (element.hasPatient()) {
40736        composeReference("patient", element.getPatient());
40737      }
40738      if (element.hasEncounter()) {
40739        composeReference("encounter", element.getEncounter());
40740      }
40741      if (element.hasAgent()) {
40742        openArray("agent");
40743        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
40744          composeAuditEventAgentComponent(null, e);
40745        closeArray();
40746      };
40747      if (element.hasSource()) {
40748        composeAuditEventSourceComponent("source", element.getSource());
40749      }
40750      if (element.hasEntity()) {
40751        openArray("entity");
40752        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
40753          composeAuditEventEntityComponent(null, e);
40754        closeArray();
40755      };
40756  }
40757
40758  protected void composeAuditEventOutcomeComponent(String name, AuditEvent.AuditEventOutcomeComponent element) throws IOException {
40759    if (element != null) {
40760      open(name);
40761      composeAuditEventOutcomeComponentProperties(element);
40762      close();
40763    }
40764  }
40765
40766  protected void composeAuditEventOutcomeComponentProperties(AuditEvent.AuditEventOutcomeComponent element) throws IOException {
40767    composeBackboneElementProperties(element);
40768      if (element.hasCode()) {
40769        composeCoding("code", element.getCode());
40770      }
40771      if (element.hasDetail()) {
40772        openArray("detail");
40773        for (CodeableConcept e : element.getDetail()) 
40774          composeCodeableConcept(null, e);
40775        closeArray();
40776      };
40777  }
40778
40779  protected void composeAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
40780    if (element != null) {
40781      open(name);
40782      composeAuditEventAgentComponentProperties(element);
40783      close();
40784    }
40785  }
40786
40787  protected void composeAuditEventAgentComponentProperties(AuditEvent.AuditEventAgentComponent element) throws IOException {
40788    composeBackboneElementProperties(element);
40789      if (element.hasType()) {
40790        composeCodeableConcept("type", element.getType());
40791      }
40792      if (element.hasRole()) {
40793        openArray("role");
40794        for (CodeableConcept e : element.getRole()) 
40795          composeCodeableConcept(null, e);
40796        closeArray();
40797      };
40798      if (element.hasWho()) {
40799        composeReference("who", element.getWho());
40800      }
40801      if (element.hasRequestorElement()) {
40802        composeBooleanCore("requestor", element.getRequestorElement(), false);
40803        composeBooleanExtras("requestor", element.getRequestorElement(), false);
40804      }
40805      if (element.hasLocation()) {
40806        composeReference("location", element.getLocation());
40807      }
40808      if (element.hasPolicy()) {
40809        if (anyHasValue(element.getPolicy())) {
40810          openArray("policy");
40811          for (UriType e : element.getPolicy()) 
40812            composeUriCore(null, e, e != element.getPolicy().get(element.getPolicy().size()-1));
40813          closeArray();
40814        }
40815        if (anyHasExtras(element.getPolicy())) {
40816          openArray("_policy");
40817          for (UriType e : element.getPolicy()) 
40818            composeUriExtras(null, e, true);
40819          closeArray();
40820        }
40821      };
40822      if (element.hasNetwork()) {
40823        composeType("network", element.getNetwork());
40824      }
40825      if (element.hasAuthorization()) {
40826        openArray("authorization");
40827        for (CodeableConcept e : element.getAuthorization()) 
40828          composeCodeableConcept(null, e);
40829        closeArray();
40830      };
40831  }
40832
40833  protected void composeAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
40834    if (element != null) {
40835      open(name);
40836      composeAuditEventSourceComponentProperties(element);
40837      close();
40838    }
40839  }
40840
40841  protected void composeAuditEventSourceComponentProperties(AuditEvent.AuditEventSourceComponent element) throws IOException {
40842    composeBackboneElementProperties(element);
40843      if (element.hasSite()) {
40844        composeReference("site", element.getSite());
40845      }
40846      if (element.hasObserver()) {
40847        composeReference("observer", element.getObserver());
40848      }
40849      if (element.hasType()) {
40850        openArray("type");
40851        for (CodeableConcept e : element.getType()) 
40852          composeCodeableConcept(null, e);
40853        closeArray();
40854      };
40855  }
40856
40857  protected void composeAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
40858    if (element != null) {
40859      open(name);
40860      composeAuditEventEntityComponentProperties(element);
40861      close();
40862    }
40863  }
40864
40865  protected void composeAuditEventEntityComponentProperties(AuditEvent.AuditEventEntityComponent element) throws IOException {
40866    composeBackboneElementProperties(element);
40867      if (element.hasWhat()) {
40868        composeReference("what", element.getWhat());
40869      }
40870      if (element.hasRole()) {
40871        composeCodeableConcept("role", element.getRole());
40872      }
40873      if (element.hasSecurityLabel()) {
40874        openArray("securityLabel");
40875        for (CodeableConcept e : element.getSecurityLabel()) 
40876          composeCodeableConcept(null, e);
40877        closeArray();
40878      };
40879      if (element.hasQueryElement()) {
40880        composeBase64BinaryCore("query", element.getQueryElement(), false);
40881        composeBase64BinaryExtras("query", element.getQueryElement(), false);
40882      }
40883      if (element.hasDetail()) {
40884        openArray("detail");
40885        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
40886          composeAuditEventEntityDetailComponent(null, e);
40887        closeArray();
40888      };
40889      if (element.hasAgent()) {
40890        openArray("agent");
40891        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
40892          composeAuditEventAgentComponent(null, e);
40893        closeArray();
40894      };
40895  }
40896
40897  protected void composeAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
40898    if (element != null) {
40899      open(name);
40900      composeAuditEventEntityDetailComponentProperties(element);
40901      close();
40902    }
40903  }
40904
40905  protected void composeAuditEventEntityDetailComponentProperties(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
40906    composeBackboneElementProperties(element);
40907      if (element.hasType()) {
40908        composeCodeableConcept("type", element.getType());
40909      }
40910      if (element.hasValue()) {
40911        composeType("value", element.getValue());
40912      }
40913  }
40914
40915  protected void composeBasic(String name, Basic element) throws IOException {
40916    if (element != null) {
40917      prop("resourceType", name);
40918      composeBasicProperties(element);
40919    }
40920  }
40921
40922  protected void composeBasicProperties(Basic element) throws IOException {
40923    composeDomainResourceProperties(element);
40924      if (element.hasIdentifier()) {
40925        openArray("identifier");
40926        for (Identifier e : element.getIdentifier()) 
40927          composeIdentifier(null, e);
40928        closeArray();
40929      };
40930      if (element.hasCode()) {
40931        composeCodeableConcept("code", element.getCode());
40932      }
40933      if (element.hasSubject()) {
40934        composeReference("subject", element.getSubject());
40935      }
40936      if (element.hasCreatedElement()) {
40937        composeDateTimeCore("created", element.getCreatedElement(), false);
40938        composeDateTimeExtras("created", element.getCreatedElement(), false);
40939      }
40940      if (element.hasAuthor()) {
40941        composeReference("author", element.getAuthor());
40942      }
40943  }
40944
40945  protected void composeBinary(String name, Binary element) throws IOException {
40946    if (element != null) {
40947      prop("resourceType", name);
40948      composeBinaryProperties(element);
40949    }
40950  }
40951
40952  protected void composeBinaryProperties(Binary element) throws IOException {
40953    composeResourceProperties(element);
40954      if (element.hasContentTypeElement()) {
40955        composeCodeCore("contentType", element.getContentTypeElement(), false);
40956        composeCodeExtras("contentType", element.getContentTypeElement(), false);
40957      }
40958      if (element.hasSecurityContext()) {
40959        composeReference("securityContext", element.getSecurityContext());
40960      }
40961      if (element.hasDataElement()) {
40962        composeBase64BinaryCore("data", element.getDataElement(), false);
40963        composeBase64BinaryExtras("data", element.getDataElement(), false);
40964      }
40965  }
40966
40967  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
40968    if (element != null) {
40969      prop("resourceType", name);
40970      composeBiologicallyDerivedProductProperties(element);
40971    }
40972  }
40973
40974  protected void composeBiologicallyDerivedProductProperties(BiologicallyDerivedProduct element) throws IOException {
40975    composeDomainResourceProperties(element);
40976      if (element.hasProductCategory()) {
40977        composeCoding("productCategory", element.getProductCategory());
40978      }
40979      if (element.hasProductCode()) {
40980        composeCodeableConcept("productCode", element.getProductCode());
40981      }
40982      if (element.hasParent()) {
40983        openArray("parent");
40984        for (Reference e : element.getParent()) 
40985          composeReference(null, e);
40986        closeArray();
40987      };
40988      if (element.hasRequest()) {
40989        openArray("request");
40990        for (Reference e : element.getRequest()) 
40991          composeReference(null, e);
40992        closeArray();
40993      };
40994      if (element.hasIdentifier()) {
40995        openArray("identifier");
40996        for (Identifier e : element.getIdentifier()) 
40997          composeIdentifier(null, e);
40998        closeArray();
40999      };
41000      if (element.hasBiologicalSourceEvent()) {
41001        composeIdentifier("biologicalSourceEvent", element.getBiologicalSourceEvent());
41002      }
41003      if (element.hasProcessingFacility()) {
41004        openArray("processingFacility");
41005        for (Reference e : element.getProcessingFacility()) 
41006          composeReference(null, e);
41007        closeArray();
41008      };
41009      if (element.hasDivisionElement()) {
41010        composeStringCore("division", element.getDivisionElement(), false);
41011        composeStringExtras("division", element.getDivisionElement(), false);
41012      }
41013      if (element.hasProductStatus()) {
41014        composeCoding("productStatus", element.getProductStatus());
41015      }
41016      if (element.hasExpirationDateElement()) {
41017        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
41018        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
41019      }
41020      if (element.hasCollection()) {
41021        composeBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
41022      }
41023      if (element.hasStorageTempRequirements()) {
41024        composeRange("storageTempRequirements", element.getStorageTempRequirements());
41025      }
41026      if (element.hasProperty()) {
41027        openArray("property");
41028        for (BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent e : element.getProperty()) 
41029          composeBiologicallyDerivedProductPropertyComponent(null, e);
41030        closeArray();
41031      };
41032  }
41033
41034  protected void composeBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
41035    if (element != null) {
41036      open(name);
41037      composeBiologicallyDerivedProductCollectionComponentProperties(element);
41038      close();
41039    }
41040  }
41041
41042  protected void composeBiologicallyDerivedProductCollectionComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
41043    composeBackboneElementProperties(element);
41044      if (element.hasCollector()) {
41045        composeReference("collector", element.getCollector());
41046      }
41047      if (element.hasSource()) {
41048        composeReference("source", element.getSource());
41049      }
41050      if (element.hasCollected()) {
41051        composeType("collected", element.getCollected());
41052      }
41053  }
41054
41055  protected void composeBiologicallyDerivedProductPropertyComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent element) throws IOException {
41056    if (element != null) {
41057      open(name);
41058      composeBiologicallyDerivedProductPropertyComponentProperties(element);
41059      close();
41060    }
41061  }
41062
41063  protected void composeBiologicallyDerivedProductPropertyComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent element) throws IOException {
41064    composeBackboneElementProperties(element);
41065      if (element.hasType()) {
41066        composeCodeableConcept("type", element.getType());
41067      }
41068      if (element.hasValue()) {
41069        composeType("value", element.getValue());
41070      }
41071  }
41072
41073  protected void composeBiologicallyDerivedProductDispense(String name, BiologicallyDerivedProductDispense element) throws IOException {
41074    if (element != null) {
41075      prop("resourceType", name);
41076      composeBiologicallyDerivedProductDispenseProperties(element);
41077    }
41078  }
41079
41080  protected void composeBiologicallyDerivedProductDispenseProperties(BiologicallyDerivedProductDispense element) throws IOException {
41081    composeDomainResourceProperties(element);
41082      if (element.hasIdentifier()) {
41083        openArray("identifier");
41084        for (Identifier e : element.getIdentifier()) 
41085          composeIdentifier(null, e);
41086        closeArray();
41087      };
41088      if (element.hasBasedOn()) {
41089        openArray("basedOn");
41090        for (Reference e : element.getBasedOn()) 
41091          composeReference(null, e);
41092        closeArray();
41093      };
41094      if (element.hasPartOf()) {
41095        openArray("partOf");
41096        for (Reference e : element.getPartOf()) 
41097          composeReference(null, e);
41098        closeArray();
41099      };
41100      if (element.hasStatusElement()) {
41101        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispenseCodesEnumFactory(), false);
41102        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispenseCodesEnumFactory(), false);
41103      }
41104      if (element.hasOriginRelationshipType()) {
41105        composeCodeableConcept("originRelationshipType", element.getOriginRelationshipType());
41106      }
41107      if (element.hasProduct()) {
41108        composeReference("product", element.getProduct());
41109      }
41110      if (element.hasPatient()) {
41111        composeReference("patient", element.getPatient());
41112      }
41113      if (element.hasMatchStatus()) {
41114        composeCodeableConcept("matchStatus", element.getMatchStatus());
41115      }
41116      if (element.hasPerformer()) {
41117        openArray("performer");
41118        for (BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent e : element.getPerformer()) 
41119          composeBiologicallyDerivedProductDispensePerformerComponent(null, e);
41120        closeArray();
41121      };
41122      if (element.hasLocation()) {
41123        composeReference("location", element.getLocation());
41124      }
41125      if (element.hasQuantity()) {
41126        composeQuantity("quantity", element.getQuantity());
41127      }
41128      if (element.hasPreparedDateElement()) {
41129        composeDateTimeCore("preparedDate", element.getPreparedDateElement(), false);
41130        composeDateTimeExtras("preparedDate", element.getPreparedDateElement(), false);
41131      }
41132      if (element.hasWhenHandedOverElement()) {
41133        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
41134        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
41135      }
41136      if (element.hasDestination()) {
41137        composeReference("destination", element.getDestination());
41138      }
41139      if (element.hasNote()) {
41140        openArray("note");
41141        for (Annotation e : element.getNote()) 
41142          composeAnnotation(null, e);
41143        closeArray();
41144      };
41145      if (element.hasUsageInstructionElement()) {
41146        composeStringCore("usageInstruction", element.getUsageInstructionElement(), false);
41147        composeStringExtras("usageInstruction", element.getUsageInstructionElement(), false);
41148      }
41149  }
41150
41151  protected void composeBiologicallyDerivedProductDispensePerformerComponent(String name, BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent element) throws IOException {
41152    if (element != null) {
41153      open(name);
41154      composeBiologicallyDerivedProductDispensePerformerComponentProperties(element);
41155      close();
41156    }
41157  }
41158
41159  protected void composeBiologicallyDerivedProductDispensePerformerComponentProperties(BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent element) throws IOException {
41160    composeBackboneElementProperties(element);
41161      if (element.hasFunction()) {
41162        composeCodeableConcept("function", element.getFunction());
41163      }
41164      if (element.hasActor()) {
41165        composeReference("actor", element.getActor());
41166      }
41167  }
41168
41169  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
41170    if (element != null) {
41171      prop("resourceType", name);
41172      composeBodyStructureProperties(element);
41173    }
41174  }
41175
41176  protected void composeBodyStructureProperties(BodyStructure element) throws IOException {
41177    composeDomainResourceProperties(element);
41178      if (element.hasIdentifier()) {
41179        openArray("identifier");
41180        for (Identifier e : element.getIdentifier()) 
41181          composeIdentifier(null, e);
41182        closeArray();
41183      };
41184      if (element.hasActiveElement()) {
41185        composeBooleanCore("active", element.getActiveElement(), false);
41186        composeBooleanExtras("active", element.getActiveElement(), false);
41187      }
41188      if (element.hasMorphology()) {
41189        composeCodeableConcept("morphology", element.getMorphology());
41190      }
41191      if (element.hasIncludedStructure()) {
41192        openArray("includedStructure");
41193        for (BodyStructure.BodyStructureIncludedStructureComponent e : element.getIncludedStructure()) 
41194          composeBodyStructureIncludedStructureComponent(null, e);
41195        closeArray();
41196      };
41197      if (element.hasExcludedStructure()) {
41198        openArray("excludedStructure");
41199        for (BodyStructure.BodyStructureIncludedStructureComponent e : element.getExcludedStructure()) 
41200          composeBodyStructureIncludedStructureComponent(null, e);
41201        closeArray();
41202      };
41203      if (element.hasDescriptionElement()) {
41204        composeMarkdownCore("description", element.getDescriptionElement(), false);
41205        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41206      }
41207      if (element.hasImage()) {
41208        openArray("image");
41209        for (Attachment e : element.getImage()) 
41210          composeAttachment(null, e);
41211        closeArray();
41212      };
41213      if (element.hasPatient()) {
41214        composeReference("patient", element.getPatient());
41215      }
41216  }
41217
41218  protected void composeBodyStructureIncludedStructureComponent(String name, BodyStructure.BodyStructureIncludedStructureComponent element) throws IOException {
41219    if (element != null) {
41220      open(name);
41221      composeBodyStructureIncludedStructureComponentProperties(element);
41222      close();
41223    }
41224  }
41225
41226  protected void composeBodyStructureIncludedStructureComponentProperties(BodyStructure.BodyStructureIncludedStructureComponent element) throws IOException {
41227    composeBackboneElementProperties(element);
41228      if (element.hasStructure()) {
41229        composeCodeableConcept("structure", element.getStructure());
41230      }
41231      if (element.hasLaterality()) {
41232        composeCodeableConcept("laterality", element.getLaterality());
41233      }
41234      if (element.hasBodyLandmarkOrientation()) {
41235        openArray("bodyLandmarkOrientation");
41236        for (BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent e : element.getBodyLandmarkOrientation()) 
41237          composeBodyStructureIncludedStructureBodyLandmarkOrientationComponent(null, e);
41238        closeArray();
41239      };
41240      if (element.hasSpatialReference()) {
41241        openArray("spatialReference");
41242        for (Reference e : element.getSpatialReference()) 
41243          composeReference(null, e);
41244        closeArray();
41245      };
41246      if (element.hasQualifier()) {
41247        openArray("qualifier");
41248        for (CodeableConcept e : element.getQualifier()) 
41249          composeCodeableConcept(null, e);
41250        closeArray();
41251      };
41252  }
41253
41254  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationComponent(String name, BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent element) throws IOException {
41255    if (element != null) {
41256      open(name);
41257      composeBodyStructureIncludedStructureBodyLandmarkOrientationComponentProperties(element);
41258      close();
41259    }
41260  }
41261
41262  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationComponentProperties(BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent element) throws IOException {
41263    composeBackboneElementProperties(element);
41264      if (element.hasLandmarkDescription()) {
41265        openArray("landmarkDescription");
41266        for (CodeableConcept e : element.getLandmarkDescription()) 
41267          composeCodeableConcept(null, e);
41268        closeArray();
41269      };
41270      if (element.hasClockFacePosition()) {
41271        openArray("clockFacePosition");
41272        for (CodeableConcept e : element.getClockFacePosition()) 
41273          composeCodeableConcept(null, e);
41274        closeArray();
41275      };
41276      if (element.hasDistanceFromLandmark()) {
41277        openArray("distanceFromLandmark");
41278        for (BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent e : element.getDistanceFromLandmark()) 
41279          composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent(null, e);
41280        closeArray();
41281      };
41282      if (element.hasSurfaceOrientation()) {
41283        openArray("surfaceOrientation");
41284        for (CodeableConcept e : element.getSurfaceOrientation()) 
41285          composeCodeableConcept(null, e);
41286        closeArray();
41287      };
41288  }
41289
41290  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent(String name, BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent element) throws IOException {
41291    if (element != null) {
41292      open(name);
41293      composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponentProperties(element);
41294      close();
41295    }
41296  }
41297
41298  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponentProperties(BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent element) throws IOException {
41299    composeBackboneElementProperties(element);
41300      if (element.hasDevice()) {
41301        openArray("device");
41302        for (CodeableReference e : element.getDevice()) 
41303          composeCodeableReference(null, e);
41304        closeArray();
41305      };
41306      if (element.hasValue()) {
41307        openArray("value");
41308        for (Quantity e : element.getValue()) 
41309          composeQuantity(null, e);
41310        closeArray();
41311      };
41312  }
41313
41314  protected void composeBundle(String name, Bundle element) throws IOException {
41315    if (element != null) {
41316      prop("resourceType", name);
41317      composeBundleProperties(element);
41318    }
41319  }
41320
41321  protected void composeBundleProperties(Bundle element) throws IOException {
41322    composeResourceProperties(element);
41323      if (element.hasIdentifier()) {
41324        composeIdentifier("identifier", element.getIdentifier());
41325      }
41326      if (element.hasTypeElement()) {
41327        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
41328        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
41329      }
41330      if (element.hasTimestampElement()) {
41331        composeInstantCore("timestamp", element.getTimestampElement(), false);
41332        composeInstantExtras("timestamp", element.getTimestampElement(), false);
41333      }
41334      if (element.hasTotalElement()) {
41335        composeUnsignedIntCore("total", element.getTotalElement(), false);
41336        composeUnsignedIntExtras("total", element.getTotalElement(), false);
41337      }
41338      if (element.hasLink()) {
41339        openArray("link");
41340        for (Bundle.BundleLinkComponent e : element.getLink()) 
41341          composeBundleLinkComponent(null, e);
41342        closeArray();
41343      };
41344      if (element.hasEntry()) {
41345        openArray("entry");
41346        for (Bundle.BundleEntryComponent e : element.getEntry()) 
41347          composeBundleEntryComponent(null, e);
41348        closeArray();
41349      };
41350      if (element.hasSignature()) {
41351        composeSignature("signature", element.getSignature());
41352      }
41353        if (element.hasIssues()) {
41354          open("issues");
41355          composeResource(element.getIssues());
41356          close();
41357        }
41358  }
41359
41360  protected void composeBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
41361    if (element != null) {
41362      open(name);
41363      composeBundleLinkComponentProperties(element);
41364      close();
41365    }
41366  }
41367
41368  protected void composeBundleLinkComponentProperties(Bundle.BundleLinkComponent element) throws IOException {
41369    composeBackboneElementProperties(element);
41370      if (element.hasRelationElement()) {
41371        composeEnumerationCore("relation", element.getRelationElement(), new Bundle.LinkRelationTypesEnumFactory(), false);
41372        composeEnumerationExtras("relation", element.getRelationElement(), new Bundle.LinkRelationTypesEnumFactory(), false);
41373      }
41374      if (element.hasUrlElement()) {
41375        composeUriCore("url", element.getUrlElement(), false);
41376        composeUriExtras("url", element.getUrlElement(), false);
41377      }
41378  }
41379
41380  protected void composeBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
41381    if (element != null) {
41382      open(name);
41383      composeBundleEntryComponentProperties(element);
41384      close();
41385    }
41386  }
41387
41388  protected void composeBundleEntryComponentProperties(Bundle.BundleEntryComponent element) throws IOException {
41389    composeBackboneElementProperties(element);
41390      if (element.hasLink()) {
41391        openArray("link");
41392        for (Bundle.BundleLinkComponent e : element.getLink()) 
41393          composeBundleLinkComponent(null, e);
41394        closeArray();
41395      };
41396      if (element.hasFullUrlElement()) {
41397        composeUriCore("fullUrl", element.getFullUrlElement(), false);
41398        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
41399      }
41400        if (element.hasResource()) {
41401          open("resource");
41402          composeResource(element.getResource());
41403          close();
41404        }
41405      if (element.hasSearch()) {
41406        composeBundleEntrySearchComponent("search", element.getSearch());
41407      }
41408      if (element.hasRequest()) {
41409        composeBundleEntryRequestComponent("request", element.getRequest());
41410      }
41411      if (element.hasResponse()) {
41412        composeBundleEntryResponseComponent("response", element.getResponse());
41413      }
41414  }
41415
41416  protected void composeBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
41417    if (element != null) {
41418      open(name);
41419      composeBundleEntrySearchComponentProperties(element);
41420      close();
41421    }
41422  }
41423
41424  protected void composeBundleEntrySearchComponentProperties(Bundle.BundleEntrySearchComponent element) throws IOException {
41425    composeBackboneElementProperties(element);
41426      if (element.hasModeElement()) {
41427        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
41428        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
41429      }
41430      if (element.hasScoreElement()) {
41431        composeDecimalCore("score", element.getScoreElement(), false);
41432        composeDecimalExtras("score", element.getScoreElement(), false);
41433      }
41434  }
41435
41436  protected void composeBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
41437    if (element != null) {
41438      open(name);
41439      composeBundleEntryRequestComponentProperties(element);
41440      close();
41441    }
41442  }
41443
41444  protected void composeBundleEntryRequestComponentProperties(Bundle.BundleEntryRequestComponent element) throws IOException {
41445    composeBackboneElementProperties(element);
41446      if (element.hasMethodElement()) {
41447        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
41448        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
41449      }
41450      if (element.hasUrlElement()) {
41451        composeUriCore("url", element.getUrlElement(), false);
41452        composeUriExtras("url", element.getUrlElement(), false);
41453      }
41454      if (element.hasIfNoneMatchElement()) {
41455        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
41456        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
41457      }
41458      if (element.hasIfModifiedSinceElement()) {
41459        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
41460        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
41461      }
41462      if (element.hasIfMatchElement()) {
41463        composeStringCore("ifMatch", element.getIfMatchElement(), false);
41464        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
41465      }
41466      if (element.hasIfNoneExistElement()) {
41467        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
41468        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
41469      }
41470  }
41471
41472  protected void composeBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
41473    if (element != null) {
41474      open(name);
41475      composeBundleEntryResponseComponentProperties(element);
41476      close();
41477    }
41478  }
41479
41480  protected void composeBundleEntryResponseComponentProperties(Bundle.BundleEntryResponseComponent element) throws IOException {
41481    composeBackboneElementProperties(element);
41482      if (element.hasStatusElement()) {
41483        composeStringCore("status", element.getStatusElement(), false);
41484        composeStringExtras("status", element.getStatusElement(), false);
41485      }
41486      if (element.hasLocationElement()) {
41487        composeUriCore("location", element.getLocationElement(), false);
41488        composeUriExtras("location", element.getLocationElement(), false);
41489      }
41490      if (element.hasEtagElement()) {
41491        composeStringCore("etag", element.getEtagElement(), false);
41492        composeStringExtras("etag", element.getEtagElement(), false);
41493      }
41494      if (element.hasLastModifiedElement()) {
41495        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
41496        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
41497      }
41498        if (element.hasOutcome()) {
41499          open("outcome");
41500          composeResource(element.getOutcome());
41501          close();
41502        }
41503  }
41504
41505  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
41506    if (element != null) {
41507      prop("resourceType", name);
41508      composeCapabilityStatementProperties(element);
41509    }
41510  }
41511
41512  protected void composeCapabilityStatementProperties(CapabilityStatement element) throws IOException {
41513    composeCanonicalResourceProperties(element);
41514      if (element.hasUrlElement()) {
41515        composeUriCore("url", element.getUrlElement(), false);
41516        composeUriExtras("url", element.getUrlElement(), false);
41517      }
41518      if (element.hasIdentifier()) {
41519        openArray("identifier");
41520        for (Identifier e : element.getIdentifier()) 
41521          composeIdentifier(null, e);
41522        closeArray();
41523      };
41524      if (element.hasVersionElement()) {
41525        composeStringCore("version", element.getVersionElement(), false);
41526        composeStringExtras("version", element.getVersionElement(), false);
41527      }
41528      if (element.hasVersionAlgorithm()) {
41529        composeType("versionAlgorithm", element.getVersionAlgorithm());
41530      }
41531      if (element.hasNameElement()) {
41532        composeStringCore("name", element.getNameElement(), false);
41533        composeStringExtras("name", element.getNameElement(), false);
41534      }
41535      if (element.hasTitleElement()) {
41536        composeStringCore("title", element.getTitleElement(), false);
41537        composeStringExtras("title", element.getTitleElement(), false);
41538      }
41539      if (element.hasStatusElement()) {
41540        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41541        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41542      }
41543      if (element.hasExperimentalElement()) {
41544        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41545        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41546      }
41547      if (element.hasDateElement()) {
41548        composeDateTimeCore("date", element.getDateElement(), false);
41549        composeDateTimeExtras("date", element.getDateElement(), false);
41550      }
41551      if (element.hasPublisherElement()) {
41552        composeStringCore("publisher", element.getPublisherElement(), false);
41553        composeStringExtras("publisher", element.getPublisherElement(), false);
41554      }
41555      if (element.hasContact()) {
41556        openArray("contact");
41557        for (ContactDetail e : element.getContact()) 
41558          composeContactDetail(null, e);
41559        closeArray();
41560      };
41561      if (element.hasDescriptionElement()) {
41562        composeMarkdownCore("description", element.getDescriptionElement(), false);
41563        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41564      }
41565      if (element.hasUseContext()) {
41566        openArray("useContext");
41567        for (UsageContext e : element.getUseContext()) 
41568          composeUsageContext(null, e);
41569        closeArray();
41570      };
41571      if (element.hasJurisdiction()) {
41572        openArray("jurisdiction");
41573        for (CodeableConcept e : element.getJurisdiction()) 
41574          composeCodeableConcept(null, e);
41575        closeArray();
41576      };
41577      if (element.hasPurposeElement()) {
41578        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41579        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41580      }
41581      if (element.hasCopyrightElement()) {
41582        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41583        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41584      }
41585      if (element.hasCopyrightLabelElement()) {
41586        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
41587        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
41588      }
41589      if (element.hasKindElement()) {
41590        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
41591        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
41592      }
41593      if (element.hasInstantiates()) {
41594        if (anyHasValue(element.getInstantiates())) {
41595          openArray("instantiates");
41596          for (CanonicalType e : element.getInstantiates()) 
41597            composeCanonicalCore(null, e, e != element.getInstantiates().get(element.getInstantiates().size()-1));
41598          closeArray();
41599        }
41600        if (anyHasExtras(element.getInstantiates())) {
41601          openArray("_instantiates");
41602          for (CanonicalType e : element.getInstantiates()) 
41603            composeCanonicalExtras(null, e, true);
41604          closeArray();
41605        }
41606      };
41607      if (element.hasImports()) {
41608        if (anyHasValue(element.getImports())) {
41609          openArray("imports");
41610          for (CanonicalType e : element.getImports()) 
41611            composeCanonicalCore(null, e, e != element.getImports().get(element.getImports().size()-1));
41612          closeArray();
41613        }
41614        if (anyHasExtras(element.getImports())) {
41615          openArray("_imports");
41616          for (CanonicalType e : element.getImports()) 
41617            composeCanonicalExtras(null, e, true);
41618          closeArray();
41619        }
41620      };
41621      if (element.hasSoftware()) {
41622        composeCapabilityStatementSoftwareComponent("software", element.getSoftware());
41623      }
41624      if (element.hasImplementation()) {
41625        composeCapabilityStatementImplementationComponent("implementation", element.getImplementation());
41626      }
41627      if (element.hasFhirVersionElement()) {
41628        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
41629        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
41630      }
41631      if (element.hasFormat()) {
41632        if (anyHasValue(element.getFormat())) {
41633          openArray("format");
41634          for (CodeType e : element.getFormat()) 
41635            composeCodeCore(null, e, e != element.getFormat().get(element.getFormat().size()-1));
41636          closeArray();
41637        }
41638        if (anyHasExtras(element.getFormat())) {
41639          openArray("_format");
41640          for (CodeType e : element.getFormat()) 
41641            composeCodeExtras(null, e, true);
41642          closeArray();
41643        }
41644      };
41645      if (element.hasPatchFormat()) {
41646        if (anyHasValue(element.getPatchFormat())) {
41647          openArray("patchFormat");
41648          for (CodeType e : element.getPatchFormat()) 
41649            composeCodeCore(null, e, e != element.getPatchFormat().get(element.getPatchFormat().size()-1));
41650          closeArray();
41651        }
41652        if (anyHasExtras(element.getPatchFormat())) {
41653          openArray("_patchFormat");
41654          for (CodeType e : element.getPatchFormat()) 
41655            composeCodeExtras(null, e, true);
41656          closeArray();
41657        }
41658      };
41659      if (element.hasAcceptLanguage()) {
41660        if (anyHasValue(element.getAcceptLanguage())) {
41661          openArray("acceptLanguage");
41662          for (CodeType e : element.getAcceptLanguage()) 
41663            composeCodeCore(null, e, e != element.getAcceptLanguage().get(element.getAcceptLanguage().size()-1));
41664          closeArray();
41665        }
41666        if (anyHasExtras(element.getAcceptLanguage())) {
41667          openArray("_acceptLanguage");
41668          for (CodeType e : element.getAcceptLanguage()) 
41669            composeCodeExtras(null, e, true);
41670          closeArray();
41671        }
41672      };
41673      if (element.hasImplementationGuide()) {
41674        if (anyHasValue(element.getImplementationGuide())) {
41675          openArray("implementationGuide");
41676          for (CanonicalType e : element.getImplementationGuide()) 
41677            composeCanonicalCore(null, e, e != element.getImplementationGuide().get(element.getImplementationGuide().size()-1));
41678          closeArray();
41679        }
41680        if (anyHasExtras(element.getImplementationGuide())) {
41681          openArray("_implementationGuide");
41682          for (CanonicalType e : element.getImplementationGuide()) 
41683            composeCanonicalExtras(null, e, true);
41684          closeArray();
41685        }
41686      };
41687      if (element.hasRest()) {
41688        openArray("rest");
41689        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
41690          composeCapabilityStatementRestComponent(null, e);
41691        closeArray();
41692      };
41693      if (element.hasMessaging()) {
41694        openArray("messaging");
41695        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
41696          composeCapabilityStatementMessagingComponent(null, e);
41697        closeArray();
41698      };
41699      if (element.hasDocument()) {
41700        openArray("document");
41701        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
41702          composeCapabilityStatementDocumentComponent(null, e);
41703        closeArray();
41704      };
41705  }
41706
41707  protected void composeCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
41708    if (element != null) {
41709      open(name);
41710      composeCapabilityStatementSoftwareComponentProperties(element);
41711      close();
41712    }
41713  }
41714
41715  protected void composeCapabilityStatementSoftwareComponentProperties(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
41716    composeBackboneElementProperties(element);
41717      if (element.hasNameElement()) {
41718        composeStringCore("name", element.getNameElement(), false);
41719        composeStringExtras("name", element.getNameElement(), false);
41720      }
41721      if (element.hasVersionElement()) {
41722        composeStringCore("version", element.getVersionElement(), false);
41723        composeStringExtras("version", element.getVersionElement(), false);
41724      }
41725      if (element.hasReleaseDateElement()) {
41726        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
41727        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
41728      }
41729  }
41730
41731  protected void composeCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
41732    if (element != null) {
41733      open(name);
41734      composeCapabilityStatementImplementationComponentProperties(element);
41735      close();
41736    }
41737  }
41738
41739  protected void composeCapabilityStatementImplementationComponentProperties(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
41740    composeBackboneElementProperties(element);
41741      if (element.hasDescriptionElement()) {
41742        composeMarkdownCore("description", element.getDescriptionElement(), false);
41743        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41744      }
41745      if (element.hasUrlElement()) {
41746        composeUrlCore("url", element.getUrlElement(), false);
41747        composeUrlExtras("url", element.getUrlElement(), false);
41748      }
41749      if (element.hasCustodian()) {
41750        composeReference("custodian", element.getCustodian());
41751      }
41752  }
41753
41754  protected void composeCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
41755    if (element != null) {
41756      open(name);
41757      composeCapabilityStatementRestComponentProperties(element);
41758      close();
41759    }
41760  }
41761
41762  protected void composeCapabilityStatementRestComponentProperties(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
41763    composeBackboneElementProperties(element);
41764      if (element.hasModeElement()) {
41765        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
41766        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
41767      }
41768      if (element.hasDocumentationElement()) {
41769        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
41770        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
41771      }
41772      if (element.hasSecurity()) {
41773        composeCapabilityStatementRestSecurityComponent("security", element.getSecurity());
41774      }
41775      if (element.hasResource()) {
41776        openArray("resource");
41777        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
41778          composeCapabilityStatementRestResourceComponent(null, e);
41779        closeArray();
41780      };
41781      if (element.hasInteraction()) {
41782        openArray("interaction");
41783        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
41784          composeSystemInteractionComponent(null, e);
41785        closeArray();
41786      };
41787      if (element.hasSearchParam()) {
41788        openArray("searchParam");
41789        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
41790          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
41791        closeArray();
41792      };
41793      if (element.hasOperation()) {
41794        openArray("operation");
41795        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
41796          composeCapabilityStatementRestResourceOperationComponent(null, e);
41797        closeArray();
41798      };
41799      if (element.hasCompartment()) {
41800        if (anyHasValue(element.getCompartment())) {
41801          openArray("compartment");
41802          for (CanonicalType e : element.getCompartment()) 
41803            composeCanonicalCore(null, e, e != element.getCompartment().get(element.getCompartment().size()-1));
41804          closeArray();
41805        }
41806        if (anyHasExtras(element.getCompartment())) {
41807          openArray("_compartment");
41808          for (CanonicalType e : element.getCompartment()) 
41809            composeCanonicalExtras(null, e, true);
41810          closeArray();
41811        }
41812      };
41813  }
41814
41815  protected void composeCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
41816    if (element != null) {
41817      open(name);
41818      composeCapabilityStatementRestSecurityComponentProperties(element);
41819      close();
41820    }
41821  }
41822
41823  protected void composeCapabilityStatementRestSecurityComponentProperties(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
41824    composeBackboneElementProperties(element);
41825      if (element.hasCorsElement()) {
41826        composeBooleanCore("cors", element.getCorsElement(), false);
41827        composeBooleanExtras("cors", element.getCorsElement(), false);
41828      }
41829      if (element.hasService()) {
41830        openArray("service");
41831        for (CodeableConcept e : element.getService()) 
41832          composeCodeableConcept(null, e);
41833        closeArray();
41834      };
41835      if (element.hasDescriptionElement()) {
41836        composeMarkdownCore("description", element.getDescriptionElement(), false);
41837        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41838      }
41839  }
41840
41841  protected void composeCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
41842    if (element != null) {
41843      open(name);
41844      composeCapabilityStatementRestResourceComponentProperties(element);
41845      close();
41846    }
41847  }
41848
41849  protected void composeCapabilityStatementRestResourceComponentProperties(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
41850    composeBackboneElementProperties(element);
41851      if (element.hasTypeElement()) {
41852        composeCodeCore("type", element.getTypeElement(), false);
41853        composeCodeExtras("type", element.getTypeElement(), false);
41854      }
41855      if (element.hasProfileElement()) {
41856        composeCanonicalCore("profile", element.getProfileElement(), false);
41857        composeCanonicalExtras("profile", element.getProfileElement(), false);
41858      }
41859      if (element.hasSupportedProfile()) {
41860        if (anyHasValue(element.getSupportedProfile())) {
41861          openArray("supportedProfile");
41862          for (CanonicalType e : element.getSupportedProfile()) 
41863            composeCanonicalCore(null, e, e != element.getSupportedProfile().get(element.getSupportedProfile().size()-1));
41864          closeArray();
41865        }
41866        if (anyHasExtras(element.getSupportedProfile())) {
41867          openArray("_supportedProfile");
41868          for (CanonicalType e : element.getSupportedProfile()) 
41869            composeCanonicalExtras(null, e, true);
41870          closeArray();
41871        }
41872      };
41873      if (element.hasDocumentationElement()) {
41874        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
41875        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
41876      }
41877      if (element.hasInteraction()) {
41878        openArray("interaction");
41879        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
41880          composeResourceInteractionComponent(null, e);
41881        closeArray();
41882      };
41883      if (element.hasVersioningElement()) {
41884        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
41885        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
41886      }
41887      if (element.hasReadHistoryElement()) {
41888        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
41889        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
41890      }
41891      if (element.hasUpdateCreateElement()) {
41892        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
41893        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
41894      }
41895      if (element.hasConditionalCreateElement()) {
41896        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
41897        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
41898      }
41899      if (element.hasConditionalReadElement()) {
41900        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
41901        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
41902      }
41903      if (element.hasConditionalUpdateElement()) {
41904        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
41905        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
41906      }
41907      if (element.hasConditionalPatchElement()) {
41908        composeBooleanCore("conditionalPatch", element.getConditionalPatchElement(), false);
41909        composeBooleanExtras("conditionalPatch", element.getConditionalPatchElement(), false);
41910      }
41911      if (element.hasConditionalDeleteElement()) {
41912        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
41913        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
41914      }
41915      if (element.hasReferencePolicy()) {
41916        openArray("referencePolicy");
41917        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
41918          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
41919        closeArray();
41920        if (anyHasExtras(element.getReferencePolicy())) {
41921          openArray("_referencePolicy");
41922          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
41923            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
41924          closeArray();
41925        }
41926      };
41927      if (element.hasSearchInclude()) {
41928        if (anyHasValue(element.getSearchInclude())) {
41929          openArray("searchInclude");
41930          for (StringType e : element.getSearchInclude()) 
41931            composeStringCore(null, e, e != element.getSearchInclude().get(element.getSearchInclude().size()-1));
41932          closeArray();
41933        }
41934        if (anyHasExtras(element.getSearchInclude())) {
41935          openArray("_searchInclude");
41936          for (StringType e : element.getSearchInclude()) 
41937            composeStringExtras(null, e, true);
41938          closeArray();
41939        }
41940      };
41941      if (element.hasSearchRevInclude()) {
41942        if (anyHasValue(element.getSearchRevInclude())) {
41943          openArray("searchRevInclude");
41944          for (StringType e : element.getSearchRevInclude()) 
41945            composeStringCore(null, e, e != element.getSearchRevInclude().get(element.getSearchRevInclude().size()-1));
41946          closeArray();
41947        }
41948        if (anyHasExtras(element.getSearchRevInclude())) {
41949          openArray("_searchRevInclude");
41950          for (StringType e : element.getSearchRevInclude()) 
41951            composeStringExtras(null, e, true);
41952          closeArray();
41953        }
41954      };
41955      if (element.hasSearchParam()) {
41956        openArray("searchParam");
41957        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
41958          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
41959        closeArray();
41960      };
41961      if (element.hasOperation()) {
41962        openArray("operation");
41963        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
41964          composeCapabilityStatementRestResourceOperationComponent(null, e);
41965        closeArray();
41966      };
41967  }
41968
41969  protected void composeResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
41970    if (element != null) {
41971      open(name);
41972      composeResourceInteractionComponentProperties(element);
41973      close();
41974    }
41975  }
41976
41977  protected void composeResourceInteractionComponentProperties(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
41978    composeBackboneElementProperties(element);
41979      if (element.hasCodeElement()) {
41980        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
41981        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
41982      }
41983      if (element.hasDocumentationElement()) {
41984        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
41985        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
41986      }
41987  }
41988
41989  protected void composeCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
41990    if (element != null) {
41991      open(name);
41992      composeCapabilityStatementRestResourceSearchParamComponentProperties(element);
41993      close();
41994    }
41995  }
41996
41997  protected void composeCapabilityStatementRestResourceSearchParamComponentProperties(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
41998    composeBackboneElementProperties(element);
41999      if (element.hasNameElement()) {
42000        composeStringCore("name", element.getNameElement(), false);
42001        composeStringExtras("name", element.getNameElement(), false);
42002      }
42003      if (element.hasDefinitionElement()) {
42004        composeCanonicalCore("definition", element.getDefinitionElement(), false);
42005        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
42006      }
42007      if (element.hasTypeElement()) {
42008        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
42009        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
42010      }
42011      if (element.hasDocumentationElement()) {
42012        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42013        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42014      }
42015  }
42016
42017  protected void composeCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
42018    if (element != null) {
42019      open(name);
42020      composeCapabilityStatementRestResourceOperationComponentProperties(element);
42021      close();
42022    }
42023  }
42024
42025  protected void composeCapabilityStatementRestResourceOperationComponentProperties(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
42026    composeBackboneElementProperties(element);
42027      if (element.hasNameElement()) {
42028        composeStringCore("name", element.getNameElement(), false);
42029        composeStringExtras("name", element.getNameElement(), false);
42030      }
42031      if (element.hasDefinitionElement()) {
42032        composeCanonicalCore("definition", element.getDefinitionElement(), false);
42033        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
42034      }
42035      if (element.hasDocumentationElement()) {
42036        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42037        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42038      }
42039  }
42040
42041  protected void composeSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
42042    if (element != null) {
42043      open(name);
42044      composeSystemInteractionComponentProperties(element);
42045      close();
42046    }
42047  }
42048
42049  protected void composeSystemInteractionComponentProperties(CapabilityStatement.SystemInteractionComponent element) throws IOException {
42050    composeBackboneElementProperties(element);
42051      if (element.hasCodeElement()) {
42052        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
42053        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
42054      }
42055      if (element.hasDocumentationElement()) {
42056        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42057        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42058      }
42059  }
42060
42061  protected void composeCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
42062    if (element != null) {
42063      open(name);
42064      composeCapabilityStatementMessagingComponentProperties(element);
42065      close();
42066    }
42067  }
42068
42069  protected void composeCapabilityStatementMessagingComponentProperties(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
42070    composeBackboneElementProperties(element);
42071      if (element.hasEndpoint()) {
42072        openArray("endpoint");
42073        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
42074          composeCapabilityStatementMessagingEndpointComponent(null, e);
42075        closeArray();
42076      };
42077      if (element.hasReliableCacheElement()) {
42078        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
42079        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
42080      }
42081      if (element.hasDocumentationElement()) {
42082        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42083        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42084      }
42085      if (element.hasSupportedMessage()) {
42086        openArray("supportedMessage");
42087        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
42088          composeCapabilityStatementMessagingSupportedMessageComponent(null, e);
42089        closeArray();
42090      };
42091  }
42092
42093  protected void composeCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
42094    if (element != null) {
42095      open(name);
42096      composeCapabilityStatementMessagingEndpointComponentProperties(element);
42097      close();
42098    }
42099  }
42100
42101  protected void composeCapabilityStatementMessagingEndpointComponentProperties(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
42102    composeBackboneElementProperties(element);
42103      if (element.hasProtocol()) {
42104        composeCoding("protocol", element.getProtocol());
42105      }
42106      if (element.hasAddressElement()) {
42107        composeUrlCore("address", element.getAddressElement(), false);
42108        composeUrlExtras("address", element.getAddressElement(), false);
42109      }
42110  }
42111
42112  protected void composeCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
42113    if (element != null) {
42114      open(name);
42115      composeCapabilityStatementMessagingSupportedMessageComponentProperties(element);
42116      close();
42117    }
42118  }
42119
42120  protected void composeCapabilityStatementMessagingSupportedMessageComponentProperties(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
42121    composeBackboneElementProperties(element);
42122      if (element.hasModeElement()) {
42123        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
42124        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
42125      }
42126      if (element.hasDefinitionElement()) {
42127        composeCanonicalCore("definition", element.getDefinitionElement(), false);
42128        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
42129      }
42130  }
42131
42132  protected void composeCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
42133    if (element != null) {
42134      open(name);
42135      composeCapabilityStatementDocumentComponentProperties(element);
42136      close();
42137    }
42138  }
42139
42140  protected void composeCapabilityStatementDocumentComponentProperties(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
42141    composeBackboneElementProperties(element);
42142      if (element.hasModeElement()) {
42143        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
42144        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
42145      }
42146      if (element.hasDocumentationElement()) {
42147        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42148        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42149      }
42150      if (element.hasProfileElement()) {
42151        composeCanonicalCore("profile", element.getProfileElement(), false);
42152        composeCanonicalExtras("profile", element.getProfileElement(), false);
42153      }
42154  }
42155
42156  protected void composeCarePlan(String name, CarePlan element) throws IOException {
42157    if (element != null) {
42158      prop("resourceType", name);
42159      composeCarePlanProperties(element);
42160    }
42161  }
42162
42163  protected void composeCarePlanProperties(CarePlan element) throws IOException {
42164    composeDomainResourceProperties(element);
42165      if (element.hasIdentifier()) {
42166        openArray("identifier");
42167        for (Identifier e : element.getIdentifier()) 
42168          composeIdentifier(null, e);
42169        closeArray();
42170      };
42171      if (element.hasInstantiatesCanonical()) {
42172        if (anyHasValue(element.getInstantiatesCanonical())) {
42173          openArray("instantiatesCanonical");
42174          for (CanonicalType e : element.getInstantiatesCanonical()) 
42175            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
42176          closeArray();
42177        }
42178        if (anyHasExtras(element.getInstantiatesCanonical())) {
42179          openArray("_instantiatesCanonical");
42180          for (CanonicalType e : element.getInstantiatesCanonical()) 
42181            composeCanonicalExtras(null, e, true);
42182          closeArray();
42183        }
42184      };
42185      if (element.hasInstantiatesUri()) {
42186        if (anyHasValue(element.getInstantiatesUri())) {
42187          openArray("instantiatesUri");
42188          for (UriType e : element.getInstantiatesUri()) 
42189            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
42190          closeArray();
42191        }
42192        if (anyHasExtras(element.getInstantiatesUri())) {
42193          openArray("_instantiatesUri");
42194          for (UriType e : element.getInstantiatesUri()) 
42195            composeUriExtras(null, e, true);
42196          closeArray();
42197        }
42198      };
42199      if (element.hasBasedOn()) {
42200        openArray("basedOn");
42201        for (Reference e : element.getBasedOn()) 
42202          composeReference(null, e);
42203        closeArray();
42204      };
42205      if (element.hasReplaces()) {
42206        openArray("replaces");
42207        for (Reference e : element.getReplaces()) 
42208          composeReference(null, e);
42209        closeArray();
42210      };
42211      if (element.hasPartOf()) {
42212        openArray("partOf");
42213        for (Reference e : element.getPartOf()) 
42214          composeReference(null, e);
42215        closeArray();
42216      };
42217      if (element.hasStatusElement()) {
42218        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
42219        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
42220      }
42221      if (element.hasIntentElement()) {
42222        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
42223        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
42224      }
42225      if (element.hasCategory()) {
42226        openArray("category");
42227        for (CodeableConcept e : element.getCategory()) 
42228          composeCodeableConcept(null, e);
42229        closeArray();
42230      };
42231      if (element.hasTitleElement()) {
42232        composeStringCore("title", element.getTitleElement(), false);
42233        composeStringExtras("title", element.getTitleElement(), false);
42234      }
42235      if (element.hasDescriptionElement()) {
42236        composeStringCore("description", element.getDescriptionElement(), false);
42237        composeStringExtras("description", element.getDescriptionElement(), false);
42238      }
42239      if (element.hasSubject()) {
42240        composeReference("subject", element.getSubject());
42241      }
42242      if (element.hasEncounter()) {
42243        composeReference("encounter", element.getEncounter());
42244      }
42245      if (element.hasPeriod()) {
42246        composePeriod("period", element.getPeriod());
42247      }
42248      if (element.hasCreatedElement()) {
42249        composeDateTimeCore("created", element.getCreatedElement(), false);
42250        composeDateTimeExtras("created", element.getCreatedElement(), false);
42251      }
42252      if (element.hasCustodian()) {
42253        composeReference("custodian", element.getCustodian());
42254      }
42255      if (element.hasContributor()) {
42256        openArray("contributor");
42257        for (Reference e : element.getContributor()) 
42258          composeReference(null, e);
42259        closeArray();
42260      };
42261      if (element.hasCareTeam()) {
42262        openArray("careTeam");
42263        for (Reference e : element.getCareTeam()) 
42264          composeReference(null, e);
42265        closeArray();
42266      };
42267      if (element.hasAddresses()) {
42268        openArray("addresses");
42269        for (CodeableReference e : element.getAddresses()) 
42270          composeCodeableReference(null, e);
42271        closeArray();
42272      };
42273      if (element.hasSupportingInfo()) {
42274        openArray("supportingInfo");
42275        for (Reference e : element.getSupportingInfo()) 
42276          composeReference(null, e);
42277        closeArray();
42278      };
42279      if (element.hasGoal()) {
42280        openArray("goal");
42281        for (Reference e : element.getGoal()) 
42282          composeReference(null, e);
42283        closeArray();
42284      };
42285      if (element.hasActivity()) {
42286        openArray("activity");
42287        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
42288          composeCarePlanActivityComponent(null, e);
42289        closeArray();
42290      };
42291      if (element.hasNote()) {
42292        openArray("note");
42293        for (Annotation e : element.getNote()) 
42294          composeAnnotation(null, e);
42295        closeArray();
42296      };
42297  }
42298
42299  protected void composeCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
42300    if (element != null) {
42301      open(name);
42302      composeCarePlanActivityComponentProperties(element);
42303      close();
42304    }
42305  }
42306
42307  protected void composeCarePlanActivityComponentProperties(CarePlan.CarePlanActivityComponent element) throws IOException {
42308    composeBackboneElementProperties(element);
42309      if (element.hasPerformedActivity()) {
42310        openArray("performedActivity");
42311        for (CodeableReference e : element.getPerformedActivity()) 
42312          composeCodeableReference(null, e);
42313        closeArray();
42314      };
42315      if (element.hasProgress()) {
42316        openArray("progress");
42317        for (Annotation e : element.getProgress()) 
42318          composeAnnotation(null, e);
42319        closeArray();
42320      };
42321      if (element.hasPlannedActivityReference()) {
42322        composeReference("plannedActivityReference", element.getPlannedActivityReference());
42323      }
42324  }
42325
42326  protected void composeCareTeam(String name, CareTeam element) throws IOException {
42327    if (element != null) {
42328      prop("resourceType", name);
42329      composeCareTeamProperties(element);
42330    }
42331  }
42332
42333  protected void composeCareTeamProperties(CareTeam element) throws IOException {
42334    composeDomainResourceProperties(element);
42335      if (element.hasIdentifier()) {
42336        openArray("identifier");
42337        for (Identifier e : element.getIdentifier()) 
42338          composeIdentifier(null, e);
42339        closeArray();
42340      };
42341      if (element.hasStatusElement()) {
42342        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
42343        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
42344      }
42345      if (element.hasCategory()) {
42346        openArray("category");
42347        for (CodeableConcept e : element.getCategory()) 
42348          composeCodeableConcept(null, e);
42349        closeArray();
42350      };
42351      if (element.hasNameElement()) {
42352        composeStringCore("name", element.getNameElement(), false);
42353        composeStringExtras("name", element.getNameElement(), false);
42354      }
42355      if (element.hasSubject()) {
42356        composeReference("subject", element.getSubject());
42357      }
42358      if (element.hasPeriod()) {
42359        composePeriod("period", element.getPeriod());
42360      }
42361      if (element.hasParticipant()) {
42362        openArray("participant");
42363        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
42364          composeCareTeamParticipantComponent(null, e);
42365        closeArray();
42366      };
42367      if (element.hasReason()) {
42368        openArray("reason");
42369        for (CodeableReference e : element.getReason()) 
42370          composeCodeableReference(null, e);
42371        closeArray();
42372      };
42373      if (element.hasManagingOrganization()) {
42374        openArray("managingOrganization");
42375        for (Reference e : element.getManagingOrganization()) 
42376          composeReference(null, e);
42377        closeArray();
42378      };
42379      if (element.hasTelecom()) {
42380        openArray("telecom");
42381        for (ContactPoint e : element.getTelecom()) 
42382          composeContactPoint(null, e);
42383        closeArray();
42384      };
42385      if (element.hasNote()) {
42386        openArray("note");
42387        for (Annotation e : element.getNote()) 
42388          composeAnnotation(null, e);
42389        closeArray();
42390      };
42391  }
42392
42393  protected void composeCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
42394    if (element != null) {
42395      open(name);
42396      composeCareTeamParticipantComponentProperties(element);
42397      close();
42398    }
42399  }
42400
42401  protected void composeCareTeamParticipantComponentProperties(CareTeam.CareTeamParticipantComponent element) throws IOException {
42402    composeBackboneElementProperties(element);
42403      if (element.hasRole()) {
42404        composeCodeableConcept("role", element.getRole());
42405      }
42406      if (element.hasMember()) {
42407        composeReference("member", element.getMember());
42408      }
42409      if (element.hasOnBehalfOf()) {
42410        composeReference("onBehalfOf", element.getOnBehalfOf());
42411      }
42412      if (element.hasCoverage()) {
42413        composeType("coverage", element.getCoverage());
42414      }
42415  }
42416
42417  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
42418    if (element != null) {
42419      prop("resourceType", name);
42420      composeChargeItemProperties(element);
42421    }
42422  }
42423
42424  protected void composeChargeItemProperties(ChargeItem element) throws IOException {
42425    composeDomainResourceProperties(element);
42426      if (element.hasIdentifier()) {
42427        openArray("identifier");
42428        for (Identifier e : element.getIdentifier()) 
42429          composeIdentifier(null, e);
42430        closeArray();
42431      };
42432      if (element.hasDefinitionUri()) {
42433        if (anyHasValue(element.getDefinitionUri())) {
42434          openArray("definitionUri");
42435          for (UriType e : element.getDefinitionUri()) 
42436            composeUriCore(null, e, e != element.getDefinitionUri().get(element.getDefinitionUri().size()-1));
42437          closeArray();
42438        }
42439        if (anyHasExtras(element.getDefinitionUri())) {
42440          openArray("_definitionUri");
42441          for (UriType e : element.getDefinitionUri()) 
42442            composeUriExtras(null, e, true);
42443          closeArray();
42444        }
42445      };
42446      if (element.hasDefinitionCanonical()) {
42447        if (anyHasValue(element.getDefinitionCanonical())) {
42448          openArray("definitionCanonical");
42449          for (CanonicalType e : element.getDefinitionCanonical()) 
42450            composeCanonicalCore(null, e, e != element.getDefinitionCanonical().get(element.getDefinitionCanonical().size()-1));
42451          closeArray();
42452        }
42453        if (anyHasExtras(element.getDefinitionCanonical())) {
42454          openArray("_definitionCanonical");
42455          for (CanonicalType e : element.getDefinitionCanonical()) 
42456            composeCanonicalExtras(null, e, true);
42457          closeArray();
42458        }
42459      };
42460      if (element.hasStatusElement()) {
42461        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
42462        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
42463      }
42464      if (element.hasPartOf()) {
42465        openArray("partOf");
42466        for (Reference e : element.getPartOf()) 
42467          composeReference(null, e);
42468        closeArray();
42469      };
42470      if (element.hasCode()) {
42471        composeCodeableConcept("code", element.getCode());
42472      }
42473      if (element.hasSubject()) {
42474        composeReference("subject", element.getSubject());
42475      }
42476      if (element.hasEncounter()) {
42477        composeReference("encounter", element.getEncounter());
42478      }
42479      if (element.hasOccurrence()) {
42480        composeType("occurrence", element.getOccurrence());
42481      }
42482      if (element.hasPerformer()) {
42483        openArray("performer");
42484        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
42485          composeChargeItemPerformerComponent(null, e);
42486        closeArray();
42487      };
42488      if (element.hasPerformingOrganization()) {
42489        composeReference("performingOrganization", element.getPerformingOrganization());
42490      }
42491      if (element.hasRequestingOrganization()) {
42492        composeReference("requestingOrganization", element.getRequestingOrganization());
42493      }
42494      if (element.hasCostCenter()) {
42495        composeReference("costCenter", element.getCostCenter());
42496      }
42497      if (element.hasQuantity()) {
42498        composeQuantity("quantity", element.getQuantity());
42499      }
42500      if (element.hasBodysite()) {
42501        openArray("bodysite");
42502        for (CodeableConcept e : element.getBodysite()) 
42503          composeCodeableConcept(null, e);
42504        closeArray();
42505      };
42506      if (element.hasUnitPriceComponent()) {
42507        composeMonetaryComponent("unitPriceComponent", element.getUnitPriceComponent());
42508      }
42509      if (element.hasTotalPriceComponent()) {
42510        composeMonetaryComponent("totalPriceComponent", element.getTotalPriceComponent());
42511      }
42512      if (element.hasOverrideReason()) {
42513        composeCodeableConcept("overrideReason", element.getOverrideReason());
42514      }
42515      if (element.hasEnterer()) {
42516        composeReference("enterer", element.getEnterer());
42517      }
42518      if (element.hasEnteredDateElement()) {
42519        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
42520        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
42521      }
42522      if (element.hasReason()) {
42523        openArray("reason");
42524        for (CodeableConcept e : element.getReason()) 
42525          composeCodeableConcept(null, e);
42526        closeArray();
42527      };
42528      if (element.hasService()) {
42529        openArray("service");
42530        for (CodeableReference e : element.getService()) 
42531          composeCodeableReference(null, e);
42532        closeArray();
42533      };
42534      if (element.hasProduct()) {
42535        openArray("product");
42536        for (CodeableReference e : element.getProduct()) 
42537          composeCodeableReference(null, e);
42538        closeArray();
42539      };
42540      if (element.hasAccount()) {
42541        openArray("account");
42542        for (Reference e : element.getAccount()) 
42543          composeReference(null, e);
42544        closeArray();
42545      };
42546      if (element.hasNote()) {
42547        openArray("note");
42548        for (Annotation e : element.getNote()) 
42549          composeAnnotation(null, e);
42550        closeArray();
42551      };
42552      if (element.hasSupportingInformation()) {
42553        openArray("supportingInformation");
42554        for (Reference e : element.getSupportingInformation()) 
42555          composeReference(null, e);
42556        closeArray();
42557      };
42558  }
42559
42560  protected void composeChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
42561    if (element != null) {
42562      open(name);
42563      composeChargeItemPerformerComponentProperties(element);
42564      close();
42565    }
42566  }
42567
42568  protected void composeChargeItemPerformerComponentProperties(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
42569    composeBackboneElementProperties(element);
42570      if (element.hasFunction()) {
42571        composeCodeableConcept("function", element.getFunction());
42572      }
42573      if (element.hasActor()) {
42574        composeReference("actor", element.getActor());
42575      }
42576  }
42577
42578  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
42579    if (element != null) {
42580      prop("resourceType", name);
42581      composeChargeItemDefinitionProperties(element);
42582    }
42583  }
42584
42585  protected void composeChargeItemDefinitionProperties(ChargeItemDefinition element) throws IOException {
42586    composeMetadataResourceProperties(element);
42587      if (element.hasUrlElement()) {
42588        composeUriCore("url", element.getUrlElement(), false);
42589        composeUriExtras("url", element.getUrlElement(), false);
42590      }
42591      if (element.hasIdentifier()) {
42592        openArray("identifier");
42593        for (Identifier e : element.getIdentifier()) 
42594          composeIdentifier(null, e);
42595        closeArray();
42596      };
42597      if (element.hasVersionElement()) {
42598        composeStringCore("version", element.getVersionElement(), false);
42599        composeStringExtras("version", element.getVersionElement(), false);
42600      }
42601      if (element.hasVersionAlgorithm()) {
42602        composeType("versionAlgorithm", element.getVersionAlgorithm());
42603      }
42604      if (element.hasNameElement()) {
42605        composeStringCore("name", element.getNameElement(), false);
42606        composeStringExtras("name", element.getNameElement(), false);
42607      }
42608      if (element.hasTitleElement()) {
42609        composeStringCore("title", element.getTitleElement(), false);
42610        composeStringExtras("title", element.getTitleElement(), false);
42611      }
42612      if (element.hasDerivedFromUri()) {
42613        if (anyHasValue(element.getDerivedFromUri())) {
42614          openArray("derivedFromUri");
42615          for (UriType e : element.getDerivedFromUri()) 
42616            composeUriCore(null, e, e != element.getDerivedFromUri().get(element.getDerivedFromUri().size()-1));
42617          closeArray();
42618        }
42619        if (anyHasExtras(element.getDerivedFromUri())) {
42620          openArray("_derivedFromUri");
42621          for (UriType e : element.getDerivedFromUri()) 
42622            composeUriExtras(null, e, true);
42623          closeArray();
42624        }
42625      };
42626      if (element.hasPartOf()) {
42627        if (anyHasValue(element.getPartOf())) {
42628          openArray("partOf");
42629          for (CanonicalType e : element.getPartOf()) 
42630            composeCanonicalCore(null, e, e != element.getPartOf().get(element.getPartOf().size()-1));
42631          closeArray();
42632        }
42633        if (anyHasExtras(element.getPartOf())) {
42634          openArray("_partOf");
42635          for (CanonicalType e : element.getPartOf()) 
42636            composeCanonicalExtras(null, e, true);
42637          closeArray();
42638        }
42639      };
42640      if (element.hasReplaces()) {
42641        if (anyHasValue(element.getReplaces())) {
42642          openArray("replaces");
42643          for (CanonicalType e : element.getReplaces()) 
42644            composeCanonicalCore(null, e, e != element.getReplaces().get(element.getReplaces().size()-1));
42645          closeArray();
42646        }
42647        if (anyHasExtras(element.getReplaces())) {
42648          openArray("_replaces");
42649          for (CanonicalType e : element.getReplaces()) 
42650            composeCanonicalExtras(null, e, true);
42651          closeArray();
42652        }
42653      };
42654      if (element.hasStatusElement()) {
42655        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42656        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42657      }
42658      if (element.hasExperimentalElement()) {
42659        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42660        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42661      }
42662      if (element.hasDateElement()) {
42663        composeDateTimeCore("date", element.getDateElement(), false);
42664        composeDateTimeExtras("date", element.getDateElement(), false);
42665      }
42666      if (element.hasPublisherElement()) {
42667        composeStringCore("publisher", element.getPublisherElement(), false);
42668        composeStringExtras("publisher", element.getPublisherElement(), false);
42669      }
42670      if (element.hasContact()) {
42671        openArray("contact");
42672        for (ContactDetail e : element.getContact()) 
42673          composeContactDetail(null, e);
42674        closeArray();
42675      };
42676      if (element.hasDescriptionElement()) {
42677        composeMarkdownCore("description", element.getDescriptionElement(), false);
42678        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42679      }
42680      if (element.hasUseContext()) {
42681        openArray("useContext");
42682        for (UsageContext e : element.getUseContext()) 
42683          composeUsageContext(null, e);
42684        closeArray();
42685      };
42686      if (element.hasJurisdiction()) {
42687        openArray("jurisdiction");
42688        for (CodeableConcept e : element.getJurisdiction()) 
42689          composeCodeableConcept(null, e);
42690        closeArray();
42691      };
42692      if (element.hasPurposeElement()) {
42693        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42694        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42695      }
42696      if (element.hasCopyrightElement()) {
42697        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42698        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42699      }
42700      if (element.hasCopyrightLabelElement()) {
42701        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
42702        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
42703      }
42704      if (element.hasApprovalDateElement()) {
42705        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42706        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42707      }
42708      if (element.hasLastReviewDateElement()) {
42709        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42710        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42711      }
42712      if (element.hasCode()) {
42713        composeCodeableConcept("code", element.getCode());
42714      }
42715      if (element.hasInstance()) {
42716        openArray("instance");
42717        for (Reference e : element.getInstance()) 
42718          composeReference(null, e);
42719        closeArray();
42720      };
42721      if (element.hasApplicability()) {
42722        openArray("applicability");
42723        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
42724          composeChargeItemDefinitionApplicabilityComponent(null, e);
42725        closeArray();
42726      };
42727      if (element.hasPropertyGroup()) {
42728        openArray("propertyGroup");
42729        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
42730          composeChargeItemDefinitionPropertyGroupComponent(null, e);
42731        closeArray();
42732      };
42733  }
42734
42735  protected void composeChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
42736    if (element != null) {
42737      open(name);
42738      composeChargeItemDefinitionApplicabilityComponentProperties(element);
42739      close();
42740    }
42741  }
42742
42743  protected void composeChargeItemDefinitionApplicabilityComponentProperties(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
42744    composeBackboneElementProperties(element);
42745      if (element.hasCondition()) {
42746        composeExpression("condition", element.getCondition());
42747      }
42748      if (element.hasEffectivePeriod()) {
42749        composePeriod("effectivePeriod", element.getEffectivePeriod());
42750      }
42751      if (element.hasRelatedArtifact()) {
42752        composeRelatedArtifact("relatedArtifact", element.getRelatedArtifact());
42753      }
42754  }
42755
42756  protected void composeChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
42757    if (element != null) {
42758      open(name);
42759      composeChargeItemDefinitionPropertyGroupComponentProperties(element);
42760      close();
42761    }
42762  }
42763
42764  protected void composeChargeItemDefinitionPropertyGroupComponentProperties(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
42765    composeBackboneElementProperties(element);
42766      if (element.hasApplicability()) {
42767        openArray("applicability");
42768        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
42769          composeChargeItemDefinitionApplicabilityComponent(null, e);
42770        closeArray();
42771      };
42772      if (element.hasPriceComponent()) {
42773        openArray("priceComponent");
42774        for (MonetaryComponent e : element.getPriceComponent()) 
42775          composeMonetaryComponent(null, e);
42776        closeArray();
42777      };
42778  }
42779
42780  protected void composeCitation(String name, Citation element) throws IOException {
42781    if (element != null) {
42782      prop("resourceType", name);
42783      composeCitationProperties(element);
42784    }
42785  }
42786
42787  protected void composeCitationProperties(Citation element) throws IOException {
42788    composeMetadataResourceProperties(element);
42789      if (element.hasUrlElement()) {
42790        composeUriCore("url", element.getUrlElement(), false);
42791        composeUriExtras("url", element.getUrlElement(), false);
42792      }
42793      if (element.hasIdentifier()) {
42794        openArray("identifier");
42795        for (Identifier e : element.getIdentifier()) 
42796          composeIdentifier(null, e);
42797        closeArray();
42798      };
42799      if (element.hasVersionElement()) {
42800        composeStringCore("version", element.getVersionElement(), false);
42801        composeStringExtras("version", element.getVersionElement(), false);
42802      }
42803      if (element.hasVersionAlgorithm()) {
42804        composeType("versionAlgorithm", element.getVersionAlgorithm());
42805      }
42806      if (element.hasNameElement()) {
42807        composeStringCore("name", element.getNameElement(), false);
42808        composeStringExtras("name", element.getNameElement(), false);
42809      }
42810      if (element.hasTitleElement()) {
42811        composeStringCore("title", element.getTitleElement(), false);
42812        composeStringExtras("title", element.getTitleElement(), false);
42813      }
42814      if (element.hasStatusElement()) {
42815        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42816        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42817      }
42818      if (element.hasExperimentalElement()) {
42819        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42820        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42821      }
42822      if (element.hasDateElement()) {
42823        composeDateTimeCore("date", element.getDateElement(), false);
42824        composeDateTimeExtras("date", element.getDateElement(), false);
42825      }
42826      if (element.hasPublisherElement()) {
42827        composeStringCore("publisher", element.getPublisherElement(), false);
42828        composeStringExtras("publisher", element.getPublisherElement(), false);
42829      }
42830      if (element.hasContact()) {
42831        openArray("contact");
42832        for (ContactDetail e : element.getContact()) 
42833          composeContactDetail(null, e);
42834        closeArray();
42835      };
42836      if (element.hasDescriptionElement()) {
42837        composeMarkdownCore("description", element.getDescriptionElement(), false);
42838        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42839      }
42840      if (element.hasUseContext()) {
42841        openArray("useContext");
42842        for (UsageContext e : element.getUseContext()) 
42843          composeUsageContext(null, e);
42844        closeArray();
42845      };
42846      if (element.hasJurisdiction()) {
42847        openArray("jurisdiction");
42848        for (CodeableConcept e : element.getJurisdiction()) 
42849          composeCodeableConcept(null, e);
42850        closeArray();
42851      };
42852      if (element.hasPurposeElement()) {
42853        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42854        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42855      }
42856      if (element.hasCopyrightElement()) {
42857        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42858        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42859      }
42860      if (element.hasCopyrightLabelElement()) {
42861        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
42862        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
42863      }
42864      if (element.hasApprovalDateElement()) {
42865        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42866        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42867      }
42868      if (element.hasLastReviewDateElement()) {
42869        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42870        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42871      }
42872      if (element.hasEffectivePeriod()) {
42873        composePeriod("effectivePeriod", element.getEffectivePeriod());
42874      }
42875      if (element.hasAuthor()) {
42876        openArray("author");
42877        for (ContactDetail e : element.getAuthor()) 
42878          composeContactDetail(null, e);
42879        closeArray();
42880      };
42881      if (element.hasEditor()) {
42882        openArray("editor");
42883        for (ContactDetail e : element.getEditor()) 
42884          composeContactDetail(null, e);
42885        closeArray();
42886      };
42887      if (element.hasReviewer()) {
42888        openArray("reviewer");
42889        for (ContactDetail e : element.getReviewer()) 
42890          composeContactDetail(null, e);
42891        closeArray();
42892      };
42893      if (element.hasEndorser()) {
42894        openArray("endorser");
42895        for (ContactDetail e : element.getEndorser()) 
42896          composeContactDetail(null, e);
42897        closeArray();
42898      };
42899      if (element.hasSummary()) {
42900        openArray("summary");
42901        for (Citation.CitationSummaryComponent e : element.getSummary()) 
42902          composeCitationSummaryComponent(null, e);
42903        closeArray();
42904      };
42905      if (element.hasClassification()) {
42906        openArray("classification");
42907        for (Citation.CitationClassificationComponent e : element.getClassification()) 
42908          composeCitationClassificationComponent(null, e);
42909        closeArray();
42910      };
42911      if (element.hasNote()) {
42912        openArray("note");
42913        for (Annotation e : element.getNote()) 
42914          composeAnnotation(null, e);
42915        closeArray();
42916      };
42917      if (element.hasCurrentState()) {
42918        openArray("currentState");
42919        for (CodeableConcept e : element.getCurrentState()) 
42920          composeCodeableConcept(null, e);
42921        closeArray();
42922      };
42923      if (element.hasStatusDate()) {
42924        openArray("statusDate");
42925        for (Citation.CitationStatusDateComponent e : element.getStatusDate()) 
42926          composeCitationStatusDateComponent(null, e);
42927        closeArray();
42928      };
42929      if (element.hasRelatedArtifact()) {
42930        openArray("relatedArtifact");
42931        for (RelatedArtifact e : element.getRelatedArtifact()) 
42932          composeRelatedArtifact(null, e);
42933        closeArray();
42934      };
42935      if (element.hasCitedArtifact()) {
42936        composeCitationCitedArtifactComponent("citedArtifact", element.getCitedArtifact());
42937      }
42938  }
42939
42940  protected void composeCitationSummaryComponent(String name, Citation.CitationSummaryComponent element) throws IOException {
42941    if (element != null) {
42942      open(name);
42943      composeCitationSummaryComponentProperties(element);
42944      close();
42945    }
42946  }
42947
42948  protected void composeCitationSummaryComponentProperties(Citation.CitationSummaryComponent element) throws IOException {
42949    composeBackboneElementProperties(element);
42950      if (element.hasStyle()) {
42951        composeCodeableConcept("style", element.getStyle());
42952      }
42953      if (element.hasTextElement()) {
42954        composeMarkdownCore("text", element.getTextElement(), false);
42955        composeMarkdownExtras("text", element.getTextElement(), false);
42956      }
42957  }
42958
42959  protected void composeCitationClassificationComponent(String name, Citation.CitationClassificationComponent element) throws IOException {
42960    if (element != null) {
42961      open(name);
42962      composeCitationClassificationComponentProperties(element);
42963      close();
42964    }
42965  }
42966
42967  protected void composeCitationClassificationComponentProperties(Citation.CitationClassificationComponent element) throws IOException {
42968    composeBackboneElementProperties(element);
42969      if (element.hasType()) {
42970        composeCodeableConcept("type", element.getType());
42971      }
42972      if (element.hasClassifier()) {
42973        openArray("classifier");
42974        for (CodeableConcept e : element.getClassifier()) 
42975          composeCodeableConcept(null, e);
42976        closeArray();
42977      };
42978  }
42979
42980  protected void composeCitationStatusDateComponent(String name, Citation.CitationStatusDateComponent element) throws IOException {
42981    if (element != null) {
42982      open(name);
42983      composeCitationStatusDateComponentProperties(element);
42984      close();
42985    }
42986  }
42987
42988  protected void composeCitationStatusDateComponentProperties(Citation.CitationStatusDateComponent element) throws IOException {
42989    composeBackboneElementProperties(element);
42990      if (element.hasActivity()) {
42991        composeCodeableConcept("activity", element.getActivity());
42992      }
42993      if (element.hasActualElement()) {
42994        composeBooleanCore("actual", element.getActualElement(), false);
42995        composeBooleanExtras("actual", element.getActualElement(), false);
42996      }
42997      if (element.hasPeriod()) {
42998        composePeriod("period", element.getPeriod());
42999      }
43000  }
43001
43002  protected void composeCitationCitedArtifactComponent(String name, Citation.CitationCitedArtifactComponent element) throws IOException {
43003    if (element != null) {
43004      open(name);
43005      composeCitationCitedArtifactComponentProperties(element);
43006      close();
43007    }
43008  }
43009
43010  protected void composeCitationCitedArtifactComponentProperties(Citation.CitationCitedArtifactComponent element) throws IOException {
43011    composeBackboneElementProperties(element);
43012      if (element.hasIdentifier()) {
43013        openArray("identifier");
43014        for (Identifier e : element.getIdentifier()) 
43015          composeIdentifier(null, e);
43016        closeArray();
43017      };
43018      if (element.hasRelatedIdentifier()) {
43019        openArray("relatedIdentifier");
43020        for (Identifier e : element.getRelatedIdentifier()) 
43021          composeIdentifier(null, e);
43022        closeArray();
43023      };
43024      if (element.hasDateAccessedElement()) {
43025        composeDateTimeCore("dateAccessed", element.getDateAccessedElement(), false);
43026        composeDateTimeExtras("dateAccessed", element.getDateAccessedElement(), false);
43027      }
43028      if (element.hasVersion()) {
43029        composeCitationCitedArtifactVersionComponent("version", element.getVersion());
43030      }
43031      if (element.hasCurrentState()) {
43032        openArray("currentState");
43033        for (CodeableConcept e : element.getCurrentState()) 
43034          composeCodeableConcept(null, e);
43035        closeArray();
43036      };
43037      if (element.hasStatusDate()) {
43038        openArray("statusDate");
43039        for (Citation.CitationCitedArtifactStatusDateComponent e : element.getStatusDate()) 
43040          composeCitationCitedArtifactStatusDateComponent(null, e);
43041        closeArray();
43042      };
43043      if (element.hasTitle()) {
43044        openArray("title");
43045        for (Citation.CitationCitedArtifactTitleComponent e : element.getTitle()) 
43046          composeCitationCitedArtifactTitleComponent(null, e);
43047        closeArray();
43048      };
43049      if (element.hasAbstract()) {
43050        openArray("abstract");
43051        for (Citation.CitationCitedArtifactAbstractComponent e : element.getAbstract()) 
43052          composeCitationCitedArtifactAbstractComponent(null, e);
43053        closeArray();
43054      };
43055      if (element.hasPart()) {
43056        composeCitationCitedArtifactPartComponent("part", element.getPart());
43057      }
43058      if (element.hasRelatesTo()) {
43059        openArray("relatesTo");
43060        for (Citation.CitationCitedArtifactRelatesToComponent e : element.getRelatesTo()) 
43061          composeCitationCitedArtifactRelatesToComponent(null, e);
43062        closeArray();
43063      };
43064      if (element.hasPublicationForm()) {
43065        openArray("publicationForm");
43066        for (Citation.CitationCitedArtifactPublicationFormComponent e : element.getPublicationForm()) 
43067          composeCitationCitedArtifactPublicationFormComponent(null, e);
43068        closeArray();
43069      };
43070      if (element.hasWebLocation()) {
43071        openArray("webLocation");
43072        for (Citation.CitationCitedArtifactWebLocationComponent e : element.getWebLocation()) 
43073          composeCitationCitedArtifactWebLocationComponent(null, e);
43074        closeArray();
43075      };
43076      if (element.hasClassification()) {
43077        openArray("classification");
43078        for (Citation.CitationCitedArtifactClassificationComponent e : element.getClassification()) 
43079          composeCitationCitedArtifactClassificationComponent(null, e);
43080        closeArray();
43081      };
43082      if (element.hasContributorship()) {
43083        composeCitationCitedArtifactContributorshipComponent("contributorship", element.getContributorship());
43084      }
43085      if (element.hasNote()) {
43086        openArray("note");
43087        for (Annotation e : element.getNote()) 
43088          composeAnnotation(null, e);
43089        closeArray();
43090      };
43091  }
43092
43093  protected void composeCitationCitedArtifactVersionComponent(String name, Citation.CitationCitedArtifactVersionComponent element) throws IOException {
43094    if (element != null) {
43095      open(name);
43096      composeCitationCitedArtifactVersionComponentProperties(element);
43097      close();
43098    }
43099  }
43100
43101  protected void composeCitationCitedArtifactVersionComponentProperties(Citation.CitationCitedArtifactVersionComponent element) throws IOException {
43102    composeBackboneElementProperties(element);
43103      if (element.hasValueElement()) {
43104        composeStringCore("value", element.getValueElement(), false);
43105        composeStringExtras("value", element.getValueElement(), false);
43106      }
43107      if (element.hasBaseCitation()) {
43108        composeReference("baseCitation", element.getBaseCitation());
43109      }
43110  }
43111
43112  protected void composeCitationCitedArtifactStatusDateComponent(String name, Citation.CitationCitedArtifactStatusDateComponent element) throws IOException {
43113    if (element != null) {
43114      open(name);
43115      composeCitationCitedArtifactStatusDateComponentProperties(element);
43116      close();
43117    }
43118  }
43119
43120  protected void composeCitationCitedArtifactStatusDateComponentProperties(Citation.CitationCitedArtifactStatusDateComponent element) throws IOException {
43121    composeBackboneElementProperties(element);
43122      if (element.hasActivity()) {
43123        composeCodeableConcept("activity", element.getActivity());
43124      }
43125      if (element.hasActualElement()) {
43126        composeBooleanCore("actual", element.getActualElement(), false);
43127        composeBooleanExtras("actual", element.getActualElement(), false);
43128      }
43129      if (element.hasPeriod()) {
43130        composePeriod("period", element.getPeriod());
43131      }
43132  }
43133
43134  protected void composeCitationCitedArtifactTitleComponent(String name, Citation.CitationCitedArtifactTitleComponent element) throws IOException {
43135    if (element != null) {
43136      open(name);
43137      composeCitationCitedArtifactTitleComponentProperties(element);
43138      close();
43139    }
43140  }
43141
43142  protected void composeCitationCitedArtifactTitleComponentProperties(Citation.CitationCitedArtifactTitleComponent element) throws IOException {
43143    composeBackboneElementProperties(element);
43144      if (element.hasType()) {
43145        openArray("type");
43146        for (CodeableConcept e : element.getType()) 
43147          composeCodeableConcept(null, e);
43148        closeArray();
43149      };
43150      if (element.hasLanguage()) {
43151        composeCodeableConcept("language", element.getLanguage());
43152      }
43153      if (element.hasTextElement()) {
43154        composeMarkdownCore("text", element.getTextElement(), false);
43155        composeMarkdownExtras("text", element.getTextElement(), false);
43156      }
43157  }
43158
43159  protected void composeCitationCitedArtifactAbstractComponent(String name, Citation.CitationCitedArtifactAbstractComponent element) throws IOException {
43160    if (element != null) {
43161      open(name);
43162      composeCitationCitedArtifactAbstractComponentProperties(element);
43163      close();
43164    }
43165  }
43166
43167  protected void composeCitationCitedArtifactAbstractComponentProperties(Citation.CitationCitedArtifactAbstractComponent element) throws IOException {
43168    composeBackboneElementProperties(element);
43169      if (element.hasType()) {
43170        composeCodeableConcept("type", element.getType());
43171      }
43172      if (element.hasLanguage()) {
43173        composeCodeableConcept("language", element.getLanguage());
43174      }
43175      if (element.hasTextElement()) {
43176        composeMarkdownCore("text", element.getTextElement(), false);
43177        composeMarkdownExtras("text", element.getTextElement(), false);
43178      }
43179      if (element.hasCopyrightElement()) {
43180        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43181        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43182      }
43183  }
43184
43185  protected void composeCitationCitedArtifactPartComponent(String name, Citation.CitationCitedArtifactPartComponent element) throws IOException {
43186    if (element != null) {
43187      open(name);
43188      composeCitationCitedArtifactPartComponentProperties(element);
43189      close();
43190    }
43191  }
43192
43193  protected void composeCitationCitedArtifactPartComponentProperties(Citation.CitationCitedArtifactPartComponent element) throws IOException {
43194    composeBackboneElementProperties(element);
43195      if (element.hasType()) {
43196        composeCodeableConcept("type", element.getType());
43197      }
43198      if (element.hasValueElement()) {
43199        composeStringCore("value", element.getValueElement(), false);
43200        composeStringExtras("value", element.getValueElement(), false);
43201      }
43202      if (element.hasBaseCitation()) {
43203        composeReference("baseCitation", element.getBaseCitation());
43204      }
43205  }
43206
43207  protected void composeCitationCitedArtifactRelatesToComponent(String name, Citation.CitationCitedArtifactRelatesToComponent element) throws IOException {
43208    if (element != null) {
43209      open(name);
43210      composeCitationCitedArtifactRelatesToComponentProperties(element);
43211      close();
43212    }
43213  }
43214
43215  protected void composeCitationCitedArtifactRelatesToComponentProperties(Citation.CitationCitedArtifactRelatesToComponent element) throws IOException {
43216    composeBackboneElementProperties(element);
43217      if (element.hasTypeElement()) {
43218        composeEnumerationCore("type", element.getTypeElement(), new Citation.RelatedArtifactTypeExpandedEnumFactory(), false);
43219        composeEnumerationExtras("type", element.getTypeElement(), new Citation.RelatedArtifactTypeExpandedEnumFactory(), false);
43220      }
43221      if (element.hasClassifier()) {
43222        openArray("classifier");
43223        for (CodeableConcept e : element.getClassifier()) 
43224          composeCodeableConcept(null, e);
43225        closeArray();
43226      };
43227      if (element.hasLabelElement()) {
43228        composeStringCore("label", element.getLabelElement(), false);
43229        composeStringExtras("label", element.getLabelElement(), false);
43230      }
43231      if (element.hasDisplayElement()) {
43232        composeStringCore("display", element.getDisplayElement(), false);
43233        composeStringExtras("display", element.getDisplayElement(), false);
43234      }
43235      if (element.hasCitationElement()) {
43236        composeMarkdownCore("citation", element.getCitationElement(), false);
43237        composeMarkdownExtras("citation", element.getCitationElement(), false);
43238      }
43239      if (element.hasDocument()) {
43240        composeAttachment("document", element.getDocument());
43241      }
43242      if (element.hasResourceElement()) {
43243        composeCanonicalCore("resource", element.getResourceElement(), false);
43244        composeCanonicalExtras("resource", element.getResourceElement(), false);
43245      }
43246      if (element.hasResourceReference()) {
43247        composeReference("resourceReference", element.getResourceReference());
43248      }
43249  }
43250
43251  protected void composeCitationCitedArtifactPublicationFormComponent(String name, Citation.CitationCitedArtifactPublicationFormComponent element) throws IOException {
43252    if (element != null) {
43253      open(name);
43254      composeCitationCitedArtifactPublicationFormComponentProperties(element);
43255      close();
43256    }
43257  }
43258
43259  protected void composeCitationCitedArtifactPublicationFormComponentProperties(Citation.CitationCitedArtifactPublicationFormComponent element) throws IOException {
43260    composeBackboneElementProperties(element);
43261      if (element.hasPublishedIn()) {
43262        composeCitationCitedArtifactPublicationFormPublishedInComponent("publishedIn", element.getPublishedIn());
43263      }
43264      if (element.hasCitedMedium()) {
43265        composeCodeableConcept("citedMedium", element.getCitedMedium());
43266      }
43267      if (element.hasVolumeElement()) {
43268        composeStringCore("volume", element.getVolumeElement(), false);
43269        composeStringExtras("volume", element.getVolumeElement(), false);
43270      }
43271      if (element.hasIssueElement()) {
43272        composeStringCore("issue", element.getIssueElement(), false);
43273        composeStringExtras("issue", element.getIssueElement(), false);
43274      }
43275      if (element.hasArticleDateElement()) {
43276        composeDateTimeCore("articleDate", element.getArticleDateElement(), false);
43277        composeDateTimeExtras("articleDate", element.getArticleDateElement(), false);
43278      }
43279      if (element.hasPublicationDateTextElement()) {
43280        composeStringCore("publicationDateText", element.getPublicationDateTextElement(), false);
43281        composeStringExtras("publicationDateText", element.getPublicationDateTextElement(), false);
43282      }
43283      if (element.hasPublicationDateSeasonElement()) {
43284        composeStringCore("publicationDateSeason", element.getPublicationDateSeasonElement(), false);
43285        composeStringExtras("publicationDateSeason", element.getPublicationDateSeasonElement(), false);
43286      }
43287      if (element.hasLastRevisionDateElement()) {
43288        composeDateTimeCore("lastRevisionDate", element.getLastRevisionDateElement(), false);
43289        composeDateTimeExtras("lastRevisionDate", element.getLastRevisionDateElement(), false);
43290      }
43291      if (element.hasLanguage()) {
43292        openArray("language");
43293        for (CodeableConcept e : element.getLanguage()) 
43294          composeCodeableConcept(null, e);
43295        closeArray();
43296      };
43297      if (element.hasAccessionNumberElement()) {
43298        composeStringCore("accessionNumber", element.getAccessionNumberElement(), false);
43299        composeStringExtras("accessionNumber", element.getAccessionNumberElement(), false);
43300      }
43301      if (element.hasPageStringElement()) {
43302        composeStringCore("pageString", element.getPageStringElement(), false);
43303        composeStringExtras("pageString", element.getPageStringElement(), false);
43304      }
43305      if (element.hasFirstPageElement()) {
43306        composeStringCore("firstPage", element.getFirstPageElement(), false);
43307        composeStringExtras("firstPage", element.getFirstPageElement(), false);
43308      }
43309      if (element.hasLastPageElement()) {
43310        composeStringCore("lastPage", element.getLastPageElement(), false);
43311        composeStringExtras("lastPage", element.getLastPageElement(), false);
43312      }
43313      if (element.hasPageCountElement()) {
43314        composeStringCore("pageCount", element.getPageCountElement(), false);
43315        composeStringExtras("pageCount", element.getPageCountElement(), false);
43316      }
43317      if (element.hasCopyrightElement()) {
43318        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43319        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43320      }
43321  }
43322
43323  protected void composeCitationCitedArtifactPublicationFormPublishedInComponent(String name, Citation.CitationCitedArtifactPublicationFormPublishedInComponent element) throws IOException {
43324    if (element != null) {
43325      open(name);
43326      composeCitationCitedArtifactPublicationFormPublishedInComponentProperties(element);
43327      close();
43328    }
43329  }
43330
43331  protected void composeCitationCitedArtifactPublicationFormPublishedInComponentProperties(Citation.CitationCitedArtifactPublicationFormPublishedInComponent element) throws IOException {
43332    composeBackboneElementProperties(element);
43333      if (element.hasType()) {
43334        composeCodeableConcept("type", element.getType());
43335      }
43336      if (element.hasIdentifier()) {
43337        openArray("identifier");
43338        for (Identifier e : element.getIdentifier()) 
43339          composeIdentifier(null, e);
43340        closeArray();
43341      };
43342      if (element.hasTitleElement()) {
43343        composeStringCore("title", element.getTitleElement(), false);
43344        composeStringExtras("title", element.getTitleElement(), false);
43345      }
43346      if (element.hasPublisher()) {
43347        composeReference("publisher", element.getPublisher());
43348      }
43349      if (element.hasPublisherLocationElement()) {
43350        composeStringCore("publisherLocation", element.getPublisherLocationElement(), false);
43351        composeStringExtras("publisherLocation", element.getPublisherLocationElement(), false);
43352      }
43353  }
43354
43355  protected void composeCitationCitedArtifactWebLocationComponent(String name, Citation.CitationCitedArtifactWebLocationComponent element) throws IOException {
43356    if (element != null) {
43357      open(name);
43358      composeCitationCitedArtifactWebLocationComponentProperties(element);
43359      close();
43360    }
43361  }
43362
43363  protected void composeCitationCitedArtifactWebLocationComponentProperties(Citation.CitationCitedArtifactWebLocationComponent element) throws IOException {
43364    composeBackboneElementProperties(element);
43365      if (element.hasClassifier()) {
43366        openArray("classifier");
43367        for (CodeableConcept e : element.getClassifier()) 
43368          composeCodeableConcept(null, e);
43369        closeArray();
43370      };
43371      if (element.hasUrlElement()) {
43372        composeUriCore("url", element.getUrlElement(), false);
43373        composeUriExtras("url", element.getUrlElement(), false);
43374      }
43375  }
43376
43377  protected void composeCitationCitedArtifactClassificationComponent(String name, Citation.CitationCitedArtifactClassificationComponent element) throws IOException {
43378    if (element != null) {
43379      open(name);
43380      composeCitationCitedArtifactClassificationComponentProperties(element);
43381      close();
43382    }
43383  }
43384
43385  protected void composeCitationCitedArtifactClassificationComponentProperties(Citation.CitationCitedArtifactClassificationComponent element) throws IOException {
43386    composeBackboneElementProperties(element);
43387      if (element.hasType()) {
43388        composeCodeableConcept("type", element.getType());
43389      }
43390      if (element.hasClassifier()) {
43391        openArray("classifier");
43392        for (CodeableConcept e : element.getClassifier()) 
43393          composeCodeableConcept(null, e);
43394        closeArray();
43395      };
43396      if (element.hasArtifactAssessment()) {
43397        openArray("artifactAssessment");
43398        for (Reference e : element.getArtifactAssessment()) 
43399          composeReference(null, e);
43400        closeArray();
43401      };
43402  }
43403
43404  protected void composeCitationCitedArtifactContributorshipComponent(String name, Citation.CitationCitedArtifactContributorshipComponent element) throws IOException {
43405    if (element != null) {
43406      open(name);
43407      composeCitationCitedArtifactContributorshipComponentProperties(element);
43408      close();
43409    }
43410  }
43411
43412  protected void composeCitationCitedArtifactContributorshipComponentProperties(Citation.CitationCitedArtifactContributorshipComponent element) throws IOException {
43413    composeBackboneElementProperties(element);
43414      if (element.hasCompleteElement()) {
43415        composeBooleanCore("complete", element.getCompleteElement(), false);
43416        composeBooleanExtras("complete", element.getCompleteElement(), false);
43417      }
43418      if (element.hasEntry()) {
43419        openArray("entry");
43420        for (Citation.CitationCitedArtifactContributorshipEntryComponent e : element.getEntry()) 
43421          composeCitationCitedArtifactContributorshipEntryComponent(null, e);
43422        closeArray();
43423      };
43424      if (element.hasSummary()) {
43425        openArray("summary");
43426        for (Citation.ContributorshipSummaryComponent e : element.getSummary()) 
43427          composeContributorshipSummaryComponent(null, e);
43428        closeArray();
43429      };
43430  }
43431
43432  protected void composeCitationCitedArtifactContributorshipEntryComponent(String name, Citation.CitationCitedArtifactContributorshipEntryComponent element) throws IOException {
43433    if (element != null) {
43434      open(name);
43435      composeCitationCitedArtifactContributorshipEntryComponentProperties(element);
43436      close();
43437    }
43438  }
43439
43440  protected void composeCitationCitedArtifactContributorshipEntryComponentProperties(Citation.CitationCitedArtifactContributorshipEntryComponent element) throws IOException {
43441    composeBackboneElementProperties(element);
43442      if (element.hasContributor()) {
43443        composeReference("contributor", element.getContributor());
43444      }
43445      if (element.hasForenameInitialsElement()) {
43446        composeStringCore("forenameInitials", element.getForenameInitialsElement(), false);
43447        composeStringExtras("forenameInitials", element.getForenameInitialsElement(), false);
43448      }
43449      if (element.hasAffiliation()) {
43450        openArray("affiliation");
43451        for (Reference e : element.getAffiliation()) 
43452          composeReference(null, e);
43453        closeArray();
43454      };
43455      if (element.hasContributionType()) {
43456        openArray("contributionType");
43457        for (CodeableConcept e : element.getContributionType()) 
43458          composeCodeableConcept(null, e);
43459        closeArray();
43460      };
43461      if (element.hasRole()) {
43462        composeCodeableConcept("role", element.getRole());
43463      }
43464      if (element.hasContributionInstance()) {
43465        openArray("contributionInstance");
43466        for (Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent e : element.getContributionInstance()) 
43467          composeCitationCitedArtifactContributorshipEntryContributionInstanceComponent(null, e);
43468        closeArray();
43469      };
43470      if (element.hasCorrespondingContactElement()) {
43471        composeBooleanCore("correspondingContact", element.getCorrespondingContactElement(), false);
43472        composeBooleanExtras("correspondingContact", element.getCorrespondingContactElement(), false);
43473      }
43474      if (element.hasRankingOrderElement()) {
43475        composePositiveIntCore("rankingOrder", element.getRankingOrderElement(), false);
43476        composePositiveIntExtras("rankingOrder", element.getRankingOrderElement(), false);
43477      }
43478  }
43479
43480  protected void composeCitationCitedArtifactContributorshipEntryContributionInstanceComponent(String name, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent element) throws IOException {
43481    if (element != null) {
43482      open(name);
43483      composeCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(element);
43484      close();
43485    }
43486  }
43487
43488  protected void composeCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent element) throws IOException {
43489    composeBackboneElementProperties(element);
43490      if (element.hasType()) {
43491        composeCodeableConcept("type", element.getType());
43492      }
43493      if (element.hasTimeElement()) {
43494        composeDateTimeCore("time", element.getTimeElement(), false);
43495        composeDateTimeExtras("time", element.getTimeElement(), false);
43496      }
43497  }
43498
43499  protected void composeContributorshipSummaryComponent(String name, Citation.ContributorshipSummaryComponent element) throws IOException {
43500    if (element != null) {
43501      open(name);
43502      composeContributorshipSummaryComponentProperties(element);
43503      close();
43504    }
43505  }
43506
43507  protected void composeContributorshipSummaryComponentProperties(Citation.ContributorshipSummaryComponent element) throws IOException {
43508    composeBackboneElementProperties(element);
43509      if (element.hasType()) {
43510        composeCodeableConcept("type", element.getType());
43511      }
43512      if (element.hasStyle()) {
43513        composeCodeableConcept("style", element.getStyle());
43514      }
43515      if (element.hasSource()) {
43516        composeCodeableConcept("source", element.getSource());
43517      }
43518      if (element.hasValueElement()) {
43519        composeMarkdownCore("value", element.getValueElement(), false);
43520        composeMarkdownExtras("value", element.getValueElement(), false);
43521      }
43522  }
43523
43524  protected void composeClaim(String name, Claim element) throws IOException {
43525    if (element != null) {
43526      prop("resourceType", name);
43527      composeClaimProperties(element);
43528    }
43529  }
43530
43531  protected void composeClaimProperties(Claim element) throws IOException {
43532    composeDomainResourceProperties(element);
43533      if (element.hasIdentifier()) {
43534        openArray("identifier");
43535        for (Identifier e : element.getIdentifier()) 
43536          composeIdentifier(null, e);
43537        closeArray();
43538      };
43539      if (element.hasTraceNumber()) {
43540        openArray("traceNumber");
43541        for (Identifier e : element.getTraceNumber()) 
43542          composeIdentifier(null, e);
43543        closeArray();
43544      };
43545      if (element.hasStatusElement()) {
43546        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
43547        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
43548      }
43549      if (element.hasType()) {
43550        composeCodeableConcept("type", element.getType());
43551      }
43552      if (element.hasSubType()) {
43553        composeCodeableConcept("subType", element.getSubType());
43554      }
43555      if (element.hasUseElement()) {
43556        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43557        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43558      }
43559      if (element.hasPatient()) {
43560        composeReference("patient", element.getPatient());
43561      }
43562      if (element.hasBillablePeriod()) {
43563        composePeriod("billablePeriod", element.getBillablePeriod());
43564      }
43565      if (element.hasCreatedElement()) {
43566        composeDateTimeCore("created", element.getCreatedElement(), false);
43567        composeDateTimeExtras("created", element.getCreatedElement(), false);
43568      }
43569      if (element.hasEnterer()) {
43570        composeReference("enterer", element.getEnterer());
43571      }
43572      if (element.hasInsurer()) {
43573        composeReference("insurer", element.getInsurer());
43574      }
43575      if (element.hasProvider()) {
43576        composeReference("provider", element.getProvider());
43577      }
43578      if (element.hasPriority()) {
43579        composeCodeableConcept("priority", element.getPriority());
43580      }
43581      if (element.hasFundsReserve()) {
43582        composeCodeableConcept("fundsReserve", element.getFundsReserve());
43583      }
43584      if (element.hasRelated()) {
43585        openArray("related");
43586        for (Claim.RelatedClaimComponent e : element.getRelated()) 
43587          composeRelatedClaimComponent(null, e);
43588        closeArray();
43589      };
43590      if (element.hasPrescription()) {
43591        composeReference("prescription", element.getPrescription());
43592      }
43593      if (element.hasOriginalPrescription()) {
43594        composeReference("originalPrescription", element.getOriginalPrescription());
43595      }
43596      if (element.hasPayee()) {
43597        composePayeeComponent("payee", element.getPayee());
43598      }
43599      if (element.hasReferral()) {
43600        composeReference("referral", element.getReferral());
43601      }
43602      if (element.hasEncounter()) {
43603        openArray("encounter");
43604        for (Reference e : element.getEncounter()) 
43605          composeReference(null, e);
43606        closeArray();
43607      };
43608      if (element.hasFacility()) {
43609        composeReference("facility", element.getFacility());
43610      }
43611      if (element.hasDiagnosisRelatedGroup()) {
43612        composeCodeableConcept("diagnosisRelatedGroup", element.getDiagnosisRelatedGroup());
43613      }
43614      if (element.hasEvent()) {
43615        openArray("event");
43616        for (Claim.ClaimEventComponent e : element.getEvent()) 
43617          composeClaimEventComponent(null, e);
43618        closeArray();
43619      };
43620      if (element.hasCareTeam()) {
43621        openArray("careTeam");
43622        for (Claim.CareTeamComponent e : element.getCareTeam()) 
43623          composeCareTeamComponent(null, e);
43624        closeArray();
43625      };
43626      if (element.hasSupportingInfo()) {
43627        openArray("supportingInfo");
43628        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
43629          composeSupportingInformationComponent(null, e);
43630        closeArray();
43631      };
43632      if (element.hasDiagnosis()) {
43633        openArray("diagnosis");
43634        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
43635          composeDiagnosisComponent(null, e);
43636        closeArray();
43637      };
43638      if (element.hasProcedure()) {
43639        openArray("procedure");
43640        for (Claim.ProcedureComponent e : element.getProcedure()) 
43641          composeProcedureComponent(null, e);
43642        closeArray();
43643      };
43644      if (element.hasInsurance()) {
43645        openArray("insurance");
43646        for (Claim.InsuranceComponent e : element.getInsurance()) 
43647          composeInsuranceComponent(null, e);
43648        closeArray();
43649      };
43650      if (element.hasAccident()) {
43651        composeAccidentComponent("accident", element.getAccident());
43652      }
43653      if (element.hasPatientPaid()) {
43654        composeMoney("patientPaid", element.getPatientPaid());
43655      }
43656      if (element.hasItem()) {
43657        openArray("item");
43658        for (Claim.ItemComponent e : element.getItem()) 
43659          composeItemComponent(null, e);
43660        closeArray();
43661      };
43662      if (element.hasTotal()) {
43663        composeMoney("total", element.getTotal());
43664      }
43665  }
43666
43667  protected void composeRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
43668    if (element != null) {
43669      open(name);
43670      composeRelatedClaimComponentProperties(element);
43671      close();
43672    }
43673  }
43674
43675  protected void composeRelatedClaimComponentProperties(Claim.RelatedClaimComponent element) throws IOException {
43676    composeBackboneElementProperties(element);
43677      if (element.hasClaim()) {
43678        composeReference("claim", element.getClaim());
43679      }
43680      if (element.hasRelationship()) {
43681        composeCodeableConcept("relationship", element.getRelationship());
43682      }
43683      if (element.hasReference()) {
43684        composeIdentifier("reference", element.getReference());
43685      }
43686  }
43687
43688  protected void composePayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
43689    if (element != null) {
43690      open(name);
43691      composePayeeComponentProperties(element);
43692      close();
43693    }
43694  }
43695
43696  protected void composePayeeComponentProperties(Claim.PayeeComponent element) throws IOException {
43697    composeBackboneElementProperties(element);
43698      if (element.hasType()) {
43699        composeCodeableConcept("type", element.getType());
43700      }
43701      if (element.hasParty()) {
43702        composeReference("party", element.getParty());
43703      }
43704  }
43705
43706  protected void composeClaimEventComponent(String name, Claim.ClaimEventComponent element) throws IOException {
43707    if (element != null) {
43708      open(name);
43709      composeClaimEventComponentProperties(element);
43710      close();
43711    }
43712  }
43713
43714  protected void composeClaimEventComponentProperties(Claim.ClaimEventComponent element) throws IOException {
43715    composeBackboneElementProperties(element);
43716      if (element.hasType()) {
43717        composeCodeableConcept("type", element.getType());
43718      }
43719      if (element.hasWhen()) {
43720        composeType("when", element.getWhen());
43721      }
43722  }
43723
43724  protected void composeCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
43725    if (element != null) {
43726      open(name);
43727      composeCareTeamComponentProperties(element);
43728      close();
43729    }
43730  }
43731
43732  protected void composeCareTeamComponentProperties(Claim.CareTeamComponent element) throws IOException {
43733    composeBackboneElementProperties(element);
43734      if (element.hasSequenceElement()) {
43735        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43736        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43737      }
43738      if (element.hasProvider()) {
43739        composeReference("provider", element.getProvider());
43740      }
43741      if (element.hasResponsibleElement()) {
43742        composeBooleanCore("responsible", element.getResponsibleElement(), false);
43743        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
43744      }
43745      if (element.hasRole()) {
43746        composeCodeableConcept("role", element.getRole());
43747      }
43748      if (element.hasSpecialty()) {
43749        composeCodeableConcept("specialty", element.getSpecialty());
43750      }
43751  }
43752
43753  protected void composeSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
43754    if (element != null) {
43755      open(name);
43756      composeSupportingInformationComponentProperties(element);
43757      close();
43758    }
43759  }
43760
43761  protected void composeSupportingInformationComponentProperties(Claim.SupportingInformationComponent element) throws IOException {
43762    composeBackboneElementProperties(element);
43763      if (element.hasSequenceElement()) {
43764        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43765        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43766      }
43767      if (element.hasCategory()) {
43768        composeCodeableConcept("category", element.getCategory());
43769      }
43770      if (element.hasCode()) {
43771        composeCodeableConcept("code", element.getCode());
43772      }
43773      if (element.hasTiming()) {
43774        composeType("timing", element.getTiming());
43775      }
43776      if (element.hasValue()) {
43777        composeType("value", element.getValue());
43778      }
43779      if (element.hasReason()) {
43780        composeCodeableConcept("reason", element.getReason());
43781      }
43782  }
43783
43784  protected void composeDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
43785    if (element != null) {
43786      open(name);
43787      composeDiagnosisComponentProperties(element);
43788      close();
43789    }
43790  }
43791
43792  protected void composeDiagnosisComponentProperties(Claim.DiagnosisComponent element) throws IOException {
43793    composeBackboneElementProperties(element);
43794      if (element.hasSequenceElement()) {
43795        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43796        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43797      }
43798      if (element.hasDiagnosis()) {
43799        composeType("diagnosis", element.getDiagnosis());
43800      }
43801      if (element.hasType()) {
43802        openArray("type");
43803        for (CodeableConcept e : element.getType()) 
43804          composeCodeableConcept(null, e);
43805        closeArray();
43806      };
43807      if (element.hasOnAdmission()) {
43808        composeCodeableConcept("onAdmission", element.getOnAdmission());
43809      }
43810  }
43811
43812  protected void composeProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
43813    if (element != null) {
43814      open(name);
43815      composeProcedureComponentProperties(element);
43816      close();
43817    }
43818  }
43819
43820  protected void composeProcedureComponentProperties(Claim.ProcedureComponent element) throws IOException {
43821    composeBackboneElementProperties(element);
43822      if (element.hasSequenceElement()) {
43823        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43824        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43825      }
43826      if (element.hasType()) {
43827        openArray("type");
43828        for (CodeableConcept e : element.getType()) 
43829          composeCodeableConcept(null, e);
43830        closeArray();
43831      };
43832      if (element.hasDateElement()) {
43833        composeDateTimeCore("date", element.getDateElement(), false);
43834        composeDateTimeExtras("date", element.getDateElement(), false);
43835      }
43836      if (element.hasProcedure()) {
43837        composeType("procedure", element.getProcedure());
43838      }
43839      if (element.hasUdi()) {
43840        openArray("udi");
43841        for (Reference e : element.getUdi()) 
43842          composeReference(null, e);
43843        closeArray();
43844      };
43845  }
43846
43847  protected void composeInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
43848    if (element != null) {
43849      open(name);
43850      composeInsuranceComponentProperties(element);
43851      close();
43852    }
43853  }
43854
43855  protected void composeInsuranceComponentProperties(Claim.InsuranceComponent element) throws IOException {
43856    composeBackboneElementProperties(element);
43857      if (element.hasSequenceElement()) {
43858        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43859        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43860      }
43861      if (element.hasFocalElement()) {
43862        composeBooleanCore("focal", element.getFocalElement(), false);
43863        composeBooleanExtras("focal", element.getFocalElement(), false);
43864      }
43865      if (element.hasIdentifier()) {
43866        composeIdentifier("identifier", element.getIdentifier());
43867      }
43868      if (element.hasCoverage()) {
43869        composeReference("coverage", element.getCoverage());
43870      }
43871      if (element.hasBusinessArrangementElement()) {
43872        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
43873        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
43874      }
43875      if (element.hasPreAuthRef()) {
43876        if (anyHasValue(element.getPreAuthRef())) {
43877          openArray("preAuthRef");
43878          for (StringType e : element.getPreAuthRef()) 
43879            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
43880          closeArray();
43881        }
43882        if (anyHasExtras(element.getPreAuthRef())) {
43883          openArray("_preAuthRef");
43884          for (StringType e : element.getPreAuthRef()) 
43885            composeStringExtras(null, e, true);
43886          closeArray();
43887        }
43888      };
43889      if (element.hasClaimResponse()) {
43890        composeReference("claimResponse", element.getClaimResponse());
43891      }
43892  }
43893
43894  protected void composeAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
43895    if (element != null) {
43896      open(name);
43897      composeAccidentComponentProperties(element);
43898      close();
43899    }
43900  }
43901
43902  protected void composeAccidentComponentProperties(Claim.AccidentComponent element) throws IOException {
43903    composeBackboneElementProperties(element);
43904      if (element.hasDateElement()) {
43905        composeDateCore("date", element.getDateElement(), false);
43906        composeDateExtras("date", element.getDateElement(), false);
43907      }
43908      if (element.hasType()) {
43909        composeCodeableConcept("type", element.getType());
43910      }
43911      if (element.hasLocation()) {
43912        composeType("location", element.getLocation());
43913      }
43914  }
43915
43916  protected void composeItemComponent(String name, Claim.ItemComponent element) throws IOException {
43917    if (element != null) {
43918      open(name);
43919      composeItemComponentProperties(element);
43920      close();
43921    }
43922  }
43923
43924  protected void composeItemComponentProperties(Claim.ItemComponent element) throws IOException {
43925    composeBackboneElementProperties(element);
43926      if (element.hasSequenceElement()) {
43927        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43928        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43929      }
43930      if (element.hasTraceNumber()) {
43931        openArray("traceNumber");
43932        for (Identifier e : element.getTraceNumber()) 
43933          composeIdentifier(null, e);
43934        closeArray();
43935      };
43936      if (element.hasCareTeamSequence()) {
43937        if (anyHasValue(element.getCareTeamSequence())) {
43938          openArray("careTeamSequence");
43939          for (PositiveIntType e : element.getCareTeamSequence()) 
43940            composePositiveIntCore(null, e, e != element.getCareTeamSequence().get(element.getCareTeamSequence().size()-1));
43941          closeArray();
43942        }
43943        if (anyHasExtras(element.getCareTeamSequence())) {
43944          openArray("_careTeamSequence");
43945          for (PositiveIntType e : element.getCareTeamSequence()) 
43946            composePositiveIntExtras(null, e, true);
43947          closeArray();
43948        }
43949      };
43950      if (element.hasDiagnosisSequence()) {
43951        if (anyHasValue(element.getDiagnosisSequence())) {
43952          openArray("diagnosisSequence");
43953          for (PositiveIntType e : element.getDiagnosisSequence()) 
43954            composePositiveIntCore(null, e, e != element.getDiagnosisSequence().get(element.getDiagnosisSequence().size()-1));
43955          closeArray();
43956        }
43957        if (anyHasExtras(element.getDiagnosisSequence())) {
43958          openArray("_diagnosisSequence");
43959          for (PositiveIntType e : element.getDiagnosisSequence()) 
43960            composePositiveIntExtras(null, e, true);
43961          closeArray();
43962        }
43963      };
43964      if (element.hasProcedureSequence()) {
43965        if (anyHasValue(element.getProcedureSequence())) {
43966          openArray("procedureSequence");
43967          for (PositiveIntType e : element.getProcedureSequence()) 
43968            composePositiveIntCore(null, e, e != element.getProcedureSequence().get(element.getProcedureSequence().size()-1));
43969          closeArray();
43970        }
43971        if (anyHasExtras(element.getProcedureSequence())) {
43972          openArray("_procedureSequence");
43973          for (PositiveIntType e : element.getProcedureSequence()) 
43974            composePositiveIntExtras(null, e, true);
43975          closeArray();
43976        }
43977      };
43978      if (element.hasInformationSequence()) {
43979        if (anyHasValue(element.getInformationSequence())) {
43980          openArray("informationSequence");
43981          for (PositiveIntType e : element.getInformationSequence()) 
43982            composePositiveIntCore(null, e, e != element.getInformationSequence().get(element.getInformationSequence().size()-1));
43983          closeArray();
43984        }
43985        if (anyHasExtras(element.getInformationSequence())) {
43986          openArray("_informationSequence");
43987          for (PositiveIntType e : element.getInformationSequence()) 
43988            composePositiveIntExtras(null, e, true);
43989          closeArray();
43990        }
43991      };
43992      if (element.hasRevenue()) {
43993        composeCodeableConcept("revenue", element.getRevenue());
43994      }
43995      if (element.hasCategory()) {
43996        composeCodeableConcept("category", element.getCategory());
43997      }
43998      if (element.hasProductOrService()) {
43999        composeCodeableConcept("productOrService", element.getProductOrService());
44000      }
44001      if (element.hasProductOrServiceEnd()) {
44002        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44003      }
44004      if (element.hasRequest()) {
44005        openArray("request");
44006        for (Reference e : element.getRequest()) 
44007          composeReference(null, e);
44008        closeArray();
44009      };
44010      if (element.hasModifier()) {
44011        openArray("modifier");
44012        for (CodeableConcept e : element.getModifier()) 
44013          composeCodeableConcept(null, e);
44014        closeArray();
44015      };
44016      if (element.hasProgramCode()) {
44017        openArray("programCode");
44018        for (CodeableConcept e : element.getProgramCode()) 
44019          composeCodeableConcept(null, e);
44020        closeArray();
44021      };
44022      if (element.hasServiced()) {
44023        composeType("serviced", element.getServiced());
44024      }
44025      if (element.hasLocation()) {
44026        composeType("location", element.getLocation());
44027      }
44028      if (element.hasPatientPaid()) {
44029        composeMoney("patientPaid", element.getPatientPaid());
44030      }
44031      if (element.hasQuantity()) {
44032        composeQuantity("quantity", element.getQuantity());
44033      }
44034      if (element.hasUnitPrice()) {
44035        composeMoney("unitPrice", element.getUnitPrice());
44036      }
44037      if (element.hasFactorElement()) {
44038        composeDecimalCore("factor", element.getFactorElement(), false);
44039        composeDecimalExtras("factor", element.getFactorElement(), false);
44040      }
44041      if (element.hasTax()) {
44042        composeMoney("tax", element.getTax());
44043      }
44044      if (element.hasNet()) {
44045        composeMoney("net", element.getNet());
44046      }
44047      if (element.hasUdi()) {
44048        openArray("udi");
44049        for (Reference e : element.getUdi()) 
44050          composeReference(null, e);
44051        closeArray();
44052      };
44053      if (element.hasBodySite()) {
44054        openArray("bodySite");
44055        for (Claim.BodySiteComponent e : element.getBodySite()) 
44056          composeBodySiteComponent(null, e);
44057        closeArray();
44058      };
44059      if (element.hasEncounter()) {
44060        openArray("encounter");
44061        for (Reference e : element.getEncounter()) 
44062          composeReference(null, e);
44063        closeArray();
44064      };
44065      if (element.hasDetail()) {
44066        openArray("detail");
44067        for (Claim.DetailComponent e : element.getDetail()) 
44068          composeDetailComponent(null, e);
44069        closeArray();
44070      };
44071  }
44072
44073  protected void composeBodySiteComponent(String name, Claim.BodySiteComponent element) throws IOException {
44074    if (element != null) {
44075      open(name);
44076      composeBodySiteComponentProperties(element);
44077      close();
44078    }
44079  }
44080
44081  protected void composeBodySiteComponentProperties(Claim.BodySiteComponent element) throws IOException {
44082    composeBackboneElementProperties(element);
44083      if (element.hasSite()) {
44084        openArray("site");
44085        for (CodeableReference e : element.getSite()) 
44086          composeCodeableReference(null, e);
44087        closeArray();
44088      };
44089      if (element.hasSubSite()) {
44090        openArray("subSite");
44091        for (CodeableConcept e : element.getSubSite()) 
44092          composeCodeableConcept(null, e);
44093        closeArray();
44094      };
44095  }
44096
44097  protected void composeDetailComponent(String name, Claim.DetailComponent element) throws IOException {
44098    if (element != null) {
44099      open(name);
44100      composeDetailComponentProperties(element);
44101      close();
44102    }
44103  }
44104
44105  protected void composeDetailComponentProperties(Claim.DetailComponent element) throws IOException {
44106    composeBackboneElementProperties(element);
44107      if (element.hasSequenceElement()) {
44108        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44109        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44110      }
44111      if (element.hasTraceNumber()) {
44112        openArray("traceNumber");
44113        for (Identifier e : element.getTraceNumber()) 
44114          composeIdentifier(null, e);
44115        closeArray();
44116      };
44117      if (element.hasRevenue()) {
44118        composeCodeableConcept("revenue", element.getRevenue());
44119      }
44120      if (element.hasCategory()) {
44121        composeCodeableConcept("category", element.getCategory());
44122      }
44123      if (element.hasProductOrService()) {
44124        composeCodeableConcept("productOrService", element.getProductOrService());
44125      }
44126      if (element.hasProductOrServiceEnd()) {
44127        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44128      }
44129      if (element.hasModifier()) {
44130        openArray("modifier");
44131        for (CodeableConcept e : element.getModifier()) 
44132          composeCodeableConcept(null, e);
44133        closeArray();
44134      };
44135      if (element.hasProgramCode()) {
44136        openArray("programCode");
44137        for (CodeableConcept e : element.getProgramCode()) 
44138          composeCodeableConcept(null, e);
44139        closeArray();
44140      };
44141      if (element.hasPatientPaid()) {
44142        composeMoney("patientPaid", element.getPatientPaid());
44143      }
44144      if (element.hasQuantity()) {
44145        composeQuantity("quantity", element.getQuantity());
44146      }
44147      if (element.hasUnitPrice()) {
44148        composeMoney("unitPrice", element.getUnitPrice());
44149      }
44150      if (element.hasFactorElement()) {
44151        composeDecimalCore("factor", element.getFactorElement(), false);
44152        composeDecimalExtras("factor", element.getFactorElement(), false);
44153      }
44154      if (element.hasTax()) {
44155        composeMoney("tax", element.getTax());
44156      }
44157      if (element.hasNet()) {
44158        composeMoney("net", element.getNet());
44159      }
44160      if (element.hasUdi()) {
44161        openArray("udi");
44162        for (Reference e : element.getUdi()) 
44163          composeReference(null, e);
44164        closeArray();
44165      };
44166      if (element.hasSubDetail()) {
44167        openArray("subDetail");
44168        for (Claim.SubDetailComponent e : element.getSubDetail()) 
44169          composeSubDetailComponent(null, e);
44170        closeArray();
44171      };
44172  }
44173
44174  protected void composeSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
44175    if (element != null) {
44176      open(name);
44177      composeSubDetailComponentProperties(element);
44178      close();
44179    }
44180  }
44181
44182  protected void composeSubDetailComponentProperties(Claim.SubDetailComponent element) throws IOException {
44183    composeBackboneElementProperties(element);
44184      if (element.hasSequenceElement()) {
44185        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44186        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44187      }
44188      if (element.hasTraceNumber()) {
44189        openArray("traceNumber");
44190        for (Identifier e : element.getTraceNumber()) 
44191          composeIdentifier(null, e);
44192        closeArray();
44193      };
44194      if (element.hasRevenue()) {
44195        composeCodeableConcept("revenue", element.getRevenue());
44196      }
44197      if (element.hasCategory()) {
44198        composeCodeableConcept("category", element.getCategory());
44199      }
44200      if (element.hasProductOrService()) {
44201        composeCodeableConcept("productOrService", element.getProductOrService());
44202      }
44203      if (element.hasProductOrServiceEnd()) {
44204        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44205      }
44206      if (element.hasModifier()) {
44207        openArray("modifier");
44208        for (CodeableConcept e : element.getModifier()) 
44209          composeCodeableConcept(null, e);
44210        closeArray();
44211      };
44212      if (element.hasProgramCode()) {
44213        openArray("programCode");
44214        for (CodeableConcept e : element.getProgramCode()) 
44215          composeCodeableConcept(null, e);
44216        closeArray();
44217      };
44218      if (element.hasPatientPaid()) {
44219        composeMoney("patientPaid", element.getPatientPaid());
44220      }
44221      if (element.hasQuantity()) {
44222        composeQuantity("quantity", element.getQuantity());
44223      }
44224      if (element.hasUnitPrice()) {
44225        composeMoney("unitPrice", element.getUnitPrice());
44226      }
44227      if (element.hasFactorElement()) {
44228        composeDecimalCore("factor", element.getFactorElement(), false);
44229        composeDecimalExtras("factor", element.getFactorElement(), false);
44230      }
44231      if (element.hasTax()) {
44232        composeMoney("tax", element.getTax());
44233      }
44234      if (element.hasNet()) {
44235        composeMoney("net", element.getNet());
44236      }
44237      if (element.hasUdi()) {
44238        openArray("udi");
44239        for (Reference e : element.getUdi()) 
44240          composeReference(null, e);
44241        closeArray();
44242      };
44243  }
44244
44245  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
44246    if (element != null) {
44247      prop("resourceType", name);
44248      composeClaimResponseProperties(element);
44249    }
44250  }
44251
44252  protected void composeClaimResponseProperties(ClaimResponse element) throws IOException {
44253    composeDomainResourceProperties(element);
44254      if (element.hasIdentifier()) {
44255        openArray("identifier");
44256        for (Identifier e : element.getIdentifier()) 
44257          composeIdentifier(null, e);
44258        closeArray();
44259      };
44260      if (element.hasTraceNumber()) {
44261        openArray("traceNumber");
44262        for (Identifier e : element.getTraceNumber()) 
44263          composeIdentifier(null, e);
44264        closeArray();
44265      };
44266      if (element.hasStatusElement()) {
44267        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
44268        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
44269      }
44270      if (element.hasType()) {
44271        composeCodeableConcept("type", element.getType());
44272      }
44273      if (element.hasSubType()) {
44274        composeCodeableConcept("subType", element.getSubType());
44275      }
44276      if (element.hasUseElement()) {
44277        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
44278        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
44279      }
44280      if (element.hasPatient()) {
44281        composeReference("patient", element.getPatient());
44282      }
44283      if (element.hasCreatedElement()) {
44284        composeDateTimeCore("created", element.getCreatedElement(), false);
44285        composeDateTimeExtras("created", element.getCreatedElement(), false);
44286      }
44287      if (element.hasInsurer()) {
44288        composeReference("insurer", element.getInsurer());
44289      }
44290      if (element.hasRequestor()) {
44291        composeReference("requestor", element.getRequestor());
44292      }
44293      if (element.hasRequest()) {
44294        composeReference("request", element.getRequest());
44295      }
44296      if (element.hasOutcomeElement()) {
44297        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
44298        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
44299      }
44300      if (element.hasDecision()) {
44301        composeCodeableConcept("decision", element.getDecision());
44302      }
44303      if (element.hasDispositionElement()) {
44304        composeStringCore("disposition", element.getDispositionElement(), false);
44305        composeStringExtras("disposition", element.getDispositionElement(), false);
44306      }
44307      if (element.hasPreAuthRefElement()) {
44308        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
44309        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
44310      }
44311      if (element.hasPreAuthPeriod()) {
44312        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
44313      }
44314      if (element.hasEvent()) {
44315        openArray("event");
44316        for (ClaimResponse.ClaimResponseEventComponent e : element.getEvent()) 
44317          composeClaimResponseEventComponent(null, e);
44318        closeArray();
44319      };
44320      if (element.hasPayeeType()) {
44321        composeCodeableConcept("payeeType", element.getPayeeType());
44322      }
44323      if (element.hasEncounter()) {
44324        openArray("encounter");
44325        for (Reference e : element.getEncounter()) 
44326          composeReference(null, e);
44327        closeArray();
44328      };
44329      if (element.hasDiagnosisRelatedGroup()) {
44330        composeCodeableConcept("diagnosisRelatedGroup", element.getDiagnosisRelatedGroup());
44331      }
44332      if (element.hasItem()) {
44333        openArray("item");
44334        for (ClaimResponse.ItemComponent e : element.getItem()) 
44335          composeItemComponent(null, e);
44336        closeArray();
44337      };
44338      if (element.hasAddItem()) {
44339        openArray("addItem");
44340        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
44341          composeAddedItemComponent(null, e);
44342        closeArray();
44343      };
44344      if (element.hasAdjudication()) {
44345        openArray("adjudication");
44346        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44347          composeAdjudicationComponent(null, e);
44348        closeArray();
44349      };
44350      if (element.hasTotal()) {
44351        openArray("total");
44352        for (ClaimResponse.TotalComponent e : element.getTotal()) 
44353          composeTotalComponent(null, e);
44354        closeArray();
44355      };
44356      if (element.hasPayment()) {
44357        composePaymentComponent("payment", element.getPayment());
44358      }
44359      if (element.hasFundsReserve()) {
44360        composeCodeableConcept("fundsReserve", element.getFundsReserve());
44361      }
44362      if (element.hasFormCode()) {
44363        composeCodeableConcept("formCode", element.getFormCode());
44364      }
44365      if (element.hasForm()) {
44366        composeAttachment("form", element.getForm());
44367      }
44368      if (element.hasProcessNote()) {
44369        openArray("processNote");
44370        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
44371          composeNoteComponent(null, e);
44372        closeArray();
44373      };
44374      if (element.hasCommunicationRequest()) {
44375        openArray("communicationRequest");
44376        for (Reference e : element.getCommunicationRequest()) 
44377          composeReference(null, e);
44378        closeArray();
44379      };
44380      if (element.hasInsurance()) {
44381        openArray("insurance");
44382        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
44383          composeInsuranceComponent(null, e);
44384        closeArray();
44385      };
44386      if (element.hasError()) {
44387        openArray("error");
44388        for (ClaimResponse.ErrorComponent e : element.getError()) 
44389          composeErrorComponent(null, e);
44390        closeArray();
44391      };
44392  }
44393
44394  protected void composeClaimResponseEventComponent(String name, ClaimResponse.ClaimResponseEventComponent element) throws IOException {
44395    if (element != null) {
44396      open(name);
44397      composeClaimResponseEventComponentProperties(element);
44398      close();
44399    }
44400  }
44401
44402  protected void composeClaimResponseEventComponentProperties(ClaimResponse.ClaimResponseEventComponent element) throws IOException {
44403    composeBackboneElementProperties(element);
44404      if (element.hasType()) {
44405        composeCodeableConcept("type", element.getType());
44406      }
44407      if (element.hasWhen()) {
44408        composeType("when", element.getWhen());
44409      }
44410  }
44411
44412  protected void composeItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
44413    if (element != null) {
44414      open(name);
44415      composeItemComponentProperties(element);
44416      close();
44417    }
44418  }
44419
44420  protected void composeItemComponentProperties(ClaimResponse.ItemComponent element) throws IOException {
44421    composeBackboneElementProperties(element);
44422      if (element.hasItemSequenceElement()) {
44423        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
44424        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
44425      }
44426      if (element.hasTraceNumber()) {
44427        openArray("traceNumber");
44428        for (Identifier e : element.getTraceNumber()) 
44429          composeIdentifier(null, e);
44430        closeArray();
44431      };
44432      if (element.hasNoteNumber()) {
44433        if (anyHasValue(element.getNoteNumber())) {
44434          openArray("noteNumber");
44435          for (PositiveIntType e : element.getNoteNumber()) 
44436            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44437          closeArray();
44438        }
44439        if (anyHasExtras(element.getNoteNumber())) {
44440          openArray("_noteNumber");
44441          for (PositiveIntType e : element.getNoteNumber()) 
44442            composePositiveIntExtras(null, e, true);
44443          closeArray();
44444        }
44445      };
44446      if (element.hasReviewOutcome()) {
44447        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44448      }
44449      if (element.hasAdjudication()) {
44450        openArray("adjudication");
44451        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44452          composeAdjudicationComponent(null, e);
44453        closeArray();
44454      };
44455      if (element.hasDetail()) {
44456        openArray("detail");
44457        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
44458          composeItemDetailComponent(null, e);
44459        closeArray();
44460      };
44461  }
44462
44463  protected void composeReviewOutcomeComponent(String name, ClaimResponse.ReviewOutcomeComponent element) throws IOException {
44464    if (element != null) {
44465      open(name);
44466      composeReviewOutcomeComponentProperties(element);
44467      close();
44468    }
44469  }
44470
44471  protected void composeReviewOutcomeComponentProperties(ClaimResponse.ReviewOutcomeComponent element) throws IOException {
44472    composeBackboneElementProperties(element);
44473      if (element.hasDecision()) {
44474        composeCodeableConcept("decision", element.getDecision());
44475      }
44476      if (element.hasReason()) {
44477        openArray("reason");
44478        for (CodeableConcept e : element.getReason()) 
44479          composeCodeableConcept(null, e);
44480        closeArray();
44481      };
44482      if (element.hasPreAuthRefElement()) {
44483        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
44484        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
44485      }
44486      if (element.hasPreAuthPeriod()) {
44487        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
44488      }
44489  }
44490
44491  protected void composeAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
44492    if (element != null) {
44493      open(name);
44494      composeAdjudicationComponentProperties(element);
44495      close();
44496    }
44497  }
44498
44499  protected void composeAdjudicationComponentProperties(ClaimResponse.AdjudicationComponent element) throws IOException {
44500    composeBackboneElementProperties(element);
44501      if (element.hasCategory()) {
44502        composeCodeableConcept("category", element.getCategory());
44503      }
44504      if (element.hasReason()) {
44505        composeCodeableConcept("reason", element.getReason());
44506      }
44507      if (element.hasAmount()) {
44508        composeMoney("amount", element.getAmount());
44509      }
44510      if (element.hasQuantity()) {
44511        composeQuantity("quantity", element.getQuantity());
44512      }
44513  }
44514
44515  protected void composeItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
44516    if (element != null) {
44517      open(name);
44518      composeItemDetailComponentProperties(element);
44519      close();
44520    }
44521  }
44522
44523  protected void composeItemDetailComponentProperties(ClaimResponse.ItemDetailComponent element) throws IOException {
44524    composeBackboneElementProperties(element);
44525      if (element.hasDetailSequenceElement()) {
44526        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
44527        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
44528      }
44529      if (element.hasTraceNumber()) {
44530        openArray("traceNumber");
44531        for (Identifier e : element.getTraceNumber()) 
44532          composeIdentifier(null, e);
44533        closeArray();
44534      };
44535      if (element.hasNoteNumber()) {
44536        if (anyHasValue(element.getNoteNumber())) {
44537          openArray("noteNumber");
44538          for (PositiveIntType e : element.getNoteNumber()) 
44539            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44540          closeArray();
44541        }
44542        if (anyHasExtras(element.getNoteNumber())) {
44543          openArray("_noteNumber");
44544          for (PositiveIntType e : element.getNoteNumber()) 
44545            composePositiveIntExtras(null, e, true);
44546          closeArray();
44547        }
44548      };
44549      if (element.hasReviewOutcome()) {
44550        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44551      }
44552      if (element.hasAdjudication()) {
44553        openArray("adjudication");
44554        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44555          composeAdjudicationComponent(null, e);
44556        closeArray();
44557      };
44558      if (element.hasSubDetail()) {
44559        openArray("subDetail");
44560        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
44561          composeSubDetailComponent(null, e);
44562        closeArray();
44563      };
44564  }
44565
44566  protected void composeSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
44567    if (element != null) {
44568      open(name);
44569      composeSubDetailComponentProperties(element);
44570      close();
44571    }
44572  }
44573
44574  protected void composeSubDetailComponentProperties(ClaimResponse.SubDetailComponent element) throws IOException {
44575    composeBackboneElementProperties(element);
44576      if (element.hasSubDetailSequenceElement()) {
44577        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
44578        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
44579      }
44580      if (element.hasTraceNumber()) {
44581        openArray("traceNumber");
44582        for (Identifier e : element.getTraceNumber()) 
44583          composeIdentifier(null, e);
44584        closeArray();
44585      };
44586      if (element.hasNoteNumber()) {
44587        if (anyHasValue(element.getNoteNumber())) {
44588          openArray("noteNumber");
44589          for (PositiveIntType e : element.getNoteNumber()) 
44590            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44591          closeArray();
44592        }
44593        if (anyHasExtras(element.getNoteNumber())) {
44594          openArray("_noteNumber");
44595          for (PositiveIntType e : element.getNoteNumber()) 
44596            composePositiveIntExtras(null, e, true);
44597          closeArray();
44598        }
44599      };
44600      if (element.hasReviewOutcome()) {
44601        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44602      }
44603      if (element.hasAdjudication()) {
44604        openArray("adjudication");
44605        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44606          composeAdjudicationComponent(null, e);
44607        closeArray();
44608      };
44609  }
44610
44611  protected void composeAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
44612    if (element != null) {
44613      open(name);
44614      composeAddedItemComponentProperties(element);
44615      close();
44616    }
44617  }
44618
44619  protected void composeAddedItemComponentProperties(ClaimResponse.AddedItemComponent element) throws IOException {
44620    composeBackboneElementProperties(element);
44621      if (element.hasItemSequence()) {
44622        if (anyHasValue(element.getItemSequence())) {
44623          openArray("itemSequence");
44624          for (PositiveIntType e : element.getItemSequence()) 
44625            composePositiveIntCore(null, e, e != element.getItemSequence().get(element.getItemSequence().size()-1));
44626          closeArray();
44627        }
44628        if (anyHasExtras(element.getItemSequence())) {
44629          openArray("_itemSequence");
44630          for (PositiveIntType e : element.getItemSequence()) 
44631            composePositiveIntExtras(null, e, true);
44632          closeArray();
44633        }
44634      };
44635      if (element.hasDetailSequence()) {
44636        if (anyHasValue(element.getDetailSequence())) {
44637          openArray("detailSequence");
44638          for (PositiveIntType e : element.getDetailSequence()) 
44639            composePositiveIntCore(null, e, e != element.getDetailSequence().get(element.getDetailSequence().size()-1));
44640          closeArray();
44641        }
44642        if (anyHasExtras(element.getDetailSequence())) {
44643          openArray("_detailSequence");
44644          for (PositiveIntType e : element.getDetailSequence()) 
44645            composePositiveIntExtras(null, e, true);
44646          closeArray();
44647        }
44648      };
44649      if (element.hasSubdetailSequence()) {
44650        if (anyHasValue(element.getSubdetailSequence())) {
44651          openArray("subdetailSequence");
44652          for (PositiveIntType e : element.getSubdetailSequence()) 
44653            composePositiveIntCore(null, e, e != element.getSubdetailSequence().get(element.getSubdetailSequence().size()-1));
44654          closeArray();
44655        }
44656        if (anyHasExtras(element.getSubdetailSequence())) {
44657          openArray("_subdetailSequence");
44658          for (PositiveIntType e : element.getSubdetailSequence()) 
44659            composePositiveIntExtras(null, e, true);
44660          closeArray();
44661        }
44662      };
44663      if (element.hasTraceNumber()) {
44664        openArray("traceNumber");
44665        for (Identifier e : element.getTraceNumber()) 
44666          composeIdentifier(null, e);
44667        closeArray();
44668      };
44669      if (element.hasProvider()) {
44670        openArray("provider");
44671        for (Reference e : element.getProvider()) 
44672          composeReference(null, e);
44673        closeArray();
44674      };
44675      if (element.hasRevenue()) {
44676        composeCodeableConcept("revenue", element.getRevenue());
44677      }
44678      if (element.hasProductOrService()) {
44679        composeCodeableConcept("productOrService", element.getProductOrService());
44680      }
44681      if (element.hasProductOrServiceEnd()) {
44682        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44683      }
44684      if (element.hasRequest()) {
44685        openArray("request");
44686        for (Reference e : element.getRequest()) 
44687          composeReference(null, e);
44688        closeArray();
44689      };
44690      if (element.hasModifier()) {
44691        openArray("modifier");
44692        for (CodeableConcept e : element.getModifier()) 
44693          composeCodeableConcept(null, e);
44694        closeArray();
44695      };
44696      if (element.hasProgramCode()) {
44697        openArray("programCode");
44698        for (CodeableConcept e : element.getProgramCode()) 
44699          composeCodeableConcept(null, e);
44700        closeArray();
44701      };
44702      if (element.hasServiced()) {
44703        composeType("serviced", element.getServiced());
44704      }
44705      if (element.hasLocation()) {
44706        composeType("location", element.getLocation());
44707      }
44708      if (element.hasQuantity()) {
44709        composeQuantity("quantity", element.getQuantity());
44710      }
44711      if (element.hasUnitPrice()) {
44712        composeMoney("unitPrice", element.getUnitPrice());
44713      }
44714      if (element.hasFactorElement()) {
44715        composeDecimalCore("factor", element.getFactorElement(), false);
44716        composeDecimalExtras("factor", element.getFactorElement(), false);
44717      }
44718      if (element.hasTax()) {
44719        composeMoney("tax", element.getTax());
44720      }
44721      if (element.hasNet()) {
44722        composeMoney("net", element.getNet());
44723      }
44724      if (element.hasBodySite()) {
44725        openArray("bodySite");
44726        for (ClaimResponse.BodySiteComponent e : element.getBodySite()) 
44727          composeBodySiteComponent(null, e);
44728        closeArray();
44729      };
44730      if (element.hasNoteNumber()) {
44731        if (anyHasValue(element.getNoteNumber())) {
44732          openArray("noteNumber");
44733          for (PositiveIntType e : element.getNoteNumber()) 
44734            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44735          closeArray();
44736        }
44737        if (anyHasExtras(element.getNoteNumber())) {
44738          openArray("_noteNumber");
44739          for (PositiveIntType e : element.getNoteNumber()) 
44740            composePositiveIntExtras(null, e, true);
44741          closeArray();
44742        }
44743      };
44744      if (element.hasReviewOutcome()) {
44745        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44746      }
44747      if (element.hasAdjudication()) {
44748        openArray("adjudication");
44749        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44750          composeAdjudicationComponent(null, e);
44751        closeArray();
44752      };
44753      if (element.hasDetail()) {
44754        openArray("detail");
44755        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
44756          composeAddedItemDetailComponent(null, e);
44757        closeArray();
44758      };
44759  }
44760
44761  protected void composeBodySiteComponent(String name, ClaimResponse.BodySiteComponent element) throws IOException {
44762    if (element != null) {
44763      open(name);
44764      composeBodySiteComponentProperties(element);
44765      close();
44766    }
44767  }
44768
44769  protected void composeBodySiteComponentProperties(ClaimResponse.BodySiteComponent element) throws IOException {
44770    composeBackboneElementProperties(element);
44771      if (element.hasSite()) {
44772        openArray("site");
44773        for (CodeableReference e : element.getSite()) 
44774          composeCodeableReference(null, e);
44775        closeArray();
44776      };
44777      if (element.hasSubSite()) {
44778        openArray("subSite");
44779        for (CodeableConcept e : element.getSubSite()) 
44780          composeCodeableConcept(null, e);
44781        closeArray();
44782      };
44783  }
44784
44785  protected void composeAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
44786    if (element != null) {
44787      open(name);
44788      composeAddedItemDetailComponentProperties(element);
44789      close();
44790    }
44791  }
44792
44793  protected void composeAddedItemDetailComponentProperties(ClaimResponse.AddedItemDetailComponent element) throws IOException {
44794    composeBackboneElementProperties(element);
44795      if (element.hasTraceNumber()) {
44796        openArray("traceNumber");
44797        for (Identifier e : element.getTraceNumber()) 
44798          composeIdentifier(null, e);
44799        closeArray();
44800      };
44801      if (element.hasRevenue()) {
44802        composeCodeableConcept("revenue", element.getRevenue());
44803      }
44804      if (element.hasProductOrService()) {
44805        composeCodeableConcept("productOrService", element.getProductOrService());
44806      }
44807      if (element.hasProductOrServiceEnd()) {
44808        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44809      }
44810      if (element.hasModifier()) {
44811        openArray("modifier");
44812        for (CodeableConcept e : element.getModifier()) 
44813          composeCodeableConcept(null, e);
44814        closeArray();
44815      };
44816      if (element.hasQuantity()) {
44817        composeQuantity("quantity", element.getQuantity());
44818      }
44819      if (element.hasUnitPrice()) {
44820        composeMoney("unitPrice", element.getUnitPrice());
44821      }
44822      if (element.hasFactorElement()) {
44823        composeDecimalCore("factor", element.getFactorElement(), false);
44824        composeDecimalExtras("factor", element.getFactorElement(), false);
44825      }
44826      if (element.hasTax()) {
44827        composeMoney("tax", element.getTax());
44828      }
44829      if (element.hasNet()) {
44830        composeMoney("net", element.getNet());
44831      }
44832      if (element.hasNoteNumber()) {
44833        if (anyHasValue(element.getNoteNumber())) {
44834          openArray("noteNumber");
44835          for (PositiveIntType e : element.getNoteNumber()) 
44836            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44837          closeArray();
44838        }
44839        if (anyHasExtras(element.getNoteNumber())) {
44840          openArray("_noteNumber");
44841          for (PositiveIntType e : element.getNoteNumber()) 
44842            composePositiveIntExtras(null, e, true);
44843          closeArray();
44844        }
44845      };
44846      if (element.hasReviewOutcome()) {
44847        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44848      }
44849      if (element.hasAdjudication()) {
44850        openArray("adjudication");
44851        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44852          composeAdjudicationComponent(null, e);
44853        closeArray();
44854      };
44855      if (element.hasSubDetail()) {
44856        openArray("subDetail");
44857        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
44858          composeAddedItemSubDetailComponent(null, e);
44859        closeArray();
44860      };
44861  }
44862
44863  protected void composeAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
44864    if (element != null) {
44865      open(name);
44866      composeAddedItemSubDetailComponentProperties(element);
44867      close();
44868    }
44869  }
44870
44871  protected void composeAddedItemSubDetailComponentProperties(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
44872    composeBackboneElementProperties(element);
44873      if (element.hasTraceNumber()) {
44874        openArray("traceNumber");
44875        for (Identifier e : element.getTraceNumber()) 
44876          composeIdentifier(null, e);
44877        closeArray();
44878      };
44879      if (element.hasRevenue()) {
44880        composeCodeableConcept("revenue", element.getRevenue());
44881      }
44882      if (element.hasProductOrService()) {
44883        composeCodeableConcept("productOrService", element.getProductOrService());
44884      }
44885      if (element.hasProductOrServiceEnd()) {
44886        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44887      }
44888      if (element.hasModifier()) {
44889        openArray("modifier");
44890        for (CodeableConcept e : element.getModifier()) 
44891          composeCodeableConcept(null, e);
44892        closeArray();
44893      };
44894      if (element.hasQuantity()) {
44895        composeQuantity("quantity", element.getQuantity());
44896      }
44897      if (element.hasUnitPrice()) {
44898        composeMoney("unitPrice", element.getUnitPrice());
44899      }
44900      if (element.hasFactorElement()) {
44901        composeDecimalCore("factor", element.getFactorElement(), false);
44902        composeDecimalExtras("factor", element.getFactorElement(), false);
44903      }
44904      if (element.hasTax()) {
44905        composeMoney("tax", element.getTax());
44906      }
44907      if (element.hasNet()) {
44908        composeMoney("net", element.getNet());
44909      }
44910      if (element.hasNoteNumber()) {
44911        if (anyHasValue(element.getNoteNumber())) {
44912          openArray("noteNumber");
44913          for (PositiveIntType e : element.getNoteNumber()) 
44914            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44915          closeArray();
44916        }
44917        if (anyHasExtras(element.getNoteNumber())) {
44918          openArray("_noteNumber");
44919          for (PositiveIntType e : element.getNoteNumber()) 
44920            composePositiveIntExtras(null, e, true);
44921          closeArray();
44922        }
44923      };
44924      if (element.hasReviewOutcome()) {
44925        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44926      }
44927      if (element.hasAdjudication()) {
44928        openArray("adjudication");
44929        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44930          composeAdjudicationComponent(null, e);
44931        closeArray();
44932      };
44933  }
44934
44935  protected void composeTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
44936    if (element != null) {
44937      open(name);
44938      composeTotalComponentProperties(element);
44939      close();
44940    }
44941  }
44942
44943  protected void composeTotalComponentProperties(ClaimResponse.TotalComponent element) throws IOException {
44944    composeBackboneElementProperties(element);
44945      if (element.hasCategory()) {
44946        composeCodeableConcept("category", element.getCategory());
44947      }
44948      if (element.hasAmount()) {
44949        composeMoney("amount", element.getAmount());
44950      }
44951  }
44952
44953  protected void composePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
44954    if (element != null) {
44955      open(name);
44956      composePaymentComponentProperties(element);
44957      close();
44958    }
44959  }
44960
44961  protected void composePaymentComponentProperties(ClaimResponse.PaymentComponent element) throws IOException {
44962    composeBackboneElementProperties(element);
44963      if (element.hasType()) {
44964        composeCodeableConcept("type", element.getType());
44965      }
44966      if (element.hasAdjustment()) {
44967        composeMoney("adjustment", element.getAdjustment());
44968      }
44969      if (element.hasAdjustmentReason()) {
44970        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
44971      }
44972      if (element.hasDateElement()) {
44973        composeDateCore("date", element.getDateElement(), false);
44974        composeDateExtras("date", element.getDateElement(), false);
44975      }
44976      if (element.hasAmount()) {
44977        composeMoney("amount", element.getAmount());
44978      }
44979      if (element.hasIdentifier()) {
44980        composeIdentifier("identifier", element.getIdentifier());
44981      }
44982  }
44983
44984  protected void composeNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
44985    if (element != null) {
44986      open(name);
44987      composeNoteComponentProperties(element);
44988      close();
44989    }
44990  }
44991
44992  protected void composeNoteComponentProperties(ClaimResponse.NoteComponent element) throws IOException {
44993    composeBackboneElementProperties(element);
44994      if (element.hasNumberElement()) {
44995        composePositiveIntCore("number", element.getNumberElement(), false);
44996        composePositiveIntExtras("number", element.getNumberElement(), false);
44997      }
44998      if (element.hasType()) {
44999        composeCodeableConcept("type", element.getType());
45000      }
45001      if (element.hasTextElement()) {
45002        composeStringCore("text", element.getTextElement(), false);
45003        composeStringExtras("text", element.getTextElement(), false);
45004      }
45005      if (element.hasLanguage()) {
45006        composeCodeableConcept("language", element.getLanguage());
45007      }
45008  }
45009
45010  protected void composeInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
45011    if (element != null) {
45012      open(name);
45013      composeInsuranceComponentProperties(element);
45014      close();
45015    }
45016  }
45017
45018  protected void composeInsuranceComponentProperties(ClaimResponse.InsuranceComponent element) throws IOException {
45019    composeBackboneElementProperties(element);
45020      if (element.hasSequenceElement()) {
45021        composePositiveIntCore("sequence", element.getSequenceElement(), false);
45022        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
45023      }
45024      if (element.hasFocalElement()) {
45025        composeBooleanCore("focal", element.getFocalElement(), false);
45026        composeBooleanExtras("focal", element.getFocalElement(), false);
45027      }
45028      if (element.hasCoverage()) {
45029        composeReference("coverage", element.getCoverage());
45030      }
45031      if (element.hasBusinessArrangementElement()) {
45032        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
45033        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
45034      }
45035      if (element.hasClaimResponse()) {
45036        composeReference("claimResponse", element.getClaimResponse());
45037      }
45038  }
45039
45040  protected void composeErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
45041    if (element != null) {
45042      open(name);
45043      composeErrorComponentProperties(element);
45044      close();
45045    }
45046  }
45047
45048  protected void composeErrorComponentProperties(ClaimResponse.ErrorComponent element) throws IOException {
45049    composeBackboneElementProperties(element);
45050      if (element.hasItemSequenceElement()) {
45051        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
45052        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
45053      }
45054      if (element.hasDetailSequenceElement()) {
45055        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
45056        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
45057      }
45058      if (element.hasSubDetailSequenceElement()) {
45059        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
45060        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
45061      }
45062      if (element.hasCode()) {
45063        composeCodeableConcept("code", element.getCode());
45064      }
45065      if (element.hasExpression()) {
45066        if (anyHasValue(element.getExpression())) {
45067          openArray("expression");
45068          for (StringType e : element.getExpression()) 
45069            composeStringCore(null, e, e != element.getExpression().get(element.getExpression().size()-1));
45070          closeArray();
45071        }
45072        if (anyHasExtras(element.getExpression())) {
45073          openArray("_expression");
45074          for (StringType e : element.getExpression()) 
45075            composeStringExtras(null, e, true);
45076          closeArray();
45077        }
45078      };
45079  }
45080
45081  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
45082    if (element != null) {
45083      prop("resourceType", name);
45084      composeClinicalImpressionProperties(element);
45085    }
45086  }
45087
45088  protected void composeClinicalImpressionProperties(ClinicalImpression element) throws IOException {
45089    composeDomainResourceProperties(element);
45090      if (element.hasIdentifier()) {
45091        openArray("identifier");
45092        for (Identifier e : element.getIdentifier()) 
45093          composeIdentifier(null, e);
45094        closeArray();
45095      };
45096      if (element.hasStatusElement()) {
45097        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45098        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45099      }
45100      if (element.hasStatusReason()) {
45101        composeCodeableConcept("statusReason", element.getStatusReason());
45102      }
45103      if (element.hasDescriptionElement()) {
45104        composeStringCore("description", element.getDescriptionElement(), false);
45105        composeStringExtras("description", element.getDescriptionElement(), false);
45106      }
45107      if (element.hasSubject()) {
45108        composeReference("subject", element.getSubject());
45109      }
45110      if (element.hasEncounter()) {
45111        composeReference("encounter", element.getEncounter());
45112      }
45113      if (element.hasEffective()) {
45114        composeType("effective", element.getEffective());
45115      }
45116      if (element.hasDateElement()) {
45117        composeDateTimeCore("date", element.getDateElement(), false);
45118        composeDateTimeExtras("date", element.getDateElement(), false);
45119      }
45120      if (element.hasPerformer()) {
45121        composeReference("performer", element.getPerformer());
45122      }
45123      if (element.hasPrevious()) {
45124        composeReference("previous", element.getPrevious());
45125      }
45126      if (element.hasProblem()) {
45127        openArray("problem");
45128        for (Reference e : element.getProblem()) 
45129          composeReference(null, e);
45130        closeArray();
45131      };
45132      if (element.hasChangePattern()) {
45133        composeCodeableConcept("changePattern", element.getChangePattern());
45134      }
45135      if (element.hasProtocol()) {
45136        if (anyHasValue(element.getProtocol())) {
45137          openArray("protocol");
45138          for (UriType e : element.getProtocol()) 
45139            composeUriCore(null, e, e != element.getProtocol().get(element.getProtocol().size()-1));
45140          closeArray();
45141        }
45142        if (anyHasExtras(element.getProtocol())) {
45143          openArray("_protocol");
45144          for (UriType e : element.getProtocol()) 
45145            composeUriExtras(null, e, true);
45146          closeArray();
45147        }
45148      };
45149      if (element.hasSummaryElement()) {
45150        composeStringCore("summary", element.getSummaryElement(), false);
45151        composeStringExtras("summary", element.getSummaryElement(), false);
45152      }
45153      if (element.hasFinding()) {
45154        openArray("finding");
45155        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
45156          composeClinicalImpressionFindingComponent(null, e);
45157        closeArray();
45158      };
45159      if (element.hasPrognosisCodeableConcept()) {
45160        openArray("prognosisCodeableConcept");
45161        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
45162          composeCodeableConcept(null, e);
45163        closeArray();
45164      };
45165      if (element.hasPrognosisReference()) {
45166        openArray("prognosisReference");
45167        for (Reference e : element.getPrognosisReference()) 
45168          composeReference(null, e);
45169        closeArray();
45170      };
45171      if (element.hasSupportingInfo()) {
45172        openArray("supportingInfo");
45173        for (Reference e : element.getSupportingInfo()) 
45174          composeReference(null, e);
45175        closeArray();
45176      };
45177      if (element.hasNote()) {
45178        openArray("note");
45179        for (Annotation e : element.getNote()) 
45180          composeAnnotation(null, e);
45181        closeArray();
45182      };
45183  }
45184
45185  protected void composeClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
45186    if (element != null) {
45187      open(name);
45188      composeClinicalImpressionFindingComponentProperties(element);
45189      close();
45190    }
45191  }
45192
45193  protected void composeClinicalImpressionFindingComponentProperties(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
45194    composeBackboneElementProperties(element);
45195      if (element.hasItem()) {
45196        composeCodeableReference("item", element.getItem());
45197      }
45198      if (element.hasBasisElement()) {
45199        composeStringCore("basis", element.getBasisElement(), false);
45200        composeStringExtras("basis", element.getBasisElement(), false);
45201      }
45202  }
45203
45204  protected void composeClinicalUseDefinition(String name, ClinicalUseDefinition element) throws IOException {
45205    if (element != null) {
45206      prop("resourceType", name);
45207      composeClinicalUseDefinitionProperties(element);
45208    }
45209  }
45210
45211  protected void composeClinicalUseDefinitionProperties(ClinicalUseDefinition element) throws IOException {
45212    composeDomainResourceProperties(element);
45213      if (element.hasIdentifier()) {
45214        openArray("identifier");
45215        for (Identifier e : element.getIdentifier()) 
45216          composeIdentifier(null, e);
45217        closeArray();
45218      };
45219      if (element.hasTypeElement()) {
45220        composeEnumerationCore("type", element.getTypeElement(), new ClinicalUseDefinition.ClinicalUseDefinitionTypeEnumFactory(), false);
45221        composeEnumerationExtras("type", element.getTypeElement(), new ClinicalUseDefinition.ClinicalUseDefinitionTypeEnumFactory(), false);
45222      }
45223      if (element.hasCategory()) {
45224        openArray("category");
45225        for (CodeableConcept e : element.getCategory()) 
45226          composeCodeableConcept(null, e);
45227        closeArray();
45228      };
45229      if (element.hasSubject()) {
45230        openArray("subject");
45231        for (Reference e : element.getSubject()) 
45232          composeReference(null, e);
45233        closeArray();
45234      };
45235      if (element.hasStatus()) {
45236        composeCodeableConcept("status", element.getStatus());
45237      }
45238      if (element.hasContraindication()) {
45239        composeClinicalUseDefinitionContraindicationComponent("contraindication", element.getContraindication());
45240      }
45241      if (element.hasIndication()) {
45242        composeClinicalUseDefinitionIndicationComponent("indication", element.getIndication());
45243      }
45244      if (element.hasInteraction()) {
45245        composeClinicalUseDefinitionInteractionComponent("interaction", element.getInteraction());
45246      }
45247      if (element.hasPopulation()) {
45248        openArray("population");
45249        for (Reference e : element.getPopulation()) 
45250          composeReference(null, e);
45251        closeArray();
45252      };
45253      if (element.hasLibrary()) {
45254        if (anyHasValue(element.getLibrary())) {
45255          openArray("library");
45256          for (CanonicalType e : element.getLibrary()) 
45257            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
45258          closeArray();
45259        }
45260        if (anyHasExtras(element.getLibrary())) {
45261          openArray("_library");
45262          for (CanonicalType e : element.getLibrary()) 
45263            composeCanonicalExtras(null, e, true);
45264          closeArray();
45265        }
45266      };
45267      if (element.hasUndesirableEffect()) {
45268        composeClinicalUseDefinitionUndesirableEffectComponent("undesirableEffect", element.getUndesirableEffect());
45269      }
45270      if (element.hasWarning()) {
45271        composeClinicalUseDefinitionWarningComponent("warning", element.getWarning());
45272      }
45273  }
45274
45275  protected void composeClinicalUseDefinitionContraindicationComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent element) throws IOException {
45276    if (element != null) {
45277      open(name);
45278      composeClinicalUseDefinitionContraindicationComponentProperties(element);
45279      close();
45280    }
45281  }
45282
45283  protected void composeClinicalUseDefinitionContraindicationComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent element) throws IOException {
45284    composeBackboneElementProperties(element);
45285      if (element.hasDiseaseSymptomProcedure()) {
45286        composeCodeableReference("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
45287      }
45288      if (element.hasDiseaseStatus()) {
45289        composeCodeableReference("diseaseStatus", element.getDiseaseStatus());
45290      }
45291      if (element.hasComorbidity()) {
45292        openArray("comorbidity");
45293        for (CodeableReference e : element.getComorbidity()) 
45294          composeCodeableReference(null, e);
45295        closeArray();
45296      };
45297      if (element.hasIndication()) {
45298        openArray("indication");
45299        for (Reference e : element.getIndication()) 
45300          composeReference(null, e);
45301        closeArray();
45302      };
45303      if (element.hasApplicability()) {
45304        composeExpression("applicability", element.getApplicability());
45305      }
45306      if (element.hasOtherTherapy()) {
45307        openArray("otherTherapy");
45308        for (ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
45309          composeClinicalUseDefinitionContraindicationOtherTherapyComponent(null, e);
45310        closeArray();
45311      };
45312  }
45313
45314  protected void composeClinicalUseDefinitionContraindicationOtherTherapyComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent element) throws IOException {
45315    if (element != null) {
45316      open(name);
45317      composeClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(element);
45318      close();
45319    }
45320  }
45321
45322  protected void composeClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent element) throws IOException {
45323    composeBackboneElementProperties(element);
45324      if (element.hasRelationshipType()) {
45325        composeCodeableConcept("relationshipType", element.getRelationshipType());
45326      }
45327      if (element.hasTreatment()) {
45328        composeCodeableReference("treatment", element.getTreatment());
45329      }
45330  }
45331
45332  protected void composeClinicalUseDefinitionIndicationComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent element) throws IOException {
45333    if (element != null) {
45334      open(name);
45335      composeClinicalUseDefinitionIndicationComponentProperties(element);
45336      close();
45337    }
45338  }
45339
45340  protected void composeClinicalUseDefinitionIndicationComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent element) throws IOException {
45341    composeBackboneElementProperties(element);
45342      if (element.hasDiseaseSymptomProcedure()) {
45343        composeCodeableReference("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
45344      }
45345      if (element.hasDiseaseStatus()) {
45346        composeCodeableReference("diseaseStatus", element.getDiseaseStatus());
45347      }
45348      if (element.hasComorbidity()) {
45349        openArray("comorbidity");
45350        for (CodeableReference e : element.getComorbidity()) 
45351          composeCodeableReference(null, e);
45352        closeArray();
45353      };
45354      if (element.hasIntendedEffect()) {
45355        composeCodeableReference("intendedEffect", element.getIntendedEffect());
45356      }
45357      if (element.hasDuration()) {
45358        composeType("duration", element.getDuration());
45359      }
45360      if (element.hasUndesirableEffect()) {
45361        openArray("undesirableEffect");
45362        for (Reference e : element.getUndesirableEffect()) 
45363          composeReference(null, e);
45364        closeArray();
45365      };
45366      if (element.hasApplicability()) {
45367        composeExpression("applicability", element.getApplicability());
45368      }
45369      if (element.hasOtherTherapy()) {
45370        openArray("otherTherapy");
45371        for (ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
45372          composeClinicalUseDefinitionContraindicationOtherTherapyComponent(null, e);
45373        closeArray();
45374      };
45375  }
45376
45377  protected void composeClinicalUseDefinitionInteractionComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent element) throws IOException {
45378    if (element != null) {
45379      open(name);
45380      composeClinicalUseDefinitionInteractionComponentProperties(element);
45381      close();
45382    }
45383  }
45384
45385  protected void composeClinicalUseDefinitionInteractionComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent element) throws IOException {
45386    composeBackboneElementProperties(element);
45387      if (element.hasInteractant()) {
45388        openArray("interactant");
45389        for (ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent e : element.getInteractant()) 
45390          composeClinicalUseDefinitionInteractionInteractantComponent(null, e);
45391        closeArray();
45392      };
45393      if (element.hasType()) {
45394        composeCodeableConcept("type", element.getType());
45395      }
45396      if (element.hasEffect()) {
45397        composeCodeableReference("effect", element.getEffect());
45398      }
45399      if (element.hasIncidence()) {
45400        composeCodeableConcept("incidence", element.getIncidence());
45401      }
45402      if (element.hasManagement()) {
45403        openArray("management");
45404        for (CodeableConcept e : element.getManagement()) 
45405          composeCodeableConcept(null, e);
45406        closeArray();
45407      };
45408  }
45409
45410  protected void composeClinicalUseDefinitionInteractionInteractantComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent element) throws IOException {
45411    if (element != null) {
45412      open(name);
45413      composeClinicalUseDefinitionInteractionInteractantComponentProperties(element);
45414      close();
45415    }
45416  }
45417
45418  protected void composeClinicalUseDefinitionInteractionInteractantComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent element) throws IOException {
45419    composeBackboneElementProperties(element);
45420      if (element.hasItem()) {
45421        composeType("item", element.getItem());
45422      }
45423  }
45424
45425  protected void composeClinicalUseDefinitionUndesirableEffectComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent element) throws IOException {
45426    if (element != null) {
45427      open(name);
45428      composeClinicalUseDefinitionUndesirableEffectComponentProperties(element);
45429      close();
45430    }
45431  }
45432
45433  protected void composeClinicalUseDefinitionUndesirableEffectComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent element) throws IOException {
45434    composeBackboneElementProperties(element);
45435      if (element.hasSymptomConditionEffect()) {
45436        composeCodeableReference("symptomConditionEffect", element.getSymptomConditionEffect());
45437      }
45438      if (element.hasClassification()) {
45439        composeCodeableConcept("classification", element.getClassification());
45440      }
45441      if (element.hasFrequencyOfOccurrence()) {
45442        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
45443      }
45444  }
45445
45446  protected void composeClinicalUseDefinitionWarningComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent element) throws IOException {
45447    if (element != null) {
45448      open(name);
45449      composeClinicalUseDefinitionWarningComponentProperties(element);
45450      close();
45451    }
45452  }
45453
45454  protected void composeClinicalUseDefinitionWarningComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent element) throws IOException {
45455    composeBackboneElementProperties(element);
45456      if (element.hasDescriptionElement()) {
45457        composeMarkdownCore("description", element.getDescriptionElement(), false);
45458        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45459      }
45460      if (element.hasCode()) {
45461        composeCodeableConcept("code", element.getCode());
45462      }
45463  }
45464
45465  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
45466    if (element != null) {
45467      prop("resourceType", name);
45468      composeCodeSystemProperties(element);
45469    }
45470  }
45471
45472  protected void composeCodeSystemProperties(CodeSystem element) throws IOException {
45473    composeMetadataResourceProperties(element);
45474      if (element.hasUrlElement()) {
45475        composeUriCore("url", element.getUrlElement(), false);
45476        composeUriExtras("url", element.getUrlElement(), false);
45477      }
45478      if (element.hasIdentifier()) {
45479        openArray("identifier");
45480        for (Identifier e : element.getIdentifier()) 
45481          composeIdentifier(null, e);
45482        closeArray();
45483      };
45484      if (element.hasVersionElement()) {
45485        composeStringCore("version", element.getVersionElement(), false);
45486        composeStringExtras("version", element.getVersionElement(), false);
45487      }
45488      if (element.hasVersionAlgorithm()) {
45489        composeType("versionAlgorithm", element.getVersionAlgorithm());
45490      }
45491      if (element.hasNameElement()) {
45492        composeStringCore("name", element.getNameElement(), false);
45493        composeStringExtras("name", element.getNameElement(), false);
45494      }
45495      if (element.hasTitleElement()) {
45496        composeStringCore("title", element.getTitleElement(), false);
45497        composeStringExtras("title", element.getTitleElement(), false);
45498      }
45499      if (element.hasStatusElement()) {
45500        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45501        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45502      }
45503      if (element.hasExperimentalElement()) {
45504        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45505        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45506      }
45507      if (element.hasDateElement()) {
45508        composeDateTimeCore("date", element.getDateElement(), false);
45509        composeDateTimeExtras("date", element.getDateElement(), false);
45510      }
45511      if (element.hasPublisherElement()) {
45512        composeStringCore("publisher", element.getPublisherElement(), false);
45513        composeStringExtras("publisher", element.getPublisherElement(), false);
45514      }
45515      if (element.hasContact()) {
45516        openArray("contact");
45517        for (ContactDetail e : element.getContact()) 
45518          composeContactDetail(null, e);
45519        closeArray();
45520      };
45521      if (element.hasDescriptionElement()) {
45522        composeMarkdownCore("description", element.getDescriptionElement(), false);
45523        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45524      }
45525      if (element.hasUseContext()) {
45526        openArray("useContext");
45527        for (UsageContext e : element.getUseContext()) 
45528          composeUsageContext(null, e);
45529        closeArray();
45530      };
45531      if (element.hasJurisdiction()) {
45532        openArray("jurisdiction");
45533        for (CodeableConcept e : element.getJurisdiction()) 
45534          composeCodeableConcept(null, e);
45535        closeArray();
45536      };
45537      if (element.hasPurposeElement()) {
45538        composeMarkdownCore("purpose", element.getPurposeElement(), false);
45539        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45540      }
45541      if (element.hasCopyrightElement()) {
45542        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45543        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45544      }
45545      if (element.hasCopyrightLabelElement()) {
45546        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
45547        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
45548      }
45549      if (element.hasApprovalDateElement()) {
45550        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45551        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45552      }
45553      if (element.hasLastReviewDateElement()) {
45554        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45555        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45556      }
45557      if (element.hasEffectivePeriod()) {
45558        composePeriod("effectivePeriod", element.getEffectivePeriod());
45559      }
45560      if (element.hasTopic()) {
45561        openArray("topic");
45562        for (CodeableConcept e : element.getTopic()) 
45563          composeCodeableConcept(null, e);
45564        closeArray();
45565      };
45566      if (element.hasAuthor()) {
45567        openArray("author");
45568        for (ContactDetail e : element.getAuthor()) 
45569          composeContactDetail(null, e);
45570        closeArray();
45571      };
45572      if (element.hasEditor()) {
45573        openArray("editor");
45574        for (ContactDetail e : element.getEditor()) 
45575          composeContactDetail(null, e);
45576        closeArray();
45577      };
45578      if (element.hasReviewer()) {
45579        openArray("reviewer");
45580        for (ContactDetail e : element.getReviewer()) 
45581          composeContactDetail(null, e);
45582        closeArray();
45583      };
45584      if (element.hasEndorser()) {
45585        openArray("endorser");
45586        for (ContactDetail e : element.getEndorser()) 
45587          composeContactDetail(null, e);
45588        closeArray();
45589      };
45590      if (element.hasRelatedArtifact()) {
45591        openArray("relatedArtifact");
45592        for (RelatedArtifact e : element.getRelatedArtifact()) 
45593          composeRelatedArtifact(null, e);
45594        closeArray();
45595      };
45596      if (element.hasCaseSensitiveElement()) {
45597        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
45598        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
45599      }
45600      if (element.hasValueSetElement()) {
45601        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
45602        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
45603      }
45604      if (element.hasHierarchyMeaningElement()) {
45605        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
45606        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
45607      }
45608      if (element.hasCompositionalElement()) {
45609        composeBooleanCore("compositional", element.getCompositionalElement(), false);
45610        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
45611      }
45612      if (element.hasVersionNeededElement()) {
45613        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
45614        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
45615      }
45616      if (element.hasContentElement()) {
45617        composeEnumerationCore("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
45618        composeEnumerationExtras("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
45619      }
45620      if (element.hasSupplementsElement()) {
45621        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
45622        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
45623      }
45624      if (element.hasCountElement()) {
45625        composeUnsignedIntCore("count", element.getCountElement(), false);
45626        composeUnsignedIntExtras("count", element.getCountElement(), false);
45627      }
45628      if (element.hasFilter()) {
45629        openArray("filter");
45630        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
45631          composeCodeSystemFilterComponent(null, e);
45632        closeArray();
45633      };
45634      if (element.hasProperty()) {
45635        openArray("property");
45636        for (CodeSystem.PropertyComponent e : element.getProperty()) 
45637          composePropertyComponent(null, e);
45638        closeArray();
45639      };
45640      if (element.hasConcept()) {
45641        openArray("concept");
45642        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
45643          composeConceptDefinitionComponent(null, e);
45644        closeArray();
45645      };
45646  }
45647
45648  protected void composeCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
45649    if (element != null) {
45650      open(name);
45651      composeCodeSystemFilterComponentProperties(element);
45652      close();
45653    }
45654  }
45655
45656  protected void composeCodeSystemFilterComponentProperties(CodeSystem.CodeSystemFilterComponent element) throws IOException {
45657    composeBackboneElementProperties(element);
45658      if (element.hasCodeElement()) {
45659        composeCodeCore("code", element.getCodeElement(), false);
45660        composeCodeExtras("code", element.getCodeElement(), false);
45661      }
45662      if (element.hasDescriptionElement()) {
45663        composeStringCore("description", element.getDescriptionElement(), false);
45664        composeStringExtras("description", element.getDescriptionElement(), false);
45665      }
45666      if (element.hasOperator()) {
45667        openArray("operator");
45668        for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
45669          composeEnumerationCore(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
45670        closeArray();
45671        if (anyHasExtras(element.getOperator())) {
45672          openArray("_operator");
45673          for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
45674            composeEnumerationExtras(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
45675          closeArray();
45676        }
45677      };
45678      if (element.hasValueElement()) {
45679        composeStringCore("value", element.getValueElement(), false);
45680        composeStringExtras("value", element.getValueElement(), false);
45681      }
45682  }
45683
45684  protected void composePropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
45685    if (element != null) {
45686      open(name);
45687      composePropertyComponentProperties(element);
45688      close();
45689    }
45690  }
45691
45692  protected void composePropertyComponentProperties(CodeSystem.PropertyComponent element) throws IOException {
45693    composeBackboneElementProperties(element);
45694      if (element.hasCodeElement()) {
45695        composeCodeCore("code", element.getCodeElement(), false);
45696        composeCodeExtras("code", element.getCodeElement(), false);
45697      }
45698      if (element.hasUriElement()) {
45699        composeUriCore("uri", element.getUriElement(), false);
45700        composeUriExtras("uri", element.getUriElement(), false);
45701      }
45702      if (element.hasDescriptionElement()) {
45703        composeStringCore("description", element.getDescriptionElement(), false);
45704        composeStringExtras("description", element.getDescriptionElement(), false);
45705      }
45706      if (element.hasTypeElement()) {
45707        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
45708        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
45709      }
45710  }
45711
45712  protected void composeConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
45713    if (element != null) {
45714      open(name);
45715      composeConceptDefinitionComponentProperties(element);
45716      close();
45717    }
45718  }
45719
45720  protected void composeConceptDefinitionComponentProperties(CodeSystem.ConceptDefinitionComponent element) throws IOException {
45721    composeBackboneElementProperties(element);
45722      if (element.hasCodeElement()) {
45723        composeCodeCore("code", element.getCodeElement(), false);
45724        composeCodeExtras("code", element.getCodeElement(), false);
45725      }
45726      if (element.hasDisplayElement()) {
45727        composeStringCore("display", element.getDisplayElement(), false);
45728        composeStringExtras("display", element.getDisplayElement(), false);
45729      }
45730      if (element.hasDefinitionElement()) {
45731        composeStringCore("definition", element.getDefinitionElement(), false);
45732        composeStringExtras("definition", element.getDefinitionElement(), false);
45733      }
45734      if (element.hasDesignation()) {
45735        openArray("designation");
45736        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
45737          composeConceptDefinitionDesignationComponent(null, e);
45738        closeArray();
45739      };
45740      if (element.hasProperty()) {
45741        openArray("property");
45742        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
45743          composeConceptPropertyComponent(null, e);
45744        closeArray();
45745      };
45746      if (element.hasConcept()) {
45747        openArray("concept");
45748        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
45749          composeConceptDefinitionComponent(null, e);
45750        closeArray();
45751      };
45752  }
45753
45754  protected void composeConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
45755    if (element != null) {
45756      open(name);
45757      composeConceptDefinitionDesignationComponentProperties(element);
45758      close();
45759    }
45760  }
45761
45762  protected void composeConceptDefinitionDesignationComponentProperties(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
45763    composeBackboneElementProperties(element);
45764      if (element.hasLanguageElement()) {
45765        composeCodeCore("language", element.getLanguageElement(), false);
45766        composeCodeExtras("language", element.getLanguageElement(), false);
45767      }
45768      if (element.hasUse()) {
45769        composeCoding("use", element.getUse());
45770      }
45771      if (element.hasAdditionalUse()) {
45772        openArray("additionalUse");
45773        for (Coding e : element.getAdditionalUse()) 
45774          composeCoding(null, e);
45775        closeArray();
45776      };
45777      if (element.hasValueElement()) {
45778        composeStringCore("value", element.getValueElement(), false);
45779        composeStringExtras("value", element.getValueElement(), false);
45780      }
45781  }
45782
45783  protected void composeConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
45784    if (element != null) {
45785      open(name);
45786      composeConceptPropertyComponentProperties(element);
45787      close();
45788    }
45789  }
45790
45791  protected void composeConceptPropertyComponentProperties(CodeSystem.ConceptPropertyComponent element) throws IOException {
45792    composeBackboneElementProperties(element);
45793      if (element.hasCodeElement()) {
45794        composeCodeCore("code", element.getCodeElement(), false);
45795        composeCodeExtras("code", element.getCodeElement(), false);
45796      }
45797      if (element.hasValue()) {
45798        composeType("value", element.getValue());
45799      }
45800  }
45801
45802  protected void composeCommunication(String name, Communication element) throws IOException {
45803    if (element != null) {
45804      prop("resourceType", name);
45805      composeCommunicationProperties(element);
45806    }
45807  }
45808
45809  protected void composeCommunicationProperties(Communication element) throws IOException {
45810    composeDomainResourceProperties(element);
45811      if (element.hasIdentifier()) {
45812        openArray("identifier");
45813        for (Identifier e : element.getIdentifier()) 
45814          composeIdentifier(null, e);
45815        closeArray();
45816      };
45817      if (element.hasInstantiatesCanonical()) {
45818        if (anyHasValue(element.getInstantiatesCanonical())) {
45819          openArray("instantiatesCanonical");
45820          for (CanonicalType e : element.getInstantiatesCanonical()) 
45821            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
45822          closeArray();
45823        }
45824        if (anyHasExtras(element.getInstantiatesCanonical())) {
45825          openArray("_instantiatesCanonical");
45826          for (CanonicalType e : element.getInstantiatesCanonical()) 
45827            composeCanonicalExtras(null, e, true);
45828          closeArray();
45829        }
45830      };
45831      if (element.hasInstantiatesUri()) {
45832        if (anyHasValue(element.getInstantiatesUri())) {
45833          openArray("instantiatesUri");
45834          for (UriType e : element.getInstantiatesUri()) 
45835            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
45836          closeArray();
45837        }
45838        if (anyHasExtras(element.getInstantiatesUri())) {
45839          openArray("_instantiatesUri");
45840          for (UriType e : element.getInstantiatesUri()) 
45841            composeUriExtras(null, e, true);
45842          closeArray();
45843        }
45844      };
45845      if (element.hasBasedOn()) {
45846        openArray("basedOn");
45847        for (Reference e : element.getBasedOn()) 
45848          composeReference(null, e);
45849        closeArray();
45850      };
45851      if (element.hasPartOf()) {
45852        openArray("partOf");
45853        for (Reference e : element.getPartOf()) 
45854          composeReference(null, e);
45855        closeArray();
45856      };
45857      if (element.hasInResponseTo()) {
45858        openArray("inResponseTo");
45859        for (Reference e : element.getInResponseTo()) 
45860          composeReference(null, e);
45861        closeArray();
45862      };
45863      if (element.hasStatusElement()) {
45864        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45865        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45866      }
45867      if (element.hasStatusReason()) {
45868        composeCodeableConcept("statusReason", element.getStatusReason());
45869      }
45870      if (element.hasCategory()) {
45871        openArray("category");
45872        for (CodeableConcept e : element.getCategory()) 
45873          composeCodeableConcept(null, e);
45874        closeArray();
45875      };
45876      if (element.hasPriorityElement()) {
45877        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
45878        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
45879      }
45880      if (element.hasMedium()) {
45881        openArray("medium");
45882        for (CodeableConcept e : element.getMedium()) 
45883          composeCodeableConcept(null, e);
45884        closeArray();
45885      };
45886      if (element.hasSubject()) {
45887        composeReference("subject", element.getSubject());
45888      }
45889      if (element.hasTopic()) {
45890        composeCodeableConcept("topic", element.getTopic());
45891      }
45892      if (element.hasAbout()) {
45893        openArray("about");
45894        for (Reference e : element.getAbout()) 
45895          composeReference(null, e);
45896        closeArray();
45897      };
45898      if (element.hasEncounter()) {
45899        composeReference("encounter", element.getEncounter());
45900      }
45901      if (element.hasSentElement()) {
45902        composeDateTimeCore("sent", element.getSentElement(), false);
45903        composeDateTimeExtras("sent", element.getSentElement(), false);
45904      }
45905      if (element.hasReceivedElement()) {
45906        composeDateTimeCore("received", element.getReceivedElement(), false);
45907        composeDateTimeExtras("received", element.getReceivedElement(), false);
45908      }
45909      if (element.hasRecipient()) {
45910        openArray("recipient");
45911        for (Reference e : element.getRecipient()) 
45912          composeReference(null, e);
45913        closeArray();
45914      };
45915      if (element.hasSender()) {
45916        composeReference("sender", element.getSender());
45917      }
45918      if (element.hasReason()) {
45919        openArray("reason");
45920        for (CodeableReference e : element.getReason()) 
45921          composeCodeableReference(null, e);
45922        closeArray();
45923      };
45924      if (element.hasPayload()) {
45925        openArray("payload");
45926        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
45927          composeCommunicationPayloadComponent(null, e);
45928        closeArray();
45929      };
45930      if (element.hasNote()) {
45931        openArray("note");
45932        for (Annotation e : element.getNote()) 
45933          composeAnnotation(null, e);
45934        closeArray();
45935      };
45936  }
45937
45938  protected void composeCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
45939    if (element != null) {
45940      open(name);
45941      composeCommunicationPayloadComponentProperties(element);
45942      close();
45943    }
45944  }
45945
45946  protected void composeCommunicationPayloadComponentProperties(Communication.CommunicationPayloadComponent element) throws IOException {
45947    composeBackboneElementProperties(element);
45948      if (element.hasContent()) {
45949        composeType("content", element.getContent());
45950      }
45951  }
45952
45953  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
45954    if (element != null) {
45955      prop("resourceType", name);
45956      composeCommunicationRequestProperties(element);
45957    }
45958  }
45959
45960  protected void composeCommunicationRequestProperties(CommunicationRequest element) throws IOException {
45961    composeDomainResourceProperties(element);
45962      if (element.hasIdentifier()) {
45963        openArray("identifier");
45964        for (Identifier e : element.getIdentifier()) 
45965          composeIdentifier(null, e);
45966        closeArray();
45967      };
45968      if (element.hasBasedOn()) {
45969        openArray("basedOn");
45970        for (Reference e : element.getBasedOn()) 
45971          composeReference(null, e);
45972        closeArray();
45973      };
45974      if (element.hasReplaces()) {
45975        openArray("replaces");
45976        for (Reference e : element.getReplaces()) 
45977          composeReference(null, e);
45978        closeArray();
45979      };
45980      if (element.hasGroupIdentifier()) {
45981        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
45982      }
45983      if (element.hasStatusElement()) {
45984        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
45985        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
45986      }
45987      if (element.hasStatusReason()) {
45988        composeCodeableConcept("statusReason", element.getStatusReason());
45989      }
45990      if (element.hasIntentElement()) {
45991        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
45992        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
45993      }
45994      if (element.hasCategory()) {
45995        openArray("category");
45996        for (CodeableConcept e : element.getCategory()) 
45997          composeCodeableConcept(null, e);
45998        closeArray();
45999      };
46000      if (element.hasPriorityElement()) {
46001        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
46002        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
46003      }
46004      if (element.hasDoNotPerformElement()) {
46005        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
46006        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
46007      }
46008      if (element.hasMedium()) {
46009        openArray("medium");
46010        for (CodeableConcept e : element.getMedium()) 
46011          composeCodeableConcept(null, e);
46012        closeArray();
46013      };
46014      if (element.hasSubject()) {
46015        composeReference("subject", element.getSubject());
46016      }
46017      if (element.hasAbout()) {
46018        openArray("about");
46019        for (Reference e : element.getAbout()) 
46020          composeReference(null, e);
46021        closeArray();
46022      };
46023      if (element.hasEncounter()) {
46024        composeReference("encounter", element.getEncounter());
46025      }
46026      if (element.hasPayload()) {
46027        openArray("payload");
46028        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
46029          composeCommunicationRequestPayloadComponent(null, e);
46030        closeArray();
46031      };
46032      if (element.hasOccurrence()) {
46033        composeType("occurrence", element.getOccurrence());
46034      }
46035      if (element.hasAuthoredOnElement()) {
46036        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
46037        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
46038      }
46039      if (element.hasRequester()) {
46040        composeReference("requester", element.getRequester());
46041      }
46042      if (element.hasRecipient()) {
46043        openArray("recipient");
46044        for (Reference e : element.getRecipient()) 
46045          composeReference(null, e);
46046        closeArray();
46047      };
46048      if (element.hasInformationProvider()) {
46049        openArray("informationProvider");
46050        for (Reference e : element.getInformationProvider()) 
46051          composeReference(null, e);
46052        closeArray();
46053      };
46054      if (element.hasReason()) {
46055        openArray("reason");
46056        for (CodeableReference e : element.getReason()) 
46057          composeCodeableReference(null, e);
46058        closeArray();
46059      };
46060      if (element.hasNote()) {
46061        openArray("note");
46062        for (Annotation e : element.getNote()) 
46063          composeAnnotation(null, e);
46064        closeArray();
46065      };
46066  }
46067
46068  protected void composeCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
46069    if (element != null) {
46070      open(name);
46071      composeCommunicationRequestPayloadComponentProperties(element);
46072      close();
46073    }
46074  }
46075
46076  protected void composeCommunicationRequestPayloadComponentProperties(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
46077    composeBackboneElementProperties(element);
46078      if (element.hasContent()) {
46079        composeType("content", element.getContent());
46080      }
46081  }
46082
46083  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
46084    if (element != null) {
46085      prop("resourceType", name);
46086      composeCompartmentDefinitionProperties(element);
46087    }
46088  }
46089
46090  protected void composeCompartmentDefinitionProperties(CompartmentDefinition element) throws IOException {
46091    composeCanonicalResourceProperties(element);
46092      if (element.hasUrlElement()) {
46093        composeUriCore("url", element.getUrlElement(), false);
46094        composeUriExtras("url", element.getUrlElement(), false);
46095      }
46096      if (element.hasVersionElement()) {
46097        composeStringCore("version", element.getVersionElement(), false);
46098        composeStringExtras("version", element.getVersionElement(), false);
46099      }
46100      if (element.hasVersionAlgorithm()) {
46101        composeType("versionAlgorithm", element.getVersionAlgorithm());
46102      }
46103      if (element.hasNameElement()) {
46104        composeStringCore("name", element.getNameElement(), false);
46105        composeStringExtras("name", element.getNameElement(), false);
46106      }
46107      if (element.hasTitleElement()) {
46108        composeStringCore("title", element.getTitleElement(), false);
46109        composeStringExtras("title", element.getTitleElement(), false);
46110      }
46111      if (element.hasStatusElement()) {
46112        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46113        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46114      }
46115      if (element.hasExperimentalElement()) {
46116        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46117        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46118      }
46119      if (element.hasDateElement()) {
46120        composeDateTimeCore("date", element.getDateElement(), false);
46121        composeDateTimeExtras("date", element.getDateElement(), false);
46122      }
46123      if (element.hasPublisherElement()) {
46124        composeStringCore("publisher", element.getPublisherElement(), false);
46125        composeStringExtras("publisher", element.getPublisherElement(), false);
46126      }
46127      if (element.hasContact()) {
46128        openArray("contact");
46129        for (ContactDetail e : element.getContact()) 
46130          composeContactDetail(null, e);
46131        closeArray();
46132      };
46133      if (element.hasDescriptionElement()) {
46134        composeMarkdownCore("description", element.getDescriptionElement(), false);
46135        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46136      }
46137      if (element.hasUseContext()) {
46138        openArray("useContext");
46139        for (UsageContext e : element.getUseContext()) 
46140          composeUsageContext(null, e);
46141        closeArray();
46142      };
46143      if (element.hasPurposeElement()) {
46144        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46145        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46146      }
46147      if (element.hasCodeElement()) {
46148        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
46149        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
46150      }
46151      if (element.hasSearchElement()) {
46152        composeBooleanCore("search", element.getSearchElement(), false);
46153        composeBooleanExtras("search", element.getSearchElement(), false);
46154      }
46155      if (element.hasResource()) {
46156        openArray("resource");
46157        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
46158          composeCompartmentDefinitionResourceComponent(null, e);
46159        closeArray();
46160      };
46161  }
46162
46163  protected void composeCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
46164    if (element != null) {
46165      open(name);
46166      composeCompartmentDefinitionResourceComponentProperties(element);
46167      close();
46168    }
46169  }
46170
46171  protected void composeCompartmentDefinitionResourceComponentProperties(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
46172    composeBackboneElementProperties(element);
46173      if (element.hasCodeElement()) {
46174        composeCodeCore("code", element.getCodeElement(), false);
46175        composeCodeExtras("code", element.getCodeElement(), false);
46176      }
46177      if (element.hasParam()) {
46178        if (anyHasValue(element.getParam())) {
46179          openArray("param");
46180          for (StringType e : element.getParam()) 
46181            composeStringCore(null, e, e != element.getParam().get(element.getParam().size()-1));
46182          closeArray();
46183        }
46184        if (anyHasExtras(element.getParam())) {
46185          openArray("_param");
46186          for (StringType e : element.getParam()) 
46187            composeStringExtras(null, e, true);
46188          closeArray();
46189        }
46190      };
46191      if (element.hasDocumentationElement()) {
46192        composeStringCore("documentation", element.getDocumentationElement(), false);
46193        composeStringExtras("documentation", element.getDocumentationElement(), false);
46194      }
46195      if (element.hasStartParamElement()) {
46196        composeUriCore("startParam", element.getStartParamElement(), false);
46197        composeUriExtras("startParam", element.getStartParamElement(), false);
46198      }
46199      if (element.hasEndParamElement()) {
46200        composeUriCore("endParam", element.getEndParamElement(), false);
46201        composeUriExtras("endParam", element.getEndParamElement(), false);
46202      }
46203  }
46204
46205  protected void composeComposition(String name, Composition element) throws IOException {
46206    if (element != null) {
46207      prop("resourceType", name);
46208      composeCompositionProperties(element);
46209    }
46210  }
46211
46212  protected void composeCompositionProperties(Composition element) throws IOException {
46213    composeDomainResourceProperties(element);
46214      if (element.hasUrlElement()) {
46215        composeUriCore("url", element.getUrlElement(), false);
46216        composeUriExtras("url", element.getUrlElement(), false);
46217      }
46218      if (element.hasIdentifier()) {
46219        openArray("identifier");
46220        for (Identifier e : element.getIdentifier()) 
46221          composeIdentifier(null, e);
46222        closeArray();
46223      };
46224      if (element.hasVersionElement()) {
46225        composeStringCore("version", element.getVersionElement(), false);
46226        composeStringExtras("version", element.getVersionElement(), false);
46227      }
46228      if (element.hasStatusElement()) {
46229        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
46230        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
46231      }
46232      if (element.hasType()) {
46233        composeCodeableConcept("type", element.getType());
46234      }
46235      if (element.hasCategory()) {
46236        openArray("category");
46237        for (CodeableConcept e : element.getCategory()) 
46238          composeCodeableConcept(null, e);
46239        closeArray();
46240      };
46241      if (element.hasSubject()) {
46242        openArray("subject");
46243        for (Reference e : element.getSubject()) 
46244          composeReference(null, e);
46245        closeArray();
46246      };
46247      if (element.hasEncounter()) {
46248        composeReference("encounter", element.getEncounter());
46249      }
46250      if (element.hasDateElement()) {
46251        composeDateTimeCore("date", element.getDateElement(), false);
46252        composeDateTimeExtras("date", element.getDateElement(), false);
46253      }
46254      if (element.hasUseContext()) {
46255        openArray("useContext");
46256        for (UsageContext e : element.getUseContext()) 
46257          composeUsageContext(null, e);
46258        closeArray();
46259      };
46260      if (element.hasAuthor()) {
46261        openArray("author");
46262        for (Reference e : element.getAuthor()) 
46263          composeReference(null, e);
46264        closeArray();
46265      };
46266      if (element.hasNameElement()) {
46267        composeStringCore("name", element.getNameElement(), false);
46268        composeStringExtras("name", element.getNameElement(), false);
46269      }
46270      if (element.hasTitleElement()) {
46271        composeStringCore("title", element.getTitleElement(), false);
46272        composeStringExtras("title", element.getTitleElement(), false);
46273      }
46274      if (element.hasNote()) {
46275        openArray("note");
46276        for (Annotation e : element.getNote()) 
46277          composeAnnotation(null, e);
46278        closeArray();
46279      };
46280      if (element.hasAttester()) {
46281        openArray("attester");
46282        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
46283          composeCompositionAttesterComponent(null, e);
46284        closeArray();
46285      };
46286      if (element.hasCustodian()) {
46287        composeReference("custodian", element.getCustodian());
46288      }
46289      if (element.hasRelatesTo()) {
46290        openArray("relatesTo");
46291        for (RelatedArtifact e : element.getRelatesTo()) 
46292          composeRelatedArtifact(null, e);
46293        closeArray();
46294      };
46295      if (element.hasEvent()) {
46296        openArray("event");
46297        for (Composition.CompositionEventComponent e : element.getEvent()) 
46298          composeCompositionEventComponent(null, e);
46299        closeArray();
46300      };
46301      if (element.hasSection()) {
46302        openArray("section");
46303        for (Composition.SectionComponent e : element.getSection()) 
46304          composeSectionComponent(null, e);
46305        closeArray();
46306      };
46307  }
46308
46309  protected void composeCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
46310    if (element != null) {
46311      open(name);
46312      composeCompositionAttesterComponentProperties(element);
46313      close();
46314    }
46315  }
46316
46317  protected void composeCompositionAttesterComponentProperties(Composition.CompositionAttesterComponent element) throws IOException {
46318    composeBackboneElementProperties(element);
46319      if (element.hasMode()) {
46320        composeCodeableConcept("mode", element.getMode());
46321      }
46322      if (element.hasTimeElement()) {
46323        composeDateTimeCore("time", element.getTimeElement(), false);
46324        composeDateTimeExtras("time", element.getTimeElement(), false);
46325      }
46326      if (element.hasParty()) {
46327        composeReference("party", element.getParty());
46328      }
46329  }
46330
46331  protected void composeCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
46332    if (element != null) {
46333      open(name);
46334      composeCompositionEventComponentProperties(element);
46335      close();
46336    }
46337  }
46338
46339  protected void composeCompositionEventComponentProperties(Composition.CompositionEventComponent element) throws IOException {
46340    composeBackboneElementProperties(element);
46341      if (element.hasPeriod()) {
46342        composePeriod("period", element.getPeriod());
46343      }
46344      if (element.hasDetail()) {
46345        openArray("detail");
46346        for (CodeableReference e : element.getDetail()) 
46347          composeCodeableReference(null, e);
46348        closeArray();
46349      };
46350  }
46351
46352  protected void composeSectionComponent(String name, Composition.SectionComponent element) throws IOException {
46353    if (element != null) {
46354      open(name);
46355      composeSectionComponentProperties(element);
46356      close();
46357    }
46358  }
46359
46360  protected void composeSectionComponentProperties(Composition.SectionComponent element) throws IOException {
46361    composeBackboneElementProperties(element);
46362      if (element.hasTitleElement()) {
46363        composeStringCore("title", element.getTitleElement(), false);
46364        composeStringExtras("title", element.getTitleElement(), false);
46365      }
46366      if (element.hasCode()) {
46367        composeCodeableConcept("code", element.getCode());
46368      }
46369      if (element.hasAuthor()) {
46370        openArray("author");
46371        for (Reference e : element.getAuthor()) 
46372          composeReference(null, e);
46373        closeArray();
46374      };
46375      if (element.hasFocus()) {
46376        composeReference("focus", element.getFocus());
46377      }
46378      if (element.hasText()) {
46379        composeNarrative("text", element.getText());
46380      }
46381      if (element.hasOrderedBy()) {
46382        composeCodeableConcept("orderedBy", element.getOrderedBy());
46383      }
46384      if (element.hasEntry()) {
46385        openArray("entry");
46386        for (Reference e : element.getEntry()) 
46387          composeReference(null, e);
46388        closeArray();
46389      };
46390      if (element.hasEmptyReason()) {
46391        composeCodeableConcept("emptyReason", element.getEmptyReason());
46392      }
46393      if (element.hasSection()) {
46394        openArray("section");
46395        for (Composition.SectionComponent e : element.getSection()) 
46396          composeSectionComponent(null, e);
46397        closeArray();
46398      };
46399  }
46400
46401  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
46402    if (element != null) {
46403      prop("resourceType", name);
46404      composeConceptMapProperties(element);
46405    }
46406  }
46407
46408  protected void composeConceptMapProperties(ConceptMap element) throws IOException {
46409    composeMetadataResourceProperties(element);
46410      if (element.hasUrlElement()) {
46411        composeUriCore("url", element.getUrlElement(), false);
46412        composeUriExtras("url", element.getUrlElement(), false);
46413      }
46414      if (element.hasIdentifier()) {
46415        openArray("identifier");
46416        for (Identifier e : element.getIdentifier()) 
46417          composeIdentifier(null, e);
46418        closeArray();
46419      };
46420      if (element.hasVersionElement()) {
46421        composeStringCore("version", element.getVersionElement(), false);
46422        composeStringExtras("version", element.getVersionElement(), false);
46423      }
46424      if (element.hasVersionAlgorithm()) {
46425        composeType("versionAlgorithm", element.getVersionAlgorithm());
46426      }
46427      if (element.hasNameElement()) {
46428        composeStringCore("name", element.getNameElement(), false);
46429        composeStringExtras("name", element.getNameElement(), false);
46430      }
46431      if (element.hasTitleElement()) {
46432        composeStringCore("title", element.getTitleElement(), false);
46433        composeStringExtras("title", element.getTitleElement(), false);
46434      }
46435      if (element.hasStatusElement()) {
46436        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46437        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46438      }
46439      if (element.hasExperimentalElement()) {
46440        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46441        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46442      }
46443      if (element.hasDateElement()) {
46444        composeDateTimeCore("date", element.getDateElement(), false);
46445        composeDateTimeExtras("date", element.getDateElement(), false);
46446      }
46447      if (element.hasPublisherElement()) {
46448        composeStringCore("publisher", element.getPublisherElement(), false);
46449        composeStringExtras("publisher", element.getPublisherElement(), false);
46450      }
46451      if (element.hasContact()) {
46452        openArray("contact");
46453        for (ContactDetail e : element.getContact()) 
46454          composeContactDetail(null, e);
46455        closeArray();
46456      };
46457      if (element.hasDescriptionElement()) {
46458        composeMarkdownCore("description", element.getDescriptionElement(), false);
46459        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46460      }
46461      if (element.hasUseContext()) {
46462        openArray("useContext");
46463        for (UsageContext e : element.getUseContext()) 
46464          composeUsageContext(null, e);
46465        closeArray();
46466      };
46467      if (element.hasJurisdiction()) {
46468        openArray("jurisdiction");
46469        for (CodeableConcept e : element.getJurisdiction()) 
46470          composeCodeableConcept(null, e);
46471        closeArray();
46472      };
46473      if (element.hasPurposeElement()) {
46474        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46475        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46476      }
46477      if (element.hasCopyrightElement()) {
46478        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46479        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46480      }
46481      if (element.hasCopyrightLabelElement()) {
46482        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
46483        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
46484      }
46485      if (element.hasApprovalDateElement()) {
46486        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
46487        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
46488      }
46489      if (element.hasLastReviewDateElement()) {
46490        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
46491        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
46492      }
46493      if (element.hasEffectivePeriod()) {
46494        composePeriod("effectivePeriod", element.getEffectivePeriod());
46495      }
46496      if (element.hasTopic()) {
46497        openArray("topic");
46498        for (CodeableConcept e : element.getTopic()) 
46499          composeCodeableConcept(null, e);
46500        closeArray();
46501      };
46502      if (element.hasAuthor()) {
46503        openArray("author");
46504        for (ContactDetail e : element.getAuthor()) 
46505          composeContactDetail(null, e);
46506        closeArray();
46507      };
46508      if (element.hasEditor()) {
46509        openArray("editor");
46510        for (ContactDetail e : element.getEditor()) 
46511          composeContactDetail(null, e);
46512        closeArray();
46513      };
46514      if (element.hasReviewer()) {
46515        openArray("reviewer");
46516        for (ContactDetail e : element.getReviewer()) 
46517          composeContactDetail(null, e);
46518        closeArray();
46519      };
46520      if (element.hasEndorser()) {
46521        openArray("endorser");
46522        for (ContactDetail e : element.getEndorser()) 
46523          composeContactDetail(null, e);
46524        closeArray();
46525      };
46526      if (element.hasRelatedArtifact()) {
46527        openArray("relatedArtifact");
46528        for (RelatedArtifact e : element.getRelatedArtifact()) 
46529          composeRelatedArtifact(null, e);
46530        closeArray();
46531      };
46532      if (element.hasProperty()) {
46533        openArray("property");
46534        for (ConceptMap.PropertyComponent e : element.getProperty()) 
46535          composePropertyComponent(null, e);
46536        closeArray();
46537      };
46538      if (element.hasAdditionalAttribute()) {
46539        openArray("additionalAttribute");
46540        for (ConceptMap.AdditionalAttributeComponent e : element.getAdditionalAttribute()) 
46541          composeAdditionalAttributeComponent(null, e);
46542        closeArray();
46543      };
46544      if (element.hasSourceScope()) {
46545        composeType("sourceScope", element.getSourceScope());
46546      }
46547      if (element.hasTargetScope()) {
46548        composeType("targetScope", element.getTargetScope());
46549      }
46550      if (element.hasGroup()) {
46551        openArray("group");
46552        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
46553          composeConceptMapGroupComponent(null, e);
46554        closeArray();
46555      };
46556  }
46557
46558  protected void composePropertyComponent(String name, ConceptMap.PropertyComponent element) throws IOException {
46559    if (element != null) {
46560      open(name);
46561      composePropertyComponentProperties(element);
46562      close();
46563    }
46564  }
46565
46566  protected void composePropertyComponentProperties(ConceptMap.PropertyComponent element) throws IOException {
46567    composeBackboneElementProperties(element);
46568      if (element.hasCodeElement()) {
46569        composeCodeCore("code", element.getCodeElement(), false);
46570        composeCodeExtras("code", element.getCodeElement(), false);
46571      }
46572      if (element.hasUriElement()) {
46573        composeUriCore("uri", element.getUriElement(), false);
46574        composeUriExtras("uri", element.getUriElement(), false);
46575      }
46576      if (element.hasDescriptionElement()) {
46577        composeStringCore("description", element.getDescriptionElement(), false);
46578        composeStringExtras("description", element.getDescriptionElement(), false);
46579      }
46580      if (element.hasTypeElement()) {
46581        composeEnumerationCore("type", element.getTypeElement(), new ConceptMap.ConceptMapPropertyTypeEnumFactory(), false);
46582        composeEnumerationExtras("type", element.getTypeElement(), new ConceptMap.ConceptMapPropertyTypeEnumFactory(), false);
46583      }
46584      if (element.hasSystemElement()) {
46585        composeCanonicalCore("system", element.getSystemElement(), false);
46586        composeCanonicalExtras("system", element.getSystemElement(), false);
46587      }
46588  }
46589
46590  protected void composeAdditionalAttributeComponent(String name, ConceptMap.AdditionalAttributeComponent element) throws IOException {
46591    if (element != null) {
46592      open(name);
46593      composeAdditionalAttributeComponentProperties(element);
46594      close();
46595    }
46596  }
46597
46598  protected void composeAdditionalAttributeComponentProperties(ConceptMap.AdditionalAttributeComponent element) throws IOException {
46599    composeBackboneElementProperties(element);
46600      if (element.hasCodeElement()) {
46601        composeCodeCore("code", element.getCodeElement(), false);
46602        composeCodeExtras("code", element.getCodeElement(), false);
46603      }
46604      if (element.hasUriElement()) {
46605        composeUriCore("uri", element.getUriElement(), false);
46606        composeUriExtras("uri", element.getUriElement(), false);
46607      }
46608      if (element.hasDescriptionElement()) {
46609        composeStringCore("description", element.getDescriptionElement(), false);
46610        composeStringExtras("description", element.getDescriptionElement(), false);
46611      }
46612      if (element.hasTypeElement()) {
46613        composeEnumerationCore("type", element.getTypeElement(), new ConceptMap.ConceptMapAttributeTypeEnumFactory(), false);
46614        composeEnumerationExtras("type", element.getTypeElement(), new ConceptMap.ConceptMapAttributeTypeEnumFactory(), false);
46615      }
46616  }
46617
46618  protected void composeConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
46619    if (element != null) {
46620      open(name);
46621      composeConceptMapGroupComponentProperties(element);
46622      close();
46623    }
46624  }
46625
46626  protected void composeConceptMapGroupComponentProperties(ConceptMap.ConceptMapGroupComponent element) throws IOException {
46627    composeBackboneElementProperties(element);
46628      if (element.hasSourceElement()) {
46629        composeCanonicalCore("source", element.getSourceElement(), false);
46630        composeCanonicalExtras("source", element.getSourceElement(), false);
46631      }
46632      if (element.hasTargetElement()) {
46633        composeCanonicalCore("target", element.getTargetElement(), false);
46634        composeCanonicalExtras("target", element.getTargetElement(), false);
46635      }
46636      if (element.hasElement()) {
46637        openArray("element");
46638        for (ConceptMap.SourceElementComponent e : element.getElement()) 
46639          composeSourceElementComponent(null, e);
46640        closeArray();
46641      };
46642      if (element.hasUnmapped()) {
46643        composeConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
46644      }
46645  }
46646
46647  protected void composeSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
46648    if (element != null) {
46649      open(name);
46650      composeSourceElementComponentProperties(element);
46651      close();
46652    }
46653  }
46654
46655  protected void composeSourceElementComponentProperties(ConceptMap.SourceElementComponent element) throws IOException {
46656    composeBackboneElementProperties(element);
46657      if (element.hasCodeElement()) {
46658        composeCodeCore("code", element.getCodeElement(), false);
46659        composeCodeExtras("code", element.getCodeElement(), false);
46660      }
46661      if (element.hasDisplayElement()) {
46662        composeStringCore("display", element.getDisplayElement(), false);
46663        composeStringExtras("display", element.getDisplayElement(), false);
46664      }
46665      if (element.hasValueSetElement()) {
46666        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46667        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46668      }
46669      if (element.hasNoMapElement()) {
46670        composeBooleanCore("noMap", element.getNoMapElement(), false);
46671        composeBooleanExtras("noMap", element.getNoMapElement(), false);
46672      }
46673      if (element.hasTarget()) {
46674        openArray("target");
46675        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
46676          composeTargetElementComponent(null, e);
46677        closeArray();
46678      };
46679  }
46680
46681  protected void composeTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
46682    if (element != null) {
46683      open(name);
46684      composeTargetElementComponentProperties(element);
46685      close();
46686    }
46687  }
46688
46689  protected void composeTargetElementComponentProperties(ConceptMap.TargetElementComponent element) throws IOException {
46690    composeBackboneElementProperties(element);
46691      if (element.hasCodeElement()) {
46692        composeCodeCore("code", element.getCodeElement(), false);
46693        composeCodeExtras("code", element.getCodeElement(), false);
46694      }
46695      if (element.hasDisplayElement()) {
46696        composeStringCore("display", element.getDisplayElement(), false);
46697        composeStringExtras("display", element.getDisplayElement(), false);
46698      }
46699      if (element.hasValueSetElement()) {
46700        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46701        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46702      }
46703      if (element.hasRelationshipElement()) {
46704        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46705        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46706      }
46707      if (element.hasCommentElement()) {
46708        composeStringCore("comment", element.getCommentElement(), false);
46709        composeStringExtras("comment", element.getCommentElement(), false);
46710      }
46711      if (element.hasProperty()) {
46712        openArray("property");
46713        for (ConceptMap.MappingPropertyComponent e : element.getProperty()) 
46714          composeMappingPropertyComponent(null, e);
46715        closeArray();
46716      };
46717      if (element.hasDependsOn()) {
46718        openArray("dependsOn");
46719        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
46720          composeOtherElementComponent(null, e);
46721        closeArray();
46722      };
46723      if (element.hasProduct()) {
46724        openArray("product");
46725        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
46726          composeOtherElementComponent(null, e);
46727        closeArray();
46728      };
46729  }
46730
46731  protected void composeMappingPropertyComponent(String name, ConceptMap.MappingPropertyComponent element) throws IOException {
46732    if (element != null) {
46733      open(name);
46734      composeMappingPropertyComponentProperties(element);
46735      close();
46736    }
46737  }
46738
46739  protected void composeMappingPropertyComponentProperties(ConceptMap.MappingPropertyComponent element) throws IOException {
46740    composeBackboneElementProperties(element);
46741      if (element.hasCodeElement()) {
46742        composeCodeCore("code", element.getCodeElement(), false);
46743        composeCodeExtras("code", element.getCodeElement(), false);
46744      }
46745      if (element.hasValue()) {
46746        composeType("value", element.getValue());
46747      }
46748  }
46749
46750  protected void composeOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
46751    if (element != null) {
46752      open(name);
46753      composeOtherElementComponentProperties(element);
46754      close();
46755    }
46756  }
46757
46758  protected void composeOtherElementComponentProperties(ConceptMap.OtherElementComponent element) throws IOException {
46759    composeBackboneElementProperties(element);
46760      if (element.hasAttributeElement()) {
46761        composeCodeCore("attribute", element.getAttributeElement(), false);
46762        composeCodeExtras("attribute", element.getAttributeElement(), false);
46763      }
46764      if (element.hasValue()) {
46765        composeType("value", element.getValue());
46766      }
46767      if (element.hasValueSetElement()) {
46768        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46769        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46770      }
46771  }
46772
46773  protected void composeConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
46774    if (element != null) {
46775      open(name);
46776      composeConceptMapGroupUnmappedComponentProperties(element);
46777      close();
46778    }
46779  }
46780
46781  protected void composeConceptMapGroupUnmappedComponentProperties(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
46782    composeBackboneElementProperties(element);
46783      if (element.hasModeElement()) {
46784        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
46785        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
46786      }
46787      if (element.hasCodeElement()) {
46788        composeCodeCore("code", element.getCodeElement(), false);
46789        composeCodeExtras("code", element.getCodeElement(), false);
46790      }
46791      if (element.hasDisplayElement()) {
46792        composeStringCore("display", element.getDisplayElement(), false);
46793        composeStringExtras("display", element.getDisplayElement(), false);
46794      }
46795      if (element.hasValueSetElement()) {
46796        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46797        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46798      }
46799      if (element.hasRelationshipElement()) {
46800        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46801        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46802      }
46803      if (element.hasOtherMapElement()) {
46804        composeCanonicalCore("otherMap", element.getOtherMapElement(), false);
46805        composeCanonicalExtras("otherMap", element.getOtherMapElement(), false);
46806      }
46807  }
46808
46809  protected void composeCondition(String name, Condition element) throws IOException {
46810    if (element != null) {
46811      prop("resourceType", name);
46812      composeConditionProperties(element);
46813    }
46814  }
46815
46816  protected void composeConditionProperties(Condition element) throws IOException {
46817    composeDomainResourceProperties(element);
46818      if (element.hasIdentifier()) {
46819        openArray("identifier");
46820        for (Identifier e : element.getIdentifier()) 
46821          composeIdentifier(null, e);
46822        closeArray();
46823      };
46824      if (element.hasClinicalStatus()) {
46825        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
46826      }
46827      if (element.hasVerificationStatus()) {
46828        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
46829      }
46830      if (element.hasCategory()) {
46831        openArray("category");
46832        for (CodeableConcept e : element.getCategory()) 
46833          composeCodeableConcept(null, e);
46834        closeArray();
46835      };
46836      if (element.hasSeverity()) {
46837        composeCodeableConcept("severity", element.getSeverity());
46838      }
46839      if (element.hasCode()) {
46840        composeCodeableConcept("code", element.getCode());
46841      }
46842      if (element.hasBodySite()) {
46843        openArray("bodySite");
46844        for (CodeableConcept e : element.getBodySite()) 
46845          composeCodeableConcept(null, e);
46846        closeArray();
46847      };
46848      if (element.hasSubject()) {
46849        composeReference("subject", element.getSubject());
46850      }
46851      if (element.hasEncounter()) {
46852        composeReference("encounter", element.getEncounter());
46853      }
46854      if (element.hasOnset()) {
46855        composeType("onset", element.getOnset());
46856      }
46857      if (element.hasAbatement()) {
46858        composeType("abatement", element.getAbatement());
46859      }
46860      if (element.hasRecordedDateElement()) {
46861        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
46862        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
46863      }
46864      if (element.hasParticipant()) {
46865        openArray("participant");
46866        for (Condition.ConditionParticipantComponent e : element.getParticipant()) 
46867          composeConditionParticipantComponent(null, e);
46868        closeArray();
46869      };
46870      if (element.hasStage()) {
46871        openArray("stage");
46872        for (Condition.ConditionStageComponent e : element.getStage()) 
46873          composeConditionStageComponent(null, e);
46874        closeArray();
46875      };
46876      if (element.hasEvidence()) {
46877        openArray("evidence");
46878        for (CodeableReference e : element.getEvidence()) 
46879          composeCodeableReference(null, e);
46880        closeArray();
46881      };
46882      if (element.hasNote()) {
46883        openArray("note");
46884        for (Annotation e : element.getNote()) 
46885          composeAnnotation(null, e);
46886        closeArray();
46887      };
46888  }
46889
46890  protected void composeConditionParticipantComponent(String name, Condition.ConditionParticipantComponent element) throws IOException {
46891    if (element != null) {
46892      open(name);
46893      composeConditionParticipantComponentProperties(element);
46894      close();
46895    }
46896  }
46897
46898  protected void composeConditionParticipantComponentProperties(Condition.ConditionParticipantComponent element) throws IOException {
46899    composeBackboneElementProperties(element);
46900      if (element.hasFunction()) {
46901        composeCodeableConcept("function", element.getFunction());
46902      }
46903      if (element.hasActor()) {
46904        composeReference("actor", element.getActor());
46905      }
46906  }
46907
46908  protected void composeConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
46909    if (element != null) {
46910      open(name);
46911      composeConditionStageComponentProperties(element);
46912      close();
46913    }
46914  }
46915
46916  protected void composeConditionStageComponentProperties(Condition.ConditionStageComponent element) throws IOException {
46917    composeBackboneElementProperties(element);
46918      if (element.hasSummary()) {
46919        composeCodeableConcept("summary", element.getSummary());
46920      }
46921      if (element.hasAssessment()) {
46922        openArray("assessment");
46923        for (Reference e : element.getAssessment()) 
46924          composeReference(null, e);
46925        closeArray();
46926      };
46927      if (element.hasType()) {
46928        composeCodeableConcept("type", element.getType());
46929      }
46930  }
46931
46932  protected void composeConditionDefinition(String name, ConditionDefinition element) throws IOException {
46933    if (element != null) {
46934      prop("resourceType", name);
46935      composeConditionDefinitionProperties(element);
46936    }
46937  }
46938
46939  protected void composeConditionDefinitionProperties(ConditionDefinition element) throws IOException {
46940    composeMetadataResourceProperties(element);
46941      if (element.hasUrlElement()) {
46942        composeUriCore("url", element.getUrlElement(), false);
46943        composeUriExtras("url", element.getUrlElement(), false);
46944      }
46945      if (element.hasIdentifier()) {
46946        openArray("identifier");
46947        for (Identifier e : element.getIdentifier()) 
46948          composeIdentifier(null, e);
46949        closeArray();
46950      };
46951      if (element.hasVersionElement()) {
46952        composeStringCore("version", element.getVersionElement(), false);
46953        composeStringExtras("version", element.getVersionElement(), false);
46954      }
46955      if (element.hasVersionAlgorithm()) {
46956        composeType("versionAlgorithm", element.getVersionAlgorithm());
46957      }
46958      if (element.hasNameElement()) {
46959        composeStringCore("name", element.getNameElement(), false);
46960        composeStringExtras("name", element.getNameElement(), false);
46961      }
46962      if (element.hasTitleElement()) {
46963        composeStringCore("title", element.getTitleElement(), false);
46964        composeStringExtras("title", element.getTitleElement(), false);
46965      }
46966      if (element.hasSubtitleElement()) {
46967        composeStringCore("subtitle", element.getSubtitleElement(), false);
46968        composeStringExtras("subtitle", element.getSubtitleElement(), false);
46969      }
46970      if (element.hasStatusElement()) {
46971        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46972        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46973      }
46974      if (element.hasExperimentalElement()) {
46975        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46976        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46977      }
46978      if (element.hasDateElement()) {
46979        composeDateTimeCore("date", element.getDateElement(), false);
46980        composeDateTimeExtras("date", element.getDateElement(), false);
46981      }
46982      if (element.hasPublisherElement()) {
46983        composeStringCore("publisher", element.getPublisherElement(), false);
46984        composeStringExtras("publisher", element.getPublisherElement(), false);
46985      }
46986      if (element.hasContact()) {
46987        openArray("contact");
46988        for (ContactDetail e : element.getContact()) 
46989          composeContactDetail(null, e);
46990        closeArray();
46991      };
46992      if (element.hasDescriptionElement()) {
46993        composeMarkdownCore("description", element.getDescriptionElement(), false);
46994        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46995      }
46996      if (element.hasUseContext()) {
46997        openArray("useContext");
46998        for (UsageContext e : element.getUseContext()) 
46999          composeUsageContext(null, e);
47000        closeArray();
47001      };
47002      if (element.hasJurisdiction()) {
47003        openArray("jurisdiction");
47004        for (CodeableConcept e : element.getJurisdiction()) 
47005          composeCodeableConcept(null, e);
47006        closeArray();
47007      };
47008      if (element.hasCode()) {
47009        composeCodeableConcept("code", element.getCode());
47010      }
47011      if (element.hasSeverity()) {
47012        composeCodeableConcept("severity", element.getSeverity());
47013      }
47014      if (element.hasBodySite()) {
47015        composeCodeableConcept("bodySite", element.getBodySite());
47016      }
47017      if (element.hasStage()) {
47018        composeCodeableConcept("stage", element.getStage());
47019      }
47020      if (element.hasHasSeverityElement()) {
47021        composeBooleanCore("hasSeverity", element.getHasSeverityElement(), false);
47022        composeBooleanExtras("hasSeverity", element.getHasSeverityElement(), false);
47023      }
47024      if (element.hasHasBodySiteElement()) {
47025        composeBooleanCore("hasBodySite", element.getHasBodySiteElement(), false);
47026        composeBooleanExtras("hasBodySite", element.getHasBodySiteElement(), false);
47027      }
47028      if (element.hasHasStageElement()) {
47029        composeBooleanCore("hasStage", element.getHasStageElement(), false);
47030        composeBooleanExtras("hasStage", element.getHasStageElement(), false);
47031      }
47032      if (element.hasDefinition()) {
47033        if (anyHasValue(element.getDefinition())) {
47034          openArray("definition");
47035          for (UriType e : element.getDefinition()) 
47036            composeUriCore(null, e, e != element.getDefinition().get(element.getDefinition().size()-1));
47037          closeArray();
47038        }
47039        if (anyHasExtras(element.getDefinition())) {
47040          openArray("_definition");
47041          for (UriType e : element.getDefinition()) 
47042            composeUriExtras(null, e, true);
47043          closeArray();
47044        }
47045      };
47046      if (element.hasObservation()) {
47047        openArray("observation");
47048        for (ConditionDefinition.ConditionDefinitionObservationComponent e : element.getObservation()) 
47049          composeConditionDefinitionObservationComponent(null, e);
47050        closeArray();
47051      };
47052      if (element.hasMedication()) {
47053        openArray("medication");
47054        for (ConditionDefinition.ConditionDefinitionMedicationComponent e : element.getMedication()) 
47055          composeConditionDefinitionMedicationComponent(null, e);
47056        closeArray();
47057      };
47058      if (element.hasPrecondition()) {
47059        openArray("precondition");
47060        for (ConditionDefinition.ConditionDefinitionPreconditionComponent e : element.getPrecondition()) 
47061          composeConditionDefinitionPreconditionComponent(null, e);
47062        closeArray();
47063      };
47064      if (element.hasTeam()) {
47065        openArray("team");
47066        for (Reference e : element.getTeam()) 
47067          composeReference(null, e);
47068        closeArray();
47069      };
47070      if (element.hasQuestionnaire()) {
47071        openArray("questionnaire");
47072        for (ConditionDefinition.ConditionDefinitionQuestionnaireComponent e : element.getQuestionnaire()) 
47073          composeConditionDefinitionQuestionnaireComponent(null, e);
47074        closeArray();
47075      };
47076      if (element.hasPlan()) {
47077        openArray("plan");
47078        for (ConditionDefinition.ConditionDefinitionPlanComponent e : element.getPlan()) 
47079          composeConditionDefinitionPlanComponent(null, e);
47080        closeArray();
47081      };
47082  }
47083
47084  protected void composeConditionDefinitionObservationComponent(String name, ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
47085    if (element != null) {
47086      open(name);
47087      composeConditionDefinitionObservationComponentProperties(element);
47088      close();
47089    }
47090  }
47091
47092  protected void composeConditionDefinitionObservationComponentProperties(ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
47093    composeBackboneElementProperties(element);
47094      if (element.hasCategory()) {
47095        composeCodeableConcept("category", element.getCategory());
47096      }
47097      if (element.hasCode()) {
47098        composeCodeableConcept("code", element.getCode());
47099      }
47100  }
47101
47102  protected void composeConditionDefinitionMedicationComponent(String name, ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
47103    if (element != null) {
47104      open(name);
47105      composeConditionDefinitionMedicationComponentProperties(element);
47106      close();
47107    }
47108  }
47109
47110  protected void composeConditionDefinitionMedicationComponentProperties(ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
47111    composeBackboneElementProperties(element);
47112      if (element.hasCategory()) {
47113        composeCodeableConcept("category", element.getCategory());
47114      }
47115      if (element.hasCode()) {
47116        composeCodeableConcept("code", element.getCode());
47117      }
47118  }
47119
47120  protected void composeConditionDefinitionPreconditionComponent(String name, ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
47121    if (element != null) {
47122      open(name);
47123      composeConditionDefinitionPreconditionComponentProperties(element);
47124      close();
47125    }
47126  }
47127
47128  protected void composeConditionDefinitionPreconditionComponentProperties(ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
47129    composeBackboneElementProperties(element);
47130      if (element.hasTypeElement()) {
47131        composeEnumerationCore("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
47132        composeEnumerationExtras("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
47133      }
47134      if (element.hasCode()) {
47135        composeCodeableConcept("code", element.getCode());
47136      }
47137      if (element.hasValue()) {
47138        composeType("value", element.getValue());
47139      }
47140  }
47141
47142  protected void composeConditionDefinitionQuestionnaireComponent(String name, ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
47143    if (element != null) {
47144      open(name);
47145      composeConditionDefinitionQuestionnaireComponentProperties(element);
47146      close();
47147    }
47148  }
47149
47150  protected void composeConditionDefinitionQuestionnaireComponentProperties(ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
47151    composeBackboneElementProperties(element);
47152      if (element.hasPurposeElement()) {
47153        composeEnumerationCore("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
47154        composeEnumerationExtras("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
47155      }
47156      if (element.hasReference()) {
47157        composeReference("reference", element.getReference());
47158      }
47159  }
47160
47161  protected void composeConditionDefinitionPlanComponent(String name, ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
47162    if (element != null) {
47163      open(name);
47164      composeConditionDefinitionPlanComponentProperties(element);
47165      close();
47166    }
47167  }
47168
47169  protected void composeConditionDefinitionPlanComponentProperties(ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
47170    composeBackboneElementProperties(element);
47171      if (element.hasRole()) {
47172        composeCodeableConcept("role", element.getRole());
47173      }
47174      if (element.hasReference()) {
47175        composeReference("reference", element.getReference());
47176      }
47177  }
47178
47179  protected void composeConsent(String name, Consent element) throws IOException {
47180    if (element != null) {
47181      prop("resourceType", name);
47182      composeConsentProperties(element);
47183    }
47184  }
47185
47186  protected void composeConsentProperties(Consent element) throws IOException {
47187    composeDomainResourceProperties(element);
47188      if (element.hasIdentifier()) {
47189        openArray("identifier");
47190        for (Identifier e : element.getIdentifier()) 
47191          composeIdentifier(null, e);
47192        closeArray();
47193      };
47194      if (element.hasStatusElement()) {
47195        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
47196        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
47197      }
47198      if (element.hasCategory()) {
47199        openArray("category");
47200        for (CodeableConcept e : element.getCategory()) 
47201          composeCodeableConcept(null, e);
47202        closeArray();
47203      };
47204      if (element.hasSubject()) {
47205        composeReference("subject", element.getSubject());
47206      }
47207      if (element.hasDateElement()) {
47208        composeDateCore("date", element.getDateElement(), false);
47209        composeDateExtras("date", element.getDateElement(), false);
47210      }
47211      if (element.hasPeriod()) {
47212        composePeriod("period", element.getPeriod());
47213      }
47214      if (element.hasGrantor()) {
47215        openArray("grantor");
47216        for (Reference e : element.getGrantor()) 
47217          composeReference(null, e);
47218        closeArray();
47219      };
47220      if (element.hasGrantee()) {
47221        openArray("grantee");
47222        for (Reference e : element.getGrantee()) 
47223          composeReference(null, e);
47224        closeArray();
47225      };
47226      if (element.hasManager()) {
47227        openArray("manager");
47228        for (Reference e : element.getManager()) 
47229          composeReference(null, e);
47230        closeArray();
47231      };
47232      if (element.hasController()) {
47233        openArray("controller");
47234        for (Reference e : element.getController()) 
47235          composeReference(null, e);
47236        closeArray();
47237      };
47238      if (element.hasSourceAttachment()) {
47239        openArray("sourceAttachment");
47240        for (Attachment e : element.getSourceAttachment()) 
47241          composeAttachment(null, e);
47242        closeArray();
47243      };
47244      if (element.hasSourceReference()) {
47245        openArray("sourceReference");
47246        for (Reference e : element.getSourceReference()) 
47247          composeReference(null, e);
47248        closeArray();
47249      };
47250      if (element.hasRegulatoryBasis()) {
47251        openArray("regulatoryBasis");
47252        for (CodeableConcept e : element.getRegulatoryBasis()) 
47253          composeCodeableConcept(null, e);
47254        closeArray();
47255      };
47256      if (element.hasPolicyBasis()) {
47257        composeConsentPolicyBasisComponent("policyBasis", element.getPolicyBasis());
47258      }
47259      if (element.hasPolicyText()) {
47260        openArray("policyText");
47261        for (Reference e : element.getPolicyText()) 
47262          composeReference(null, e);
47263        closeArray();
47264      };
47265      if (element.hasVerification()) {
47266        openArray("verification");
47267        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
47268          composeConsentVerificationComponent(null, e);
47269        closeArray();
47270      };
47271      if (element.hasDecisionElement()) {
47272        composeEnumerationCore("decision", element.getDecisionElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
47273        composeEnumerationExtras("decision", element.getDecisionElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
47274      }
47275      if (element.hasProvision()) {
47276        openArray("provision");
47277        for (Consent.ProvisionComponent e : element.getProvision()) 
47278          composeProvisionComponent(null, e);
47279        closeArray();
47280      };
47281  }
47282
47283  protected void composeConsentPolicyBasisComponent(String name, Consent.ConsentPolicyBasisComponent element) throws IOException {
47284    if (element != null) {
47285      open(name);
47286      composeConsentPolicyBasisComponentProperties(element);
47287      close();
47288    }
47289  }
47290
47291  protected void composeConsentPolicyBasisComponentProperties(Consent.ConsentPolicyBasisComponent element) throws IOException {
47292    composeBackboneElementProperties(element);
47293      if (element.hasReference()) {
47294        composeReference("reference", element.getReference());
47295      }
47296      if (element.hasUrlElement()) {
47297        composeUrlCore("url", element.getUrlElement(), false);
47298        composeUrlExtras("url", element.getUrlElement(), false);
47299      }
47300  }
47301
47302  protected void composeConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
47303    if (element != null) {
47304      open(name);
47305      composeConsentVerificationComponentProperties(element);
47306      close();
47307    }
47308  }
47309
47310  protected void composeConsentVerificationComponentProperties(Consent.ConsentVerificationComponent element) throws IOException {
47311    composeBackboneElementProperties(element);
47312      if (element.hasVerifiedElement()) {
47313        composeBooleanCore("verified", element.getVerifiedElement(), false);
47314        composeBooleanExtras("verified", element.getVerifiedElement(), false);
47315      }
47316      if (element.hasVerificationType()) {
47317        composeCodeableConcept("verificationType", element.getVerificationType());
47318      }
47319      if (element.hasVerifiedBy()) {
47320        composeReference("verifiedBy", element.getVerifiedBy());
47321      }
47322      if (element.hasVerifiedWith()) {
47323        composeReference("verifiedWith", element.getVerifiedWith());
47324      }
47325      if (element.hasVerificationDate()) {
47326        if (anyHasValue(element.getVerificationDate())) {
47327          openArray("verificationDate");
47328          for (DateTimeType e : element.getVerificationDate()) 
47329            composeDateTimeCore(null, e, e != element.getVerificationDate().get(element.getVerificationDate().size()-1));
47330          closeArray();
47331        }
47332        if (anyHasExtras(element.getVerificationDate())) {
47333          openArray("_verificationDate");
47334          for (DateTimeType e : element.getVerificationDate()) 
47335            composeDateTimeExtras(null, e, true);
47336          closeArray();
47337        }
47338      };
47339  }
47340
47341  protected void composeProvisionComponent(String name, Consent.ProvisionComponent element) throws IOException {
47342    if (element != null) {
47343      open(name);
47344      composeProvisionComponentProperties(element);
47345      close();
47346    }
47347  }
47348
47349  protected void composeProvisionComponentProperties(Consent.ProvisionComponent element) throws IOException {
47350    composeBackboneElementProperties(element);
47351      if (element.hasPeriod()) {
47352        composePeriod("period", element.getPeriod());
47353      }
47354      if (element.hasActor()) {
47355        openArray("actor");
47356        for (Consent.ProvisionActorComponent e : element.getActor()) 
47357          composeProvisionActorComponent(null, e);
47358        closeArray();
47359      };
47360      if (element.hasAction()) {
47361        openArray("action");
47362        for (CodeableConcept e : element.getAction()) 
47363          composeCodeableConcept(null, e);
47364        closeArray();
47365      };
47366      if (element.hasSecurityLabel()) {
47367        openArray("securityLabel");
47368        for (Coding e : element.getSecurityLabel()) 
47369          composeCoding(null, e);
47370        closeArray();
47371      };
47372      if (element.hasPurpose()) {
47373        openArray("purpose");
47374        for (Coding e : element.getPurpose()) 
47375          composeCoding(null, e);
47376        closeArray();
47377      };
47378      if (element.hasDocumentType()) {
47379        openArray("documentType");
47380        for (Coding e : element.getDocumentType()) 
47381          composeCoding(null, e);
47382        closeArray();
47383      };
47384      if (element.hasResourceType()) {
47385        openArray("resourceType");
47386        for (Coding e : element.getResourceType()) 
47387          composeCoding(null, e);
47388        closeArray();
47389      };
47390      if (element.hasCode()) {
47391        openArray("code");
47392        for (CodeableConcept e : element.getCode()) 
47393          composeCodeableConcept(null, e);
47394        closeArray();
47395      };
47396      if (element.hasDataPeriod()) {
47397        composePeriod("dataPeriod", element.getDataPeriod());
47398      }
47399      if (element.hasData()) {
47400        openArray("data");
47401        for (Consent.ProvisionDataComponent e : element.getData()) 
47402          composeProvisionDataComponent(null, e);
47403        closeArray();
47404      };
47405      if (element.hasExpression()) {
47406        composeExpression("expression", element.getExpression());
47407      }
47408      if (element.hasProvision()) {
47409        openArray("provision");
47410        for (Consent.ProvisionComponent e : element.getProvision()) 
47411          composeProvisionComponent(null, e);
47412        closeArray();
47413      };
47414  }
47415
47416  protected void composeProvisionActorComponent(String name, Consent.ProvisionActorComponent element) throws IOException {
47417    if (element != null) {
47418      open(name);
47419      composeProvisionActorComponentProperties(element);
47420      close();
47421    }
47422  }
47423
47424  protected void composeProvisionActorComponentProperties(Consent.ProvisionActorComponent element) throws IOException {
47425    composeBackboneElementProperties(element);
47426      if (element.hasRole()) {
47427        composeCodeableConcept("role", element.getRole());
47428      }
47429      if (element.hasReference()) {
47430        composeReference("reference", element.getReference());
47431      }
47432  }
47433
47434  protected void composeProvisionDataComponent(String name, Consent.ProvisionDataComponent element) throws IOException {
47435    if (element != null) {
47436      open(name);
47437      composeProvisionDataComponentProperties(element);
47438      close();
47439    }
47440  }
47441
47442  protected void composeProvisionDataComponentProperties(Consent.ProvisionDataComponent element) throws IOException {
47443    composeBackboneElementProperties(element);
47444      if (element.hasMeaningElement()) {
47445        composeEnumerationCore("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
47446        composeEnumerationExtras("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
47447      }
47448      if (element.hasReference()) {
47449        composeReference("reference", element.getReference());
47450      }
47451  }
47452
47453  protected void composeContract(String name, Contract element) throws IOException {
47454    if (element != null) {
47455      prop("resourceType", name);
47456      composeContractProperties(element);
47457    }
47458  }
47459
47460  protected void composeContractProperties(Contract element) throws IOException {
47461    composeDomainResourceProperties(element);
47462      if (element.hasIdentifier()) {
47463        openArray("identifier");
47464        for (Identifier e : element.getIdentifier()) 
47465          composeIdentifier(null, e);
47466        closeArray();
47467      };
47468      if (element.hasUrlElement()) {
47469        composeUriCore("url", element.getUrlElement(), false);
47470        composeUriExtras("url", element.getUrlElement(), false);
47471      }
47472      if (element.hasVersionElement()) {
47473        composeStringCore("version", element.getVersionElement(), false);
47474        composeStringExtras("version", element.getVersionElement(), false);
47475      }
47476      if (element.hasStatusElement()) {
47477        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
47478        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
47479      }
47480      if (element.hasLegalState()) {
47481        composeCodeableConcept("legalState", element.getLegalState());
47482      }
47483      if (element.hasInstantiatesCanonical()) {
47484        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
47485      }
47486      if (element.hasInstantiatesUriElement()) {
47487        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
47488        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
47489      }
47490      if (element.hasContentDerivative()) {
47491        composeCodeableConcept("contentDerivative", element.getContentDerivative());
47492      }
47493      if (element.hasIssuedElement()) {
47494        composeDateTimeCore("issued", element.getIssuedElement(), false);
47495        composeDateTimeExtras("issued", element.getIssuedElement(), false);
47496      }
47497      if (element.hasApplies()) {
47498        composePeriod("applies", element.getApplies());
47499      }
47500      if (element.hasExpirationType()) {
47501        composeCodeableConcept("expirationType", element.getExpirationType());
47502      }
47503      if (element.hasSubject()) {
47504        openArray("subject");
47505        for (Reference e : element.getSubject()) 
47506          composeReference(null, e);
47507        closeArray();
47508      };
47509      if (element.hasAuthority()) {
47510        openArray("authority");
47511        for (Reference e : element.getAuthority()) 
47512          composeReference(null, e);
47513        closeArray();
47514      };
47515      if (element.hasDomain()) {
47516        openArray("domain");
47517        for (Reference e : element.getDomain()) 
47518          composeReference(null, e);
47519        closeArray();
47520      };
47521      if (element.hasSite()) {
47522        openArray("site");
47523        for (Reference e : element.getSite()) 
47524          composeReference(null, e);
47525        closeArray();
47526      };
47527      if (element.hasNameElement()) {
47528        composeStringCore("name", element.getNameElement(), false);
47529        composeStringExtras("name", element.getNameElement(), false);
47530      }
47531      if (element.hasTitleElement()) {
47532        composeStringCore("title", element.getTitleElement(), false);
47533        composeStringExtras("title", element.getTitleElement(), false);
47534      }
47535      if (element.hasSubtitleElement()) {
47536        composeStringCore("subtitle", element.getSubtitleElement(), false);
47537        composeStringExtras("subtitle", element.getSubtitleElement(), false);
47538      }
47539      if (element.hasAlias()) {
47540        if (anyHasValue(element.getAlias())) {
47541          openArray("alias");
47542          for (StringType e : element.getAlias()) 
47543            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
47544          closeArray();
47545        }
47546        if (anyHasExtras(element.getAlias())) {
47547          openArray("_alias");
47548          for (StringType e : element.getAlias()) 
47549            composeStringExtras(null, e, true);
47550          closeArray();
47551        }
47552      };
47553      if (element.hasAuthor()) {
47554        composeReference("author", element.getAuthor());
47555      }
47556      if (element.hasScope()) {
47557        composeCodeableConcept("scope", element.getScope());
47558      }
47559      if (element.hasTopic()) {
47560        composeType("topic", element.getTopic());
47561      }
47562      if (element.hasType()) {
47563        composeCodeableConcept("type", element.getType());
47564      }
47565      if (element.hasSubType()) {
47566        openArray("subType");
47567        for (CodeableConcept e : element.getSubType()) 
47568          composeCodeableConcept(null, e);
47569        closeArray();
47570      };
47571      if (element.hasContentDefinition()) {
47572        composeContentDefinitionComponent("contentDefinition", element.getContentDefinition());
47573      }
47574      if (element.hasTerm()) {
47575        openArray("term");
47576        for (Contract.TermComponent e : element.getTerm()) 
47577          composeTermComponent(null, e);
47578        closeArray();
47579      };
47580      if (element.hasSupportingInfo()) {
47581        openArray("supportingInfo");
47582        for (Reference e : element.getSupportingInfo()) 
47583          composeReference(null, e);
47584        closeArray();
47585      };
47586      if (element.hasRelevantHistory()) {
47587        openArray("relevantHistory");
47588        for (Reference e : element.getRelevantHistory()) 
47589          composeReference(null, e);
47590        closeArray();
47591      };
47592      if (element.hasSigner()) {
47593        openArray("signer");
47594        for (Contract.SignatoryComponent e : element.getSigner()) 
47595          composeSignatoryComponent(null, e);
47596        closeArray();
47597      };
47598      if (element.hasFriendly()) {
47599        openArray("friendly");
47600        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
47601          composeFriendlyLanguageComponent(null, e);
47602        closeArray();
47603      };
47604      if (element.hasLegal()) {
47605        openArray("legal");
47606        for (Contract.LegalLanguageComponent e : element.getLegal()) 
47607          composeLegalLanguageComponent(null, e);
47608        closeArray();
47609      };
47610      if (element.hasRule()) {
47611        openArray("rule");
47612        for (Contract.ComputableLanguageComponent e : element.getRule()) 
47613          composeComputableLanguageComponent(null, e);
47614        closeArray();
47615      };
47616      if (element.hasLegallyBinding()) {
47617        composeType("legallyBinding", element.getLegallyBinding());
47618      }
47619  }
47620
47621  protected void composeContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
47622    if (element != null) {
47623      open(name);
47624      composeContentDefinitionComponentProperties(element);
47625      close();
47626    }
47627  }
47628
47629  protected void composeContentDefinitionComponentProperties(Contract.ContentDefinitionComponent element) throws IOException {
47630    composeBackboneElementProperties(element);
47631      if (element.hasType()) {
47632        composeCodeableConcept("type", element.getType());
47633      }
47634      if (element.hasSubType()) {
47635        composeCodeableConcept("subType", element.getSubType());
47636      }
47637      if (element.hasPublisher()) {
47638        composeReference("publisher", element.getPublisher());
47639      }
47640      if (element.hasPublicationDateElement()) {
47641        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
47642        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
47643      }
47644      if (element.hasPublicationStatusElement()) {
47645        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
47646        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
47647      }
47648      if (element.hasCopyrightElement()) {
47649        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47650        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47651      }
47652  }
47653
47654  protected void composeTermComponent(String name, Contract.TermComponent element) throws IOException {
47655    if (element != null) {
47656      open(name);
47657      composeTermComponentProperties(element);
47658      close();
47659    }
47660  }
47661
47662  protected void composeTermComponentProperties(Contract.TermComponent element) throws IOException {
47663    composeBackboneElementProperties(element);
47664      if (element.hasIdentifier()) {
47665        composeIdentifier("identifier", element.getIdentifier());
47666      }
47667      if (element.hasIssuedElement()) {
47668        composeDateTimeCore("issued", element.getIssuedElement(), false);
47669        composeDateTimeExtras("issued", element.getIssuedElement(), false);
47670      }
47671      if (element.hasApplies()) {
47672        composePeriod("applies", element.getApplies());
47673      }
47674      if (element.hasTopic()) {
47675        composeType("topic", element.getTopic());
47676      }
47677      if (element.hasType()) {
47678        composeCodeableConcept("type", element.getType());
47679      }
47680      if (element.hasSubType()) {
47681        composeCodeableConcept("subType", element.getSubType());
47682      }
47683      if (element.hasTextElement()) {
47684        composeStringCore("text", element.getTextElement(), false);
47685        composeStringExtras("text", element.getTextElement(), false);
47686      }
47687      if (element.hasSecurityLabel()) {
47688        openArray("securityLabel");
47689        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
47690          composeSecurityLabelComponent(null, e);
47691        closeArray();
47692      };
47693      if (element.hasOffer()) {
47694        composeContractOfferComponent("offer", element.getOffer());
47695      }
47696      if (element.hasAsset()) {
47697        openArray("asset");
47698        for (Contract.ContractAssetComponent e : element.getAsset()) 
47699          composeContractAssetComponent(null, e);
47700        closeArray();
47701      };
47702      if (element.hasAction()) {
47703        openArray("action");
47704        for (Contract.ActionComponent e : element.getAction()) 
47705          composeActionComponent(null, e);
47706        closeArray();
47707      };
47708      if (element.hasGroup()) {
47709        openArray("group");
47710        for (Contract.TermComponent e : element.getGroup()) 
47711          composeTermComponent(null, e);
47712        closeArray();
47713      };
47714  }
47715
47716  protected void composeSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
47717    if (element != null) {
47718      open(name);
47719      composeSecurityLabelComponentProperties(element);
47720      close();
47721    }
47722  }
47723
47724  protected void composeSecurityLabelComponentProperties(Contract.SecurityLabelComponent element) throws IOException {
47725    composeBackboneElementProperties(element);
47726      if (element.hasNumber()) {
47727        if (anyHasValue(element.getNumber())) {
47728          openArray("number");
47729          for (UnsignedIntType e : element.getNumber()) 
47730            composeUnsignedIntCore(null, e, e != element.getNumber().get(element.getNumber().size()-1));
47731          closeArray();
47732        }
47733        if (anyHasExtras(element.getNumber())) {
47734          openArray("_number");
47735          for (UnsignedIntType e : element.getNumber()) 
47736            composeUnsignedIntExtras(null, e, true);
47737          closeArray();
47738        }
47739      };
47740      if (element.hasClassification()) {
47741        composeCoding("classification", element.getClassification());
47742      }
47743      if (element.hasCategory()) {
47744        openArray("category");
47745        for (Coding e : element.getCategory()) 
47746          composeCoding(null, e);
47747        closeArray();
47748      };
47749      if (element.hasControl()) {
47750        openArray("control");
47751        for (Coding e : element.getControl()) 
47752          composeCoding(null, e);
47753        closeArray();
47754      };
47755  }
47756
47757  protected void composeContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
47758    if (element != null) {
47759      open(name);
47760      composeContractOfferComponentProperties(element);
47761      close();
47762    }
47763  }
47764
47765  protected void composeContractOfferComponentProperties(Contract.ContractOfferComponent element) throws IOException {
47766    composeBackboneElementProperties(element);
47767      if (element.hasIdentifier()) {
47768        openArray("identifier");
47769        for (Identifier e : element.getIdentifier()) 
47770          composeIdentifier(null, e);
47771        closeArray();
47772      };
47773      if (element.hasParty()) {
47774        openArray("party");
47775        for (Contract.ContractPartyComponent e : element.getParty()) 
47776          composeContractPartyComponent(null, e);
47777        closeArray();
47778      };
47779      if (element.hasTopic()) {
47780        composeReference("topic", element.getTopic());
47781      }
47782      if (element.hasType()) {
47783        composeCodeableConcept("type", element.getType());
47784      }
47785      if (element.hasDecision()) {
47786        composeCodeableConcept("decision", element.getDecision());
47787      }
47788      if (element.hasDecisionMode()) {
47789        openArray("decisionMode");
47790        for (CodeableConcept e : element.getDecisionMode()) 
47791          composeCodeableConcept(null, e);
47792        closeArray();
47793      };
47794      if (element.hasAnswer()) {
47795        openArray("answer");
47796        for (Contract.AnswerComponent e : element.getAnswer()) 
47797          composeAnswerComponent(null, e);
47798        closeArray();
47799      };
47800      if (element.hasTextElement()) {
47801        composeStringCore("text", element.getTextElement(), false);
47802        composeStringExtras("text", element.getTextElement(), false);
47803      }
47804      if (element.hasLinkId()) {
47805        if (anyHasValue(element.getLinkId())) {
47806          openArray("linkId");
47807          for (StringType e : element.getLinkId()) 
47808            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
47809          closeArray();
47810        }
47811        if (anyHasExtras(element.getLinkId())) {
47812          openArray("_linkId");
47813          for (StringType e : element.getLinkId()) 
47814            composeStringExtras(null, e, true);
47815          closeArray();
47816        }
47817      };
47818      if (element.hasSecurityLabelNumber()) {
47819        if (anyHasValue(element.getSecurityLabelNumber())) {
47820          openArray("securityLabelNumber");
47821          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47822            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
47823          closeArray();
47824        }
47825        if (anyHasExtras(element.getSecurityLabelNumber())) {
47826          openArray("_securityLabelNumber");
47827          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47828            composeUnsignedIntExtras(null, e, true);
47829          closeArray();
47830        }
47831      };
47832  }
47833
47834  protected void composeContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
47835    if (element != null) {
47836      open(name);
47837      composeContractPartyComponentProperties(element);
47838      close();
47839    }
47840  }
47841
47842  protected void composeContractPartyComponentProperties(Contract.ContractPartyComponent element) throws IOException {
47843    composeBackboneElementProperties(element);
47844      if (element.hasReference()) {
47845        openArray("reference");
47846        for (Reference e : element.getReference()) 
47847          composeReference(null, e);
47848        closeArray();
47849      };
47850      if (element.hasRole()) {
47851        composeCodeableConcept("role", element.getRole());
47852      }
47853  }
47854
47855  protected void composeAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
47856    if (element != null) {
47857      open(name);
47858      composeAnswerComponentProperties(element);
47859      close();
47860    }
47861  }
47862
47863  protected void composeAnswerComponentProperties(Contract.AnswerComponent element) throws IOException {
47864    composeBackboneElementProperties(element);
47865      if (element.hasValue()) {
47866        composeType("value", element.getValue());
47867      }
47868  }
47869
47870  protected void composeContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
47871    if (element != null) {
47872      open(name);
47873      composeContractAssetComponentProperties(element);
47874      close();
47875    }
47876  }
47877
47878  protected void composeContractAssetComponentProperties(Contract.ContractAssetComponent element) throws IOException {
47879    composeBackboneElementProperties(element);
47880      if (element.hasScope()) {
47881        composeCodeableConcept("scope", element.getScope());
47882      }
47883      if (element.hasType()) {
47884        openArray("type");
47885        for (CodeableConcept e : element.getType()) 
47886          composeCodeableConcept(null, e);
47887        closeArray();
47888      };
47889      if (element.hasTypeReference()) {
47890        openArray("typeReference");
47891        for (Reference e : element.getTypeReference()) 
47892          composeReference(null, e);
47893        closeArray();
47894      };
47895      if (element.hasSubtype()) {
47896        openArray("subtype");
47897        for (CodeableConcept e : element.getSubtype()) 
47898          composeCodeableConcept(null, e);
47899        closeArray();
47900      };
47901      if (element.hasRelationship()) {
47902        composeCoding("relationship", element.getRelationship());
47903      }
47904      if (element.hasContext()) {
47905        openArray("context");
47906        for (Contract.AssetContextComponent e : element.getContext()) 
47907          composeAssetContextComponent(null, e);
47908        closeArray();
47909      };
47910      if (element.hasConditionElement()) {
47911        composeStringCore("condition", element.getConditionElement(), false);
47912        composeStringExtras("condition", element.getConditionElement(), false);
47913      }
47914      if (element.hasPeriodType()) {
47915        openArray("periodType");
47916        for (CodeableConcept e : element.getPeriodType()) 
47917          composeCodeableConcept(null, e);
47918        closeArray();
47919      };
47920      if (element.hasPeriod()) {
47921        openArray("period");
47922        for (Period e : element.getPeriod()) 
47923          composePeriod(null, e);
47924        closeArray();
47925      };
47926      if (element.hasUsePeriod()) {
47927        openArray("usePeriod");
47928        for (Period e : element.getUsePeriod()) 
47929          composePeriod(null, e);
47930        closeArray();
47931      };
47932      if (element.hasTextElement()) {
47933        composeStringCore("text", element.getTextElement(), false);
47934        composeStringExtras("text", element.getTextElement(), false);
47935      }
47936      if (element.hasLinkId()) {
47937        if (anyHasValue(element.getLinkId())) {
47938          openArray("linkId");
47939          for (StringType e : element.getLinkId()) 
47940            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
47941          closeArray();
47942        }
47943        if (anyHasExtras(element.getLinkId())) {
47944          openArray("_linkId");
47945          for (StringType e : element.getLinkId()) 
47946            composeStringExtras(null, e, true);
47947          closeArray();
47948        }
47949      };
47950      if (element.hasAnswer()) {
47951        openArray("answer");
47952        for (Contract.AnswerComponent e : element.getAnswer()) 
47953          composeAnswerComponent(null, e);
47954        closeArray();
47955      };
47956      if (element.hasSecurityLabelNumber()) {
47957        if (anyHasValue(element.getSecurityLabelNumber())) {
47958          openArray("securityLabelNumber");
47959          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47960            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
47961          closeArray();
47962        }
47963        if (anyHasExtras(element.getSecurityLabelNumber())) {
47964          openArray("_securityLabelNumber");
47965          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47966            composeUnsignedIntExtras(null, e, true);
47967          closeArray();
47968        }
47969      };
47970      if (element.hasValuedItem()) {
47971        openArray("valuedItem");
47972        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
47973          composeValuedItemComponent(null, e);
47974        closeArray();
47975      };
47976  }
47977
47978  protected void composeAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
47979    if (element != null) {
47980      open(name);
47981      composeAssetContextComponentProperties(element);
47982      close();
47983    }
47984  }
47985
47986  protected void composeAssetContextComponentProperties(Contract.AssetContextComponent element) throws IOException {
47987    composeBackboneElementProperties(element);
47988      if (element.hasReference()) {
47989        composeReference("reference", element.getReference());
47990      }
47991      if (element.hasCode()) {
47992        openArray("code");
47993        for (CodeableConcept e : element.getCode()) 
47994          composeCodeableConcept(null, e);
47995        closeArray();
47996      };
47997      if (element.hasTextElement()) {
47998        composeStringCore("text", element.getTextElement(), false);
47999        composeStringExtras("text", element.getTextElement(), false);
48000      }
48001  }
48002
48003  protected void composeValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
48004    if (element != null) {
48005      open(name);
48006      composeValuedItemComponentProperties(element);
48007      close();
48008    }
48009  }
48010
48011  protected void composeValuedItemComponentProperties(Contract.ValuedItemComponent element) throws IOException {
48012    composeBackboneElementProperties(element);
48013      if (element.hasEntity()) {
48014        composeType("entity", element.getEntity());
48015      }
48016      if (element.hasIdentifier()) {
48017        composeIdentifier("identifier", element.getIdentifier());
48018      }
48019      if (element.hasEffectiveTimeElement()) {
48020        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
48021        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
48022      }
48023      if (element.hasQuantity()) {
48024        composeQuantity("quantity", element.getQuantity());
48025      }
48026      if (element.hasUnitPrice()) {
48027        composeMoney("unitPrice", element.getUnitPrice());
48028      }
48029      if (element.hasFactorElement()) {
48030        composeDecimalCore("factor", element.getFactorElement(), false);
48031        composeDecimalExtras("factor", element.getFactorElement(), false);
48032      }
48033      if (element.hasPointsElement()) {
48034        composeDecimalCore("points", element.getPointsElement(), false);
48035        composeDecimalExtras("points", element.getPointsElement(), false);
48036      }
48037      if (element.hasNet()) {
48038        composeMoney("net", element.getNet());
48039      }
48040      if (element.hasPaymentElement()) {
48041        composeStringCore("payment", element.getPaymentElement(), false);
48042        composeStringExtras("payment", element.getPaymentElement(), false);
48043      }
48044      if (element.hasPaymentDateElement()) {
48045        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
48046        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
48047      }
48048      if (element.hasResponsible()) {
48049        composeReference("responsible", element.getResponsible());
48050      }
48051      if (element.hasRecipient()) {
48052        composeReference("recipient", element.getRecipient());
48053      }
48054      if (element.hasLinkId()) {
48055        if (anyHasValue(element.getLinkId())) {
48056          openArray("linkId");
48057          for (StringType e : element.getLinkId()) 
48058            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
48059          closeArray();
48060        }
48061        if (anyHasExtras(element.getLinkId())) {
48062          openArray("_linkId");
48063          for (StringType e : element.getLinkId()) 
48064            composeStringExtras(null, e, true);
48065          closeArray();
48066        }
48067      };
48068      if (element.hasSecurityLabelNumber()) {
48069        if (anyHasValue(element.getSecurityLabelNumber())) {
48070          openArray("securityLabelNumber");
48071          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48072            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
48073          closeArray();
48074        }
48075        if (anyHasExtras(element.getSecurityLabelNumber())) {
48076          openArray("_securityLabelNumber");
48077          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48078            composeUnsignedIntExtras(null, e, true);
48079          closeArray();
48080        }
48081      };
48082  }
48083
48084  protected void composeActionComponent(String name, Contract.ActionComponent element) throws IOException {
48085    if (element != null) {
48086      open(name);
48087      composeActionComponentProperties(element);
48088      close();
48089    }
48090  }
48091
48092  protected void composeActionComponentProperties(Contract.ActionComponent element) throws IOException {
48093    composeBackboneElementProperties(element);
48094      if (element.hasDoNotPerformElement()) {
48095        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
48096        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
48097      }
48098      if (element.hasType()) {
48099        composeCodeableConcept("type", element.getType());
48100      }
48101      if (element.hasSubject()) {
48102        openArray("subject");
48103        for (Contract.ActionSubjectComponent e : element.getSubject()) 
48104          composeActionSubjectComponent(null, e);
48105        closeArray();
48106      };
48107      if (element.hasIntent()) {
48108        composeCodeableConcept("intent", element.getIntent());
48109      }
48110      if (element.hasLinkId()) {
48111        if (anyHasValue(element.getLinkId())) {
48112          openArray("linkId");
48113          for (StringType e : element.getLinkId()) 
48114            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
48115          closeArray();
48116        }
48117        if (anyHasExtras(element.getLinkId())) {
48118          openArray("_linkId");
48119          for (StringType e : element.getLinkId()) 
48120            composeStringExtras(null, e, true);
48121          closeArray();
48122        }
48123      };
48124      if (element.hasStatus()) {
48125        composeCodeableConcept("status", element.getStatus());
48126      }
48127      if (element.hasContext()) {
48128        composeReference("context", element.getContext());
48129      }
48130      if (element.hasContextLinkId()) {
48131        if (anyHasValue(element.getContextLinkId())) {
48132          openArray("contextLinkId");
48133          for (StringType e : element.getContextLinkId()) 
48134            composeStringCore(null, e, e != element.getContextLinkId().get(element.getContextLinkId().size()-1));
48135          closeArray();
48136        }
48137        if (anyHasExtras(element.getContextLinkId())) {
48138          openArray("_contextLinkId");
48139          for (StringType e : element.getContextLinkId()) 
48140            composeStringExtras(null, e, true);
48141          closeArray();
48142        }
48143      };
48144      if (element.hasOccurrence()) {
48145        composeType("occurrence", element.getOccurrence());
48146      }
48147      if (element.hasRequester()) {
48148        openArray("requester");
48149        for (Reference e : element.getRequester()) 
48150          composeReference(null, e);
48151        closeArray();
48152      };
48153      if (element.hasRequesterLinkId()) {
48154        if (anyHasValue(element.getRequesterLinkId())) {
48155          openArray("requesterLinkId");
48156          for (StringType e : element.getRequesterLinkId()) 
48157            composeStringCore(null, e, e != element.getRequesterLinkId().get(element.getRequesterLinkId().size()-1));
48158          closeArray();
48159        }
48160        if (anyHasExtras(element.getRequesterLinkId())) {
48161          openArray("_requesterLinkId");
48162          for (StringType e : element.getRequesterLinkId()) 
48163            composeStringExtras(null, e, true);
48164          closeArray();
48165        }
48166      };
48167      if (element.hasPerformerType()) {
48168        openArray("performerType");
48169        for (CodeableConcept e : element.getPerformerType()) 
48170          composeCodeableConcept(null, e);
48171        closeArray();
48172      };
48173      if (element.hasPerformerRole()) {
48174        composeCodeableConcept("performerRole", element.getPerformerRole());
48175      }
48176      if (element.hasPerformer()) {
48177        composeReference("performer", element.getPerformer());
48178      }
48179      if (element.hasPerformerLinkId()) {
48180        if (anyHasValue(element.getPerformerLinkId())) {
48181          openArray("performerLinkId");
48182          for (StringType e : element.getPerformerLinkId()) 
48183            composeStringCore(null, e, e != element.getPerformerLinkId().get(element.getPerformerLinkId().size()-1));
48184          closeArray();
48185        }
48186        if (anyHasExtras(element.getPerformerLinkId())) {
48187          openArray("_performerLinkId");
48188          for (StringType e : element.getPerformerLinkId()) 
48189            composeStringExtras(null, e, true);
48190          closeArray();
48191        }
48192      };
48193      if (element.hasReason()) {
48194        openArray("reason");
48195        for (CodeableReference e : element.getReason()) 
48196          composeCodeableReference(null, e);
48197        closeArray();
48198      };
48199      if (element.hasReasonLinkId()) {
48200        if (anyHasValue(element.getReasonLinkId())) {
48201          openArray("reasonLinkId");
48202          for (StringType e : element.getReasonLinkId()) 
48203            composeStringCore(null, e, e != element.getReasonLinkId().get(element.getReasonLinkId().size()-1));
48204          closeArray();
48205        }
48206        if (anyHasExtras(element.getReasonLinkId())) {
48207          openArray("_reasonLinkId");
48208          for (StringType e : element.getReasonLinkId()) 
48209            composeStringExtras(null, e, true);
48210          closeArray();
48211        }
48212      };
48213      if (element.hasNote()) {
48214        openArray("note");
48215        for (Annotation e : element.getNote()) 
48216          composeAnnotation(null, e);
48217        closeArray();
48218      };
48219      if (element.hasSecurityLabelNumber()) {
48220        if (anyHasValue(element.getSecurityLabelNumber())) {
48221          openArray("securityLabelNumber");
48222          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48223            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
48224          closeArray();
48225        }
48226        if (anyHasExtras(element.getSecurityLabelNumber())) {
48227          openArray("_securityLabelNumber");
48228          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48229            composeUnsignedIntExtras(null, e, true);
48230          closeArray();
48231        }
48232      };
48233  }
48234
48235  protected void composeActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
48236    if (element != null) {
48237      open(name);
48238      composeActionSubjectComponentProperties(element);
48239      close();
48240    }
48241  }
48242
48243  protected void composeActionSubjectComponentProperties(Contract.ActionSubjectComponent element) throws IOException {
48244    composeBackboneElementProperties(element);
48245      if (element.hasReference()) {
48246        openArray("reference");
48247        for (Reference e : element.getReference()) 
48248          composeReference(null, e);
48249        closeArray();
48250      };
48251      if (element.hasRole()) {
48252        composeCodeableConcept("role", element.getRole());
48253      }
48254  }
48255
48256  protected void composeSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
48257    if (element != null) {
48258      open(name);
48259      composeSignatoryComponentProperties(element);
48260      close();
48261    }
48262  }
48263
48264  protected void composeSignatoryComponentProperties(Contract.SignatoryComponent element) throws IOException {
48265    composeBackboneElementProperties(element);
48266      if (element.hasType()) {
48267        composeCoding("type", element.getType());
48268      }
48269      if (element.hasParty()) {
48270        composeReference("party", element.getParty());
48271      }
48272      if (element.hasSignature()) {
48273        openArray("signature");
48274        for (Signature e : element.getSignature()) 
48275          composeSignature(null, e);
48276        closeArray();
48277      };
48278  }
48279
48280  protected void composeFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
48281    if (element != null) {
48282      open(name);
48283      composeFriendlyLanguageComponentProperties(element);
48284      close();
48285    }
48286  }
48287
48288  protected void composeFriendlyLanguageComponentProperties(Contract.FriendlyLanguageComponent element) throws IOException {
48289    composeBackboneElementProperties(element);
48290      if (element.hasContent()) {
48291        composeType("content", element.getContent());
48292      }
48293  }
48294
48295  protected void composeLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
48296    if (element != null) {
48297      open(name);
48298      composeLegalLanguageComponentProperties(element);
48299      close();
48300    }
48301  }
48302
48303  protected void composeLegalLanguageComponentProperties(Contract.LegalLanguageComponent element) throws IOException {
48304    composeBackboneElementProperties(element);
48305      if (element.hasContent()) {
48306        composeType("content", element.getContent());
48307      }
48308  }
48309
48310  protected void composeComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
48311    if (element != null) {
48312      open(name);
48313      composeComputableLanguageComponentProperties(element);
48314      close();
48315    }
48316  }
48317
48318  protected void composeComputableLanguageComponentProperties(Contract.ComputableLanguageComponent element) throws IOException {
48319    composeBackboneElementProperties(element);
48320      if (element.hasContent()) {
48321        composeType("content", element.getContent());
48322      }
48323  }
48324
48325  protected void composeCoverage(String name, Coverage element) throws IOException {
48326    if (element != null) {
48327      prop("resourceType", name);
48328      composeCoverageProperties(element);
48329    }
48330  }
48331
48332  protected void composeCoverageProperties(Coverage element) throws IOException {
48333    composeDomainResourceProperties(element);
48334      if (element.hasIdentifier()) {
48335        openArray("identifier");
48336        for (Identifier e : element.getIdentifier()) 
48337          composeIdentifier(null, e);
48338        closeArray();
48339      };
48340      if (element.hasStatusElement()) {
48341        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48342        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48343      }
48344      if (element.hasKindElement()) {
48345        composeEnumerationCore("kind", element.getKindElement(), new Coverage.KindEnumFactory(), false);
48346        composeEnumerationExtras("kind", element.getKindElement(), new Coverage.KindEnumFactory(), false);
48347      }
48348      if (element.hasPaymentBy()) {
48349        openArray("paymentBy");
48350        for (Coverage.CoveragePaymentByComponent e : element.getPaymentBy()) 
48351          composeCoveragePaymentByComponent(null, e);
48352        closeArray();
48353      };
48354      if (element.hasType()) {
48355        composeCodeableConcept("type", element.getType());
48356      }
48357      if (element.hasPolicyHolder()) {
48358        composeReference("policyHolder", element.getPolicyHolder());
48359      }
48360      if (element.hasSubscriber()) {
48361        composeReference("subscriber", element.getSubscriber());
48362      }
48363      if (element.hasSubscriberId()) {
48364        openArray("subscriberId");
48365        for (Identifier e : element.getSubscriberId()) 
48366          composeIdentifier(null, e);
48367        closeArray();
48368      };
48369      if (element.hasBeneficiary()) {
48370        composeReference("beneficiary", element.getBeneficiary());
48371      }
48372      if (element.hasDependentElement()) {
48373        composeStringCore("dependent", element.getDependentElement(), false);
48374        composeStringExtras("dependent", element.getDependentElement(), false);
48375      }
48376      if (element.hasRelationship()) {
48377        composeCodeableConcept("relationship", element.getRelationship());
48378      }
48379      if (element.hasPeriod()) {
48380        composePeriod("period", element.getPeriod());
48381      }
48382      if (element.hasInsurer()) {
48383        composeReference("insurer", element.getInsurer());
48384      }
48385      if (element.hasClass_()) {
48386        openArray("class");
48387        for (Coverage.ClassComponent e : element.getClass_()) 
48388          composeClassComponent(null, e);
48389        closeArray();
48390      };
48391      if (element.hasOrderElement()) {
48392        composePositiveIntCore("order", element.getOrderElement(), false);
48393        composePositiveIntExtras("order", element.getOrderElement(), false);
48394      }
48395      if (element.hasNetworkElement()) {
48396        composeStringCore("network", element.getNetworkElement(), false);
48397        composeStringExtras("network", element.getNetworkElement(), false);
48398      }
48399      if (element.hasCostToBeneficiary()) {
48400        openArray("costToBeneficiary");
48401        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
48402          composeCostToBeneficiaryComponent(null, e);
48403        closeArray();
48404      };
48405      if (element.hasSubrogationElement()) {
48406        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
48407        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
48408      }
48409      if (element.hasContract()) {
48410        openArray("contract");
48411        for (Reference e : element.getContract()) 
48412          composeReference(null, e);
48413        closeArray();
48414      };
48415      if (element.hasInsurancePlan()) {
48416        composeReference("insurancePlan", element.getInsurancePlan());
48417      }
48418  }
48419
48420  protected void composeCoveragePaymentByComponent(String name, Coverage.CoveragePaymentByComponent element) throws IOException {
48421    if (element != null) {
48422      open(name);
48423      composeCoveragePaymentByComponentProperties(element);
48424      close();
48425    }
48426  }
48427
48428  protected void composeCoveragePaymentByComponentProperties(Coverage.CoveragePaymentByComponent element) throws IOException {
48429    composeBackboneElementProperties(element);
48430      if (element.hasParty()) {
48431        composeReference("party", element.getParty());
48432      }
48433      if (element.hasResponsibilityElement()) {
48434        composeStringCore("responsibility", element.getResponsibilityElement(), false);
48435        composeStringExtras("responsibility", element.getResponsibilityElement(), false);
48436      }
48437  }
48438
48439  protected void composeClassComponent(String name, Coverage.ClassComponent element) throws IOException {
48440    if (element != null) {
48441      open(name);
48442      composeClassComponentProperties(element);
48443      close();
48444    }
48445  }
48446
48447  protected void composeClassComponentProperties(Coverage.ClassComponent element) throws IOException {
48448    composeBackboneElementProperties(element);
48449      if (element.hasType()) {
48450        composeCodeableConcept("type", element.getType());
48451      }
48452      if (element.hasValue()) {
48453        composeIdentifier("value", element.getValue());
48454      }
48455      if (element.hasNameElement()) {
48456        composeStringCore("name", element.getNameElement(), false);
48457        composeStringExtras("name", element.getNameElement(), false);
48458      }
48459  }
48460
48461  protected void composeCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
48462    if (element != null) {
48463      open(name);
48464      composeCostToBeneficiaryComponentProperties(element);
48465      close();
48466    }
48467  }
48468
48469  protected void composeCostToBeneficiaryComponentProperties(Coverage.CostToBeneficiaryComponent element) throws IOException {
48470    composeBackboneElementProperties(element);
48471      if (element.hasType()) {
48472        composeCodeableConcept("type", element.getType());
48473      }
48474      if (element.hasCategory()) {
48475        composeCodeableConcept("category", element.getCategory());
48476      }
48477      if (element.hasNetwork()) {
48478        composeCodeableConcept("network", element.getNetwork());
48479      }
48480      if (element.hasUnit()) {
48481        composeCodeableConcept("unit", element.getUnit());
48482      }
48483      if (element.hasTerm()) {
48484        composeCodeableConcept("term", element.getTerm());
48485      }
48486      if (element.hasValue()) {
48487        composeType("value", element.getValue());
48488      }
48489      if (element.hasException()) {
48490        openArray("exception");
48491        for (Coverage.ExemptionComponent e : element.getException()) 
48492          composeExemptionComponent(null, e);
48493        closeArray();
48494      };
48495  }
48496
48497  protected void composeExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
48498    if (element != null) {
48499      open(name);
48500      composeExemptionComponentProperties(element);
48501      close();
48502    }
48503  }
48504
48505  protected void composeExemptionComponentProperties(Coverage.ExemptionComponent element) throws IOException {
48506    composeBackboneElementProperties(element);
48507      if (element.hasType()) {
48508        composeCodeableConcept("type", element.getType());
48509      }
48510      if (element.hasPeriod()) {
48511        composePeriod("period", element.getPeriod());
48512      }
48513  }
48514
48515  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
48516    if (element != null) {
48517      prop("resourceType", name);
48518      composeCoverageEligibilityRequestProperties(element);
48519    }
48520  }
48521
48522  protected void composeCoverageEligibilityRequestProperties(CoverageEligibilityRequest element) throws IOException {
48523    composeDomainResourceProperties(element);
48524      if (element.hasIdentifier()) {
48525        openArray("identifier");
48526        for (Identifier e : element.getIdentifier()) 
48527          composeIdentifier(null, e);
48528        closeArray();
48529      };
48530      if (element.hasStatusElement()) {
48531        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48532        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48533      }
48534      if (element.hasPriority()) {
48535        composeCodeableConcept("priority", element.getPriority());
48536      }
48537      if (element.hasPurpose()) {
48538        openArray("purpose");
48539        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
48540          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
48541        closeArray();
48542        if (anyHasExtras(element.getPurpose())) {
48543          openArray("_purpose");
48544          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
48545            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
48546          closeArray();
48547        }
48548      };
48549      if (element.hasPatient()) {
48550        composeReference("patient", element.getPatient());
48551      }
48552      if (element.hasEvent()) {
48553        openArray("event");
48554        for (CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent e : element.getEvent()) 
48555          composeCoverageEligibilityRequestEventComponent(null, e);
48556        closeArray();
48557      };
48558      if (element.hasServiced()) {
48559        composeType("serviced", element.getServiced());
48560      }
48561      if (element.hasCreatedElement()) {
48562        composeDateTimeCore("created", element.getCreatedElement(), false);
48563        composeDateTimeExtras("created", element.getCreatedElement(), false);
48564      }
48565      if (element.hasEnterer()) {
48566        composeReference("enterer", element.getEnterer());
48567      }
48568      if (element.hasProvider()) {
48569        composeReference("provider", element.getProvider());
48570      }
48571      if (element.hasInsurer()) {
48572        composeReference("insurer", element.getInsurer());
48573      }
48574      if (element.hasFacility()) {
48575        composeReference("facility", element.getFacility());
48576      }
48577      if (element.hasSupportingInfo()) {
48578        openArray("supportingInfo");
48579        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
48580          composeSupportingInformationComponent(null, e);
48581        closeArray();
48582      };
48583      if (element.hasInsurance()) {
48584        openArray("insurance");
48585        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
48586          composeInsuranceComponent(null, e);
48587        closeArray();
48588      };
48589      if (element.hasItem()) {
48590        openArray("item");
48591        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
48592          composeDetailsComponent(null, e);
48593        closeArray();
48594      };
48595  }
48596
48597  protected void composeCoverageEligibilityRequestEventComponent(String name, CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent element) throws IOException {
48598    if (element != null) {
48599      open(name);
48600      composeCoverageEligibilityRequestEventComponentProperties(element);
48601      close();
48602    }
48603  }
48604
48605  protected void composeCoverageEligibilityRequestEventComponentProperties(CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent element) throws IOException {
48606    composeBackboneElementProperties(element);
48607      if (element.hasType()) {
48608        composeCodeableConcept("type", element.getType());
48609      }
48610      if (element.hasWhen()) {
48611        composeType("when", element.getWhen());
48612      }
48613  }
48614
48615  protected void composeSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
48616    if (element != null) {
48617      open(name);
48618      composeSupportingInformationComponentProperties(element);
48619      close();
48620    }
48621  }
48622
48623  protected void composeSupportingInformationComponentProperties(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
48624    composeBackboneElementProperties(element);
48625      if (element.hasSequenceElement()) {
48626        composePositiveIntCore("sequence", element.getSequenceElement(), false);
48627        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
48628      }
48629      if (element.hasInformation()) {
48630        composeReference("information", element.getInformation());
48631      }
48632      if (element.hasAppliesToAllElement()) {
48633        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
48634        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
48635      }
48636  }
48637
48638  protected void composeInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
48639    if (element != null) {
48640      open(name);
48641      composeInsuranceComponentProperties(element);
48642      close();
48643    }
48644  }
48645
48646  protected void composeInsuranceComponentProperties(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
48647    composeBackboneElementProperties(element);
48648      if (element.hasFocalElement()) {
48649        composeBooleanCore("focal", element.getFocalElement(), false);
48650        composeBooleanExtras("focal", element.getFocalElement(), false);
48651      }
48652      if (element.hasCoverage()) {
48653        composeReference("coverage", element.getCoverage());
48654      }
48655      if (element.hasBusinessArrangementElement()) {
48656        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
48657        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
48658      }
48659  }
48660
48661  protected void composeDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
48662    if (element != null) {
48663      open(name);
48664      composeDetailsComponentProperties(element);
48665      close();
48666    }
48667  }
48668
48669  protected void composeDetailsComponentProperties(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
48670    composeBackboneElementProperties(element);
48671      if (element.hasSupportingInfoSequence()) {
48672        if (anyHasValue(element.getSupportingInfoSequence())) {
48673          openArray("supportingInfoSequence");
48674          for (PositiveIntType e : element.getSupportingInfoSequence()) 
48675            composePositiveIntCore(null, e, e != element.getSupportingInfoSequence().get(element.getSupportingInfoSequence().size()-1));
48676          closeArray();
48677        }
48678        if (anyHasExtras(element.getSupportingInfoSequence())) {
48679          openArray("_supportingInfoSequence");
48680          for (PositiveIntType e : element.getSupportingInfoSequence()) 
48681            composePositiveIntExtras(null, e, true);
48682          closeArray();
48683        }
48684      };
48685      if (element.hasCategory()) {
48686        composeCodeableConcept("category", element.getCategory());
48687      }
48688      if (element.hasProductOrService()) {
48689        composeCodeableConcept("productOrService", element.getProductOrService());
48690      }
48691      if (element.hasModifier()) {
48692        openArray("modifier");
48693        for (CodeableConcept e : element.getModifier()) 
48694          composeCodeableConcept(null, e);
48695        closeArray();
48696      };
48697      if (element.hasProvider()) {
48698        composeReference("provider", element.getProvider());
48699      }
48700      if (element.hasQuantity()) {
48701        composeQuantity("quantity", element.getQuantity());
48702      }
48703      if (element.hasUnitPrice()) {
48704        composeMoney("unitPrice", element.getUnitPrice());
48705      }
48706      if (element.hasFacility()) {
48707        composeReference("facility", element.getFacility());
48708      }
48709      if (element.hasDiagnosis()) {
48710        openArray("diagnosis");
48711        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
48712          composeDiagnosisComponent(null, e);
48713        closeArray();
48714      };
48715      if (element.hasDetail()) {
48716        openArray("detail");
48717        for (Reference e : element.getDetail()) 
48718          composeReference(null, e);
48719        closeArray();
48720      };
48721  }
48722
48723  protected void composeDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
48724    if (element != null) {
48725      open(name);
48726      composeDiagnosisComponentProperties(element);
48727      close();
48728    }
48729  }
48730
48731  protected void composeDiagnosisComponentProperties(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
48732    composeBackboneElementProperties(element);
48733      if (element.hasDiagnosis()) {
48734        composeType("diagnosis", element.getDiagnosis());
48735      }
48736  }
48737
48738  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
48739    if (element != null) {
48740      prop("resourceType", name);
48741      composeCoverageEligibilityResponseProperties(element);
48742    }
48743  }
48744
48745  protected void composeCoverageEligibilityResponseProperties(CoverageEligibilityResponse element) throws IOException {
48746    composeDomainResourceProperties(element);
48747      if (element.hasIdentifier()) {
48748        openArray("identifier");
48749        for (Identifier e : element.getIdentifier()) 
48750          composeIdentifier(null, e);
48751        closeArray();
48752      };
48753      if (element.hasStatusElement()) {
48754        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48755        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48756      }
48757      if (element.hasPurpose()) {
48758        openArray("purpose");
48759        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
48760          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
48761        closeArray();
48762        if (anyHasExtras(element.getPurpose())) {
48763          openArray("_purpose");
48764          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
48765            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
48766          closeArray();
48767        }
48768      };
48769      if (element.hasPatient()) {
48770        composeReference("patient", element.getPatient());
48771      }
48772      if (element.hasEvent()) {
48773        openArray("event");
48774        for (CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent e : element.getEvent()) 
48775          composeCoverageEligibilityResponseEventComponent(null, e);
48776        closeArray();
48777      };
48778      if (element.hasServiced()) {
48779        composeType("serviced", element.getServiced());
48780      }
48781      if (element.hasCreatedElement()) {
48782        composeDateTimeCore("created", element.getCreatedElement(), false);
48783        composeDateTimeExtras("created", element.getCreatedElement(), false);
48784      }
48785      if (element.hasRequestor()) {
48786        composeReference("requestor", element.getRequestor());
48787      }
48788      if (element.hasRequest()) {
48789        composeReference("request", element.getRequest());
48790      }
48791      if (element.hasOutcomeElement()) {
48792        composeEnumerationCore("outcome", element.getOutcomeElement(), new CoverageEligibilityResponse.EligibilityOutcomeEnumFactory(), false);
48793        composeEnumerationExtras("outcome", element.getOutcomeElement(), new CoverageEligibilityResponse.EligibilityOutcomeEnumFactory(), false);
48794      }
48795      if (element.hasDispositionElement()) {
48796        composeStringCore("disposition", element.getDispositionElement(), false);
48797        composeStringExtras("disposition", element.getDispositionElement(), false);
48798      }
48799      if (element.hasInsurer()) {
48800        composeReference("insurer", element.getInsurer());
48801      }
48802      if (element.hasInsurance()) {
48803        openArray("insurance");
48804        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
48805          composeInsuranceComponent(null, e);
48806        closeArray();
48807      };
48808      if (element.hasPreAuthRefElement()) {
48809        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
48810        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
48811      }
48812      if (element.hasForm()) {
48813        composeCodeableConcept("form", element.getForm());
48814      }
48815      if (element.hasError()) {
48816        openArray("error");
48817        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
48818          composeErrorsComponent(null, e);
48819        closeArray();
48820      };
48821  }
48822
48823  protected void composeCoverageEligibilityResponseEventComponent(String name, CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent element) throws IOException {
48824    if (element != null) {
48825      open(name);
48826      composeCoverageEligibilityResponseEventComponentProperties(element);
48827      close();
48828    }
48829  }
48830
48831  protected void composeCoverageEligibilityResponseEventComponentProperties(CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent element) throws IOException {
48832    composeBackboneElementProperties(element);
48833      if (element.hasType()) {
48834        composeCodeableConcept("type", element.getType());
48835      }
48836      if (element.hasWhen()) {
48837        composeType("when", element.getWhen());
48838      }
48839  }
48840
48841  protected void composeInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
48842    if (element != null) {
48843      open(name);
48844      composeInsuranceComponentProperties(element);
48845      close();
48846    }
48847  }
48848
48849  protected void composeInsuranceComponentProperties(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
48850    composeBackboneElementProperties(element);
48851      if (element.hasCoverage()) {
48852        composeReference("coverage", element.getCoverage());
48853      }
48854      if (element.hasInforceElement()) {
48855        composeBooleanCore("inforce", element.getInforceElement(), false);
48856        composeBooleanExtras("inforce", element.getInforceElement(), false);
48857      }
48858      if (element.hasBenefitPeriod()) {
48859        composePeriod("benefitPeriod", element.getBenefitPeriod());
48860      }
48861      if (element.hasItem()) {
48862        openArray("item");
48863        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
48864          composeItemsComponent(null, e);
48865        closeArray();
48866      };
48867  }
48868
48869  protected void composeItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
48870    if (element != null) {
48871      open(name);
48872      composeItemsComponentProperties(element);
48873      close();
48874    }
48875  }
48876
48877  protected void composeItemsComponentProperties(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
48878    composeBackboneElementProperties(element);
48879      if (element.hasCategory()) {
48880        composeCodeableConcept("category", element.getCategory());
48881      }
48882      if (element.hasProductOrService()) {
48883        composeCodeableConcept("productOrService", element.getProductOrService());
48884      }
48885      if (element.hasModifier()) {
48886        openArray("modifier");
48887        for (CodeableConcept e : element.getModifier()) 
48888          composeCodeableConcept(null, e);
48889        closeArray();
48890      };
48891      if (element.hasProvider()) {
48892        composeReference("provider", element.getProvider());
48893      }
48894      if (element.hasExcludedElement()) {
48895        composeBooleanCore("excluded", element.getExcludedElement(), false);
48896        composeBooleanExtras("excluded", element.getExcludedElement(), false);
48897      }
48898      if (element.hasNameElement()) {
48899        composeStringCore("name", element.getNameElement(), false);
48900        composeStringExtras("name", element.getNameElement(), false);
48901      }
48902      if (element.hasDescriptionElement()) {
48903        composeStringCore("description", element.getDescriptionElement(), false);
48904        composeStringExtras("description", element.getDescriptionElement(), false);
48905      }
48906      if (element.hasNetwork()) {
48907        composeCodeableConcept("network", element.getNetwork());
48908      }
48909      if (element.hasUnit()) {
48910        composeCodeableConcept("unit", element.getUnit());
48911      }
48912      if (element.hasTerm()) {
48913        composeCodeableConcept("term", element.getTerm());
48914      }
48915      if (element.hasBenefit()) {
48916        openArray("benefit");
48917        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
48918          composeBenefitComponent(null, e);
48919        closeArray();
48920      };
48921      if (element.hasAuthorizationRequiredElement()) {
48922        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
48923        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
48924      }
48925      if (element.hasAuthorizationSupporting()) {
48926        openArray("authorizationSupporting");
48927        for (CodeableConcept e : element.getAuthorizationSupporting()) 
48928          composeCodeableConcept(null, e);
48929        closeArray();
48930      };
48931      if (element.hasAuthorizationUrlElement()) {
48932        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
48933        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
48934      }
48935  }
48936
48937  protected void composeBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
48938    if (element != null) {
48939      open(name);
48940      composeBenefitComponentProperties(element);
48941      close();
48942    }
48943  }
48944
48945  protected void composeBenefitComponentProperties(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
48946    composeBackboneElementProperties(element);
48947      if (element.hasType()) {
48948        composeCodeableConcept("type", element.getType());
48949      }
48950      if (element.hasAllowed()) {
48951        composeType("allowed", element.getAllowed());
48952      }
48953      if (element.hasUsed()) {
48954        composeType("used", element.getUsed());
48955      }
48956  }
48957
48958  protected void composeErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
48959    if (element != null) {
48960      open(name);
48961      composeErrorsComponentProperties(element);
48962      close();
48963    }
48964  }
48965
48966  protected void composeErrorsComponentProperties(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
48967    composeBackboneElementProperties(element);
48968      if (element.hasCode()) {
48969        composeCodeableConcept("code", element.getCode());
48970      }
48971      if (element.hasExpression()) {
48972        if (anyHasValue(element.getExpression())) {
48973          openArray("expression");
48974          for (StringType e : element.getExpression()) 
48975            composeStringCore(null, e, e != element.getExpression().get(element.getExpression().size()-1));
48976          closeArray();
48977        }
48978        if (anyHasExtras(element.getExpression())) {
48979          openArray("_expression");
48980          for (StringType e : element.getExpression()) 
48981            composeStringExtras(null, e, true);
48982          closeArray();
48983        }
48984      };
48985  }
48986
48987  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
48988    if (element != null) {
48989      prop("resourceType", name);
48990      composeDetectedIssueProperties(element);
48991    }
48992  }
48993
48994  protected void composeDetectedIssueProperties(DetectedIssue element) throws IOException {
48995    composeDomainResourceProperties(element);
48996      if (element.hasIdentifier()) {
48997        openArray("identifier");
48998        for (Identifier e : element.getIdentifier()) 
48999          composeIdentifier(null, e);
49000        closeArray();
49001      };
49002      if (element.hasStatusElement()) {
49003        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
49004        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
49005      }
49006      if (element.hasCategory()) {
49007        openArray("category");
49008        for (CodeableConcept e : element.getCategory()) 
49009          composeCodeableConcept(null, e);
49010        closeArray();
49011      };
49012      if (element.hasCode()) {
49013        composeCodeableConcept("code", element.getCode());
49014      }
49015      if (element.hasSeverityElement()) {
49016        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
49017        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
49018      }
49019      if (element.hasSubject()) {
49020        composeReference("subject", element.getSubject());
49021      }
49022      if (element.hasEncounter()) {
49023        composeReference("encounter", element.getEncounter());
49024      }
49025      if (element.hasIdentified()) {
49026        composeType("identified", element.getIdentified());
49027      }
49028      if (element.hasAuthor()) {
49029        composeReference("author", element.getAuthor());
49030      }
49031      if (element.hasImplicated()) {
49032        openArray("implicated");
49033        for (Reference e : element.getImplicated()) 
49034          composeReference(null, e);
49035        closeArray();
49036      };
49037      if (element.hasEvidence()) {
49038        openArray("evidence");
49039        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
49040          composeDetectedIssueEvidenceComponent(null, e);
49041        closeArray();
49042      };
49043      if (element.hasDetailElement()) {
49044        composeMarkdownCore("detail", element.getDetailElement(), false);
49045        composeMarkdownExtras("detail", element.getDetailElement(), false);
49046      }
49047      if (element.hasReferenceElement()) {
49048        composeUriCore("reference", element.getReferenceElement(), false);
49049        composeUriExtras("reference", element.getReferenceElement(), false);
49050      }
49051      if (element.hasMitigation()) {
49052        openArray("mitigation");
49053        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
49054          composeDetectedIssueMitigationComponent(null, e);
49055        closeArray();
49056      };
49057  }
49058
49059  protected void composeDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
49060    if (element != null) {
49061      open(name);
49062      composeDetectedIssueEvidenceComponentProperties(element);
49063      close();
49064    }
49065  }
49066
49067  protected void composeDetectedIssueEvidenceComponentProperties(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
49068    composeBackboneElementProperties(element);
49069      if (element.hasCode()) {
49070        openArray("code");
49071        for (CodeableConcept e : element.getCode()) 
49072          composeCodeableConcept(null, e);
49073        closeArray();
49074      };
49075      if (element.hasDetail()) {
49076        openArray("detail");
49077        for (Reference e : element.getDetail()) 
49078          composeReference(null, e);
49079        closeArray();
49080      };
49081  }
49082
49083  protected void composeDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
49084    if (element != null) {
49085      open(name);
49086      composeDetectedIssueMitigationComponentProperties(element);
49087      close();
49088    }
49089  }
49090
49091  protected void composeDetectedIssueMitigationComponentProperties(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
49092    composeBackboneElementProperties(element);
49093      if (element.hasAction()) {
49094        composeCodeableConcept("action", element.getAction());
49095      }
49096      if (element.hasDateElement()) {
49097        composeDateTimeCore("date", element.getDateElement(), false);
49098        composeDateTimeExtras("date", element.getDateElement(), false);
49099      }
49100      if (element.hasAuthor()) {
49101        composeReference("author", element.getAuthor());
49102      }
49103      if (element.hasNote()) {
49104        openArray("note");
49105        for (Annotation e : element.getNote()) 
49106          composeAnnotation(null, e);
49107        closeArray();
49108      };
49109  }
49110
49111  protected void composeDevice(String name, Device element) throws IOException {
49112    if (element != null) {
49113      prop("resourceType", name);
49114      composeDeviceProperties(element);
49115    }
49116  }
49117
49118  protected void composeDeviceProperties(Device element) throws IOException {
49119    composeDomainResourceProperties(element);
49120      if (element.hasIdentifier()) {
49121        openArray("identifier");
49122        for (Identifier e : element.getIdentifier()) 
49123          composeIdentifier(null, e);
49124        closeArray();
49125      };
49126      if (element.hasDisplayNameElement()) {
49127        composeStringCore("displayName", element.getDisplayNameElement(), false);
49128        composeStringExtras("displayName", element.getDisplayNameElement(), false);
49129      }
49130      if (element.hasDefinition()) {
49131        composeCodeableReference("definition", element.getDefinition());
49132      }
49133      if (element.hasUdiCarrier()) {
49134        openArray("udiCarrier");
49135        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
49136          composeDeviceUdiCarrierComponent(null, e);
49137        closeArray();
49138      };
49139      if (element.hasStatusElement()) {
49140        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
49141        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
49142      }
49143      if (element.hasAvailabilityStatus()) {
49144        composeCodeableConcept("availabilityStatus", element.getAvailabilityStatus());
49145      }
49146      if (element.hasBiologicalSourceEvent()) {
49147        composeIdentifier("biologicalSourceEvent", element.getBiologicalSourceEvent());
49148      }
49149      if (element.hasManufacturerElement()) {
49150        composeStringCore("manufacturer", element.getManufacturerElement(), false);
49151        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
49152      }
49153      if (element.hasManufactureDateElement()) {
49154        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
49155        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
49156      }
49157      if (element.hasExpirationDateElement()) {
49158        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
49159        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
49160      }
49161      if (element.hasLotNumberElement()) {
49162        composeStringCore("lotNumber", element.getLotNumberElement(), false);
49163        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
49164      }
49165      if (element.hasSerialNumberElement()) {
49166        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
49167        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
49168      }
49169      if (element.hasName()) {
49170        openArray("name");
49171        for (Device.DeviceNameComponent e : element.getName()) 
49172          composeDeviceNameComponent(null, e);
49173        closeArray();
49174      };
49175      if (element.hasModelNumberElement()) {
49176        composeStringCore("modelNumber", element.getModelNumberElement(), false);
49177        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
49178      }
49179      if (element.hasPartNumberElement()) {
49180        composeStringCore("partNumber", element.getPartNumberElement(), false);
49181        composeStringExtras("partNumber", element.getPartNumberElement(), false);
49182      }
49183      if (element.hasCategory()) {
49184        openArray("category");
49185        for (CodeableConcept e : element.getCategory()) 
49186          composeCodeableConcept(null, e);
49187        closeArray();
49188      };
49189      if (element.hasType()) {
49190        openArray("type");
49191        for (CodeableConcept e : element.getType()) 
49192          composeCodeableConcept(null, e);
49193        closeArray();
49194      };
49195      if (element.hasVersion()) {
49196        openArray("version");
49197        for (Device.DeviceVersionComponent e : element.getVersion()) 
49198          composeDeviceVersionComponent(null, e);
49199        closeArray();
49200      };
49201      if (element.hasConformsTo()) {
49202        openArray("conformsTo");
49203        for (Device.DeviceConformsToComponent e : element.getConformsTo()) 
49204          composeDeviceConformsToComponent(null, e);
49205        closeArray();
49206      };
49207      if (element.hasProperty()) {
49208        openArray("property");
49209        for (Device.DevicePropertyComponent e : element.getProperty()) 
49210          composeDevicePropertyComponent(null, e);
49211        closeArray();
49212      };
49213      if (element.hasMode()) {
49214        composeCodeableConcept("mode", element.getMode());
49215      }
49216      if (element.hasCycle()) {
49217        composeCount("cycle", element.getCycle());
49218      }
49219      if (element.hasDuration()) {
49220        composeDuration("duration", element.getDuration());
49221      }
49222      if (element.hasOwner()) {
49223        composeReference("owner", element.getOwner());
49224      }
49225      if (element.hasContact()) {
49226        openArray("contact");
49227        for (ContactPoint e : element.getContact()) 
49228          composeContactPoint(null, e);
49229        closeArray();
49230      };
49231      if (element.hasLocation()) {
49232        composeReference("location", element.getLocation());
49233      }
49234      if (element.hasUrlElement()) {
49235        composeUriCore("url", element.getUrlElement(), false);
49236        composeUriExtras("url", element.getUrlElement(), false);
49237      }
49238      if (element.hasEndpoint()) {
49239        openArray("endpoint");
49240        for (Reference e : element.getEndpoint()) 
49241          composeReference(null, e);
49242        closeArray();
49243      };
49244      if (element.hasGateway()) {
49245        openArray("gateway");
49246        for (CodeableReference e : element.getGateway()) 
49247          composeCodeableReference(null, e);
49248        closeArray();
49249      };
49250      if (element.hasNote()) {
49251        openArray("note");
49252        for (Annotation e : element.getNote()) 
49253          composeAnnotation(null, e);
49254        closeArray();
49255      };
49256      if (element.hasSafety()) {
49257        openArray("safety");
49258        for (CodeableConcept e : element.getSafety()) 
49259          composeCodeableConcept(null, e);
49260        closeArray();
49261      };
49262      if (element.hasParent()) {
49263        composeReference("parent", element.getParent());
49264      }
49265  }
49266
49267  protected void composeDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
49268    if (element != null) {
49269      open(name);
49270      composeDeviceUdiCarrierComponentProperties(element);
49271      close();
49272    }
49273  }
49274
49275  protected void composeDeviceUdiCarrierComponentProperties(Device.DeviceUdiCarrierComponent element) throws IOException {
49276    composeBackboneElementProperties(element);
49277      if (element.hasDeviceIdentifierElement()) {
49278        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49279        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49280      }
49281      if (element.hasIssuerElement()) {
49282        composeUriCore("issuer", element.getIssuerElement(), false);
49283        composeUriExtras("issuer", element.getIssuerElement(), false);
49284      }
49285      if (element.hasJurisdictionElement()) {
49286        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
49287        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
49288      }
49289      if (element.hasCarrierAIDCElement()) {
49290        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
49291        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
49292      }
49293      if (element.hasCarrierHRFElement()) {
49294        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
49295        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
49296      }
49297      if (element.hasEntryTypeElement()) {
49298        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
49299        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
49300      }
49301  }
49302
49303  protected void composeDeviceNameComponent(String name, Device.DeviceNameComponent element) throws IOException {
49304    if (element != null) {
49305      open(name);
49306      composeDeviceNameComponentProperties(element);
49307      close();
49308    }
49309  }
49310
49311  protected void composeDeviceNameComponentProperties(Device.DeviceNameComponent element) throws IOException {
49312    composeBackboneElementProperties(element);
49313      if (element.hasValueElement()) {
49314        composeStringCore("value", element.getValueElement(), false);
49315        composeStringExtras("value", element.getValueElement(), false);
49316      }
49317      if (element.hasTypeElement()) {
49318        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49319        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49320      }
49321      if (element.hasDisplayElement()) {
49322        composeBooleanCore("display", element.getDisplayElement(), false);
49323        composeBooleanExtras("display", element.getDisplayElement(), false);
49324      }
49325  }
49326
49327  protected void composeDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
49328    if (element != null) {
49329      open(name);
49330      composeDeviceVersionComponentProperties(element);
49331      close();
49332    }
49333  }
49334
49335  protected void composeDeviceVersionComponentProperties(Device.DeviceVersionComponent element) throws IOException {
49336    composeBackboneElementProperties(element);
49337      if (element.hasType()) {
49338        composeCodeableConcept("type", element.getType());
49339      }
49340      if (element.hasComponent()) {
49341        composeIdentifier("component", element.getComponent());
49342      }
49343      if (element.hasInstallDateElement()) {
49344        composeDateTimeCore("installDate", element.getInstallDateElement(), false);
49345        composeDateTimeExtras("installDate", element.getInstallDateElement(), false);
49346      }
49347      if (element.hasValueElement()) {
49348        composeStringCore("value", element.getValueElement(), false);
49349        composeStringExtras("value", element.getValueElement(), false);
49350      }
49351  }
49352
49353  protected void composeDeviceConformsToComponent(String name, Device.DeviceConformsToComponent element) throws IOException {
49354    if (element != null) {
49355      open(name);
49356      composeDeviceConformsToComponentProperties(element);
49357      close();
49358    }
49359  }
49360
49361  protected void composeDeviceConformsToComponentProperties(Device.DeviceConformsToComponent element) throws IOException {
49362    composeBackboneElementProperties(element);
49363      if (element.hasCategory()) {
49364        composeCodeableConcept("category", element.getCategory());
49365      }
49366      if (element.hasSpecification()) {
49367        composeCodeableConcept("specification", element.getSpecification());
49368      }
49369      if (element.hasVersionElement()) {
49370        composeStringCore("version", element.getVersionElement(), false);
49371        composeStringExtras("version", element.getVersionElement(), false);
49372      }
49373  }
49374
49375  protected void composeDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
49376    if (element != null) {
49377      open(name);
49378      composeDevicePropertyComponentProperties(element);
49379      close();
49380    }
49381  }
49382
49383  protected void composeDevicePropertyComponentProperties(Device.DevicePropertyComponent element) throws IOException {
49384    composeBackboneElementProperties(element);
49385      if (element.hasType()) {
49386        composeCodeableConcept("type", element.getType());
49387      }
49388      if (element.hasValue()) {
49389        composeType("value", element.getValue());
49390      }
49391  }
49392
49393  protected void composeDeviceAssociation(String name, DeviceAssociation element) throws IOException {
49394    if (element != null) {
49395      prop("resourceType", name);
49396      composeDeviceAssociationProperties(element);
49397    }
49398  }
49399
49400  protected void composeDeviceAssociationProperties(DeviceAssociation element) throws IOException {
49401    composeDomainResourceProperties(element);
49402      if (element.hasIdentifier()) {
49403        openArray("identifier");
49404        for (Identifier e : element.getIdentifier()) 
49405          composeIdentifier(null, e);
49406        closeArray();
49407      };
49408      if (element.hasDevice()) {
49409        composeReference("device", element.getDevice());
49410      }
49411      if (element.hasCategory()) {
49412        openArray("category");
49413        for (CodeableConcept e : element.getCategory()) 
49414          composeCodeableConcept(null, e);
49415        closeArray();
49416      };
49417      if (element.hasStatus()) {
49418        composeCodeableConcept("status", element.getStatus());
49419      }
49420      if (element.hasStatusReason()) {
49421        openArray("statusReason");
49422        for (CodeableConcept e : element.getStatusReason()) 
49423          composeCodeableConcept(null, e);
49424        closeArray();
49425      };
49426      if (element.hasSubject()) {
49427        composeReference("subject", element.getSubject());
49428      }
49429      if (element.hasBodyStructure()) {
49430        composeReference("bodyStructure", element.getBodyStructure());
49431      }
49432      if (element.hasPeriod()) {
49433        composePeriod("period", element.getPeriod());
49434      }
49435      if (element.hasOperation()) {
49436        openArray("operation");
49437        for (DeviceAssociation.DeviceAssociationOperationComponent e : element.getOperation()) 
49438          composeDeviceAssociationOperationComponent(null, e);
49439        closeArray();
49440      };
49441  }
49442
49443  protected void composeDeviceAssociationOperationComponent(String name, DeviceAssociation.DeviceAssociationOperationComponent element) throws IOException {
49444    if (element != null) {
49445      open(name);
49446      composeDeviceAssociationOperationComponentProperties(element);
49447      close();
49448    }
49449  }
49450
49451  protected void composeDeviceAssociationOperationComponentProperties(DeviceAssociation.DeviceAssociationOperationComponent element) throws IOException {
49452    composeBackboneElementProperties(element);
49453      if (element.hasStatus()) {
49454        composeCodeableConcept("status", element.getStatus());
49455      }
49456      if (element.hasOperator()) {
49457        openArray("operator");
49458        for (Reference e : element.getOperator()) 
49459          composeReference(null, e);
49460        closeArray();
49461      };
49462      if (element.hasPeriod()) {
49463        composePeriod("period", element.getPeriod());
49464      }
49465  }
49466
49467  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
49468    if (element != null) {
49469      prop("resourceType", name);
49470      composeDeviceDefinitionProperties(element);
49471    }
49472  }
49473
49474  protected void composeDeviceDefinitionProperties(DeviceDefinition element) throws IOException {
49475    composeDomainResourceProperties(element);
49476      if (element.hasDescriptionElement()) {
49477        composeMarkdownCore("description", element.getDescriptionElement(), false);
49478        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49479      }
49480      if (element.hasIdentifier()) {
49481        openArray("identifier");
49482        for (Identifier e : element.getIdentifier()) 
49483          composeIdentifier(null, e);
49484        closeArray();
49485      };
49486      if (element.hasUdiDeviceIdentifier()) {
49487        openArray("udiDeviceIdentifier");
49488        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
49489          composeDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
49490        closeArray();
49491      };
49492      if (element.hasRegulatoryIdentifier()) {
49493        openArray("regulatoryIdentifier");
49494        for (DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent e : element.getRegulatoryIdentifier()) 
49495          composeDeviceDefinitionRegulatoryIdentifierComponent(null, e);
49496        closeArray();
49497      };
49498      if (element.hasPartNumberElement()) {
49499        composeStringCore("partNumber", element.getPartNumberElement(), false);
49500        composeStringExtras("partNumber", element.getPartNumberElement(), false);
49501      }
49502      if (element.hasManufacturer()) {
49503        composeReference("manufacturer", element.getManufacturer());
49504      }
49505      if (element.hasDeviceName()) {
49506        openArray("deviceName");
49507        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
49508          composeDeviceDefinitionDeviceNameComponent(null, e);
49509        closeArray();
49510      };
49511      if (element.hasModelNumberElement()) {
49512        composeStringCore("modelNumber", element.getModelNumberElement(), false);
49513        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
49514      }
49515      if (element.hasClassification()) {
49516        openArray("classification");
49517        for (DeviceDefinition.DeviceDefinitionClassificationComponent e : element.getClassification()) 
49518          composeDeviceDefinitionClassificationComponent(null, e);
49519        closeArray();
49520      };
49521      if (element.hasConformsTo()) {
49522        openArray("conformsTo");
49523        for (DeviceDefinition.DeviceDefinitionConformsToComponent e : element.getConformsTo()) 
49524          composeDeviceDefinitionConformsToComponent(null, e);
49525        closeArray();
49526      };
49527      if (element.hasHasPart()) {
49528        openArray("hasPart");
49529        for (DeviceDefinition.DeviceDefinitionHasPartComponent e : element.getHasPart()) 
49530          composeDeviceDefinitionHasPartComponent(null, e);
49531        closeArray();
49532      };
49533      if (element.hasPackaging()) {
49534        openArray("packaging");
49535        for (DeviceDefinition.DeviceDefinitionPackagingComponent e : element.getPackaging()) 
49536          composeDeviceDefinitionPackagingComponent(null, e);
49537        closeArray();
49538      };
49539      if (element.hasVersion()) {
49540        openArray("version");
49541        for (DeviceDefinition.DeviceDefinitionVersionComponent e : element.getVersion()) 
49542          composeDeviceDefinitionVersionComponent(null, e);
49543        closeArray();
49544      };
49545      if (element.hasSafety()) {
49546        openArray("safety");
49547        for (CodeableConcept e : element.getSafety()) 
49548          composeCodeableConcept(null, e);
49549        closeArray();
49550      };
49551      if (element.hasShelfLifeStorage()) {
49552        openArray("shelfLifeStorage");
49553        for (ProductShelfLife e : element.getShelfLifeStorage()) 
49554          composeProductShelfLife(null, e);
49555        closeArray();
49556      };
49557      if (element.hasLanguageCode()) {
49558        openArray("languageCode");
49559        for (CodeableConcept e : element.getLanguageCode()) 
49560          composeCodeableConcept(null, e);
49561        closeArray();
49562      };
49563      if (element.hasProperty()) {
49564        openArray("property");
49565        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
49566          composeDeviceDefinitionPropertyComponent(null, e);
49567        closeArray();
49568      };
49569      if (element.hasOwner()) {
49570        composeReference("owner", element.getOwner());
49571      }
49572      if (element.hasContact()) {
49573        openArray("contact");
49574        for (ContactPoint e : element.getContact()) 
49575          composeContactPoint(null, e);
49576        closeArray();
49577      };
49578      if (element.hasLink()) {
49579        openArray("link");
49580        for (DeviceDefinition.DeviceDefinitionLinkComponent e : element.getLink()) 
49581          composeDeviceDefinitionLinkComponent(null, e);
49582        closeArray();
49583      };
49584      if (element.hasNote()) {
49585        openArray("note");
49586        for (Annotation e : element.getNote()) 
49587          composeAnnotation(null, e);
49588        closeArray();
49589      };
49590      if (element.hasMaterial()) {
49591        openArray("material");
49592        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
49593          composeDeviceDefinitionMaterialComponent(null, e);
49594        closeArray();
49595      };
49596      if (element.hasProductionIdentifierInUDI()) {
49597        openArray("productionIdentifierInUDI");
49598        for (Enumeration<DeviceDefinition.DeviceProductionIdentifierInUDI> e : element.getProductionIdentifierInUDI()) 
49599          composeEnumerationCore(null, e, new DeviceDefinition.DeviceProductionIdentifierInUDIEnumFactory(), true);
49600        closeArray();
49601        if (anyHasExtras(element.getProductionIdentifierInUDI())) {
49602          openArray("_productionIdentifierInUDI");
49603          for (Enumeration<DeviceDefinition.DeviceProductionIdentifierInUDI> e : element.getProductionIdentifierInUDI()) 
49604            composeEnumerationExtras(null, e, new DeviceDefinition.DeviceProductionIdentifierInUDIEnumFactory(), true);
49605          closeArray();
49606        }
49607      };
49608      if (element.hasGuideline()) {
49609        composeDeviceDefinitionGuidelineComponent("guideline", element.getGuideline());
49610      }
49611      if (element.hasCorrectiveAction()) {
49612        composeDeviceDefinitionCorrectiveActionComponent("correctiveAction", element.getCorrectiveAction());
49613      }
49614      if (element.hasChargeItem()) {
49615        openArray("chargeItem");
49616        for (DeviceDefinition.DeviceDefinitionChargeItemComponent e : element.getChargeItem()) 
49617          composeDeviceDefinitionChargeItemComponent(null, e);
49618        closeArray();
49619      };
49620  }
49621
49622  protected void composeDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
49623    if (element != null) {
49624      open(name);
49625      composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(element);
49626      close();
49627    }
49628  }
49629
49630  protected void composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
49631    composeBackboneElementProperties(element);
49632      if (element.hasDeviceIdentifierElement()) {
49633        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49634        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49635      }
49636      if (element.hasIssuerElement()) {
49637        composeUriCore("issuer", element.getIssuerElement(), false);
49638        composeUriExtras("issuer", element.getIssuerElement(), false);
49639      }
49640      if (element.hasJurisdictionElement()) {
49641        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
49642        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
49643      }
49644      if (element.hasMarketDistribution()) {
49645        openArray("marketDistribution");
49646        for (DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent e : element.getMarketDistribution()) 
49647          composeUdiDeviceIdentifierMarketDistributionComponent(null, e);
49648        closeArray();
49649      };
49650  }
49651
49652  protected void composeUdiDeviceIdentifierMarketDistributionComponent(String name, DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent element) throws IOException {
49653    if (element != null) {
49654      open(name);
49655      composeUdiDeviceIdentifierMarketDistributionComponentProperties(element);
49656      close();
49657    }
49658  }
49659
49660  protected void composeUdiDeviceIdentifierMarketDistributionComponentProperties(DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent element) throws IOException {
49661    composeBackboneElementProperties(element);
49662      if (element.hasMarketPeriod()) {
49663        composePeriod("marketPeriod", element.getMarketPeriod());
49664      }
49665      if (element.hasSubJurisdictionElement()) {
49666        composeUriCore("subJurisdiction", element.getSubJurisdictionElement(), false);
49667        composeUriExtras("subJurisdiction", element.getSubJurisdictionElement(), false);
49668      }
49669  }
49670
49671  protected void composeDeviceDefinitionRegulatoryIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent element) throws IOException {
49672    if (element != null) {
49673      open(name);
49674      composeDeviceDefinitionRegulatoryIdentifierComponentProperties(element);
49675      close();
49676    }
49677  }
49678
49679  protected void composeDeviceDefinitionRegulatoryIdentifierComponentProperties(DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent element) throws IOException {
49680    composeBackboneElementProperties(element);
49681      if (element.hasTypeElement()) {
49682        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceDefinitionRegulatoryIdentifierTypeEnumFactory(), false);
49683        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceDefinitionRegulatoryIdentifierTypeEnumFactory(), false);
49684      }
49685      if (element.hasDeviceIdentifierElement()) {
49686        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49687        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49688      }
49689      if (element.hasIssuerElement()) {
49690        composeUriCore("issuer", element.getIssuerElement(), false);
49691        composeUriExtras("issuer", element.getIssuerElement(), false);
49692      }
49693      if (element.hasJurisdictionElement()) {
49694        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
49695        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
49696      }
49697  }
49698
49699  protected void composeDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
49700    if (element != null) {
49701      open(name);
49702      composeDeviceDefinitionDeviceNameComponentProperties(element);
49703      close();
49704    }
49705  }
49706
49707  protected void composeDeviceDefinitionDeviceNameComponentProperties(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
49708    composeBackboneElementProperties(element);
49709      if (element.hasNameElement()) {
49710        composeStringCore("name", element.getNameElement(), false);
49711        composeStringExtras("name", element.getNameElement(), false);
49712      }
49713      if (element.hasTypeElement()) {
49714        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49715        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49716      }
49717  }
49718
49719  protected void composeDeviceDefinitionClassificationComponent(String name, DeviceDefinition.DeviceDefinitionClassificationComponent element) throws IOException {
49720    if (element != null) {
49721      open(name);
49722      composeDeviceDefinitionClassificationComponentProperties(element);
49723      close();
49724    }
49725  }
49726
49727  protected void composeDeviceDefinitionClassificationComponentProperties(DeviceDefinition.DeviceDefinitionClassificationComponent element) throws IOException {
49728    composeBackboneElementProperties(element);
49729      if (element.hasType()) {
49730        composeCodeableConcept("type", element.getType());
49731      }
49732      if (element.hasJustification()) {
49733        openArray("justification");
49734        for (RelatedArtifact e : element.getJustification()) 
49735          composeRelatedArtifact(null, e);
49736        closeArray();
49737      };
49738  }
49739
49740  protected void composeDeviceDefinitionConformsToComponent(String name, DeviceDefinition.DeviceDefinitionConformsToComponent element) throws IOException {
49741    if (element != null) {
49742      open(name);
49743      composeDeviceDefinitionConformsToComponentProperties(element);
49744      close();
49745    }
49746  }
49747
49748  protected void composeDeviceDefinitionConformsToComponentProperties(DeviceDefinition.DeviceDefinitionConformsToComponent element) throws IOException {
49749    composeBackboneElementProperties(element);
49750      if (element.hasCategory()) {
49751        composeCodeableConcept("category", element.getCategory());
49752      }
49753      if (element.hasSpecification()) {
49754        composeCodeableConcept("specification", element.getSpecification());
49755      }
49756      if (element.hasVersion()) {
49757        if (anyHasValue(element.getVersion())) {
49758          openArray("version");
49759          for (StringType e : element.getVersion()) 
49760            composeStringCore(null, e, e != element.getVersion().get(element.getVersion().size()-1));
49761          closeArray();
49762        }
49763        if (anyHasExtras(element.getVersion())) {
49764          openArray("_version");
49765          for (StringType e : element.getVersion()) 
49766            composeStringExtras(null, e, true);
49767          closeArray();
49768        }
49769      };
49770      if (element.hasSource()) {
49771        openArray("source");
49772        for (RelatedArtifact e : element.getSource()) 
49773          composeRelatedArtifact(null, e);
49774        closeArray();
49775      };
49776  }
49777
49778  protected void composeDeviceDefinitionHasPartComponent(String name, DeviceDefinition.DeviceDefinitionHasPartComponent element) throws IOException {
49779    if (element != null) {
49780      open(name);
49781      composeDeviceDefinitionHasPartComponentProperties(element);
49782      close();
49783    }
49784  }
49785
49786  protected void composeDeviceDefinitionHasPartComponentProperties(DeviceDefinition.DeviceDefinitionHasPartComponent element) throws IOException {
49787    composeBackboneElementProperties(element);
49788      if (element.hasReference()) {
49789        composeReference("reference", element.getReference());
49790      }
49791      if (element.hasCountElement()) {
49792        composeIntegerCore("count", element.getCountElement(), false);
49793        composeIntegerExtras("count", element.getCountElement(), false);
49794      }
49795  }
49796
49797  protected void composeDeviceDefinitionPackagingComponent(String name, DeviceDefinition.DeviceDefinitionPackagingComponent element) throws IOException {
49798    if (element != null) {
49799      open(name);
49800      composeDeviceDefinitionPackagingComponentProperties(element);
49801      close();
49802    }
49803  }
49804
49805  protected void composeDeviceDefinitionPackagingComponentProperties(DeviceDefinition.DeviceDefinitionPackagingComponent element) throws IOException {
49806    composeBackboneElementProperties(element);
49807      if (element.hasIdentifier()) {
49808        composeIdentifier("identifier", element.getIdentifier());
49809      }
49810      if (element.hasType()) {
49811        composeCodeableConcept("type", element.getType());
49812      }
49813      if (element.hasCountElement()) {
49814        composeIntegerCore("count", element.getCountElement(), false);
49815        composeIntegerExtras("count", element.getCountElement(), false);
49816      }
49817      if (element.hasDistributor()) {
49818        openArray("distributor");
49819        for (DeviceDefinition.PackagingDistributorComponent e : element.getDistributor()) 
49820          composePackagingDistributorComponent(null, e);
49821        closeArray();
49822      };
49823      if (element.hasUdiDeviceIdentifier()) {
49824        openArray("udiDeviceIdentifier");
49825        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
49826          composeDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
49827        closeArray();
49828      };
49829      if (element.hasPackaging()) {
49830        openArray("packaging");
49831        for (DeviceDefinition.DeviceDefinitionPackagingComponent e : element.getPackaging()) 
49832          composeDeviceDefinitionPackagingComponent(null, e);
49833        closeArray();
49834      };
49835  }
49836
49837  protected void composePackagingDistributorComponent(String name, DeviceDefinition.PackagingDistributorComponent element) throws IOException {
49838    if (element != null) {
49839      open(name);
49840      composePackagingDistributorComponentProperties(element);
49841      close();
49842    }
49843  }
49844
49845  protected void composePackagingDistributorComponentProperties(DeviceDefinition.PackagingDistributorComponent element) throws IOException {
49846    composeBackboneElementProperties(element);
49847      if (element.hasNameElement()) {
49848        composeStringCore("name", element.getNameElement(), false);
49849        composeStringExtras("name", element.getNameElement(), false);
49850      }
49851      if (element.hasOrganizationReference()) {
49852        openArray("organizationReference");
49853        for (Reference e : element.getOrganizationReference()) 
49854          composeReference(null, e);
49855        closeArray();
49856      };
49857  }
49858
49859  protected void composeDeviceDefinitionVersionComponent(String name, DeviceDefinition.DeviceDefinitionVersionComponent element) throws IOException {
49860    if (element != null) {
49861      open(name);
49862      composeDeviceDefinitionVersionComponentProperties(element);
49863      close();
49864    }
49865  }
49866
49867  protected void composeDeviceDefinitionVersionComponentProperties(DeviceDefinition.DeviceDefinitionVersionComponent element) throws IOException {
49868    composeBackboneElementProperties(element);
49869      if (element.hasType()) {
49870        composeCodeableConcept("type", element.getType());
49871      }
49872      if (element.hasComponent()) {
49873        composeIdentifier("component", element.getComponent());
49874      }
49875      if (element.hasValueElement()) {
49876        composeStringCore("value", element.getValueElement(), false);
49877        composeStringExtras("value", element.getValueElement(), false);
49878      }
49879  }
49880
49881  protected void composeDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
49882    if (element != null) {
49883      open(name);
49884      composeDeviceDefinitionPropertyComponentProperties(element);
49885      close();
49886    }
49887  }
49888
49889  protected void composeDeviceDefinitionPropertyComponentProperties(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
49890    composeBackboneElementProperties(element);
49891      if (element.hasType()) {
49892        composeCodeableConcept("type", element.getType());
49893      }
49894      if (element.hasValue()) {
49895        composeType("value", element.getValue());
49896      }
49897  }
49898
49899  protected void composeDeviceDefinitionLinkComponent(String name, DeviceDefinition.DeviceDefinitionLinkComponent element) throws IOException {
49900    if (element != null) {
49901      open(name);
49902      composeDeviceDefinitionLinkComponentProperties(element);
49903      close();
49904    }
49905  }
49906
49907  protected void composeDeviceDefinitionLinkComponentProperties(DeviceDefinition.DeviceDefinitionLinkComponent element) throws IOException {
49908    composeBackboneElementProperties(element);
49909      if (element.hasRelation()) {
49910        composeCoding("relation", element.getRelation());
49911      }
49912      if (element.hasRelatedDevice()) {
49913        composeCodeableReference("relatedDevice", element.getRelatedDevice());
49914      }
49915  }
49916
49917  protected void composeDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
49918    if (element != null) {
49919      open(name);
49920      composeDeviceDefinitionMaterialComponentProperties(element);
49921      close();
49922    }
49923  }
49924
49925  protected void composeDeviceDefinitionMaterialComponentProperties(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
49926    composeBackboneElementProperties(element);
49927      if (element.hasSubstance()) {
49928        composeCodeableConcept("substance", element.getSubstance());
49929      }
49930      if (element.hasAlternateElement()) {
49931        composeBooleanCore("alternate", element.getAlternateElement(), false);
49932        composeBooleanExtras("alternate", element.getAlternateElement(), false);
49933      }
49934      if (element.hasAllergenicIndicatorElement()) {
49935        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
49936        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
49937      }
49938  }
49939
49940  protected void composeDeviceDefinitionGuidelineComponent(String name, DeviceDefinition.DeviceDefinitionGuidelineComponent element) throws IOException {
49941    if (element != null) {
49942      open(name);
49943      composeDeviceDefinitionGuidelineComponentProperties(element);
49944      close();
49945    }
49946  }
49947
49948  protected void composeDeviceDefinitionGuidelineComponentProperties(DeviceDefinition.DeviceDefinitionGuidelineComponent element) throws IOException {
49949    composeBackboneElementProperties(element);
49950      if (element.hasUseContext()) {
49951        openArray("useContext");
49952        for (UsageContext e : element.getUseContext()) 
49953          composeUsageContext(null, e);
49954        closeArray();
49955      };
49956      if (element.hasUsageInstructionElement()) {
49957        composeMarkdownCore("usageInstruction", element.getUsageInstructionElement(), false);
49958        composeMarkdownExtras("usageInstruction", element.getUsageInstructionElement(), false);
49959      }
49960      if (element.hasRelatedArtifact()) {
49961        openArray("relatedArtifact");
49962        for (RelatedArtifact e : element.getRelatedArtifact()) 
49963          composeRelatedArtifact(null, e);
49964        closeArray();
49965      };
49966      if (element.hasIndication()) {
49967        openArray("indication");
49968        for (CodeableConcept e : element.getIndication()) 
49969          composeCodeableConcept(null, e);
49970        closeArray();
49971      };
49972      if (element.hasContraindication()) {
49973        openArray("contraindication");
49974        for (CodeableConcept e : element.getContraindication()) 
49975          composeCodeableConcept(null, e);
49976        closeArray();
49977      };
49978      if (element.hasWarning()) {
49979        openArray("warning");
49980        for (CodeableConcept e : element.getWarning()) 
49981          composeCodeableConcept(null, e);
49982        closeArray();
49983      };
49984      if (element.hasIntendedUseElement()) {
49985        composeStringCore("intendedUse", element.getIntendedUseElement(), false);
49986        composeStringExtras("intendedUse", element.getIntendedUseElement(), false);
49987      }
49988  }
49989
49990  protected void composeDeviceDefinitionCorrectiveActionComponent(String name, DeviceDefinition.DeviceDefinitionCorrectiveActionComponent element) throws IOException {
49991    if (element != null) {
49992      open(name);
49993      composeDeviceDefinitionCorrectiveActionComponentProperties(element);
49994      close();
49995    }
49996  }
49997
49998  protected void composeDeviceDefinitionCorrectiveActionComponentProperties(DeviceDefinition.DeviceDefinitionCorrectiveActionComponent element) throws IOException {
49999    composeBackboneElementProperties(element);
50000      if (element.hasRecallElement()) {
50001        composeBooleanCore("recall", element.getRecallElement(), false);
50002        composeBooleanExtras("recall", element.getRecallElement(), false);
50003      }
50004      if (element.hasScopeElement()) {
50005        composeEnumerationCore("scope", element.getScopeElement(), new DeviceDefinition.DeviceCorrectiveActionScopeEnumFactory(), false);
50006        composeEnumerationExtras("scope", element.getScopeElement(), new DeviceDefinition.DeviceCorrectiveActionScopeEnumFactory(), false);
50007      }
50008      if (element.hasPeriod()) {
50009        composePeriod("period", element.getPeriod());
50010      }
50011  }
50012
50013  protected void composeDeviceDefinitionChargeItemComponent(String name, DeviceDefinition.DeviceDefinitionChargeItemComponent element) throws IOException {
50014    if (element != null) {
50015      open(name);
50016      composeDeviceDefinitionChargeItemComponentProperties(element);
50017      close();
50018    }
50019  }
50020
50021  protected void composeDeviceDefinitionChargeItemComponentProperties(DeviceDefinition.DeviceDefinitionChargeItemComponent element) throws IOException {
50022    composeBackboneElementProperties(element);
50023      if (element.hasChargeItemCode()) {
50024        composeCodeableReference("chargeItemCode", element.getChargeItemCode());
50025      }
50026      if (element.hasCount()) {
50027        composeQuantity("count", element.getCount());
50028      }
50029      if (element.hasEffectivePeriod()) {
50030        composePeriod("effectivePeriod", element.getEffectivePeriod());
50031      }
50032      if (element.hasUseContext()) {
50033        openArray("useContext");
50034        for (UsageContext e : element.getUseContext()) 
50035          composeUsageContext(null, e);
50036        closeArray();
50037      };
50038  }
50039
50040  protected void composeDeviceDispense(String name, DeviceDispense element) throws IOException {
50041    if (element != null) {
50042      prop("resourceType", name);
50043      composeDeviceDispenseProperties(element);
50044    }
50045  }
50046
50047  protected void composeDeviceDispenseProperties(DeviceDispense element) throws IOException {
50048    composeDomainResourceProperties(element);
50049      if (element.hasIdentifier()) {
50050        openArray("identifier");
50051        for (Identifier e : element.getIdentifier()) 
50052          composeIdentifier(null, e);
50053        closeArray();
50054      };
50055      if (element.hasBasedOn()) {
50056        openArray("basedOn");
50057        for (Reference e : element.getBasedOn()) 
50058          composeReference(null, e);
50059        closeArray();
50060      };
50061      if (element.hasPartOf()) {
50062        openArray("partOf");
50063        for (Reference e : element.getPartOf()) 
50064          composeReference(null, e);
50065        closeArray();
50066      };
50067      if (element.hasStatusElement()) {
50068        composeEnumerationCore("status", element.getStatusElement(), new DeviceDispense.DeviceDispenseStatusCodesEnumFactory(), false);
50069        composeEnumerationExtras("status", element.getStatusElement(), new DeviceDispense.DeviceDispenseStatusCodesEnumFactory(), false);
50070      }
50071      if (element.hasStatusReason()) {
50072        composeCodeableReference("statusReason", element.getStatusReason());
50073      }
50074      if (element.hasCategory()) {
50075        openArray("category");
50076        for (CodeableConcept e : element.getCategory()) 
50077          composeCodeableConcept(null, e);
50078        closeArray();
50079      };
50080      if (element.hasDevice()) {
50081        composeCodeableReference("device", element.getDevice());
50082      }
50083      if (element.hasSubject()) {
50084        composeReference("subject", element.getSubject());
50085      }
50086      if (element.hasReceiver()) {
50087        composeReference("receiver", element.getReceiver());
50088      }
50089      if (element.hasEncounter()) {
50090        composeReference("encounter", element.getEncounter());
50091      }
50092      if (element.hasSupportingInformation()) {
50093        openArray("supportingInformation");
50094        for (Reference e : element.getSupportingInformation()) 
50095          composeReference(null, e);
50096        closeArray();
50097      };
50098      if (element.hasPerformer()) {
50099        openArray("performer");
50100        for (DeviceDispense.DeviceDispensePerformerComponent e : element.getPerformer()) 
50101          composeDeviceDispensePerformerComponent(null, e);
50102        closeArray();
50103      };
50104      if (element.hasLocation()) {
50105        composeReference("location", element.getLocation());
50106      }
50107      if (element.hasType()) {
50108        composeCodeableConcept("type", element.getType());
50109      }
50110      if (element.hasQuantity()) {
50111        composeQuantity("quantity", element.getQuantity());
50112      }
50113      if (element.hasPreparedDateElement()) {
50114        composeDateTimeCore("preparedDate", element.getPreparedDateElement(), false);
50115        composeDateTimeExtras("preparedDate", element.getPreparedDateElement(), false);
50116      }
50117      if (element.hasWhenHandedOverElement()) {
50118        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
50119        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
50120      }
50121      if (element.hasDestination()) {
50122        composeReference("destination", element.getDestination());
50123      }
50124      if (element.hasNote()) {
50125        openArray("note");
50126        for (Annotation e : element.getNote()) 
50127          composeAnnotation(null, e);
50128        closeArray();
50129      };
50130      if (element.hasUsageInstructionElement()) {
50131        composeMarkdownCore("usageInstruction", element.getUsageInstructionElement(), false);
50132        composeMarkdownExtras("usageInstruction", element.getUsageInstructionElement(), false);
50133      }
50134      if (element.hasEventHistory()) {
50135        openArray("eventHistory");
50136        for (Reference e : element.getEventHistory()) 
50137          composeReference(null, e);
50138        closeArray();
50139      };
50140  }
50141
50142  protected void composeDeviceDispensePerformerComponent(String name, DeviceDispense.DeviceDispensePerformerComponent element) throws IOException {
50143    if (element != null) {
50144      open(name);
50145      composeDeviceDispensePerformerComponentProperties(element);
50146      close();
50147    }
50148  }
50149
50150  protected void composeDeviceDispensePerformerComponentProperties(DeviceDispense.DeviceDispensePerformerComponent element) throws IOException {
50151    composeBackboneElementProperties(element);
50152      if (element.hasFunction()) {
50153        composeCodeableConcept("function", element.getFunction());
50154      }
50155      if (element.hasActor()) {
50156        composeReference("actor", element.getActor());
50157      }
50158  }
50159
50160  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
50161    if (element != null) {
50162      prop("resourceType", name);
50163      composeDeviceMetricProperties(element);
50164    }
50165  }
50166
50167  protected void composeDeviceMetricProperties(DeviceMetric element) throws IOException {
50168    composeDomainResourceProperties(element);
50169      if (element.hasIdentifier()) {
50170        openArray("identifier");
50171        for (Identifier e : element.getIdentifier()) 
50172          composeIdentifier(null, e);
50173        closeArray();
50174      };
50175      if (element.hasType()) {
50176        composeCodeableConcept("type", element.getType());
50177      }
50178      if (element.hasUnit()) {
50179        composeCodeableConcept("unit", element.getUnit());
50180      }
50181      if (element.hasDevice()) {
50182        composeReference("device", element.getDevice());
50183      }
50184      if (element.hasOperationalStatusElement()) {
50185        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
50186        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
50187      }
50188      if (element.hasColorElement()) {
50189        composeCodeCore("color", element.getColorElement(), false);
50190        composeCodeExtras("color", element.getColorElement(), false);
50191      }
50192      if (element.hasCategoryElement()) {
50193        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
50194        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
50195      }
50196      if (element.hasMeasurementFrequency()) {
50197        composeQuantity("measurementFrequency", element.getMeasurementFrequency());
50198      }
50199      if (element.hasCalibration()) {
50200        openArray("calibration");
50201        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
50202          composeDeviceMetricCalibrationComponent(null, e);
50203        closeArray();
50204      };
50205  }
50206
50207  protected void composeDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
50208    if (element != null) {
50209      open(name);
50210      composeDeviceMetricCalibrationComponentProperties(element);
50211      close();
50212    }
50213  }
50214
50215  protected void composeDeviceMetricCalibrationComponentProperties(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
50216    composeBackboneElementProperties(element);
50217      if (element.hasTypeElement()) {
50218        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
50219        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
50220      }
50221      if (element.hasStateElement()) {
50222        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
50223        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
50224      }
50225      if (element.hasTimeElement()) {
50226        composeInstantCore("time", element.getTimeElement(), false);
50227        composeInstantExtras("time", element.getTimeElement(), false);
50228      }
50229  }
50230
50231  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
50232    if (element != null) {
50233      prop("resourceType", name);
50234      composeDeviceRequestProperties(element);
50235    }
50236  }
50237
50238  protected void composeDeviceRequestProperties(DeviceRequest element) throws IOException {
50239    composeDomainResourceProperties(element);
50240      if (element.hasIdentifier()) {
50241        openArray("identifier");
50242        for (Identifier e : element.getIdentifier()) 
50243          composeIdentifier(null, e);
50244        closeArray();
50245      };
50246      if (element.hasInstantiatesCanonical()) {
50247        if (anyHasValue(element.getInstantiatesCanonical())) {
50248          openArray("instantiatesCanonical");
50249          for (CanonicalType e : element.getInstantiatesCanonical()) 
50250            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
50251          closeArray();
50252        }
50253        if (anyHasExtras(element.getInstantiatesCanonical())) {
50254          openArray("_instantiatesCanonical");
50255          for (CanonicalType e : element.getInstantiatesCanonical()) 
50256            composeCanonicalExtras(null, e, true);
50257          closeArray();
50258        }
50259      };
50260      if (element.hasInstantiatesUri()) {
50261        if (anyHasValue(element.getInstantiatesUri())) {
50262          openArray("instantiatesUri");
50263          for (UriType e : element.getInstantiatesUri()) 
50264            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
50265          closeArray();
50266        }
50267        if (anyHasExtras(element.getInstantiatesUri())) {
50268          openArray("_instantiatesUri");
50269          for (UriType e : element.getInstantiatesUri()) 
50270            composeUriExtras(null, e, true);
50271          closeArray();
50272        }
50273      };
50274      if (element.hasBasedOn()) {
50275        openArray("basedOn");
50276        for (Reference e : element.getBasedOn()) 
50277          composeReference(null, e);
50278        closeArray();
50279      };
50280      if (element.hasReplaces()) {
50281        openArray("replaces");
50282        for (Reference e : element.getReplaces()) 
50283          composeReference(null, e);
50284        closeArray();
50285      };
50286      if (element.hasGroupIdentifier()) {
50287        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
50288      }
50289      if (element.hasStatusElement()) {
50290        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
50291        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
50292      }
50293      if (element.hasIntentElement()) {
50294        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
50295        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
50296      }
50297      if (element.hasPriorityElement()) {
50298        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
50299        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
50300      }
50301      if (element.hasDoNotPerformElement()) {
50302        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
50303        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
50304      }
50305      if (element.hasCode()) {
50306        composeCodeableReference("code", element.getCode());
50307      }
50308      if (element.hasQuantityElement()) {
50309        composeIntegerCore("quantity", element.getQuantityElement(), false);
50310        composeIntegerExtras("quantity", element.getQuantityElement(), false);
50311      }
50312      if (element.hasParameter()) {
50313        openArray("parameter");
50314        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
50315          composeDeviceRequestParameterComponent(null, e);
50316        closeArray();
50317      };
50318      if (element.hasSubject()) {
50319        composeReference("subject", element.getSubject());
50320      }
50321      if (element.hasEncounter()) {
50322        composeReference("encounter", element.getEncounter());
50323      }
50324      if (element.hasOccurrence()) {
50325        composeType("occurrence", element.getOccurrence());
50326      }
50327      if (element.hasAuthoredOnElement()) {
50328        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
50329        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
50330      }
50331      if (element.hasRequester()) {
50332        composeReference("requester", element.getRequester());
50333      }
50334      if (element.hasPerformer()) {
50335        composeCodeableReference("performer", element.getPerformer());
50336      }
50337      if (element.hasReason()) {
50338        openArray("reason");
50339        for (CodeableReference e : element.getReason()) 
50340          composeCodeableReference(null, e);
50341        closeArray();
50342      };
50343      if (element.hasAsNeededElement()) {
50344        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
50345        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
50346      }
50347      if (element.hasAsNeededFor()) {
50348        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
50349      }
50350      if (element.hasInsurance()) {
50351        openArray("insurance");
50352        for (Reference e : element.getInsurance()) 
50353          composeReference(null, e);
50354        closeArray();
50355      };
50356      if (element.hasSupportingInfo()) {
50357        openArray("supportingInfo");
50358        for (Reference e : element.getSupportingInfo()) 
50359          composeReference(null, e);
50360        closeArray();
50361      };
50362      if (element.hasNote()) {
50363        openArray("note");
50364        for (Annotation e : element.getNote()) 
50365          composeAnnotation(null, e);
50366        closeArray();
50367      };
50368      if (element.hasRelevantHistory()) {
50369        openArray("relevantHistory");
50370        for (Reference e : element.getRelevantHistory()) 
50371          composeReference(null, e);
50372        closeArray();
50373      };
50374  }
50375
50376  protected void composeDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
50377    if (element != null) {
50378      open(name);
50379      composeDeviceRequestParameterComponentProperties(element);
50380      close();
50381    }
50382  }
50383
50384  protected void composeDeviceRequestParameterComponentProperties(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
50385    composeBackboneElementProperties(element);
50386      if (element.hasCode()) {
50387        composeCodeableConcept("code", element.getCode());
50388      }
50389      if (element.hasValue()) {
50390        composeType("value", element.getValue());
50391      }
50392  }
50393
50394  protected void composeDeviceUsage(String name, DeviceUsage element) throws IOException {
50395    if (element != null) {
50396      prop("resourceType", name);
50397      composeDeviceUsageProperties(element);
50398    }
50399  }
50400
50401  protected void composeDeviceUsageProperties(DeviceUsage element) throws IOException {
50402    composeDomainResourceProperties(element);
50403      if (element.hasIdentifier()) {
50404        openArray("identifier");
50405        for (Identifier e : element.getIdentifier()) 
50406          composeIdentifier(null, e);
50407        closeArray();
50408      };
50409      if (element.hasBasedOn()) {
50410        openArray("basedOn");
50411        for (Reference e : element.getBasedOn()) 
50412          composeReference(null, e);
50413        closeArray();
50414      };
50415      if (element.hasStatusElement()) {
50416        composeEnumerationCore("status", element.getStatusElement(), new DeviceUsage.DeviceUsageStatusEnumFactory(), false);
50417        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUsage.DeviceUsageStatusEnumFactory(), false);
50418      }
50419      if (element.hasCategory()) {
50420        openArray("category");
50421        for (CodeableConcept e : element.getCategory()) 
50422          composeCodeableConcept(null, e);
50423        closeArray();
50424      };
50425      if (element.hasPatient()) {
50426        composeReference("patient", element.getPatient());
50427      }
50428      if (element.hasDerivedFrom()) {
50429        openArray("derivedFrom");
50430        for (Reference e : element.getDerivedFrom()) 
50431          composeReference(null, e);
50432        closeArray();
50433      };
50434      if (element.hasContext()) {
50435        composeReference("context", element.getContext());
50436      }
50437      if (element.hasTiming()) {
50438        composeType("timing", element.getTiming());
50439      }
50440      if (element.hasDateAssertedElement()) {
50441        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
50442        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
50443      }
50444      if (element.hasUsageStatus()) {
50445        composeCodeableConcept("usageStatus", element.getUsageStatus());
50446      }
50447      if (element.hasUsageReason()) {
50448        openArray("usageReason");
50449        for (CodeableConcept e : element.getUsageReason()) 
50450          composeCodeableConcept(null, e);
50451        closeArray();
50452      };
50453      if (element.hasAdherence()) {
50454        composeDeviceUsageAdherenceComponent("adherence", element.getAdherence());
50455      }
50456      if (element.hasInformationSource()) {
50457        composeReference("informationSource", element.getInformationSource());
50458      }
50459      if (element.hasDevice()) {
50460        composeCodeableReference("device", element.getDevice());
50461      }
50462      if (element.hasReason()) {
50463        openArray("reason");
50464        for (CodeableReference e : element.getReason()) 
50465          composeCodeableReference(null, e);
50466        closeArray();
50467      };
50468      if (element.hasBodySite()) {
50469        composeCodeableReference("bodySite", element.getBodySite());
50470      }
50471      if (element.hasNote()) {
50472        openArray("note");
50473        for (Annotation e : element.getNote()) 
50474          composeAnnotation(null, e);
50475        closeArray();
50476      };
50477  }
50478
50479  protected void composeDeviceUsageAdherenceComponent(String name, DeviceUsage.DeviceUsageAdherenceComponent element) throws IOException {
50480    if (element != null) {
50481      open(name);
50482      composeDeviceUsageAdherenceComponentProperties(element);
50483      close();
50484    }
50485  }
50486
50487  protected void composeDeviceUsageAdherenceComponentProperties(DeviceUsage.DeviceUsageAdherenceComponent element) throws IOException {
50488    composeBackboneElementProperties(element);
50489      if (element.hasCode()) {
50490        composeCodeableConcept("code", element.getCode());
50491      }
50492      if (element.hasReason()) {
50493        openArray("reason");
50494        for (CodeableConcept e : element.getReason()) 
50495          composeCodeableConcept(null, e);
50496        closeArray();
50497      };
50498  }
50499
50500  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
50501    if (element != null) {
50502      prop("resourceType", name);
50503      composeDiagnosticReportProperties(element);
50504    }
50505  }
50506
50507  protected void composeDiagnosticReportProperties(DiagnosticReport element) throws IOException {
50508    composeDomainResourceProperties(element);
50509      if (element.hasIdentifier()) {
50510        openArray("identifier");
50511        for (Identifier e : element.getIdentifier()) 
50512          composeIdentifier(null, e);
50513        closeArray();
50514      };
50515      if (element.hasBasedOn()) {
50516        openArray("basedOn");
50517        for (Reference e : element.getBasedOn()) 
50518          composeReference(null, e);
50519        closeArray();
50520      };
50521      if (element.hasStatusElement()) {
50522        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
50523        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
50524      }
50525      if (element.hasCategory()) {
50526        openArray("category");
50527        for (CodeableConcept e : element.getCategory()) 
50528          composeCodeableConcept(null, e);
50529        closeArray();
50530      };
50531      if (element.hasCode()) {
50532        composeCodeableConcept("code", element.getCode());
50533      }
50534      if (element.hasSubject()) {
50535        composeReference("subject", element.getSubject());
50536      }
50537      if (element.hasEncounter()) {
50538        composeReference("encounter", element.getEncounter());
50539      }
50540      if (element.hasEffective()) {
50541        composeType("effective", element.getEffective());
50542      }
50543      if (element.hasIssuedElement()) {
50544        composeInstantCore("issued", element.getIssuedElement(), false);
50545        composeInstantExtras("issued", element.getIssuedElement(), false);
50546      }
50547      if (element.hasPerformer()) {
50548        openArray("performer");
50549        for (Reference e : element.getPerformer()) 
50550          composeReference(null, e);
50551        closeArray();
50552      };
50553      if (element.hasResultsInterpreter()) {
50554        openArray("resultsInterpreter");
50555        for (Reference e : element.getResultsInterpreter()) 
50556          composeReference(null, e);
50557        closeArray();
50558      };
50559      if (element.hasSpecimen()) {
50560        openArray("specimen");
50561        for (Reference e : element.getSpecimen()) 
50562          composeReference(null, e);
50563        closeArray();
50564      };
50565      if (element.hasResult()) {
50566        openArray("result");
50567        for (Reference e : element.getResult()) 
50568          composeReference(null, e);
50569        closeArray();
50570      };
50571      if (element.hasNote()) {
50572        openArray("note");
50573        for (Annotation e : element.getNote()) 
50574          composeAnnotation(null, e);
50575        closeArray();
50576      };
50577      if (element.hasStudy()) {
50578        openArray("study");
50579        for (Reference e : element.getStudy()) 
50580          composeReference(null, e);
50581        closeArray();
50582      };
50583      if (element.hasSupportingInfo()) {
50584        openArray("supportingInfo");
50585        for (DiagnosticReport.DiagnosticReportSupportingInfoComponent e : element.getSupportingInfo()) 
50586          composeDiagnosticReportSupportingInfoComponent(null, e);
50587        closeArray();
50588      };
50589      if (element.hasMedia()) {
50590        openArray("media");
50591        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
50592          composeDiagnosticReportMediaComponent(null, e);
50593        closeArray();
50594      };
50595      if (element.hasComposition()) {
50596        composeReference("composition", element.getComposition());
50597      }
50598      if (element.hasConclusionElement()) {
50599        composeMarkdownCore("conclusion", element.getConclusionElement(), false);
50600        composeMarkdownExtras("conclusion", element.getConclusionElement(), false);
50601      }
50602      if (element.hasConclusionCode()) {
50603        openArray("conclusionCode");
50604        for (CodeableConcept e : element.getConclusionCode()) 
50605          composeCodeableConcept(null, e);
50606        closeArray();
50607      };
50608      if (element.hasPresentedForm()) {
50609        openArray("presentedForm");
50610        for (Attachment e : element.getPresentedForm()) 
50611          composeAttachment(null, e);
50612        closeArray();
50613      };
50614  }
50615
50616  protected void composeDiagnosticReportSupportingInfoComponent(String name, DiagnosticReport.DiagnosticReportSupportingInfoComponent element) throws IOException {
50617    if (element != null) {
50618      open(name);
50619      composeDiagnosticReportSupportingInfoComponentProperties(element);
50620      close();
50621    }
50622  }
50623
50624  protected void composeDiagnosticReportSupportingInfoComponentProperties(DiagnosticReport.DiagnosticReportSupportingInfoComponent element) throws IOException {
50625    composeBackboneElementProperties(element);
50626      if (element.hasType()) {
50627        composeCodeableConcept("type", element.getType());
50628      }
50629      if (element.hasReference()) {
50630        composeReference("reference", element.getReference());
50631      }
50632  }
50633
50634  protected void composeDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
50635    if (element != null) {
50636      open(name);
50637      composeDiagnosticReportMediaComponentProperties(element);
50638      close();
50639    }
50640  }
50641
50642  protected void composeDiagnosticReportMediaComponentProperties(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
50643    composeBackboneElementProperties(element);
50644      if (element.hasCommentElement()) {
50645        composeStringCore("comment", element.getCommentElement(), false);
50646        composeStringExtras("comment", element.getCommentElement(), false);
50647      }
50648      if (element.hasLink()) {
50649        composeReference("link", element.getLink());
50650      }
50651  }
50652
50653  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
50654    if (element != null) {
50655      prop("resourceType", name);
50656      composeDocumentReferenceProperties(element);
50657    }
50658  }
50659
50660  protected void composeDocumentReferenceProperties(DocumentReference element) throws IOException {
50661    composeDomainResourceProperties(element);
50662      if (element.hasIdentifier()) {
50663        openArray("identifier");
50664        for (Identifier e : element.getIdentifier()) 
50665          composeIdentifier(null, e);
50666        closeArray();
50667      };
50668      if (element.hasVersionElement()) {
50669        composeStringCore("version", element.getVersionElement(), false);
50670        composeStringExtras("version", element.getVersionElement(), false);
50671      }
50672      if (element.hasBasedOn()) {
50673        openArray("basedOn");
50674        for (Reference e : element.getBasedOn()) 
50675          composeReference(null, e);
50676        closeArray();
50677      };
50678      if (element.hasStatusElement()) {
50679        composeEnumerationCore("status", element.getStatusElement(), new DocumentReference.DocumentReferenceStatusEnumFactory(), false);
50680        composeEnumerationExtras("status", element.getStatusElement(), new DocumentReference.DocumentReferenceStatusEnumFactory(), false);
50681      }
50682      if (element.hasDocStatusElement()) {
50683        composeEnumerationCore("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
50684        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
50685      }
50686      if (element.hasModality()) {
50687        openArray("modality");
50688        for (CodeableConcept e : element.getModality()) 
50689          composeCodeableConcept(null, e);
50690        closeArray();
50691      };
50692      if (element.hasType()) {
50693        composeCodeableConcept("type", element.getType());
50694      }
50695      if (element.hasCategory()) {
50696        openArray("category");
50697        for (CodeableConcept e : element.getCategory()) 
50698          composeCodeableConcept(null, e);
50699        closeArray();
50700      };
50701      if (element.hasSubject()) {
50702        composeReference("subject", element.getSubject());
50703      }
50704      if (element.hasContext()) {
50705        openArray("context");
50706        for (Reference e : element.getContext()) 
50707          composeReference(null, e);
50708        closeArray();
50709      };
50710      if (element.hasEvent()) {
50711        openArray("event");
50712        for (CodeableReference e : element.getEvent()) 
50713          composeCodeableReference(null, e);
50714        closeArray();
50715      };
50716      if (element.hasBodySite()) {
50717        openArray("bodySite");
50718        for (CodeableReference e : element.getBodySite()) 
50719          composeCodeableReference(null, e);
50720        closeArray();
50721      };
50722      if (element.hasFacilityType()) {
50723        composeCodeableConcept("facilityType", element.getFacilityType());
50724      }
50725      if (element.hasPracticeSetting()) {
50726        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
50727      }
50728      if (element.hasPeriod()) {
50729        composePeriod("period", element.getPeriod());
50730      }
50731      if (element.hasDateElement()) {
50732        composeInstantCore("date", element.getDateElement(), false);
50733        composeInstantExtras("date", element.getDateElement(), false);
50734      }
50735      if (element.hasAuthor()) {
50736        openArray("author");
50737        for (Reference e : element.getAuthor()) 
50738          composeReference(null, e);
50739        closeArray();
50740      };
50741      if (element.hasAttester()) {
50742        openArray("attester");
50743        for (DocumentReference.DocumentReferenceAttesterComponent e : element.getAttester()) 
50744          composeDocumentReferenceAttesterComponent(null, e);
50745        closeArray();
50746      };
50747      if (element.hasCustodian()) {
50748        composeReference("custodian", element.getCustodian());
50749      }
50750      if (element.hasRelatesTo()) {
50751        openArray("relatesTo");
50752        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
50753          composeDocumentReferenceRelatesToComponent(null, e);
50754        closeArray();
50755      };
50756      if (element.hasDescriptionElement()) {
50757        composeMarkdownCore("description", element.getDescriptionElement(), false);
50758        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50759      }
50760      if (element.hasSecurityLabel()) {
50761        openArray("securityLabel");
50762        for (CodeableConcept e : element.getSecurityLabel()) 
50763          composeCodeableConcept(null, e);
50764        closeArray();
50765      };
50766      if (element.hasContent()) {
50767        openArray("content");
50768        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
50769          composeDocumentReferenceContentComponent(null, e);
50770        closeArray();
50771      };
50772  }
50773
50774  protected void composeDocumentReferenceAttesterComponent(String name, DocumentReference.DocumentReferenceAttesterComponent element) throws IOException {
50775    if (element != null) {
50776      open(name);
50777      composeDocumentReferenceAttesterComponentProperties(element);
50778      close();
50779    }
50780  }
50781
50782  protected void composeDocumentReferenceAttesterComponentProperties(DocumentReference.DocumentReferenceAttesterComponent element) throws IOException {
50783    composeBackboneElementProperties(element);
50784      if (element.hasMode()) {
50785        composeCodeableConcept("mode", element.getMode());
50786      }
50787      if (element.hasTimeElement()) {
50788        composeDateTimeCore("time", element.getTimeElement(), false);
50789        composeDateTimeExtras("time", element.getTimeElement(), false);
50790      }
50791      if (element.hasParty()) {
50792        composeReference("party", element.getParty());
50793      }
50794  }
50795
50796  protected void composeDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
50797    if (element != null) {
50798      open(name);
50799      composeDocumentReferenceRelatesToComponentProperties(element);
50800      close();
50801    }
50802  }
50803
50804  protected void composeDocumentReferenceRelatesToComponentProperties(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
50805    composeBackboneElementProperties(element);
50806      if (element.hasCode()) {
50807        composeCodeableConcept("code", element.getCode());
50808      }
50809      if (element.hasTarget()) {
50810        composeReference("target", element.getTarget());
50811      }
50812  }
50813
50814  protected void composeDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
50815    if (element != null) {
50816      open(name);
50817      composeDocumentReferenceContentComponentProperties(element);
50818      close();
50819    }
50820  }
50821
50822  protected void composeDocumentReferenceContentComponentProperties(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
50823    composeBackboneElementProperties(element);
50824      if (element.hasAttachment()) {
50825        composeAttachment("attachment", element.getAttachment());
50826      }
50827      if (element.hasProfile()) {
50828        openArray("profile");
50829        for (DocumentReference.DocumentReferenceContentProfileComponent e : element.getProfile()) 
50830          composeDocumentReferenceContentProfileComponent(null, e);
50831        closeArray();
50832      };
50833  }
50834
50835  protected void composeDocumentReferenceContentProfileComponent(String name, DocumentReference.DocumentReferenceContentProfileComponent element) throws IOException {
50836    if (element != null) {
50837      open(name);
50838      composeDocumentReferenceContentProfileComponentProperties(element);
50839      close();
50840    }
50841  }
50842
50843  protected void composeDocumentReferenceContentProfileComponentProperties(DocumentReference.DocumentReferenceContentProfileComponent element) throws IOException {
50844    composeBackboneElementProperties(element);
50845      if (element.hasValue()) {
50846        composeType("value", element.getValue());
50847      }
50848  }
50849
50850  protected void composeEncounter(String name, Encounter element) throws IOException {
50851    if (element != null) {
50852      prop("resourceType", name);
50853      composeEncounterProperties(element);
50854    }
50855  }
50856
50857  protected void composeEncounterProperties(Encounter element) throws IOException {
50858    composeDomainResourceProperties(element);
50859      if (element.hasIdentifier()) {
50860        openArray("identifier");
50861        for (Identifier e : element.getIdentifier()) 
50862          composeIdentifier(null, e);
50863        closeArray();
50864      };
50865      if (element.hasStatusElement()) {
50866        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
50867        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
50868      }
50869      if (element.hasClass_()) {
50870        openArray("class");
50871        for (CodeableConcept e : element.getClass_()) 
50872          composeCodeableConcept(null, e);
50873        closeArray();
50874      };
50875      if (element.hasPriority()) {
50876        composeCodeableConcept("priority", element.getPriority());
50877      }
50878      if (element.hasType()) {
50879        openArray("type");
50880        for (CodeableConcept e : element.getType()) 
50881          composeCodeableConcept(null, e);
50882        closeArray();
50883      };
50884      if (element.hasServiceType()) {
50885        openArray("serviceType");
50886        for (CodeableReference e : element.getServiceType()) 
50887          composeCodeableReference(null, e);
50888        closeArray();
50889      };
50890      if (element.hasSubject()) {
50891        composeReference("subject", element.getSubject());
50892      }
50893      if (element.hasSubjectStatus()) {
50894        composeCodeableConcept("subjectStatus", element.getSubjectStatus());
50895      }
50896      if (element.hasEpisodeOfCare()) {
50897        openArray("episodeOfCare");
50898        for (Reference e : element.getEpisodeOfCare()) 
50899          composeReference(null, e);
50900        closeArray();
50901      };
50902      if (element.hasBasedOn()) {
50903        openArray("basedOn");
50904        for (Reference e : element.getBasedOn()) 
50905          composeReference(null, e);
50906        closeArray();
50907      };
50908      if (element.hasCareTeam()) {
50909        openArray("careTeam");
50910        for (Reference e : element.getCareTeam()) 
50911          composeReference(null, e);
50912        closeArray();
50913      };
50914      if (element.hasPartOf()) {
50915        composeReference("partOf", element.getPartOf());
50916      }
50917      if (element.hasServiceProvider()) {
50918        composeReference("serviceProvider", element.getServiceProvider());
50919      }
50920      if (element.hasParticipant()) {
50921        openArray("participant");
50922        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
50923          composeEncounterParticipantComponent(null, e);
50924        closeArray();
50925      };
50926      if (element.hasAppointment()) {
50927        openArray("appointment");
50928        for (Reference e : element.getAppointment()) 
50929          composeReference(null, e);
50930        closeArray();
50931      };
50932      if (element.hasVirtualService()) {
50933        openArray("virtualService");
50934        for (VirtualServiceDetail e : element.getVirtualService()) 
50935          composeVirtualServiceDetail(null, e);
50936        closeArray();
50937      };
50938      if (element.hasActualPeriod()) {
50939        composePeriod("actualPeriod", element.getActualPeriod());
50940      }
50941      if (element.hasPlannedStartDateElement()) {
50942        composeDateTimeCore("plannedStartDate", element.getPlannedStartDateElement(), false);
50943        composeDateTimeExtras("plannedStartDate", element.getPlannedStartDateElement(), false);
50944      }
50945      if (element.hasPlannedEndDateElement()) {
50946        composeDateTimeCore("plannedEndDate", element.getPlannedEndDateElement(), false);
50947        composeDateTimeExtras("plannedEndDate", element.getPlannedEndDateElement(), false);
50948      }
50949      if (element.hasLength()) {
50950        composeDuration("length", element.getLength());
50951      }
50952      if (element.hasReason()) {
50953        openArray("reason");
50954        for (Encounter.ReasonComponent e : element.getReason()) 
50955          composeReasonComponent(null, e);
50956        closeArray();
50957      };
50958      if (element.hasDiagnosis()) {
50959        openArray("diagnosis");
50960        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
50961          composeDiagnosisComponent(null, e);
50962        closeArray();
50963      };
50964      if (element.hasAccount()) {
50965        openArray("account");
50966        for (Reference e : element.getAccount()) 
50967          composeReference(null, e);
50968        closeArray();
50969      };
50970      if (element.hasDietPreference()) {
50971        openArray("dietPreference");
50972        for (CodeableConcept e : element.getDietPreference()) 
50973          composeCodeableConcept(null, e);
50974        closeArray();
50975      };
50976      if (element.hasSpecialArrangement()) {
50977        openArray("specialArrangement");
50978        for (CodeableConcept e : element.getSpecialArrangement()) 
50979          composeCodeableConcept(null, e);
50980        closeArray();
50981      };
50982      if (element.hasSpecialCourtesy()) {
50983        openArray("specialCourtesy");
50984        for (CodeableConcept e : element.getSpecialCourtesy()) 
50985          composeCodeableConcept(null, e);
50986        closeArray();
50987      };
50988      if (element.hasAdmission()) {
50989        composeEncounterAdmissionComponent("admission", element.getAdmission());
50990      }
50991      if (element.hasLocation()) {
50992        openArray("location");
50993        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
50994          composeEncounterLocationComponent(null, e);
50995        closeArray();
50996      };
50997  }
50998
50999  protected void composeEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
51000    if (element != null) {
51001      open(name);
51002      composeEncounterParticipantComponentProperties(element);
51003      close();
51004    }
51005  }
51006
51007  protected void composeEncounterParticipantComponentProperties(Encounter.EncounterParticipantComponent element) throws IOException {
51008    composeBackboneElementProperties(element);
51009      if (element.hasType()) {
51010        openArray("type");
51011        for (CodeableConcept e : element.getType()) 
51012          composeCodeableConcept(null, e);
51013        closeArray();
51014      };
51015      if (element.hasPeriod()) {
51016        composePeriod("period", element.getPeriod());
51017      }
51018      if (element.hasActor()) {
51019        composeReference("actor", element.getActor());
51020      }
51021  }
51022
51023  protected void composeReasonComponent(String name, Encounter.ReasonComponent element) throws IOException {
51024    if (element != null) {
51025      open(name);
51026      composeReasonComponentProperties(element);
51027      close();
51028    }
51029  }
51030
51031  protected void composeReasonComponentProperties(Encounter.ReasonComponent element) throws IOException {
51032    composeBackboneElementProperties(element);
51033      if (element.hasUse()) {
51034        openArray("use");
51035        for (CodeableConcept e : element.getUse()) 
51036          composeCodeableConcept(null, e);
51037        closeArray();
51038      };
51039      if (element.hasValue()) {
51040        openArray("value");
51041        for (CodeableReference e : element.getValue()) 
51042          composeCodeableReference(null, e);
51043        closeArray();
51044      };
51045  }
51046
51047  protected void composeDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
51048    if (element != null) {
51049      open(name);
51050      composeDiagnosisComponentProperties(element);
51051      close();
51052    }
51053  }
51054
51055  protected void composeDiagnosisComponentProperties(Encounter.DiagnosisComponent element) throws IOException {
51056    composeBackboneElementProperties(element);
51057      if (element.hasCondition()) {
51058        openArray("condition");
51059        for (CodeableReference e : element.getCondition()) 
51060          composeCodeableReference(null, e);
51061        closeArray();
51062      };
51063      if (element.hasUse()) {
51064        openArray("use");
51065        for (CodeableConcept e : element.getUse()) 
51066          composeCodeableConcept(null, e);
51067        closeArray();
51068      };
51069  }
51070
51071  protected void composeEncounterAdmissionComponent(String name, Encounter.EncounterAdmissionComponent element) throws IOException {
51072    if (element != null) {
51073      open(name);
51074      composeEncounterAdmissionComponentProperties(element);
51075      close();
51076    }
51077  }
51078
51079  protected void composeEncounterAdmissionComponentProperties(Encounter.EncounterAdmissionComponent element) throws IOException {
51080    composeBackboneElementProperties(element);
51081      if (element.hasPreAdmissionIdentifier()) {
51082        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
51083      }
51084      if (element.hasOrigin()) {
51085        composeReference("origin", element.getOrigin());
51086      }
51087      if (element.hasAdmitSource()) {
51088        composeCodeableConcept("admitSource", element.getAdmitSource());
51089      }
51090      if (element.hasReAdmission()) {
51091        composeCodeableConcept("reAdmission", element.getReAdmission());
51092      }
51093      if (element.hasDestination()) {
51094        composeReference("destination", element.getDestination());
51095      }
51096      if (element.hasDischargeDisposition()) {
51097        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
51098      }
51099  }
51100
51101  protected void composeEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
51102    if (element != null) {
51103      open(name);
51104      composeEncounterLocationComponentProperties(element);
51105      close();
51106    }
51107  }
51108
51109  protected void composeEncounterLocationComponentProperties(Encounter.EncounterLocationComponent element) throws IOException {
51110    composeBackboneElementProperties(element);
51111      if (element.hasLocation()) {
51112        composeReference("location", element.getLocation());
51113      }
51114      if (element.hasStatusElement()) {
51115        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
51116        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
51117      }
51118      if (element.hasForm()) {
51119        composeCodeableConcept("form", element.getForm());
51120      }
51121      if (element.hasPeriod()) {
51122        composePeriod("period", element.getPeriod());
51123      }
51124  }
51125
51126  protected void composeEncounterHistory(String name, EncounterHistory element) throws IOException {
51127    if (element != null) {
51128      prop("resourceType", name);
51129      composeEncounterHistoryProperties(element);
51130    }
51131  }
51132
51133  protected void composeEncounterHistoryProperties(EncounterHistory element) throws IOException {
51134    composeDomainResourceProperties(element);
51135      if (element.hasEncounter()) {
51136        composeReference("encounter", element.getEncounter());
51137      }
51138      if (element.hasIdentifier()) {
51139        openArray("identifier");
51140        for (Identifier e : element.getIdentifier()) 
51141          composeIdentifier(null, e);
51142        closeArray();
51143      };
51144      if (element.hasStatusElement()) {
51145        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
51146        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
51147      }
51148      if (element.hasClass_()) {
51149        composeCodeableConcept("class", element.getClass_());
51150      }
51151      if (element.hasType()) {
51152        openArray("type");
51153        for (CodeableConcept e : element.getType()) 
51154          composeCodeableConcept(null, e);
51155        closeArray();
51156      };
51157      if (element.hasServiceType()) {
51158        openArray("serviceType");
51159        for (CodeableReference e : element.getServiceType()) 
51160          composeCodeableReference(null, e);
51161        closeArray();
51162      };
51163      if (element.hasSubject()) {
51164        composeReference("subject", element.getSubject());
51165      }
51166      if (element.hasSubjectStatus()) {
51167        composeCodeableConcept("subjectStatus", element.getSubjectStatus());
51168      }
51169      if (element.hasActualPeriod()) {
51170        composePeriod("actualPeriod", element.getActualPeriod());
51171      }
51172      if (element.hasPlannedStartDateElement()) {
51173        composeDateTimeCore("plannedStartDate", element.getPlannedStartDateElement(), false);
51174        composeDateTimeExtras("plannedStartDate", element.getPlannedStartDateElement(), false);
51175      }
51176      if (element.hasPlannedEndDateElement()) {
51177        composeDateTimeCore("plannedEndDate", element.getPlannedEndDateElement(), false);
51178        composeDateTimeExtras("plannedEndDate", element.getPlannedEndDateElement(), false);
51179      }
51180      if (element.hasLength()) {
51181        composeDuration("length", element.getLength());
51182      }
51183      if (element.hasLocation()) {
51184        openArray("location");
51185        for (EncounterHistory.EncounterHistoryLocationComponent e : element.getLocation()) 
51186          composeEncounterHistoryLocationComponent(null, e);
51187        closeArray();
51188      };
51189  }
51190
51191  protected void composeEncounterHistoryLocationComponent(String name, EncounterHistory.EncounterHistoryLocationComponent element) throws IOException {
51192    if (element != null) {
51193      open(name);
51194      composeEncounterHistoryLocationComponentProperties(element);
51195      close();
51196    }
51197  }
51198
51199  protected void composeEncounterHistoryLocationComponentProperties(EncounterHistory.EncounterHistoryLocationComponent element) throws IOException {
51200    composeBackboneElementProperties(element);
51201      if (element.hasLocation()) {
51202        composeReference("location", element.getLocation());
51203      }
51204      if (element.hasForm()) {
51205        composeCodeableConcept("form", element.getForm());
51206      }
51207  }
51208
51209  protected void composeEndpoint(String name, Endpoint element) throws IOException {
51210    if (element != null) {
51211      prop("resourceType", name);
51212      composeEndpointProperties(element);
51213    }
51214  }
51215
51216  protected void composeEndpointProperties(Endpoint element) throws IOException {
51217    composeDomainResourceProperties(element);
51218      if (element.hasIdentifier()) {
51219        openArray("identifier");
51220        for (Identifier e : element.getIdentifier()) 
51221          composeIdentifier(null, e);
51222        closeArray();
51223      };
51224      if (element.hasStatusElement()) {
51225        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
51226        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
51227      }
51228      if (element.hasConnectionType()) {
51229        openArray("connectionType");
51230        for (CodeableConcept e : element.getConnectionType()) 
51231          composeCodeableConcept(null, e);
51232        closeArray();
51233      };
51234      if (element.hasNameElement()) {
51235        composeStringCore("name", element.getNameElement(), false);
51236        composeStringExtras("name", element.getNameElement(), false);
51237      }
51238      if (element.hasDescriptionElement()) {
51239        composeStringCore("description", element.getDescriptionElement(), false);
51240        composeStringExtras("description", element.getDescriptionElement(), false);
51241      }
51242      if (element.hasEnvironmentType()) {
51243        openArray("environmentType");
51244        for (CodeableConcept e : element.getEnvironmentType()) 
51245          composeCodeableConcept(null, e);
51246        closeArray();
51247      };
51248      if (element.hasManagingOrganization()) {
51249        composeReference("managingOrganization", element.getManagingOrganization());
51250      }
51251      if (element.hasContact()) {
51252        openArray("contact");
51253        for (ContactPoint e : element.getContact()) 
51254          composeContactPoint(null, e);
51255        closeArray();
51256      };
51257      if (element.hasPeriod()) {
51258        composePeriod("period", element.getPeriod());
51259      }
51260      if (element.hasPayload()) {
51261        openArray("payload");
51262        for (Endpoint.EndpointPayloadComponent e : element.getPayload()) 
51263          composeEndpointPayloadComponent(null, e);
51264        closeArray();
51265      };
51266      if (element.hasAddressElement()) {
51267        composeUrlCore("address", element.getAddressElement(), false);
51268        composeUrlExtras("address", element.getAddressElement(), false);
51269      }
51270      if (element.hasHeader()) {
51271        if (anyHasValue(element.getHeader())) {
51272          openArray("header");
51273          for (StringType e : element.getHeader()) 
51274            composeStringCore(null, e, e != element.getHeader().get(element.getHeader().size()-1));
51275          closeArray();
51276        }
51277        if (anyHasExtras(element.getHeader())) {
51278          openArray("_header");
51279          for (StringType e : element.getHeader()) 
51280            composeStringExtras(null, e, true);
51281          closeArray();
51282        }
51283      };
51284  }
51285
51286  protected void composeEndpointPayloadComponent(String name, Endpoint.EndpointPayloadComponent element) throws IOException {
51287    if (element != null) {
51288      open(name);
51289      composeEndpointPayloadComponentProperties(element);
51290      close();
51291    }
51292  }
51293
51294  protected void composeEndpointPayloadComponentProperties(Endpoint.EndpointPayloadComponent element) throws IOException {
51295    composeBackboneElementProperties(element);
51296      if (element.hasType()) {
51297        openArray("type");
51298        for (CodeableConcept e : element.getType()) 
51299          composeCodeableConcept(null, e);
51300        closeArray();
51301      };
51302      if (element.hasMimeType()) {
51303        if (anyHasValue(element.getMimeType())) {
51304          openArray("mimeType");
51305          for (CodeType e : element.getMimeType()) 
51306            composeCodeCore(null, e, e != element.getMimeType().get(element.getMimeType().size()-1));
51307          closeArray();
51308        }
51309        if (anyHasExtras(element.getMimeType())) {
51310          openArray("_mimeType");
51311          for (CodeType e : element.getMimeType()) 
51312            composeCodeExtras(null, e, true);
51313          closeArray();
51314        }
51315      };
51316  }
51317
51318  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
51319    if (element != null) {
51320      prop("resourceType", name);
51321      composeEnrollmentRequestProperties(element);
51322    }
51323  }
51324
51325  protected void composeEnrollmentRequestProperties(EnrollmentRequest element) throws IOException {
51326    composeDomainResourceProperties(element);
51327      if (element.hasIdentifier()) {
51328        openArray("identifier");
51329        for (Identifier e : element.getIdentifier()) 
51330          composeIdentifier(null, e);
51331        closeArray();
51332      };
51333      if (element.hasStatusElement()) {
51334        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51335        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51336      }
51337      if (element.hasCreatedElement()) {
51338        composeDateTimeCore("created", element.getCreatedElement(), false);
51339        composeDateTimeExtras("created", element.getCreatedElement(), false);
51340      }
51341      if (element.hasInsurer()) {
51342        composeReference("insurer", element.getInsurer());
51343      }
51344      if (element.hasProvider()) {
51345        composeReference("provider", element.getProvider());
51346      }
51347      if (element.hasCandidate()) {
51348        composeReference("candidate", element.getCandidate());
51349      }
51350      if (element.hasCoverage()) {
51351        composeReference("coverage", element.getCoverage());
51352      }
51353  }
51354
51355  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
51356    if (element != null) {
51357      prop("resourceType", name);
51358      composeEnrollmentResponseProperties(element);
51359    }
51360  }
51361
51362  protected void composeEnrollmentResponseProperties(EnrollmentResponse element) throws IOException {
51363    composeDomainResourceProperties(element);
51364      if (element.hasIdentifier()) {
51365        openArray("identifier");
51366        for (Identifier e : element.getIdentifier()) 
51367          composeIdentifier(null, e);
51368        closeArray();
51369      };
51370      if (element.hasStatusElement()) {
51371        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51372        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51373      }
51374      if (element.hasRequest()) {
51375        composeReference("request", element.getRequest());
51376      }
51377      if (element.hasOutcomeElement()) {
51378        composeEnumerationCore("outcome", element.getOutcomeElement(), new EnrollmentResponse.EnrollmentOutcomeEnumFactory(), false);
51379        composeEnumerationExtras("outcome", element.getOutcomeElement(), new EnrollmentResponse.EnrollmentOutcomeEnumFactory(), false);
51380      }
51381      if (element.hasDispositionElement()) {
51382        composeStringCore("disposition", element.getDispositionElement(), false);
51383        composeStringExtras("disposition", element.getDispositionElement(), false);
51384      }
51385      if (element.hasCreatedElement()) {
51386        composeDateTimeCore("created", element.getCreatedElement(), false);
51387        composeDateTimeExtras("created", element.getCreatedElement(), false);
51388      }
51389      if (element.hasOrganization()) {
51390        composeReference("organization", element.getOrganization());
51391      }
51392      if (element.hasRequestProvider()) {
51393        composeReference("requestProvider", element.getRequestProvider());
51394      }
51395  }
51396
51397  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
51398    if (element != null) {
51399      prop("resourceType", name);
51400      composeEpisodeOfCareProperties(element);
51401    }
51402  }
51403
51404  protected void composeEpisodeOfCareProperties(EpisodeOfCare element) throws IOException {
51405    composeDomainResourceProperties(element);
51406      if (element.hasIdentifier()) {
51407        openArray("identifier");
51408        for (Identifier e : element.getIdentifier()) 
51409          composeIdentifier(null, e);
51410        closeArray();
51411      };
51412      if (element.hasStatusElement()) {
51413        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51414        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51415      }
51416      if (element.hasStatusHistory()) {
51417        openArray("statusHistory");
51418        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
51419          composeEpisodeOfCareStatusHistoryComponent(null, e);
51420        closeArray();
51421      };
51422      if (element.hasType()) {
51423        openArray("type");
51424        for (CodeableConcept e : element.getType()) 
51425          composeCodeableConcept(null, e);
51426        closeArray();
51427      };
51428      if (element.hasReason()) {
51429        openArray("reason");
51430        for (EpisodeOfCare.ReasonComponent e : element.getReason()) 
51431          composeReasonComponent(null, e);
51432        closeArray();
51433      };
51434      if (element.hasDiagnosis()) {
51435        openArray("diagnosis");
51436        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
51437          composeDiagnosisComponent(null, e);
51438        closeArray();
51439      };
51440      if (element.hasPatient()) {
51441        composeReference("patient", element.getPatient());
51442      }
51443      if (element.hasManagingOrganization()) {
51444        composeReference("managingOrganization", element.getManagingOrganization());
51445      }
51446      if (element.hasPeriod()) {
51447        composePeriod("period", element.getPeriod());
51448      }
51449      if (element.hasReferralRequest()) {
51450        openArray("referralRequest");
51451        for (Reference e : element.getReferralRequest()) 
51452          composeReference(null, e);
51453        closeArray();
51454      };
51455      if (element.hasCareManager()) {
51456        composeReference("careManager", element.getCareManager());
51457      }
51458      if (element.hasCareTeam()) {
51459        openArray("careTeam");
51460        for (Reference e : element.getCareTeam()) 
51461          composeReference(null, e);
51462        closeArray();
51463      };
51464      if (element.hasAccount()) {
51465        openArray("account");
51466        for (Reference e : element.getAccount()) 
51467          composeReference(null, e);
51468        closeArray();
51469      };
51470  }
51471
51472  protected void composeEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
51473    if (element != null) {
51474      open(name);
51475      composeEpisodeOfCareStatusHistoryComponentProperties(element);
51476      close();
51477    }
51478  }
51479
51480  protected void composeEpisodeOfCareStatusHistoryComponentProperties(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
51481    composeBackboneElementProperties(element);
51482      if (element.hasStatusElement()) {
51483        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51484        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51485      }
51486      if (element.hasPeriod()) {
51487        composePeriod("period", element.getPeriod());
51488      }
51489  }
51490
51491  protected void composeReasonComponent(String name, EpisodeOfCare.ReasonComponent element) throws IOException {
51492    if (element != null) {
51493      open(name);
51494      composeReasonComponentProperties(element);
51495      close();
51496    }
51497  }
51498
51499  protected void composeReasonComponentProperties(EpisodeOfCare.ReasonComponent element) throws IOException {
51500    composeBackboneElementProperties(element);
51501      if (element.hasUse()) {
51502        composeCodeableConcept("use", element.getUse());
51503      }
51504      if (element.hasValue()) {
51505        openArray("value");
51506        for (CodeableReference e : element.getValue()) 
51507          composeCodeableReference(null, e);
51508        closeArray();
51509      };
51510  }
51511
51512  protected void composeDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
51513    if (element != null) {
51514      open(name);
51515      composeDiagnosisComponentProperties(element);
51516      close();
51517    }
51518  }
51519
51520  protected void composeDiagnosisComponentProperties(EpisodeOfCare.DiagnosisComponent element) throws IOException {
51521    composeBackboneElementProperties(element);
51522      if (element.hasCondition()) {
51523        openArray("condition");
51524        for (CodeableReference e : element.getCondition()) 
51525          composeCodeableReference(null, e);
51526        closeArray();
51527      };
51528      if (element.hasUse()) {
51529        composeCodeableConcept("use", element.getUse());
51530      }
51531  }
51532
51533  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
51534    if (element != null) {
51535      prop("resourceType", name);
51536      composeEventDefinitionProperties(element);
51537    }
51538  }
51539
51540  protected void composeEventDefinitionProperties(EventDefinition element) throws IOException {
51541    composeMetadataResourceProperties(element);
51542      if (element.hasUrlElement()) {
51543        composeUriCore("url", element.getUrlElement(), false);
51544        composeUriExtras("url", element.getUrlElement(), false);
51545      }
51546      if (element.hasIdentifier()) {
51547        openArray("identifier");
51548        for (Identifier e : element.getIdentifier()) 
51549          composeIdentifier(null, e);
51550        closeArray();
51551      };
51552      if (element.hasVersionElement()) {
51553        composeStringCore("version", element.getVersionElement(), false);
51554        composeStringExtras("version", element.getVersionElement(), false);
51555      }
51556      if (element.hasVersionAlgorithm()) {
51557        composeType("versionAlgorithm", element.getVersionAlgorithm());
51558      }
51559      if (element.hasNameElement()) {
51560        composeStringCore("name", element.getNameElement(), false);
51561        composeStringExtras("name", element.getNameElement(), false);
51562      }
51563      if (element.hasTitleElement()) {
51564        composeStringCore("title", element.getTitleElement(), false);
51565        composeStringExtras("title", element.getTitleElement(), false);
51566      }
51567      if (element.hasSubtitleElement()) {
51568        composeStringCore("subtitle", element.getSubtitleElement(), false);
51569        composeStringExtras("subtitle", element.getSubtitleElement(), false);
51570      }
51571      if (element.hasStatusElement()) {
51572        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51573        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51574      }
51575      if (element.hasExperimentalElement()) {
51576        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51577        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51578      }
51579      if (element.hasSubject()) {
51580        composeType("subject", element.getSubject());
51581      }
51582      if (element.hasDateElement()) {
51583        composeDateTimeCore("date", element.getDateElement(), false);
51584        composeDateTimeExtras("date", element.getDateElement(), false);
51585      }
51586      if (element.hasPublisherElement()) {
51587        composeStringCore("publisher", element.getPublisherElement(), false);
51588        composeStringExtras("publisher", element.getPublisherElement(), false);
51589      }
51590      if (element.hasContact()) {
51591        openArray("contact");
51592        for (ContactDetail e : element.getContact()) 
51593          composeContactDetail(null, e);
51594        closeArray();
51595      };
51596      if (element.hasDescriptionElement()) {
51597        composeMarkdownCore("description", element.getDescriptionElement(), false);
51598        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51599      }
51600      if (element.hasUseContext()) {
51601        openArray("useContext");
51602        for (UsageContext e : element.getUseContext()) 
51603          composeUsageContext(null, e);
51604        closeArray();
51605      };
51606      if (element.hasJurisdiction()) {
51607        openArray("jurisdiction");
51608        for (CodeableConcept e : element.getJurisdiction()) 
51609          composeCodeableConcept(null, e);
51610        closeArray();
51611      };
51612      if (element.hasPurposeElement()) {
51613        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51614        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51615      }
51616      if (element.hasUsageElement()) {
51617        composeMarkdownCore("usage", element.getUsageElement(), false);
51618        composeMarkdownExtras("usage", element.getUsageElement(), false);
51619      }
51620      if (element.hasCopyrightElement()) {
51621        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51622        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51623      }
51624      if (element.hasCopyrightLabelElement()) {
51625        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
51626        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
51627      }
51628      if (element.hasApprovalDateElement()) {
51629        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51630        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51631      }
51632      if (element.hasLastReviewDateElement()) {
51633        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51634        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51635      }
51636      if (element.hasEffectivePeriod()) {
51637        composePeriod("effectivePeriod", element.getEffectivePeriod());
51638      }
51639      if (element.hasTopic()) {
51640        openArray("topic");
51641        for (CodeableConcept e : element.getTopic()) 
51642          composeCodeableConcept(null, e);
51643        closeArray();
51644      };
51645      if (element.hasAuthor()) {
51646        openArray("author");
51647        for (ContactDetail e : element.getAuthor()) 
51648          composeContactDetail(null, e);
51649        closeArray();
51650      };
51651      if (element.hasEditor()) {
51652        openArray("editor");
51653        for (ContactDetail e : element.getEditor()) 
51654          composeContactDetail(null, e);
51655        closeArray();
51656      };
51657      if (element.hasReviewer()) {
51658        openArray("reviewer");
51659        for (ContactDetail e : element.getReviewer()) 
51660          composeContactDetail(null, e);
51661        closeArray();
51662      };
51663      if (element.hasEndorser()) {
51664        openArray("endorser");
51665        for (ContactDetail e : element.getEndorser()) 
51666          composeContactDetail(null, e);
51667        closeArray();
51668      };
51669      if (element.hasRelatedArtifact()) {
51670        openArray("relatedArtifact");
51671        for (RelatedArtifact e : element.getRelatedArtifact()) 
51672          composeRelatedArtifact(null, e);
51673        closeArray();
51674      };
51675      if (element.hasTrigger()) {
51676        openArray("trigger");
51677        for (TriggerDefinition e : element.getTrigger()) 
51678          composeTriggerDefinition(null, e);
51679        closeArray();
51680      };
51681  }
51682
51683  protected void composeEvidence(String name, Evidence element) throws IOException {
51684    if (element != null) {
51685      prop("resourceType", name);
51686      composeEvidenceProperties(element);
51687    }
51688  }
51689
51690  protected void composeEvidenceProperties(Evidence element) throws IOException {
51691    composeMetadataResourceProperties(element);
51692      if (element.hasUrlElement()) {
51693        composeUriCore("url", element.getUrlElement(), false);
51694        composeUriExtras("url", element.getUrlElement(), false);
51695      }
51696      if (element.hasIdentifier()) {
51697        openArray("identifier");
51698        for (Identifier e : element.getIdentifier()) 
51699          composeIdentifier(null, e);
51700        closeArray();
51701      };
51702      if (element.hasVersionElement()) {
51703        composeStringCore("version", element.getVersionElement(), false);
51704        composeStringExtras("version", element.getVersionElement(), false);
51705      }
51706      if (element.hasVersionAlgorithm()) {
51707        composeType("versionAlgorithm", element.getVersionAlgorithm());
51708      }
51709      if (element.hasNameElement()) {
51710        composeStringCore("name", element.getNameElement(), false);
51711        composeStringExtras("name", element.getNameElement(), false);
51712      }
51713      if (element.hasTitleElement()) {
51714        composeStringCore("title", element.getTitleElement(), false);
51715        composeStringExtras("title", element.getTitleElement(), false);
51716      }
51717      if (element.hasCiteAs()) {
51718        composeType("citeAs", element.getCiteAs());
51719      }
51720      if (element.hasStatusElement()) {
51721        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51722        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51723      }
51724      if (element.hasExperimentalElement()) {
51725        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51726        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51727      }
51728      if (element.hasDateElement()) {
51729        composeDateTimeCore("date", element.getDateElement(), false);
51730        composeDateTimeExtras("date", element.getDateElement(), false);
51731      }
51732      if (element.hasApprovalDateElement()) {
51733        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51734        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51735      }
51736      if (element.hasLastReviewDateElement()) {
51737        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51738        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51739      }
51740      if (element.hasPublisherElement()) {
51741        composeStringCore("publisher", element.getPublisherElement(), false);
51742        composeStringExtras("publisher", element.getPublisherElement(), false);
51743      }
51744      if (element.hasContact()) {
51745        openArray("contact");
51746        for (ContactDetail e : element.getContact()) 
51747          composeContactDetail(null, e);
51748        closeArray();
51749      };
51750      if (element.hasAuthor()) {
51751        openArray("author");
51752        for (ContactDetail e : element.getAuthor()) 
51753          composeContactDetail(null, e);
51754        closeArray();
51755      };
51756      if (element.hasEditor()) {
51757        openArray("editor");
51758        for (ContactDetail e : element.getEditor()) 
51759          composeContactDetail(null, e);
51760        closeArray();
51761      };
51762      if (element.hasReviewer()) {
51763        openArray("reviewer");
51764        for (ContactDetail e : element.getReviewer()) 
51765          composeContactDetail(null, e);
51766        closeArray();
51767      };
51768      if (element.hasEndorser()) {
51769        openArray("endorser");
51770        for (ContactDetail e : element.getEndorser()) 
51771          composeContactDetail(null, e);
51772        closeArray();
51773      };
51774      if (element.hasUseContext()) {
51775        openArray("useContext");
51776        for (UsageContext e : element.getUseContext()) 
51777          composeUsageContext(null, e);
51778        closeArray();
51779      };
51780      if (element.hasPurposeElement()) {
51781        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51782        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51783      }
51784      if (element.hasCopyrightElement()) {
51785        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51786        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51787      }
51788      if (element.hasCopyrightLabelElement()) {
51789        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
51790        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
51791      }
51792      if (element.hasRelatedArtifact()) {
51793        openArray("relatedArtifact");
51794        for (RelatedArtifact e : element.getRelatedArtifact()) 
51795          composeRelatedArtifact(null, e);
51796        closeArray();
51797      };
51798      if (element.hasDescriptionElement()) {
51799        composeMarkdownCore("description", element.getDescriptionElement(), false);
51800        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51801      }
51802      if (element.hasAssertionElement()) {
51803        composeMarkdownCore("assertion", element.getAssertionElement(), false);
51804        composeMarkdownExtras("assertion", element.getAssertionElement(), false);
51805      }
51806      if (element.hasNote()) {
51807        openArray("note");
51808        for (Annotation e : element.getNote()) 
51809          composeAnnotation(null, e);
51810        closeArray();
51811      };
51812      if (element.hasVariableDefinition()) {
51813        openArray("variableDefinition");
51814        for (Evidence.EvidenceVariableDefinitionComponent e : element.getVariableDefinition()) 
51815          composeEvidenceVariableDefinitionComponent(null, e);
51816        closeArray();
51817      };
51818      if (element.hasSynthesisType()) {
51819        composeCodeableConcept("synthesisType", element.getSynthesisType());
51820      }
51821      if (element.hasStudyDesign()) {
51822        openArray("studyDesign");
51823        for (CodeableConcept e : element.getStudyDesign()) 
51824          composeCodeableConcept(null, e);
51825        closeArray();
51826      };
51827      if (element.hasStatistic()) {
51828        openArray("statistic");
51829        for (Evidence.EvidenceStatisticComponent e : element.getStatistic()) 
51830          composeEvidenceStatisticComponent(null, e);
51831        closeArray();
51832      };
51833      if (element.hasCertainty()) {
51834        openArray("certainty");
51835        for (Evidence.EvidenceCertaintyComponent e : element.getCertainty()) 
51836          composeEvidenceCertaintyComponent(null, e);
51837        closeArray();
51838      };
51839  }
51840
51841  protected void composeEvidenceVariableDefinitionComponent(String name, Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
51842    if (element != null) {
51843      open(name);
51844      composeEvidenceVariableDefinitionComponentProperties(element);
51845      close();
51846    }
51847  }
51848
51849  protected void composeEvidenceVariableDefinitionComponentProperties(Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
51850    composeBackboneElementProperties(element);
51851      if (element.hasDescriptionElement()) {
51852        composeMarkdownCore("description", element.getDescriptionElement(), false);
51853        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51854      }
51855      if (element.hasNote()) {
51856        openArray("note");
51857        for (Annotation e : element.getNote()) 
51858          composeAnnotation(null, e);
51859        closeArray();
51860      };
51861      if (element.hasVariableRole()) {
51862        composeCodeableConcept("variableRole", element.getVariableRole());
51863      }
51864      if (element.hasObserved()) {
51865        composeReference("observed", element.getObserved());
51866      }
51867      if (element.hasIntended()) {
51868        composeReference("intended", element.getIntended());
51869      }
51870      if (element.hasDirectnessMatch()) {
51871        composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
51872      }
51873  }
51874
51875  protected void composeEvidenceStatisticComponent(String name, Evidence.EvidenceStatisticComponent element) throws IOException {
51876    if (element != null) {
51877      open(name);
51878      composeEvidenceStatisticComponentProperties(element);
51879      close();
51880    }
51881  }
51882
51883  protected void composeEvidenceStatisticComponentProperties(Evidence.EvidenceStatisticComponent element) throws IOException {
51884    composeBackboneElementProperties(element);
51885      if (element.hasDescriptionElement()) {
51886        composeMarkdownCore("description", element.getDescriptionElement(), false);
51887        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51888      }
51889      if (element.hasNote()) {
51890        openArray("note");
51891        for (Annotation e : element.getNote()) 
51892          composeAnnotation(null, e);
51893        closeArray();
51894      };
51895      if (element.hasStatisticType()) {
51896        composeCodeableConcept("statisticType", element.getStatisticType());
51897      }
51898      if (element.hasCategory()) {
51899        composeCodeableConcept("category", element.getCategory());
51900      }
51901      if (element.hasQuantity()) {
51902        composeQuantity("quantity", element.getQuantity());
51903      }
51904      if (element.hasNumberOfEventsElement()) {
51905        composeUnsignedIntCore("numberOfEvents", element.getNumberOfEventsElement(), false);
51906        composeUnsignedIntExtras("numberOfEvents", element.getNumberOfEventsElement(), false);
51907      }
51908      if (element.hasNumberAffectedElement()) {
51909        composeUnsignedIntCore("numberAffected", element.getNumberAffectedElement(), false);
51910        composeUnsignedIntExtras("numberAffected", element.getNumberAffectedElement(), false);
51911      }
51912      if (element.hasSampleSize()) {
51913        composeEvidenceStatisticSampleSizeComponent("sampleSize", element.getSampleSize());
51914      }
51915      if (element.hasAttributeEstimate()) {
51916        openArray("attributeEstimate");
51917        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
51918          composeEvidenceStatisticAttributeEstimateComponent(null, e);
51919        closeArray();
51920      };
51921      if (element.hasModelCharacteristic()) {
51922        openArray("modelCharacteristic");
51923        for (Evidence.EvidenceStatisticModelCharacteristicComponent e : element.getModelCharacteristic()) 
51924          composeEvidenceStatisticModelCharacteristicComponent(null, e);
51925        closeArray();
51926      };
51927  }
51928
51929  protected void composeEvidenceStatisticSampleSizeComponent(String name, Evidence.EvidenceStatisticSampleSizeComponent element) throws IOException {
51930    if (element != null) {
51931      open(name);
51932      composeEvidenceStatisticSampleSizeComponentProperties(element);
51933      close();
51934    }
51935  }
51936
51937  protected void composeEvidenceStatisticSampleSizeComponentProperties(Evidence.EvidenceStatisticSampleSizeComponent element) throws IOException {
51938    composeBackboneElementProperties(element);
51939      if (element.hasDescriptionElement()) {
51940        composeMarkdownCore("description", element.getDescriptionElement(), false);
51941        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51942      }
51943      if (element.hasNote()) {
51944        openArray("note");
51945        for (Annotation e : element.getNote()) 
51946          composeAnnotation(null, e);
51947        closeArray();
51948      };
51949      if (element.hasNumberOfStudiesElement()) {
51950        composeUnsignedIntCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
51951        composeUnsignedIntExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
51952      }
51953      if (element.hasNumberOfParticipantsElement()) {
51954        composeUnsignedIntCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
51955        composeUnsignedIntExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
51956      }
51957      if (element.hasKnownDataCountElement()) {
51958        composeUnsignedIntCore("knownDataCount", element.getKnownDataCountElement(), false);
51959        composeUnsignedIntExtras("knownDataCount", element.getKnownDataCountElement(), false);
51960      }
51961  }
51962
51963  protected void composeEvidenceStatisticAttributeEstimateComponent(String name, Evidence.EvidenceStatisticAttributeEstimateComponent element) throws IOException {
51964    if (element != null) {
51965      open(name);
51966      composeEvidenceStatisticAttributeEstimateComponentProperties(element);
51967      close();
51968    }
51969  }
51970
51971  protected void composeEvidenceStatisticAttributeEstimateComponentProperties(Evidence.EvidenceStatisticAttributeEstimateComponent element) throws IOException {
51972    composeBackboneElementProperties(element);
51973      if (element.hasDescriptionElement()) {
51974        composeMarkdownCore("description", element.getDescriptionElement(), false);
51975        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51976      }
51977      if (element.hasNote()) {
51978        openArray("note");
51979        for (Annotation e : element.getNote()) 
51980          composeAnnotation(null, e);
51981        closeArray();
51982      };
51983      if (element.hasType()) {
51984        composeCodeableConcept("type", element.getType());
51985      }
51986      if (element.hasQuantity()) {
51987        composeQuantity("quantity", element.getQuantity());
51988      }
51989      if (element.hasLevelElement()) {
51990        composeDecimalCore("level", element.getLevelElement(), false);
51991        composeDecimalExtras("level", element.getLevelElement(), false);
51992      }
51993      if (element.hasRange()) {
51994        composeRange("range", element.getRange());
51995      }
51996      if (element.hasAttributeEstimate()) {
51997        openArray("attributeEstimate");
51998        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
51999          composeEvidenceStatisticAttributeEstimateComponent(null, e);
52000        closeArray();
52001      };
52002  }
52003
52004  protected void composeEvidenceStatisticModelCharacteristicComponent(String name, Evidence.EvidenceStatisticModelCharacteristicComponent element) throws IOException {
52005    if (element != null) {
52006      open(name);
52007      composeEvidenceStatisticModelCharacteristicComponentProperties(element);
52008      close();
52009    }
52010  }
52011
52012  protected void composeEvidenceStatisticModelCharacteristicComponentProperties(Evidence.EvidenceStatisticModelCharacteristicComponent element) throws IOException {
52013    composeBackboneElementProperties(element);
52014      if (element.hasCode()) {
52015        composeCodeableConcept("code", element.getCode());
52016      }
52017      if (element.hasValue()) {
52018        composeQuantity("value", element.getValue());
52019      }
52020      if (element.hasVariable()) {
52021        openArray("variable");
52022        for (Evidence.EvidenceStatisticModelCharacteristicVariableComponent e : element.getVariable()) 
52023          composeEvidenceStatisticModelCharacteristicVariableComponent(null, e);
52024        closeArray();
52025      };
52026      if (element.hasAttributeEstimate()) {
52027        openArray("attributeEstimate");
52028        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
52029          composeEvidenceStatisticAttributeEstimateComponent(null, e);
52030        closeArray();
52031      };
52032  }
52033
52034  protected void composeEvidenceStatisticModelCharacteristicVariableComponent(String name, Evidence.EvidenceStatisticModelCharacteristicVariableComponent element) throws IOException {
52035    if (element != null) {
52036      open(name);
52037      composeEvidenceStatisticModelCharacteristicVariableComponentProperties(element);
52038      close();
52039    }
52040  }
52041
52042  protected void composeEvidenceStatisticModelCharacteristicVariableComponentProperties(Evidence.EvidenceStatisticModelCharacteristicVariableComponent element) throws IOException {
52043    composeBackboneElementProperties(element);
52044      if (element.hasVariableDefinition()) {
52045        composeReference("variableDefinition", element.getVariableDefinition());
52046      }
52047      if (element.hasHandlingElement()) {
52048        composeEnumerationCore("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52049        composeEnumerationExtras("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52050      }
52051      if (element.hasValueCategory()) {
52052        openArray("valueCategory");
52053        for (CodeableConcept e : element.getValueCategory()) 
52054          composeCodeableConcept(null, e);
52055        closeArray();
52056      };
52057      if (element.hasValueQuantity()) {
52058        openArray("valueQuantity");
52059        for (Quantity e : element.getValueQuantity()) 
52060          composeQuantity(null, e);
52061        closeArray();
52062      };
52063      if (element.hasValueRange()) {
52064        openArray("valueRange");
52065        for (Range e : element.getValueRange()) 
52066          composeRange(null, e);
52067        closeArray();
52068      };
52069  }
52070
52071  protected void composeEvidenceCertaintyComponent(String name, Evidence.EvidenceCertaintyComponent element) throws IOException {
52072    if (element != null) {
52073      open(name);
52074      composeEvidenceCertaintyComponentProperties(element);
52075      close();
52076    }
52077  }
52078
52079  protected void composeEvidenceCertaintyComponentProperties(Evidence.EvidenceCertaintyComponent element) throws IOException {
52080    composeBackboneElementProperties(element);
52081      if (element.hasDescriptionElement()) {
52082        composeMarkdownCore("description", element.getDescriptionElement(), false);
52083        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52084      }
52085      if (element.hasNote()) {
52086        openArray("note");
52087        for (Annotation e : element.getNote()) 
52088          composeAnnotation(null, e);
52089        closeArray();
52090      };
52091      if (element.hasType()) {
52092        composeCodeableConcept("type", element.getType());
52093      }
52094      if (element.hasRating()) {
52095        composeCodeableConcept("rating", element.getRating());
52096      }
52097      if (element.hasRaterElement()) {
52098        composeStringCore("rater", element.getRaterElement(), false);
52099        composeStringExtras("rater", element.getRaterElement(), false);
52100      }
52101      if (element.hasSubcomponent()) {
52102        openArray("subcomponent");
52103        for (Evidence.EvidenceCertaintyComponent e : element.getSubcomponent()) 
52104          composeEvidenceCertaintyComponent(null, e);
52105        closeArray();
52106      };
52107  }
52108
52109  protected void composeEvidenceReport(String name, EvidenceReport element) throws IOException {
52110    if (element != null) {
52111      prop("resourceType", name);
52112      composeEvidenceReportProperties(element);
52113    }
52114  }
52115
52116  protected void composeEvidenceReportProperties(EvidenceReport element) throws IOException {
52117    composeMetadataResourceProperties(element);
52118      if (element.hasUrlElement()) {
52119        composeUriCore("url", element.getUrlElement(), false);
52120        composeUriExtras("url", element.getUrlElement(), false);
52121      }
52122      if (element.hasStatusElement()) {
52123        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52124        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52125      }
52126      if (element.hasUseContext()) {
52127        openArray("useContext");
52128        for (UsageContext e : element.getUseContext()) 
52129          composeUsageContext(null, e);
52130        closeArray();
52131      };
52132      if (element.hasIdentifier()) {
52133        openArray("identifier");
52134        for (Identifier e : element.getIdentifier()) 
52135          composeIdentifier(null, e);
52136        closeArray();
52137      };
52138      if (element.hasRelatedIdentifier()) {
52139        openArray("relatedIdentifier");
52140        for (Identifier e : element.getRelatedIdentifier()) 
52141          composeIdentifier(null, e);
52142        closeArray();
52143      };
52144      if (element.hasCiteAs()) {
52145        composeType("citeAs", element.getCiteAs());
52146      }
52147      if (element.hasType()) {
52148        composeCodeableConcept("type", element.getType());
52149      }
52150      if (element.hasNote()) {
52151        openArray("note");
52152        for (Annotation e : element.getNote()) 
52153          composeAnnotation(null, e);
52154        closeArray();
52155      };
52156      if (element.hasRelatedArtifact()) {
52157        openArray("relatedArtifact");
52158        for (RelatedArtifact e : element.getRelatedArtifact()) 
52159          composeRelatedArtifact(null, e);
52160        closeArray();
52161      };
52162      if (element.hasSubject()) {
52163        composeEvidenceReportSubjectComponent("subject", element.getSubject());
52164      }
52165      if (element.hasPublisherElement()) {
52166        composeStringCore("publisher", element.getPublisherElement(), false);
52167        composeStringExtras("publisher", element.getPublisherElement(), false);
52168      }
52169      if (element.hasContact()) {
52170        openArray("contact");
52171        for (ContactDetail e : element.getContact()) 
52172          composeContactDetail(null, e);
52173        closeArray();
52174      };
52175      if (element.hasAuthor()) {
52176        openArray("author");
52177        for (ContactDetail e : element.getAuthor()) 
52178          composeContactDetail(null, e);
52179        closeArray();
52180      };
52181      if (element.hasEditor()) {
52182        openArray("editor");
52183        for (ContactDetail e : element.getEditor()) 
52184          composeContactDetail(null, e);
52185        closeArray();
52186      };
52187      if (element.hasReviewer()) {
52188        openArray("reviewer");
52189        for (ContactDetail e : element.getReviewer()) 
52190          composeContactDetail(null, e);
52191        closeArray();
52192      };
52193      if (element.hasEndorser()) {
52194        openArray("endorser");
52195        for (ContactDetail e : element.getEndorser()) 
52196          composeContactDetail(null, e);
52197        closeArray();
52198      };
52199      if (element.hasRelatesTo()) {
52200        openArray("relatesTo");
52201        for (EvidenceReport.EvidenceReportRelatesToComponent e : element.getRelatesTo()) 
52202          composeEvidenceReportRelatesToComponent(null, e);
52203        closeArray();
52204      };
52205      if (element.hasSection()) {
52206        openArray("section");
52207        for (EvidenceReport.SectionComponent e : element.getSection()) 
52208          composeSectionComponent(null, e);
52209        closeArray();
52210      };
52211  }
52212
52213  protected void composeEvidenceReportSubjectComponent(String name, EvidenceReport.EvidenceReportSubjectComponent element) throws IOException {
52214    if (element != null) {
52215      open(name);
52216      composeEvidenceReportSubjectComponentProperties(element);
52217      close();
52218    }
52219  }
52220
52221  protected void composeEvidenceReportSubjectComponentProperties(EvidenceReport.EvidenceReportSubjectComponent element) throws IOException {
52222    composeBackboneElementProperties(element);
52223      if (element.hasCharacteristic()) {
52224        openArray("characteristic");
52225        for (EvidenceReport.EvidenceReportSubjectCharacteristicComponent e : element.getCharacteristic()) 
52226          composeEvidenceReportSubjectCharacteristicComponent(null, e);
52227        closeArray();
52228      };
52229      if (element.hasNote()) {
52230        openArray("note");
52231        for (Annotation e : element.getNote()) 
52232          composeAnnotation(null, e);
52233        closeArray();
52234      };
52235  }
52236
52237  protected void composeEvidenceReportSubjectCharacteristicComponent(String name, EvidenceReport.EvidenceReportSubjectCharacteristicComponent element) throws IOException {
52238    if (element != null) {
52239      open(name);
52240      composeEvidenceReportSubjectCharacteristicComponentProperties(element);
52241      close();
52242    }
52243  }
52244
52245  protected void composeEvidenceReportSubjectCharacteristicComponentProperties(EvidenceReport.EvidenceReportSubjectCharacteristicComponent element) throws IOException {
52246    composeBackboneElementProperties(element);
52247      if (element.hasCode()) {
52248        composeCodeableConcept("code", element.getCode());
52249      }
52250      if (element.hasValue()) {
52251        composeType("value", element.getValue());
52252      }
52253      if (element.hasExcludeElement()) {
52254        composeBooleanCore("exclude", element.getExcludeElement(), false);
52255        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52256      }
52257      if (element.hasPeriod()) {
52258        composePeriod("period", element.getPeriod());
52259      }
52260  }
52261
52262  protected void composeEvidenceReportRelatesToComponent(String name, EvidenceReport.EvidenceReportRelatesToComponent element) throws IOException {
52263    if (element != null) {
52264      open(name);
52265      composeEvidenceReportRelatesToComponentProperties(element);
52266      close();
52267    }
52268  }
52269
52270  protected void composeEvidenceReportRelatesToComponentProperties(EvidenceReport.EvidenceReportRelatesToComponent element) throws IOException {
52271    composeBackboneElementProperties(element);
52272      if (element.hasCodeElement()) {
52273        composeEnumerationCore("code", element.getCodeElement(), new EvidenceReport.ReportRelationshipTypeEnumFactory(), false);
52274        composeEnumerationExtras("code", element.getCodeElement(), new EvidenceReport.ReportRelationshipTypeEnumFactory(), false);
52275      }
52276      if (element.hasTarget()) {
52277        composeEvidenceReportRelatesToTargetComponent("target", element.getTarget());
52278      }
52279  }
52280
52281  protected void composeEvidenceReportRelatesToTargetComponent(String name, EvidenceReport.EvidenceReportRelatesToTargetComponent element) throws IOException {
52282    if (element != null) {
52283      open(name);
52284      composeEvidenceReportRelatesToTargetComponentProperties(element);
52285      close();
52286    }
52287  }
52288
52289  protected void composeEvidenceReportRelatesToTargetComponentProperties(EvidenceReport.EvidenceReportRelatesToTargetComponent element) throws IOException {
52290    composeBackboneElementProperties(element);
52291      if (element.hasUrlElement()) {
52292        composeUriCore("url", element.getUrlElement(), false);
52293        composeUriExtras("url", element.getUrlElement(), false);
52294      }
52295      if (element.hasIdentifier()) {
52296        composeIdentifier("identifier", element.getIdentifier());
52297      }
52298      if (element.hasDisplayElement()) {
52299        composeMarkdownCore("display", element.getDisplayElement(), false);
52300        composeMarkdownExtras("display", element.getDisplayElement(), false);
52301      }
52302      if (element.hasResource()) {
52303        composeReference("resource", element.getResource());
52304      }
52305  }
52306
52307  protected void composeSectionComponent(String name, EvidenceReport.SectionComponent element) throws IOException {
52308    if (element != null) {
52309      open(name);
52310      composeSectionComponentProperties(element);
52311      close();
52312    }
52313  }
52314
52315  protected void composeSectionComponentProperties(EvidenceReport.SectionComponent element) throws IOException {
52316    composeBackboneElementProperties(element);
52317      if (element.hasTitleElement()) {
52318        composeStringCore("title", element.getTitleElement(), false);
52319        composeStringExtras("title", element.getTitleElement(), false);
52320      }
52321      if (element.hasFocus()) {
52322        composeCodeableConcept("focus", element.getFocus());
52323      }
52324      if (element.hasFocusReference()) {
52325        composeReference("focusReference", element.getFocusReference());
52326      }
52327      if (element.hasAuthor()) {
52328        openArray("author");
52329        for (Reference e : element.getAuthor()) 
52330          composeReference(null, e);
52331        closeArray();
52332      };
52333      if (element.hasText()) {
52334        composeNarrative("text", element.getText());
52335      }
52336      if (element.hasModeElement()) {
52337        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
52338        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
52339      }
52340      if (element.hasOrderedBy()) {
52341        composeCodeableConcept("orderedBy", element.getOrderedBy());
52342      }
52343      if (element.hasEntryClassifier()) {
52344        openArray("entryClassifier");
52345        for (CodeableConcept e : element.getEntryClassifier()) 
52346          composeCodeableConcept(null, e);
52347        closeArray();
52348      };
52349      if (element.hasEntryReference()) {
52350        openArray("entryReference");
52351        for (Reference e : element.getEntryReference()) 
52352          composeReference(null, e);
52353        closeArray();
52354      };
52355      if (element.hasEntryQuantity()) {
52356        openArray("entryQuantity");
52357        for (Quantity e : element.getEntryQuantity()) 
52358          composeQuantity(null, e);
52359        closeArray();
52360      };
52361      if (element.hasEmptyReason()) {
52362        composeCodeableConcept("emptyReason", element.getEmptyReason());
52363      }
52364      if (element.hasSection()) {
52365        openArray("section");
52366        for (EvidenceReport.SectionComponent e : element.getSection()) 
52367          composeSectionComponent(null, e);
52368        closeArray();
52369      };
52370  }
52371
52372  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
52373    if (element != null) {
52374      prop("resourceType", name);
52375      composeEvidenceVariableProperties(element);
52376    }
52377  }
52378
52379  protected void composeEvidenceVariableProperties(EvidenceVariable element) throws IOException {
52380    composeMetadataResourceProperties(element);
52381      if (element.hasUrlElement()) {
52382        composeUriCore("url", element.getUrlElement(), false);
52383        composeUriExtras("url", element.getUrlElement(), false);
52384      }
52385      if (element.hasIdentifier()) {
52386        openArray("identifier");
52387        for (Identifier e : element.getIdentifier()) 
52388          composeIdentifier(null, e);
52389        closeArray();
52390      };
52391      if (element.hasVersionElement()) {
52392        composeStringCore("version", element.getVersionElement(), false);
52393        composeStringExtras("version", element.getVersionElement(), false);
52394      }
52395      if (element.hasVersionAlgorithm()) {
52396        composeType("versionAlgorithm", element.getVersionAlgorithm());
52397      }
52398      if (element.hasNameElement()) {
52399        composeStringCore("name", element.getNameElement(), false);
52400        composeStringExtras("name", element.getNameElement(), false);
52401      }
52402      if (element.hasTitleElement()) {
52403        composeStringCore("title", element.getTitleElement(), false);
52404        composeStringExtras("title", element.getTitleElement(), false);
52405      }
52406      if (element.hasShortTitleElement()) {
52407        composeStringCore("shortTitle", element.getShortTitleElement(), false);
52408        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
52409      }
52410      if (element.hasStatusElement()) {
52411        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52412        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52413      }
52414      if (element.hasExperimentalElement()) {
52415        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52416        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52417      }
52418      if (element.hasDateElement()) {
52419        composeDateTimeCore("date", element.getDateElement(), false);
52420        composeDateTimeExtras("date", element.getDateElement(), false);
52421      }
52422      if (element.hasPublisherElement()) {
52423        composeStringCore("publisher", element.getPublisherElement(), false);
52424        composeStringExtras("publisher", element.getPublisherElement(), false);
52425      }
52426      if (element.hasContact()) {
52427        openArray("contact");
52428        for (ContactDetail e : element.getContact()) 
52429          composeContactDetail(null, e);
52430        closeArray();
52431      };
52432      if (element.hasDescriptionElement()) {
52433        composeMarkdownCore("description", element.getDescriptionElement(), false);
52434        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52435      }
52436      if (element.hasNote()) {
52437        openArray("note");
52438        for (Annotation e : element.getNote()) 
52439          composeAnnotation(null, e);
52440        closeArray();
52441      };
52442      if (element.hasUseContext()) {
52443        openArray("useContext");
52444        for (UsageContext e : element.getUseContext()) 
52445          composeUsageContext(null, e);
52446        closeArray();
52447      };
52448      if (element.hasPurposeElement()) {
52449        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52450        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52451      }
52452      if (element.hasCopyrightElement()) {
52453        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52454        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52455      }
52456      if (element.hasCopyrightLabelElement()) {
52457        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
52458        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
52459      }
52460      if (element.hasApprovalDateElement()) {
52461        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52462        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52463      }
52464      if (element.hasLastReviewDateElement()) {
52465        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52466        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52467      }
52468      if (element.hasEffectivePeriod()) {
52469        composePeriod("effectivePeriod", element.getEffectivePeriod());
52470      }
52471      if (element.hasAuthor()) {
52472        openArray("author");
52473        for (ContactDetail e : element.getAuthor()) 
52474          composeContactDetail(null, e);
52475        closeArray();
52476      };
52477      if (element.hasEditor()) {
52478        openArray("editor");
52479        for (ContactDetail e : element.getEditor()) 
52480          composeContactDetail(null, e);
52481        closeArray();
52482      };
52483      if (element.hasReviewer()) {
52484        openArray("reviewer");
52485        for (ContactDetail e : element.getReviewer()) 
52486          composeContactDetail(null, e);
52487        closeArray();
52488      };
52489      if (element.hasEndorser()) {
52490        openArray("endorser");
52491        for (ContactDetail e : element.getEndorser()) 
52492          composeContactDetail(null, e);
52493        closeArray();
52494      };
52495      if (element.hasRelatedArtifact()) {
52496        openArray("relatedArtifact");
52497        for (RelatedArtifact e : element.getRelatedArtifact()) 
52498          composeRelatedArtifact(null, e);
52499        closeArray();
52500      };
52501      if (element.hasActualElement()) {
52502        composeBooleanCore("actual", element.getActualElement(), false);
52503        composeBooleanExtras("actual", element.getActualElement(), false);
52504      }
52505      if (element.hasCharacteristic()) {
52506        openArray("characteristic");
52507        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
52508          composeEvidenceVariableCharacteristicComponent(null, e);
52509        closeArray();
52510      };
52511      if (element.hasHandlingElement()) {
52512        composeEnumerationCore("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52513        composeEnumerationExtras("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52514      }
52515      if (element.hasCategory()) {
52516        openArray("category");
52517        for (EvidenceVariable.EvidenceVariableCategoryComponent e : element.getCategory()) 
52518          composeEvidenceVariableCategoryComponent(null, e);
52519        closeArray();
52520      };
52521  }
52522
52523  protected void composeEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
52524    if (element != null) {
52525      open(name);
52526      composeEvidenceVariableCharacteristicComponentProperties(element);
52527      close();
52528    }
52529  }
52530
52531  protected void composeEvidenceVariableCharacteristicComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
52532    composeBackboneElementProperties(element);
52533      if (element.hasLinkIdElement()) {
52534        composeIdCore("linkId", element.getLinkIdElement(), false);
52535        composeIdExtras("linkId", element.getLinkIdElement(), false);
52536      }
52537      if (element.hasDescriptionElement()) {
52538        composeMarkdownCore("description", element.getDescriptionElement(), false);
52539        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52540      }
52541      if (element.hasNote()) {
52542        openArray("note");
52543        for (Annotation e : element.getNote()) 
52544          composeAnnotation(null, e);
52545        closeArray();
52546      };
52547      if (element.hasExcludeElement()) {
52548        composeBooleanCore("exclude", element.getExcludeElement(), false);
52549        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52550      }
52551      if (element.hasDefinitionReference()) {
52552        composeReference("definitionReference", element.getDefinitionReference());
52553      }
52554      if (element.hasDefinitionCanonicalElement()) {
52555        composeCanonicalCore("definitionCanonical", element.getDefinitionCanonicalElement(), false);
52556        composeCanonicalExtras("definitionCanonical", element.getDefinitionCanonicalElement(), false);
52557      }
52558      if (element.hasDefinitionCodeableConcept()) {
52559        composeCodeableConcept("definitionCodeableConcept", element.getDefinitionCodeableConcept());
52560      }
52561      if (element.hasDefinitionExpression()) {
52562        composeExpression("definitionExpression", element.getDefinitionExpression());
52563      }
52564      if (element.hasDefinitionIdElement()) {
52565        composeIdCore("definitionId", element.getDefinitionIdElement(), false);
52566        composeIdExtras("definitionId", element.getDefinitionIdElement(), false);
52567      }
52568      if (element.hasDefinitionByTypeAndValue()) {
52569        composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponent("definitionByTypeAndValue", element.getDefinitionByTypeAndValue());
52570      }
52571      if (element.hasDefinitionByCombination()) {
52572        composeEvidenceVariableCharacteristicDefinitionByCombinationComponent("definitionByCombination", element.getDefinitionByCombination());
52573      }
52574      if (element.hasInstances()) {
52575        composeType("instances", element.getInstances());
52576      }
52577      if (element.hasDuration()) {
52578        composeType("duration", element.getDuration());
52579      }
52580      if (element.hasTimeFromEvent()) {
52581        openArray("timeFromEvent");
52582        for (EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent e : element.getTimeFromEvent()) 
52583          composeEvidenceVariableCharacteristicTimeFromEventComponent(null, e);
52584        closeArray();
52585      };
52586  }
52587
52588  protected void composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent element) throws IOException {
52589    if (element != null) {
52590      open(name);
52591      composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponentProperties(element);
52592      close();
52593    }
52594  }
52595
52596  protected void composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent element) throws IOException {
52597    composeBackboneElementProperties(element);
52598      if (element.hasType()) {
52599        composeCodeableConcept("type", element.getType());
52600      }
52601      if (element.hasMethod()) {
52602        openArray("method");
52603        for (CodeableConcept e : element.getMethod()) 
52604          composeCodeableConcept(null, e);
52605        closeArray();
52606      };
52607      if (element.hasDevice()) {
52608        composeReference("device", element.getDevice());
52609      }
52610      if (element.hasValue()) {
52611        composeType("value", element.getValue());
52612      }
52613      if (element.hasOffset()) {
52614        composeCodeableConcept("offset", element.getOffset());
52615      }
52616  }
52617
52618  protected void composeEvidenceVariableCharacteristicDefinitionByCombinationComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent element) throws IOException {
52619    if (element != null) {
52620      open(name);
52621      composeEvidenceVariableCharacteristicDefinitionByCombinationComponentProperties(element);
52622      close();
52623    }
52624  }
52625
52626  protected void composeEvidenceVariableCharacteristicDefinitionByCombinationComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent element) throws IOException {
52627    composeBackboneElementProperties(element);
52628      if (element.hasCodeElement()) {
52629        composeEnumerationCore("code", element.getCodeElement(), new EvidenceVariable.CharacteristicCombinationEnumFactory(), false);
52630        composeEnumerationExtras("code", element.getCodeElement(), new EvidenceVariable.CharacteristicCombinationEnumFactory(), false);
52631      }
52632      if (element.hasThresholdElement()) {
52633        composePositiveIntCore("threshold", element.getThresholdElement(), false);
52634        composePositiveIntExtras("threshold", element.getThresholdElement(), false);
52635      }
52636      if (element.hasCharacteristic()) {
52637        openArray("characteristic");
52638        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
52639          composeEvidenceVariableCharacteristicComponent(null, e);
52640        closeArray();
52641      };
52642  }
52643
52644  protected void composeEvidenceVariableCharacteristicTimeFromEventComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent element) throws IOException {
52645    if (element != null) {
52646      open(name);
52647      composeEvidenceVariableCharacteristicTimeFromEventComponentProperties(element);
52648      close();
52649    }
52650  }
52651
52652  protected void composeEvidenceVariableCharacteristicTimeFromEventComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent element) throws IOException {
52653    composeBackboneElementProperties(element);
52654      if (element.hasDescriptionElement()) {
52655        composeMarkdownCore("description", element.getDescriptionElement(), false);
52656        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52657      }
52658      if (element.hasNote()) {
52659        openArray("note");
52660        for (Annotation e : element.getNote()) 
52661          composeAnnotation(null, e);
52662        closeArray();
52663      };
52664      if (element.hasEvent()) {
52665        composeType("event", element.getEvent());
52666      }
52667      if (element.hasQuantity()) {
52668        composeQuantity("quantity", element.getQuantity());
52669      }
52670      if (element.hasRange()) {
52671        composeRange("range", element.getRange());
52672      }
52673  }
52674
52675  protected void composeEvidenceVariableCategoryComponent(String name, EvidenceVariable.EvidenceVariableCategoryComponent element) throws IOException {
52676    if (element != null) {
52677      open(name);
52678      composeEvidenceVariableCategoryComponentProperties(element);
52679      close();
52680    }
52681  }
52682
52683  protected void composeEvidenceVariableCategoryComponentProperties(EvidenceVariable.EvidenceVariableCategoryComponent element) throws IOException {
52684    composeBackboneElementProperties(element);
52685      if (element.hasNameElement()) {
52686        composeStringCore("name", element.getNameElement(), false);
52687        composeStringExtras("name", element.getNameElement(), false);
52688      }
52689      if (element.hasValue()) {
52690        composeType("value", element.getValue());
52691      }
52692  }
52693
52694  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
52695    if (element != null) {
52696      prop("resourceType", name);
52697      composeExampleScenarioProperties(element);
52698    }
52699  }
52700
52701  protected void composeExampleScenarioProperties(ExampleScenario element) throws IOException {
52702    composeCanonicalResourceProperties(element);
52703      if (element.hasUrlElement()) {
52704        composeUriCore("url", element.getUrlElement(), false);
52705        composeUriExtras("url", element.getUrlElement(), false);
52706      }
52707      if (element.hasIdentifier()) {
52708        openArray("identifier");
52709        for (Identifier e : element.getIdentifier()) 
52710          composeIdentifier(null, e);
52711        closeArray();
52712      };
52713      if (element.hasVersionElement()) {
52714        composeStringCore("version", element.getVersionElement(), false);
52715        composeStringExtras("version", element.getVersionElement(), false);
52716      }
52717      if (element.hasVersionAlgorithm()) {
52718        composeType("versionAlgorithm", element.getVersionAlgorithm());
52719      }
52720      if (element.hasNameElement()) {
52721        composeStringCore("name", element.getNameElement(), false);
52722        composeStringExtras("name", element.getNameElement(), false);
52723      }
52724      if (element.hasTitleElement()) {
52725        composeStringCore("title", element.getTitleElement(), false);
52726        composeStringExtras("title", element.getTitleElement(), false);
52727      }
52728      if (element.hasStatusElement()) {
52729        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52730        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52731      }
52732      if (element.hasExperimentalElement()) {
52733        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52734        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52735      }
52736      if (element.hasDateElement()) {
52737        composeDateTimeCore("date", element.getDateElement(), false);
52738        composeDateTimeExtras("date", element.getDateElement(), false);
52739      }
52740      if (element.hasPublisherElement()) {
52741        composeStringCore("publisher", element.getPublisherElement(), false);
52742        composeStringExtras("publisher", element.getPublisherElement(), false);
52743      }
52744      if (element.hasContact()) {
52745        openArray("contact");
52746        for (ContactDetail e : element.getContact()) 
52747          composeContactDetail(null, e);
52748        closeArray();
52749      };
52750      if (element.hasDescriptionElement()) {
52751        composeMarkdownCore("description", element.getDescriptionElement(), false);
52752        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52753      }
52754      if (element.hasUseContext()) {
52755        openArray("useContext");
52756        for (UsageContext e : element.getUseContext()) 
52757          composeUsageContext(null, e);
52758        closeArray();
52759      };
52760      if (element.hasJurisdiction()) {
52761        openArray("jurisdiction");
52762        for (CodeableConcept e : element.getJurisdiction()) 
52763          composeCodeableConcept(null, e);
52764        closeArray();
52765      };
52766      if (element.hasPurposeElement()) {
52767        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52768        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52769      }
52770      if (element.hasCopyrightElement()) {
52771        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52772        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52773      }
52774      if (element.hasCopyrightLabelElement()) {
52775        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
52776        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
52777      }
52778      if (element.hasActor()) {
52779        openArray("actor");
52780        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
52781          composeExampleScenarioActorComponent(null, e);
52782        closeArray();
52783      };
52784      if (element.hasInstance()) {
52785        openArray("instance");
52786        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
52787          composeExampleScenarioInstanceComponent(null, e);
52788        closeArray();
52789      };
52790      if (element.hasProcess()) {
52791        openArray("process");
52792        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
52793          composeExampleScenarioProcessComponent(null, e);
52794        closeArray();
52795      };
52796  }
52797
52798  protected void composeExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
52799    if (element != null) {
52800      open(name);
52801      composeExampleScenarioActorComponentProperties(element);
52802      close();
52803    }
52804  }
52805
52806  protected void composeExampleScenarioActorComponentProperties(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
52807    composeBackboneElementProperties(element);
52808      if (element.hasKeyElement()) {
52809        composeStringCore("key", element.getKeyElement(), false);
52810        composeStringExtras("key", element.getKeyElement(), false);
52811      }
52812      if (element.hasTypeElement()) {
52813        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
52814        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
52815      }
52816      if (element.hasTitleElement()) {
52817        composeStringCore("title", element.getTitleElement(), false);
52818        composeStringExtras("title", element.getTitleElement(), false);
52819      }
52820      if (element.hasDescriptionElement()) {
52821        composeMarkdownCore("description", element.getDescriptionElement(), false);
52822        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52823      }
52824  }
52825
52826  protected void composeExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
52827    if (element != null) {
52828      open(name);
52829      composeExampleScenarioInstanceComponentProperties(element);
52830      close();
52831    }
52832  }
52833
52834  protected void composeExampleScenarioInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
52835    composeBackboneElementProperties(element);
52836      if (element.hasKeyElement()) {
52837        composeStringCore("key", element.getKeyElement(), false);
52838        composeStringExtras("key", element.getKeyElement(), false);
52839      }
52840      if (element.hasStructureType()) {
52841        composeCoding("structureType", element.getStructureType());
52842      }
52843      if (element.hasStructureVersionElement()) {
52844        composeStringCore("structureVersion", element.getStructureVersionElement(), false);
52845        composeStringExtras("structureVersion", element.getStructureVersionElement(), false);
52846      }
52847      if (element.hasStructureProfile()) {
52848        composeType("structureProfile", element.getStructureProfile());
52849      }
52850      if (element.hasTitleElement()) {
52851        composeStringCore("title", element.getTitleElement(), false);
52852        composeStringExtras("title", element.getTitleElement(), false);
52853      }
52854      if (element.hasDescriptionElement()) {
52855        composeMarkdownCore("description", element.getDescriptionElement(), false);
52856        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52857      }
52858      if (element.hasContent()) {
52859        composeReference("content", element.getContent());
52860      }
52861      if (element.hasVersion()) {
52862        openArray("version");
52863        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
52864          composeExampleScenarioInstanceVersionComponent(null, e);
52865        closeArray();
52866      };
52867      if (element.hasContainedInstance()) {
52868        openArray("containedInstance");
52869        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
52870          composeExampleScenarioInstanceContainedInstanceComponent(null, e);
52871        closeArray();
52872      };
52873  }
52874
52875  protected void composeExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
52876    if (element != null) {
52877      open(name);
52878      composeExampleScenarioInstanceVersionComponentProperties(element);
52879      close();
52880    }
52881  }
52882
52883  protected void composeExampleScenarioInstanceVersionComponentProperties(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
52884    composeBackboneElementProperties(element);
52885      if (element.hasKeyElement()) {
52886        composeStringCore("key", element.getKeyElement(), false);
52887        composeStringExtras("key", element.getKeyElement(), false);
52888      }
52889      if (element.hasTitleElement()) {
52890        composeStringCore("title", element.getTitleElement(), false);
52891        composeStringExtras("title", element.getTitleElement(), false);
52892      }
52893      if (element.hasDescriptionElement()) {
52894        composeMarkdownCore("description", element.getDescriptionElement(), false);
52895        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52896      }
52897      if (element.hasContent()) {
52898        composeReference("content", element.getContent());
52899      }
52900  }
52901
52902  protected void composeExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
52903    if (element != null) {
52904      open(name);
52905      composeExampleScenarioInstanceContainedInstanceComponentProperties(element);
52906      close();
52907    }
52908  }
52909
52910  protected void composeExampleScenarioInstanceContainedInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
52911    composeBackboneElementProperties(element);
52912      if (element.hasInstanceReferenceElement()) {
52913        composeStringCore("instanceReference", element.getInstanceReferenceElement(), false);
52914        composeStringExtras("instanceReference", element.getInstanceReferenceElement(), false);
52915      }
52916      if (element.hasVersionReferenceElement()) {
52917        composeStringCore("versionReference", element.getVersionReferenceElement(), false);
52918        composeStringExtras("versionReference", element.getVersionReferenceElement(), false);
52919      }
52920  }
52921
52922  protected void composeExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
52923    if (element != null) {
52924      open(name);
52925      composeExampleScenarioProcessComponentProperties(element);
52926      close();
52927    }
52928  }
52929
52930  protected void composeExampleScenarioProcessComponentProperties(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
52931    composeBackboneElementProperties(element);
52932      if (element.hasTitleElement()) {
52933        composeStringCore("title", element.getTitleElement(), false);
52934        composeStringExtras("title", element.getTitleElement(), false);
52935      }
52936      if (element.hasDescriptionElement()) {
52937        composeMarkdownCore("description", element.getDescriptionElement(), false);
52938        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52939      }
52940      if (element.hasPreConditionsElement()) {
52941        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
52942        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
52943      }
52944      if (element.hasPostConditionsElement()) {
52945        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
52946        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
52947      }
52948      if (element.hasStep()) {
52949        openArray("step");
52950        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
52951          composeExampleScenarioProcessStepComponent(null, e);
52952        closeArray();
52953      };
52954  }
52955
52956  protected void composeExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
52957    if (element != null) {
52958      open(name);
52959      composeExampleScenarioProcessStepComponentProperties(element);
52960      close();
52961    }
52962  }
52963
52964  protected void composeExampleScenarioProcessStepComponentProperties(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
52965    composeBackboneElementProperties(element);
52966      if (element.hasNumberElement()) {
52967        composeStringCore("number", element.getNumberElement(), false);
52968        composeStringExtras("number", element.getNumberElement(), false);
52969      }
52970      if (element.hasProcess()) {
52971        composeExampleScenarioProcessComponent("process", element.getProcess());
52972      }
52973      if (element.hasWorkflowElement()) {
52974        composeCanonicalCore("workflow", element.getWorkflowElement(), false);
52975        composeCanonicalExtras("workflow", element.getWorkflowElement(), false);
52976      }
52977      if (element.hasOperation()) {
52978        composeExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
52979      }
52980      if (element.hasAlternative()) {
52981        openArray("alternative");
52982        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
52983          composeExampleScenarioProcessStepAlternativeComponent(null, e);
52984        closeArray();
52985      };
52986      if (element.hasPauseElement()) {
52987        composeBooleanCore("pause", element.getPauseElement(), false);
52988        composeBooleanExtras("pause", element.getPauseElement(), false);
52989      }
52990  }
52991
52992  protected void composeExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
52993    if (element != null) {
52994      open(name);
52995      composeExampleScenarioProcessStepOperationComponentProperties(element);
52996      close();
52997    }
52998  }
52999
53000  protected void composeExampleScenarioProcessStepOperationComponentProperties(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
53001    composeBackboneElementProperties(element);
53002      if (element.hasType()) {
53003        composeCoding("type", element.getType());
53004      }
53005      if (element.hasTitleElement()) {
53006        composeStringCore("title", element.getTitleElement(), false);
53007        composeStringExtras("title", element.getTitleElement(), false);
53008      }
53009      if (element.hasInitiatorElement()) {
53010        composeStringCore("initiator", element.getInitiatorElement(), false);
53011        composeStringExtras("initiator", element.getInitiatorElement(), false);
53012      }
53013      if (element.hasReceiverElement()) {
53014        composeStringCore("receiver", element.getReceiverElement(), false);
53015        composeStringExtras("receiver", element.getReceiverElement(), false);
53016      }
53017      if (element.hasDescriptionElement()) {
53018        composeMarkdownCore("description", element.getDescriptionElement(), false);
53019        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53020      }
53021      if (element.hasInitiatorActiveElement()) {
53022        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
53023        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
53024      }
53025      if (element.hasReceiverActiveElement()) {
53026        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
53027        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
53028      }
53029      if (element.hasRequest()) {
53030        composeExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
53031      }
53032      if (element.hasResponse()) {
53033        composeExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
53034      }
53035  }
53036
53037  protected void composeExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
53038    if (element != null) {
53039      open(name);
53040      composeExampleScenarioProcessStepAlternativeComponentProperties(element);
53041      close();
53042    }
53043  }
53044
53045  protected void composeExampleScenarioProcessStepAlternativeComponentProperties(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
53046    composeBackboneElementProperties(element);
53047      if (element.hasTitleElement()) {
53048        composeStringCore("title", element.getTitleElement(), false);
53049        composeStringExtras("title", element.getTitleElement(), false);
53050      }
53051      if (element.hasDescriptionElement()) {
53052        composeMarkdownCore("description", element.getDescriptionElement(), false);
53053        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53054      }
53055      if (element.hasStep()) {
53056        openArray("step");
53057        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
53058          composeExampleScenarioProcessStepComponent(null, e);
53059        closeArray();
53060      };
53061  }
53062
53063  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
53064    if (element != null) {
53065      prop("resourceType", name);
53066      composeExplanationOfBenefitProperties(element);
53067    }
53068  }
53069
53070  protected void composeExplanationOfBenefitProperties(ExplanationOfBenefit element) throws IOException {
53071    composeDomainResourceProperties(element);
53072      if (element.hasIdentifier()) {
53073        openArray("identifier");
53074        for (Identifier e : element.getIdentifier()) 
53075          composeIdentifier(null, e);
53076        closeArray();
53077      };
53078      if (element.hasTraceNumber()) {
53079        openArray("traceNumber");
53080        for (Identifier e : element.getTraceNumber()) 
53081          composeIdentifier(null, e);
53082        closeArray();
53083      };
53084      if (element.hasStatusElement()) {
53085        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
53086        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
53087      }
53088      if (element.hasType()) {
53089        composeCodeableConcept("type", element.getType());
53090      }
53091      if (element.hasSubType()) {
53092        composeCodeableConcept("subType", element.getSubType());
53093      }
53094      if (element.hasUseElement()) {
53095        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
53096        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
53097      }
53098      if (element.hasPatient()) {
53099        composeReference("patient", element.getPatient());
53100      }
53101      if (element.hasBillablePeriod()) {
53102        composePeriod("billablePeriod", element.getBillablePeriod());
53103      }
53104      if (element.hasCreatedElement()) {
53105        composeDateTimeCore("created", element.getCreatedElement(), false);
53106        composeDateTimeExtras("created", element.getCreatedElement(), false);
53107      }
53108      if (element.hasEnterer()) {
53109        composeReference("enterer", element.getEnterer());
53110      }
53111      if (element.hasInsurer()) {
53112        composeReference("insurer", element.getInsurer());
53113      }
53114      if (element.hasProvider()) {
53115        composeReference("provider", element.getProvider());
53116      }
53117      if (element.hasPriority()) {
53118        composeCodeableConcept("priority", element.getPriority());
53119      }
53120      if (element.hasFundsReserveRequested()) {
53121        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
53122      }
53123      if (element.hasFundsReserve()) {
53124        composeCodeableConcept("fundsReserve", element.getFundsReserve());
53125      }
53126      if (element.hasRelated()) {
53127        openArray("related");
53128        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
53129          composeRelatedClaimComponent(null, e);
53130        closeArray();
53131      };
53132      if (element.hasPrescription()) {
53133        composeReference("prescription", element.getPrescription());
53134      }
53135      if (element.hasOriginalPrescription()) {
53136        composeReference("originalPrescription", element.getOriginalPrescription());
53137      }
53138      if (element.hasEvent()) {
53139        openArray("event");
53140        for (ExplanationOfBenefit.ExplanationOfBenefitEventComponent e : element.getEvent()) 
53141          composeExplanationOfBenefitEventComponent(null, e);
53142        closeArray();
53143      };
53144      if (element.hasPayee()) {
53145        composePayeeComponent("payee", element.getPayee());
53146      }
53147      if (element.hasReferral()) {
53148        composeReference("referral", element.getReferral());
53149      }
53150      if (element.hasEncounter()) {
53151        openArray("encounter");
53152        for (Reference e : element.getEncounter()) 
53153          composeReference(null, e);
53154        closeArray();
53155      };
53156      if (element.hasFacility()) {
53157        composeReference("facility", element.getFacility());
53158      }
53159      if (element.hasClaim()) {
53160        composeReference("claim", element.getClaim());
53161      }
53162      if (element.hasClaimResponse()) {
53163        composeReference("claimResponse", element.getClaimResponse());
53164      }
53165      if (element.hasOutcomeElement()) {
53166        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
53167        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
53168      }
53169      if (element.hasDecision()) {
53170        composeCodeableConcept("decision", element.getDecision());
53171      }
53172      if (element.hasDispositionElement()) {
53173        composeStringCore("disposition", element.getDispositionElement(), false);
53174        composeStringExtras("disposition", element.getDispositionElement(), false);
53175      }
53176      if (element.hasPreAuthRef()) {
53177        if (anyHasValue(element.getPreAuthRef())) {
53178          openArray("preAuthRef");
53179          for (StringType e : element.getPreAuthRef()) 
53180            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
53181          closeArray();
53182        }
53183        if (anyHasExtras(element.getPreAuthRef())) {
53184          openArray("_preAuthRef");
53185          for (StringType e : element.getPreAuthRef()) 
53186            composeStringExtras(null, e, true);
53187          closeArray();
53188        }
53189      };
53190      if (element.hasPreAuthRefPeriod()) {
53191        openArray("preAuthRefPeriod");
53192        for (Period e : element.getPreAuthRefPeriod()) 
53193          composePeriod(null, e);
53194        closeArray();
53195      };
53196      if (element.hasDiagnosisRelatedGroup()) {
53197        composeCodeableConcept("diagnosisRelatedGroup", element.getDiagnosisRelatedGroup());
53198      }
53199      if (element.hasCareTeam()) {
53200        openArray("careTeam");
53201        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
53202          composeCareTeamComponent(null, e);
53203        closeArray();
53204      };
53205      if (element.hasSupportingInfo()) {
53206        openArray("supportingInfo");
53207        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
53208          composeSupportingInformationComponent(null, e);
53209        closeArray();
53210      };
53211      if (element.hasDiagnosis()) {
53212        openArray("diagnosis");
53213        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
53214          composeDiagnosisComponent(null, e);
53215        closeArray();
53216      };
53217      if (element.hasProcedure()) {
53218        openArray("procedure");
53219        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
53220          composeProcedureComponent(null, e);
53221        closeArray();
53222      };
53223      if (element.hasPrecedenceElement()) {
53224        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
53225        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
53226      }
53227      if (element.hasInsurance()) {
53228        openArray("insurance");
53229        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
53230          composeInsuranceComponent(null, e);
53231        closeArray();
53232      };
53233      if (element.hasAccident()) {
53234        composeAccidentComponent("accident", element.getAccident());
53235      }
53236      if (element.hasPatientPaid()) {
53237        composeMoney("patientPaid", element.getPatientPaid());
53238      }
53239      if (element.hasItem()) {
53240        openArray("item");
53241        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
53242          composeItemComponent(null, e);
53243        closeArray();
53244      };
53245      if (element.hasAddItem()) {
53246        openArray("addItem");
53247        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
53248          composeAddedItemComponent(null, e);
53249        closeArray();
53250      };
53251      if (element.hasAdjudication()) {
53252        openArray("adjudication");
53253        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53254          composeAdjudicationComponent(null, e);
53255        closeArray();
53256      };
53257      if (element.hasTotal()) {
53258        openArray("total");
53259        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
53260          composeTotalComponent(null, e);
53261        closeArray();
53262      };
53263      if (element.hasPayment()) {
53264        composePaymentComponent("payment", element.getPayment());
53265      }
53266      if (element.hasFormCode()) {
53267        composeCodeableConcept("formCode", element.getFormCode());
53268      }
53269      if (element.hasForm()) {
53270        composeAttachment("form", element.getForm());
53271      }
53272      if (element.hasProcessNote()) {
53273        openArray("processNote");
53274        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
53275          composeNoteComponent(null, e);
53276        closeArray();
53277      };
53278      if (element.hasBenefitPeriod()) {
53279        composePeriod("benefitPeriod", element.getBenefitPeriod());
53280      }
53281      if (element.hasBenefitBalance()) {
53282        openArray("benefitBalance");
53283        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
53284          composeBenefitBalanceComponent(null, e);
53285        closeArray();
53286      };
53287  }
53288
53289  protected void composeRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
53290    if (element != null) {
53291      open(name);
53292      composeRelatedClaimComponentProperties(element);
53293      close();
53294    }
53295  }
53296
53297  protected void composeRelatedClaimComponentProperties(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
53298    composeBackboneElementProperties(element);
53299      if (element.hasClaim()) {
53300        composeReference("claim", element.getClaim());
53301      }
53302      if (element.hasRelationship()) {
53303        composeCodeableConcept("relationship", element.getRelationship());
53304      }
53305      if (element.hasReference()) {
53306        composeIdentifier("reference", element.getReference());
53307      }
53308  }
53309
53310  protected void composeExplanationOfBenefitEventComponent(String name, ExplanationOfBenefit.ExplanationOfBenefitEventComponent element) throws IOException {
53311    if (element != null) {
53312      open(name);
53313      composeExplanationOfBenefitEventComponentProperties(element);
53314      close();
53315    }
53316  }
53317
53318  protected void composeExplanationOfBenefitEventComponentProperties(ExplanationOfBenefit.ExplanationOfBenefitEventComponent element) throws IOException {
53319    composeBackboneElementProperties(element);
53320      if (element.hasType()) {
53321        composeCodeableConcept("type", element.getType());
53322      }
53323      if (element.hasWhen()) {
53324        composeType("when", element.getWhen());
53325      }
53326  }
53327
53328  protected void composePayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
53329    if (element != null) {
53330      open(name);
53331      composePayeeComponentProperties(element);
53332      close();
53333    }
53334  }
53335
53336  protected void composePayeeComponentProperties(ExplanationOfBenefit.PayeeComponent element) throws IOException {
53337    composeBackboneElementProperties(element);
53338      if (element.hasType()) {
53339        composeCodeableConcept("type", element.getType());
53340      }
53341      if (element.hasParty()) {
53342        composeReference("party", element.getParty());
53343      }
53344  }
53345
53346  protected void composeCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
53347    if (element != null) {
53348      open(name);
53349      composeCareTeamComponentProperties(element);
53350      close();
53351    }
53352  }
53353
53354  protected void composeCareTeamComponentProperties(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
53355    composeBackboneElementProperties(element);
53356      if (element.hasSequenceElement()) {
53357        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53358        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53359      }
53360      if (element.hasProvider()) {
53361        composeReference("provider", element.getProvider());
53362      }
53363      if (element.hasResponsibleElement()) {
53364        composeBooleanCore("responsible", element.getResponsibleElement(), false);
53365        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
53366      }
53367      if (element.hasRole()) {
53368        composeCodeableConcept("role", element.getRole());
53369      }
53370      if (element.hasSpecialty()) {
53371        composeCodeableConcept("specialty", element.getSpecialty());
53372      }
53373  }
53374
53375  protected void composeSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
53376    if (element != null) {
53377      open(name);
53378      composeSupportingInformationComponentProperties(element);
53379      close();
53380    }
53381  }
53382
53383  protected void composeSupportingInformationComponentProperties(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
53384    composeBackboneElementProperties(element);
53385      if (element.hasSequenceElement()) {
53386        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53387        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53388      }
53389      if (element.hasCategory()) {
53390        composeCodeableConcept("category", element.getCategory());
53391      }
53392      if (element.hasCode()) {
53393        composeCodeableConcept("code", element.getCode());
53394      }
53395      if (element.hasTiming()) {
53396        composeType("timing", element.getTiming());
53397      }
53398      if (element.hasValue()) {
53399        composeType("value", element.getValue());
53400      }
53401      if (element.hasReason()) {
53402        composeCoding("reason", element.getReason());
53403      }
53404  }
53405
53406  protected void composeDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
53407    if (element != null) {
53408      open(name);
53409      composeDiagnosisComponentProperties(element);
53410      close();
53411    }
53412  }
53413
53414  protected void composeDiagnosisComponentProperties(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
53415    composeBackboneElementProperties(element);
53416      if (element.hasSequenceElement()) {
53417        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53418        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53419      }
53420      if (element.hasDiagnosis()) {
53421        composeType("diagnosis", element.getDiagnosis());
53422      }
53423      if (element.hasType()) {
53424        openArray("type");
53425        for (CodeableConcept e : element.getType()) 
53426          composeCodeableConcept(null, e);
53427        closeArray();
53428      };
53429      if (element.hasOnAdmission()) {
53430        composeCodeableConcept("onAdmission", element.getOnAdmission());
53431      }
53432  }
53433
53434  protected void composeProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
53435    if (element != null) {
53436      open(name);
53437      composeProcedureComponentProperties(element);
53438      close();
53439    }
53440  }
53441
53442  protected void composeProcedureComponentProperties(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
53443    composeBackboneElementProperties(element);
53444      if (element.hasSequenceElement()) {
53445        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53446        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53447      }
53448      if (element.hasType()) {
53449        openArray("type");
53450        for (CodeableConcept e : element.getType()) 
53451          composeCodeableConcept(null, e);
53452        closeArray();
53453      };
53454      if (element.hasDateElement()) {
53455        composeDateTimeCore("date", element.getDateElement(), false);
53456        composeDateTimeExtras("date", element.getDateElement(), false);
53457      }
53458      if (element.hasProcedure()) {
53459        composeType("procedure", element.getProcedure());
53460      }
53461      if (element.hasUdi()) {
53462        openArray("udi");
53463        for (Reference e : element.getUdi()) 
53464          composeReference(null, e);
53465        closeArray();
53466      };
53467  }
53468
53469  protected void composeInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
53470    if (element != null) {
53471      open(name);
53472      composeInsuranceComponentProperties(element);
53473      close();
53474    }
53475  }
53476
53477  protected void composeInsuranceComponentProperties(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
53478    composeBackboneElementProperties(element);
53479      if (element.hasFocalElement()) {
53480        composeBooleanCore("focal", element.getFocalElement(), false);
53481        composeBooleanExtras("focal", element.getFocalElement(), false);
53482      }
53483      if (element.hasCoverage()) {
53484        composeReference("coverage", element.getCoverage());
53485      }
53486      if (element.hasPreAuthRef()) {
53487        if (anyHasValue(element.getPreAuthRef())) {
53488          openArray("preAuthRef");
53489          for (StringType e : element.getPreAuthRef()) 
53490            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
53491          closeArray();
53492        }
53493        if (anyHasExtras(element.getPreAuthRef())) {
53494          openArray("_preAuthRef");
53495          for (StringType e : element.getPreAuthRef()) 
53496            composeStringExtras(null, e, true);
53497          closeArray();
53498        }
53499      };
53500  }
53501
53502  protected void composeAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
53503    if (element != null) {
53504      open(name);
53505      composeAccidentComponentProperties(element);
53506      close();
53507    }
53508  }
53509
53510  protected void composeAccidentComponentProperties(ExplanationOfBenefit.AccidentComponent element) throws IOException {
53511    composeBackboneElementProperties(element);
53512      if (element.hasDateElement()) {
53513        composeDateCore("date", element.getDateElement(), false);
53514        composeDateExtras("date", element.getDateElement(), false);
53515      }
53516      if (element.hasType()) {
53517        composeCodeableConcept("type", element.getType());
53518      }
53519      if (element.hasLocation()) {
53520        composeType("location", element.getLocation());
53521      }
53522  }
53523
53524  protected void composeItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
53525    if (element != null) {
53526      open(name);
53527      composeItemComponentProperties(element);
53528      close();
53529    }
53530  }
53531
53532  protected void composeItemComponentProperties(ExplanationOfBenefit.ItemComponent element) throws IOException {
53533    composeBackboneElementProperties(element);
53534      if (element.hasSequenceElement()) {
53535        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53536        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53537      }
53538      if (element.hasCareTeamSequence()) {
53539        if (anyHasValue(element.getCareTeamSequence())) {
53540          openArray("careTeamSequence");
53541          for (PositiveIntType e : element.getCareTeamSequence()) 
53542            composePositiveIntCore(null, e, e != element.getCareTeamSequence().get(element.getCareTeamSequence().size()-1));
53543          closeArray();
53544        }
53545        if (anyHasExtras(element.getCareTeamSequence())) {
53546          openArray("_careTeamSequence");
53547          for (PositiveIntType e : element.getCareTeamSequence()) 
53548            composePositiveIntExtras(null, e, true);
53549          closeArray();
53550        }
53551      };
53552      if (element.hasDiagnosisSequence()) {
53553        if (anyHasValue(element.getDiagnosisSequence())) {
53554          openArray("diagnosisSequence");
53555          for (PositiveIntType e : element.getDiagnosisSequence()) 
53556            composePositiveIntCore(null, e, e != element.getDiagnosisSequence().get(element.getDiagnosisSequence().size()-1));
53557          closeArray();
53558        }
53559        if (anyHasExtras(element.getDiagnosisSequence())) {
53560          openArray("_diagnosisSequence");
53561          for (PositiveIntType e : element.getDiagnosisSequence()) 
53562            composePositiveIntExtras(null, e, true);
53563          closeArray();
53564        }
53565      };
53566      if (element.hasProcedureSequence()) {
53567        if (anyHasValue(element.getProcedureSequence())) {
53568          openArray("procedureSequence");
53569          for (PositiveIntType e : element.getProcedureSequence()) 
53570            composePositiveIntCore(null, e, e != element.getProcedureSequence().get(element.getProcedureSequence().size()-1));
53571          closeArray();
53572        }
53573        if (anyHasExtras(element.getProcedureSequence())) {
53574          openArray("_procedureSequence");
53575          for (PositiveIntType e : element.getProcedureSequence()) 
53576            composePositiveIntExtras(null, e, true);
53577          closeArray();
53578        }
53579      };
53580      if (element.hasInformationSequence()) {
53581        if (anyHasValue(element.getInformationSequence())) {
53582          openArray("informationSequence");
53583          for (PositiveIntType e : element.getInformationSequence()) 
53584            composePositiveIntCore(null, e, e != element.getInformationSequence().get(element.getInformationSequence().size()-1));
53585          closeArray();
53586        }
53587        if (anyHasExtras(element.getInformationSequence())) {
53588          openArray("_informationSequence");
53589          for (PositiveIntType e : element.getInformationSequence()) 
53590            composePositiveIntExtras(null, e, true);
53591          closeArray();
53592        }
53593      };
53594      if (element.hasTraceNumber()) {
53595        openArray("traceNumber");
53596        for (Identifier e : element.getTraceNumber()) 
53597          composeIdentifier(null, e);
53598        closeArray();
53599      };
53600      if (element.hasRevenue()) {
53601        composeCodeableConcept("revenue", element.getRevenue());
53602      }
53603      if (element.hasCategory()) {
53604        composeCodeableConcept("category", element.getCategory());
53605      }
53606      if (element.hasProductOrService()) {
53607        composeCodeableConcept("productOrService", element.getProductOrService());
53608      }
53609      if (element.hasProductOrServiceEnd()) {
53610        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
53611      }
53612      if (element.hasRequest()) {
53613        openArray("request");
53614        for (Reference e : element.getRequest()) 
53615          composeReference(null, e);
53616        closeArray();
53617      };
53618      if (element.hasModifier()) {
53619        openArray("modifier");
53620        for (CodeableConcept e : element.getModifier()) 
53621          composeCodeableConcept(null, e);
53622        closeArray();
53623      };
53624      if (element.hasProgramCode()) {
53625        openArray("programCode");
53626        for (CodeableConcept e : element.getProgramCode()) 
53627          composeCodeableConcept(null, e);
53628        closeArray();
53629      };
53630      if (element.hasServiced()) {
53631        composeType("serviced", element.getServiced());
53632      }
53633      if (element.hasLocation()) {
53634        composeType("location", element.getLocation());
53635      }
53636      if (element.hasPatientPaid()) {
53637        composeMoney("patientPaid", element.getPatientPaid());
53638      }
53639      if (element.hasQuantity()) {
53640        composeQuantity("quantity", element.getQuantity());
53641      }
53642      if (element.hasUnitPrice()) {
53643        composeMoney("unitPrice", element.getUnitPrice());
53644      }
53645      if (element.hasFactorElement()) {
53646        composeDecimalCore("factor", element.getFactorElement(), false);
53647        composeDecimalExtras("factor", element.getFactorElement(), false);
53648      }
53649      if (element.hasTax()) {
53650        composeMoney("tax", element.getTax());
53651      }
53652      if (element.hasNet()) {
53653        composeMoney("net", element.getNet());
53654      }
53655      if (element.hasUdi()) {
53656        openArray("udi");
53657        for (Reference e : element.getUdi()) 
53658          composeReference(null, e);
53659        closeArray();
53660      };
53661      if (element.hasBodySite()) {
53662        openArray("bodySite");
53663        for (ExplanationOfBenefit.ItemBodySiteComponent e : element.getBodySite()) 
53664          composeItemBodySiteComponent(null, e);
53665        closeArray();
53666      };
53667      if (element.hasEncounter()) {
53668        openArray("encounter");
53669        for (Reference e : element.getEncounter()) 
53670          composeReference(null, e);
53671        closeArray();
53672      };
53673      if (element.hasNoteNumber()) {
53674        if (anyHasValue(element.getNoteNumber())) {
53675          openArray("noteNumber");
53676          for (PositiveIntType e : element.getNoteNumber()) 
53677            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
53678          closeArray();
53679        }
53680        if (anyHasExtras(element.getNoteNumber())) {
53681          openArray("_noteNumber");
53682          for (PositiveIntType e : element.getNoteNumber()) 
53683            composePositiveIntExtras(null, e, true);
53684          closeArray();
53685        }
53686      };
53687      if (element.hasReviewOutcome()) {
53688        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
53689      }
53690      if (element.hasAdjudication()) {
53691        openArray("adjudication");
53692        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53693          composeAdjudicationComponent(null, e);
53694        closeArray();
53695      };
53696      if (element.hasDetail()) {
53697        openArray("detail");
53698        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
53699          composeDetailComponent(null, e);
53700        closeArray();
53701      };
53702  }
53703
53704  protected void composeItemBodySiteComponent(String name, ExplanationOfBenefit.ItemBodySiteComponent element) throws IOException {
53705    if (element != null) {
53706      open(name);
53707      composeItemBodySiteComponentProperties(element);
53708      close();
53709    }
53710  }
53711
53712  protected void composeItemBodySiteComponentProperties(ExplanationOfBenefit.ItemBodySiteComponent element) throws IOException {
53713    composeBackboneElementProperties(element);
53714      if (element.hasSite()) {
53715        openArray("site");
53716        for (CodeableReference e : element.getSite()) 
53717          composeCodeableReference(null, e);
53718        closeArray();
53719      };
53720      if (element.hasSubSite()) {
53721        openArray("subSite");
53722        for (CodeableConcept e : element.getSubSite()) 
53723          composeCodeableConcept(null, e);
53724        closeArray();
53725      };
53726  }
53727
53728  protected void composeItemReviewOutcomeComponent(String name, ExplanationOfBenefit.ItemReviewOutcomeComponent element) throws IOException {
53729    if (element != null) {
53730      open(name);
53731      composeItemReviewOutcomeComponentProperties(element);
53732      close();
53733    }
53734  }
53735
53736  protected void composeItemReviewOutcomeComponentProperties(ExplanationOfBenefit.ItemReviewOutcomeComponent element) throws IOException {
53737    composeBackboneElementProperties(element);
53738      if (element.hasDecision()) {
53739        composeCodeableConcept("decision", element.getDecision());
53740      }
53741      if (element.hasReason()) {
53742        openArray("reason");
53743        for (CodeableConcept e : element.getReason()) 
53744          composeCodeableConcept(null, e);
53745        closeArray();
53746      };
53747      if (element.hasPreAuthRefElement()) {
53748        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
53749        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
53750      }
53751      if (element.hasPreAuthPeriod()) {
53752        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
53753      }
53754  }
53755
53756  protected void composeAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
53757    if (element != null) {
53758      open(name);
53759      composeAdjudicationComponentProperties(element);
53760      close();
53761    }
53762  }
53763
53764  protected void composeAdjudicationComponentProperties(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
53765    composeBackboneElementProperties(element);
53766      if (element.hasCategory()) {
53767        composeCodeableConcept("category", element.getCategory());
53768      }
53769      if (element.hasReason()) {
53770        composeCodeableConcept("reason", element.getReason());
53771      }
53772      if (element.hasAmount()) {
53773        composeMoney("amount", element.getAmount());
53774      }
53775      if (element.hasQuantity()) {
53776        composeQuantity("quantity", element.getQuantity());
53777      }
53778  }
53779
53780  protected void composeDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
53781    if (element != null) {
53782      open(name);
53783      composeDetailComponentProperties(element);
53784      close();
53785    }
53786  }
53787
53788  protected void composeDetailComponentProperties(ExplanationOfBenefit.DetailComponent element) throws IOException {
53789    composeBackboneElementProperties(element);
53790      if (element.hasSequenceElement()) {
53791        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53792        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53793      }
53794      if (element.hasTraceNumber()) {
53795        openArray("traceNumber");
53796        for (Identifier e : element.getTraceNumber()) 
53797          composeIdentifier(null, e);
53798        closeArray();
53799      };
53800      if (element.hasRevenue()) {
53801        composeCodeableConcept("revenue", element.getRevenue());
53802      }
53803      if (element.hasCategory()) {
53804        composeCodeableConcept("category", element.getCategory());
53805      }
53806      if (element.hasProductOrService()) {
53807        composeCodeableConcept("productOrService", element.getProductOrService());
53808      }
53809      if (element.hasProductOrServiceEnd()) {
53810        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
53811      }
53812      if (element.hasModifier()) {
53813        openArray("modifier");
53814        for (CodeableConcept e : element.getModifier()) 
53815          composeCodeableConcept(null, e);
53816        closeArray();
53817      };
53818      if (element.hasProgramCode()) {
53819        openArray("programCode");
53820        for (CodeableConcept e : element.getProgramCode()) 
53821          composeCodeableConcept(null, e);
53822        closeArray();
53823      };
53824      if (element.hasPatientPaid()) {
53825        composeMoney("patientPaid", element.getPatientPaid());
53826      }
53827      if (element.hasQuantity()) {
53828        composeQuantity("quantity", element.getQuantity());
53829      }
53830      if (element.hasUnitPrice()) {
53831        composeMoney("unitPrice", element.getUnitPrice());
53832      }
53833      if (element.hasFactorElement()) {
53834        composeDecimalCore("factor", element.getFactorElement(), false);
53835        composeDecimalExtras("factor", element.getFactorElement(), false);
53836      }
53837      if (element.hasTax()) {
53838        composeMoney("tax", element.getTax());
53839      }
53840      if (element.hasNet()) {
53841        composeMoney("net", element.getNet());
53842      }
53843      if (element.hasUdi()) {
53844        openArray("udi");
53845        for (Reference e : element.getUdi()) 
53846          composeReference(null, e);
53847        closeArray();
53848      };
53849      if (element.hasNoteNumber()) {
53850        if (anyHasValue(element.getNoteNumber())) {
53851          openArray("noteNumber");
53852          for (PositiveIntType e : element.getNoteNumber()) 
53853            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
53854          closeArray();
53855        }
53856        if (anyHasExtras(element.getNoteNumber())) {
53857          openArray("_noteNumber");
53858          for (PositiveIntType e : element.getNoteNumber()) 
53859            composePositiveIntExtras(null, e, true);
53860          closeArray();
53861        }
53862      };
53863      if (element.hasReviewOutcome()) {
53864        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
53865      }
53866      if (element.hasAdjudication()) {
53867        openArray("adjudication");
53868        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53869          composeAdjudicationComponent(null, e);
53870        closeArray();
53871      };
53872      if (element.hasSubDetail()) {
53873        openArray("subDetail");
53874        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
53875          composeSubDetailComponent(null, e);
53876        closeArray();
53877      };
53878  }
53879
53880  protected void composeSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
53881    if (element != null) {
53882      open(name);
53883      composeSubDetailComponentProperties(element);
53884      close();
53885    }
53886  }
53887
53888  protected void composeSubDetailComponentProperties(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
53889    composeBackboneElementProperties(element);
53890      if (element.hasSequenceElement()) {
53891        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53892        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53893      }
53894      if (element.hasTraceNumber()) {
53895        openArray("traceNumber");
53896        for (Identifier e : element.getTraceNumber()) 
53897          composeIdentifier(null, e);
53898        closeArray();
53899      };
53900      if (element.hasRevenue()) {
53901        composeCodeableConcept("revenue", element.getRevenue());
53902      }
53903      if (element.hasCategory()) {
53904        composeCodeableConcept("category", element.getCategory());
53905      }
53906      if (element.hasProductOrService()) {
53907        composeCodeableConcept("productOrService", element.getProductOrService());
53908      }
53909      if (element.hasProductOrServiceEnd()) {
53910        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
53911      }
53912      if (element.hasModifier()) {
53913        openArray("modifier");
53914        for (CodeableConcept e : element.getModifier()) 
53915          composeCodeableConcept(null, e);
53916        closeArray();
53917      };
53918      if (element.hasProgramCode()) {
53919        openArray("programCode");
53920        for (CodeableConcept e : element.getProgramCode()) 
53921          composeCodeableConcept(null, e);
53922        closeArray();
53923      };
53924      if (element.hasPatientPaid()) {
53925        composeMoney("patientPaid", element.getPatientPaid());
53926      }
53927      if (element.hasQuantity()) {
53928        composeQuantity("quantity", element.getQuantity());
53929      }
53930      if (element.hasUnitPrice()) {
53931        composeMoney("unitPrice", element.getUnitPrice());
53932      }
53933      if (element.hasFactorElement()) {
53934        composeDecimalCore("factor", element.getFactorElement(), false);
53935        composeDecimalExtras("factor", element.getFactorElement(), false);
53936      }
53937      if (element.hasTax()) {
53938        composeMoney("tax", element.getTax());
53939      }
53940      if (element.hasNet()) {
53941        composeMoney("net", element.getNet());
53942      }
53943      if (element.hasUdi()) {
53944        openArray("udi");
53945        for (Reference e : element.getUdi()) 
53946          composeReference(null, e);
53947        closeArray();
53948      };
53949      if (element.hasNoteNumber()) {
53950        if (anyHasValue(element.getNoteNumber())) {
53951          openArray("noteNumber");
53952          for (PositiveIntType e : element.getNoteNumber()) 
53953            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
53954          closeArray();
53955        }
53956        if (anyHasExtras(element.getNoteNumber())) {
53957          openArray("_noteNumber");
53958          for (PositiveIntType e : element.getNoteNumber()) 
53959            composePositiveIntExtras(null, e, true);
53960          closeArray();
53961        }
53962      };
53963      if (element.hasReviewOutcome()) {
53964        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
53965      }
53966      if (element.hasAdjudication()) {
53967        openArray("adjudication");
53968        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53969          composeAdjudicationComponent(null, e);
53970        closeArray();
53971      };
53972  }
53973
53974  protected void composeAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
53975    if (element != null) {
53976      open(name);
53977      composeAddedItemComponentProperties(element);
53978      close();
53979    }
53980  }
53981
53982  protected void composeAddedItemComponentProperties(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
53983    composeBackboneElementProperties(element);
53984      if (element.hasItemSequence()) {
53985        if (anyHasValue(element.getItemSequence())) {
53986          openArray("itemSequence");
53987          for (PositiveIntType e : element.getItemSequence()) 
53988            composePositiveIntCore(null, e, e != element.getItemSequence().get(element.getItemSequence().size()-1));
53989          closeArray();
53990        }
53991        if (anyHasExtras(element.getItemSequence())) {
53992          openArray("_itemSequence");
53993          for (PositiveIntType e : element.getItemSequence()) 
53994            composePositiveIntExtras(null, e, true);
53995          closeArray();
53996        }
53997      };
53998      if (element.hasDetailSequence()) {
53999        if (anyHasValue(element.getDetailSequence())) {
54000          openArray("detailSequence");
54001          for (PositiveIntType e : element.getDetailSequence()) 
54002            composePositiveIntCore(null, e, e != element.getDetailSequence().get(element.getDetailSequence().size()-1));
54003          closeArray();
54004        }
54005        if (anyHasExtras(element.getDetailSequence())) {
54006          openArray("_detailSequence");
54007          for (PositiveIntType e : element.getDetailSequence()) 
54008            composePositiveIntExtras(null, e, true);
54009          closeArray();
54010        }
54011      };
54012      if (element.hasSubDetailSequence()) {
54013        if (anyHasValue(element.getSubDetailSequence())) {
54014          openArray("subDetailSequence");
54015          for (PositiveIntType e : element.getSubDetailSequence()) 
54016            composePositiveIntCore(null, e, e != element.getSubDetailSequence().get(element.getSubDetailSequence().size()-1));
54017          closeArray();
54018        }
54019        if (anyHasExtras(element.getSubDetailSequence())) {
54020          openArray("_subDetailSequence");
54021          for (PositiveIntType e : element.getSubDetailSequence()) 
54022            composePositiveIntExtras(null, e, true);
54023          closeArray();
54024        }
54025      };
54026      if (element.hasTraceNumber()) {
54027        openArray("traceNumber");
54028        for (Identifier e : element.getTraceNumber()) 
54029          composeIdentifier(null, e);
54030        closeArray();
54031      };
54032      if (element.hasProvider()) {
54033        openArray("provider");
54034        for (Reference e : element.getProvider()) 
54035          composeReference(null, e);
54036        closeArray();
54037      };
54038      if (element.hasRevenue()) {
54039        composeCodeableConcept("revenue", element.getRevenue());
54040      }
54041      if (element.hasProductOrService()) {
54042        composeCodeableConcept("productOrService", element.getProductOrService());
54043      }
54044      if (element.hasProductOrServiceEnd()) {
54045        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
54046      }
54047      if (element.hasRequest()) {
54048        openArray("request");
54049        for (Reference e : element.getRequest()) 
54050          composeReference(null, e);
54051        closeArray();
54052      };
54053      if (element.hasModifier()) {
54054        openArray("modifier");
54055        for (CodeableConcept e : element.getModifier()) 
54056          composeCodeableConcept(null, e);
54057        closeArray();
54058      };
54059      if (element.hasProgramCode()) {
54060        openArray("programCode");
54061        for (CodeableConcept e : element.getProgramCode()) 
54062          composeCodeableConcept(null, e);
54063        closeArray();
54064      };
54065      if (element.hasServiced()) {
54066        composeType("serviced", element.getServiced());
54067      }
54068      if (element.hasLocation()) {
54069        composeType("location", element.getLocation());
54070      }
54071      if (element.hasPatientPaid()) {
54072        composeMoney("patientPaid", element.getPatientPaid());
54073      }
54074      if (element.hasQuantity()) {
54075        composeQuantity("quantity", element.getQuantity());
54076      }
54077      if (element.hasUnitPrice()) {
54078        composeMoney("unitPrice", element.getUnitPrice());
54079      }
54080      if (element.hasFactorElement()) {
54081        composeDecimalCore("factor", element.getFactorElement(), false);
54082        composeDecimalExtras("factor", element.getFactorElement(), false);
54083      }
54084      if (element.hasTax()) {
54085        composeMoney("tax", element.getTax());
54086      }
54087      if (element.hasNet()) {
54088        composeMoney("net", element.getNet());
54089      }
54090      if (element.hasBodySite()) {
54091        openArray("bodySite");
54092        for (ExplanationOfBenefit.AddedItemBodySiteComponent e : element.getBodySite()) 
54093          composeAddedItemBodySiteComponent(null, e);
54094        closeArray();
54095      };
54096      if (element.hasNoteNumber()) {
54097        if (anyHasValue(element.getNoteNumber())) {
54098          openArray("noteNumber");
54099          for (PositiveIntType e : element.getNoteNumber()) 
54100            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
54101          closeArray();
54102        }
54103        if (anyHasExtras(element.getNoteNumber())) {
54104          openArray("_noteNumber");
54105          for (PositiveIntType e : element.getNoteNumber()) 
54106            composePositiveIntExtras(null, e, true);
54107          closeArray();
54108        }
54109      };
54110      if (element.hasReviewOutcome()) {
54111        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
54112      }
54113      if (element.hasAdjudication()) {
54114        openArray("adjudication");
54115        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
54116          composeAdjudicationComponent(null, e);
54117        closeArray();
54118      };
54119      if (element.hasDetail()) {
54120        openArray("detail");
54121        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
54122          composeAddedItemDetailComponent(null, e);
54123        closeArray();
54124      };
54125  }
54126
54127  protected void composeAddedItemBodySiteComponent(String name, ExplanationOfBenefit.AddedItemBodySiteComponent element) throws IOException {
54128    if (element != null) {
54129      open(name);
54130      composeAddedItemBodySiteComponentProperties(element);
54131      close();
54132    }
54133  }
54134
54135  protected void composeAddedItemBodySiteComponentProperties(ExplanationOfBenefit.AddedItemBodySiteComponent element) throws IOException {
54136    composeBackboneElementProperties(element);
54137      if (element.hasSite()) {
54138        openArray("site");
54139        for (CodeableReference e : element.getSite()) 
54140          composeCodeableReference(null, e);
54141        closeArray();
54142      };
54143      if (element.hasSubSite()) {
54144        openArray("subSite");
54145        for (CodeableConcept e : element.getSubSite()) 
54146          composeCodeableConcept(null, e);
54147        closeArray();
54148      };
54149  }
54150
54151  protected void composeAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
54152    if (element != null) {
54153      open(name);
54154      composeAddedItemDetailComponentProperties(element);
54155      close();
54156    }
54157  }
54158
54159  protected void composeAddedItemDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
54160    composeBackboneElementProperties(element);
54161      if (element.hasTraceNumber()) {
54162        openArray("traceNumber");
54163        for (Identifier e : element.getTraceNumber()) 
54164          composeIdentifier(null, e);
54165        closeArray();
54166      };
54167      if (element.hasRevenue()) {
54168        composeCodeableConcept("revenue", element.getRevenue());
54169      }
54170      if (element.hasProductOrService()) {
54171        composeCodeableConcept("productOrService", element.getProductOrService());
54172      }
54173      if (element.hasProductOrServiceEnd()) {
54174        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
54175      }
54176      if (element.hasModifier()) {
54177        openArray("modifier");
54178        for (CodeableConcept e : element.getModifier()) 
54179          composeCodeableConcept(null, e);
54180        closeArray();
54181      };
54182      if (element.hasPatientPaid()) {
54183        composeMoney("patientPaid", element.getPatientPaid());
54184      }
54185      if (element.hasQuantity()) {
54186        composeQuantity("quantity", element.getQuantity());
54187      }
54188      if (element.hasUnitPrice()) {
54189        composeMoney("unitPrice", element.getUnitPrice());
54190      }
54191      if (element.hasFactorElement()) {
54192        composeDecimalCore("factor", element.getFactorElement(), false);
54193        composeDecimalExtras("factor", element.getFactorElement(), false);
54194      }
54195      if (element.hasTax()) {
54196        composeMoney("tax", element.getTax());
54197      }
54198      if (element.hasNet()) {
54199        composeMoney("net", element.getNet());
54200      }
54201      if (element.hasNoteNumber()) {
54202        if (anyHasValue(element.getNoteNumber())) {
54203          openArray("noteNumber");
54204          for (PositiveIntType e : element.getNoteNumber()) 
54205            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
54206          closeArray();
54207        }
54208        if (anyHasExtras(element.getNoteNumber())) {
54209          openArray("_noteNumber");
54210          for (PositiveIntType e : element.getNoteNumber()) 
54211            composePositiveIntExtras(null, e, true);
54212          closeArray();
54213        }
54214      };
54215      if (element.hasReviewOutcome()) {
54216        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
54217      }
54218      if (element.hasAdjudication()) {
54219        openArray("adjudication");
54220        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
54221          composeAdjudicationComponent(null, e);
54222        closeArray();
54223      };
54224      if (element.hasSubDetail()) {
54225        openArray("subDetail");
54226        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
54227          composeAddedItemDetailSubDetailComponent(null, e);
54228        closeArray();
54229      };
54230  }
54231
54232  protected void composeAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
54233    if (element != null) {
54234      open(name);
54235      composeAddedItemDetailSubDetailComponentProperties(element);
54236      close();
54237    }
54238  }
54239
54240  protected void composeAddedItemDetailSubDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
54241    composeBackboneElementProperties(element);
54242      if (element.hasTraceNumber()) {
54243        openArray("traceNumber");
54244        for (Identifier e : element.getTraceNumber()) 
54245          composeIdentifier(null, e);
54246        closeArray();
54247      };
54248      if (element.hasRevenue()) {
54249        composeCodeableConcept("revenue", element.getRevenue());
54250      }
54251      if (element.hasProductOrService()) {
54252        composeCodeableConcept("productOrService", element.getProductOrService());
54253      }
54254      if (element.hasProductOrServiceEnd()) {
54255        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
54256      }
54257      if (element.hasModifier()) {
54258        openArray("modifier");
54259        for (CodeableConcept e : element.getModifier()) 
54260          composeCodeableConcept(null, e);
54261        closeArray();
54262      };
54263      if (element.hasPatientPaid()) {
54264        composeMoney("patientPaid", element.getPatientPaid());
54265      }
54266      if (element.hasQuantity()) {
54267        composeQuantity("quantity", element.getQuantity());
54268      }
54269      if (element.hasUnitPrice()) {
54270        composeMoney("unitPrice", element.getUnitPrice());
54271      }
54272      if (element.hasFactorElement()) {
54273        composeDecimalCore("factor", element.getFactorElement(), false);
54274        composeDecimalExtras("factor", element.getFactorElement(), false);
54275      }
54276      if (element.hasTax()) {
54277        composeMoney("tax", element.getTax());
54278      }
54279      if (element.hasNet()) {
54280        composeMoney("net", element.getNet());
54281      }
54282      if (element.hasNoteNumber()) {
54283        if (anyHasValue(element.getNoteNumber())) {
54284          openArray("noteNumber");
54285          for (PositiveIntType e : element.getNoteNumber()) 
54286            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
54287          closeArray();
54288        }
54289        if (anyHasExtras(element.getNoteNumber())) {
54290          openArray("_noteNumber");
54291          for (PositiveIntType e : element.getNoteNumber()) 
54292            composePositiveIntExtras(null, e, true);
54293          closeArray();
54294        }
54295      };
54296      if (element.hasReviewOutcome()) {
54297        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
54298      }
54299      if (element.hasAdjudication()) {
54300        openArray("adjudication");
54301        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
54302          composeAdjudicationComponent(null, e);
54303        closeArray();
54304      };
54305  }
54306
54307  protected void composeTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
54308    if (element != null) {
54309      open(name);
54310      composeTotalComponentProperties(element);
54311      close();
54312    }
54313  }
54314
54315  protected void composeTotalComponentProperties(ExplanationOfBenefit.TotalComponent element) throws IOException {
54316    composeBackboneElementProperties(element);
54317      if (element.hasCategory()) {
54318        composeCodeableConcept("category", element.getCategory());
54319      }
54320      if (element.hasAmount()) {
54321        composeMoney("amount", element.getAmount());
54322      }
54323  }
54324
54325  protected void composePaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
54326    if (element != null) {
54327      open(name);
54328      composePaymentComponentProperties(element);
54329      close();
54330    }
54331  }
54332
54333  protected void composePaymentComponentProperties(ExplanationOfBenefit.PaymentComponent element) throws IOException {
54334    composeBackboneElementProperties(element);
54335      if (element.hasType()) {
54336        composeCodeableConcept("type", element.getType());
54337      }
54338      if (element.hasAdjustment()) {
54339        composeMoney("adjustment", element.getAdjustment());
54340      }
54341      if (element.hasAdjustmentReason()) {
54342        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
54343      }
54344      if (element.hasDateElement()) {
54345        composeDateCore("date", element.getDateElement(), false);
54346        composeDateExtras("date", element.getDateElement(), false);
54347      }
54348      if (element.hasAmount()) {
54349        composeMoney("amount", element.getAmount());
54350      }
54351      if (element.hasIdentifier()) {
54352        composeIdentifier("identifier", element.getIdentifier());
54353      }
54354  }
54355
54356  protected void composeNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
54357    if (element != null) {
54358      open(name);
54359      composeNoteComponentProperties(element);
54360      close();
54361    }
54362  }
54363
54364  protected void composeNoteComponentProperties(ExplanationOfBenefit.NoteComponent element) throws IOException {
54365    composeBackboneElementProperties(element);
54366      if (element.hasNumberElement()) {
54367        composePositiveIntCore("number", element.getNumberElement(), false);
54368        composePositiveIntExtras("number", element.getNumberElement(), false);
54369      }
54370      if (element.hasType()) {
54371        composeCodeableConcept("type", element.getType());
54372      }
54373      if (element.hasTextElement()) {
54374        composeStringCore("text", element.getTextElement(), false);
54375        composeStringExtras("text", element.getTextElement(), false);
54376      }
54377      if (element.hasLanguage()) {
54378        composeCodeableConcept("language", element.getLanguage());
54379      }
54380  }
54381
54382  protected void composeBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
54383    if (element != null) {
54384      open(name);
54385      composeBenefitBalanceComponentProperties(element);
54386      close();
54387    }
54388  }
54389
54390  protected void composeBenefitBalanceComponentProperties(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
54391    composeBackboneElementProperties(element);
54392      if (element.hasCategory()) {
54393        composeCodeableConcept("category", element.getCategory());
54394      }
54395      if (element.hasExcludedElement()) {
54396        composeBooleanCore("excluded", element.getExcludedElement(), false);
54397        composeBooleanExtras("excluded", element.getExcludedElement(), false);
54398      }
54399      if (element.hasNameElement()) {
54400        composeStringCore("name", element.getNameElement(), false);
54401        composeStringExtras("name", element.getNameElement(), false);
54402      }
54403      if (element.hasDescriptionElement()) {
54404        composeStringCore("description", element.getDescriptionElement(), false);
54405        composeStringExtras("description", element.getDescriptionElement(), false);
54406      }
54407      if (element.hasNetwork()) {
54408        composeCodeableConcept("network", element.getNetwork());
54409      }
54410      if (element.hasUnit()) {
54411        composeCodeableConcept("unit", element.getUnit());
54412      }
54413      if (element.hasTerm()) {
54414        composeCodeableConcept("term", element.getTerm());
54415      }
54416      if (element.hasFinancial()) {
54417        openArray("financial");
54418        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
54419          composeBenefitComponent(null, e);
54420        closeArray();
54421      };
54422  }
54423
54424  protected void composeBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
54425    if (element != null) {
54426      open(name);
54427      composeBenefitComponentProperties(element);
54428      close();
54429    }
54430  }
54431
54432  protected void composeBenefitComponentProperties(ExplanationOfBenefit.BenefitComponent element) throws IOException {
54433    composeBackboneElementProperties(element);
54434      if (element.hasType()) {
54435        composeCodeableConcept("type", element.getType());
54436      }
54437      if (element.hasAllowed()) {
54438        composeType("allowed", element.getAllowed());
54439      }
54440      if (element.hasUsed()) {
54441        composeType("used", element.getUsed());
54442      }
54443  }
54444
54445  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
54446    if (element != null) {
54447      prop("resourceType", name);
54448      composeFamilyMemberHistoryProperties(element);
54449    }
54450  }
54451
54452  protected void composeFamilyMemberHistoryProperties(FamilyMemberHistory element) throws IOException {
54453    composeDomainResourceProperties(element);
54454      if (element.hasIdentifier()) {
54455        openArray("identifier");
54456        for (Identifier e : element.getIdentifier()) 
54457          composeIdentifier(null, e);
54458        closeArray();
54459      };
54460      if (element.hasInstantiatesCanonical()) {
54461        if (anyHasValue(element.getInstantiatesCanonical())) {
54462          openArray("instantiatesCanonical");
54463          for (CanonicalType e : element.getInstantiatesCanonical()) 
54464            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
54465          closeArray();
54466        }
54467        if (anyHasExtras(element.getInstantiatesCanonical())) {
54468          openArray("_instantiatesCanonical");
54469          for (CanonicalType e : element.getInstantiatesCanonical()) 
54470            composeCanonicalExtras(null, e, true);
54471          closeArray();
54472        }
54473      };
54474      if (element.hasInstantiatesUri()) {
54475        if (anyHasValue(element.getInstantiatesUri())) {
54476          openArray("instantiatesUri");
54477          for (UriType e : element.getInstantiatesUri()) 
54478            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
54479          closeArray();
54480        }
54481        if (anyHasExtras(element.getInstantiatesUri())) {
54482          openArray("_instantiatesUri");
54483          for (UriType e : element.getInstantiatesUri()) 
54484            composeUriExtras(null, e, true);
54485          closeArray();
54486        }
54487      };
54488      if (element.hasStatusElement()) {
54489        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
54490        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
54491      }
54492      if (element.hasDataAbsentReason()) {
54493        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
54494      }
54495      if (element.hasPatient()) {
54496        composeReference("patient", element.getPatient());
54497      }
54498      if (element.hasDateElement()) {
54499        composeDateTimeCore("date", element.getDateElement(), false);
54500        composeDateTimeExtras("date", element.getDateElement(), false);
54501      }
54502      if (element.hasParticipant()) {
54503        openArray("participant");
54504        for (FamilyMemberHistory.FamilyMemberHistoryParticipantComponent e : element.getParticipant()) 
54505          composeFamilyMemberHistoryParticipantComponent(null, e);
54506        closeArray();
54507      };
54508      if (element.hasNameElement()) {
54509        composeStringCore("name", element.getNameElement(), false);
54510        composeStringExtras("name", element.getNameElement(), false);
54511      }
54512      if (element.hasRelationship()) {
54513        composeCodeableConcept("relationship", element.getRelationship());
54514      }
54515      if (element.hasSex()) {
54516        composeCodeableConcept("sex", element.getSex());
54517      }
54518      if (element.hasBorn()) {
54519        composeType("born", element.getBorn());
54520      }
54521      if (element.hasAge()) {
54522        composeType("age", element.getAge());
54523      }
54524      if (element.hasEstimatedAgeElement()) {
54525        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
54526        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
54527      }
54528      if (element.hasDeceased()) {
54529        composeType("deceased", element.getDeceased());
54530      }
54531      if (element.hasReason()) {
54532        openArray("reason");
54533        for (CodeableReference e : element.getReason()) 
54534          composeCodeableReference(null, e);
54535        closeArray();
54536      };
54537      if (element.hasNote()) {
54538        openArray("note");
54539        for (Annotation e : element.getNote()) 
54540          composeAnnotation(null, e);
54541        closeArray();
54542      };
54543      if (element.hasCondition()) {
54544        openArray("condition");
54545        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
54546          composeFamilyMemberHistoryConditionComponent(null, e);
54547        closeArray();
54548      };
54549      if (element.hasProcedure()) {
54550        openArray("procedure");
54551        for (FamilyMemberHistory.FamilyMemberHistoryProcedureComponent e : element.getProcedure()) 
54552          composeFamilyMemberHistoryProcedureComponent(null, e);
54553        closeArray();
54554      };
54555  }
54556
54557  protected void composeFamilyMemberHistoryParticipantComponent(String name, FamilyMemberHistory.FamilyMemberHistoryParticipantComponent element) throws IOException {
54558    if (element != null) {
54559      open(name);
54560      composeFamilyMemberHistoryParticipantComponentProperties(element);
54561      close();
54562    }
54563  }
54564
54565  protected void composeFamilyMemberHistoryParticipantComponentProperties(FamilyMemberHistory.FamilyMemberHistoryParticipantComponent element) throws IOException {
54566    composeBackboneElementProperties(element);
54567      if (element.hasFunction()) {
54568        composeCodeableConcept("function", element.getFunction());
54569      }
54570      if (element.hasActor()) {
54571        composeReference("actor", element.getActor());
54572      }
54573  }
54574
54575  protected void composeFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
54576    if (element != null) {
54577      open(name);
54578      composeFamilyMemberHistoryConditionComponentProperties(element);
54579      close();
54580    }
54581  }
54582
54583  protected void composeFamilyMemberHistoryConditionComponentProperties(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
54584    composeBackboneElementProperties(element);
54585      if (element.hasCode()) {
54586        composeCodeableConcept("code", element.getCode());
54587      }
54588      if (element.hasOutcome()) {
54589        composeCodeableConcept("outcome", element.getOutcome());
54590      }
54591      if (element.hasContributedToDeathElement()) {
54592        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
54593        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
54594      }
54595      if (element.hasOnset()) {
54596        composeType("onset", element.getOnset());
54597      }
54598      if (element.hasNote()) {
54599        openArray("note");
54600        for (Annotation e : element.getNote()) 
54601          composeAnnotation(null, e);
54602        closeArray();
54603      };
54604  }
54605
54606  protected void composeFamilyMemberHistoryProcedureComponent(String name, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
54607    if (element != null) {
54608      open(name);
54609      composeFamilyMemberHistoryProcedureComponentProperties(element);
54610      close();
54611    }
54612  }
54613
54614  protected void composeFamilyMemberHistoryProcedureComponentProperties(FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
54615    composeBackboneElementProperties(element);
54616      if (element.hasCode()) {
54617        composeCodeableConcept("code", element.getCode());
54618      }
54619      if (element.hasOutcome()) {
54620        composeCodeableConcept("outcome", element.getOutcome());
54621      }
54622      if (element.hasContributedToDeathElement()) {
54623        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
54624        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
54625      }
54626      if (element.hasPerformed()) {
54627        composeType("performed", element.getPerformed());
54628      }
54629      if (element.hasNote()) {
54630        openArray("note");
54631        for (Annotation e : element.getNote()) 
54632          composeAnnotation(null, e);
54633        closeArray();
54634      };
54635  }
54636
54637  protected void composeFlag(String name, Flag element) throws IOException {
54638    if (element != null) {
54639      prop("resourceType", name);
54640      composeFlagProperties(element);
54641    }
54642  }
54643
54644  protected void composeFlagProperties(Flag element) throws IOException {
54645    composeDomainResourceProperties(element);
54646      if (element.hasIdentifier()) {
54647        openArray("identifier");
54648        for (Identifier e : element.getIdentifier()) 
54649          composeIdentifier(null, e);
54650        closeArray();
54651      };
54652      if (element.hasStatusElement()) {
54653        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
54654        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
54655      }
54656      if (element.hasCategory()) {
54657        openArray("category");
54658        for (CodeableConcept e : element.getCategory()) 
54659          composeCodeableConcept(null, e);
54660        closeArray();
54661      };
54662      if (element.hasCode()) {
54663        composeCodeableConcept("code", element.getCode());
54664      }
54665      if (element.hasSubject()) {
54666        composeReference("subject", element.getSubject());
54667      }
54668      if (element.hasPeriod()) {
54669        composePeriod("period", element.getPeriod());
54670      }
54671      if (element.hasEncounter()) {
54672        composeReference("encounter", element.getEncounter());
54673      }
54674      if (element.hasAuthor()) {
54675        composeReference("author", element.getAuthor());
54676      }
54677  }
54678
54679  protected void composeFormularyItem(String name, FormularyItem element) throws IOException {
54680    if (element != null) {
54681      prop("resourceType", name);
54682      composeFormularyItemProperties(element);
54683    }
54684  }
54685
54686  protected void composeFormularyItemProperties(FormularyItem element) throws IOException {
54687    composeDomainResourceProperties(element);
54688      if (element.hasIdentifier()) {
54689        openArray("identifier");
54690        for (Identifier e : element.getIdentifier()) 
54691          composeIdentifier(null, e);
54692        closeArray();
54693      };
54694      if (element.hasCode()) {
54695        composeCodeableConcept("code", element.getCode());
54696      }
54697      if (element.hasStatusElement()) {
54698        composeEnumerationCore("status", element.getStatusElement(), new FormularyItem.FormularyItemStatusCodesEnumFactory(), false);
54699        composeEnumerationExtras("status", element.getStatusElement(), new FormularyItem.FormularyItemStatusCodesEnumFactory(), false);
54700      }
54701  }
54702
54703  protected void composeGenomicStudy(String name, GenomicStudy element) throws IOException {
54704    if (element != null) {
54705      prop("resourceType", name);
54706      composeGenomicStudyProperties(element);
54707    }
54708  }
54709
54710  protected void composeGenomicStudyProperties(GenomicStudy element) throws IOException {
54711    composeDomainResourceProperties(element);
54712      if (element.hasIdentifier()) {
54713        openArray("identifier");
54714        for (Identifier e : element.getIdentifier()) 
54715          composeIdentifier(null, e);
54716        closeArray();
54717      };
54718      if (element.hasStatusElement()) {
54719        composeEnumerationCore("status", element.getStatusElement(), new GenomicStudy.GenomicStudyStatusEnumFactory(), false);
54720        composeEnumerationExtras("status", element.getStatusElement(), new GenomicStudy.GenomicStudyStatusEnumFactory(), false);
54721      }
54722      if (element.hasType()) {
54723        openArray("type");
54724        for (CodeableConcept e : element.getType()) 
54725          composeCodeableConcept(null, e);
54726        closeArray();
54727      };
54728      if (element.hasSubject()) {
54729        composeReference("subject", element.getSubject());
54730      }
54731      if (element.hasEncounter()) {
54732        composeReference("encounter", element.getEncounter());
54733      }
54734      if (element.hasStartDateElement()) {
54735        composeDateTimeCore("startDate", element.getStartDateElement(), false);
54736        composeDateTimeExtras("startDate", element.getStartDateElement(), false);
54737      }
54738      if (element.hasBasedOn()) {
54739        openArray("basedOn");
54740        for (Reference e : element.getBasedOn()) 
54741          composeReference(null, e);
54742        closeArray();
54743      };
54744      if (element.hasReferrer()) {
54745        composeReference("referrer", element.getReferrer());
54746      }
54747      if (element.hasInterpreter()) {
54748        openArray("interpreter");
54749        for (Reference e : element.getInterpreter()) 
54750          composeReference(null, e);
54751        closeArray();
54752      };
54753      if (element.hasReason()) {
54754        openArray("reason");
54755        for (CodeableReference e : element.getReason()) 
54756          composeCodeableReference(null, e);
54757        closeArray();
54758      };
54759      if (element.hasInstantiatesCanonicalElement()) {
54760        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54761        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54762      }
54763      if (element.hasInstantiatesUriElement()) {
54764        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
54765        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
54766      }
54767      if (element.hasNote()) {
54768        openArray("note");
54769        for (Annotation e : element.getNote()) 
54770          composeAnnotation(null, e);
54771        closeArray();
54772      };
54773      if (element.hasDescriptionElement()) {
54774        composeMarkdownCore("description", element.getDescriptionElement(), false);
54775        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54776      }
54777      if (element.hasAnalysis()) {
54778        openArray("analysis");
54779        for (GenomicStudy.GenomicStudyAnalysisComponent e : element.getAnalysis()) 
54780          composeGenomicStudyAnalysisComponent(null, e);
54781        closeArray();
54782      };
54783  }
54784
54785  protected void composeGenomicStudyAnalysisComponent(String name, GenomicStudy.GenomicStudyAnalysisComponent element) throws IOException {
54786    if (element != null) {
54787      open(name);
54788      composeGenomicStudyAnalysisComponentProperties(element);
54789      close();
54790    }
54791  }
54792
54793  protected void composeGenomicStudyAnalysisComponentProperties(GenomicStudy.GenomicStudyAnalysisComponent element) throws IOException {
54794    composeBackboneElementProperties(element);
54795      if (element.hasIdentifier()) {
54796        openArray("identifier");
54797        for (Identifier e : element.getIdentifier()) 
54798          composeIdentifier(null, e);
54799        closeArray();
54800      };
54801      if (element.hasMethodType()) {
54802        openArray("methodType");
54803        for (CodeableConcept e : element.getMethodType()) 
54804          composeCodeableConcept(null, e);
54805        closeArray();
54806      };
54807      if (element.hasChangeType()) {
54808        openArray("changeType");
54809        for (CodeableConcept e : element.getChangeType()) 
54810          composeCodeableConcept(null, e);
54811        closeArray();
54812      };
54813      if (element.hasGenomeBuild()) {
54814        composeCodeableConcept("genomeBuild", element.getGenomeBuild());
54815      }
54816      if (element.hasInstantiatesCanonicalElement()) {
54817        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54818        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54819      }
54820      if (element.hasInstantiatesUriElement()) {
54821        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
54822        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
54823      }
54824      if (element.hasTitleElement()) {
54825        composeStringCore("title", element.getTitleElement(), false);
54826        composeStringExtras("title", element.getTitleElement(), false);
54827      }
54828      if (element.hasFocus()) {
54829        openArray("focus");
54830        for (Reference e : element.getFocus()) 
54831          composeReference(null, e);
54832        closeArray();
54833      };
54834      if (element.hasSpecimen()) {
54835        openArray("specimen");
54836        for (Reference e : element.getSpecimen()) 
54837          composeReference(null, e);
54838        closeArray();
54839      };
54840      if (element.hasDateElement()) {
54841        composeDateTimeCore("date", element.getDateElement(), false);
54842        composeDateTimeExtras("date", element.getDateElement(), false);
54843      }
54844      if (element.hasNote()) {
54845        openArray("note");
54846        for (Annotation e : element.getNote()) 
54847          composeAnnotation(null, e);
54848        closeArray();
54849      };
54850      if (element.hasProtocolPerformed()) {
54851        composeReference("protocolPerformed", element.getProtocolPerformed());
54852      }
54853      if (element.hasRegionsStudied()) {
54854        openArray("regionsStudied");
54855        for (Reference e : element.getRegionsStudied()) 
54856          composeReference(null, e);
54857        closeArray();
54858      };
54859      if (element.hasRegionsCalled()) {
54860        openArray("regionsCalled");
54861        for (Reference e : element.getRegionsCalled()) 
54862          composeReference(null, e);
54863        closeArray();
54864      };
54865      if (element.hasInput()) {
54866        openArray("input");
54867        for (GenomicStudy.GenomicStudyAnalysisInputComponent e : element.getInput()) 
54868          composeGenomicStudyAnalysisInputComponent(null, e);
54869        closeArray();
54870      };
54871      if (element.hasOutput()) {
54872        openArray("output");
54873        for (GenomicStudy.GenomicStudyAnalysisOutputComponent e : element.getOutput()) 
54874          composeGenomicStudyAnalysisOutputComponent(null, e);
54875        closeArray();
54876      };
54877      if (element.hasPerformer()) {
54878        openArray("performer");
54879        for (GenomicStudy.GenomicStudyAnalysisPerformerComponent e : element.getPerformer()) 
54880          composeGenomicStudyAnalysisPerformerComponent(null, e);
54881        closeArray();
54882      };
54883      if (element.hasDevice()) {
54884        openArray("device");
54885        for (GenomicStudy.GenomicStudyAnalysisDeviceComponent e : element.getDevice()) 
54886          composeGenomicStudyAnalysisDeviceComponent(null, e);
54887        closeArray();
54888      };
54889  }
54890
54891  protected void composeGenomicStudyAnalysisInputComponent(String name, GenomicStudy.GenomicStudyAnalysisInputComponent element) throws IOException {
54892    if (element != null) {
54893      open(name);
54894      composeGenomicStudyAnalysisInputComponentProperties(element);
54895      close();
54896    }
54897  }
54898
54899  protected void composeGenomicStudyAnalysisInputComponentProperties(GenomicStudy.GenomicStudyAnalysisInputComponent element) throws IOException {
54900    composeBackboneElementProperties(element);
54901      if (element.hasFile()) {
54902        composeReference("file", element.getFile());
54903      }
54904      if (element.hasType()) {
54905        composeCodeableConcept("type", element.getType());
54906      }
54907      if (element.hasGeneratedBy()) {
54908        composeType("generatedBy", element.getGeneratedBy());
54909      }
54910  }
54911
54912  protected void composeGenomicStudyAnalysisOutputComponent(String name, GenomicStudy.GenomicStudyAnalysisOutputComponent element) throws IOException {
54913    if (element != null) {
54914      open(name);
54915      composeGenomicStudyAnalysisOutputComponentProperties(element);
54916      close();
54917    }
54918  }
54919
54920  protected void composeGenomicStudyAnalysisOutputComponentProperties(GenomicStudy.GenomicStudyAnalysisOutputComponent element) throws IOException {
54921    composeBackboneElementProperties(element);
54922      if (element.hasFile()) {
54923        composeReference("file", element.getFile());
54924      }
54925      if (element.hasType()) {
54926        composeCodeableConcept("type", element.getType());
54927      }
54928  }
54929
54930  protected void composeGenomicStudyAnalysisPerformerComponent(String name, GenomicStudy.GenomicStudyAnalysisPerformerComponent element) throws IOException {
54931    if (element != null) {
54932      open(name);
54933      composeGenomicStudyAnalysisPerformerComponentProperties(element);
54934      close();
54935    }
54936  }
54937
54938  protected void composeGenomicStudyAnalysisPerformerComponentProperties(GenomicStudy.GenomicStudyAnalysisPerformerComponent element) throws IOException {
54939    composeBackboneElementProperties(element);
54940      if (element.hasActor()) {
54941        composeReference("actor", element.getActor());
54942      }
54943      if (element.hasRole()) {
54944        composeCodeableConcept("role", element.getRole());
54945      }
54946  }
54947
54948  protected void composeGenomicStudyAnalysisDeviceComponent(String name, GenomicStudy.GenomicStudyAnalysisDeviceComponent element) throws IOException {
54949    if (element != null) {
54950      open(name);
54951      composeGenomicStudyAnalysisDeviceComponentProperties(element);
54952      close();
54953    }
54954  }
54955
54956  protected void composeGenomicStudyAnalysisDeviceComponentProperties(GenomicStudy.GenomicStudyAnalysisDeviceComponent element) throws IOException {
54957    composeBackboneElementProperties(element);
54958      if (element.hasDevice()) {
54959        composeReference("device", element.getDevice());
54960      }
54961      if (element.hasFunction()) {
54962        composeCodeableConcept("function", element.getFunction());
54963      }
54964  }
54965
54966  protected void composeGoal(String name, Goal element) throws IOException {
54967    if (element != null) {
54968      prop("resourceType", name);
54969      composeGoalProperties(element);
54970    }
54971  }
54972
54973  protected void composeGoalProperties(Goal element) throws IOException {
54974    composeDomainResourceProperties(element);
54975      if (element.hasIdentifier()) {
54976        openArray("identifier");
54977        for (Identifier e : element.getIdentifier()) 
54978          composeIdentifier(null, e);
54979        closeArray();
54980      };
54981      if (element.hasLifecycleStatusElement()) {
54982        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
54983        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
54984      }
54985      if (element.hasAchievementStatus()) {
54986        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
54987      }
54988      if (element.hasCategory()) {
54989        openArray("category");
54990        for (CodeableConcept e : element.getCategory()) 
54991          composeCodeableConcept(null, e);
54992        closeArray();
54993      };
54994      if (element.hasContinuousElement()) {
54995        composeBooleanCore("continuous", element.getContinuousElement(), false);
54996        composeBooleanExtras("continuous", element.getContinuousElement(), false);
54997      }
54998      if (element.hasPriority()) {
54999        composeCodeableConcept("priority", element.getPriority());
55000      }
55001      if (element.hasDescription()) {
55002        composeCodeableConcept("description", element.getDescription());
55003      }
55004      if (element.hasSubject()) {
55005        composeReference("subject", element.getSubject());
55006      }
55007      if (element.hasStart()) {
55008        composeType("start", element.getStart());
55009      }
55010      if (element.hasTarget()) {
55011        openArray("target");
55012        for (Goal.GoalTargetComponent e : element.getTarget()) 
55013          composeGoalTargetComponent(null, e);
55014        closeArray();
55015      };
55016      if (element.hasStatusDateElement()) {
55017        composeDateCore("statusDate", element.getStatusDateElement(), false);
55018        composeDateExtras("statusDate", element.getStatusDateElement(), false);
55019      }
55020      if (element.hasStatusReasonElement()) {
55021        composeStringCore("statusReason", element.getStatusReasonElement(), false);
55022        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
55023      }
55024      if (element.hasSource()) {
55025        composeReference("source", element.getSource());
55026      }
55027      if (element.hasAddresses()) {
55028        openArray("addresses");
55029        for (Reference e : element.getAddresses()) 
55030          composeReference(null, e);
55031        closeArray();
55032      };
55033      if (element.hasNote()) {
55034        openArray("note");
55035        for (Annotation e : element.getNote()) 
55036          composeAnnotation(null, e);
55037        closeArray();
55038      };
55039      if (element.hasOutcome()) {
55040        openArray("outcome");
55041        for (CodeableReference e : element.getOutcome()) 
55042          composeCodeableReference(null, e);
55043        closeArray();
55044      };
55045  }
55046
55047  protected void composeGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
55048    if (element != null) {
55049      open(name);
55050      composeGoalTargetComponentProperties(element);
55051      close();
55052    }
55053  }
55054
55055  protected void composeGoalTargetComponentProperties(Goal.GoalTargetComponent element) throws IOException {
55056    composeBackboneElementProperties(element);
55057      if (element.hasMeasure()) {
55058        composeCodeableConcept("measure", element.getMeasure());
55059      }
55060      if (element.hasDetail()) {
55061        composeType("detail", element.getDetail());
55062      }
55063      if (element.hasDue()) {
55064        composeType("due", element.getDue());
55065      }
55066  }
55067
55068  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
55069    if (element != null) {
55070      prop("resourceType", name);
55071      composeGraphDefinitionProperties(element);
55072    }
55073  }
55074
55075  protected void composeGraphDefinitionProperties(GraphDefinition element) throws IOException {
55076    composeCanonicalResourceProperties(element);
55077      if (element.hasUrlElement()) {
55078        composeUriCore("url", element.getUrlElement(), false);
55079        composeUriExtras("url", element.getUrlElement(), false);
55080      }
55081      if (element.hasIdentifier()) {
55082        openArray("identifier");
55083        for (Identifier e : element.getIdentifier()) 
55084          composeIdentifier(null, e);
55085        closeArray();
55086      };
55087      if (element.hasVersionElement()) {
55088        composeStringCore("version", element.getVersionElement(), false);
55089        composeStringExtras("version", element.getVersionElement(), false);
55090      }
55091      if (element.hasVersionAlgorithm()) {
55092        composeType("versionAlgorithm", element.getVersionAlgorithm());
55093      }
55094      if (element.hasNameElement()) {
55095        composeStringCore("name", element.getNameElement(), false);
55096        composeStringExtras("name", element.getNameElement(), false);
55097      }
55098      if (element.hasTitleElement()) {
55099        composeStringCore("title", element.getTitleElement(), false);
55100        composeStringExtras("title", element.getTitleElement(), false);
55101      }
55102      if (element.hasStatusElement()) {
55103        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55104        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55105      }
55106      if (element.hasExperimentalElement()) {
55107        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55108        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55109      }
55110      if (element.hasDateElement()) {
55111        composeDateTimeCore("date", element.getDateElement(), false);
55112        composeDateTimeExtras("date", element.getDateElement(), false);
55113      }
55114      if (element.hasPublisherElement()) {
55115        composeStringCore("publisher", element.getPublisherElement(), false);
55116        composeStringExtras("publisher", element.getPublisherElement(), false);
55117      }
55118      if (element.hasContact()) {
55119        openArray("contact");
55120        for (ContactDetail e : element.getContact()) 
55121          composeContactDetail(null, e);
55122        closeArray();
55123      };
55124      if (element.hasDescriptionElement()) {
55125        composeMarkdownCore("description", element.getDescriptionElement(), false);
55126        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55127      }
55128      if (element.hasUseContext()) {
55129        openArray("useContext");
55130        for (UsageContext e : element.getUseContext()) 
55131          composeUsageContext(null, e);
55132        closeArray();
55133      };
55134      if (element.hasJurisdiction()) {
55135        openArray("jurisdiction");
55136        for (CodeableConcept e : element.getJurisdiction()) 
55137          composeCodeableConcept(null, e);
55138        closeArray();
55139      };
55140      if (element.hasPurposeElement()) {
55141        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55142        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55143      }
55144      if (element.hasCopyrightElement()) {
55145        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55146        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55147      }
55148      if (element.hasCopyrightLabelElement()) {
55149        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
55150        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
55151      }
55152      if (element.hasStartElement()) {
55153        composeIdCore("start", element.getStartElement(), false);
55154        composeIdExtras("start", element.getStartElement(), false);
55155      }
55156      if (element.hasNode()) {
55157        openArray("node");
55158        for (GraphDefinition.GraphDefinitionNodeComponent e : element.getNode()) 
55159          composeGraphDefinitionNodeComponent(null, e);
55160        closeArray();
55161      };
55162      if (element.hasLink()) {
55163        openArray("link");
55164        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
55165          composeGraphDefinitionLinkComponent(null, e);
55166        closeArray();
55167      };
55168  }
55169
55170  protected void composeGraphDefinitionNodeComponent(String name, GraphDefinition.GraphDefinitionNodeComponent element) throws IOException {
55171    if (element != null) {
55172      open(name);
55173      composeGraphDefinitionNodeComponentProperties(element);
55174      close();
55175    }
55176  }
55177
55178  protected void composeGraphDefinitionNodeComponentProperties(GraphDefinition.GraphDefinitionNodeComponent element) throws IOException {
55179    composeBackboneElementProperties(element);
55180      if (element.hasNodeIdElement()) {
55181        composeIdCore("nodeId", element.getNodeIdElement(), false);
55182        composeIdExtras("nodeId", element.getNodeIdElement(), false);
55183      }
55184      if (element.hasDescriptionElement()) {
55185        composeStringCore("description", element.getDescriptionElement(), false);
55186        composeStringExtras("description", element.getDescriptionElement(), false);
55187      }
55188      if (element.hasTypeElement()) {
55189        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), false);
55190        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), false);
55191      }
55192      if (element.hasProfileElement()) {
55193        composeCanonicalCore("profile", element.getProfileElement(), false);
55194        composeCanonicalExtras("profile", element.getProfileElement(), false);
55195      }
55196  }
55197
55198  protected void composeGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
55199    if (element != null) {
55200      open(name);
55201      composeGraphDefinitionLinkComponentProperties(element);
55202      close();
55203    }
55204  }
55205
55206  protected void composeGraphDefinitionLinkComponentProperties(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
55207    composeBackboneElementProperties(element);
55208      if (element.hasDescriptionElement()) {
55209        composeStringCore("description", element.getDescriptionElement(), false);
55210        composeStringExtras("description", element.getDescriptionElement(), false);
55211      }
55212      if (element.hasMinElement()) {
55213        composeIntegerCore("min", element.getMinElement(), false);
55214        composeIntegerExtras("min", element.getMinElement(), false);
55215      }
55216      if (element.hasMaxElement()) {
55217        composeStringCore("max", element.getMaxElement(), false);
55218        composeStringExtras("max", element.getMaxElement(), false);
55219      }
55220      if (element.hasSourceIdElement()) {
55221        composeIdCore("sourceId", element.getSourceIdElement(), false);
55222        composeIdExtras("sourceId", element.getSourceIdElement(), false);
55223      }
55224      if (element.hasPathElement()) {
55225        composeStringCore("path", element.getPathElement(), false);
55226        composeStringExtras("path", element.getPathElement(), false);
55227      }
55228      if (element.hasSliceNameElement()) {
55229        composeStringCore("sliceName", element.getSliceNameElement(), false);
55230        composeStringExtras("sliceName", element.getSliceNameElement(), false);
55231      }
55232      if (element.hasTargetIdElement()) {
55233        composeIdCore("targetId", element.getTargetIdElement(), false);
55234        composeIdExtras("targetId", element.getTargetIdElement(), false);
55235      }
55236      if (element.hasParamsElement()) {
55237        composeStringCore("params", element.getParamsElement(), false);
55238        composeStringExtras("params", element.getParamsElement(), false);
55239      }
55240      if (element.hasCompartment()) {
55241        openArray("compartment");
55242        for (GraphDefinition.GraphDefinitionLinkCompartmentComponent e : element.getCompartment()) 
55243          composeGraphDefinitionLinkCompartmentComponent(null, e);
55244        closeArray();
55245      };
55246  }
55247
55248  protected void composeGraphDefinitionLinkCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkCompartmentComponent element) throws IOException {
55249    if (element != null) {
55250      open(name);
55251      composeGraphDefinitionLinkCompartmentComponentProperties(element);
55252      close();
55253    }
55254  }
55255
55256  protected void composeGraphDefinitionLinkCompartmentComponentProperties(GraphDefinition.GraphDefinitionLinkCompartmentComponent element) throws IOException {
55257    composeBackboneElementProperties(element);
55258      if (element.hasUseElement()) {
55259        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
55260        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
55261      }
55262      if (element.hasRuleElement()) {
55263        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
55264        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
55265      }
55266      if (element.hasCodeElement()) {
55267        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
55268        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
55269      }
55270      if (element.hasExpressionElement()) {
55271        composeStringCore("expression", element.getExpressionElement(), false);
55272        composeStringExtras("expression", element.getExpressionElement(), false);
55273      }
55274      if (element.hasDescriptionElement()) {
55275        composeStringCore("description", element.getDescriptionElement(), false);
55276        composeStringExtras("description", element.getDescriptionElement(), false);
55277      }
55278  }
55279
55280  protected void composeGroup(String name, Group element) throws IOException {
55281    if (element != null) {
55282      prop("resourceType", name);
55283      composeGroupProperties(element);
55284    }
55285  }
55286
55287  protected void composeGroupProperties(Group element) throws IOException {
55288    composeDomainResourceProperties(element);
55289      if (element.hasIdentifier()) {
55290        openArray("identifier");
55291        for (Identifier e : element.getIdentifier()) 
55292          composeIdentifier(null, e);
55293        closeArray();
55294      };
55295      if (element.hasActiveElement()) {
55296        composeBooleanCore("active", element.getActiveElement(), false);
55297        composeBooleanExtras("active", element.getActiveElement(), false);
55298      }
55299      if (element.hasTypeElement()) {
55300        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
55301        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
55302      }
55303      if (element.hasMembershipElement()) {
55304        composeEnumerationCore("membership", element.getMembershipElement(), new Group.GroupMembershipBasisEnumFactory(), false);
55305        composeEnumerationExtras("membership", element.getMembershipElement(), new Group.GroupMembershipBasisEnumFactory(), false);
55306      }
55307      if (element.hasCode()) {
55308        composeCodeableConcept("code", element.getCode());
55309      }
55310      if (element.hasNameElement()) {
55311        composeStringCore("name", element.getNameElement(), false);
55312        composeStringExtras("name", element.getNameElement(), false);
55313      }
55314      if (element.hasDescriptionElement()) {
55315        composeMarkdownCore("description", element.getDescriptionElement(), false);
55316        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55317      }
55318      if (element.hasQuantityElement()) {
55319        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
55320        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
55321      }
55322      if (element.hasManagingEntity()) {
55323        composeReference("managingEntity", element.getManagingEntity());
55324      }
55325      if (element.hasCharacteristic()) {
55326        openArray("characteristic");
55327        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
55328          composeGroupCharacteristicComponent(null, e);
55329        closeArray();
55330      };
55331      if (element.hasMember()) {
55332        openArray("member");
55333        for (Group.GroupMemberComponent e : element.getMember()) 
55334          composeGroupMemberComponent(null, e);
55335        closeArray();
55336      };
55337  }
55338
55339  protected void composeGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
55340    if (element != null) {
55341      open(name);
55342      composeGroupCharacteristicComponentProperties(element);
55343      close();
55344    }
55345  }
55346
55347  protected void composeGroupCharacteristicComponentProperties(Group.GroupCharacteristicComponent element) throws IOException {
55348    composeBackboneElementProperties(element);
55349      if (element.hasCode()) {
55350        composeCodeableConcept("code", element.getCode());
55351      }
55352      if (element.hasValue()) {
55353        composeType("value", element.getValue());
55354      }
55355      if (element.hasExcludeElement()) {
55356        composeBooleanCore("exclude", element.getExcludeElement(), false);
55357        composeBooleanExtras("exclude", element.getExcludeElement(), false);
55358      }
55359      if (element.hasPeriod()) {
55360        composePeriod("period", element.getPeriod());
55361      }
55362  }
55363
55364  protected void composeGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
55365    if (element != null) {
55366      open(name);
55367      composeGroupMemberComponentProperties(element);
55368      close();
55369    }
55370  }
55371
55372  protected void composeGroupMemberComponentProperties(Group.GroupMemberComponent element) throws IOException {
55373    composeBackboneElementProperties(element);
55374      if (element.hasEntity()) {
55375        composeReference("entity", element.getEntity());
55376      }
55377      if (element.hasPeriod()) {
55378        composePeriod("period", element.getPeriod());
55379      }
55380      if (element.hasInactiveElement()) {
55381        composeBooleanCore("inactive", element.getInactiveElement(), false);
55382        composeBooleanExtras("inactive", element.getInactiveElement(), false);
55383      }
55384  }
55385
55386  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
55387    if (element != null) {
55388      prop("resourceType", name);
55389      composeGuidanceResponseProperties(element);
55390    }
55391  }
55392
55393  protected void composeGuidanceResponseProperties(GuidanceResponse element) throws IOException {
55394    composeDomainResourceProperties(element);
55395      if (element.hasRequestIdentifier()) {
55396        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
55397      }
55398      if (element.hasIdentifier()) {
55399        openArray("identifier");
55400        for (Identifier e : element.getIdentifier()) 
55401          composeIdentifier(null, e);
55402        closeArray();
55403      };
55404      if (element.hasModule()) {
55405        composeType("module", element.getModule());
55406      }
55407      if (element.hasStatusElement()) {
55408        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
55409        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
55410      }
55411      if (element.hasSubject()) {
55412        composeReference("subject", element.getSubject());
55413      }
55414      if (element.hasEncounter()) {
55415        composeReference("encounter", element.getEncounter());
55416      }
55417      if (element.hasOccurrenceDateTimeElement()) {
55418        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
55419        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
55420      }
55421      if (element.hasPerformer()) {
55422        composeReference("performer", element.getPerformer());
55423      }
55424      if (element.hasReason()) {
55425        openArray("reason");
55426        for (CodeableReference e : element.getReason()) 
55427          composeCodeableReference(null, e);
55428        closeArray();
55429      };
55430      if (element.hasNote()) {
55431        openArray("note");
55432        for (Annotation e : element.getNote()) 
55433          composeAnnotation(null, e);
55434        closeArray();
55435      };
55436      if (element.hasEvaluationMessage()) {
55437        composeReference("evaluationMessage", element.getEvaluationMessage());
55438      }
55439      if (element.hasOutputParameters()) {
55440        composeReference("outputParameters", element.getOutputParameters());
55441      }
55442      if (element.hasResult()) {
55443        openArray("result");
55444        for (Reference e : element.getResult()) 
55445          composeReference(null, e);
55446        closeArray();
55447      };
55448      if (element.hasDataRequirement()) {
55449        openArray("dataRequirement");
55450        for (DataRequirement e : element.getDataRequirement()) 
55451          composeDataRequirement(null, e);
55452        closeArray();
55453      };
55454  }
55455
55456  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
55457    if (element != null) {
55458      prop("resourceType", name);
55459      composeHealthcareServiceProperties(element);
55460    }
55461  }
55462
55463  protected void composeHealthcareServiceProperties(HealthcareService element) throws IOException {
55464    composeDomainResourceProperties(element);
55465      if (element.hasIdentifier()) {
55466        openArray("identifier");
55467        for (Identifier e : element.getIdentifier()) 
55468          composeIdentifier(null, e);
55469        closeArray();
55470      };
55471      if (element.hasActiveElement()) {
55472        composeBooleanCore("active", element.getActiveElement(), false);
55473        composeBooleanExtras("active", element.getActiveElement(), false);
55474      }
55475      if (element.hasProvidedBy()) {
55476        composeReference("providedBy", element.getProvidedBy());
55477      }
55478      if (element.hasOfferedIn()) {
55479        openArray("offeredIn");
55480        for (Reference e : element.getOfferedIn()) 
55481          composeReference(null, e);
55482        closeArray();
55483      };
55484      if (element.hasCategory()) {
55485        openArray("category");
55486        for (CodeableConcept e : element.getCategory()) 
55487          composeCodeableConcept(null, e);
55488        closeArray();
55489      };
55490      if (element.hasType()) {
55491        openArray("type");
55492        for (CodeableConcept e : element.getType()) 
55493          composeCodeableConcept(null, e);
55494        closeArray();
55495      };
55496      if (element.hasSpecialty()) {
55497        openArray("specialty");
55498        for (CodeableConcept e : element.getSpecialty()) 
55499          composeCodeableConcept(null, e);
55500        closeArray();
55501      };
55502      if (element.hasLocation()) {
55503        openArray("location");
55504        for (Reference e : element.getLocation()) 
55505          composeReference(null, e);
55506        closeArray();
55507      };
55508      if (element.hasNameElement()) {
55509        composeStringCore("name", element.getNameElement(), false);
55510        composeStringExtras("name", element.getNameElement(), false);
55511      }
55512      if (element.hasCommentElement()) {
55513        composeMarkdownCore("comment", element.getCommentElement(), false);
55514        composeMarkdownExtras("comment", element.getCommentElement(), false);
55515      }
55516      if (element.hasExtraDetailsElement()) {
55517        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
55518        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
55519      }
55520      if (element.hasPhoto()) {
55521        composeAttachment("photo", element.getPhoto());
55522      }
55523      if (element.hasContact()) {
55524        openArray("contact");
55525        for (ExtendedContactDetail e : element.getContact()) 
55526          composeExtendedContactDetail(null, e);
55527        closeArray();
55528      };
55529      if (element.hasCoverageArea()) {
55530        openArray("coverageArea");
55531        for (Reference e : element.getCoverageArea()) 
55532          composeReference(null, e);
55533        closeArray();
55534      };
55535      if (element.hasServiceProvisionCode()) {
55536        openArray("serviceProvisionCode");
55537        for (CodeableConcept e : element.getServiceProvisionCode()) 
55538          composeCodeableConcept(null, e);
55539        closeArray();
55540      };
55541      if (element.hasEligibility()) {
55542        openArray("eligibility");
55543        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
55544          composeHealthcareServiceEligibilityComponent(null, e);
55545        closeArray();
55546      };
55547      if (element.hasProgram()) {
55548        openArray("program");
55549        for (CodeableConcept e : element.getProgram()) 
55550          composeCodeableConcept(null, e);
55551        closeArray();
55552      };
55553      if (element.hasCharacteristic()) {
55554        openArray("characteristic");
55555        for (CodeableConcept e : element.getCharacteristic()) 
55556          composeCodeableConcept(null, e);
55557        closeArray();
55558      };
55559      if (element.hasCommunication()) {
55560        openArray("communication");
55561        for (CodeableConcept e : element.getCommunication()) 
55562          composeCodeableConcept(null, e);
55563        closeArray();
55564      };
55565      if (element.hasReferralMethod()) {
55566        openArray("referralMethod");
55567        for (CodeableConcept e : element.getReferralMethod()) 
55568          composeCodeableConcept(null, e);
55569        closeArray();
55570      };
55571      if (element.hasAppointmentRequiredElement()) {
55572        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
55573        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
55574      }
55575      if (element.hasAvailability()) {
55576        openArray("availability");
55577        for (Availability e : element.getAvailability()) 
55578          composeAvailability(null, e);
55579        closeArray();
55580      };
55581      if (element.hasEndpoint()) {
55582        openArray("endpoint");
55583        for (Reference e : element.getEndpoint()) 
55584          composeReference(null, e);
55585        closeArray();
55586      };
55587  }
55588
55589  protected void composeHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
55590    if (element != null) {
55591      open(name);
55592      composeHealthcareServiceEligibilityComponentProperties(element);
55593      close();
55594    }
55595  }
55596
55597  protected void composeHealthcareServiceEligibilityComponentProperties(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
55598    composeBackboneElementProperties(element);
55599      if (element.hasCode()) {
55600        composeCodeableConcept("code", element.getCode());
55601      }
55602      if (element.hasCommentElement()) {
55603        composeMarkdownCore("comment", element.getCommentElement(), false);
55604        composeMarkdownExtras("comment", element.getCommentElement(), false);
55605      }
55606  }
55607
55608  protected void composeImagingSelection(String name, ImagingSelection element) throws IOException {
55609    if (element != null) {
55610      prop("resourceType", name);
55611      composeImagingSelectionProperties(element);
55612    }
55613  }
55614
55615  protected void composeImagingSelectionProperties(ImagingSelection element) throws IOException {
55616    composeDomainResourceProperties(element);
55617      if (element.hasIdentifier()) {
55618        openArray("identifier");
55619        for (Identifier e : element.getIdentifier()) 
55620          composeIdentifier(null, e);
55621        closeArray();
55622      };
55623      if (element.hasStatusElement()) {
55624        composeEnumerationCore("status", element.getStatusElement(), new ImagingSelection.ImagingSelectionStatusEnumFactory(), false);
55625        composeEnumerationExtras("status", element.getStatusElement(), new ImagingSelection.ImagingSelectionStatusEnumFactory(), false);
55626      }
55627      if (element.hasSubject()) {
55628        composeReference("subject", element.getSubject());
55629      }
55630      if (element.hasIssuedElement()) {
55631        composeInstantCore("issued", element.getIssuedElement(), false);
55632        composeInstantExtras("issued", element.getIssuedElement(), false);
55633      }
55634      if (element.hasPerformer()) {
55635        openArray("performer");
55636        for (ImagingSelection.ImagingSelectionPerformerComponent e : element.getPerformer()) 
55637          composeImagingSelectionPerformerComponent(null, e);
55638        closeArray();
55639      };
55640      if (element.hasBasedOn()) {
55641        openArray("basedOn");
55642        for (Reference e : element.getBasedOn()) 
55643          composeReference(null, e);
55644        closeArray();
55645      };
55646      if (element.hasCategory()) {
55647        openArray("category");
55648        for (CodeableConcept e : element.getCategory()) 
55649          composeCodeableConcept(null, e);
55650        closeArray();
55651      };
55652      if (element.hasCode()) {
55653        composeCodeableConcept("code", element.getCode());
55654      }
55655      if (element.hasStudyUidElement()) {
55656        composeIdCore("studyUid", element.getStudyUidElement(), false);
55657        composeIdExtras("studyUid", element.getStudyUidElement(), false);
55658      }
55659      if (element.hasDerivedFrom()) {
55660        openArray("derivedFrom");
55661        for (Reference e : element.getDerivedFrom()) 
55662          composeReference(null, e);
55663        closeArray();
55664      };
55665      if (element.hasEndpoint()) {
55666        openArray("endpoint");
55667        for (Reference e : element.getEndpoint()) 
55668          composeReference(null, e);
55669        closeArray();
55670      };
55671      if (element.hasSeriesUidElement()) {
55672        composeIdCore("seriesUid", element.getSeriesUidElement(), false);
55673        composeIdExtras("seriesUid", element.getSeriesUidElement(), false);
55674      }
55675      if (element.hasSeriesNumberElement()) {
55676        composeUnsignedIntCore("seriesNumber", element.getSeriesNumberElement(), false);
55677        composeUnsignedIntExtras("seriesNumber", element.getSeriesNumberElement(), false);
55678      }
55679      if (element.hasFrameOfReferenceUidElement()) {
55680        composeIdCore("frameOfReferenceUid", element.getFrameOfReferenceUidElement(), false);
55681        composeIdExtras("frameOfReferenceUid", element.getFrameOfReferenceUidElement(), false);
55682      }
55683      if (element.hasBodySite()) {
55684        composeCodeableReference("bodySite", element.getBodySite());
55685      }
55686      if (element.hasFocus()) {
55687        openArray("focus");
55688        for (Reference e : element.getFocus()) 
55689          composeReference(null, e);
55690        closeArray();
55691      };
55692      if (element.hasInstance()) {
55693        openArray("instance");
55694        for (ImagingSelection.ImagingSelectionInstanceComponent e : element.getInstance()) 
55695          composeImagingSelectionInstanceComponent(null, e);
55696        closeArray();
55697      };
55698  }
55699
55700  protected void composeImagingSelectionPerformerComponent(String name, ImagingSelection.ImagingSelectionPerformerComponent element) throws IOException {
55701    if (element != null) {
55702      open(name);
55703      composeImagingSelectionPerformerComponentProperties(element);
55704      close();
55705    }
55706  }
55707
55708  protected void composeImagingSelectionPerformerComponentProperties(ImagingSelection.ImagingSelectionPerformerComponent element) throws IOException {
55709    composeBackboneElementProperties(element);
55710      if (element.hasFunction()) {
55711        composeCodeableConcept("function", element.getFunction());
55712      }
55713      if (element.hasActor()) {
55714        composeReference("actor", element.getActor());
55715      }
55716  }
55717
55718  protected void composeImagingSelectionInstanceComponent(String name, ImagingSelection.ImagingSelectionInstanceComponent element) throws IOException {
55719    if (element != null) {
55720      open(name);
55721      composeImagingSelectionInstanceComponentProperties(element);
55722      close();
55723    }
55724  }
55725
55726  protected void composeImagingSelectionInstanceComponentProperties(ImagingSelection.ImagingSelectionInstanceComponent element) throws IOException {
55727    composeBackboneElementProperties(element);
55728      if (element.hasUidElement()) {
55729        composeIdCore("uid", element.getUidElement(), false);
55730        composeIdExtras("uid", element.getUidElement(), false);
55731      }
55732      if (element.hasNumberElement()) {
55733        composeUnsignedIntCore("number", element.getNumberElement(), false);
55734        composeUnsignedIntExtras("number", element.getNumberElement(), false);
55735      }
55736      if (element.hasSopClass()) {
55737        composeCoding("sopClass", element.getSopClass());
55738      }
55739      if (element.hasSubset()) {
55740        if (anyHasValue(element.getSubset())) {
55741          openArray("subset");
55742          for (StringType e : element.getSubset()) 
55743            composeStringCore(null, e, e != element.getSubset().get(element.getSubset().size()-1));
55744          closeArray();
55745        }
55746        if (anyHasExtras(element.getSubset())) {
55747          openArray("_subset");
55748          for (StringType e : element.getSubset()) 
55749            composeStringExtras(null, e, true);
55750          closeArray();
55751        }
55752      };
55753      if (element.hasImageRegion2D()) {
55754        openArray("imageRegion2D");
55755        for (ImagingSelection.ImageRegion2DComponent e : element.getImageRegion2D()) 
55756          composeImageRegion2DComponent(null, e);
55757        closeArray();
55758      };
55759      if (element.hasImageRegion3D()) {
55760        openArray("imageRegion3D");
55761        for (ImagingSelection.ImageRegion3DComponent e : element.getImageRegion3D()) 
55762          composeImageRegion3DComponent(null, e);
55763        closeArray();
55764      };
55765  }
55766
55767  protected void composeImageRegion2DComponent(String name, ImagingSelection.ImageRegion2DComponent element) throws IOException {
55768    if (element != null) {
55769      open(name);
55770      composeImageRegion2DComponentProperties(element);
55771      close();
55772    }
55773  }
55774
55775  protected void composeImageRegion2DComponentProperties(ImagingSelection.ImageRegion2DComponent element) throws IOException {
55776    composeBackboneElementProperties(element);
55777      if (element.hasRegionTypeElement()) {
55778        composeEnumerationCore("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection2DGraphicTypeEnumFactory(), false);
55779        composeEnumerationExtras("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection2DGraphicTypeEnumFactory(), false);
55780      }
55781      if (element.hasCoordinate()) {
55782        if (anyHasValue(element.getCoordinate())) {
55783          openArray("coordinate");
55784          for (DecimalType e : element.getCoordinate()) 
55785            composeDecimalCore(null, e, e != element.getCoordinate().get(element.getCoordinate().size()-1));
55786          closeArray();
55787        }
55788        if (anyHasExtras(element.getCoordinate())) {
55789          openArray("_coordinate");
55790          for (DecimalType e : element.getCoordinate()) 
55791            composeDecimalExtras(null, e, true);
55792          closeArray();
55793        }
55794      };
55795  }
55796
55797  protected void composeImageRegion3DComponent(String name, ImagingSelection.ImageRegion3DComponent element) throws IOException {
55798    if (element != null) {
55799      open(name);
55800      composeImageRegion3DComponentProperties(element);
55801      close();
55802    }
55803  }
55804
55805  protected void composeImageRegion3DComponentProperties(ImagingSelection.ImageRegion3DComponent element) throws IOException {
55806    composeBackboneElementProperties(element);
55807      if (element.hasRegionTypeElement()) {
55808        composeEnumerationCore("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection3DGraphicTypeEnumFactory(), false);
55809        composeEnumerationExtras("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection3DGraphicTypeEnumFactory(), false);
55810      }
55811      if (element.hasCoordinate()) {
55812        if (anyHasValue(element.getCoordinate())) {
55813          openArray("coordinate");
55814          for (DecimalType e : element.getCoordinate()) 
55815            composeDecimalCore(null, e, e != element.getCoordinate().get(element.getCoordinate().size()-1));
55816          closeArray();
55817        }
55818        if (anyHasExtras(element.getCoordinate())) {
55819          openArray("_coordinate");
55820          for (DecimalType e : element.getCoordinate()) 
55821            composeDecimalExtras(null, e, true);
55822          closeArray();
55823        }
55824      };
55825  }
55826
55827  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
55828    if (element != null) {
55829      prop("resourceType", name);
55830      composeImagingStudyProperties(element);
55831    }
55832  }
55833
55834  protected void composeImagingStudyProperties(ImagingStudy element) throws IOException {
55835    composeDomainResourceProperties(element);
55836      if (element.hasIdentifier()) {
55837        openArray("identifier");
55838        for (Identifier e : element.getIdentifier()) 
55839          composeIdentifier(null, e);
55840        closeArray();
55841      };
55842      if (element.hasStatusElement()) {
55843        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
55844        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
55845      }
55846      if (element.hasModality()) {
55847        openArray("modality");
55848        for (CodeableConcept e : element.getModality()) 
55849          composeCodeableConcept(null, e);
55850        closeArray();
55851      };
55852      if (element.hasSubject()) {
55853        composeReference("subject", element.getSubject());
55854      }
55855      if (element.hasEncounter()) {
55856        composeReference("encounter", element.getEncounter());
55857      }
55858      if (element.hasStartedElement()) {
55859        composeDateTimeCore("started", element.getStartedElement(), false);
55860        composeDateTimeExtras("started", element.getStartedElement(), false);
55861      }
55862      if (element.hasBasedOn()) {
55863        openArray("basedOn");
55864        for (Reference e : element.getBasedOn()) 
55865          composeReference(null, e);
55866        closeArray();
55867      };
55868      if (element.hasPartOf()) {
55869        openArray("partOf");
55870        for (Reference e : element.getPartOf()) 
55871          composeReference(null, e);
55872        closeArray();
55873      };
55874      if (element.hasReferrer()) {
55875        composeReference("referrer", element.getReferrer());
55876      }
55877      if (element.hasEndpoint()) {
55878        openArray("endpoint");
55879        for (Reference e : element.getEndpoint()) 
55880          composeReference(null, e);
55881        closeArray();
55882      };
55883      if (element.hasNumberOfSeriesElement()) {
55884        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
55885        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
55886      }
55887      if (element.hasNumberOfInstancesElement()) {
55888        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
55889        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
55890      }
55891      if (element.hasProcedure()) {
55892        openArray("procedure");
55893        for (CodeableReference e : element.getProcedure()) 
55894          composeCodeableReference(null, e);
55895        closeArray();
55896      };
55897      if (element.hasLocation()) {
55898        composeReference("location", element.getLocation());
55899      }
55900      if (element.hasReason()) {
55901        openArray("reason");
55902        for (CodeableReference e : element.getReason()) 
55903          composeCodeableReference(null, e);
55904        closeArray();
55905      };
55906      if (element.hasNote()) {
55907        openArray("note");
55908        for (Annotation e : element.getNote()) 
55909          composeAnnotation(null, e);
55910        closeArray();
55911      };
55912      if (element.hasDescriptionElement()) {
55913        composeStringCore("description", element.getDescriptionElement(), false);
55914        composeStringExtras("description", element.getDescriptionElement(), false);
55915      }
55916      if (element.hasSeries()) {
55917        openArray("series");
55918        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
55919          composeImagingStudySeriesComponent(null, e);
55920        closeArray();
55921      };
55922  }
55923
55924  protected void composeImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
55925    if (element != null) {
55926      open(name);
55927      composeImagingStudySeriesComponentProperties(element);
55928      close();
55929    }
55930  }
55931
55932  protected void composeImagingStudySeriesComponentProperties(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
55933    composeBackboneElementProperties(element);
55934      if (element.hasUidElement()) {
55935        composeIdCore("uid", element.getUidElement(), false);
55936        composeIdExtras("uid", element.getUidElement(), false);
55937      }
55938      if (element.hasNumberElement()) {
55939        composeUnsignedIntCore("number", element.getNumberElement(), false);
55940        composeUnsignedIntExtras("number", element.getNumberElement(), false);
55941      }
55942      if (element.hasModality()) {
55943        composeCodeableConcept("modality", element.getModality());
55944      }
55945      if (element.hasDescriptionElement()) {
55946        composeStringCore("description", element.getDescriptionElement(), false);
55947        composeStringExtras("description", element.getDescriptionElement(), false);
55948      }
55949      if (element.hasNumberOfInstancesElement()) {
55950        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
55951        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
55952      }
55953      if (element.hasEndpoint()) {
55954        openArray("endpoint");
55955        for (Reference e : element.getEndpoint()) 
55956          composeReference(null, e);
55957        closeArray();
55958      };
55959      if (element.hasBodySite()) {
55960        composeCodeableReference("bodySite", element.getBodySite());
55961      }
55962      if (element.hasLaterality()) {
55963        composeCodeableConcept("laterality", element.getLaterality());
55964      }
55965      if (element.hasSpecimen()) {
55966        openArray("specimen");
55967        for (Reference e : element.getSpecimen()) 
55968          composeReference(null, e);
55969        closeArray();
55970      };
55971      if (element.hasStartedElement()) {
55972        composeDateTimeCore("started", element.getStartedElement(), false);
55973        composeDateTimeExtras("started", element.getStartedElement(), false);
55974      }
55975      if (element.hasPerformer()) {
55976        openArray("performer");
55977        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
55978          composeImagingStudySeriesPerformerComponent(null, e);
55979        closeArray();
55980      };
55981      if (element.hasInstance()) {
55982        openArray("instance");
55983        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
55984          composeImagingStudySeriesInstanceComponent(null, e);
55985        closeArray();
55986      };
55987  }
55988
55989  protected void composeImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
55990    if (element != null) {
55991      open(name);
55992      composeImagingStudySeriesPerformerComponentProperties(element);
55993      close();
55994    }
55995  }
55996
55997  protected void composeImagingStudySeriesPerformerComponentProperties(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
55998    composeBackboneElementProperties(element);
55999      if (element.hasFunction()) {
56000        composeCodeableConcept("function", element.getFunction());
56001      }
56002      if (element.hasActor()) {
56003        composeReference("actor", element.getActor());
56004      }
56005  }
56006
56007  protected void composeImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
56008    if (element != null) {
56009      open(name);
56010      composeImagingStudySeriesInstanceComponentProperties(element);
56011      close();
56012    }
56013  }
56014
56015  protected void composeImagingStudySeriesInstanceComponentProperties(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
56016    composeBackboneElementProperties(element);
56017      if (element.hasUidElement()) {
56018        composeIdCore("uid", element.getUidElement(), false);
56019        composeIdExtras("uid", element.getUidElement(), false);
56020      }
56021      if (element.hasSopClass()) {
56022        composeCoding("sopClass", element.getSopClass());
56023      }
56024      if (element.hasNumberElement()) {
56025        composeUnsignedIntCore("number", element.getNumberElement(), false);
56026        composeUnsignedIntExtras("number", element.getNumberElement(), false);
56027      }
56028      if (element.hasTitleElement()) {
56029        composeStringCore("title", element.getTitleElement(), false);
56030        composeStringExtras("title", element.getTitleElement(), false);
56031      }
56032  }
56033
56034  protected void composeImmunization(String name, Immunization element) throws IOException {
56035    if (element != null) {
56036      prop("resourceType", name);
56037      composeImmunizationProperties(element);
56038    }
56039  }
56040
56041  protected void composeImmunizationProperties(Immunization element) throws IOException {
56042    composeDomainResourceProperties(element);
56043      if (element.hasIdentifier()) {
56044        openArray("identifier");
56045        for (Identifier e : element.getIdentifier()) 
56046          composeIdentifier(null, e);
56047        closeArray();
56048      };
56049      if (element.hasBasedOn()) {
56050        openArray("basedOn");
56051        for (Reference e : element.getBasedOn()) 
56052          composeReference(null, e);
56053        closeArray();
56054      };
56055      if (element.hasStatusElement()) {
56056        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
56057        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
56058      }
56059      if (element.hasStatusReason()) {
56060        composeCodeableConcept("statusReason", element.getStatusReason());
56061      }
56062      if (element.hasVaccineCode()) {
56063        composeCodeableConcept("vaccineCode", element.getVaccineCode());
56064      }
56065      if (element.hasAdministeredProduct()) {
56066        composeCodeableReference("administeredProduct", element.getAdministeredProduct());
56067      }
56068      if (element.hasManufacturer()) {
56069        composeCodeableReference("manufacturer", element.getManufacturer());
56070      }
56071      if (element.hasLotNumberElement()) {
56072        composeStringCore("lotNumber", element.getLotNumberElement(), false);
56073        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
56074      }
56075      if (element.hasExpirationDateElement()) {
56076        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
56077        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
56078      }
56079      if (element.hasPatient()) {
56080        composeReference("patient", element.getPatient());
56081      }
56082      if (element.hasEncounter()) {
56083        composeReference("encounter", element.getEncounter());
56084      }
56085      if (element.hasSupportingInformation()) {
56086        openArray("supportingInformation");
56087        for (Reference e : element.getSupportingInformation()) 
56088          composeReference(null, e);
56089        closeArray();
56090      };
56091      if (element.hasOccurrence()) {
56092        composeType("occurrence", element.getOccurrence());
56093      }
56094      if (element.hasPrimarySourceElement()) {
56095        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
56096        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
56097      }
56098      if (element.hasInformationSource()) {
56099        composeCodeableReference("informationSource", element.getInformationSource());
56100      }
56101      if (element.hasLocation()) {
56102        composeReference("location", element.getLocation());
56103      }
56104      if (element.hasSite()) {
56105        composeCodeableConcept("site", element.getSite());
56106      }
56107      if (element.hasRoute()) {
56108        composeCodeableConcept("route", element.getRoute());
56109      }
56110      if (element.hasDoseQuantity()) {
56111        composeQuantity("doseQuantity", element.getDoseQuantity());
56112      }
56113      if (element.hasPerformer()) {
56114        openArray("performer");
56115        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
56116          composeImmunizationPerformerComponent(null, e);
56117        closeArray();
56118      };
56119      if (element.hasNote()) {
56120        openArray("note");
56121        for (Annotation e : element.getNote()) 
56122          composeAnnotation(null, e);
56123        closeArray();
56124      };
56125      if (element.hasReason()) {
56126        openArray("reason");
56127        for (CodeableReference e : element.getReason()) 
56128          composeCodeableReference(null, e);
56129        closeArray();
56130      };
56131      if (element.hasIsSubpotentElement()) {
56132        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
56133        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
56134      }
56135      if (element.hasSubpotentReason()) {
56136        openArray("subpotentReason");
56137        for (CodeableConcept e : element.getSubpotentReason()) 
56138          composeCodeableConcept(null, e);
56139        closeArray();
56140      };
56141      if (element.hasProgramEligibility()) {
56142        openArray("programEligibility");
56143        for (Immunization.ImmunizationProgramEligibilityComponent e : element.getProgramEligibility()) 
56144          composeImmunizationProgramEligibilityComponent(null, e);
56145        closeArray();
56146      };
56147      if (element.hasFundingSource()) {
56148        composeCodeableConcept("fundingSource", element.getFundingSource());
56149      }
56150      if (element.hasReaction()) {
56151        openArray("reaction");
56152        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
56153          composeImmunizationReactionComponent(null, e);
56154        closeArray();
56155      };
56156      if (element.hasProtocolApplied()) {
56157        openArray("protocolApplied");
56158        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
56159          composeImmunizationProtocolAppliedComponent(null, e);
56160        closeArray();
56161      };
56162  }
56163
56164  protected void composeImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
56165    if (element != null) {
56166      open(name);
56167      composeImmunizationPerformerComponentProperties(element);
56168      close();
56169    }
56170  }
56171
56172  protected void composeImmunizationPerformerComponentProperties(Immunization.ImmunizationPerformerComponent element) throws IOException {
56173    composeBackboneElementProperties(element);
56174      if (element.hasFunction()) {
56175        composeCodeableConcept("function", element.getFunction());
56176      }
56177      if (element.hasActor()) {
56178        composeReference("actor", element.getActor());
56179      }
56180  }
56181
56182  protected void composeImmunizationProgramEligibilityComponent(String name, Immunization.ImmunizationProgramEligibilityComponent element) throws IOException {
56183    if (element != null) {
56184      open(name);
56185      composeImmunizationProgramEligibilityComponentProperties(element);
56186      close();
56187    }
56188  }
56189
56190  protected void composeImmunizationProgramEligibilityComponentProperties(Immunization.ImmunizationProgramEligibilityComponent element) throws IOException {
56191    composeBackboneElementProperties(element);
56192      if (element.hasProgram()) {
56193        composeCodeableConcept("program", element.getProgram());
56194      }
56195      if (element.hasProgramStatus()) {
56196        composeCodeableConcept("programStatus", element.getProgramStatus());
56197      }
56198  }
56199
56200  protected void composeImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
56201    if (element != null) {
56202      open(name);
56203      composeImmunizationReactionComponentProperties(element);
56204      close();
56205    }
56206  }
56207
56208  protected void composeImmunizationReactionComponentProperties(Immunization.ImmunizationReactionComponent element) throws IOException {
56209    composeBackboneElementProperties(element);
56210      if (element.hasDateElement()) {
56211        composeDateTimeCore("date", element.getDateElement(), false);
56212        composeDateTimeExtras("date", element.getDateElement(), false);
56213      }
56214      if (element.hasManifestation()) {
56215        composeCodeableReference("manifestation", element.getManifestation());
56216      }
56217      if (element.hasReportedElement()) {
56218        composeBooleanCore("reported", element.getReportedElement(), false);
56219        composeBooleanExtras("reported", element.getReportedElement(), false);
56220      }
56221  }
56222
56223  protected void composeImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
56224    if (element != null) {
56225      open(name);
56226      composeImmunizationProtocolAppliedComponentProperties(element);
56227      close();
56228    }
56229  }
56230
56231  protected void composeImmunizationProtocolAppliedComponentProperties(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
56232    composeBackboneElementProperties(element);
56233      if (element.hasSeriesElement()) {
56234        composeStringCore("series", element.getSeriesElement(), false);
56235        composeStringExtras("series", element.getSeriesElement(), false);
56236      }
56237      if (element.hasAuthority()) {
56238        composeReference("authority", element.getAuthority());
56239      }
56240      if (element.hasTargetDisease()) {
56241        openArray("targetDisease");
56242        for (CodeableConcept e : element.getTargetDisease()) 
56243          composeCodeableConcept(null, e);
56244        closeArray();
56245      };
56246      if (element.hasDoseNumberElement()) {
56247        composeStringCore("doseNumber", element.getDoseNumberElement(), false);
56248        composeStringExtras("doseNumber", element.getDoseNumberElement(), false);
56249      }
56250      if (element.hasSeriesDosesElement()) {
56251        composeStringCore("seriesDoses", element.getSeriesDosesElement(), false);
56252        composeStringExtras("seriesDoses", element.getSeriesDosesElement(), false);
56253      }
56254  }
56255
56256  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
56257    if (element != null) {
56258      prop("resourceType", name);
56259      composeImmunizationEvaluationProperties(element);
56260    }
56261  }
56262
56263  protected void composeImmunizationEvaluationProperties(ImmunizationEvaluation element) throws IOException {
56264    composeDomainResourceProperties(element);
56265      if (element.hasIdentifier()) {
56266        openArray("identifier");
56267        for (Identifier e : element.getIdentifier()) 
56268          composeIdentifier(null, e);
56269        closeArray();
56270      };
56271      if (element.hasStatusElement()) {
56272        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
56273        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
56274      }
56275      if (element.hasPatient()) {
56276        composeReference("patient", element.getPatient());
56277      }
56278      if (element.hasDateElement()) {
56279        composeDateTimeCore("date", element.getDateElement(), false);
56280        composeDateTimeExtras("date", element.getDateElement(), false);
56281      }
56282      if (element.hasAuthority()) {
56283        composeReference("authority", element.getAuthority());
56284      }
56285      if (element.hasTargetDisease()) {
56286        composeCodeableConcept("targetDisease", element.getTargetDisease());
56287      }
56288      if (element.hasImmunizationEvent()) {
56289        composeReference("immunizationEvent", element.getImmunizationEvent());
56290      }
56291      if (element.hasDoseStatus()) {
56292        composeCodeableConcept("doseStatus", element.getDoseStatus());
56293      }
56294      if (element.hasDoseStatusReason()) {
56295        openArray("doseStatusReason");
56296        for (CodeableConcept e : element.getDoseStatusReason()) 
56297          composeCodeableConcept(null, e);
56298        closeArray();
56299      };
56300      if (element.hasDescriptionElement()) {
56301        composeMarkdownCore("description", element.getDescriptionElement(), false);
56302        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56303      }
56304      if (element.hasSeriesElement()) {
56305        composeStringCore("series", element.getSeriesElement(), false);
56306        composeStringExtras("series", element.getSeriesElement(), false);
56307      }
56308      if (element.hasDoseNumberElement()) {
56309        composeStringCore("doseNumber", element.getDoseNumberElement(), false);
56310        composeStringExtras("doseNumber", element.getDoseNumberElement(), false);
56311      }
56312      if (element.hasSeriesDosesElement()) {
56313        composeStringCore("seriesDoses", element.getSeriesDosesElement(), false);
56314        composeStringExtras("seriesDoses", element.getSeriesDosesElement(), false);
56315      }
56316  }
56317
56318  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
56319    if (element != null) {
56320      prop("resourceType", name);
56321      composeImmunizationRecommendationProperties(element);
56322    }
56323  }
56324
56325  protected void composeImmunizationRecommendationProperties(ImmunizationRecommendation element) throws IOException {
56326    composeDomainResourceProperties(element);
56327      if (element.hasIdentifier()) {
56328        openArray("identifier");
56329        for (Identifier e : element.getIdentifier()) 
56330          composeIdentifier(null, e);
56331        closeArray();
56332      };
56333      if (element.hasPatient()) {
56334        composeReference("patient", element.getPatient());
56335      }
56336      if (element.hasDateElement()) {
56337        composeDateTimeCore("date", element.getDateElement(), false);
56338        composeDateTimeExtras("date", element.getDateElement(), false);
56339      }
56340      if (element.hasAuthority()) {
56341        composeReference("authority", element.getAuthority());
56342      }
56343      if (element.hasRecommendation()) {
56344        openArray("recommendation");
56345        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
56346          composeImmunizationRecommendationRecommendationComponent(null, e);
56347        closeArray();
56348      };
56349  }
56350
56351  protected void composeImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
56352    if (element != null) {
56353      open(name);
56354      composeImmunizationRecommendationRecommendationComponentProperties(element);
56355      close();
56356    }
56357  }
56358
56359  protected void composeImmunizationRecommendationRecommendationComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
56360    composeBackboneElementProperties(element);
56361      if (element.hasVaccineCode()) {
56362        openArray("vaccineCode");
56363        for (CodeableConcept e : element.getVaccineCode()) 
56364          composeCodeableConcept(null, e);
56365        closeArray();
56366      };
56367      if (element.hasTargetDisease()) {
56368        openArray("targetDisease");
56369        for (CodeableConcept e : element.getTargetDisease()) 
56370          composeCodeableConcept(null, e);
56371        closeArray();
56372      };
56373      if (element.hasContraindicatedVaccineCode()) {
56374        openArray("contraindicatedVaccineCode");
56375        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
56376          composeCodeableConcept(null, e);
56377        closeArray();
56378      };
56379      if (element.hasForecastStatus()) {
56380        composeCodeableConcept("forecastStatus", element.getForecastStatus());
56381      }
56382      if (element.hasForecastReason()) {
56383        openArray("forecastReason");
56384        for (CodeableConcept e : element.getForecastReason()) 
56385          composeCodeableConcept(null, e);
56386        closeArray();
56387      };
56388      if (element.hasDateCriterion()) {
56389        openArray("dateCriterion");
56390        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
56391          composeImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
56392        closeArray();
56393      };
56394      if (element.hasDescriptionElement()) {
56395        composeMarkdownCore("description", element.getDescriptionElement(), false);
56396        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56397      }
56398      if (element.hasSeriesElement()) {
56399        composeStringCore("series", element.getSeriesElement(), false);
56400        composeStringExtras("series", element.getSeriesElement(), false);
56401      }
56402      if (element.hasDoseNumberElement()) {
56403        composeStringCore("doseNumber", element.getDoseNumberElement(), false);
56404        composeStringExtras("doseNumber", element.getDoseNumberElement(), false);
56405      }
56406      if (element.hasSeriesDosesElement()) {
56407        composeStringCore("seriesDoses", element.getSeriesDosesElement(), false);
56408        composeStringExtras("seriesDoses", element.getSeriesDosesElement(), false);
56409      }
56410      if (element.hasSupportingImmunization()) {
56411        openArray("supportingImmunization");
56412        for (Reference e : element.getSupportingImmunization()) 
56413          composeReference(null, e);
56414        closeArray();
56415      };
56416      if (element.hasSupportingPatientInformation()) {
56417        openArray("supportingPatientInformation");
56418        for (Reference e : element.getSupportingPatientInformation()) 
56419          composeReference(null, e);
56420        closeArray();
56421      };
56422  }
56423
56424  protected void composeImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
56425    if (element != null) {
56426      open(name);
56427      composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(element);
56428      close();
56429    }
56430  }
56431
56432  protected void composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
56433    composeBackboneElementProperties(element);
56434      if (element.hasCode()) {
56435        composeCodeableConcept("code", element.getCode());
56436      }
56437      if (element.hasValueElement()) {
56438        composeDateTimeCore("value", element.getValueElement(), false);
56439        composeDateTimeExtras("value", element.getValueElement(), false);
56440      }
56441  }
56442
56443  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
56444    if (element != null) {
56445      prop("resourceType", name);
56446      composeImplementationGuideProperties(element);
56447    }
56448  }
56449
56450  protected void composeImplementationGuideProperties(ImplementationGuide element) throws IOException {
56451    composeCanonicalResourceProperties(element);
56452      if (element.hasUrlElement()) {
56453        composeUriCore("url", element.getUrlElement(), false);
56454        composeUriExtras("url", element.getUrlElement(), false);
56455      }
56456      if (element.hasIdentifier()) {
56457        openArray("identifier");
56458        for (Identifier e : element.getIdentifier()) 
56459          composeIdentifier(null, e);
56460        closeArray();
56461      };
56462      if (element.hasVersionElement()) {
56463        composeStringCore("version", element.getVersionElement(), false);
56464        composeStringExtras("version", element.getVersionElement(), false);
56465      }
56466      if (element.hasVersionAlgorithm()) {
56467        composeType("versionAlgorithm", element.getVersionAlgorithm());
56468      }
56469      if (element.hasNameElement()) {
56470        composeStringCore("name", element.getNameElement(), false);
56471        composeStringExtras("name", element.getNameElement(), false);
56472      }
56473      if (element.hasTitleElement()) {
56474        composeStringCore("title", element.getTitleElement(), false);
56475        composeStringExtras("title", element.getTitleElement(), false);
56476      }
56477      if (element.hasStatusElement()) {
56478        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56479        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56480      }
56481      if (element.hasExperimentalElement()) {
56482        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56483        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56484      }
56485      if (element.hasDateElement()) {
56486        composeDateTimeCore("date", element.getDateElement(), false);
56487        composeDateTimeExtras("date", element.getDateElement(), false);
56488      }
56489      if (element.hasPublisherElement()) {
56490        composeStringCore("publisher", element.getPublisherElement(), false);
56491        composeStringExtras("publisher", element.getPublisherElement(), false);
56492      }
56493      if (element.hasContact()) {
56494        openArray("contact");
56495        for (ContactDetail e : element.getContact()) 
56496          composeContactDetail(null, e);
56497        closeArray();
56498      };
56499      if (element.hasDescriptionElement()) {
56500        composeMarkdownCore("description", element.getDescriptionElement(), false);
56501        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56502      }
56503      if (element.hasUseContext()) {
56504        openArray("useContext");
56505        for (UsageContext e : element.getUseContext()) 
56506          composeUsageContext(null, e);
56507        closeArray();
56508      };
56509      if (element.hasJurisdiction()) {
56510        openArray("jurisdiction");
56511        for (CodeableConcept e : element.getJurisdiction()) 
56512          composeCodeableConcept(null, e);
56513        closeArray();
56514      };
56515      if (element.hasPurposeElement()) {
56516        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56517        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56518      }
56519      if (element.hasCopyrightElement()) {
56520        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56521        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56522      }
56523      if (element.hasCopyrightLabelElement()) {
56524        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
56525        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
56526      }
56527      if (element.hasPackageIdElement()) {
56528        composeIdCore("packageId", element.getPackageIdElement(), false);
56529        composeIdExtras("packageId", element.getPackageIdElement(), false);
56530      }
56531      if (element.hasLicenseElement()) {
56532        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
56533        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
56534      }
56535      if (element.hasFhirVersion()) {
56536        openArray("fhirVersion");
56537        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56538          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56539        closeArray();
56540        if (anyHasExtras(element.getFhirVersion())) {
56541          openArray("_fhirVersion");
56542          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56543            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56544          closeArray();
56545        }
56546      };
56547      if (element.hasDependsOn()) {
56548        openArray("dependsOn");
56549        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
56550          composeImplementationGuideDependsOnComponent(null, e);
56551        closeArray();
56552      };
56553      if (element.hasGlobal()) {
56554        openArray("global");
56555        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
56556          composeImplementationGuideGlobalComponent(null, e);
56557        closeArray();
56558      };
56559      if (element.hasDefinition()) {
56560        composeImplementationGuideDefinitionComponent("definition", element.getDefinition());
56561      }
56562      if (element.hasManifest()) {
56563        composeImplementationGuideManifestComponent("manifest", element.getManifest());
56564      }
56565  }
56566
56567  protected void composeImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
56568    if (element != null) {
56569      open(name);
56570      composeImplementationGuideDependsOnComponentProperties(element);
56571      close();
56572    }
56573  }
56574
56575  protected void composeImplementationGuideDependsOnComponentProperties(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
56576    composeBackboneElementProperties(element);
56577      if (element.hasUriElement()) {
56578        composeCanonicalCore("uri", element.getUriElement(), false);
56579        composeCanonicalExtras("uri", element.getUriElement(), false);
56580      }
56581      if (element.hasPackageIdElement()) {
56582        composeIdCore("packageId", element.getPackageIdElement(), false);
56583        composeIdExtras("packageId", element.getPackageIdElement(), false);
56584      }
56585      if (element.hasVersionElement()) {
56586        composeStringCore("version", element.getVersionElement(), false);
56587        composeStringExtras("version", element.getVersionElement(), false);
56588      }
56589      if (element.hasReasonElement()) {
56590        composeMarkdownCore("reason", element.getReasonElement(), false);
56591        composeMarkdownExtras("reason", element.getReasonElement(), false);
56592      }
56593  }
56594
56595  protected void composeImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
56596    if (element != null) {
56597      open(name);
56598      composeImplementationGuideGlobalComponentProperties(element);
56599      close();
56600    }
56601  }
56602
56603  protected void composeImplementationGuideGlobalComponentProperties(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
56604    composeBackboneElementProperties(element);
56605      if (element.hasTypeElement()) {
56606        composeCodeCore("type", element.getTypeElement(), false);
56607        composeCodeExtras("type", element.getTypeElement(), false);
56608      }
56609      if (element.hasProfileElement()) {
56610        composeCanonicalCore("profile", element.getProfileElement(), false);
56611        composeCanonicalExtras("profile", element.getProfileElement(), false);
56612      }
56613  }
56614
56615  protected void composeImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
56616    if (element != null) {
56617      open(name);
56618      composeImplementationGuideDefinitionComponentProperties(element);
56619      close();
56620    }
56621  }
56622
56623  protected void composeImplementationGuideDefinitionComponentProperties(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
56624    composeBackboneElementProperties(element);
56625      if (element.hasGrouping()) {
56626        openArray("grouping");
56627        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
56628          composeImplementationGuideDefinitionGroupingComponent(null, e);
56629        closeArray();
56630      };
56631      if (element.hasResource()) {
56632        openArray("resource");
56633        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
56634          composeImplementationGuideDefinitionResourceComponent(null, e);
56635        closeArray();
56636      };
56637      if (element.hasPage()) {
56638        composeImplementationGuideDefinitionPageComponent("page", element.getPage());
56639      }
56640      if (element.hasParameter()) {
56641        openArray("parameter");
56642        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
56643          composeImplementationGuideDefinitionParameterComponent(null, e);
56644        closeArray();
56645      };
56646      if (element.hasTemplate()) {
56647        openArray("template");
56648        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
56649          composeImplementationGuideDefinitionTemplateComponent(null, e);
56650        closeArray();
56651      };
56652  }
56653
56654  protected void composeImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
56655    if (element != null) {
56656      open(name);
56657      composeImplementationGuideDefinitionGroupingComponentProperties(element);
56658      close();
56659    }
56660  }
56661
56662  protected void composeImplementationGuideDefinitionGroupingComponentProperties(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
56663    composeBackboneElementProperties(element);
56664      if (element.hasNameElement()) {
56665        composeStringCore("name", element.getNameElement(), false);
56666        composeStringExtras("name", element.getNameElement(), false);
56667      }
56668      if (element.hasDescriptionElement()) {
56669        composeMarkdownCore("description", element.getDescriptionElement(), false);
56670        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56671      }
56672  }
56673
56674  protected void composeImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
56675    if (element != null) {
56676      open(name);
56677      composeImplementationGuideDefinitionResourceComponentProperties(element);
56678      close();
56679    }
56680  }
56681
56682  protected void composeImplementationGuideDefinitionResourceComponentProperties(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
56683    composeBackboneElementProperties(element);
56684      if (element.hasReference()) {
56685        composeReference("reference", element.getReference());
56686      }
56687      if (element.hasFhirVersion()) {
56688        openArray("fhirVersion");
56689        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56690          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56691        closeArray();
56692        if (anyHasExtras(element.getFhirVersion())) {
56693          openArray("_fhirVersion");
56694          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56695            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56696          closeArray();
56697        }
56698      };
56699      if (element.hasNameElement()) {
56700        composeStringCore("name", element.getNameElement(), false);
56701        composeStringExtras("name", element.getNameElement(), false);
56702      }
56703      if (element.hasDescriptionElement()) {
56704        composeMarkdownCore("description", element.getDescriptionElement(), false);
56705        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56706      }
56707      if (element.hasIsExampleElement()) {
56708        composeBooleanCore("isExample", element.getIsExampleElement(), false);
56709        composeBooleanExtras("isExample", element.getIsExampleElement(), false);
56710      }
56711      if (element.hasProfile()) {
56712        if (anyHasValue(element.getProfile())) {
56713          openArray("profile");
56714          for (CanonicalType e : element.getProfile()) 
56715            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
56716          closeArray();
56717        }
56718        if (anyHasExtras(element.getProfile())) {
56719          openArray("_profile");
56720          for (CanonicalType e : element.getProfile()) 
56721            composeCanonicalExtras(null, e, true);
56722          closeArray();
56723        }
56724      };
56725      if (element.hasGroupingIdElement()) {
56726        composeIdCore("groupingId", element.getGroupingIdElement(), false);
56727        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
56728      }
56729  }
56730
56731  protected void composeImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
56732    if (element != null) {
56733      open(name);
56734      composeImplementationGuideDefinitionPageComponentProperties(element);
56735      close();
56736    }
56737  }
56738
56739  protected void composeImplementationGuideDefinitionPageComponentProperties(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
56740    composeBackboneElementProperties(element);
56741      if (element.hasSource()) {
56742        composeType("source", element.getSource());
56743      }
56744      if (element.hasNameElement()) {
56745        composeUrlCore("name", element.getNameElement(), false);
56746        composeUrlExtras("name", element.getNameElement(), false);
56747      }
56748      if (element.hasTitleElement()) {
56749        composeStringCore("title", element.getTitleElement(), false);
56750        composeStringExtras("title", element.getTitleElement(), false);
56751      }
56752      if (element.hasGenerationElement()) {
56753        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
56754        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
56755      }
56756      if (element.hasPage()) {
56757        openArray("page");
56758        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
56759          composeImplementationGuideDefinitionPageComponent(null, e);
56760        closeArray();
56761      };
56762  }
56763
56764  protected void composeImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
56765    if (element != null) {
56766      open(name);
56767      composeImplementationGuideDefinitionParameterComponentProperties(element);
56768      close();
56769    }
56770  }
56771
56772  protected void composeImplementationGuideDefinitionParameterComponentProperties(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
56773    composeBackboneElementProperties(element);
56774      if (element.hasCode()) {
56775        composeCoding("code", element.getCode());
56776      }
56777      if (element.hasValueElement()) {
56778        composeStringCore("value", element.getValueElement(), false);
56779        composeStringExtras("value", element.getValueElement(), false);
56780      }
56781  }
56782
56783  protected void composeImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
56784    if (element != null) {
56785      open(name);
56786      composeImplementationGuideDefinitionTemplateComponentProperties(element);
56787      close();
56788    }
56789  }
56790
56791  protected void composeImplementationGuideDefinitionTemplateComponentProperties(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
56792    composeBackboneElementProperties(element);
56793      if (element.hasCodeElement()) {
56794        composeCodeCore("code", element.getCodeElement(), false);
56795        composeCodeExtras("code", element.getCodeElement(), false);
56796      }
56797      if (element.hasSourceElement()) {
56798        composeStringCore("source", element.getSourceElement(), false);
56799        composeStringExtras("source", element.getSourceElement(), false);
56800      }
56801      if (element.hasScopeElement()) {
56802        composeStringCore("scope", element.getScopeElement(), false);
56803        composeStringExtras("scope", element.getScopeElement(), false);
56804      }
56805  }
56806
56807  protected void composeImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
56808    if (element != null) {
56809      open(name);
56810      composeImplementationGuideManifestComponentProperties(element);
56811      close();
56812    }
56813  }
56814
56815  protected void composeImplementationGuideManifestComponentProperties(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
56816    composeBackboneElementProperties(element);
56817      if (element.hasRenderingElement()) {
56818        composeUrlCore("rendering", element.getRenderingElement(), false);
56819        composeUrlExtras("rendering", element.getRenderingElement(), false);
56820      }
56821      if (element.hasResource()) {
56822        openArray("resource");
56823        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
56824          composeManifestResourceComponent(null, e);
56825        closeArray();
56826      };
56827      if (element.hasPage()) {
56828        openArray("page");
56829        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
56830          composeManifestPageComponent(null, e);
56831        closeArray();
56832      };
56833      if (element.hasImage()) {
56834        if (anyHasValue(element.getImage())) {
56835          openArray("image");
56836          for (StringType e : element.getImage()) 
56837            composeStringCore(null, e, e != element.getImage().get(element.getImage().size()-1));
56838          closeArray();
56839        }
56840        if (anyHasExtras(element.getImage())) {
56841          openArray("_image");
56842          for (StringType e : element.getImage()) 
56843            composeStringExtras(null, e, true);
56844          closeArray();
56845        }
56846      };
56847      if (element.hasOther()) {
56848        if (anyHasValue(element.getOther())) {
56849          openArray("other");
56850          for (StringType e : element.getOther()) 
56851            composeStringCore(null, e, e != element.getOther().get(element.getOther().size()-1));
56852          closeArray();
56853        }
56854        if (anyHasExtras(element.getOther())) {
56855          openArray("_other");
56856          for (StringType e : element.getOther()) 
56857            composeStringExtras(null, e, true);
56858          closeArray();
56859        }
56860      };
56861  }
56862
56863  protected void composeManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
56864    if (element != null) {
56865      open(name);
56866      composeManifestResourceComponentProperties(element);
56867      close();
56868    }
56869  }
56870
56871  protected void composeManifestResourceComponentProperties(ImplementationGuide.ManifestResourceComponent element) throws IOException {
56872    composeBackboneElementProperties(element);
56873      if (element.hasReference()) {
56874        composeReference("reference", element.getReference());
56875      }
56876      if (element.hasIsExampleElement()) {
56877        composeBooleanCore("isExample", element.getIsExampleElement(), false);
56878        composeBooleanExtras("isExample", element.getIsExampleElement(), false);
56879      }
56880      if (element.hasProfile()) {
56881        if (anyHasValue(element.getProfile())) {
56882          openArray("profile");
56883          for (CanonicalType e : element.getProfile()) 
56884            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
56885          closeArray();
56886        }
56887        if (anyHasExtras(element.getProfile())) {
56888          openArray("_profile");
56889          for (CanonicalType e : element.getProfile()) 
56890            composeCanonicalExtras(null, e, true);
56891          closeArray();
56892        }
56893      };
56894      if (element.hasRelativePathElement()) {
56895        composeUrlCore("relativePath", element.getRelativePathElement(), false);
56896        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
56897      }
56898  }
56899
56900  protected void composeManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
56901    if (element != null) {
56902      open(name);
56903      composeManifestPageComponentProperties(element);
56904      close();
56905    }
56906  }
56907
56908  protected void composeManifestPageComponentProperties(ImplementationGuide.ManifestPageComponent element) throws IOException {
56909    composeBackboneElementProperties(element);
56910      if (element.hasNameElement()) {
56911        composeStringCore("name", element.getNameElement(), false);
56912        composeStringExtras("name", element.getNameElement(), false);
56913      }
56914      if (element.hasTitleElement()) {
56915        composeStringCore("title", element.getTitleElement(), false);
56916        composeStringExtras("title", element.getTitleElement(), false);
56917      }
56918      if (element.hasAnchor()) {
56919        if (anyHasValue(element.getAnchor())) {
56920          openArray("anchor");
56921          for (StringType e : element.getAnchor()) 
56922            composeStringCore(null, e, e != element.getAnchor().get(element.getAnchor().size()-1));
56923          closeArray();
56924        }
56925        if (anyHasExtras(element.getAnchor())) {
56926          openArray("_anchor");
56927          for (StringType e : element.getAnchor()) 
56928            composeStringExtras(null, e, true);
56929          closeArray();
56930        }
56931      };
56932  }
56933
56934  protected void composeIngredient(String name, Ingredient element) throws IOException {
56935    if (element != null) {
56936      prop("resourceType", name);
56937      composeIngredientProperties(element);
56938    }
56939  }
56940
56941  protected void composeIngredientProperties(Ingredient element) throws IOException {
56942    composeDomainResourceProperties(element);
56943      if (element.hasIdentifier()) {
56944        composeIdentifier("identifier", element.getIdentifier());
56945      }
56946      if (element.hasStatusElement()) {
56947        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56948        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56949      }
56950      if (element.hasFor()) {
56951        openArray("for");
56952        for (Reference e : element.getFor()) 
56953          composeReference(null, e);
56954        closeArray();
56955      };
56956      if (element.hasRole()) {
56957        composeCodeableConcept("role", element.getRole());
56958      }
56959      if (element.hasFunction()) {
56960        openArray("function");
56961        for (CodeableConcept e : element.getFunction()) 
56962          composeCodeableConcept(null, e);
56963        closeArray();
56964      };
56965      if (element.hasGroup()) {
56966        composeCodeableConcept("group", element.getGroup());
56967      }
56968      if (element.hasAllergenicIndicatorElement()) {
56969        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
56970        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
56971      }
56972      if (element.hasCommentElement()) {
56973        composeMarkdownCore("comment", element.getCommentElement(), false);
56974        composeMarkdownExtras("comment", element.getCommentElement(), false);
56975      }
56976      if (element.hasManufacturer()) {
56977        openArray("manufacturer");
56978        for (Ingredient.IngredientManufacturerComponent e : element.getManufacturer()) 
56979          composeIngredientManufacturerComponent(null, e);
56980        closeArray();
56981      };
56982      if (element.hasSubstance()) {
56983        composeIngredientSubstanceComponent("substance", element.getSubstance());
56984      }
56985  }
56986
56987  protected void composeIngredientManufacturerComponent(String name, Ingredient.IngredientManufacturerComponent element) throws IOException {
56988    if (element != null) {
56989      open(name);
56990      composeIngredientManufacturerComponentProperties(element);
56991      close();
56992    }
56993  }
56994
56995  protected void composeIngredientManufacturerComponentProperties(Ingredient.IngredientManufacturerComponent element) throws IOException {
56996    composeBackboneElementProperties(element);
56997      if (element.hasRoleElement()) {
56998        composeEnumerationCore("role", element.getRoleElement(), new Ingredient.IngredientManufacturerRoleEnumFactory(), false);
56999        composeEnumerationExtras("role", element.getRoleElement(), new Ingredient.IngredientManufacturerRoleEnumFactory(), false);
57000      }
57001      if (element.hasManufacturer()) {
57002        composeReference("manufacturer", element.getManufacturer());
57003      }
57004  }
57005
57006  protected void composeIngredientSubstanceComponent(String name, Ingredient.IngredientSubstanceComponent element) throws IOException {
57007    if (element != null) {
57008      open(name);
57009      composeIngredientSubstanceComponentProperties(element);
57010      close();
57011    }
57012  }
57013
57014  protected void composeIngredientSubstanceComponentProperties(Ingredient.IngredientSubstanceComponent element) throws IOException {
57015    composeBackboneElementProperties(element);
57016      if (element.hasCode()) {
57017        composeCodeableReference("code", element.getCode());
57018      }
57019      if (element.hasStrength()) {
57020        openArray("strength");
57021        for (Ingredient.IngredientSubstanceStrengthComponent e : element.getStrength()) 
57022          composeIngredientSubstanceStrengthComponent(null, e);
57023        closeArray();
57024      };
57025  }
57026
57027  protected void composeIngredientSubstanceStrengthComponent(String name, Ingredient.IngredientSubstanceStrengthComponent element) throws IOException {
57028    if (element != null) {
57029      open(name);
57030      composeIngredientSubstanceStrengthComponentProperties(element);
57031      close();
57032    }
57033  }
57034
57035  protected void composeIngredientSubstanceStrengthComponentProperties(Ingredient.IngredientSubstanceStrengthComponent element) throws IOException {
57036    composeBackboneElementProperties(element);
57037      if (element.hasPresentation()) {
57038        composeType("presentation", element.getPresentation());
57039      }
57040      if (element.hasTextPresentationElement()) {
57041        composeStringCore("textPresentation", element.getTextPresentationElement(), false);
57042        composeStringExtras("textPresentation", element.getTextPresentationElement(), false);
57043      }
57044      if (element.hasConcentration()) {
57045        composeType("concentration", element.getConcentration());
57046      }
57047      if (element.hasTextConcentrationElement()) {
57048        composeStringCore("textConcentration", element.getTextConcentrationElement(), false);
57049        composeStringExtras("textConcentration", element.getTextConcentrationElement(), false);
57050      }
57051      if (element.hasBasis()) {
57052        composeCodeableConcept("basis", element.getBasis());
57053      }
57054      if (element.hasMeasurementPointElement()) {
57055        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
57056        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
57057      }
57058      if (element.hasCountry()) {
57059        openArray("country");
57060        for (CodeableConcept e : element.getCountry()) 
57061          composeCodeableConcept(null, e);
57062        closeArray();
57063      };
57064      if (element.hasReferenceStrength()) {
57065        openArray("referenceStrength");
57066        for (Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
57067          composeIngredientSubstanceStrengthReferenceStrengthComponent(null, e);
57068        closeArray();
57069      };
57070  }
57071
57072  protected void composeIngredientSubstanceStrengthReferenceStrengthComponent(String name, Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent element) throws IOException {
57073    if (element != null) {
57074      open(name);
57075      composeIngredientSubstanceStrengthReferenceStrengthComponentProperties(element);
57076      close();
57077    }
57078  }
57079
57080  protected void composeIngredientSubstanceStrengthReferenceStrengthComponentProperties(Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent element) throws IOException {
57081    composeBackboneElementProperties(element);
57082      if (element.hasSubstance()) {
57083        composeCodeableReference("substance", element.getSubstance());
57084      }
57085      if (element.hasStrength()) {
57086        composeType("strength", element.getStrength());
57087      }
57088      if (element.hasMeasurementPointElement()) {
57089        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
57090        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
57091      }
57092      if (element.hasCountry()) {
57093        openArray("country");
57094        for (CodeableConcept e : element.getCountry()) 
57095          composeCodeableConcept(null, e);
57096        closeArray();
57097      };
57098  }
57099
57100  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
57101    if (element != null) {
57102      prop("resourceType", name);
57103      composeInsurancePlanProperties(element);
57104    }
57105  }
57106
57107  protected void composeInsurancePlanProperties(InsurancePlan element) throws IOException {
57108    composeDomainResourceProperties(element);
57109      if (element.hasIdentifier()) {
57110        openArray("identifier");
57111        for (Identifier e : element.getIdentifier()) 
57112          composeIdentifier(null, e);
57113        closeArray();
57114      };
57115      if (element.hasStatusElement()) {
57116        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57117        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57118      }
57119      if (element.hasType()) {
57120        openArray("type");
57121        for (CodeableConcept e : element.getType()) 
57122          composeCodeableConcept(null, e);
57123        closeArray();
57124      };
57125      if (element.hasNameElement()) {
57126        composeStringCore("name", element.getNameElement(), false);
57127        composeStringExtras("name", element.getNameElement(), false);
57128      }
57129      if (element.hasAlias()) {
57130        if (anyHasValue(element.getAlias())) {
57131          openArray("alias");
57132          for (StringType e : element.getAlias()) 
57133            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
57134          closeArray();
57135        }
57136        if (anyHasExtras(element.getAlias())) {
57137          openArray("_alias");
57138          for (StringType e : element.getAlias()) 
57139            composeStringExtras(null, e, true);
57140          closeArray();
57141        }
57142      };
57143      if (element.hasPeriod()) {
57144        composePeriod("period", element.getPeriod());
57145      }
57146      if (element.hasOwnedBy()) {
57147        composeReference("ownedBy", element.getOwnedBy());
57148      }
57149      if (element.hasAdministeredBy()) {
57150        composeReference("administeredBy", element.getAdministeredBy());
57151      }
57152      if (element.hasCoverageArea()) {
57153        openArray("coverageArea");
57154        for (Reference e : element.getCoverageArea()) 
57155          composeReference(null, e);
57156        closeArray();
57157      };
57158      if (element.hasContact()) {
57159        openArray("contact");
57160        for (ExtendedContactDetail e : element.getContact()) 
57161          composeExtendedContactDetail(null, e);
57162        closeArray();
57163      };
57164      if (element.hasEndpoint()) {
57165        openArray("endpoint");
57166        for (Reference e : element.getEndpoint()) 
57167          composeReference(null, e);
57168        closeArray();
57169      };
57170      if (element.hasNetwork()) {
57171        openArray("network");
57172        for (Reference e : element.getNetwork()) 
57173          composeReference(null, e);
57174        closeArray();
57175      };
57176      if (element.hasCoverage()) {
57177        openArray("coverage");
57178        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
57179          composeInsurancePlanCoverageComponent(null, e);
57180        closeArray();
57181      };
57182      if (element.hasPlan()) {
57183        openArray("plan");
57184        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
57185          composeInsurancePlanPlanComponent(null, e);
57186        closeArray();
57187      };
57188  }
57189
57190  protected void composeInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
57191    if (element != null) {
57192      open(name);
57193      composeInsurancePlanCoverageComponentProperties(element);
57194      close();
57195    }
57196  }
57197
57198  protected void composeInsurancePlanCoverageComponentProperties(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
57199    composeBackboneElementProperties(element);
57200      if (element.hasType()) {
57201        composeCodeableConcept("type", element.getType());
57202      }
57203      if (element.hasNetwork()) {
57204        openArray("network");
57205        for (Reference e : element.getNetwork()) 
57206          composeReference(null, e);
57207        closeArray();
57208      };
57209      if (element.hasBenefit()) {
57210        openArray("benefit");
57211        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
57212          composeCoverageBenefitComponent(null, e);
57213        closeArray();
57214      };
57215  }
57216
57217  protected void composeCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
57218    if (element != null) {
57219      open(name);
57220      composeCoverageBenefitComponentProperties(element);
57221      close();
57222    }
57223  }
57224
57225  protected void composeCoverageBenefitComponentProperties(InsurancePlan.CoverageBenefitComponent element) throws IOException {
57226    composeBackboneElementProperties(element);
57227      if (element.hasType()) {
57228        composeCodeableConcept("type", element.getType());
57229      }
57230      if (element.hasRequirementElement()) {
57231        composeStringCore("requirement", element.getRequirementElement(), false);
57232        composeStringExtras("requirement", element.getRequirementElement(), false);
57233      }
57234      if (element.hasLimit()) {
57235        openArray("limit");
57236        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
57237          composeCoverageBenefitLimitComponent(null, e);
57238        closeArray();
57239      };
57240  }
57241
57242  protected void composeCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
57243    if (element != null) {
57244      open(name);
57245      composeCoverageBenefitLimitComponentProperties(element);
57246      close();
57247    }
57248  }
57249
57250  protected void composeCoverageBenefitLimitComponentProperties(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
57251    composeBackboneElementProperties(element);
57252      if (element.hasValue()) {
57253        composeQuantity("value", element.getValue());
57254      }
57255      if (element.hasCode()) {
57256        composeCodeableConcept("code", element.getCode());
57257      }
57258  }
57259
57260  protected void composeInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
57261    if (element != null) {
57262      open(name);
57263      composeInsurancePlanPlanComponentProperties(element);
57264      close();
57265    }
57266  }
57267
57268  protected void composeInsurancePlanPlanComponentProperties(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
57269    composeBackboneElementProperties(element);
57270      if (element.hasIdentifier()) {
57271        openArray("identifier");
57272        for (Identifier e : element.getIdentifier()) 
57273          composeIdentifier(null, e);
57274        closeArray();
57275      };
57276      if (element.hasType()) {
57277        composeCodeableConcept("type", element.getType());
57278      }
57279      if (element.hasCoverageArea()) {
57280        openArray("coverageArea");
57281        for (Reference e : element.getCoverageArea()) 
57282          composeReference(null, e);
57283        closeArray();
57284      };
57285      if (element.hasNetwork()) {
57286        openArray("network");
57287        for (Reference e : element.getNetwork()) 
57288          composeReference(null, e);
57289        closeArray();
57290      };
57291      if (element.hasGeneralCost()) {
57292        openArray("generalCost");
57293        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
57294          composeInsurancePlanPlanGeneralCostComponent(null, e);
57295        closeArray();
57296      };
57297      if (element.hasSpecificCost()) {
57298        openArray("specificCost");
57299        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
57300          composeInsurancePlanPlanSpecificCostComponent(null, e);
57301        closeArray();
57302      };
57303  }
57304
57305  protected void composeInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
57306    if (element != null) {
57307      open(name);
57308      composeInsurancePlanPlanGeneralCostComponentProperties(element);
57309      close();
57310    }
57311  }
57312
57313  protected void composeInsurancePlanPlanGeneralCostComponentProperties(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
57314    composeBackboneElementProperties(element);
57315      if (element.hasType()) {
57316        composeCodeableConcept("type", element.getType());
57317      }
57318      if (element.hasGroupSizeElement()) {
57319        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
57320        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
57321      }
57322      if (element.hasCost()) {
57323        composeMoney("cost", element.getCost());
57324      }
57325      if (element.hasCommentElement()) {
57326        composeStringCore("comment", element.getCommentElement(), false);
57327        composeStringExtras("comment", element.getCommentElement(), false);
57328      }
57329  }
57330
57331  protected void composeInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
57332    if (element != null) {
57333      open(name);
57334      composeInsurancePlanPlanSpecificCostComponentProperties(element);
57335      close();
57336    }
57337  }
57338
57339  protected void composeInsurancePlanPlanSpecificCostComponentProperties(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
57340    composeBackboneElementProperties(element);
57341      if (element.hasCategory()) {
57342        composeCodeableConcept("category", element.getCategory());
57343      }
57344      if (element.hasBenefit()) {
57345        openArray("benefit");
57346        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
57347          composePlanBenefitComponent(null, e);
57348        closeArray();
57349      };
57350  }
57351
57352  protected void composePlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
57353    if (element != null) {
57354      open(name);
57355      composePlanBenefitComponentProperties(element);
57356      close();
57357    }
57358  }
57359
57360  protected void composePlanBenefitComponentProperties(InsurancePlan.PlanBenefitComponent element) throws IOException {
57361    composeBackboneElementProperties(element);
57362      if (element.hasType()) {
57363        composeCodeableConcept("type", element.getType());
57364      }
57365      if (element.hasCost()) {
57366        openArray("cost");
57367        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
57368          composePlanBenefitCostComponent(null, e);
57369        closeArray();
57370      };
57371  }
57372
57373  protected void composePlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
57374    if (element != null) {
57375      open(name);
57376      composePlanBenefitCostComponentProperties(element);
57377      close();
57378    }
57379  }
57380
57381  protected void composePlanBenefitCostComponentProperties(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
57382    composeBackboneElementProperties(element);
57383      if (element.hasType()) {
57384        composeCodeableConcept("type", element.getType());
57385      }
57386      if (element.hasApplicability()) {
57387        composeCodeableConcept("applicability", element.getApplicability());
57388      }
57389      if (element.hasQualifiers()) {
57390        openArray("qualifiers");
57391        for (CodeableConcept e : element.getQualifiers()) 
57392          composeCodeableConcept(null, e);
57393        closeArray();
57394      };
57395      if (element.hasValue()) {
57396        composeQuantity("value", element.getValue());
57397      }
57398  }
57399
57400  protected void composeInventoryItem(String name, InventoryItem element) throws IOException {
57401    if (element != null) {
57402      prop("resourceType", name);
57403      composeInventoryItemProperties(element);
57404    }
57405  }
57406
57407  protected void composeInventoryItemProperties(InventoryItem element) throws IOException {
57408    composeDomainResourceProperties(element);
57409      if (element.hasIdentifier()) {
57410        openArray("identifier");
57411        for (Identifier e : element.getIdentifier()) 
57412          composeIdentifier(null, e);
57413        closeArray();
57414      };
57415      if (element.hasStatusElement()) {
57416        composeEnumerationCore("status", element.getStatusElement(), new InventoryItem.InventoryItemStatusCodesEnumFactory(), false);
57417        composeEnumerationExtras("status", element.getStatusElement(), new InventoryItem.InventoryItemStatusCodesEnumFactory(), false);
57418      }
57419      if (element.hasCategory()) {
57420        openArray("category");
57421        for (CodeableConcept e : element.getCategory()) 
57422          composeCodeableConcept(null, e);
57423        closeArray();
57424      };
57425      if (element.hasCode()) {
57426        openArray("code");
57427        for (CodeableConcept e : element.getCode()) 
57428          composeCodeableConcept(null, e);
57429        closeArray();
57430      };
57431      if (element.hasName()) {
57432        openArray("name");
57433        for (InventoryItem.InventoryItemNameComponent e : element.getName()) 
57434          composeInventoryItemNameComponent(null, e);
57435        closeArray();
57436      };
57437      if (element.hasResponsibleOrganization()) {
57438        openArray("responsibleOrganization");
57439        for (InventoryItem.InventoryItemResponsibleOrganizationComponent e : element.getResponsibleOrganization()) 
57440          composeInventoryItemResponsibleOrganizationComponent(null, e);
57441        closeArray();
57442      };
57443      if (element.hasDescription()) {
57444        composeInventoryItemDescriptionComponent("description", element.getDescription());
57445      }
57446      if (element.hasInventoryStatus()) {
57447        openArray("inventoryStatus");
57448        for (CodeableConcept e : element.getInventoryStatus()) 
57449          composeCodeableConcept(null, e);
57450        closeArray();
57451      };
57452      if (element.hasBaseUnit()) {
57453        composeCodeableConcept("baseUnit", element.getBaseUnit());
57454      }
57455      if (element.hasNetContent()) {
57456        composeQuantity("netContent", element.getNetContent());
57457      }
57458      if (element.hasAssociation()) {
57459        openArray("association");
57460        for (InventoryItem.InventoryItemAssociationComponent e : element.getAssociation()) 
57461          composeInventoryItemAssociationComponent(null, e);
57462        closeArray();
57463      };
57464      if (element.hasCharacteristic()) {
57465        openArray("characteristic");
57466        for (InventoryItem.InventoryItemCharacteristicComponent e : element.getCharacteristic()) 
57467          composeInventoryItemCharacteristicComponent(null, e);
57468        closeArray();
57469      };
57470      if (element.hasInstance()) {
57471        composeInventoryItemInstanceComponent("instance", element.getInstance());
57472      }
57473      if (element.hasProductReference()) {
57474        composeReference("productReference", element.getProductReference());
57475      }
57476  }
57477
57478  protected void composeInventoryItemNameComponent(String name, InventoryItem.InventoryItemNameComponent element) throws IOException {
57479    if (element != null) {
57480      open(name);
57481      composeInventoryItemNameComponentProperties(element);
57482      close();
57483    }
57484  }
57485
57486  protected void composeInventoryItemNameComponentProperties(InventoryItem.InventoryItemNameComponent element) throws IOException {
57487    composeBackboneElementProperties(element);
57488      if (element.hasNameType()) {
57489        composeCoding("nameType", element.getNameType());
57490      }
57491      if (element.hasLanguageElement()) {
57492        composeEnumerationCore("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57493        composeEnumerationExtras("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57494      }
57495      if (element.hasNameElement()) {
57496        composeStringCore("name", element.getNameElement(), false);
57497        composeStringExtras("name", element.getNameElement(), false);
57498      }
57499  }
57500
57501  protected void composeInventoryItemResponsibleOrganizationComponent(String name, InventoryItem.InventoryItemResponsibleOrganizationComponent element) throws IOException {
57502    if (element != null) {
57503      open(name);
57504      composeInventoryItemResponsibleOrganizationComponentProperties(element);
57505      close();
57506    }
57507  }
57508
57509  protected void composeInventoryItemResponsibleOrganizationComponentProperties(InventoryItem.InventoryItemResponsibleOrganizationComponent element) throws IOException {
57510    composeBackboneElementProperties(element);
57511      if (element.hasRole()) {
57512        composeCodeableConcept("role", element.getRole());
57513      }
57514      if (element.hasOrganization()) {
57515        composeReference("organization", element.getOrganization());
57516      }
57517  }
57518
57519  protected void composeInventoryItemDescriptionComponent(String name, InventoryItem.InventoryItemDescriptionComponent element) throws IOException {
57520    if (element != null) {
57521      open(name);
57522      composeInventoryItemDescriptionComponentProperties(element);
57523      close();
57524    }
57525  }
57526
57527  protected void composeInventoryItemDescriptionComponentProperties(InventoryItem.InventoryItemDescriptionComponent element) throws IOException {
57528    composeBackboneElementProperties(element);
57529      if (element.hasLanguageElement()) {
57530        composeEnumerationCore("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57531        composeEnumerationExtras("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57532      }
57533      if (element.hasDescriptionElement()) {
57534        composeStringCore("description", element.getDescriptionElement(), false);
57535        composeStringExtras("description", element.getDescriptionElement(), false);
57536      }
57537  }
57538
57539  protected void composeInventoryItemAssociationComponent(String name, InventoryItem.InventoryItemAssociationComponent element) throws IOException {
57540    if (element != null) {
57541      open(name);
57542      composeInventoryItemAssociationComponentProperties(element);
57543      close();
57544    }
57545  }
57546
57547  protected void composeInventoryItemAssociationComponentProperties(InventoryItem.InventoryItemAssociationComponent element) throws IOException {
57548    composeBackboneElementProperties(element);
57549      if (element.hasAssociationType()) {
57550        composeCodeableConcept("associationType", element.getAssociationType());
57551      }
57552      if (element.hasRelatedItem()) {
57553        composeReference("relatedItem", element.getRelatedItem());
57554      }
57555      if (element.hasQuantity()) {
57556        composeRatio("quantity", element.getQuantity());
57557      }
57558  }
57559
57560  protected void composeInventoryItemCharacteristicComponent(String name, InventoryItem.InventoryItemCharacteristicComponent element) throws IOException {
57561    if (element != null) {
57562      open(name);
57563      composeInventoryItemCharacteristicComponentProperties(element);
57564      close();
57565    }
57566  }
57567
57568  protected void composeInventoryItemCharacteristicComponentProperties(InventoryItem.InventoryItemCharacteristicComponent element) throws IOException {
57569    composeBackboneElementProperties(element);
57570      if (element.hasCharacteristicType()) {
57571        composeCodeableConcept("characteristicType", element.getCharacteristicType());
57572      }
57573      if (element.hasValue()) {
57574        composeType("value", element.getValue());
57575      }
57576  }
57577
57578  protected void composeInventoryItemInstanceComponent(String name, InventoryItem.InventoryItemInstanceComponent element) throws IOException {
57579    if (element != null) {
57580      open(name);
57581      composeInventoryItemInstanceComponentProperties(element);
57582      close();
57583    }
57584  }
57585
57586  protected void composeInventoryItemInstanceComponentProperties(InventoryItem.InventoryItemInstanceComponent element) throws IOException {
57587    composeBackboneElementProperties(element);
57588      if (element.hasIdentifier()) {
57589        openArray("identifier");
57590        for (Identifier e : element.getIdentifier()) 
57591          composeIdentifier(null, e);
57592        closeArray();
57593      };
57594      if (element.hasLotNumberElement()) {
57595        composeStringCore("lotNumber", element.getLotNumberElement(), false);
57596        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
57597      }
57598      if (element.hasExpiryElement()) {
57599        composeDateTimeCore("expiry", element.getExpiryElement(), false);
57600        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
57601      }
57602      if (element.hasSubject()) {
57603        composeReference("subject", element.getSubject());
57604      }
57605      if (element.hasLocation()) {
57606        composeReference("location", element.getLocation());
57607      }
57608  }
57609
57610  protected void composeInventoryReport(String name, InventoryReport element) throws IOException {
57611    if (element != null) {
57612      prop("resourceType", name);
57613      composeInventoryReportProperties(element);
57614    }
57615  }
57616
57617  protected void composeInventoryReportProperties(InventoryReport element) throws IOException {
57618    composeDomainResourceProperties(element);
57619      if (element.hasIdentifier()) {
57620        openArray("identifier");
57621        for (Identifier e : element.getIdentifier()) 
57622          composeIdentifier(null, e);
57623        closeArray();
57624      };
57625      if (element.hasStatusElement()) {
57626        composeEnumerationCore("status", element.getStatusElement(), new InventoryReport.InventoryReportStatusEnumFactory(), false);
57627        composeEnumerationExtras("status", element.getStatusElement(), new InventoryReport.InventoryReportStatusEnumFactory(), false);
57628      }
57629      if (element.hasCountTypeElement()) {
57630        composeEnumerationCore("countType", element.getCountTypeElement(), new InventoryReport.InventoryCountTypeEnumFactory(), false);
57631        composeEnumerationExtras("countType", element.getCountTypeElement(), new InventoryReport.InventoryCountTypeEnumFactory(), false);
57632      }
57633      if (element.hasOperationType()) {
57634        composeCodeableConcept("operationType", element.getOperationType());
57635      }
57636      if (element.hasOperationTypeReason()) {
57637        composeCodeableConcept("operationTypeReason", element.getOperationTypeReason());
57638      }
57639      if (element.hasReportedDateTimeElement()) {
57640        composeDateTimeCore("reportedDateTime", element.getReportedDateTimeElement(), false);
57641        composeDateTimeExtras("reportedDateTime", element.getReportedDateTimeElement(), false);
57642      }
57643      if (element.hasReporter()) {
57644        composeReference("reporter", element.getReporter());
57645      }
57646      if (element.hasReportingPeriod()) {
57647        composePeriod("reportingPeriod", element.getReportingPeriod());
57648      }
57649      if (element.hasInventoryListing()) {
57650        openArray("inventoryListing");
57651        for (InventoryReport.InventoryReportInventoryListingComponent e : element.getInventoryListing()) 
57652          composeInventoryReportInventoryListingComponent(null, e);
57653        closeArray();
57654      };
57655      if (element.hasNote()) {
57656        openArray("note");
57657        for (Annotation e : element.getNote()) 
57658          composeAnnotation(null, e);
57659        closeArray();
57660      };
57661  }
57662
57663  protected void composeInventoryReportInventoryListingComponent(String name, InventoryReport.InventoryReportInventoryListingComponent element) throws IOException {
57664    if (element != null) {
57665      open(name);
57666      composeInventoryReportInventoryListingComponentProperties(element);
57667      close();
57668    }
57669  }
57670
57671  protected void composeInventoryReportInventoryListingComponentProperties(InventoryReport.InventoryReportInventoryListingComponent element) throws IOException {
57672    composeBackboneElementProperties(element);
57673      if (element.hasLocation()) {
57674        composeReference("location", element.getLocation());
57675      }
57676      if (element.hasItemStatus()) {
57677        composeCodeableConcept("itemStatus", element.getItemStatus());
57678      }
57679      if (element.hasCountingDateTimeElement()) {
57680        composeDateTimeCore("countingDateTime", element.getCountingDateTimeElement(), false);
57681        composeDateTimeExtras("countingDateTime", element.getCountingDateTimeElement(), false);
57682      }
57683      if (element.hasItem()) {
57684        openArray("item");
57685        for (InventoryReport.InventoryReportInventoryListingItemComponent e : element.getItem()) 
57686          composeInventoryReportInventoryListingItemComponent(null, e);
57687        closeArray();
57688      };
57689  }
57690
57691  protected void composeInventoryReportInventoryListingItemComponent(String name, InventoryReport.InventoryReportInventoryListingItemComponent element) throws IOException {
57692    if (element != null) {
57693      open(name);
57694      composeInventoryReportInventoryListingItemComponentProperties(element);
57695      close();
57696    }
57697  }
57698
57699  protected void composeInventoryReportInventoryListingItemComponentProperties(InventoryReport.InventoryReportInventoryListingItemComponent element) throws IOException {
57700    composeBackboneElementProperties(element);
57701      if (element.hasCategory()) {
57702        composeCodeableConcept("category", element.getCategory());
57703      }
57704      if (element.hasQuantity()) {
57705        composeQuantity("quantity", element.getQuantity());
57706      }
57707      if (element.hasItem()) {
57708        composeCodeableReference("item", element.getItem());
57709      }
57710  }
57711
57712  protected void composeInvoice(String name, Invoice element) throws IOException {
57713    if (element != null) {
57714      prop("resourceType", name);
57715      composeInvoiceProperties(element);
57716    }
57717  }
57718
57719  protected void composeInvoiceProperties(Invoice element) throws IOException {
57720    composeDomainResourceProperties(element);
57721      if (element.hasIdentifier()) {
57722        openArray("identifier");
57723        for (Identifier e : element.getIdentifier()) 
57724          composeIdentifier(null, e);
57725        closeArray();
57726      };
57727      if (element.hasStatusElement()) {
57728        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
57729        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
57730      }
57731      if (element.hasCancelledReasonElement()) {
57732        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
57733        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
57734      }
57735      if (element.hasType()) {
57736        composeCodeableConcept("type", element.getType());
57737      }
57738      if (element.hasSubject()) {
57739        composeReference("subject", element.getSubject());
57740      }
57741      if (element.hasRecipient()) {
57742        composeReference("recipient", element.getRecipient());
57743      }
57744      if (element.hasDateElement()) {
57745        composeDateTimeCore("date", element.getDateElement(), false);
57746        composeDateTimeExtras("date", element.getDateElement(), false);
57747      }
57748      if (element.hasCreationElement()) {
57749        composeDateTimeCore("creation", element.getCreationElement(), false);
57750        composeDateTimeExtras("creation", element.getCreationElement(), false);
57751      }
57752      if (element.hasPeriod()) {
57753        composeType("period", element.getPeriod());
57754      }
57755      if (element.hasParticipant()) {
57756        openArray("participant");
57757        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
57758          composeInvoiceParticipantComponent(null, e);
57759        closeArray();
57760      };
57761      if (element.hasIssuer()) {
57762        composeReference("issuer", element.getIssuer());
57763      }
57764      if (element.hasAccount()) {
57765        composeReference("account", element.getAccount());
57766      }
57767      if (element.hasLineItem()) {
57768        openArray("lineItem");
57769        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
57770          composeInvoiceLineItemComponent(null, e);
57771        closeArray();
57772      };
57773      if (element.hasTotalPriceComponent()) {
57774        openArray("totalPriceComponent");
57775        for (MonetaryComponent e : element.getTotalPriceComponent()) 
57776          composeMonetaryComponent(null, e);
57777        closeArray();
57778      };
57779      if (element.hasTotalNet()) {
57780        composeMoney("totalNet", element.getTotalNet());
57781      }
57782      if (element.hasTotalGross()) {
57783        composeMoney("totalGross", element.getTotalGross());
57784      }
57785      if (element.hasPaymentTermsElement()) {
57786        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
57787        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
57788      }
57789      if (element.hasNote()) {
57790        openArray("note");
57791        for (Annotation e : element.getNote()) 
57792          composeAnnotation(null, e);
57793        closeArray();
57794      };
57795  }
57796
57797  protected void composeInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
57798    if (element != null) {
57799      open(name);
57800      composeInvoiceParticipantComponentProperties(element);
57801      close();
57802    }
57803  }
57804
57805  protected void composeInvoiceParticipantComponentProperties(Invoice.InvoiceParticipantComponent element) throws IOException {
57806    composeBackboneElementProperties(element);
57807      if (element.hasRole()) {
57808        composeCodeableConcept("role", element.getRole());
57809      }
57810      if (element.hasActor()) {
57811        composeReference("actor", element.getActor());
57812      }
57813  }
57814
57815  protected void composeInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
57816    if (element != null) {
57817      open(name);
57818      composeInvoiceLineItemComponentProperties(element);
57819      close();
57820    }
57821  }
57822
57823  protected void composeInvoiceLineItemComponentProperties(Invoice.InvoiceLineItemComponent element) throws IOException {
57824    composeBackboneElementProperties(element);
57825      if (element.hasSequenceElement()) {
57826        composePositiveIntCore("sequence", element.getSequenceElement(), false);
57827        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
57828      }
57829      if (element.hasServiced()) {
57830        composeType("serviced", element.getServiced());
57831      }
57832      if (element.hasChargeItem()) {
57833        composeType("chargeItem", element.getChargeItem());
57834      }
57835      if (element.hasPriceComponent()) {
57836        openArray("priceComponent");
57837        for (MonetaryComponent e : element.getPriceComponent()) 
57838          composeMonetaryComponent(null, e);
57839        closeArray();
57840      };
57841  }
57842
57843  protected void composeLibrary(String name, Library element) throws IOException {
57844    if (element != null) {
57845      prop("resourceType", name);
57846      composeLibraryProperties(element);
57847    }
57848  }
57849
57850  protected void composeLibraryProperties(Library element) throws IOException {
57851    composeMetadataResourceProperties(element);
57852      if (element.hasUrlElement()) {
57853        composeUriCore("url", element.getUrlElement(), false);
57854        composeUriExtras("url", element.getUrlElement(), false);
57855      }
57856      if (element.hasIdentifier()) {
57857        openArray("identifier");
57858        for (Identifier e : element.getIdentifier()) 
57859          composeIdentifier(null, e);
57860        closeArray();
57861      };
57862      if (element.hasVersionElement()) {
57863        composeStringCore("version", element.getVersionElement(), false);
57864        composeStringExtras("version", element.getVersionElement(), false);
57865      }
57866      if (element.hasVersionAlgorithm()) {
57867        composeType("versionAlgorithm", element.getVersionAlgorithm());
57868      }
57869      if (element.hasNameElement()) {
57870        composeStringCore("name", element.getNameElement(), false);
57871        composeStringExtras("name", element.getNameElement(), false);
57872      }
57873      if (element.hasTitleElement()) {
57874        composeStringCore("title", element.getTitleElement(), false);
57875        composeStringExtras("title", element.getTitleElement(), false);
57876      }
57877      if (element.hasSubtitleElement()) {
57878        composeStringCore("subtitle", element.getSubtitleElement(), false);
57879        composeStringExtras("subtitle", element.getSubtitleElement(), false);
57880      }
57881      if (element.hasStatusElement()) {
57882        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57883        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57884      }
57885      if (element.hasExperimentalElement()) {
57886        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57887        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57888      }
57889      if (element.hasType()) {
57890        composeCodeableConcept("type", element.getType());
57891      }
57892      if (element.hasSubject()) {
57893        composeType("subject", element.getSubject());
57894      }
57895      if (element.hasDateElement()) {
57896        composeDateTimeCore("date", element.getDateElement(), false);
57897        composeDateTimeExtras("date", element.getDateElement(), false);
57898      }
57899      if (element.hasPublisherElement()) {
57900        composeStringCore("publisher", element.getPublisherElement(), false);
57901        composeStringExtras("publisher", element.getPublisherElement(), false);
57902      }
57903      if (element.hasContact()) {
57904        openArray("contact");
57905        for (ContactDetail e : element.getContact()) 
57906          composeContactDetail(null, e);
57907        closeArray();
57908      };
57909      if (element.hasDescriptionElement()) {
57910        composeMarkdownCore("description", element.getDescriptionElement(), false);
57911        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57912      }
57913      if (element.hasUseContext()) {
57914        openArray("useContext");
57915        for (UsageContext e : element.getUseContext()) 
57916          composeUsageContext(null, e);
57917        closeArray();
57918      };
57919      if (element.hasJurisdiction()) {
57920        openArray("jurisdiction");
57921        for (CodeableConcept e : element.getJurisdiction()) 
57922          composeCodeableConcept(null, e);
57923        closeArray();
57924      };
57925      if (element.hasPurposeElement()) {
57926        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57927        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57928      }
57929      if (element.hasUsageElement()) {
57930        composeMarkdownCore("usage", element.getUsageElement(), false);
57931        composeMarkdownExtras("usage", element.getUsageElement(), false);
57932      }
57933      if (element.hasCopyrightElement()) {
57934        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57935        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57936      }
57937      if (element.hasCopyrightLabelElement()) {
57938        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
57939        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
57940      }
57941      if (element.hasApprovalDateElement()) {
57942        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
57943        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
57944      }
57945      if (element.hasLastReviewDateElement()) {
57946        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
57947        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
57948      }
57949      if (element.hasEffectivePeriod()) {
57950        composePeriod("effectivePeriod", element.getEffectivePeriod());
57951      }
57952      if (element.hasTopic()) {
57953        openArray("topic");
57954        for (CodeableConcept e : element.getTopic()) 
57955          composeCodeableConcept(null, e);
57956        closeArray();
57957      };
57958      if (element.hasAuthor()) {
57959        openArray("author");
57960        for (ContactDetail e : element.getAuthor()) 
57961          composeContactDetail(null, e);
57962        closeArray();
57963      };
57964      if (element.hasEditor()) {
57965        openArray("editor");
57966        for (ContactDetail e : element.getEditor()) 
57967          composeContactDetail(null, e);
57968        closeArray();
57969      };
57970      if (element.hasReviewer()) {
57971        openArray("reviewer");
57972        for (ContactDetail e : element.getReviewer()) 
57973          composeContactDetail(null, e);
57974        closeArray();
57975      };
57976      if (element.hasEndorser()) {
57977        openArray("endorser");
57978        for (ContactDetail e : element.getEndorser()) 
57979          composeContactDetail(null, e);
57980        closeArray();
57981      };
57982      if (element.hasRelatedArtifact()) {
57983        openArray("relatedArtifact");
57984        for (RelatedArtifact e : element.getRelatedArtifact()) 
57985          composeRelatedArtifact(null, e);
57986        closeArray();
57987      };
57988      if (element.hasParameter()) {
57989        openArray("parameter");
57990        for (ParameterDefinition e : element.getParameter()) 
57991          composeParameterDefinition(null, e);
57992        closeArray();
57993      };
57994      if (element.hasDataRequirement()) {
57995        openArray("dataRequirement");
57996        for (DataRequirement e : element.getDataRequirement()) 
57997          composeDataRequirement(null, e);
57998        closeArray();
57999      };
58000      if (element.hasContent()) {
58001        openArray("content");
58002        for (Attachment e : element.getContent()) 
58003          composeAttachment(null, e);
58004        closeArray();
58005      };
58006  }
58007
58008  protected void composeLinkage(String name, Linkage element) throws IOException {
58009    if (element != null) {
58010      prop("resourceType", name);
58011      composeLinkageProperties(element);
58012    }
58013  }
58014
58015  protected void composeLinkageProperties(Linkage element) throws IOException {
58016    composeDomainResourceProperties(element);
58017      if (element.hasActiveElement()) {
58018        composeBooleanCore("active", element.getActiveElement(), false);
58019        composeBooleanExtras("active", element.getActiveElement(), false);
58020      }
58021      if (element.hasAuthor()) {
58022        composeReference("author", element.getAuthor());
58023      }
58024      if (element.hasItem()) {
58025        openArray("item");
58026        for (Linkage.LinkageItemComponent e : element.getItem()) 
58027          composeLinkageItemComponent(null, e);
58028        closeArray();
58029      };
58030  }
58031
58032  protected void composeLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
58033    if (element != null) {
58034      open(name);
58035      composeLinkageItemComponentProperties(element);
58036      close();
58037    }
58038  }
58039
58040  protected void composeLinkageItemComponentProperties(Linkage.LinkageItemComponent element) throws IOException {
58041    composeBackboneElementProperties(element);
58042      if (element.hasTypeElement()) {
58043        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
58044        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
58045      }
58046      if (element.hasResource()) {
58047        composeReference("resource", element.getResource());
58048      }
58049  }
58050
58051  protected void composeListResource(String name, ListResource element) throws IOException {
58052    if (element != null) {
58053      prop("resourceType", name);
58054      composeListResourceProperties(element);
58055    }
58056  }
58057
58058  protected void composeListResourceProperties(ListResource element) throws IOException {
58059    composeDomainResourceProperties(element);
58060      if (element.hasIdentifier()) {
58061        openArray("identifier");
58062        for (Identifier e : element.getIdentifier()) 
58063          composeIdentifier(null, e);
58064        closeArray();
58065      };
58066      if (element.hasStatusElement()) {
58067        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
58068        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
58069      }
58070      if (element.hasModeElement()) {
58071        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
58072        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
58073      }
58074      if (element.hasTitleElement()) {
58075        composeStringCore("title", element.getTitleElement(), false);
58076        composeStringExtras("title", element.getTitleElement(), false);
58077      }
58078      if (element.hasCode()) {
58079        composeCodeableConcept("code", element.getCode());
58080      }
58081      if (element.hasSubject()) {
58082        openArray("subject");
58083        for (Reference e : element.getSubject()) 
58084          composeReference(null, e);
58085        closeArray();
58086      };
58087      if (element.hasEncounter()) {
58088        composeReference("encounter", element.getEncounter());
58089      }
58090      if (element.hasDateElement()) {
58091        composeDateTimeCore("date", element.getDateElement(), false);
58092        composeDateTimeExtras("date", element.getDateElement(), false);
58093      }
58094      if (element.hasSource()) {
58095        composeReference("source", element.getSource());
58096      }
58097      if (element.hasOrderedBy()) {
58098        composeCodeableConcept("orderedBy", element.getOrderedBy());
58099      }
58100      if (element.hasNote()) {
58101        openArray("note");
58102        for (Annotation e : element.getNote()) 
58103          composeAnnotation(null, e);
58104        closeArray();
58105      };
58106      if (element.hasEntry()) {
58107        openArray("entry");
58108        for (ListResource.ListResourceEntryComponent e : element.getEntry()) 
58109          composeListResourceEntryComponent(null, e);
58110        closeArray();
58111      };
58112      if (element.hasEmptyReason()) {
58113        composeCodeableConcept("emptyReason", element.getEmptyReason());
58114      }
58115  }
58116
58117  protected void composeListResourceEntryComponent(String name, ListResource.ListResourceEntryComponent element) throws IOException {
58118    if (element != null) {
58119      open(name);
58120      composeListResourceEntryComponentProperties(element);
58121      close();
58122    }
58123  }
58124
58125  protected void composeListResourceEntryComponentProperties(ListResource.ListResourceEntryComponent element) throws IOException {
58126    composeBackboneElementProperties(element);
58127      if (element.hasFlag()) {
58128        composeCodeableConcept("flag", element.getFlag());
58129      }
58130      if (element.hasDeletedElement()) {
58131        composeBooleanCore("deleted", element.getDeletedElement(), false);
58132        composeBooleanExtras("deleted", element.getDeletedElement(), false);
58133      }
58134      if (element.hasDateElement()) {
58135        composeDateTimeCore("date", element.getDateElement(), false);
58136        composeDateTimeExtras("date", element.getDateElement(), false);
58137      }
58138      if (element.hasItem()) {
58139        composeReference("item", element.getItem());
58140      }
58141  }
58142
58143  protected void composeLocation(String name, Location element) throws IOException {
58144    if (element != null) {
58145      prop("resourceType", name);
58146      composeLocationProperties(element);
58147    }
58148  }
58149
58150  protected void composeLocationProperties(Location element) throws IOException {
58151    composeDomainResourceProperties(element);
58152      if (element.hasIdentifier()) {
58153        openArray("identifier");
58154        for (Identifier e : element.getIdentifier()) 
58155          composeIdentifier(null, e);
58156        closeArray();
58157      };
58158      if (element.hasStatusElement()) {
58159        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
58160        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
58161      }
58162      if (element.hasOperationalStatus()) {
58163        composeCoding("operationalStatus", element.getOperationalStatus());
58164      }
58165      if (element.hasNameElement()) {
58166        composeStringCore("name", element.getNameElement(), false);
58167        composeStringExtras("name", element.getNameElement(), false);
58168      }
58169      if (element.hasAlias()) {
58170        if (anyHasValue(element.getAlias())) {
58171          openArray("alias");
58172          for (StringType e : element.getAlias()) 
58173            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
58174          closeArray();
58175        }
58176        if (anyHasExtras(element.getAlias())) {
58177          openArray("_alias");
58178          for (StringType e : element.getAlias()) 
58179            composeStringExtras(null, e, true);
58180          closeArray();
58181        }
58182      };
58183      if (element.hasDescriptionElement()) {
58184        composeMarkdownCore("description", element.getDescriptionElement(), false);
58185        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58186      }
58187      if (element.hasModeElement()) {
58188        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
58189        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
58190      }
58191      if (element.hasType()) {
58192        openArray("type");
58193        for (CodeableConcept e : element.getType()) 
58194          composeCodeableConcept(null, e);
58195        closeArray();
58196      };
58197      if (element.hasContact()) {
58198        openArray("contact");
58199        for (ExtendedContactDetail e : element.getContact()) 
58200          composeExtendedContactDetail(null, e);
58201        closeArray();
58202      };
58203      if (element.hasAddress()) {
58204        composeAddress("address", element.getAddress());
58205      }
58206      if (element.hasForm()) {
58207        composeCodeableConcept("form", element.getForm());
58208      }
58209      if (element.hasPosition()) {
58210        composeLocationPositionComponent("position", element.getPosition());
58211      }
58212      if (element.hasManagingOrganization()) {
58213        composeReference("managingOrganization", element.getManagingOrganization());
58214      }
58215      if (element.hasPartOf()) {
58216        composeReference("partOf", element.getPartOf());
58217      }
58218      if (element.hasCharacteristic()) {
58219        openArray("characteristic");
58220        for (CodeableConcept e : element.getCharacteristic()) 
58221          composeCodeableConcept(null, e);
58222        closeArray();
58223      };
58224      if (element.hasHoursOfOperation()) {
58225        openArray("hoursOfOperation");
58226        for (Availability e : element.getHoursOfOperation()) 
58227          composeAvailability(null, e);
58228        closeArray();
58229      };
58230      if (element.hasVirtualService()) {
58231        openArray("virtualService");
58232        for (VirtualServiceDetail e : element.getVirtualService()) 
58233          composeVirtualServiceDetail(null, e);
58234        closeArray();
58235      };
58236      if (element.hasEndpoint()) {
58237        openArray("endpoint");
58238        for (Reference e : element.getEndpoint()) 
58239          composeReference(null, e);
58240        closeArray();
58241      };
58242  }
58243
58244  protected void composeLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
58245    if (element != null) {
58246      open(name);
58247      composeLocationPositionComponentProperties(element);
58248      close();
58249    }
58250  }
58251
58252  protected void composeLocationPositionComponentProperties(Location.LocationPositionComponent element) throws IOException {
58253    composeBackboneElementProperties(element);
58254      if (element.hasLongitudeElement()) {
58255        composeDecimalCore("longitude", element.getLongitudeElement(), false);
58256        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
58257      }
58258      if (element.hasLatitudeElement()) {
58259        composeDecimalCore("latitude", element.getLatitudeElement(), false);
58260        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
58261      }
58262      if (element.hasAltitudeElement()) {
58263        composeDecimalCore("altitude", element.getAltitudeElement(), false);
58264        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
58265      }
58266  }
58267
58268  protected void composeManufacturedItemDefinition(String name, ManufacturedItemDefinition element) throws IOException {
58269    if (element != null) {
58270      prop("resourceType", name);
58271      composeManufacturedItemDefinitionProperties(element);
58272    }
58273  }
58274
58275  protected void composeManufacturedItemDefinitionProperties(ManufacturedItemDefinition element) throws IOException {
58276    composeDomainResourceProperties(element);
58277      if (element.hasIdentifier()) {
58278        openArray("identifier");
58279        for (Identifier e : element.getIdentifier()) 
58280          composeIdentifier(null, e);
58281        closeArray();
58282      };
58283      if (element.hasStatusElement()) {
58284        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58285        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58286      }
58287      if (element.hasNameElement()) {
58288        composeStringCore("name", element.getNameElement(), false);
58289        composeStringExtras("name", element.getNameElement(), false);
58290      }
58291      if (element.hasManufacturedDoseForm()) {
58292        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
58293      }
58294      if (element.hasUnitOfPresentation()) {
58295        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
58296      }
58297      if (element.hasManufacturer()) {
58298        openArray("manufacturer");
58299        for (Reference e : element.getManufacturer()) 
58300          composeReference(null, e);
58301        closeArray();
58302      };
58303      if (element.hasMarketingStatus()) {
58304        openArray("marketingStatus");
58305        for (MarketingStatus e : element.getMarketingStatus()) 
58306          composeMarketingStatus(null, e);
58307        closeArray();
58308      };
58309      if (element.hasIngredient()) {
58310        openArray("ingredient");
58311        for (CodeableConcept e : element.getIngredient()) 
58312          composeCodeableConcept(null, e);
58313        closeArray();
58314      };
58315      if (element.hasProperty()) {
58316        openArray("property");
58317        for (ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent e : element.getProperty()) 
58318          composeManufacturedItemDefinitionPropertyComponent(null, e);
58319        closeArray();
58320      };
58321      if (element.hasComponent()) {
58322        openArray("component");
58323        for (ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent e : element.getComponent()) 
58324          composeManufacturedItemDefinitionComponentComponent(null, e);
58325        closeArray();
58326      };
58327  }
58328
58329  protected void composeManufacturedItemDefinitionPropertyComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
58330    if (element != null) {
58331      open(name);
58332      composeManufacturedItemDefinitionPropertyComponentProperties(element);
58333      close();
58334    }
58335  }
58336
58337  protected void composeManufacturedItemDefinitionPropertyComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
58338    composeBackboneElementProperties(element);
58339      if (element.hasType()) {
58340        composeCodeableConcept("type", element.getType());
58341      }
58342      if (element.hasValue()) {
58343        composeType("value", element.getValue());
58344      }
58345  }
58346
58347  protected void composeManufacturedItemDefinitionComponentComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent element) throws IOException {
58348    if (element != null) {
58349      open(name);
58350      composeManufacturedItemDefinitionComponentComponentProperties(element);
58351      close();
58352    }
58353  }
58354
58355  protected void composeManufacturedItemDefinitionComponentComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent element) throws IOException {
58356    composeBackboneElementProperties(element);
58357      if (element.hasType()) {
58358        composeCodeableConcept("type", element.getType());
58359      }
58360      if (element.hasFunction()) {
58361        openArray("function");
58362        for (CodeableConcept e : element.getFunction()) 
58363          composeCodeableConcept(null, e);
58364        closeArray();
58365      };
58366      if (element.hasAmount()) {
58367        openArray("amount");
58368        for (Quantity e : element.getAmount()) 
58369          composeQuantity(null, e);
58370        closeArray();
58371      };
58372      if (element.hasConstituent()) {
58373        openArray("constituent");
58374        for (ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent e : element.getConstituent()) 
58375          composeManufacturedItemDefinitionComponentConstituentComponent(null, e);
58376        closeArray();
58377      };
58378      if (element.hasProperty()) {
58379        openArray("property");
58380        for (ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent e : element.getProperty()) 
58381          composeManufacturedItemDefinitionPropertyComponent(null, e);
58382        closeArray();
58383      };
58384      if (element.hasComponent()) {
58385        openArray("component");
58386        for (ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent e : element.getComponent()) 
58387          composeManufacturedItemDefinitionComponentComponent(null, e);
58388        closeArray();
58389      };
58390  }
58391
58392  protected void composeManufacturedItemDefinitionComponentConstituentComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent element) throws IOException {
58393    if (element != null) {
58394      open(name);
58395      composeManufacturedItemDefinitionComponentConstituentComponentProperties(element);
58396      close();
58397    }
58398  }
58399
58400  protected void composeManufacturedItemDefinitionComponentConstituentComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent element) throws IOException {
58401    composeBackboneElementProperties(element);
58402      if (element.hasAmount()) {
58403        openArray("amount");
58404        for (Quantity e : element.getAmount()) 
58405          composeQuantity(null, e);
58406        closeArray();
58407      };
58408      if (element.hasLocation()) {
58409        openArray("location");
58410        for (CodeableConcept e : element.getLocation()) 
58411          composeCodeableConcept(null, e);
58412        closeArray();
58413      };
58414      if (element.hasFunction()) {
58415        openArray("function");
58416        for (CodeableConcept e : element.getFunction()) 
58417          composeCodeableConcept(null, e);
58418        closeArray();
58419      };
58420      if (element.hasHasIngredient()) {
58421        openArray("hasIngredient");
58422        for (CodeableReference e : element.getHasIngredient()) 
58423          composeCodeableReference(null, e);
58424        closeArray();
58425      };
58426  }
58427
58428  protected void composeMeasure(String name, Measure element) throws IOException {
58429    if (element != null) {
58430      prop("resourceType", name);
58431      composeMeasureProperties(element);
58432    }
58433  }
58434
58435  protected void composeMeasureProperties(Measure element) throws IOException {
58436    composeMetadataResourceProperties(element);
58437      if (element.hasUrlElement()) {
58438        composeUriCore("url", element.getUrlElement(), false);
58439        composeUriExtras("url", element.getUrlElement(), false);
58440      }
58441      if (element.hasIdentifier()) {
58442        openArray("identifier");
58443        for (Identifier e : element.getIdentifier()) 
58444          composeIdentifier(null, e);
58445        closeArray();
58446      };
58447      if (element.hasVersionElement()) {
58448        composeStringCore("version", element.getVersionElement(), false);
58449        composeStringExtras("version", element.getVersionElement(), false);
58450      }
58451      if (element.hasVersionAlgorithm()) {
58452        composeType("versionAlgorithm", element.getVersionAlgorithm());
58453      }
58454      if (element.hasNameElement()) {
58455        composeStringCore("name", element.getNameElement(), false);
58456        composeStringExtras("name", element.getNameElement(), false);
58457      }
58458      if (element.hasTitleElement()) {
58459        composeStringCore("title", element.getTitleElement(), false);
58460        composeStringExtras("title", element.getTitleElement(), false);
58461      }
58462      if (element.hasSubtitleElement()) {
58463        composeStringCore("subtitle", element.getSubtitleElement(), false);
58464        composeStringExtras("subtitle", element.getSubtitleElement(), false);
58465      }
58466      if (element.hasStatusElement()) {
58467        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58468        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58469      }
58470      if (element.hasExperimentalElement()) {
58471        composeBooleanCore("experimental", element.getExperimentalElement(), false);
58472        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58473      }
58474      if (element.hasSubject()) {
58475        composeType("subject", element.getSubject());
58476      }
58477      if (element.hasBasisElement()) {
58478        composeEnumerationCore("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58479        composeEnumerationExtras("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58480      }
58481      if (element.hasDateElement()) {
58482        composeDateTimeCore("date", element.getDateElement(), false);
58483        composeDateTimeExtras("date", element.getDateElement(), false);
58484      }
58485      if (element.hasPublisherElement()) {
58486        composeStringCore("publisher", element.getPublisherElement(), false);
58487        composeStringExtras("publisher", element.getPublisherElement(), false);
58488      }
58489      if (element.hasContact()) {
58490        openArray("contact");
58491        for (ContactDetail e : element.getContact()) 
58492          composeContactDetail(null, e);
58493        closeArray();
58494      };
58495      if (element.hasDescriptionElement()) {
58496        composeMarkdownCore("description", element.getDescriptionElement(), false);
58497        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58498      }
58499      if (element.hasUseContext()) {
58500        openArray("useContext");
58501        for (UsageContext e : element.getUseContext()) 
58502          composeUsageContext(null, e);
58503        closeArray();
58504      };
58505      if (element.hasJurisdiction()) {
58506        openArray("jurisdiction");
58507        for (CodeableConcept e : element.getJurisdiction()) 
58508          composeCodeableConcept(null, e);
58509        closeArray();
58510      };
58511      if (element.hasPurposeElement()) {
58512        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58513        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58514      }
58515      if (element.hasUsageElement()) {
58516        composeMarkdownCore("usage", element.getUsageElement(), false);
58517        composeMarkdownExtras("usage", element.getUsageElement(), false);
58518      }
58519      if (element.hasCopyrightElement()) {
58520        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58521        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58522      }
58523      if (element.hasCopyrightLabelElement()) {
58524        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
58525        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
58526      }
58527      if (element.hasApprovalDateElement()) {
58528        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
58529        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
58530      }
58531      if (element.hasLastReviewDateElement()) {
58532        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
58533        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
58534      }
58535      if (element.hasEffectivePeriod()) {
58536        composePeriod("effectivePeriod", element.getEffectivePeriod());
58537      }
58538      if (element.hasTopic()) {
58539        openArray("topic");
58540        for (CodeableConcept e : element.getTopic()) 
58541          composeCodeableConcept(null, e);
58542        closeArray();
58543      };
58544      if (element.hasAuthor()) {
58545        openArray("author");
58546        for (ContactDetail e : element.getAuthor()) 
58547          composeContactDetail(null, e);
58548        closeArray();
58549      };
58550      if (element.hasEditor()) {
58551        openArray("editor");
58552        for (ContactDetail e : element.getEditor()) 
58553          composeContactDetail(null, e);
58554        closeArray();
58555      };
58556      if (element.hasReviewer()) {
58557        openArray("reviewer");
58558        for (ContactDetail e : element.getReviewer()) 
58559          composeContactDetail(null, e);
58560        closeArray();
58561      };
58562      if (element.hasEndorser()) {
58563        openArray("endorser");
58564        for (ContactDetail e : element.getEndorser()) 
58565          composeContactDetail(null, e);
58566        closeArray();
58567      };
58568      if (element.hasRelatedArtifact()) {
58569        openArray("relatedArtifact");
58570        for (RelatedArtifact e : element.getRelatedArtifact()) 
58571          composeRelatedArtifact(null, e);
58572        closeArray();
58573      };
58574      if (element.hasLibrary()) {
58575        if (anyHasValue(element.getLibrary())) {
58576          openArray("library");
58577          for (CanonicalType e : element.getLibrary()) 
58578            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
58579          closeArray();
58580        }
58581        if (anyHasExtras(element.getLibrary())) {
58582          openArray("_library");
58583          for (CanonicalType e : element.getLibrary()) 
58584            composeCanonicalExtras(null, e, true);
58585          closeArray();
58586        }
58587      };
58588      if (element.hasDisclaimerElement()) {
58589        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
58590        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
58591      }
58592      if (element.hasScoring()) {
58593        composeCodeableConcept("scoring", element.getScoring());
58594      }
58595      if (element.hasScoringUnit()) {
58596        composeCodeableConcept("scoringUnit", element.getScoringUnit());
58597      }
58598      if (element.hasCompositeScoring()) {
58599        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
58600      }
58601      if (element.hasType()) {
58602        openArray("type");
58603        for (CodeableConcept e : element.getType()) 
58604          composeCodeableConcept(null, e);
58605        closeArray();
58606      };
58607      if (element.hasRiskAdjustmentElement()) {
58608        composeMarkdownCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
58609        composeMarkdownExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
58610      }
58611      if (element.hasRateAggregationElement()) {
58612        composeMarkdownCore("rateAggregation", element.getRateAggregationElement(), false);
58613        composeMarkdownExtras("rateAggregation", element.getRateAggregationElement(), false);
58614      }
58615      if (element.hasRationaleElement()) {
58616        composeMarkdownCore("rationale", element.getRationaleElement(), false);
58617        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
58618      }
58619      if (element.hasClinicalRecommendationStatementElement()) {
58620        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
58621        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
58622      }
58623      if (element.hasImprovementNotation()) {
58624        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
58625      }
58626      if (element.hasTerm()) {
58627        openArray("term");
58628        for (Measure.MeasureTermComponent e : element.getTerm()) 
58629          composeMeasureTermComponent(null, e);
58630        closeArray();
58631      };
58632      if (element.hasGuidanceElement()) {
58633        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
58634        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
58635      }
58636      if (element.hasGroup()) {
58637        openArray("group");
58638        for (Measure.MeasureGroupComponent e : element.getGroup()) 
58639          composeMeasureGroupComponent(null, e);
58640        closeArray();
58641      };
58642      if (element.hasSupplementalData()) {
58643        openArray("supplementalData");
58644        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
58645          composeMeasureSupplementalDataComponent(null, e);
58646        closeArray();
58647      };
58648  }
58649
58650  protected void composeMeasureTermComponent(String name, Measure.MeasureTermComponent element) throws IOException {
58651    if (element != null) {
58652      open(name);
58653      composeMeasureTermComponentProperties(element);
58654      close();
58655    }
58656  }
58657
58658  protected void composeMeasureTermComponentProperties(Measure.MeasureTermComponent element) throws IOException {
58659    composeBackboneElementProperties(element);
58660      if (element.hasCode()) {
58661        composeCodeableConcept("code", element.getCode());
58662      }
58663      if (element.hasDefinitionElement()) {
58664        composeMarkdownCore("definition", element.getDefinitionElement(), false);
58665        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
58666      }
58667  }
58668
58669  protected void composeMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
58670    if (element != null) {
58671      open(name);
58672      composeMeasureGroupComponentProperties(element);
58673      close();
58674    }
58675  }
58676
58677  protected void composeMeasureGroupComponentProperties(Measure.MeasureGroupComponent element) throws IOException {
58678    composeBackboneElementProperties(element);
58679      if (element.hasLinkIdElement()) {
58680        composeStringCore("linkId", element.getLinkIdElement(), false);
58681        composeStringExtras("linkId", element.getLinkIdElement(), false);
58682      }
58683      if (element.hasCode()) {
58684        composeCodeableConcept("code", element.getCode());
58685      }
58686      if (element.hasDescriptionElement()) {
58687        composeMarkdownCore("description", element.getDescriptionElement(), false);
58688        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58689      }
58690      if (element.hasType()) {
58691        openArray("type");
58692        for (CodeableConcept e : element.getType()) 
58693          composeCodeableConcept(null, e);
58694        closeArray();
58695      };
58696      if (element.hasSubject()) {
58697        composeType("subject", element.getSubject());
58698      }
58699      if (element.hasBasisElement()) {
58700        composeEnumerationCore("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58701        composeEnumerationExtras("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58702      }
58703      if (element.hasScoring()) {
58704        composeCodeableConcept("scoring", element.getScoring());
58705      }
58706      if (element.hasScoringUnit()) {
58707        composeCodeableConcept("scoringUnit", element.getScoringUnit());
58708      }
58709      if (element.hasRateAggregationElement()) {
58710        composeMarkdownCore("rateAggregation", element.getRateAggregationElement(), false);
58711        composeMarkdownExtras("rateAggregation", element.getRateAggregationElement(), false);
58712      }
58713      if (element.hasImprovementNotation()) {
58714        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
58715      }
58716      if (element.hasLibrary()) {
58717        if (anyHasValue(element.getLibrary())) {
58718          openArray("library");
58719          for (CanonicalType e : element.getLibrary()) 
58720            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
58721          closeArray();
58722        }
58723        if (anyHasExtras(element.getLibrary())) {
58724          openArray("_library");
58725          for (CanonicalType e : element.getLibrary()) 
58726            composeCanonicalExtras(null, e, true);
58727          closeArray();
58728        }
58729      };
58730      if (element.hasPopulation()) {
58731        openArray("population");
58732        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
58733          composeMeasureGroupPopulationComponent(null, e);
58734        closeArray();
58735      };
58736      if (element.hasStratifier()) {
58737        openArray("stratifier");
58738        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
58739          composeMeasureGroupStratifierComponent(null, e);
58740        closeArray();
58741      };
58742  }
58743
58744  protected void composeMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
58745    if (element != null) {
58746      open(name);
58747      composeMeasureGroupPopulationComponentProperties(element);
58748      close();
58749    }
58750  }
58751
58752  protected void composeMeasureGroupPopulationComponentProperties(Measure.MeasureGroupPopulationComponent element) throws IOException {
58753    composeBackboneElementProperties(element);
58754      if (element.hasLinkIdElement()) {
58755        composeStringCore("linkId", element.getLinkIdElement(), false);
58756        composeStringExtras("linkId", element.getLinkIdElement(), false);
58757      }
58758      if (element.hasCode()) {
58759        composeCodeableConcept("code", element.getCode());
58760      }
58761      if (element.hasDescriptionElement()) {
58762        composeMarkdownCore("description", element.getDescriptionElement(), false);
58763        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58764      }
58765      if (element.hasCriteria()) {
58766        composeExpression("criteria", element.getCriteria());
58767      }
58768      if (element.hasGroupDefinition()) {
58769        composeReference("groupDefinition", element.getGroupDefinition());
58770      }
58771      if (element.hasInputPopulationIdElement()) {
58772        composeStringCore("inputPopulationId", element.getInputPopulationIdElement(), false);
58773        composeStringExtras("inputPopulationId", element.getInputPopulationIdElement(), false);
58774      }
58775      if (element.hasAggregateMethod()) {
58776        composeCodeableConcept("aggregateMethod", element.getAggregateMethod());
58777      }
58778  }
58779
58780  protected void composeMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
58781    if (element != null) {
58782      open(name);
58783      composeMeasureGroupStratifierComponentProperties(element);
58784      close();
58785    }
58786  }
58787
58788  protected void composeMeasureGroupStratifierComponentProperties(Measure.MeasureGroupStratifierComponent element) throws IOException {
58789    composeBackboneElementProperties(element);
58790      if (element.hasLinkIdElement()) {
58791        composeStringCore("linkId", element.getLinkIdElement(), false);
58792        composeStringExtras("linkId", element.getLinkIdElement(), false);
58793      }
58794      if (element.hasCode()) {
58795        composeCodeableConcept("code", element.getCode());
58796      }
58797      if (element.hasDescriptionElement()) {
58798        composeMarkdownCore("description", element.getDescriptionElement(), false);
58799        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58800      }
58801      if (element.hasCriteria()) {
58802        composeExpression("criteria", element.getCriteria());
58803      }
58804      if (element.hasGroupDefinition()) {
58805        composeReference("groupDefinition", element.getGroupDefinition());
58806      }
58807      if (element.hasComponent()) {
58808        openArray("component");
58809        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
58810          composeMeasureGroupStratifierComponentComponent(null, e);
58811        closeArray();
58812      };
58813  }
58814
58815  protected void composeMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
58816    if (element != null) {
58817      open(name);
58818      composeMeasureGroupStratifierComponentComponentProperties(element);
58819      close();
58820    }
58821  }
58822
58823  protected void composeMeasureGroupStratifierComponentComponentProperties(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
58824    composeBackboneElementProperties(element);
58825      if (element.hasLinkIdElement()) {
58826        composeStringCore("linkId", element.getLinkIdElement(), false);
58827        composeStringExtras("linkId", element.getLinkIdElement(), false);
58828      }
58829      if (element.hasCode()) {
58830        composeCodeableConcept("code", element.getCode());
58831      }
58832      if (element.hasDescriptionElement()) {
58833        composeMarkdownCore("description", element.getDescriptionElement(), false);
58834        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58835      }
58836      if (element.hasCriteria()) {
58837        composeExpression("criteria", element.getCriteria());
58838      }
58839      if (element.hasGroupDefinition()) {
58840        composeReference("groupDefinition", element.getGroupDefinition());
58841      }
58842  }
58843
58844  protected void composeMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
58845    if (element != null) {
58846      open(name);
58847      composeMeasureSupplementalDataComponentProperties(element);
58848      close();
58849    }
58850  }
58851
58852  protected void composeMeasureSupplementalDataComponentProperties(Measure.MeasureSupplementalDataComponent element) throws IOException {
58853    composeBackboneElementProperties(element);
58854      if (element.hasLinkIdElement()) {
58855        composeStringCore("linkId", element.getLinkIdElement(), false);
58856        composeStringExtras("linkId", element.getLinkIdElement(), false);
58857      }
58858      if (element.hasCode()) {
58859        composeCodeableConcept("code", element.getCode());
58860      }
58861      if (element.hasUsage()) {
58862        openArray("usage");
58863        for (CodeableConcept e : element.getUsage()) 
58864          composeCodeableConcept(null, e);
58865        closeArray();
58866      };
58867      if (element.hasDescriptionElement()) {
58868        composeMarkdownCore("description", element.getDescriptionElement(), false);
58869        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58870      }
58871      if (element.hasCriteria()) {
58872        composeExpression("criteria", element.getCriteria());
58873      }
58874  }
58875
58876  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
58877    if (element != null) {
58878      prop("resourceType", name);
58879      composeMeasureReportProperties(element);
58880    }
58881  }
58882
58883  protected void composeMeasureReportProperties(MeasureReport element) throws IOException {
58884    composeDomainResourceProperties(element);
58885      if (element.hasIdentifier()) {
58886        openArray("identifier");
58887        for (Identifier e : element.getIdentifier()) 
58888          composeIdentifier(null, e);
58889        closeArray();
58890      };
58891      if (element.hasStatusElement()) {
58892        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
58893        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
58894      }
58895      if (element.hasTypeElement()) {
58896        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
58897        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
58898      }
58899      if (element.hasDataUpdateTypeElement()) {
58900        composeEnumerationCore("dataUpdateType", element.getDataUpdateTypeElement(), new MeasureReport.SubmitDataUpdateTypeEnumFactory(), false);
58901        composeEnumerationExtras("dataUpdateType", element.getDataUpdateTypeElement(), new MeasureReport.SubmitDataUpdateTypeEnumFactory(), false);
58902      }
58903      if (element.hasMeasureElement()) {
58904        composeCanonicalCore("measure", element.getMeasureElement(), false);
58905        composeCanonicalExtras("measure", element.getMeasureElement(), false);
58906      }
58907      if (element.hasSubject()) {
58908        composeReference("subject", element.getSubject());
58909      }
58910      if (element.hasDateElement()) {
58911        composeDateTimeCore("date", element.getDateElement(), false);
58912        composeDateTimeExtras("date", element.getDateElement(), false);
58913      }
58914      if (element.hasReporter()) {
58915        composeReference("reporter", element.getReporter());
58916      }
58917      if (element.hasReportingVendor()) {
58918        composeReference("reportingVendor", element.getReportingVendor());
58919      }
58920      if (element.hasLocation()) {
58921        composeReference("location", element.getLocation());
58922      }
58923      if (element.hasPeriod()) {
58924        composePeriod("period", element.getPeriod());
58925      }
58926      if (element.hasInputParameters()) {
58927        composeReference("inputParameters", element.getInputParameters());
58928      }
58929      if (element.hasScoring()) {
58930        composeCodeableConcept("scoring", element.getScoring());
58931      }
58932      if (element.hasImprovementNotation()) {
58933        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
58934      }
58935      if (element.hasGroup()) {
58936        openArray("group");
58937        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
58938          composeMeasureReportGroupComponent(null, e);
58939        closeArray();
58940      };
58941      if (element.hasSupplementalData()) {
58942        openArray("supplementalData");
58943        for (Reference e : element.getSupplementalData()) 
58944          composeReference(null, e);
58945        closeArray();
58946      };
58947      if (element.hasEvaluatedResource()) {
58948        openArray("evaluatedResource");
58949        for (Reference e : element.getEvaluatedResource()) 
58950          composeReference(null, e);
58951        closeArray();
58952      };
58953  }
58954
58955  protected void composeMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
58956    if (element != null) {
58957      open(name);
58958      composeMeasureReportGroupComponentProperties(element);
58959      close();
58960    }
58961  }
58962
58963  protected void composeMeasureReportGroupComponentProperties(MeasureReport.MeasureReportGroupComponent element) throws IOException {
58964    composeBackboneElementProperties(element);
58965      if (element.hasLinkIdElement()) {
58966        composeStringCore("linkId", element.getLinkIdElement(), false);
58967        composeStringExtras("linkId", element.getLinkIdElement(), false);
58968      }
58969      if (element.hasCode()) {
58970        composeCodeableConcept("code", element.getCode());
58971      }
58972      if (element.hasSubject()) {
58973        composeReference("subject", element.getSubject());
58974      }
58975      if (element.hasPopulation()) {
58976        openArray("population");
58977        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
58978          composeMeasureReportGroupPopulationComponent(null, e);
58979        closeArray();
58980      };
58981      if (element.hasMeasureScore()) {
58982        composeType("measureScore", element.getMeasureScore());
58983      }
58984      if (element.hasStratifier()) {
58985        openArray("stratifier");
58986        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
58987          composeMeasureReportGroupStratifierComponent(null, e);
58988        closeArray();
58989      };
58990  }
58991
58992  protected void composeMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
58993    if (element != null) {
58994      open(name);
58995      composeMeasureReportGroupPopulationComponentProperties(element);
58996      close();
58997    }
58998  }
58999
59000  protected void composeMeasureReportGroupPopulationComponentProperties(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
59001    composeBackboneElementProperties(element);
59002      if (element.hasLinkIdElement()) {
59003        composeStringCore("linkId", element.getLinkIdElement(), false);
59004        composeStringExtras("linkId", element.getLinkIdElement(), false);
59005      }
59006      if (element.hasCode()) {
59007        composeCodeableConcept("code", element.getCode());
59008      }
59009      if (element.hasCountElement()) {
59010        composeIntegerCore("count", element.getCountElement(), false);
59011        composeIntegerExtras("count", element.getCountElement(), false);
59012      }
59013      if (element.hasSubjectResults()) {
59014        composeReference("subjectResults", element.getSubjectResults());
59015      }
59016      if (element.hasSubjectReport()) {
59017        openArray("subjectReport");
59018        for (Reference e : element.getSubjectReport()) 
59019          composeReference(null, e);
59020        closeArray();
59021      };
59022      if (element.hasSubjects()) {
59023        composeReference("subjects", element.getSubjects());
59024      }
59025  }
59026
59027  protected void composeMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
59028    if (element != null) {
59029      open(name);
59030      composeMeasureReportGroupStratifierComponentProperties(element);
59031      close();
59032    }
59033  }
59034
59035  protected void composeMeasureReportGroupStratifierComponentProperties(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
59036    composeBackboneElementProperties(element);
59037      if (element.hasLinkIdElement()) {
59038        composeStringCore("linkId", element.getLinkIdElement(), false);
59039        composeStringExtras("linkId", element.getLinkIdElement(), false);
59040      }
59041      if (element.hasCode()) {
59042        composeCodeableConcept("code", element.getCode());
59043      }
59044      if (element.hasStratum()) {
59045        openArray("stratum");
59046        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
59047          composeStratifierGroupComponent(null, e);
59048        closeArray();
59049      };
59050  }
59051
59052  protected void composeStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
59053    if (element != null) {
59054      open(name);
59055      composeStratifierGroupComponentProperties(element);
59056      close();
59057    }
59058  }
59059
59060  protected void composeStratifierGroupComponentProperties(MeasureReport.StratifierGroupComponent element) throws IOException {
59061    composeBackboneElementProperties(element);
59062      if (element.hasValue()) {
59063        composeType("value", element.getValue());
59064      }
59065      if (element.hasComponent()) {
59066        openArray("component");
59067        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
59068          composeStratifierGroupComponentComponent(null, e);
59069        closeArray();
59070      };
59071      if (element.hasPopulation()) {
59072        openArray("population");
59073        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
59074          composeStratifierGroupPopulationComponent(null, e);
59075        closeArray();
59076      };
59077      if (element.hasMeasureScore()) {
59078        composeType("measureScore", element.getMeasureScore());
59079      }
59080  }
59081
59082  protected void composeStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
59083    if (element != null) {
59084      open(name);
59085      composeStratifierGroupComponentComponentProperties(element);
59086      close();
59087    }
59088  }
59089
59090  protected void composeStratifierGroupComponentComponentProperties(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
59091    composeBackboneElementProperties(element);
59092      if (element.hasLinkIdElement()) {
59093        composeStringCore("linkId", element.getLinkIdElement(), false);
59094        composeStringExtras("linkId", element.getLinkIdElement(), false);
59095      }
59096      if (element.hasCode()) {
59097        composeCodeableConcept("code", element.getCode());
59098      }
59099      if (element.hasValue()) {
59100        composeType("value", element.getValue());
59101      }
59102  }
59103
59104  protected void composeStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
59105    if (element != null) {
59106      open(name);
59107      composeStratifierGroupPopulationComponentProperties(element);
59108      close();
59109    }
59110  }
59111
59112  protected void composeStratifierGroupPopulationComponentProperties(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
59113    composeBackboneElementProperties(element);
59114      if (element.hasLinkIdElement()) {
59115        composeStringCore("linkId", element.getLinkIdElement(), false);
59116        composeStringExtras("linkId", element.getLinkIdElement(), false);
59117      }
59118      if (element.hasCode()) {
59119        composeCodeableConcept("code", element.getCode());
59120      }
59121      if (element.hasCountElement()) {
59122        composeIntegerCore("count", element.getCountElement(), false);
59123        composeIntegerExtras("count", element.getCountElement(), false);
59124      }
59125      if (element.hasSubjectResults()) {
59126        composeReference("subjectResults", element.getSubjectResults());
59127      }
59128      if (element.hasSubjectReport()) {
59129        openArray("subjectReport");
59130        for (Reference e : element.getSubjectReport()) 
59131          composeReference(null, e);
59132        closeArray();
59133      };
59134      if (element.hasSubjects()) {
59135        composeReference("subjects", element.getSubjects());
59136      }
59137  }
59138
59139  protected void composeMedication(String name, Medication element) throws IOException {
59140    if (element != null) {
59141      prop("resourceType", name);
59142      composeMedicationProperties(element);
59143    }
59144  }
59145
59146  protected void composeMedicationProperties(Medication element) throws IOException {
59147    composeDomainResourceProperties(element);
59148      if (element.hasIdentifier()) {
59149        openArray("identifier");
59150        for (Identifier e : element.getIdentifier()) 
59151          composeIdentifier(null, e);
59152        closeArray();
59153      };
59154      if (element.hasCode()) {
59155        composeCodeableConcept("code", element.getCode());
59156      }
59157      if (element.hasStatusElement()) {
59158        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
59159        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
59160      }
59161      if (element.hasMarketingAuthorizationHolder()) {
59162        composeReference("marketingAuthorizationHolder", element.getMarketingAuthorizationHolder());
59163      }
59164      if (element.hasDoseForm()) {
59165        composeCodeableConcept("doseForm", element.getDoseForm());
59166      }
59167      if (element.hasTotalVolume()) {
59168        composeQuantity("totalVolume", element.getTotalVolume());
59169      }
59170      if (element.hasIngredient()) {
59171        openArray("ingredient");
59172        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
59173          composeMedicationIngredientComponent(null, e);
59174        closeArray();
59175      };
59176      if (element.hasBatch()) {
59177        composeMedicationBatchComponent("batch", element.getBatch());
59178      }
59179      if (element.hasDefinition()) {
59180        composeReference("definition", element.getDefinition());
59181      }
59182  }
59183
59184  protected void composeMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
59185    if (element != null) {
59186      open(name);
59187      composeMedicationIngredientComponentProperties(element);
59188      close();
59189    }
59190  }
59191
59192  protected void composeMedicationIngredientComponentProperties(Medication.MedicationIngredientComponent element) throws IOException {
59193    composeBackboneElementProperties(element);
59194      if (element.hasItem()) {
59195        composeCodeableReference("item", element.getItem());
59196      }
59197      if (element.hasIsActiveElement()) {
59198        composeBooleanCore("isActive", element.getIsActiveElement(), false);
59199        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
59200      }
59201      if (element.hasStrength()) {
59202        composeType("strength", element.getStrength());
59203      }
59204  }
59205
59206  protected void composeMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
59207    if (element != null) {
59208      open(name);
59209      composeMedicationBatchComponentProperties(element);
59210      close();
59211    }
59212  }
59213
59214  protected void composeMedicationBatchComponentProperties(Medication.MedicationBatchComponent element) throws IOException {
59215    composeBackboneElementProperties(element);
59216      if (element.hasLotNumberElement()) {
59217        composeStringCore("lotNumber", element.getLotNumberElement(), false);
59218        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
59219      }
59220      if (element.hasExpirationDateElement()) {
59221        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
59222        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
59223      }
59224  }
59225
59226  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
59227    if (element != null) {
59228      prop("resourceType", name);
59229      composeMedicationAdministrationProperties(element);
59230    }
59231  }
59232
59233  protected void composeMedicationAdministrationProperties(MedicationAdministration element) throws IOException {
59234    composeDomainResourceProperties(element);
59235      if (element.hasIdentifier()) {
59236        openArray("identifier");
59237        for (Identifier e : element.getIdentifier()) 
59238          composeIdentifier(null, e);
59239        closeArray();
59240      };
59241      if (element.hasBasedOn()) {
59242        openArray("basedOn");
59243        for (Reference e : element.getBasedOn()) 
59244          composeReference(null, e);
59245        closeArray();
59246      };
59247      if (element.hasPartOf()) {
59248        openArray("partOf");
59249        for (Reference e : element.getPartOf()) 
59250          composeReference(null, e);
59251        closeArray();
59252      };
59253      if (element.hasStatusElement()) {
59254        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
59255        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
59256      }
59257      if (element.hasStatusReason()) {
59258        openArray("statusReason");
59259        for (CodeableConcept e : element.getStatusReason()) 
59260          composeCodeableConcept(null, e);
59261        closeArray();
59262      };
59263      if (element.hasCategory()) {
59264        openArray("category");
59265        for (CodeableConcept e : element.getCategory()) 
59266          composeCodeableConcept(null, e);
59267        closeArray();
59268      };
59269      if (element.hasMedication()) {
59270        composeCodeableReference("medication", element.getMedication());
59271      }
59272      if (element.hasSubject()) {
59273        composeReference("subject", element.getSubject());
59274      }
59275      if (element.hasEncounter()) {
59276        composeReference("encounter", element.getEncounter());
59277      }
59278      if (element.hasSupportingInformation()) {
59279        openArray("supportingInformation");
59280        for (Reference e : element.getSupportingInformation()) 
59281          composeReference(null, e);
59282        closeArray();
59283      };
59284      if (element.hasOccurence()) {
59285        composeType("occurence", element.getOccurence());
59286      }
59287      if (element.hasRecordedElement()) {
59288        composeDateTimeCore("recorded", element.getRecordedElement(), false);
59289        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
59290      }
59291      if (element.hasIsSubPotentElement()) {
59292        composeBooleanCore("isSubPotent", element.getIsSubPotentElement(), false);
59293        composeBooleanExtras("isSubPotent", element.getIsSubPotentElement(), false);
59294      }
59295      if (element.hasSubPotentReason()) {
59296        openArray("subPotentReason");
59297        for (CodeableConcept e : element.getSubPotentReason()) 
59298          composeCodeableConcept(null, e);
59299        closeArray();
59300      };
59301      if (element.hasPerformer()) {
59302        openArray("performer");
59303        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
59304          composeMedicationAdministrationPerformerComponent(null, e);
59305        closeArray();
59306      };
59307      if (element.hasReason()) {
59308        openArray("reason");
59309        for (CodeableReference e : element.getReason()) 
59310          composeCodeableReference(null, e);
59311        closeArray();
59312      };
59313      if (element.hasRequest()) {
59314        composeReference("request", element.getRequest());
59315      }
59316      if (element.hasDevice()) {
59317        openArray("device");
59318        for (CodeableReference e : element.getDevice()) 
59319          composeCodeableReference(null, e);
59320        closeArray();
59321      };
59322      if (element.hasNote()) {
59323        openArray("note");
59324        for (Annotation e : element.getNote()) 
59325          composeAnnotation(null, e);
59326        closeArray();
59327      };
59328      if (element.hasDosage()) {
59329        composeMedicationAdministrationDosageComponent("dosage", element.getDosage());
59330      }
59331      if (element.hasEventHistory()) {
59332        openArray("eventHistory");
59333        for (Reference e : element.getEventHistory()) 
59334          composeReference(null, e);
59335        closeArray();
59336      };
59337  }
59338
59339  protected void composeMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
59340    if (element != null) {
59341      open(name);
59342      composeMedicationAdministrationPerformerComponentProperties(element);
59343      close();
59344    }
59345  }
59346
59347  protected void composeMedicationAdministrationPerformerComponentProperties(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
59348    composeBackboneElementProperties(element);
59349      if (element.hasFunction()) {
59350        composeCodeableConcept("function", element.getFunction());
59351      }
59352      if (element.hasActor()) {
59353        composeCodeableReference("actor", element.getActor());
59354      }
59355  }
59356
59357  protected void composeMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
59358    if (element != null) {
59359      open(name);
59360      composeMedicationAdministrationDosageComponentProperties(element);
59361      close();
59362    }
59363  }
59364
59365  protected void composeMedicationAdministrationDosageComponentProperties(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
59366    composeBackboneElementProperties(element);
59367      if (element.hasTextElement()) {
59368        composeStringCore("text", element.getTextElement(), false);
59369        composeStringExtras("text", element.getTextElement(), false);
59370      }
59371      if (element.hasSite()) {
59372        composeCodeableConcept("site", element.getSite());
59373      }
59374      if (element.hasRoute()) {
59375        composeCodeableConcept("route", element.getRoute());
59376      }
59377      if (element.hasMethod()) {
59378        composeCodeableConcept("method", element.getMethod());
59379      }
59380      if (element.hasDose()) {
59381        composeQuantity("dose", element.getDose());
59382      }
59383      if (element.hasRate()) {
59384        composeType("rate", element.getRate());
59385      }
59386  }
59387
59388  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
59389    if (element != null) {
59390      prop("resourceType", name);
59391      composeMedicationDispenseProperties(element);
59392    }
59393  }
59394
59395  protected void composeMedicationDispenseProperties(MedicationDispense element) throws IOException {
59396    composeDomainResourceProperties(element);
59397      if (element.hasIdentifier()) {
59398        openArray("identifier");
59399        for (Identifier e : element.getIdentifier()) 
59400          composeIdentifier(null, e);
59401        closeArray();
59402      };
59403      if (element.hasBasedOn()) {
59404        openArray("basedOn");
59405        for (Reference e : element.getBasedOn()) 
59406          composeReference(null, e);
59407        closeArray();
59408      };
59409      if (element.hasPartOf()) {
59410        openArray("partOf");
59411        for (Reference e : element.getPartOf()) 
59412          composeReference(null, e);
59413        closeArray();
59414      };
59415      if (element.hasStatusElement()) {
59416        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
59417        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
59418      }
59419      if (element.hasNotPerformedReason()) {
59420        composeCodeableReference("notPerformedReason", element.getNotPerformedReason());
59421      }
59422      if (element.hasStatusChangedElement()) {
59423        composeDateTimeCore("statusChanged", element.getStatusChangedElement(), false);
59424        composeDateTimeExtras("statusChanged", element.getStatusChangedElement(), false);
59425      }
59426      if (element.hasCategory()) {
59427        openArray("category");
59428        for (CodeableConcept e : element.getCategory()) 
59429          composeCodeableConcept(null, e);
59430        closeArray();
59431      };
59432      if (element.hasMedication()) {
59433        composeCodeableReference("medication", element.getMedication());
59434      }
59435      if (element.hasSubject()) {
59436        composeReference("subject", element.getSubject());
59437      }
59438      if (element.hasEncounter()) {
59439        composeReference("encounter", element.getEncounter());
59440      }
59441      if (element.hasSupportingInformation()) {
59442        openArray("supportingInformation");
59443        for (Reference e : element.getSupportingInformation()) 
59444          composeReference(null, e);
59445        closeArray();
59446      };
59447      if (element.hasPerformer()) {
59448        openArray("performer");
59449        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
59450          composeMedicationDispensePerformerComponent(null, e);
59451        closeArray();
59452      };
59453      if (element.hasLocation()) {
59454        composeReference("location", element.getLocation());
59455      }
59456      if (element.hasAuthorizingPrescription()) {
59457        openArray("authorizingPrescription");
59458        for (Reference e : element.getAuthorizingPrescription()) 
59459          composeReference(null, e);
59460        closeArray();
59461      };
59462      if (element.hasType()) {
59463        composeCodeableConcept("type", element.getType());
59464      }
59465      if (element.hasQuantity()) {
59466        composeQuantity("quantity", element.getQuantity());
59467      }
59468      if (element.hasDaysSupply()) {
59469        composeQuantity("daysSupply", element.getDaysSupply());
59470      }
59471      if (element.hasRecordedElement()) {
59472        composeDateTimeCore("recorded", element.getRecordedElement(), false);
59473        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
59474      }
59475      if (element.hasWhenPreparedElement()) {
59476        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
59477        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
59478      }
59479      if (element.hasWhenHandedOverElement()) {
59480        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
59481        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
59482      }
59483      if (element.hasDestination()) {
59484        composeReference("destination", element.getDestination());
59485      }
59486      if (element.hasReceiver()) {
59487        openArray("receiver");
59488        for (Reference e : element.getReceiver()) 
59489          composeReference(null, e);
59490        closeArray();
59491      };
59492      if (element.hasNote()) {
59493        openArray("note");
59494        for (Annotation e : element.getNote()) 
59495          composeAnnotation(null, e);
59496        closeArray();
59497      };
59498      if (element.hasRenderedDosageInstructionElement()) {
59499        composeMarkdownCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
59500        composeMarkdownExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
59501      }
59502      if (element.hasDosageInstruction()) {
59503        openArray("dosageInstruction");
59504        for (Dosage e : element.getDosageInstruction()) 
59505          composeDosage(null, e);
59506        closeArray();
59507      };
59508      if (element.hasSubstitution()) {
59509        composeMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
59510      }
59511      if (element.hasEventHistory()) {
59512        openArray("eventHistory");
59513        for (Reference e : element.getEventHistory()) 
59514          composeReference(null, e);
59515        closeArray();
59516      };
59517  }
59518
59519  protected void composeMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
59520    if (element != null) {
59521      open(name);
59522      composeMedicationDispensePerformerComponentProperties(element);
59523      close();
59524    }
59525  }
59526
59527  protected void composeMedicationDispensePerformerComponentProperties(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
59528    composeBackboneElementProperties(element);
59529      if (element.hasFunction()) {
59530        composeCodeableConcept("function", element.getFunction());
59531      }
59532      if (element.hasActor()) {
59533        composeReference("actor", element.getActor());
59534      }
59535  }
59536
59537  protected void composeMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
59538    if (element != null) {
59539      open(name);
59540      composeMedicationDispenseSubstitutionComponentProperties(element);
59541      close();
59542    }
59543  }
59544
59545  protected void composeMedicationDispenseSubstitutionComponentProperties(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
59546    composeBackboneElementProperties(element);
59547      if (element.hasWasSubstitutedElement()) {
59548        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
59549        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
59550      }
59551      if (element.hasType()) {
59552        composeCodeableConcept("type", element.getType());
59553      }
59554      if (element.hasReason()) {
59555        openArray("reason");
59556        for (CodeableConcept e : element.getReason()) 
59557          composeCodeableConcept(null, e);
59558        closeArray();
59559      };
59560      if (element.hasResponsibleParty()) {
59561        composeReference("responsibleParty", element.getResponsibleParty());
59562      }
59563  }
59564
59565  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
59566    if (element != null) {
59567      prop("resourceType", name);
59568      composeMedicationKnowledgeProperties(element);
59569    }
59570  }
59571
59572  protected void composeMedicationKnowledgeProperties(MedicationKnowledge element) throws IOException {
59573    composeDomainResourceProperties(element);
59574      if (element.hasIdentifier()) {
59575        openArray("identifier");
59576        for (Identifier e : element.getIdentifier()) 
59577          composeIdentifier(null, e);
59578        closeArray();
59579      };
59580      if (element.hasCode()) {
59581        composeCodeableConcept("code", element.getCode());
59582      }
59583      if (element.hasStatusElement()) {
59584        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
59585        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
59586      }
59587      if (element.hasAuthor()) {
59588        composeReference("author", element.getAuthor());
59589      }
59590      if (element.hasIntendedJurisdiction()) {
59591        openArray("intendedJurisdiction");
59592        for (CodeableConcept e : element.getIntendedJurisdiction()) 
59593          composeCodeableConcept(null, e);
59594        closeArray();
59595      };
59596      if (element.hasName()) {
59597        if (anyHasValue(element.getName())) {
59598          openArray("name");
59599          for (StringType e : element.getName()) 
59600            composeStringCore(null, e, e != element.getName().get(element.getName().size()-1));
59601          closeArray();
59602        }
59603        if (anyHasExtras(element.getName())) {
59604          openArray("_name");
59605          for (StringType e : element.getName()) 
59606            composeStringExtras(null, e, true);
59607          closeArray();
59608        }
59609      };
59610      if (element.hasRelatedMedicationKnowledge()) {
59611        openArray("relatedMedicationKnowledge");
59612        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
59613          composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
59614        closeArray();
59615      };
59616      if (element.hasAssociatedMedication()) {
59617        openArray("associatedMedication");
59618        for (Reference e : element.getAssociatedMedication()) 
59619          composeReference(null, e);
59620        closeArray();
59621      };
59622      if (element.hasProductType()) {
59623        openArray("productType");
59624        for (CodeableConcept e : element.getProductType()) 
59625          composeCodeableConcept(null, e);
59626        closeArray();
59627      };
59628      if (element.hasMonograph()) {
59629        openArray("monograph");
59630        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
59631          composeMedicationKnowledgeMonographComponent(null, e);
59632        closeArray();
59633      };
59634      if (element.hasPreparationInstructionElement()) {
59635        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
59636        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
59637      }
59638      if (element.hasCost()) {
59639        openArray("cost");
59640        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
59641          composeMedicationKnowledgeCostComponent(null, e);
59642        closeArray();
59643      };
59644      if (element.hasMonitoringProgram()) {
59645        openArray("monitoringProgram");
59646        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
59647          composeMedicationKnowledgeMonitoringProgramComponent(null, e);
59648        closeArray();
59649      };
59650      if (element.hasIndicationGuideline()) {
59651        openArray("indicationGuideline");
59652        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent e : element.getIndicationGuideline()) 
59653          composeMedicationKnowledgeIndicationGuidelineComponent(null, e);
59654        closeArray();
59655      };
59656      if (element.hasMedicineClassification()) {
59657        openArray("medicineClassification");
59658        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
59659          composeMedicationKnowledgeMedicineClassificationComponent(null, e);
59660        closeArray();
59661      };
59662      if (element.hasPackaging()) {
59663        openArray("packaging");
59664        for (MedicationKnowledge.MedicationKnowledgePackagingComponent e : element.getPackaging()) 
59665          composeMedicationKnowledgePackagingComponent(null, e);
59666        closeArray();
59667      };
59668      if (element.hasClinicalUseIssue()) {
59669        openArray("clinicalUseIssue");
59670        for (Reference e : element.getClinicalUseIssue()) 
59671          composeReference(null, e);
59672        closeArray();
59673      };
59674      if (element.hasStorageGuideline()) {
59675        openArray("storageGuideline");
59676        for (MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent e : element.getStorageGuideline()) 
59677          composeMedicationKnowledgeStorageGuidelineComponent(null, e);
59678        closeArray();
59679      };
59680      if (element.hasRegulatory()) {
59681        openArray("regulatory");
59682        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
59683          composeMedicationKnowledgeRegulatoryComponent(null, e);
59684        closeArray();
59685      };
59686      if (element.hasDefinitional()) {
59687        composeMedicationKnowledgeDefinitionalComponent("definitional", element.getDefinitional());
59688      }
59689  }
59690
59691  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
59692    if (element != null) {
59693      open(name);
59694      composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(element);
59695      close();
59696    }
59697  }
59698
59699  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
59700    composeBackboneElementProperties(element);
59701      if (element.hasType()) {
59702        composeCodeableConcept("type", element.getType());
59703      }
59704      if (element.hasReference()) {
59705        openArray("reference");
59706        for (Reference e : element.getReference()) 
59707          composeReference(null, e);
59708        closeArray();
59709      };
59710  }
59711
59712  protected void composeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
59713    if (element != null) {
59714      open(name);
59715      composeMedicationKnowledgeMonographComponentProperties(element);
59716      close();
59717    }
59718  }
59719
59720  protected void composeMedicationKnowledgeMonographComponentProperties(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
59721    composeBackboneElementProperties(element);
59722      if (element.hasType()) {
59723        composeCodeableConcept("type", element.getType());
59724      }
59725      if (element.hasSource()) {
59726        composeReference("source", element.getSource());
59727      }
59728  }
59729
59730  protected void composeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
59731    if (element != null) {
59732      open(name);
59733      composeMedicationKnowledgeCostComponentProperties(element);
59734      close();
59735    }
59736  }
59737
59738  protected void composeMedicationKnowledgeCostComponentProperties(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
59739    composeBackboneElementProperties(element);
59740      if (element.hasEffectiveDate()) {
59741        openArray("effectiveDate");
59742        for (Period e : element.getEffectiveDate()) 
59743          composePeriod(null, e);
59744        closeArray();
59745      };
59746      if (element.hasType()) {
59747        composeCodeableConcept("type", element.getType());
59748      }
59749      if (element.hasSourceElement()) {
59750        composeStringCore("source", element.getSourceElement(), false);
59751        composeStringExtras("source", element.getSourceElement(), false);
59752      }
59753      if (element.hasCost()) {
59754        composeType("cost", element.getCost());
59755      }
59756  }
59757
59758  protected void composeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
59759    if (element != null) {
59760      open(name);
59761      composeMedicationKnowledgeMonitoringProgramComponentProperties(element);
59762      close();
59763    }
59764  }
59765
59766  protected void composeMedicationKnowledgeMonitoringProgramComponentProperties(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
59767    composeBackboneElementProperties(element);
59768      if (element.hasType()) {
59769        composeCodeableConcept("type", element.getType());
59770      }
59771      if (element.hasNameElement()) {
59772        composeStringCore("name", element.getNameElement(), false);
59773        composeStringExtras("name", element.getNameElement(), false);
59774      }
59775  }
59776
59777  protected void composeMedicationKnowledgeIndicationGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent element) throws IOException {
59778    if (element != null) {
59779      open(name);
59780      composeMedicationKnowledgeIndicationGuidelineComponentProperties(element);
59781      close();
59782    }
59783  }
59784
59785  protected void composeMedicationKnowledgeIndicationGuidelineComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent element) throws IOException {
59786    composeBackboneElementProperties(element);
59787      if (element.hasIndication()) {
59788        openArray("indication");
59789        for (CodeableReference e : element.getIndication()) 
59790          composeCodeableReference(null, e);
59791        closeArray();
59792      };
59793      if (element.hasDosingGuideline()) {
59794        openArray("dosingGuideline");
59795        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent e : element.getDosingGuideline()) 
59796          composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponent(null, e);
59797        closeArray();
59798      };
59799  }
59800
59801  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent element) throws IOException {
59802    if (element != null) {
59803      open(name);
59804      composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponentProperties(element);
59805      close();
59806    }
59807  }
59808
59809  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent element) throws IOException {
59810    composeBackboneElementProperties(element);
59811      if (element.hasTreatmentIntent()) {
59812        composeCodeableConcept("treatmentIntent", element.getTreatmentIntent());
59813      }
59814      if (element.hasDosage()) {
59815        openArray("dosage");
59816        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent e : element.getDosage()) 
59817          composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent(null, e);
59818        closeArray();
59819      };
59820      if (element.hasAdministrationTreatment()) {
59821        composeCodeableConcept("administrationTreatment", element.getAdministrationTreatment());
59822      }
59823      if (element.hasPatientCharacteristic()) {
59824        openArray("patientCharacteristic");
59825        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent e : element.getPatientCharacteristic()) 
59826          composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent(null, e);
59827        closeArray();
59828      };
59829  }
59830
59831  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent element) throws IOException {
59832    if (element != null) {
59833      open(name);
59834      composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponentProperties(element);
59835      close();
59836    }
59837  }
59838
59839  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent element) throws IOException {
59840    composeBackboneElementProperties(element);
59841      if (element.hasType()) {
59842        composeCodeableConcept("type", element.getType());
59843      }
59844      if (element.hasDosage()) {
59845        openArray("dosage");
59846        for (Dosage e : element.getDosage()) 
59847          composeDosage(null, e);
59848        closeArray();
59849      };
59850  }
59851
59852  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent element) throws IOException {
59853    if (element != null) {
59854      open(name);
59855      composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponentProperties(element);
59856      close();
59857    }
59858  }
59859
59860  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent element) throws IOException {
59861    composeBackboneElementProperties(element);
59862      if (element.hasType()) {
59863        composeCodeableConcept("type", element.getType());
59864      }
59865      if (element.hasValue()) {
59866        composeType("value", element.getValue());
59867      }
59868  }
59869
59870  protected void composeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
59871    if (element != null) {
59872      open(name);
59873      composeMedicationKnowledgeMedicineClassificationComponentProperties(element);
59874      close();
59875    }
59876  }
59877
59878  protected void composeMedicationKnowledgeMedicineClassificationComponentProperties(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
59879    composeBackboneElementProperties(element);
59880      if (element.hasType()) {
59881        composeCodeableConcept("type", element.getType());
59882      }
59883      if (element.hasSource()) {
59884        composeType("source", element.getSource());
59885      }
59886      if (element.hasClassification()) {
59887        openArray("classification");
59888        for (CodeableConcept e : element.getClassification()) 
59889          composeCodeableConcept(null, e);
59890        closeArray();
59891      };
59892  }
59893
59894  protected void composeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
59895    if (element != null) {
59896      open(name);
59897      composeMedicationKnowledgePackagingComponentProperties(element);
59898      close();
59899    }
59900  }
59901
59902  protected void composeMedicationKnowledgePackagingComponentProperties(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
59903    composeBackboneElementProperties(element);
59904      if (element.hasCost()) {
59905        openArray("cost");
59906        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
59907          composeMedicationKnowledgeCostComponent(null, e);
59908        closeArray();
59909      };
59910      if (element.hasPackagedProduct()) {
59911        composeReference("packagedProduct", element.getPackagedProduct());
59912      }
59913  }
59914
59915  protected void composeMedicationKnowledgeStorageGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent element) throws IOException {
59916    if (element != null) {
59917      open(name);
59918      composeMedicationKnowledgeStorageGuidelineComponentProperties(element);
59919      close();
59920    }
59921  }
59922
59923  protected void composeMedicationKnowledgeStorageGuidelineComponentProperties(MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent element) throws IOException {
59924    composeBackboneElementProperties(element);
59925      if (element.hasReferenceElement()) {
59926        composeUriCore("reference", element.getReferenceElement(), false);
59927        composeUriExtras("reference", element.getReferenceElement(), false);
59928      }
59929      if (element.hasNote()) {
59930        openArray("note");
59931        for (Annotation e : element.getNote()) 
59932          composeAnnotation(null, e);
59933        closeArray();
59934      };
59935      if (element.hasStabilityDuration()) {
59936        composeDuration("stabilityDuration", element.getStabilityDuration());
59937      }
59938      if (element.hasEnvironmentalSetting()) {
59939        openArray("environmentalSetting");
59940        for (MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent e : element.getEnvironmentalSetting()) 
59941          composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent(null, e);
59942        closeArray();
59943      };
59944  }
59945
59946  protected void composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent(String name, MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent element) throws IOException {
59947    if (element != null) {
59948      open(name);
59949      composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponentProperties(element);
59950      close();
59951    }
59952  }
59953
59954  protected void composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponentProperties(MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent element) throws IOException {
59955    composeBackboneElementProperties(element);
59956      if (element.hasType()) {
59957        composeCodeableConcept("type", element.getType());
59958      }
59959      if (element.hasValue()) {
59960        composeType("value", element.getValue());
59961      }
59962  }
59963
59964  protected void composeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
59965    if (element != null) {
59966      open(name);
59967      composeMedicationKnowledgeRegulatoryComponentProperties(element);
59968      close();
59969    }
59970  }
59971
59972  protected void composeMedicationKnowledgeRegulatoryComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
59973    composeBackboneElementProperties(element);
59974      if (element.hasRegulatoryAuthority()) {
59975        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
59976      }
59977      if (element.hasSubstitution()) {
59978        openArray("substitution");
59979        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
59980          composeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
59981        closeArray();
59982      };
59983      if (element.hasSchedule()) {
59984        openArray("schedule");
59985        for (CodeableConcept e : element.getSchedule()) 
59986          composeCodeableConcept(null, e);
59987        closeArray();
59988      };
59989      if (element.hasMaxDispense()) {
59990        composeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
59991      }
59992  }
59993
59994  protected void composeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
59995    if (element != null) {
59996      open(name);
59997      composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(element);
59998      close();
59999    }
60000  }
60001
60002  protected void composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
60003    composeBackboneElementProperties(element);
60004      if (element.hasType()) {
60005        composeCodeableConcept("type", element.getType());
60006      }
60007      if (element.hasAllowedElement()) {
60008        composeBooleanCore("allowed", element.getAllowedElement(), false);
60009        composeBooleanExtras("allowed", element.getAllowedElement(), false);
60010      }
60011  }
60012
60013  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
60014    if (element != null) {
60015      open(name);
60016      composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(element);
60017      close();
60018    }
60019  }
60020
60021  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
60022    composeBackboneElementProperties(element);
60023      if (element.hasQuantity()) {
60024        composeQuantity("quantity", element.getQuantity());
60025      }
60026      if (element.hasPeriod()) {
60027        composeDuration("period", element.getPeriod());
60028      }
60029  }
60030
60031  protected void composeMedicationKnowledgeDefinitionalComponent(String name, MedicationKnowledge.MedicationKnowledgeDefinitionalComponent element) throws IOException {
60032    if (element != null) {
60033      open(name);
60034      composeMedicationKnowledgeDefinitionalComponentProperties(element);
60035      close();
60036    }
60037  }
60038
60039  protected void composeMedicationKnowledgeDefinitionalComponentProperties(MedicationKnowledge.MedicationKnowledgeDefinitionalComponent element) throws IOException {
60040    composeBackboneElementProperties(element);
60041      if (element.hasDefinition()) {
60042        openArray("definition");
60043        for (Reference e : element.getDefinition()) 
60044          composeReference(null, e);
60045        closeArray();
60046      };
60047      if (element.hasDoseForm()) {
60048        composeCodeableConcept("doseForm", element.getDoseForm());
60049      }
60050      if (element.hasIntendedRoute()) {
60051        openArray("intendedRoute");
60052        for (CodeableConcept e : element.getIntendedRoute()) 
60053          composeCodeableConcept(null, e);
60054        closeArray();
60055      };
60056      if (element.hasIngredient()) {
60057        openArray("ingredient");
60058        for (MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent e : element.getIngredient()) 
60059          composeMedicationKnowledgeDefinitionalIngredientComponent(null, e);
60060        closeArray();
60061      };
60062      if (element.hasDrugCharacteristic()) {
60063        openArray("drugCharacteristic");
60064        for (MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
60065          composeMedicationKnowledgeDefinitionalDrugCharacteristicComponent(null, e);
60066        closeArray();
60067      };
60068  }
60069
60070  protected void composeMedicationKnowledgeDefinitionalIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent element) throws IOException {
60071    if (element != null) {
60072      open(name);
60073      composeMedicationKnowledgeDefinitionalIngredientComponentProperties(element);
60074      close();
60075    }
60076  }
60077
60078  protected void composeMedicationKnowledgeDefinitionalIngredientComponentProperties(MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent element) throws IOException {
60079    composeBackboneElementProperties(element);
60080      if (element.hasItem()) {
60081        composeCodeableReference("item", element.getItem());
60082      }
60083      if (element.hasType()) {
60084        composeCodeableConcept("type", element.getType());
60085      }
60086      if (element.hasStrength()) {
60087        composeType("strength", element.getStrength());
60088      }
60089  }
60090
60091  protected void composeMedicationKnowledgeDefinitionalDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent element) throws IOException {
60092    if (element != null) {
60093      open(name);
60094      composeMedicationKnowledgeDefinitionalDrugCharacteristicComponentProperties(element);
60095      close();
60096    }
60097  }
60098
60099  protected void composeMedicationKnowledgeDefinitionalDrugCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent element) throws IOException {
60100    composeBackboneElementProperties(element);
60101      if (element.hasType()) {
60102        composeCodeableConcept("type", element.getType());
60103      }
60104      if (element.hasValue()) {
60105        composeType("value", element.getValue());
60106      }
60107  }
60108
60109  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
60110    if (element != null) {
60111      prop("resourceType", name);
60112      composeMedicationRequestProperties(element);
60113    }
60114  }
60115
60116  protected void composeMedicationRequestProperties(MedicationRequest element) throws IOException {
60117    composeDomainResourceProperties(element);
60118      if (element.hasIdentifier()) {
60119        openArray("identifier");
60120        for (Identifier e : element.getIdentifier()) 
60121          composeIdentifier(null, e);
60122        closeArray();
60123      };
60124      if (element.hasBasedOn()) {
60125        openArray("basedOn");
60126        for (Reference e : element.getBasedOn()) 
60127          composeReference(null, e);
60128        closeArray();
60129      };
60130      if (element.hasPriorPrescription()) {
60131        composeReference("priorPrescription", element.getPriorPrescription());
60132      }
60133      if (element.hasGroupIdentifier()) {
60134        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
60135      }
60136      if (element.hasStatusElement()) {
60137        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
60138        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
60139      }
60140      if (element.hasStatusReason()) {
60141        composeCodeableConcept("statusReason", element.getStatusReason());
60142      }
60143      if (element.hasStatusChangedElement()) {
60144        composeDateTimeCore("statusChanged", element.getStatusChangedElement(), false);
60145        composeDateTimeExtras("statusChanged", element.getStatusChangedElement(), false);
60146      }
60147      if (element.hasIntentElement()) {
60148        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
60149        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
60150      }
60151      if (element.hasCategory()) {
60152        openArray("category");
60153        for (CodeableConcept e : element.getCategory()) 
60154          composeCodeableConcept(null, e);
60155        closeArray();
60156      };
60157      if (element.hasPriorityElement()) {
60158        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
60159        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
60160      }
60161      if (element.hasDoNotPerformElement()) {
60162        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
60163        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
60164      }
60165      if (element.hasMedication()) {
60166        composeCodeableReference("medication", element.getMedication());
60167      }
60168      if (element.hasSubject()) {
60169        composeReference("subject", element.getSubject());
60170      }
60171      if (element.hasInformationSource()) {
60172        openArray("informationSource");
60173        for (Reference e : element.getInformationSource()) 
60174          composeReference(null, e);
60175        closeArray();
60176      };
60177      if (element.hasEncounter()) {
60178        composeReference("encounter", element.getEncounter());
60179      }
60180      if (element.hasSupportingInformation()) {
60181        openArray("supportingInformation");
60182        for (Reference e : element.getSupportingInformation()) 
60183          composeReference(null, e);
60184        closeArray();
60185      };
60186      if (element.hasAuthoredOnElement()) {
60187        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
60188        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
60189      }
60190      if (element.hasRequester()) {
60191        composeReference("requester", element.getRequester());
60192      }
60193      if (element.hasReportedElement()) {
60194        composeBooleanCore("reported", element.getReportedElement(), false);
60195        composeBooleanExtras("reported", element.getReportedElement(), false);
60196      }
60197      if (element.hasPerformerType()) {
60198        composeCodeableConcept("performerType", element.getPerformerType());
60199      }
60200      if (element.hasPerformer()) {
60201        openArray("performer");
60202        for (Reference e : element.getPerformer()) 
60203          composeReference(null, e);
60204        closeArray();
60205      };
60206      if (element.hasDevice()) {
60207        openArray("device");
60208        for (CodeableReference e : element.getDevice()) 
60209          composeCodeableReference(null, e);
60210        closeArray();
60211      };
60212      if (element.hasRecorder()) {
60213        composeReference("recorder", element.getRecorder());
60214      }
60215      if (element.hasReason()) {
60216        openArray("reason");
60217        for (CodeableReference e : element.getReason()) 
60218          composeCodeableReference(null, e);
60219        closeArray();
60220      };
60221      if (element.hasCourseOfTherapyType()) {
60222        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
60223      }
60224      if (element.hasInsurance()) {
60225        openArray("insurance");
60226        for (Reference e : element.getInsurance()) 
60227          composeReference(null, e);
60228        closeArray();
60229      };
60230      if (element.hasNote()) {
60231        openArray("note");
60232        for (Annotation e : element.getNote()) 
60233          composeAnnotation(null, e);
60234        closeArray();
60235      };
60236      if (element.hasRenderedDosageInstructionElement()) {
60237        composeMarkdownCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60238        composeMarkdownExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60239      }
60240      if (element.hasEffectiveDosePeriod()) {
60241        composePeriod("effectiveDosePeriod", element.getEffectiveDosePeriod());
60242      }
60243      if (element.hasDosageInstruction()) {
60244        openArray("dosageInstruction");
60245        for (Dosage e : element.getDosageInstruction()) 
60246          composeDosage(null, e);
60247        closeArray();
60248      };
60249      if (element.hasDispenseRequest()) {
60250        composeMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
60251      }
60252      if (element.hasSubstitution()) {
60253        composeMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
60254      }
60255      if (element.hasEventHistory()) {
60256        openArray("eventHistory");
60257        for (Reference e : element.getEventHistory()) 
60258          composeReference(null, e);
60259        closeArray();
60260      };
60261  }
60262
60263  protected void composeMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
60264    if (element != null) {
60265      open(name);
60266      composeMedicationRequestDispenseRequestComponentProperties(element);
60267      close();
60268    }
60269  }
60270
60271  protected void composeMedicationRequestDispenseRequestComponentProperties(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
60272    composeBackboneElementProperties(element);
60273      if (element.hasInitialFill()) {
60274        composeMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
60275      }
60276      if (element.hasDispenseInterval()) {
60277        composeDuration("dispenseInterval", element.getDispenseInterval());
60278      }
60279      if (element.hasValidityPeriod()) {
60280        composePeriod("validityPeriod", element.getValidityPeriod());
60281      }
60282      if (element.hasNumberOfRepeatsAllowedElement()) {
60283        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
60284        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
60285      }
60286      if (element.hasQuantity()) {
60287        composeQuantity("quantity", element.getQuantity());
60288      }
60289      if (element.hasExpectedSupplyDuration()) {
60290        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
60291      }
60292      if (element.hasDispenser()) {
60293        composeReference("dispenser", element.getDispenser());
60294      }
60295      if (element.hasDispenserInstruction()) {
60296        openArray("dispenserInstruction");
60297        for (Annotation e : element.getDispenserInstruction()) 
60298          composeAnnotation(null, e);
60299        closeArray();
60300      };
60301      if (element.hasDoseAdministrationAid()) {
60302        composeCodeableConcept("doseAdministrationAid", element.getDoseAdministrationAid());
60303      }
60304  }
60305
60306  protected void composeMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
60307    if (element != null) {
60308      open(name);
60309      composeMedicationRequestDispenseRequestInitialFillComponentProperties(element);
60310      close();
60311    }
60312  }
60313
60314  protected void composeMedicationRequestDispenseRequestInitialFillComponentProperties(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
60315    composeBackboneElementProperties(element);
60316      if (element.hasQuantity()) {
60317        composeQuantity("quantity", element.getQuantity());
60318      }
60319      if (element.hasDuration()) {
60320        composeDuration("duration", element.getDuration());
60321      }
60322  }
60323
60324  protected void composeMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
60325    if (element != null) {
60326      open(name);
60327      composeMedicationRequestSubstitutionComponentProperties(element);
60328      close();
60329    }
60330  }
60331
60332  protected void composeMedicationRequestSubstitutionComponentProperties(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
60333    composeBackboneElementProperties(element);
60334      if (element.hasAllowed()) {
60335        composeType("allowed", element.getAllowed());
60336      }
60337      if (element.hasReason()) {
60338        composeCodeableConcept("reason", element.getReason());
60339      }
60340  }
60341
60342  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
60343    if (element != null) {
60344      prop("resourceType", name);
60345      composeMedicationStatementProperties(element);
60346    }
60347  }
60348
60349  protected void composeMedicationStatementProperties(MedicationStatement element) throws IOException {
60350    composeDomainResourceProperties(element);
60351      if (element.hasIdentifier()) {
60352        openArray("identifier");
60353        for (Identifier e : element.getIdentifier()) 
60354          composeIdentifier(null, e);
60355        closeArray();
60356      };
60357      if (element.hasPartOf()) {
60358        openArray("partOf");
60359        for (Reference e : element.getPartOf()) 
60360          composeReference(null, e);
60361        closeArray();
60362      };
60363      if (element.hasStatusElement()) {
60364        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusCodesEnumFactory(), false);
60365        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusCodesEnumFactory(), false);
60366      }
60367      if (element.hasCategory()) {
60368        openArray("category");
60369        for (CodeableConcept e : element.getCategory()) 
60370          composeCodeableConcept(null, e);
60371        closeArray();
60372      };
60373      if (element.hasMedication()) {
60374        composeCodeableReference("medication", element.getMedication());
60375      }
60376      if (element.hasSubject()) {
60377        composeReference("subject", element.getSubject());
60378      }
60379      if (element.hasEncounter()) {
60380        composeReference("encounter", element.getEncounter());
60381      }
60382      if (element.hasEffective()) {
60383        composeType("effective", element.getEffective());
60384      }
60385      if (element.hasDateAssertedElement()) {
60386        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
60387        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
60388      }
60389      if (element.hasInformationSource()) {
60390        openArray("informationSource");
60391        for (Reference e : element.getInformationSource()) 
60392          composeReference(null, e);
60393        closeArray();
60394      };
60395      if (element.hasDerivedFrom()) {
60396        openArray("derivedFrom");
60397        for (Reference e : element.getDerivedFrom()) 
60398          composeReference(null, e);
60399        closeArray();
60400      };
60401      if (element.hasReason()) {
60402        openArray("reason");
60403        for (CodeableReference e : element.getReason()) 
60404          composeCodeableReference(null, e);
60405        closeArray();
60406      };
60407      if (element.hasNote()) {
60408        openArray("note");
60409        for (Annotation e : element.getNote()) 
60410          composeAnnotation(null, e);
60411        closeArray();
60412      };
60413      if (element.hasRelatedClinicalInformation()) {
60414        openArray("relatedClinicalInformation");
60415        for (Reference e : element.getRelatedClinicalInformation()) 
60416          composeReference(null, e);
60417        closeArray();
60418      };
60419      if (element.hasRenderedDosageInstructionElement()) {
60420        composeMarkdownCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60421        composeMarkdownExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60422      }
60423      if (element.hasDosage()) {
60424        openArray("dosage");
60425        for (Dosage e : element.getDosage()) 
60426          composeDosage(null, e);
60427        closeArray();
60428      };
60429      if (element.hasAdherence()) {
60430        composeMedicationStatementAdherenceComponent("adherence", element.getAdherence());
60431      }
60432  }
60433
60434  protected void composeMedicationStatementAdherenceComponent(String name, MedicationStatement.MedicationStatementAdherenceComponent element) throws IOException {
60435    if (element != null) {
60436      open(name);
60437      composeMedicationStatementAdherenceComponentProperties(element);
60438      close();
60439    }
60440  }
60441
60442  protected void composeMedicationStatementAdherenceComponentProperties(MedicationStatement.MedicationStatementAdherenceComponent element) throws IOException {
60443    composeBackboneElementProperties(element);
60444      if (element.hasCode()) {
60445        composeCodeableConcept("code", element.getCode());
60446      }
60447      if (element.hasReason()) {
60448        composeCodeableConcept("reason", element.getReason());
60449      }
60450  }
60451
60452  protected void composeMedicinalProductDefinition(String name, MedicinalProductDefinition element) throws IOException {
60453    if (element != null) {
60454      prop("resourceType", name);
60455      composeMedicinalProductDefinitionProperties(element);
60456    }
60457  }
60458
60459  protected void composeMedicinalProductDefinitionProperties(MedicinalProductDefinition element) throws IOException {
60460    composeDomainResourceProperties(element);
60461      if (element.hasIdentifier()) {
60462        openArray("identifier");
60463        for (Identifier e : element.getIdentifier()) 
60464          composeIdentifier(null, e);
60465        closeArray();
60466      };
60467      if (element.hasType()) {
60468        composeCodeableConcept("type", element.getType());
60469      }
60470      if (element.hasDomain()) {
60471        composeCodeableConcept("domain", element.getDomain());
60472      }
60473      if (element.hasVersionElement()) {
60474        composeStringCore("version", element.getVersionElement(), false);
60475        composeStringExtras("version", element.getVersionElement(), false);
60476      }
60477      if (element.hasStatus()) {
60478        composeCodeableConcept("status", element.getStatus());
60479      }
60480      if (element.hasStatusDateElement()) {
60481        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
60482        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
60483      }
60484      if (element.hasDescriptionElement()) {
60485        composeMarkdownCore("description", element.getDescriptionElement(), false);
60486        composeMarkdownExtras("description", element.getDescriptionElement(), false);
60487      }
60488      if (element.hasCombinedPharmaceuticalDoseForm()) {
60489        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
60490      }
60491      if (element.hasRoute()) {
60492        openArray("route");
60493        for (CodeableConcept e : element.getRoute()) 
60494          composeCodeableConcept(null, e);
60495        closeArray();
60496      };
60497      if (element.hasIndicationElement()) {
60498        composeMarkdownCore("indication", element.getIndicationElement(), false);
60499        composeMarkdownExtras("indication", element.getIndicationElement(), false);
60500      }
60501      if (element.hasLegalStatusOfSupply()) {
60502        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
60503      }
60504      if (element.hasAdditionalMonitoringIndicator()) {
60505        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
60506      }
60507      if (element.hasSpecialMeasures()) {
60508        openArray("specialMeasures");
60509        for (CodeableConcept e : element.getSpecialMeasures()) 
60510          composeCodeableConcept(null, e);
60511        closeArray();
60512      };
60513      if (element.hasPediatricUseIndicator()) {
60514        composeCodeableConcept("pediatricUseIndicator", element.getPediatricUseIndicator());
60515      }
60516      if (element.hasClassification()) {
60517        openArray("classification");
60518        for (CodeableConcept e : element.getClassification()) 
60519          composeCodeableConcept(null, e);
60520        closeArray();
60521      };
60522      if (element.hasMarketingStatus()) {
60523        openArray("marketingStatus");
60524        for (MarketingStatus e : element.getMarketingStatus()) 
60525          composeMarketingStatus(null, e);
60526        closeArray();
60527      };
60528      if (element.hasPackagedMedicinalProduct()) {
60529        openArray("packagedMedicinalProduct");
60530        for (CodeableConcept e : element.getPackagedMedicinalProduct()) 
60531          composeCodeableConcept(null, e);
60532        closeArray();
60533      };
60534      if (element.hasComprisedOf()) {
60535        openArray("comprisedOf");
60536        for (Reference e : element.getComprisedOf()) 
60537          composeReference(null, e);
60538        closeArray();
60539      };
60540      if (element.hasIngredient()) {
60541        openArray("ingredient");
60542        for (CodeableConcept e : element.getIngredient()) 
60543          composeCodeableConcept(null, e);
60544        closeArray();
60545      };
60546      if (element.hasImpurity()) {
60547        openArray("impurity");
60548        for (CodeableReference e : element.getImpurity()) 
60549          composeCodeableReference(null, e);
60550        closeArray();
60551      };
60552      if (element.hasAttachedDocument()) {
60553        openArray("attachedDocument");
60554        for (Reference e : element.getAttachedDocument()) 
60555          composeReference(null, e);
60556        closeArray();
60557      };
60558      if (element.hasMasterFile()) {
60559        openArray("masterFile");
60560        for (Reference e : element.getMasterFile()) 
60561          composeReference(null, e);
60562        closeArray();
60563      };
60564      if (element.hasContact()) {
60565        openArray("contact");
60566        for (MedicinalProductDefinition.MedicinalProductDefinitionContactComponent e : element.getContact()) 
60567          composeMedicinalProductDefinitionContactComponent(null, e);
60568        closeArray();
60569      };
60570      if (element.hasClinicalTrial()) {
60571        openArray("clinicalTrial");
60572        for (Reference e : element.getClinicalTrial()) 
60573          composeReference(null, e);
60574        closeArray();
60575      };
60576      if (element.hasCode()) {
60577        openArray("code");
60578        for (Coding e : element.getCode()) 
60579          composeCoding(null, e);
60580        closeArray();
60581      };
60582      if (element.hasName()) {
60583        openArray("name");
60584        for (MedicinalProductDefinition.MedicinalProductDefinitionNameComponent e : element.getName()) 
60585          composeMedicinalProductDefinitionNameComponent(null, e);
60586        closeArray();
60587      };
60588      if (element.hasCrossReference()) {
60589        openArray("crossReference");
60590        for (MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent e : element.getCrossReference()) 
60591          composeMedicinalProductDefinitionCrossReferenceComponent(null, e);
60592        closeArray();
60593      };
60594      if (element.hasOperation()) {
60595        openArray("operation");
60596        for (MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent e : element.getOperation()) 
60597          composeMedicinalProductDefinitionOperationComponent(null, e);
60598        closeArray();
60599      };
60600      if (element.hasCharacteristic()) {
60601        openArray("characteristic");
60602        for (MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent e : element.getCharacteristic()) 
60603          composeMedicinalProductDefinitionCharacteristicComponent(null, e);
60604        closeArray();
60605      };
60606  }
60607
60608  protected void composeMedicinalProductDefinitionContactComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
60609    if (element != null) {
60610      open(name);
60611      composeMedicinalProductDefinitionContactComponentProperties(element);
60612      close();
60613    }
60614  }
60615
60616  protected void composeMedicinalProductDefinitionContactComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
60617    composeBackboneElementProperties(element);
60618      if (element.hasType()) {
60619        composeCodeableConcept("type", element.getType());
60620      }
60621      if (element.hasContact()) {
60622        composeReference("contact", element.getContact());
60623      }
60624  }
60625
60626  protected void composeMedicinalProductDefinitionNameComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
60627    if (element != null) {
60628      open(name);
60629      composeMedicinalProductDefinitionNameComponentProperties(element);
60630      close();
60631    }
60632  }
60633
60634  protected void composeMedicinalProductDefinitionNameComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
60635    composeBackboneElementProperties(element);
60636      if (element.hasProductNameElement()) {
60637        composeStringCore("productName", element.getProductNameElement(), false);
60638        composeStringExtras("productName", element.getProductNameElement(), false);
60639      }
60640      if (element.hasType()) {
60641        composeCodeableConcept("type", element.getType());
60642      }
60643      if (element.hasPart()) {
60644        openArray("part");
60645        for (MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent e : element.getPart()) 
60646          composeMedicinalProductDefinitionNamePartComponent(null, e);
60647        closeArray();
60648      };
60649      if (element.hasUsage()) {
60650        openArray("usage");
60651        for (MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent e : element.getUsage()) 
60652          composeMedicinalProductDefinitionNameUsageComponent(null, e);
60653        closeArray();
60654      };
60655  }
60656
60657  protected void composeMedicinalProductDefinitionNamePartComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent element) throws IOException {
60658    if (element != null) {
60659      open(name);
60660      composeMedicinalProductDefinitionNamePartComponentProperties(element);
60661      close();
60662    }
60663  }
60664
60665  protected void composeMedicinalProductDefinitionNamePartComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent element) throws IOException {
60666    composeBackboneElementProperties(element);
60667      if (element.hasPartElement()) {
60668        composeStringCore("part", element.getPartElement(), false);
60669        composeStringExtras("part", element.getPartElement(), false);
60670      }
60671      if (element.hasType()) {
60672        composeCodeableConcept("type", element.getType());
60673      }
60674  }
60675
60676  protected void composeMedicinalProductDefinitionNameUsageComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent element) throws IOException {
60677    if (element != null) {
60678      open(name);
60679      composeMedicinalProductDefinitionNameUsageComponentProperties(element);
60680      close();
60681    }
60682  }
60683
60684  protected void composeMedicinalProductDefinitionNameUsageComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent element) throws IOException {
60685    composeBackboneElementProperties(element);
60686      if (element.hasCountry()) {
60687        composeCodeableConcept("country", element.getCountry());
60688      }
60689      if (element.hasJurisdiction()) {
60690        composeCodeableConcept("jurisdiction", element.getJurisdiction());
60691      }
60692      if (element.hasLanguage()) {
60693        composeCodeableConcept("language", element.getLanguage());
60694      }
60695  }
60696
60697  protected void composeMedicinalProductDefinitionCrossReferenceComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
60698    if (element != null) {
60699      open(name);
60700      composeMedicinalProductDefinitionCrossReferenceComponentProperties(element);
60701      close();
60702    }
60703  }
60704
60705  protected void composeMedicinalProductDefinitionCrossReferenceComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
60706    composeBackboneElementProperties(element);
60707      if (element.hasProduct()) {
60708        composeCodeableReference("product", element.getProduct());
60709      }
60710      if (element.hasType()) {
60711        composeCodeableConcept("type", element.getType());
60712      }
60713  }
60714
60715  protected void composeMedicinalProductDefinitionOperationComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent element) throws IOException {
60716    if (element != null) {
60717      open(name);
60718      composeMedicinalProductDefinitionOperationComponentProperties(element);
60719      close();
60720    }
60721  }
60722
60723  protected void composeMedicinalProductDefinitionOperationComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent element) throws IOException {
60724    composeBackboneElementProperties(element);
60725      if (element.hasType()) {
60726        composeCodeableReference("type", element.getType());
60727      }
60728      if (element.hasEffectiveDate()) {
60729        composePeriod("effectiveDate", element.getEffectiveDate());
60730      }
60731      if (element.hasOrganization()) {
60732        openArray("organization");
60733        for (Reference e : element.getOrganization()) 
60734          composeReference(null, e);
60735        closeArray();
60736      };
60737      if (element.hasConfidentialityIndicator()) {
60738        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
60739      }
60740  }
60741
60742  protected void composeMedicinalProductDefinitionCharacteristicComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent element) throws IOException {
60743    if (element != null) {
60744      open(name);
60745      composeMedicinalProductDefinitionCharacteristicComponentProperties(element);
60746      close();
60747    }
60748  }
60749
60750  protected void composeMedicinalProductDefinitionCharacteristicComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent element) throws IOException {
60751    composeBackboneElementProperties(element);
60752      if (element.hasType()) {
60753        composeCodeableConcept("type", element.getType());
60754      }
60755      if (element.hasValue()) {
60756        composeType("value", element.getValue());
60757      }
60758  }
60759
60760  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
60761    if (element != null) {
60762      prop("resourceType", name);
60763      composeMessageDefinitionProperties(element);
60764    }
60765  }
60766
60767  protected void composeMessageDefinitionProperties(MessageDefinition element) throws IOException {
60768    composeCanonicalResourceProperties(element);
60769      if (element.hasUrlElement()) {
60770        composeUriCore("url", element.getUrlElement(), false);
60771        composeUriExtras("url", element.getUrlElement(), false);
60772      }
60773      if (element.hasIdentifier()) {
60774        openArray("identifier");
60775        for (Identifier e : element.getIdentifier()) 
60776          composeIdentifier(null, e);
60777        closeArray();
60778      };
60779      if (element.hasVersionElement()) {
60780        composeStringCore("version", element.getVersionElement(), false);
60781        composeStringExtras("version", element.getVersionElement(), false);
60782      }
60783      if (element.hasVersionAlgorithm()) {
60784        composeType("versionAlgorithm", element.getVersionAlgorithm());
60785      }
60786      if (element.hasNameElement()) {
60787        composeStringCore("name", element.getNameElement(), false);
60788        composeStringExtras("name", element.getNameElement(), false);
60789      }
60790      if (element.hasTitleElement()) {
60791        composeStringCore("title", element.getTitleElement(), false);
60792        composeStringExtras("title", element.getTitleElement(), false);
60793      }
60794      if (element.hasReplaces()) {
60795        if (anyHasValue(element.getReplaces())) {
60796          openArray("replaces");
60797          for (CanonicalType e : element.getReplaces()) 
60798            composeCanonicalCore(null, e, e != element.getReplaces().get(element.getReplaces().size()-1));
60799          closeArray();
60800        }
60801        if (anyHasExtras(element.getReplaces())) {
60802          openArray("_replaces");
60803          for (CanonicalType e : element.getReplaces()) 
60804            composeCanonicalExtras(null, e, true);
60805          closeArray();
60806        }
60807      };
60808      if (element.hasStatusElement()) {
60809        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
60810        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
60811      }
60812      if (element.hasExperimentalElement()) {
60813        composeBooleanCore("experimental", element.getExperimentalElement(), false);
60814        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
60815      }
60816      if (element.hasDateElement()) {
60817        composeDateTimeCore("date", element.getDateElement(), false);
60818        composeDateTimeExtras("date", element.getDateElement(), false);
60819      }
60820      if (element.hasPublisherElement()) {
60821        composeStringCore("publisher", element.getPublisherElement(), false);
60822        composeStringExtras("publisher", element.getPublisherElement(), false);
60823      }
60824      if (element.hasContact()) {
60825        openArray("contact");
60826        for (ContactDetail e : element.getContact()) 
60827          composeContactDetail(null, e);
60828        closeArray();
60829      };
60830      if (element.hasDescriptionElement()) {
60831        composeMarkdownCore("description", element.getDescriptionElement(), false);
60832        composeMarkdownExtras("description", element.getDescriptionElement(), false);
60833      }
60834      if (element.hasUseContext()) {
60835        openArray("useContext");
60836        for (UsageContext e : element.getUseContext()) 
60837          composeUsageContext(null, e);
60838        closeArray();
60839      };
60840      if (element.hasJurisdiction()) {
60841        openArray("jurisdiction");
60842        for (CodeableConcept e : element.getJurisdiction()) 
60843          composeCodeableConcept(null, e);
60844        closeArray();
60845      };
60846      if (element.hasPurposeElement()) {
60847        composeMarkdownCore("purpose", element.getPurposeElement(), false);
60848        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
60849      }
60850      if (element.hasCopyrightElement()) {
60851        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
60852        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
60853      }
60854      if (element.hasCopyrightLabelElement()) {
60855        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
60856        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
60857      }
60858      if (element.hasBaseElement()) {
60859        composeCanonicalCore("base", element.getBaseElement(), false);
60860        composeCanonicalExtras("base", element.getBaseElement(), false);
60861      }
60862      if (element.hasParent()) {
60863        if (anyHasValue(element.getParent())) {
60864          openArray("parent");
60865          for (CanonicalType e : element.getParent()) 
60866            composeCanonicalCore(null, e, e != element.getParent().get(element.getParent().size()-1));
60867          closeArray();
60868        }
60869        if (anyHasExtras(element.getParent())) {
60870          openArray("_parent");
60871          for (CanonicalType e : element.getParent()) 
60872            composeCanonicalExtras(null, e, true);
60873          closeArray();
60874        }
60875      };
60876      if (element.hasEvent()) {
60877        composeType("event", element.getEvent());
60878      }
60879      if (element.hasCategoryElement()) {
60880        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
60881        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
60882      }
60883      if (element.hasFocus()) {
60884        openArray("focus");
60885        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
60886          composeMessageDefinitionFocusComponent(null, e);
60887        closeArray();
60888      };
60889      if (element.hasResponseRequiredElement()) {
60890        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
60891        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
60892      }
60893      if (element.hasAllowedResponse()) {
60894        openArray("allowedResponse");
60895        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
60896          composeMessageDefinitionAllowedResponseComponent(null, e);
60897        closeArray();
60898      };
60899      if (element.hasGraphElement()) {
60900        composeCanonicalCore("graph", element.getGraphElement(), false);
60901        composeCanonicalExtras("graph", element.getGraphElement(), false);
60902      }
60903  }
60904
60905  protected void composeMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
60906    if (element != null) {
60907      open(name);
60908      composeMessageDefinitionFocusComponentProperties(element);
60909      close();
60910    }
60911  }
60912
60913  protected void composeMessageDefinitionFocusComponentProperties(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
60914    composeBackboneElementProperties(element);
60915      if (element.hasCodeElement()) {
60916        composeCodeCore("code", element.getCodeElement(), false);
60917        composeCodeExtras("code", element.getCodeElement(), false);
60918      }
60919      if (element.hasProfileElement()) {
60920        composeCanonicalCore("profile", element.getProfileElement(), false);
60921        composeCanonicalExtras("profile", element.getProfileElement(), false);
60922      }
60923      if (element.hasMinElement()) {
60924        composeUnsignedIntCore("min", element.getMinElement(), false);
60925        composeUnsignedIntExtras("min", element.getMinElement(), false);
60926      }
60927      if (element.hasMaxElement()) {
60928        composeStringCore("max", element.getMaxElement(), false);
60929        composeStringExtras("max", element.getMaxElement(), false);
60930      }
60931  }
60932
60933  protected void composeMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
60934    if (element != null) {
60935      open(name);
60936      composeMessageDefinitionAllowedResponseComponentProperties(element);
60937      close();
60938    }
60939  }
60940
60941  protected void composeMessageDefinitionAllowedResponseComponentProperties(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
60942    composeBackboneElementProperties(element);
60943      if (element.hasMessageElement()) {
60944        composeCanonicalCore("message", element.getMessageElement(), false);
60945        composeCanonicalExtras("message", element.getMessageElement(), false);
60946      }
60947      if (element.hasSituationElement()) {
60948        composeMarkdownCore("situation", element.getSituationElement(), false);
60949        composeMarkdownExtras("situation", element.getSituationElement(), false);
60950      }
60951  }
60952
60953  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
60954    if (element != null) {
60955      prop("resourceType", name);
60956      composeMessageHeaderProperties(element);
60957    }
60958  }
60959
60960  protected void composeMessageHeaderProperties(MessageHeader element) throws IOException {
60961    composeDomainResourceProperties(element);
60962      if (element.hasEvent()) {
60963        composeType("event", element.getEvent());
60964      }
60965      if (element.hasDestination()) {
60966        openArray("destination");
60967        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
60968          composeMessageDestinationComponent(null, e);
60969        closeArray();
60970      };
60971      if (element.hasSender()) {
60972        composeReference("sender", element.getSender());
60973      }
60974      if (element.hasAuthor()) {
60975        composeReference("author", element.getAuthor());
60976      }
60977      if (element.hasSource()) {
60978        composeMessageSourceComponent("source", element.getSource());
60979      }
60980      if (element.hasResponsible()) {
60981        composeReference("responsible", element.getResponsible());
60982      }
60983      if (element.hasReason()) {
60984        composeCodeableConcept("reason", element.getReason());
60985      }
60986      if (element.hasResponse()) {
60987        composeMessageHeaderResponseComponent("response", element.getResponse());
60988      }
60989      if (element.hasFocus()) {
60990        openArray("focus");
60991        for (Reference e : element.getFocus()) 
60992          composeReference(null, e);
60993        closeArray();
60994      };
60995      if (element.hasDefinitionElement()) {
60996        composeCanonicalCore("definition", element.getDefinitionElement(), false);
60997        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
60998      }
60999  }
61000
61001  protected void composeMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
61002    if (element != null) {
61003      open(name);
61004      composeMessageDestinationComponentProperties(element);
61005      close();
61006    }
61007  }
61008
61009  protected void composeMessageDestinationComponentProperties(MessageHeader.MessageDestinationComponent element) throws IOException {
61010    composeBackboneElementProperties(element);
61011      if (element.hasEndpoint()) {
61012        composeType("endpoint", element.getEndpoint());
61013      }
61014      if (element.hasNameElement()) {
61015        composeStringCore("name", element.getNameElement(), false);
61016        composeStringExtras("name", element.getNameElement(), false);
61017      }
61018      if (element.hasTarget()) {
61019        composeReference("target", element.getTarget());
61020      }
61021      if (element.hasReceiver()) {
61022        composeReference("receiver", element.getReceiver());
61023      }
61024  }
61025
61026  protected void composeMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
61027    if (element != null) {
61028      open(name);
61029      composeMessageSourceComponentProperties(element);
61030      close();
61031    }
61032  }
61033
61034  protected void composeMessageSourceComponentProperties(MessageHeader.MessageSourceComponent element) throws IOException {
61035    composeBackboneElementProperties(element);
61036      if (element.hasEndpoint()) {
61037        composeType("endpoint", element.getEndpoint());
61038      }
61039      if (element.hasNameElement()) {
61040        composeStringCore("name", element.getNameElement(), false);
61041        composeStringExtras("name", element.getNameElement(), false);
61042      }
61043      if (element.hasSoftwareElement()) {
61044        composeStringCore("software", element.getSoftwareElement(), false);
61045        composeStringExtras("software", element.getSoftwareElement(), false);
61046      }
61047      if (element.hasVersionElement()) {
61048        composeStringCore("version", element.getVersionElement(), false);
61049        composeStringExtras("version", element.getVersionElement(), false);
61050      }
61051      if (element.hasContact()) {
61052        composeContactPoint("contact", element.getContact());
61053      }
61054  }
61055
61056  protected void composeMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
61057    if (element != null) {
61058      open(name);
61059      composeMessageHeaderResponseComponentProperties(element);
61060      close();
61061    }
61062  }
61063
61064  protected void composeMessageHeaderResponseComponentProperties(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
61065    composeBackboneElementProperties(element);
61066      if (element.hasIdentifier()) {
61067        composeIdentifier("identifier", element.getIdentifier());
61068      }
61069      if (element.hasCodeElement()) {
61070        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
61071        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
61072      }
61073      if (element.hasDetails()) {
61074        composeReference("details", element.getDetails());
61075      }
61076  }
61077
61078  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
61079    if (element != null) {
61080      prop("resourceType", name);
61081      composeMolecularSequenceProperties(element);
61082    }
61083  }
61084
61085  protected void composeMolecularSequenceProperties(MolecularSequence element) throws IOException {
61086    composeDomainResourceProperties(element);
61087      if (element.hasIdentifier()) {
61088        openArray("identifier");
61089        for (Identifier e : element.getIdentifier()) 
61090          composeIdentifier(null, e);
61091        closeArray();
61092      };
61093      if (element.hasTypeElement()) {
61094        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
61095        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
61096      }
61097      if (element.hasSubject()) {
61098        composeReference("subject", element.getSubject());
61099      }
61100      if (element.hasFocus()) {
61101        openArray("focus");
61102        for (Reference e : element.getFocus()) 
61103          composeReference(null, e);
61104        closeArray();
61105      };
61106      if (element.hasSpecimen()) {
61107        composeReference("specimen", element.getSpecimen());
61108      }
61109      if (element.hasDevice()) {
61110        composeReference("device", element.getDevice());
61111      }
61112      if (element.hasPerformer()) {
61113        composeReference("performer", element.getPerformer());
61114      }
61115      if (element.hasLiteralElement()) {
61116        composeStringCore("literal", element.getLiteralElement(), false);
61117        composeStringExtras("literal", element.getLiteralElement(), false);
61118      }
61119      if (element.hasFormatted()) {
61120        openArray("formatted");
61121        for (Attachment e : element.getFormatted()) 
61122          composeAttachment(null, e);
61123        closeArray();
61124      };
61125      if (element.hasRelative()) {
61126        openArray("relative");
61127        for (MolecularSequence.MolecularSequenceRelativeComponent e : element.getRelative()) 
61128          composeMolecularSequenceRelativeComponent(null, e);
61129        closeArray();
61130      };
61131  }
61132
61133  protected void composeMolecularSequenceRelativeComponent(String name, MolecularSequence.MolecularSequenceRelativeComponent element) throws IOException {
61134    if (element != null) {
61135      open(name);
61136      composeMolecularSequenceRelativeComponentProperties(element);
61137      close();
61138    }
61139  }
61140
61141  protected void composeMolecularSequenceRelativeComponentProperties(MolecularSequence.MolecularSequenceRelativeComponent element) throws IOException {
61142    composeBackboneElementProperties(element);
61143      if (element.hasCoordinateSystem()) {
61144        composeCodeableConcept("coordinateSystem", element.getCoordinateSystem());
61145      }
61146      if (element.hasOrdinalPositionElement()) {
61147        composeIntegerCore("ordinalPosition", element.getOrdinalPositionElement(), false);
61148        composeIntegerExtras("ordinalPosition", element.getOrdinalPositionElement(), false);
61149      }
61150      if (element.hasSequenceRange()) {
61151        composeRange("sequenceRange", element.getSequenceRange());
61152      }
61153      if (element.hasStartingSequence()) {
61154        composeMolecularSequenceRelativeStartingSequenceComponent("startingSequence", element.getStartingSequence());
61155      }
61156      if (element.hasEdit()) {
61157        openArray("edit");
61158        for (MolecularSequence.MolecularSequenceRelativeEditComponent e : element.getEdit()) 
61159          composeMolecularSequenceRelativeEditComponent(null, e);
61160        closeArray();
61161      };
61162  }
61163
61164  protected void composeMolecularSequenceRelativeStartingSequenceComponent(String name, MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent element) throws IOException {
61165    if (element != null) {
61166      open(name);
61167      composeMolecularSequenceRelativeStartingSequenceComponentProperties(element);
61168      close();
61169    }
61170  }
61171
61172  protected void composeMolecularSequenceRelativeStartingSequenceComponentProperties(MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent element) throws IOException {
61173    composeBackboneElementProperties(element);
61174      if (element.hasGenomeAssembly()) {
61175        composeCodeableConcept("genomeAssembly", element.getGenomeAssembly());
61176      }
61177      if (element.hasChromosome()) {
61178        composeCodeableConcept("chromosome", element.getChromosome());
61179      }
61180      if (element.hasSequence()) {
61181        composeType("sequence", element.getSequence());
61182      }
61183      if (element.hasWindowStartElement()) {
61184        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
61185        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
61186      }
61187      if (element.hasWindowEndElement()) {
61188        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
61189        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
61190      }
61191      if (element.hasOrientationElement()) {
61192        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
61193        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
61194      }
61195      if (element.hasStrandElement()) {
61196        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
61197        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
61198      }
61199  }
61200
61201  protected void composeMolecularSequenceRelativeEditComponent(String name, MolecularSequence.MolecularSequenceRelativeEditComponent element) throws IOException {
61202    if (element != null) {
61203      open(name);
61204      composeMolecularSequenceRelativeEditComponentProperties(element);
61205      close();
61206    }
61207  }
61208
61209  protected void composeMolecularSequenceRelativeEditComponentProperties(MolecularSequence.MolecularSequenceRelativeEditComponent element) throws IOException {
61210    composeBackboneElementProperties(element);
61211      if (element.hasStartElement()) {
61212        composeIntegerCore("start", element.getStartElement(), false);
61213        composeIntegerExtras("start", element.getStartElement(), false);
61214      }
61215      if (element.hasEndElement()) {
61216        composeIntegerCore("end", element.getEndElement(), false);
61217        composeIntegerExtras("end", element.getEndElement(), false);
61218      }
61219      if (element.hasReplacementSequenceElement()) {
61220        composeStringCore("replacementSequence", element.getReplacementSequenceElement(), false);
61221        composeStringExtras("replacementSequence", element.getReplacementSequenceElement(), false);
61222      }
61223      if (element.hasReplacedSequenceElement()) {
61224        composeStringCore("replacedSequence", element.getReplacedSequenceElement(), false);
61225        composeStringExtras("replacedSequence", element.getReplacedSequenceElement(), false);
61226      }
61227  }
61228
61229  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
61230    if (element != null) {
61231      prop("resourceType", name);
61232      composeNamingSystemProperties(element);
61233    }
61234  }
61235
61236  protected void composeNamingSystemProperties(NamingSystem element) throws IOException {
61237    composeMetadataResourceProperties(element);
61238      if (element.hasUrlElement()) {
61239        composeUriCore("url", element.getUrlElement(), false);
61240        composeUriExtras("url", element.getUrlElement(), false);
61241      }
61242      if (element.hasIdentifier()) {
61243        openArray("identifier");
61244        for (Identifier e : element.getIdentifier()) 
61245          composeIdentifier(null, e);
61246        closeArray();
61247      };
61248      if (element.hasVersionElement()) {
61249        composeStringCore("version", element.getVersionElement(), false);
61250        composeStringExtras("version", element.getVersionElement(), false);
61251      }
61252      if (element.hasVersionAlgorithm()) {
61253        composeType("versionAlgorithm", element.getVersionAlgorithm());
61254      }
61255      if (element.hasNameElement()) {
61256        composeStringCore("name", element.getNameElement(), false);
61257        composeStringExtras("name", element.getNameElement(), false);
61258      }
61259      if (element.hasTitleElement()) {
61260        composeStringCore("title", element.getTitleElement(), false);
61261        composeStringExtras("title", element.getTitleElement(), false);
61262      }
61263      if (element.hasStatusElement()) {
61264        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
61265        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
61266      }
61267      if (element.hasKindElement()) {
61268        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
61269        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
61270      }
61271      if (element.hasExperimentalElement()) {
61272        composeBooleanCore("experimental", element.getExperimentalElement(), false);
61273        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
61274      }
61275      if (element.hasDateElement()) {
61276        composeDateTimeCore("date", element.getDateElement(), false);
61277        composeDateTimeExtras("date", element.getDateElement(), false);
61278      }
61279      if (element.hasPublisherElement()) {
61280        composeStringCore("publisher", element.getPublisherElement(), false);
61281        composeStringExtras("publisher", element.getPublisherElement(), false);
61282      }
61283      if (element.hasContact()) {
61284        openArray("contact");
61285        for (ContactDetail e : element.getContact()) 
61286          composeContactDetail(null, e);
61287        closeArray();
61288      };
61289      if (element.hasResponsibleElement()) {
61290        composeStringCore("responsible", element.getResponsibleElement(), false);
61291        composeStringExtras("responsible", element.getResponsibleElement(), false);
61292      }
61293      if (element.hasType()) {
61294        composeCodeableConcept("type", element.getType());
61295      }
61296      if (element.hasDescriptionElement()) {
61297        composeMarkdownCore("description", element.getDescriptionElement(), false);
61298        composeMarkdownExtras("description", element.getDescriptionElement(), false);
61299      }
61300      if (element.hasUseContext()) {
61301        openArray("useContext");
61302        for (UsageContext e : element.getUseContext()) 
61303          composeUsageContext(null, e);
61304        closeArray();
61305      };
61306      if (element.hasJurisdiction()) {
61307        openArray("jurisdiction");
61308        for (CodeableConcept e : element.getJurisdiction()) 
61309          composeCodeableConcept(null, e);
61310        closeArray();
61311      };
61312      if (element.hasPurposeElement()) {
61313        composeMarkdownCore("purpose", element.getPurposeElement(), false);
61314        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
61315      }
61316      if (element.hasCopyrightElement()) {
61317        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
61318        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
61319      }
61320      if (element.hasCopyrightLabelElement()) {
61321        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
61322        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
61323      }
61324      if (element.hasApprovalDateElement()) {
61325        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
61326        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
61327      }
61328      if (element.hasLastReviewDateElement()) {
61329        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
61330        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
61331      }
61332      if (element.hasEffectivePeriod()) {
61333        composePeriod("effectivePeriod", element.getEffectivePeriod());
61334      }
61335      if (element.hasTopic()) {
61336        openArray("topic");
61337        for (CodeableConcept e : element.getTopic()) 
61338          composeCodeableConcept(null, e);
61339        closeArray();
61340      };
61341      if (element.hasAuthor()) {
61342        openArray("author");
61343        for (ContactDetail e : element.getAuthor()) 
61344          composeContactDetail(null, e);
61345        closeArray();
61346      };
61347      if (element.hasEditor()) {
61348        openArray("editor");
61349        for (ContactDetail e : element.getEditor()) 
61350          composeContactDetail(null, e);
61351        closeArray();
61352      };
61353      if (element.hasReviewer()) {
61354        openArray("reviewer");
61355        for (ContactDetail e : element.getReviewer()) 
61356          composeContactDetail(null, e);
61357        closeArray();
61358      };
61359      if (element.hasEndorser()) {
61360        openArray("endorser");
61361        for (ContactDetail e : element.getEndorser()) 
61362          composeContactDetail(null, e);
61363        closeArray();
61364      };
61365      if (element.hasRelatedArtifact()) {
61366        openArray("relatedArtifact");
61367        for (RelatedArtifact e : element.getRelatedArtifact()) 
61368          composeRelatedArtifact(null, e);
61369        closeArray();
61370      };
61371      if (element.hasUsageElement()) {
61372        composeStringCore("usage", element.getUsageElement(), false);
61373        composeStringExtras("usage", element.getUsageElement(), false);
61374      }
61375      if (element.hasUniqueId()) {
61376        openArray("uniqueId");
61377        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
61378          composeNamingSystemUniqueIdComponent(null, e);
61379        closeArray();
61380      };
61381  }
61382
61383  protected void composeNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
61384    if (element != null) {
61385      open(name);
61386      composeNamingSystemUniqueIdComponentProperties(element);
61387      close();
61388    }
61389  }
61390
61391  protected void composeNamingSystemUniqueIdComponentProperties(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
61392    composeBackboneElementProperties(element);
61393      if (element.hasTypeElement()) {
61394        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
61395        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
61396      }
61397      if (element.hasValueElement()) {
61398        composeStringCore("value", element.getValueElement(), false);
61399        composeStringExtras("value", element.getValueElement(), false);
61400      }
61401      if (element.hasPreferredElement()) {
61402        composeBooleanCore("preferred", element.getPreferredElement(), false);
61403        composeBooleanExtras("preferred", element.getPreferredElement(), false);
61404      }
61405      if (element.hasCommentElement()) {
61406        composeStringCore("comment", element.getCommentElement(), false);
61407        composeStringExtras("comment", element.getCommentElement(), false);
61408      }
61409      if (element.hasPeriod()) {
61410        composePeriod("period", element.getPeriod());
61411      }
61412      if (element.hasAuthoritativeElement()) {
61413        composeBooleanCore("authoritative", element.getAuthoritativeElement(), false);
61414        composeBooleanExtras("authoritative", element.getAuthoritativeElement(), false);
61415      }
61416  }
61417
61418  protected void composeNutritionIntake(String name, NutritionIntake element) throws IOException {
61419    if (element != null) {
61420      prop("resourceType", name);
61421      composeNutritionIntakeProperties(element);
61422    }
61423  }
61424
61425  protected void composeNutritionIntakeProperties(NutritionIntake element) throws IOException {
61426    composeDomainResourceProperties(element);
61427      if (element.hasIdentifier()) {
61428        openArray("identifier");
61429        for (Identifier e : element.getIdentifier()) 
61430          composeIdentifier(null, e);
61431        closeArray();
61432      };
61433      if (element.hasInstantiatesCanonical()) {
61434        if (anyHasValue(element.getInstantiatesCanonical())) {
61435          openArray("instantiatesCanonical");
61436          for (CanonicalType e : element.getInstantiatesCanonical()) 
61437            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
61438          closeArray();
61439        }
61440        if (anyHasExtras(element.getInstantiatesCanonical())) {
61441          openArray("_instantiatesCanonical");
61442          for (CanonicalType e : element.getInstantiatesCanonical()) 
61443            composeCanonicalExtras(null, e, true);
61444          closeArray();
61445        }
61446      };
61447      if (element.hasInstantiatesUri()) {
61448        if (anyHasValue(element.getInstantiatesUri())) {
61449          openArray("instantiatesUri");
61450          for (UriType e : element.getInstantiatesUri()) 
61451            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
61452          closeArray();
61453        }
61454        if (anyHasExtras(element.getInstantiatesUri())) {
61455          openArray("_instantiatesUri");
61456          for (UriType e : element.getInstantiatesUri()) 
61457            composeUriExtras(null, e, true);
61458          closeArray();
61459        }
61460      };
61461      if (element.hasBasedOn()) {
61462        openArray("basedOn");
61463        for (Reference e : element.getBasedOn()) 
61464          composeReference(null, e);
61465        closeArray();
61466      };
61467      if (element.hasPartOf()) {
61468        openArray("partOf");
61469        for (Reference e : element.getPartOf()) 
61470          composeReference(null, e);
61471        closeArray();
61472      };
61473      if (element.hasStatusElement()) {
61474        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
61475        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
61476      }
61477      if (element.hasStatusReason()) {
61478        openArray("statusReason");
61479        for (CodeableConcept e : element.getStatusReason()) 
61480          composeCodeableConcept(null, e);
61481        closeArray();
61482      };
61483      if (element.hasCode()) {
61484        composeCodeableConcept("code", element.getCode());
61485      }
61486      if (element.hasSubject()) {
61487        composeReference("subject", element.getSubject());
61488      }
61489      if (element.hasEncounter()) {
61490        composeReference("encounter", element.getEncounter());
61491      }
61492      if (element.hasOccurrence()) {
61493        composeType("occurrence", element.getOccurrence());
61494      }
61495      if (element.hasRecordedElement()) {
61496        composeDateTimeCore("recorded", element.getRecordedElement(), false);
61497        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
61498      }
61499      if (element.hasReported()) {
61500        composeType("reported", element.getReported());
61501      }
61502      if (element.hasConsumedItem()) {
61503        openArray("consumedItem");
61504        for (NutritionIntake.NutritionIntakeConsumedItemComponent e : element.getConsumedItem()) 
61505          composeNutritionIntakeConsumedItemComponent(null, e);
61506        closeArray();
61507      };
61508      if (element.hasIngredientLabel()) {
61509        openArray("ingredientLabel");
61510        for (NutritionIntake.NutritionIntakeIngredientLabelComponent e : element.getIngredientLabel()) 
61511          composeNutritionIntakeIngredientLabelComponent(null, e);
61512        closeArray();
61513      };
61514      if (element.hasPerformer()) {
61515        openArray("performer");
61516        for (NutritionIntake.NutritionIntakePerformerComponent e : element.getPerformer()) 
61517          composeNutritionIntakePerformerComponent(null, e);
61518        closeArray();
61519      };
61520      if (element.hasLocation()) {
61521        composeReference("location", element.getLocation());
61522      }
61523      if (element.hasDerivedFrom()) {
61524        openArray("derivedFrom");
61525        for (Reference e : element.getDerivedFrom()) 
61526          composeReference(null, e);
61527        closeArray();
61528      };
61529      if (element.hasReason()) {
61530        openArray("reason");
61531        for (CodeableReference e : element.getReason()) 
61532          composeCodeableReference(null, e);
61533        closeArray();
61534      };
61535      if (element.hasNote()) {
61536        openArray("note");
61537        for (Annotation e : element.getNote()) 
61538          composeAnnotation(null, e);
61539        closeArray();
61540      };
61541  }
61542
61543  protected void composeNutritionIntakeConsumedItemComponent(String name, NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
61544    if (element != null) {
61545      open(name);
61546      composeNutritionIntakeConsumedItemComponentProperties(element);
61547      close();
61548    }
61549  }
61550
61551  protected void composeNutritionIntakeConsumedItemComponentProperties(NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
61552    composeBackboneElementProperties(element);
61553      if (element.hasType()) {
61554        composeCodeableConcept("type", element.getType());
61555      }
61556      if (element.hasNutritionProduct()) {
61557        composeCodeableReference("nutritionProduct", element.getNutritionProduct());
61558      }
61559      if (element.hasSchedule()) {
61560        composeTiming("schedule", element.getSchedule());
61561      }
61562      if (element.hasAmount()) {
61563        composeQuantity("amount", element.getAmount());
61564      }
61565      if (element.hasRate()) {
61566        composeQuantity("rate", element.getRate());
61567      }
61568      if (element.hasNotConsumedElement()) {
61569        composeBooleanCore("notConsumed", element.getNotConsumedElement(), false);
61570        composeBooleanExtras("notConsumed", element.getNotConsumedElement(), false);
61571      }
61572      if (element.hasNotConsumedReason()) {
61573        composeCodeableConcept("notConsumedReason", element.getNotConsumedReason());
61574      }
61575  }
61576
61577  protected void composeNutritionIntakeIngredientLabelComponent(String name, NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
61578    if (element != null) {
61579      open(name);
61580      composeNutritionIntakeIngredientLabelComponentProperties(element);
61581      close();
61582    }
61583  }
61584
61585  protected void composeNutritionIntakeIngredientLabelComponentProperties(NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
61586    composeBackboneElementProperties(element);
61587      if (element.hasNutrient()) {
61588        composeCodeableReference("nutrient", element.getNutrient());
61589      }
61590      if (element.hasAmount()) {
61591        composeQuantity("amount", element.getAmount());
61592      }
61593  }
61594
61595  protected void composeNutritionIntakePerformerComponent(String name, NutritionIntake.NutritionIntakePerformerComponent element) throws IOException {
61596    if (element != null) {
61597      open(name);
61598      composeNutritionIntakePerformerComponentProperties(element);
61599      close();
61600    }
61601  }
61602
61603  protected void composeNutritionIntakePerformerComponentProperties(NutritionIntake.NutritionIntakePerformerComponent element) throws IOException {
61604    composeBackboneElementProperties(element);
61605      if (element.hasFunction()) {
61606        composeCodeableConcept("function", element.getFunction());
61607      }
61608      if (element.hasActor()) {
61609        composeReference("actor", element.getActor());
61610      }
61611  }
61612
61613  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
61614    if (element != null) {
61615      prop("resourceType", name);
61616      composeNutritionOrderProperties(element);
61617    }
61618  }
61619
61620  protected void composeNutritionOrderProperties(NutritionOrder element) throws IOException {
61621    composeDomainResourceProperties(element);
61622      if (element.hasIdentifier()) {
61623        openArray("identifier");
61624        for (Identifier e : element.getIdentifier()) 
61625          composeIdentifier(null, e);
61626        closeArray();
61627      };
61628      if (element.hasInstantiatesCanonical()) {
61629        if (anyHasValue(element.getInstantiatesCanonical())) {
61630          openArray("instantiatesCanonical");
61631          for (CanonicalType e : element.getInstantiatesCanonical()) 
61632            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
61633          closeArray();
61634        }
61635        if (anyHasExtras(element.getInstantiatesCanonical())) {
61636          openArray("_instantiatesCanonical");
61637          for (CanonicalType e : element.getInstantiatesCanonical()) 
61638            composeCanonicalExtras(null, e, true);
61639          closeArray();
61640        }
61641      };
61642      if (element.hasInstantiatesUri()) {
61643        if (anyHasValue(element.getInstantiatesUri())) {
61644          openArray("instantiatesUri");
61645          for (UriType e : element.getInstantiatesUri()) 
61646            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
61647          closeArray();
61648        }
61649        if (anyHasExtras(element.getInstantiatesUri())) {
61650          openArray("_instantiatesUri");
61651          for (UriType e : element.getInstantiatesUri()) 
61652            composeUriExtras(null, e, true);
61653          closeArray();
61654        }
61655      };
61656      if (element.hasInstantiates()) {
61657        if (anyHasValue(element.getInstantiates())) {
61658          openArray("instantiates");
61659          for (UriType e : element.getInstantiates()) 
61660            composeUriCore(null, e, e != element.getInstantiates().get(element.getInstantiates().size()-1));
61661          closeArray();
61662        }
61663        if (anyHasExtras(element.getInstantiates())) {
61664          openArray("_instantiates");
61665          for (UriType e : element.getInstantiates()) 
61666            composeUriExtras(null, e, true);
61667          closeArray();
61668        }
61669      };
61670      if (element.hasBasedOn()) {
61671        openArray("basedOn");
61672        for (Reference e : element.getBasedOn()) 
61673          composeReference(null, e);
61674        closeArray();
61675      };
61676      if (element.hasGroupIdentifier()) {
61677        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
61678      }
61679      if (element.hasStatusElement()) {
61680        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
61681        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
61682      }
61683      if (element.hasIntentElement()) {
61684        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
61685        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
61686      }
61687      if (element.hasPriorityElement()) {
61688        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
61689        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
61690      }
61691      if (element.hasSubject()) {
61692        composeReference("subject", element.getSubject());
61693      }
61694      if (element.hasEncounter()) {
61695        composeReference("encounter", element.getEncounter());
61696      }
61697      if (element.hasSupportingInformation()) {
61698        openArray("supportingInformation");
61699        for (Reference e : element.getSupportingInformation()) 
61700          composeReference(null, e);
61701        closeArray();
61702      };
61703      if (element.hasDateTimeElement()) {
61704        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
61705        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
61706      }
61707      if (element.hasOrderer()) {
61708        composeReference("orderer", element.getOrderer());
61709      }
61710      if (element.hasPerformer()) {
61711        openArray("performer");
61712        for (CodeableReference e : element.getPerformer()) 
61713          composeCodeableReference(null, e);
61714        closeArray();
61715      };
61716      if (element.hasAllergyIntolerance()) {
61717        openArray("allergyIntolerance");
61718        for (Reference e : element.getAllergyIntolerance()) 
61719          composeReference(null, e);
61720        closeArray();
61721      };
61722      if (element.hasFoodPreferenceModifier()) {
61723        openArray("foodPreferenceModifier");
61724        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
61725          composeCodeableConcept(null, e);
61726        closeArray();
61727      };
61728      if (element.hasExcludeFoodModifier()) {
61729        openArray("excludeFoodModifier");
61730        for (CodeableConcept e : element.getExcludeFoodModifier()) 
61731          composeCodeableConcept(null, e);
61732        closeArray();
61733      };
61734      if (element.hasOutsideFoodAllowedElement()) {
61735        composeBooleanCore("outsideFoodAllowed", element.getOutsideFoodAllowedElement(), false);
61736        composeBooleanExtras("outsideFoodAllowed", element.getOutsideFoodAllowedElement(), false);
61737      }
61738      if (element.hasOralDiet()) {
61739        composeNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
61740      }
61741      if (element.hasSupplement()) {
61742        openArray("supplement");
61743        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
61744          composeNutritionOrderSupplementComponent(null, e);
61745        closeArray();
61746      };
61747      if (element.hasEnteralFormula()) {
61748        composeNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
61749      }
61750      if (element.hasNote()) {
61751        openArray("note");
61752        for (Annotation e : element.getNote()) 
61753          composeAnnotation(null, e);
61754        closeArray();
61755      };
61756  }
61757
61758  protected void composeNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
61759    if (element != null) {
61760      open(name);
61761      composeNutritionOrderOralDietComponentProperties(element);
61762      close();
61763    }
61764  }
61765
61766  protected void composeNutritionOrderOralDietComponentProperties(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
61767    composeBackboneElementProperties(element);
61768      if (element.hasType()) {
61769        openArray("type");
61770        for (CodeableConcept e : element.getType()) 
61771          composeCodeableConcept(null, e);
61772        closeArray();
61773      };
61774      if (element.hasSchedule()) {
61775        composeOralDietScheduleComponent("schedule", element.getSchedule());
61776      }
61777      if (element.hasNutrient()) {
61778        openArray("nutrient");
61779        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
61780          composeNutritionOrderOralDietNutrientComponent(null, e);
61781        closeArray();
61782      };
61783      if (element.hasTexture()) {
61784        openArray("texture");
61785        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
61786          composeNutritionOrderOralDietTextureComponent(null, e);
61787        closeArray();
61788      };
61789      if (element.hasFluidConsistencyType()) {
61790        openArray("fluidConsistencyType");
61791        for (CodeableConcept e : element.getFluidConsistencyType()) 
61792          composeCodeableConcept(null, e);
61793        closeArray();
61794      };
61795      if (element.hasInstructionElement()) {
61796        composeStringCore("instruction", element.getInstructionElement(), false);
61797        composeStringExtras("instruction", element.getInstructionElement(), false);
61798      }
61799  }
61800
61801  protected void composeOralDietScheduleComponent(String name, NutritionOrder.OralDietScheduleComponent element) throws IOException {
61802    if (element != null) {
61803      open(name);
61804      composeOralDietScheduleComponentProperties(element);
61805      close();
61806    }
61807  }
61808
61809  protected void composeOralDietScheduleComponentProperties(NutritionOrder.OralDietScheduleComponent element) throws IOException {
61810    composeBackboneElementProperties(element);
61811      if (element.hasTiming()) {
61812        openArray("timing");
61813        for (Timing e : element.getTiming()) 
61814          composeTiming(null, e);
61815        closeArray();
61816      };
61817      if (element.hasAsNeededElement()) {
61818        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
61819        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
61820      }
61821      if (element.hasAsNeededFor()) {
61822        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
61823      }
61824  }
61825
61826  protected void composeNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
61827    if (element != null) {
61828      open(name);
61829      composeNutritionOrderOralDietNutrientComponentProperties(element);
61830      close();
61831    }
61832  }
61833
61834  protected void composeNutritionOrderOralDietNutrientComponentProperties(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
61835    composeBackboneElementProperties(element);
61836      if (element.hasModifier()) {
61837        composeCodeableConcept("modifier", element.getModifier());
61838      }
61839      if (element.hasAmount()) {
61840        composeQuantity("amount", element.getAmount());
61841      }
61842  }
61843
61844  protected void composeNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
61845    if (element != null) {
61846      open(name);
61847      composeNutritionOrderOralDietTextureComponentProperties(element);
61848      close();
61849    }
61850  }
61851
61852  protected void composeNutritionOrderOralDietTextureComponentProperties(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
61853    composeBackboneElementProperties(element);
61854      if (element.hasModifier()) {
61855        composeCodeableConcept("modifier", element.getModifier());
61856      }
61857      if (element.hasFoodType()) {
61858        composeCodeableConcept("foodType", element.getFoodType());
61859      }
61860  }
61861
61862  protected void composeNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
61863    if (element != null) {
61864      open(name);
61865      composeNutritionOrderSupplementComponentProperties(element);
61866      close();
61867    }
61868  }
61869
61870  protected void composeNutritionOrderSupplementComponentProperties(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
61871    composeBackboneElementProperties(element);
61872      if (element.hasType()) {
61873        composeCodeableReference("type", element.getType());
61874      }
61875      if (element.hasProductNameElement()) {
61876        composeStringCore("productName", element.getProductNameElement(), false);
61877        composeStringExtras("productName", element.getProductNameElement(), false);
61878      }
61879      if (element.hasSchedule()) {
61880        composeSupplementScheduleComponent("schedule", element.getSchedule());
61881      }
61882      if (element.hasQuantity()) {
61883        composeQuantity("quantity", element.getQuantity());
61884      }
61885      if (element.hasInstructionElement()) {
61886        composeStringCore("instruction", element.getInstructionElement(), false);
61887        composeStringExtras("instruction", element.getInstructionElement(), false);
61888      }
61889  }
61890
61891  protected void composeSupplementScheduleComponent(String name, NutritionOrder.SupplementScheduleComponent element) throws IOException {
61892    if (element != null) {
61893      open(name);
61894      composeSupplementScheduleComponentProperties(element);
61895      close();
61896    }
61897  }
61898
61899  protected void composeSupplementScheduleComponentProperties(NutritionOrder.SupplementScheduleComponent element) throws IOException {
61900    composeBackboneElementProperties(element);
61901      if (element.hasTiming()) {
61902        openArray("timing");
61903        for (Timing e : element.getTiming()) 
61904          composeTiming(null, e);
61905        closeArray();
61906      };
61907      if (element.hasAsNeededElement()) {
61908        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
61909        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
61910      }
61911      if (element.hasAsNeededFor()) {
61912        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
61913      }
61914  }
61915
61916  protected void composeNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
61917    if (element != null) {
61918      open(name);
61919      composeNutritionOrderEnteralFormulaComponentProperties(element);
61920      close();
61921    }
61922  }
61923
61924  protected void composeNutritionOrderEnteralFormulaComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
61925    composeBackboneElementProperties(element);
61926      if (element.hasBaseFormulaType()) {
61927        composeCodeableReference("baseFormulaType", element.getBaseFormulaType());
61928      }
61929      if (element.hasBaseFormulaProductNameElement()) {
61930        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
61931        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
61932      }
61933      if (element.hasDeliveryDevice()) {
61934        openArray("deliveryDevice");
61935        for (CodeableReference e : element.getDeliveryDevice()) 
61936          composeCodeableReference(null, e);
61937        closeArray();
61938      };
61939      if (element.hasAdditive()) {
61940        openArray("additive");
61941        for (NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent e : element.getAdditive()) 
61942          composeNutritionOrderEnteralFormulaAdditiveComponent(null, e);
61943        closeArray();
61944      };
61945      if (element.hasCaloricDensity()) {
61946        composeQuantity("caloricDensity", element.getCaloricDensity());
61947      }
61948      if (element.hasRouteOfAdministration()) {
61949        composeCodeableConcept("routeOfAdministration", element.getRouteOfAdministration());
61950      }
61951      if (element.hasAdministration()) {
61952        openArray("administration");
61953        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
61954          composeNutritionOrderEnteralFormulaAdministrationComponent(null, e);
61955        closeArray();
61956      };
61957      if (element.hasMaxVolumeToDeliver()) {
61958        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
61959      }
61960      if (element.hasAdministrationInstructionElement()) {
61961        composeMarkdownCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
61962        composeMarkdownExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
61963      }
61964  }
61965
61966  protected void composeNutritionOrderEnteralFormulaAdditiveComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent element) throws IOException {
61967    if (element != null) {
61968      open(name);
61969      composeNutritionOrderEnteralFormulaAdditiveComponentProperties(element);
61970      close();
61971    }
61972  }
61973
61974  protected void composeNutritionOrderEnteralFormulaAdditiveComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent element) throws IOException {
61975    composeBackboneElementProperties(element);
61976      if (element.hasType()) {
61977        composeCodeableReference("type", element.getType());
61978      }
61979      if (element.hasProductNameElement()) {
61980        composeStringCore("productName", element.getProductNameElement(), false);
61981        composeStringExtras("productName", element.getProductNameElement(), false);
61982      }
61983      if (element.hasQuantity()) {
61984        composeQuantity("quantity", element.getQuantity());
61985      }
61986  }
61987
61988  protected void composeNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
61989    if (element != null) {
61990      open(name);
61991      composeNutritionOrderEnteralFormulaAdministrationComponentProperties(element);
61992      close();
61993    }
61994  }
61995
61996  protected void composeNutritionOrderEnteralFormulaAdministrationComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
61997    composeBackboneElementProperties(element);
61998      if (element.hasSchedule()) {
61999        composeEnteralFormulaScheduleComponent("schedule", element.getSchedule());
62000      }
62001      if (element.hasQuantity()) {
62002        composeQuantity("quantity", element.getQuantity());
62003      }
62004      if (element.hasRate()) {
62005        composeType("rate", element.getRate());
62006      }
62007  }
62008
62009  protected void composeEnteralFormulaScheduleComponent(String name, NutritionOrder.EnteralFormulaScheduleComponent element) throws IOException {
62010    if (element != null) {
62011      open(name);
62012      composeEnteralFormulaScheduleComponentProperties(element);
62013      close();
62014    }
62015  }
62016
62017  protected void composeEnteralFormulaScheduleComponentProperties(NutritionOrder.EnteralFormulaScheduleComponent element) throws IOException {
62018    composeBackboneElementProperties(element);
62019      if (element.hasTiming()) {
62020        openArray("timing");
62021        for (Timing e : element.getTiming()) 
62022          composeTiming(null, e);
62023        closeArray();
62024      };
62025      if (element.hasAsNeededElement()) {
62026        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
62027        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
62028      }
62029      if (element.hasAsNeededFor()) {
62030        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
62031      }
62032  }
62033
62034  protected void composeNutritionProduct(String name, NutritionProduct element) throws IOException {
62035    if (element != null) {
62036      prop("resourceType", name);
62037      composeNutritionProductProperties(element);
62038    }
62039  }
62040
62041  protected void composeNutritionProductProperties(NutritionProduct element) throws IOException {
62042    composeDomainResourceProperties(element);
62043      if (element.hasCode()) {
62044        composeCodeableConcept("code", element.getCode());
62045      }
62046      if (element.hasStatusElement()) {
62047        composeEnumerationCore("status", element.getStatusElement(), new NutritionProduct.NutritionProductStatusEnumFactory(), false);
62048        composeEnumerationExtras("status", element.getStatusElement(), new NutritionProduct.NutritionProductStatusEnumFactory(), false);
62049      }
62050      if (element.hasCategory()) {
62051        openArray("category");
62052        for (CodeableConcept e : element.getCategory()) 
62053          composeCodeableConcept(null, e);
62054        closeArray();
62055      };
62056      if (element.hasManufacturer()) {
62057        openArray("manufacturer");
62058        for (Reference e : element.getManufacturer()) 
62059          composeReference(null, e);
62060        closeArray();
62061      };
62062      if (element.hasNutrient()) {
62063        openArray("nutrient");
62064        for (NutritionProduct.NutritionProductNutrientComponent e : element.getNutrient()) 
62065          composeNutritionProductNutrientComponent(null, e);
62066        closeArray();
62067      };
62068      if (element.hasIngredient()) {
62069        openArray("ingredient");
62070        for (NutritionProduct.NutritionProductIngredientComponent e : element.getIngredient()) 
62071          composeNutritionProductIngredientComponent(null, e);
62072        closeArray();
62073      };
62074      if (element.hasKnownAllergen()) {
62075        openArray("knownAllergen");
62076        for (CodeableReference e : element.getKnownAllergen()) 
62077          composeCodeableReference(null, e);
62078        closeArray();
62079      };
62080      if (element.hasCharacteristic()) {
62081        openArray("characteristic");
62082        for (NutritionProduct.NutritionProductCharacteristicComponent e : element.getCharacteristic()) 
62083          composeNutritionProductCharacteristicComponent(null, e);
62084        closeArray();
62085      };
62086      if (element.hasInstance()) {
62087        openArray("instance");
62088        for (NutritionProduct.NutritionProductInstanceComponent e : element.getInstance()) 
62089          composeNutritionProductInstanceComponent(null, e);
62090        closeArray();
62091      };
62092      if (element.hasNote()) {
62093        openArray("note");
62094        for (Annotation e : element.getNote()) 
62095          composeAnnotation(null, e);
62096        closeArray();
62097      };
62098  }
62099
62100  protected void composeNutritionProductNutrientComponent(String name, NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
62101    if (element != null) {
62102      open(name);
62103      composeNutritionProductNutrientComponentProperties(element);
62104      close();
62105    }
62106  }
62107
62108  protected void composeNutritionProductNutrientComponentProperties(NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
62109    composeBackboneElementProperties(element);
62110      if (element.hasItem()) {
62111        composeCodeableReference("item", element.getItem());
62112      }
62113      if (element.hasAmount()) {
62114        openArray("amount");
62115        for (Ratio e : element.getAmount()) 
62116          composeRatio(null, e);
62117        closeArray();
62118      };
62119  }
62120
62121  protected void composeNutritionProductIngredientComponent(String name, NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
62122    if (element != null) {
62123      open(name);
62124      composeNutritionProductIngredientComponentProperties(element);
62125      close();
62126    }
62127  }
62128
62129  protected void composeNutritionProductIngredientComponentProperties(NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
62130    composeBackboneElementProperties(element);
62131      if (element.hasItem()) {
62132        composeCodeableReference("item", element.getItem());
62133      }
62134      if (element.hasAmount()) {
62135        openArray("amount");
62136        for (Ratio e : element.getAmount()) 
62137          composeRatio(null, e);
62138        closeArray();
62139      };
62140  }
62141
62142  protected void composeNutritionProductCharacteristicComponent(String name, NutritionProduct.NutritionProductCharacteristicComponent element) throws IOException {
62143    if (element != null) {
62144      open(name);
62145      composeNutritionProductCharacteristicComponentProperties(element);
62146      close();
62147    }
62148  }
62149
62150  protected void composeNutritionProductCharacteristicComponentProperties(NutritionProduct.NutritionProductCharacteristicComponent element) throws IOException {
62151    composeBackboneElementProperties(element);
62152      if (element.hasType()) {
62153        composeCodeableConcept("type", element.getType());
62154      }
62155      if (element.hasValue()) {
62156        composeType("value", element.getValue());
62157      }
62158  }
62159
62160  protected void composeNutritionProductInstanceComponent(String name, NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
62161    if (element != null) {
62162      open(name);
62163      composeNutritionProductInstanceComponentProperties(element);
62164      close();
62165    }
62166  }
62167
62168  protected void composeNutritionProductInstanceComponentProperties(NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
62169    composeBackboneElementProperties(element);
62170      if (element.hasQuantity()) {
62171        composeQuantity("quantity", element.getQuantity());
62172      }
62173      if (element.hasIdentifier()) {
62174        openArray("identifier");
62175        for (Identifier e : element.getIdentifier()) 
62176          composeIdentifier(null, e);
62177        closeArray();
62178      };
62179      if (element.hasNameElement()) {
62180        composeStringCore("name", element.getNameElement(), false);
62181        composeStringExtras("name", element.getNameElement(), false);
62182      }
62183      if (element.hasLotNumberElement()) {
62184        composeStringCore("lotNumber", element.getLotNumberElement(), false);
62185        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
62186      }
62187      if (element.hasExpiryElement()) {
62188        composeDateTimeCore("expiry", element.getExpiryElement(), false);
62189        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
62190      }
62191      if (element.hasUseByElement()) {
62192        composeDateTimeCore("useBy", element.getUseByElement(), false);
62193        composeDateTimeExtras("useBy", element.getUseByElement(), false);
62194      }
62195      if (element.hasBiologicalSourceEvent()) {
62196        composeIdentifier("biologicalSourceEvent", element.getBiologicalSourceEvent());
62197      }
62198  }
62199
62200  protected void composeObservation(String name, Observation element) throws IOException {
62201    if (element != null) {
62202      prop("resourceType", name);
62203      composeObservationProperties(element);
62204    }
62205  }
62206
62207  protected void composeObservationProperties(Observation element) throws IOException {
62208    composeDomainResourceProperties(element);
62209      if (element.hasIdentifier()) {
62210        openArray("identifier");
62211        for (Identifier e : element.getIdentifier()) 
62212          composeIdentifier(null, e);
62213        closeArray();
62214      };
62215      if (element.hasInstantiates()) {
62216        composeType("instantiates", element.getInstantiates());
62217      }
62218      if (element.hasBasedOn()) {
62219        openArray("basedOn");
62220        for (Reference e : element.getBasedOn()) 
62221          composeReference(null, e);
62222        closeArray();
62223      };
62224      if (element.hasTriggeredBy()) {
62225        openArray("triggeredBy");
62226        for (Observation.ObservationTriggeredByComponent e : element.getTriggeredBy()) 
62227          composeObservationTriggeredByComponent(null, e);
62228        closeArray();
62229      };
62230      if (element.hasPartOf()) {
62231        openArray("partOf");
62232        for (Reference e : element.getPartOf()) 
62233          composeReference(null, e);
62234        closeArray();
62235      };
62236      if (element.hasStatusElement()) {
62237        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
62238        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
62239      }
62240      if (element.hasCategory()) {
62241        openArray("category");
62242        for (CodeableConcept e : element.getCategory()) 
62243          composeCodeableConcept(null, e);
62244        closeArray();
62245      };
62246      if (element.hasCode()) {
62247        composeCodeableConcept("code", element.getCode());
62248      }
62249      if (element.hasSubject()) {
62250        composeReference("subject", element.getSubject());
62251      }
62252      if (element.hasFocus()) {
62253        openArray("focus");
62254        for (Reference e : element.getFocus()) 
62255          composeReference(null, e);
62256        closeArray();
62257      };
62258      if (element.hasEncounter()) {
62259        composeReference("encounter", element.getEncounter());
62260      }
62261      if (element.hasEffective()) {
62262        composeType("effective", element.getEffective());
62263      }
62264      if (element.hasIssuedElement()) {
62265        composeInstantCore("issued", element.getIssuedElement(), false);
62266        composeInstantExtras("issued", element.getIssuedElement(), false);
62267      }
62268      if (element.hasPerformer()) {
62269        openArray("performer");
62270        for (Reference e : element.getPerformer()) 
62271          composeReference(null, e);
62272        closeArray();
62273      };
62274      if (element.hasValue()) {
62275        composeType("value", element.getValue());
62276      }
62277      if (element.hasDataAbsentReason()) {
62278        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
62279      }
62280      if (element.hasInterpretation()) {
62281        openArray("interpretation");
62282        for (CodeableConcept e : element.getInterpretation()) 
62283          composeCodeableConcept(null, e);
62284        closeArray();
62285      };
62286      if (element.hasNote()) {
62287        openArray("note");
62288        for (Annotation e : element.getNote()) 
62289          composeAnnotation(null, e);
62290        closeArray();
62291      };
62292      if (element.hasBodySite()) {
62293        composeCodeableConcept("bodySite", element.getBodySite());
62294      }
62295      if (element.hasBodyStructure()) {
62296        composeReference("bodyStructure", element.getBodyStructure());
62297      }
62298      if (element.hasMethod()) {
62299        composeCodeableConcept("method", element.getMethod());
62300      }
62301      if (element.hasSpecimen()) {
62302        composeReference("specimen", element.getSpecimen());
62303      }
62304      if (element.hasDevice()) {
62305        composeReference("device", element.getDevice());
62306      }
62307      if (element.hasReferenceRange()) {
62308        openArray("referenceRange");
62309        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
62310          composeObservationReferenceRangeComponent(null, e);
62311        closeArray();
62312      };
62313      if (element.hasHasMember()) {
62314        openArray("hasMember");
62315        for (Reference e : element.getHasMember()) 
62316          composeReference(null, e);
62317        closeArray();
62318      };
62319      if (element.hasDerivedFrom()) {
62320        openArray("derivedFrom");
62321        for (Reference e : element.getDerivedFrom()) 
62322          composeReference(null, e);
62323        closeArray();
62324      };
62325      if (element.hasComponent()) {
62326        openArray("component");
62327        for (Observation.ObservationComponentComponent e : element.getComponent()) 
62328          composeObservationComponentComponent(null, e);
62329        closeArray();
62330      };
62331  }
62332
62333  protected void composeObservationTriggeredByComponent(String name, Observation.ObservationTriggeredByComponent element) throws IOException {
62334    if (element != null) {
62335      open(name);
62336      composeObservationTriggeredByComponentProperties(element);
62337      close();
62338    }
62339  }
62340
62341  protected void composeObservationTriggeredByComponentProperties(Observation.ObservationTriggeredByComponent element) throws IOException {
62342    composeBackboneElementProperties(element);
62343      if (element.hasObservation()) {
62344        composeReference("observation", element.getObservation());
62345      }
62346      if (element.hasTypeElement()) {
62347        composeEnumerationCore("type", element.getTypeElement(), new Observation.TriggeredBytypeEnumFactory(), false);
62348        composeEnumerationExtras("type", element.getTypeElement(), new Observation.TriggeredBytypeEnumFactory(), false);
62349      }
62350      if (element.hasReasonElement()) {
62351        composeStringCore("reason", element.getReasonElement(), false);
62352        composeStringExtras("reason", element.getReasonElement(), false);
62353      }
62354  }
62355
62356  protected void composeObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
62357    if (element != null) {
62358      open(name);
62359      composeObservationReferenceRangeComponentProperties(element);
62360      close();
62361    }
62362  }
62363
62364  protected void composeObservationReferenceRangeComponentProperties(Observation.ObservationReferenceRangeComponent element) throws IOException {
62365    composeBackboneElementProperties(element);
62366      if (element.hasLow()) {
62367        composeQuantity("low", element.getLow());
62368      }
62369      if (element.hasHigh()) {
62370        composeQuantity("high", element.getHigh());
62371      }
62372      if (element.hasNormalValue()) {
62373        composeCodeableConcept("normalValue", element.getNormalValue());
62374      }
62375      if (element.hasType()) {
62376        composeCodeableConcept("type", element.getType());
62377      }
62378      if (element.hasAppliesTo()) {
62379        openArray("appliesTo");
62380        for (CodeableConcept e : element.getAppliesTo()) 
62381          composeCodeableConcept(null, e);
62382        closeArray();
62383      };
62384      if (element.hasAge()) {
62385        composeRange("age", element.getAge());
62386      }
62387      if (element.hasTextElement()) {
62388        composeMarkdownCore("text", element.getTextElement(), false);
62389        composeMarkdownExtras("text", element.getTextElement(), false);
62390      }
62391  }
62392
62393  protected void composeObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
62394    if (element != null) {
62395      open(name);
62396      composeObservationComponentComponentProperties(element);
62397      close();
62398    }
62399  }
62400
62401  protected void composeObservationComponentComponentProperties(Observation.ObservationComponentComponent element) throws IOException {
62402    composeBackboneElementProperties(element);
62403      if (element.hasCode()) {
62404        composeCodeableConcept("code", element.getCode());
62405      }
62406      if (element.hasValue()) {
62407        composeType("value", element.getValue());
62408      }
62409      if (element.hasDataAbsentReason()) {
62410        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
62411      }
62412      if (element.hasInterpretation()) {
62413        openArray("interpretation");
62414        for (CodeableConcept e : element.getInterpretation()) 
62415          composeCodeableConcept(null, e);
62416        closeArray();
62417      };
62418      if (element.hasReferenceRange()) {
62419        openArray("referenceRange");
62420        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
62421          composeObservationReferenceRangeComponent(null, e);
62422        closeArray();
62423      };
62424  }
62425
62426  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
62427    if (element != null) {
62428      prop("resourceType", name);
62429      composeObservationDefinitionProperties(element);
62430    }
62431  }
62432
62433  protected void composeObservationDefinitionProperties(ObservationDefinition element) throws IOException {
62434    composeDomainResourceProperties(element);
62435      if (element.hasUrlElement()) {
62436        composeUriCore("url", element.getUrlElement(), false);
62437        composeUriExtras("url", element.getUrlElement(), false);
62438      }
62439      if (element.hasIdentifier()) {
62440        composeIdentifier("identifier", element.getIdentifier());
62441      }
62442      if (element.hasVersionElement()) {
62443        composeStringCore("version", element.getVersionElement(), false);
62444        composeStringExtras("version", element.getVersionElement(), false);
62445      }
62446      if (element.hasVersionAlgorithm()) {
62447        composeType("versionAlgorithm", element.getVersionAlgorithm());
62448      }
62449      if (element.hasNameElement()) {
62450        composeStringCore("name", element.getNameElement(), false);
62451        composeStringExtras("name", element.getNameElement(), false);
62452      }
62453      if (element.hasTitleElement()) {
62454        composeStringCore("title", element.getTitleElement(), false);
62455        composeStringExtras("title", element.getTitleElement(), false);
62456      }
62457      if (element.hasStatusElement()) {
62458        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62459        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62460      }
62461      if (element.hasExperimentalElement()) {
62462        composeBooleanCore("experimental", element.getExperimentalElement(), false);
62463        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
62464      }
62465      if (element.hasDateElement()) {
62466        composeDateTimeCore("date", element.getDateElement(), false);
62467        composeDateTimeExtras("date", element.getDateElement(), false);
62468      }
62469      if (element.hasPublisherElement()) {
62470        composeStringCore("publisher", element.getPublisherElement(), false);
62471        composeStringExtras("publisher", element.getPublisherElement(), false);
62472      }
62473      if (element.hasContact()) {
62474        openArray("contact");
62475        for (ContactDetail e : element.getContact()) 
62476          composeContactDetail(null, e);
62477        closeArray();
62478      };
62479      if (element.hasDescriptionElement()) {
62480        composeMarkdownCore("description", element.getDescriptionElement(), false);
62481        composeMarkdownExtras("description", element.getDescriptionElement(), false);
62482      }
62483      if (element.hasUseContext()) {
62484        openArray("useContext");
62485        for (UsageContext e : element.getUseContext()) 
62486          composeUsageContext(null, e);
62487        closeArray();
62488      };
62489      if (element.hasJurisdiction()) {
62490        openArray("jurisdiction");
62491        for (CodeableConcept e : element.getJurisdiction()) 
62492          composeCodeableConcept(null, e);
62493        closeArray();
62494      };
62495      if (element.hasPurposeElement()) {
62496        composeMarkdownCore("purpose", element.getPurposeElement(), false);
62497        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
62498      }
62499      if (element.hasCopyrightElement()) {
62500        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
62501        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
62502      }
62503      if (element.hasCopyrightLabelElement()) {
62504        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
62505        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
62506      }
62507      if (element.hasApprovalDateElement()) {
62508        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
62509        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
62510      }
62511      if (element.hasLastReviewDateElement()) {
62512        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
62513        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
62514      }
62515      if (element.hasEffectivePeriod()) {
62516        composePeriod("effectivePeriod", element.getEffectivePeriod());
62517      }
62518      if (element.hasDerivedFromCanonical()) {
62519        if (anyHasValue(element.getDerivedFromCanonical())) {
62520          openArray("derivedFromCanonical");
62521          for (CanonicalType e : element.getDerivedFromCanonical()) 
62522            composeCanonicalCore(null, e, e != element.getDerivedFromCanonical().get(element.getDerivedFromCanonical().size()-1));
62523          closeArray();
62524        }
62525        if (anyHasExtras(element.getDerivedFromCanonical())) {
62526          openArray("_derivedFromCanonical");
62527          for (CanonicalType e : element.getDerivedFromCanonical()) 
62528            composeCanonicalExtras(null, e, true);
62529          closeArray();
62530        }
62531      };
62532      if (element.hasDerivedFromUri()) {
62533        if (anyHasValue(element.getDerivedFromUri())) {
62534          openArray("derivedFromUri");
62535          for (UriType e : element.getDerivedFromUri()) 
62536            composeUriCore(null, e, e != element.getDerivedFromUri().get(element.getDerivedFromUri().size()-1));
62537          closeArray();
62538        }
62539        if (anyHasExtras(element.getDerivedFromUri())) {
62540          openArray("_derivedFromUri");
62541          for (UriType e : element.getDerivedFromUri()) 
62542            composeUriExtras(null, e, true);
62543          closeArray();
62544        }
62545      };
62546      if (element.hasSubject()) {
62547        openArray("subject");
62548        for (CodeableConcept e : element.getSubject()) 
62549          composeCodeableConcept(null, e);
62550        closeArray();
62551      };
62552      if (element.hasPerformerType()) {
62553        composeCodeableConcept("performerType", element.getPerformerType());
62554      }
62555      if (element.hasCategory()) {
62556        openArray("category");
62557        for (CodeableConcept e : element.getCategory()) 
62558          composeCodeableConcept(null, e);
62559        closeArray();
62560      };
62561      if (element.hasCode()) {
62562        composeCodeableConcept("code", element.getCode());
62563      }
62564      if (element.hasPermittedDataType()) {
62565        openArray("permittedDataType");
62566        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62567          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62568        closeArray();
62569        if (anyHasExtras(element.getPermittedDataType())) {
62570          openArray("_permittedDataType");
62571          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62572            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62573          closeArray();
62574        }
62575      };
62576      if (element.hasMultipleResultsAllowedElement()) {
62577        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
62578        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
62579      }
62580      if (element.hasBodySite()) {
62581        composeCodeableConcept("bodySite", element.getBodySite());
62582      }
62583      if (element.hasMethod()) {
62584        composeCodeableConcept("method", element.getMethod());
62585      }
62586      if (element.hasSpecimen()) {
62587        openArray("specimen");
62588        for (Reference e : element.getSpecimen()) 
62589          composeReference(null, e);
62590        closeArray();
62591      };
62592      if (element.hasDevice()) {
62593        openArray("device");
62594        for (Reference e : element.getDevice()) 
62595          composeReference(null, e);
62596        closeArray();
62597      };
62598      if (element.hasPreferredReportNameElement()) {
62599        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
62600        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
62601      }
62602      if (element.hasPermittedUnit()) {
62603        openArray("permittedUnit");
62604        for (Coding e : element.getPermittedUnit()) 
62605          composeCoding(null, e);
62606        closeArray();
62607      };
62608      if (element.hasQualifiedValue()) {
62609        openArray("qualifiedValue");
62610        for (ObservationDefinition.ObservationDefinitionQualifiedValueComponent e : element.getQualifiedValue()) 
62611          composeObservationDefinitionQualifiedValueComponent(null, e);
62612        closeArray();
62613      };
62614      if (element.hasHasMember()) {
62615        openArray("hasMember");
62616        for (Reference e : element.getHasMember()) 
62617          composeReference(null, e);
62618        closeArray();
62619      };
62620      if (element.hasComponent()) {
62621        openArray("component");
62622        for (ObservationDefinition.ObservationDefinitionComponentComponent e : element.getComponent()) 
62623          composeObservationDefinitionComponentComponent(null, e);
62624        closeArray();
62625      };
62626  }
62627
62628  protected void composeObservationDefinitionQualifiedValueComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedValueComponent element) throws IOException {
62629    if (element != null) {
62630      open(name);
62631      composeObservationDefinitionQualifiedValueComponentProperties(element);
62632      close();
62633    }
62634  }
62635
62636  protected void composeObservationDefinitionQualifiedValueComponentProperties(ObservationDefinition.ObservationDefinitionQualifiedValueComponent element) throws IOException {
62637    composeBackboneElementProperties(element);
62638      if (element.hasContext()) {
62639        composeCodeableConcept("context", element.getContext());
62640      }
62641      if (element.hasAppliesTo()) {
62642        openArray("appliesTo");
62643        for (CodeableConcept e : element.getAppliesTo()) 
62644          composeCodeableConcept(null, e);
62645        closeArray();
62646      };
62647      if (element.hasGenderElement()) {
62648        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
62649        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
62650      }
62651      if (element.hasAge()) {
62652        composeRange("age", element.getAge());
62653      }
62654      if (element.hasGestationalAge()) {
62655        composeRange("gestationalAge", element.getGestationalAge());
62656      }
62657      if (element.hasConditionElement()) {
62658        composeStringCore("condition", element.getConditionElement(), false);
62659        composeStringExtras("condition", element.getConditionElement(), false);
62660      }
62661      if (element.hasRangeCategoryElement()) {
62662        composeEnumerationCore("rangeCategory", element.getRangeCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
62663        composeEnumerationExtras("rangeCategory", element.getRangeCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
62664      }
62665      if (element.hasRange()) {
62666        composeRange("range", element.getRange());
62667      }
62668      if (element.hasValidCodedValueSetElement()) {
62669        composeCanonicalCore("validCodedValueSet", element.getValidCodedValueSetElement(), false);
62670        composeCanonicalExtras("validCodedValueSet", element.getValidCodedValueSetElement(), false);
62671      }
62672      if (element.hasNormalCodedValueSetElement()) {
62673        composeCanonicalCore("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
62674        composeCanonicalExtras("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
62675      }
62676      if (element.hasAbnormalCodedValueSetElement()) {
62677        composeCanonicalCore("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
62678        composeCanonicalExtras("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
62679      }
62680      if (element.hasCriticalCodedValueSetElement()) {
62681        composeCanonicalCore("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
62682        composeCanonicalExtras("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
62683      }
62684  }
62685
62686  protected void composeObservationDefinitionComponentComponent(String name, ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
62687    if (element != null) {
62688      open(name);
62689      composeObservationDefinitionComponentComponentProperties(element);
62690      close();
62691    }
62692  }
62693
62694  protected void composeObservationDefinitionComponentComponentProperties(ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
62695    composeBackboneElementProperties(element);
62696      if (element.hasCode()) {
62697        composeCodeableConcept("code", element.getCode());
62698      }
62699      if (element.hasPermittedDataType()) {
62700        openArray("permittedDataType");
62701        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62702          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62703        closeArray();
62704        if (anyHasExtras(element.getPermittedDataType())) {
62705          openArray("_permittedDataType");
62706          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62707            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62708          closeArray();
62709        }
62710      };
62711      if (element.hasPermittedUnit()) {
62712        openArray("permittedUnit");
62713        for (Coding e : element.getPermittedUnit()) 
62714          composeCoding(null, e);
62715        closeArray();
62716      };
62717      if (element.hasQualifiedValue()) {
62718        openArray("qualifiedValue");
62719        for (ObservationDefinition.ObservationDefinitionQualifiedValueComponent e : element.getQualifiedValue()) 
62720          composeObservationDefinitionQualifiedValueComponent(null, e);
62721        closeArray();
62722      };
62723  }
62724
62725  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
62726    if (element != null) {
62727      prop("resourceType", name);
62728      composeOperationDefinitionProperties(element);
62729    }
62730  }
62731
62732  protected void composeOperationDefinitionProperties(OperationDefinition element) throws IOException {
62733    composeCanonicalResourceProperties(element);
62734      if (element.hasUrlElement()) {
62735        composeUriCore("url", element.getUrlElement(), false);
62736        composeUriExtras("url", element.getUrlElement(), false);
62737      }
62738      if (element.hasIdentifier()) {
62739        openArray("identifier");
62740        for (Identifier e : element.getIdentifier()) 
62741          composeIdentifier(null, e);
62742        closeArray();
62743      };
62744      if (element.hasVersionElement()) {
62745        composeStringCore("version", element.getVersionElement(), false);
62746        composeStringExtras("version", element.getVersionElement(), false);
62747      }
62748      if (element.hasVersionAlgorithm()) {
62749        composeType("versionAlgorithm", element.getVersionAlgorithm());
62750      }
62751      if (element.hasNameElement()) {
62752        composeStringCore("name", element.getNameElement(), false);
62753        composeStringExtras("name", element.getNameElement(), false);
62754      }
62755      if (element.hasTitleElement()) {
62756        composeStringCore("title", element.getTitleElement(), false);
62757        composeStringExtras("title", element.getTitleElement(), false);
62758      }
62759      if (element.hasStatusElement()) {
62760        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62761        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62762      }
62763      if (element.hasKindElement()) {
62764        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
62765        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
62766      }
62767      if (element.hasExperimentalElement()) {
62768        composeBooleanCore("experimental", element.getExperimentalElement(), false);
62769        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
62770      }
62771      if (element.hasDateElement()) {
62772        composeDateTimeCore("date", element.getDateElement(), false);
62773        composeDateTimeExtras("date", element.getDateElement(), false);
62774      }
62775      if (element.hasPublisherElement()) {
62776        composeStringCore("publisher", element.getPublisherElement(), false);
62777        composeStringExtras("publisher", element.getPublisherElement(), false);
62778      }
62779      if (element.hasContact()) {
62780        openArray("contact");
62781        for (ContactDetail e : element.getContact()) 
62782          composeContactDetail(null, e);
62783        closeArray();
62784      };
62785      if (element.hasDescriptionElement()) {
62786        composeMarkdownCore("description", element.getDescriptionElement(), false);
62787        composeMarkdownExtras("description", element.getDescriptionElement(), false);
62788      }
62789      if (element.hasUseContext()) {
62790        openArray("useContext");
62791        for (UsageContext e : element.getUseContext()) 
62792          composeUsageContext(null, e);
62793        closeArray();
62794      };
62795      if (element.hasJurisdiction()) {
62796        openArray("jurisdiction");
62797        for (CodeableConcept e : element.getJurisdiction()) 
62798          composeCodeableConcept(null, e);
62799        closeArray();
62800      };
62801      if (element.hasPurposeElement()) {
62802        composeMarkdownCore("purpose", element.getPurposeElement(), false);
62803        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
62804      }
62805      if (element.hasCopyrightElement()) {
62806        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
62807        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
62808      }
62809      if (element.hasCopyrightLabelElement()) {
62810        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
62811        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
62812      }
62813      if (element.hasAffectsStateElement()) {
62814        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
62815        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
62816      }
62817      if (element.hasCodeElement()) {
62818        composeCodeCore("code", element.getCodeElement(), false);
62819        composeCodeExtras("code", element.getCodeElement(), false);
62820      }
62821      if (element.hasCommentElement()) {
62822        composeMarkdownCore("comment", element.getCommentElement(), false);
62823        composeMarkdownExtras("comment", element.getCommentElement(), false);
62824      }
62825      if (element.hasBaseElement()) {
62826        composeCanonicalCore("base", element.getBaseElement(), false);
62827        composeCanonicalExtras("base", element.getBaseElement(), false);
62828      }
62829      if (element.hasResource()) {
62830        openArray("resource");
62831        for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getResource()) 
62832          composeEnumerationCore(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
62833        closeArray();
62834        if (anyHasExtras(element.getResource())) {
62835          openArray("_resource");
62836          for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getResource()) 
62837            composeEnumerationExtras(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
62838          closeArray();
62839        }
62840      };
62841      if (element.hasSystemElement()) {
62842        composeBooleanCore("system", element.getSystemElement(), false);
62843        composeBooleanExtras("system", element.getSystemElement(), false);
62844      }
62845      if (element.hasTypeElement()) {
62846        composeBooleanCore("type", element.getTypeElement(), false);
62847        composeBooleanExtras("type", element.getTypeElement(), false);
62848      }
62849      if (element.hasInstanceElement()) {
62850        composeBooleanCore("instance", element.getInstanceElement(), false);
62851        composeBooleanExtras("instance", element.getInstanceElement(), false);
62852      }
62853      if (element.hasInputProfileElement()) {
62854        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
62855        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
62856      }
62857      if (element.hasOutputProfileElement()) {
62858        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
62859        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
62860      }
62861      if (element.hasParameter()) {
62862        openArray("parameter");
62863        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
62864          composeOperationDefinitionParameterComponent(null, e);
62865        closeArray();
62866      };
62867      if (element.hasOverload()) {
62868        openArray("overload");
62869        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
62870          composeOperationDefinitionOverloadComponent(null, e);
62871        closeArray();
62872      };
62873  }
62874
62875  protected void composeOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
62876    if (element != null) {
62877      open(name);
62878      composeOperationDefinitionParameterComponentProperties(element);
62879      close();
62880    }
62881  }
62882
62883  protected void composeOperationDefinitionParameterComponentProperties(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
62884    composeBackboneElementProperties(element);
62885      if (element.hasNameElement()) {
62886        composeCodeCore("name", element.getNameElement(), false);
62887        composeCodeExtras("name", element.getNameElement(), false);
62888      }
62889      if (element.hasUseElement()) {
62890        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
62891        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
62892      }
62893      if (element.hasScope()) {
62894        openArray("scope");
62895        for (Enumeration<OperationDefinition.OperationParameterScope> e : element.getScope()) 
62896          composeEnumerationCore(null, e, new OperationDefinition.OperationParameterScopeEnumFactory(), true);
62897        closeArray();
62898        if (anyHasExtras(element.getScope())) {
62899          openArray("_scope");
62900          for (Enumeration<OperationDefinition.OperationParameterScope> e : element.getScope()) 
62901            composeEnumerationExtras(null, e, new OperationDefinition.OperationParameterScopeEnumFactory(), true);
62902          closeArray();
62903        }
62904      };
62905      if (element.hasMinElement()) {
62906        composeIntegerCore("min", element.getMinElement(), false);
62907        composeIntegerExtras("min", element.getMinElement(), false);
62908      }
62909      if (element.hasMaxElement()) {
62910        composeStringCore("max", element.getMaxElement(), false);
62911        composeStringExtras("max", element.getMaxElement(), false);
62912      }
62913      if (element.hasDocumentationElement()) {
62914        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
62915        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
62916      }
62917      if (element.hasTypeElement()) {
62918        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
62919        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
62920      }
62921      if (element.hasAllowedType()) {
62922        openArray("allowedType");
62923        for (Enumeration<Enumerations.FHIRTypes> e : element.getAllowedType()) 
62924          composeEnumerationCore(null, e, new Enumerations.FHIRTypesEnumFactory(), true);
62925        closeArray();
62926        if (anyHasExtras(element.getAllowedType())) {
62927          openArray("_allowedType");
62928          for (Enumeration<Enumerations.FHIRTypes> e : element.getAllowedType()) 
62929            composeEnumerationExtras(null, e, new Enumerations.FHIRTypesEnumFactory(), true);
62930          closeArray();
62931        }
62932      };
62933      if (element.hasTargetProfile()) {
62934        if (anyHasValue(element.getTargetProfile())) {
62935          openArray("targetProfile");
62936          for (CanonicalType e : element.getTargetProfile()) 
62937            composeCanonicalCore(null, e, e != element.getTargetProfile().get(element.getTargetProfile().size()-1));
62938          closeArray();
62939        }
62940        if (anyHasExtras(element.getTargetProfile())) {
62941          openArray("_targetProfile");
62942          for (CanonicalType e : element.getTargetProfile()) 
62943            composeCanonicalExtras(null, e, true);
62944          closeArray();
62945        }
62946      };
62947      if (element.hasSearchTypeElement()) {
62948        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
62949        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
62950      }
62951      if (element.hasBinding()) {
62952        composeOperationDefinitionParameterBindingComponent("binding", element.getBinding());
62953      }
62954      if (element.hasReferencedFrom()) {
62955        openArray("referencedFrom");
62956        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
62957          composeOperationDefinitionParameterReferencedFromComponent(null, e);
62958        closeArray();
62959      };
62960      if (element.hasPart()) {
62961        openArray("part");
62962        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
62963          composeOperationDefinitionParameterComponent(null, e);
62964        closeArray();
62965      };
62966  }
62967
62968  protected void composeOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
62969    if (element != null) {
62970      open(name);
62971      composeOperationDefinitionParameterBindingComponentProperties(element);
62972      close();
62973    }
62974  }
62975
62976  protected void composeOperationDefinitionParameterBindingComponentProperties(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
62977    composeBackboneElementProperties(element);
62978      if (element.hasStrengthElement()) {
62979        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
62980        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
62981      }
62982      if (element.hasValueSetElement()) {
62983        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
62984        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
62985      }
62986  }
62987
62988  protected void composeOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
62989    if (element != null) {
62990      open(name);
62991      composeOperationDefinitionParameterReferencedFromComponentProperties(element);
62992      close();
62993    }
62994  }
62995
62996  protected void composeOperationDefinitionParameterReferencedFromComponentProperties(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
62997    composeBackboneElementProperties(element);
62998      if (element.hasSourceElement()) {
62999        composeStringCore("source", element.getSourceElement(), false);
63000        composeStringExtras("source", element.getSourceElement(), false);
63001      }
63002      if (element.hasSourceIdElement()) {
63003        composeStringCore("sourceId", element.getSourceIdElement(), false);
63004        composeStringExtras("sourceId", element.getSourceIdElement(), false);
63005      }
63006  }
63007
63008  protected void composeOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
63009    if (element != null) {
63010      open(name);
63011      composeOperationDefinitionOverloadComponentProperties(element);
63012      close();
63013    }
63014  }
63015
63016  protected void composeOperationDefinitionOverloadComponentProperties(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
63017    composeBackboneElementProperties(element);
63018      if (element.hasParameterName()) {
63019        if (anyHasValue(element.getParameterName())) {
63020          openArray("parameterName");
63021          for (StringType e : element.getParameterName()) 
63022            composeStringCore(null, e, e != element.getParameterName().get(element.getParameterName().size()-1));
63023          closeArray();
63024        }
63025        if (anyHasExtras(element.getParameterName())) {
63026          openArray("_parameterName");
63027          for (StringType e : element.getParameterName()) 
63028            composeStringExtras(null, e, true);
63029          closeArray();
63030        }
63031      };
63032      if (element.hasCommentElement()) {
63033        composeStringCore("comment", element.getCommentElement(), false);
63034        composeStringExtras("comment", element.getCommentElement(), false);
63035      }
63036  }
63037
63038  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
63039    if (element != null) {
63040      prop("resourceType", name);
63041      composeOperationOutcomeProperties(element);
63042    }
63043  }
63044
63045  protected void composeOperationOutcomeProperties(OperationOutcome element) throws IOException {
63046    composeDomainResourceProperties(element);
63047      if (element.hasIssue()) {
63048        openArray("issue");
63049        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
63050          composeOperationOutcomeIssueComponent(null, e);
63051        closeArray();
63052      };
63053  }
63054
63055  protected void composeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
63056    if (element != null) {
63057      open(name);
63058      composeOperationOutcomeIssueComponentProperties(element);
63059      close();
63060    }
63061  }
63062
63063  protected void composeOperationOutcomeIssueComponentProperties(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
63064    composeBackboneElementProperties(element);
63065      if (element.hasSeverityElement()) {
63066        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
63067        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
63068      }
63069      if (element.hasCodeElement()) {
63070        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
63071        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
63072      }
63073      if (element.hasDetails()) {
63074        composeCodeableConcept("details", element.getDetails());
63075      }
63076      if (element.hasDiagnosticsElement()) {
63077        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
63078        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
63079      }
63080      if (element.hasLocation()) {
63081        if (anyHasValue(element.getLocation())) {
63082          openArray("location");
63083          for (StringType e : element.getLocation()) 
63084            composeStringCore(null, e, e != element.getLocation().get(element.getLocation().size()-1));
63085          closeArray();
63086        }
63087        if (anyHasExtras(element.getLocation())) {
63088          openArray("_location");
63089          for (StringType e : element.getLocation()) 
63090            composeStringExtras(null, e, true);
63091          closeArray();
63092        }
63093      };
63094      if (element.hasExpression()) {
63095        if (anyHasValue(element.getExpression())) {
63096          openArray("expression");
63097          for (StringType e : element.getExpression()) 
63098            composeStringCore(null, e, e != element.getExpression().get(element.getExpression().size()-1));
63099          closeArray();
63100        }
63101        if (anyHasExtras(element.getExpression())) {
63102          openArray("_expression");
63103          for (StringType e : element.getExpression()) 
63104            composeStringExtras(null, e, true);
63105          closeArray();
63106        }
63107      };
63108  }
63109
63110  protected void composeOrganization(String name, Organization element) throws IOException {
63111    if (element != null) {
63112      prop("resourceType", name);
63113      composeOrganizationProperties(element);
63114    }
63115  }
63116
63117  protected void composeOrganizationProperties(Organization element) throws IOException {
63118    composeDomainResourceProperties(element);
63119      if (element.hasIdentifier()) {
63120        openArray("identifier");
63121        for (Identifier e : element.getIdentifier()) 
63122          composeIdentifier(null, e);
63123        closeArray();
63124      };
63125      if (element.hasActiveElement()) {
63126        composeBooleanCore("active", element.getActiveElement(), false);
63127        composeBooleanExtras("active", element.getActiveElement(), false);
63128      }
63129      if (element.hasType()) {
63130        openArray("type");
63131        for (CodeableConcept e : element.getType()) 
63132          composeCodeableConcept(null, e);
63133        closeArray();
63134      };
63135      if (element.hasNameElement()) {
63136        composeStringCore("name", element.getNameElement(), false);
63137        composeStringExtras("name", element.getNameElement(), false);
63138      }
63139      if (element.hasAlias()) {
63140        if (anyHasValue(element.getAlias())) {
63141          openArray("alias");
63142          for (StringType e : element.getAlias()) 
63143            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
63144          closeArray();
63145        }
63146        if (anyHasExtras(element.getAlias())) {
63147          openArray("_alias");
63148          for (StringType e : element.getAlias()) 
63149            composeStringExtras(null, e, true);
63150          closeArray();
63151        }
63152      };
63153      if (element.hasDescriptionElement()) {
63154        composeMarkdownCore("description", element.getDescriptionElement(), false);
63155        composeMarkdownExtras("description", element.getDescriptionElement(), false);
63156      }
63157      if (element.hasContact()) {
63158        openArray("contact");
63159        for (ExtendedContactDetail e : element.getContact()) 
63160          composeExtendedContactDetail(null, e);
63161        closeArray();
63162      };
63163      if (element.hasPartOf()) {
63164        composeReference("partOf", element.getPartOf());
63165      }
63166      if (element.hasEndpoint()) {
63167        openArray("endpoint");
63168        for (Reference e : element.getEndpoint()) 
63169          composeReference(null, e);
63170        closeArray();
63171      };
63172      if (element.hasQualification()) {
63173        openArray("qualification");
63174        for (Organization.OrganizationQualificationComponent e : element.getQualification()) 
63175          composeOrganizationQualificationComponent(null, e);
63176        closeArray();
63177      };
63178  }
63179
63180  protected void composeOrganizationQualificationComponent(String name, Organization.OrganizationQualificationComponent element) throws IOException {
63181    if (element != null) {
63182      open(name);
63183      composeOrganizationQualificationComponentProperties(element);
63184      close();
63185    }
63186  }
63187
63188  protected void composeOrganizationQualificationComponentProperties(Organization.OrganizationQualificationComponent element) throws IOException {
63189    composeBackboneElementProperties(element);
63190      if (element.hasIdentifier()) {
63191        openArray("identifier");
63192        for (Identifier e : element.getIdentifier()) 
63193          composeIdentifier(null, e);
63194        closeArray();
63195      };
63196      if (element.hasCode()) {
63197        composeCodeableConcept("code", element.getCode());
63198      }
63199      if (element.hasPeriod()) {
63200        composePeriod("period", element.getPeriod());
63201      }
63202      if (element.hasIssuer()) {
63203        composeReference("issuer", element.getIssuer());
63204      }
63205  }
63206
63207  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
63208    if (element != null) {
63209      prop("resourceType", name);
63210      composeOrganizationAffiliationProperties(element);
63211    }
63212  }
63213
63214  protected void composeOrganizationAffiliationProperties(OrganizationAffiliation element) throws IOException {
63215    composeDomainResourceProperties(element);
63216      if (element.hasIdentifier()) {
63217        openArray("identifier");
63218        for (Identifier e : element.getIdentifier()) 
63219          composeIdentifier(null, e);
63220        closeArray();
63221      };
63222      if (element.hasActiveElement()) {
63223        composeBooleanCore("active", element.getActiveElement(), false);
63224        composeBooleanExtras("active", element.getActiveElement(), false);
63225      }
63226      if (element.hasPeriod()) {
63227        composePeriod("period", element.getPeriod());
63228      }
63229      if (element.hasOrganization()) {
63230        composeReference("organization", element.getOrganization());
63231      }
63232      if (element.hasParticipatingOrganization()) {
63233        composeReference("participatingOrganization", element.getParticipatingOrganization());
63234      }
63235      if (element.hasNetwork()) {
63236        openArray("network");
63237        for (Reference e : element.getNetwork()) 
63238          composeReference(null, e);
63239        closeArray();
63240      };
63241      if (element.hasCode()) {
63242        openArray("code");
63243        for (CodeableConcept e : element.getCode()) 
63244          composeCodeableConcept(null, e);
63245        closeArray();
63246      };
63247      if (element.hasSpecialty()) {
63248        openArray("specialty");
63249        for (CodeableConcept e : element.getSpecialty()) 
63250          composeCodeableConcept(null, e);
63251        closeArray();
63252      };
63253      if (element.hasLocation()) {
63254        openArray("location");
63255        for (Reference e : element.getLocation()) 
63256          composeReference(null, e);
63257        closeArray();
63258      };
63259      if (element.hasHealthcareService()) {
63260        openArray("healthcareService");
63261        for (Reference e : element.getHealthcareService()) 
63262          composeReference(null, e);
63263        closeArray();
63264      };
63265      if (element.hasContact()) {
63266        openArray("contact");
63267        for (ExtendedContactDetail e : element.getContact()) 
63268          composeExtendedContactDetail(null, e);
63269        closeArray();
63270      };
63271      if (element.hasEndpoint()) {
63272        openArray("endpoint");
63273        for (Reference e : element.getEndpoint()) 
63274          composeReference(null, e);
63275        closeArray();
63276      };
63277  }
63278
63279  protected void composePackagedProductDefinition(String name, PackagedProductDefinition element) throws IOException {
63280    if (element != null) {
63281      prop("resourceType", name);
63282      composePackagedProductDefinitionProperties(element);
63283    }
63284  }
63285
63286  protected void composePackagedProductDefinitionProperties(PackagedProductDefinition element) throws IOException {
63287    composeDomainResourceProperties(element);
63288      if (element.hasIdentifier()) {
63289        openArray("identifier");
63290        for (Identifier e : element.getIdentifier()) 
63291          composeIdentifier(null, e);
63292        closeArray();
63293      };
63294      if (element.hasNameElement()) {
63295        composeStringCore("name", element.getNameElement(), false);
63296        composeStringExtras("name", element.getNameElement(), false);
63297      }
63298      if (element.hasType()) {
63299        composeCodeableConcept("type", element.getType());
63300      }
63301      if (element.hasPackageFor()) {
63302        openArray("packageFor");
63303        for (Reference e : element.getPackageFor()) 
63304          composeReference(null, e);
63305        closeArray();
63306      };
63307      if (element.hasStatus()) {
63308        composeCodeableConcept("status", element.getStatus());
63309      }
63310      if (element.hasStatusDateElement()) {
63311        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
63312        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
63313      }
63314      if (element.hasContainedItemQuantity()) {
63315        openArray("containedItemQuantity");
63316        for (Quantity e : element.getContainedItemQuantity()) 
63317          composeQuantity(null, e);
63318        closeArray();
63319      };
63320      if (element.hasDescriptionElement()) {
63321        composeMarkdownCore("description", element.getDescriptionElement(), false);
63322        composeMarkdownExtras("description", element.getDescriptionElement(), false);
63323      }
63324      if (element.hasLegalStatusOfSupply()) {
63325        openArray("legalStatusOfSupply");
63326        for (PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent e : element.getLegalStatusOfSupply()) 
63327          composePackagedProductDefinitionLegalStatusOfSupplyComponent(null, e);
63328        closeArray();
63329      };
63330      if (element.hasMarketingStatus()) {
63331        openArray("marketingStatus");
63332        for (MarketingStatus e : element.getMarketingStatus()) 
63333          composeMarketingStatus(null, e);
63334        closeArray();
63335      };
63336      if (element.hasCopackagedIndicatorElement()) {
63337        composeBooleanCore("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
63338        composeBooleanExtras("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
63339      }
63340      if (element.hasManufacturer()) {
63341        openArray("manufacturer");
63342        for (Reference e : element.getManufacturer()) 
63343          composeReference(null, e);
63344        closeArray();
63345      };
63346      if (element.hasAttachedDocument()) {
63347        openArray("attachedDocument");
63348        for (Reference e : element.getAttachedDocument()) 
63349          composeReference(null, e);
63350        closeArray();
63351      };
63352      if (element.hasPackaging()) {
63353        composePackagedProductDefinitionPackagingComponent("packaging", element.getPackaging());
63354      }
63355      if (element.hasCharacteristic()) {
63356        openArray("characteristic");
63357        for (PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent e : element.getCharacteristic()) 
63358          composePackagedProductDefinitionPackagingPropertyComponent(null, e);
63359        closeArray();
63360      };
63361  }
63362
63363  protected void composePackagedProductDefinitionLegalStatusOfSupplyComponent(String name, PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent element) throws IOException {
63364    if (element != null) {
63365      open(name);
63366      composePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(element);
63367      close();
63368    }
63369  }
63370
63371  protected void composePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent element) throws IOException {
63372    composeBackboneElementProperties(element);
63373      if (element.hasCode()) {
63374        composeCodeableConcept("code", element.getCode());
63375      }
63376      if (element.hasJurisdiction()) {
63377        composeCodeableConcept("jurisdiction", element.getJurisdiction());
63378      }
63379  }
63380
63381  protected void composePackagedProductDefinitionPackagingComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagingComponent element) throws IOException {
63382    if (element != null) {
63383      open(name);
63384      composePackagedProductDefinitionPackagingComponentProperties(element);
63385      close();
63386    }
63387  }
63388
63389  protected void composePackagedProductDefinitionPackagingComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackagingComponent element) throws IOException {
63390    composeBackboneElementProperties(element);
63391      if (element.hasIdentifier()) {
63392        openArray("identifier");
63393        for (Identifier e : element.getIdentifier()) 
63394          composeIdentifier(null, e);
63395        closeArray();
63396      };
63397      if (element.hasType()) {
63398        composeCodeableConcept("type", element.getType());
63399      }
63400      if (element.hasComponentPartElement()) {
63401        composeBooleanCore("componentPart", element.getComponentPartElement(), false);
63402        composeBooleanExtras("componentPart", element.getComponentPartElement(), false);
63403      }
63404      if (element.hasQuantityElement()) {
63405        composeIntegerCore("quantity", element.getQuantityElement(), false);
63406        composeIntegerExtras("quantity", element.getQuantityElement(), false);
63407      }
63408      if (element.hasMaterial()) {
63409        openArray("material");
63410        for (CodeableConcept e : element.getMaterial()) 
63411          composeCodeableConcept(null, e);
63412        closeArray();
63413      };
63414      if (element.hasAlternateMaterial()) {
63415        openArray("alternateMaterial");
63416        for (CodeableConcept e : element.getAlternateMaterial()) 
63417          composeCodeableConcept(null, e);
63418        closeArray();
63419      };
63420      if (element.hasShelfLifeStorage()) {
63421        openArray("shelfLifeStorage");
63422        for (ProductShelfLife e : element.getShelfLifeStorage()) 
63423          composeProductShelfLife(null, e);
63424        closeArray();
63425      };
63426      if (element.hasManufacturer()) {
63427        openArray("manufacturer");
63428        for (Reference e : element.getManufacturer()) 
63429          composeReference(null, e);
63430        closeArray();
63431      };
63432      if (element.hasProperty()) {
63433        openArray("property");
63434        for (PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent e : element.getProperty()) 
63435          composePackagedProductDefinitionPackagingPropertyComponent(null, e);
63436        closeArray();
63437      };
63438      if (element.hasContainedItem()) {
63439        openArray("containedItem");
63440        for (PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent e : element.getContainedItem()) 
63441          composePackagedProductDefinitionPackagingContainedItemComponent(null, e);
63442        closeArray();
63443      };
63444      if (element.hasPackaging()) {
63445        openArray("packaging");
63446        for (PackagedProductDefinition.PackagedProductDefinitionPackagingComponent e : element.getPackaging()) 
63447          composePackagedProductDefinitionPackagingComponent(null, e);
63448        closeArray();
63449      };
63450  }
63451
63452  protected void composePackagedProductDefinitionPackagingPropertyComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent element) throws IOException {
63453    if (element != null) {
63454      open(name);
63455      composePackagedProductDefinitionPackagingPropertyComponentProperties(element);
63456      close();
63457    }
63458  }
63459
63460  protected void composePackagedProductDefinitionPackagingPropertyComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent element) throws IOException {
63461    composeBackboneElementProperties(element);
63462      if (element.hasType()) {
63463        composeCodeableConcept("type", element.getType());
63464      }
63465      if (element.hasValue()) {
63466        composeType("value", element.getValue());
63467      }
63468  }
63469
63470  protected void composePackagedProductDefinitionPackagingContainedItemComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent element) throws IOException {
63471    if (element != null) {
63472      open(name);
63473      composePackagedProductDefinitionPackagingContainedItemComponentProperties(element);
63474      close();
63475    }
63476  }
63477
63478  protected void composePackagedProductDefinitionPackagingContainedItemComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent element) throws IOException {
63479    composeBackboneElementProperties(element);
63480      if (element.hasItem()) {
63481        composeCodeableReference("item", element.getItem());
63482      }
63483      if (element.hasAmount()) {
63484        composeQuantity("amount", element.getAmount());
63485      }
63486  }
63487
63488  protected void composeParameters(String name, Parameters element) throws IOException {
63489    if (element != null) {
63490      prop("resourceType", name);
63491      composeParametersProperties(element);
63492    }
63493  }
63494
63495  protected void composeParametersProperties(Parameters element) throws IOException {
63496    composeResourceProperties(element);
63497      if (element.hasParameter()) {
63498        openArray("parameter");
63499        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
63500          composeParametersParameterComponent(null, e);
63501        closeArray();
63502      };
63503  }
63504
63505  protected void composeParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
63506    if (element != null) {
63507      open(name);
63508      composeParametersParameterComponentProperties(element);
63509      close();
63510    }
63511  }
63512
63513  protected void composeParametersParameterComponentProperties(Parameters.ParametersParameterComponent element) throws IOException {
63514    composeBackboneElementProperties(element);
63515      if (element.hasNameElement()) {
63516        composeStringCore("name", element.getNameElement(), false);
63517        composeStringExtras("name", element.getNameElement(), false);
63518      }
63519      if (element.hasValue()) {
63520        composeType("value", element.getValue());
63521      }
63522        if (element.hasResource()) {
63523          open("resource");
63524          composeResource(element.getResource());
63525          close();
63526        }
63527      if (element.hasPart()) {
63528        openArray("part");
63529        for (Parameters.ParametersParameterComponent e : element.getPart()) 
63530          composeParametersParameterComponent(null, e);
63531        closeArray();
63532      };
63533  }
63534
63535  protected void composePatient(String name, Patient element) throws IOException {
63536    if (element != null) {
63537      prop("resourceType", name);
63538      composePatientProperties(element);
63539    }
63540  }
63541
63542  protected void composePatientProperties(Patient element) throws IOException {
63543    composeDomainResourceProperties(element);
63544      if (element.hasIdentifier()) {
63545        openArray("identifier");
63546        for (Identifier e : element.getIdentifier()) 
63547          composeIdentifier(null, e);
63548        closeArray();
63549      };
63550      if (element.hasActiveElement()) {
63551        composeBooleanCore("active", element.getActiveElement(), false);
63552        composeBooleanExtras("active", element.getActiveElement(), false);
63553      }
63554      if (element.hasName()) {
63555        openArray("name");
63556        for (HumanName e : element.getName()) 
63557          composeHumanName(null, e);
63558        closeArray();
63559      };
63560      if (element.hasTelecom()) {
63561        openArray("telecom");
63562        for (ContactPoint e : element.getTelecom()) 
63563          composeContactPoint(null, e);
63564        closeArray();
63565      };
63566      if (element.hasGenderElement()) {
63567        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63568        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63569      }
63570      if (element.hasBirthDateElement()) {
63571        composeDateCore("birthDate", element.getBirthDateElement(), false);
63572        composeDateExtras("birthDate", element.getBirthDateElement(), false);
63573      }
63574      if (element.hasDeceased()) {
63575        composeType("deceased", element.getDeceased());
63576      }
63577      if (element.hasAddress()) {
63578        openArray("address");
63579        for (Address e : element.getAddress()) 
63580          composeAddress(null, e);
63581        closeArray();
63582      };
63583      if (element.hasMaritalStatus()) {
63584        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
63585      }
63586      if (element.hasMultipleBirth()) {
63587        composeType("multipleBirth", element.getMultipleBirth());
63588      }
63589      if (element.hasPhoto()) {
63590        openArray("photo");
63591        for (Attachment e : element.getPhoto()) 
63592          composeAttachment(null, e);
63593        closeArray();
63594      };
63595      if (element.hasContact()) {
63596        openArray("contact");
63597        for (Patient.ContactComponent e : element.getContact()) 
63598          composeContactComponent(null, e);
63599        closeArray();
63600      };
63601      if (element.hasCommunication()) {
63602        openArray("communication");
63603        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
63604          composePatientCommunicationComponent(null, e);
63605        closeArray();
63606      };
63607      if (element.hasGeneralPractitioner()) {
63608        openArray("generalPractitioner");
63609        for (Reference e : element.getGeneralPractitioner()) 
63610          composeReference(null, e);
63611        closeArray();
63612      };
63613      if (element.hasManagingOrganization()) {
63614        composeReference("managingOrganization", element.getManagingOrganization());
63615      }
63616      if (element.hasLink()) {
63617        openArray("link");
63618        for (Patient.PatientLinkComponent e : element.getLink()) 
63619          composePatientLinkComponent(null, e);
63620        closeArray();
63621      };
63622  }
63623
63624  protected void composeContactComponent(String name, Patient.ContactComponent element) throws IOException {
63625    if (element != null) {
63626      open(name);
63627      composeContactComponentProperties(element);
63628      close();
63629    }
63630  }
63631
63632  protected void composeContactComponentProperties(Patient.ContactComponent element) throws IOException {
63633    composeBackboneElementProperties(element);
63634      if (element.hasRelationship()) {
63635        openArray("relationship");
63636        for (CodeableConcept e : element.getRelationship()) 
63637          composeCodeableConcept(null, e);
63638        closeArray();
63639      };
63640      if (element.hasName()) {
63641        composeHumanName("name", element.getName());
63642      }
63643      if (element.hasTelecom()) {
63644        openArray("telecom");
63645        for (ContactPoint e : element.getTelecom()) 
63646          composeContactPoint(null, e);
63647        closeArray();
63648      };
63649      if (element.hasAddress()) {
63650        composeAddress("address", element.getAddress());
63651      }
63652      if (element.hasGenderElement()) {
63653        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63654        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63655      }
63656      if (element.hasOrganization()) {
63657        composeReference("organization", element.getOrganization());
63658      }
63659      if (element.hasPeriod()) {
63660        composePeriod("period", element.getPeriod());
63661      }
63662  }
63663
63664  protected void composePatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
63665    if (element != null) {
63666      open(name);
63667      composePatientCommunicationComponentProperties(element);
63668      close();
63669    }
63670  }
63671
63672  protected void composePatientCommunicationComponentProperties(Patient.PatientCommunicationComponent element) throws IOException {
63673    composeBackboneElementProperties(element);
63674      if (element.hasLanguage()) {
63675        composeCodeableConcept("language", element.getLanguage());
63676      }
63677      if (element.hasPreferredElement()) {
63678        composeBooleanCore("preferred", element.getPreferredElement(), false);
63679        composeBooleanExtras("preferred", element.getPreferredElement(), false);
63680      }
63681  }
63682
63683  protected void composePatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
63684    if (element != null) {
63685      open(name);
63686      composePatientLinkComponentProperties(element);
63687      close();
63688    }
63689  }
63690
63691  protected void composePatientLinkComponentProperties(Patient.PatientLinkComponent element) throws IOException {
63692    composeBackboneElementProperties(element);
63693      if (element.hasOther()) {
63694        composeReference("other", element.getOther());
63695      }
63696      if (element.hasTypeElement()) {
63697        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
63698        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
63699      }
63700  }
63701
63702  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
63703    if (element != null) {
63704      prop("resourceType", name);
63705      composePaymentNoticeProperties(element);
63706    }
63707  }
63708
63709  protected void composePaymentNoticeProperties(PaymentNotice element) throws IOException {
63710    composeDomainResourceProperties(element);
63711      if (element.hasIdentifier()) {
63712        openArray("identifier");
63713        for (Identifier e : element.getIdentifier()) 
63714          composeIdentifier(null, e);
63715        closeArray();
63716      };
63717      if (element.hasStatusElement()) {
63718        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63719        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63720      }
63721      if (element.hasRequest()) {
63722        composeReference("request", element.getRequest());
63723      }
63724      if (element.hasResponse()) {
63725        composeReference("response", element.getResponse());
63726      }
63727      if (element.hasCreatedElement()) {
63728        composeDateTimeCore("created", element.getCreatedElement(), false);
63729        composeDateTimeExtras("created", element.getCreatedElement(), false);
63730      }
63731      if (element.hasReporter()) {
63732        composeReference("reporter", element.getReporter());
63733      }
63734      if (element.hasPayment()) {
63735        composeReference("payment", element.getPayment());
63736      }
63737      if (element.hasPaymentDateElement()) {
63738        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
63739        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
63740      }
63741      if (element.hasPayee()) {
63742        composeReference("payee", element.getPayee());
63743      }
63744      if (element.hasRecipient()) {
63745        composeReference("recipient", element.getRecipient());
63746      }
63747      if (element.hasAmount()) {
63748        composeMoney("amount", element.getAmount());
63749      }
63750      if (element.hasPaymentStatus()) {
63751        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
63752      }
63753  }
63754
63755  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
63756    if (element != null) {
63757      prop("resourceType", name);
63758      composePaymentReconciliationProperties(element);
63759    }
63760  }
63761
63762  protected void composePaymentReconciliationProperties(PaymentReconciliation element) throws IOException {
63763    composeDomainResourceProperties(element);
63764      if (element.hasIdentifier()) {
63765        openArray("identifier");
63766        for (Identifier e : element.getIdentifier()) 
63767          composeIdentifier(null, e);
63768        closeArray();
63769      };
63770      if (element.hasType()) {
63771        composeCodeableConcept("type", element.getType());
63772      }
63773      if (element.hasStatusElement()) {
63774        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63775        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63776      }
63777      if (element.hasKind()) {
63778        composeCodeableConcept("kind", element.getKind());
63779      }
63780      if (element.hasPeriod()) {
63781        composePeriod("period", element.getPeriod());
63782      }
63783      if (element.hasCreatedElement()) {
63784        composeDateTimeCore("created", element.getCreatedElement(), false);
63785        composeDateTimeExtras("created", element.getCreatedElement(), false);
63786      }
63787      if (element.hasEnterer()) {
63788        composeReference("enterer", element.getEnterer());
63789      }
63790      if (element.hasIssuerType()) {
63791        composeCodeableConcept("issuerType", element.getIssuerType());
63792      }
63793      if (element.hasPaymentIssuer()) {
63794        composeReference("paymentIssuer", element.getPaymentIssuer());
63795      }
63796      if (element.hasRequest()) {
63797        composeReference("request", element.getRequest());
63798      }
63799      if (element.hasRequestor()) {
63800        composeReference("requestor", element.getRequestor());
63801      }
63802      if (element.hasOutcomeElement()) {
63803        composeEnumerationCore("outcome", element.getOutcomeElement(), new PaymentReconciliation.PaymentOutcomeEnumFactory(), false);
63804        composeEnumerationExtras("outcome", element.getOutcomeElement(), new PaymentReconciliation.PaymentOutcomeEnumFactory(), false);
63805      }
63806      if (element.hasDispositionElement()) {
63807        composeStringCore("disposition", element.getDispositionElement(), false);
63808        composeStringExtras("disposition", element.getDispositionElement(), false);
63809      }
63810      if (element.hasDateElement()) {
63811        composeDateCore("date", element.getDateElement(), false);
63812        composeDateExtras("date", element.getDateElement(), false);
63813      }
63814      if (element.hasLocation()) {
63815        composeReference("location", element.getLocation());
63816      }
63817      if (element.hasMethod()) {
63818        composeCodeableConcept("method", element.getMethod());
63819      }
63820      if (element.hasCardBrandElement()) {
63821        composeStringCore("cardBrand", element.getCardBrandElement(), false);
63822        composeStringExtras("cardBrand", element.getCardBrandElement(), false);
63823      }
63824      if (element.hasAccountNumberElement()) {
63825        composeStringCore("accountNumber", element.getAccountNumberElement(), false);
63826        composeStringExtras("accountNumber", element.getAccountNumberElement(), false);
63827      }
63828      if (element.hasExpirationDateElement()) {
63829        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
63830        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
63831      }
63832      if (element.hasProcessorElement()) {
63833        composeStringCore("processor", element.getProcessorElement(), false);
63834        composeStringExtras("processor", element.getProcessorElement(), false);
63835      }
63836      if (element.hasReferenceNumberElement()) {
63837        composeStringCore("referenceNumber", element.getReferenceNumberElement(), false);
63838        composeStringExtras("referenceNumber", element.getReferenceNumberElement(), false);
63839      }
63840      if (element.hasAuthorizationElement()) {
63841        composeStringCore("authorization", element.getAuthorizationElement(), false);
63842        composeStringExtras("authorization", element.getAuthorizationElement(), false);
63843      }
63844      if (element.hasTenderedAmount()) {
63845        composeMoney("tenderedAmount", element.getTenderedAmount());
63846      }
63847      if (element.hasReturnedAmount()) {
63848        composeMoney("returnedAmount", element.getReturnedAmount());
63849      }
63850      if (element.hasAmount()) {
63851        composeMoney("amount", element.getAmount());
63852      }
63853      if (element.hasPaymentIdentifier()) {
63854        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
63855      }
63856      if (element.hasAllocation()) {
63857        openArray("allocation");
63858        for (PaymentReconciliation.PaymentReconciliationAllocationComponent e : element.getAllocation()) 
63859          composePaymentReconciliationAllocationComponent(null, e);
63860        closeArray();
63861      };
63862      if (element.hasFormCode()) {
63863        composeCodeableConcept("formCode", element.getFormCode());
63864      }
63865      if (element.hasProcessNote()) {
63866        openArray("processNote");
63867        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
63868          composeNotesComponent(null, e);
63869        closeArray();
63870      };
63871  }
63872
63873  protected void composePaymentReconciliationAllocationComponent(String name, PaymentReconciliation.PaymentReconciliationAllocationComponent element) throws IOException {
63874    if (element != null) {
63875      open(name);
63876      composePaymentReconciliationAllocationComponentProperties(element);
63877      close();
63878    }
63879  }
63880
63881  protected void composePaymentReconciliationAllocationComponentProperties(PaymentReconciliation.PaymentReconciliationAllocationComponent element) throws IOException {
63882    composeBackboneElementProperties(element);
63883      if (element.hasIdentifier()) {
63884        composeIdentifier("identifier", element.getIdentifier());
63885      }
63886      if (element.hasPredecessor()) {
63887        composeIdentifier("predecessor", element.getPredecessor());
63888      }
63889      if (element.hasTarget()) {
63890        composeReference("target", element.getTarget());
63891      }
63892      if (element.hasTargetItem()) {
63893        composeType("targetItem", element.getTargetItem());
63894      }
63895      if (element.hasEncounter()) {
63896        composeReference("encounter", element.getEncounter());
63897      }
63898      if (element.hasAccount()) {
63899        composeReference("account", element.getAccount());
63900      }
63901      if (element.hasType()) {
63902        composeCodeableConcept("type", element.getType());
63903      }
63904      if (element.hasSubmitter()) {
63905        composeReference("submitter", element.getSubmitter());
63906      }
63907      if (element.hasResponse()) {
63908        composeReference("response", element.getResponse());
63909      }
63910      if (element.hasDateElement()) {
63911        composeDateCore("date", element.getDateElement(), false);
63912        composeDateExtras("date", element.getDateElement(), false);
63913      }
63914      if (element.hasResponsible()) {
63915        composeReference("responsible", element.getResponsible());
63916      }
63917      if (element.hasPayee()) {
63918        composeReference("payee", element.getPayee());
63919      }
63920      if (element.hasAmount()) {
63921        composeMoney("amount", element.getAmount());
63922      }
63923  }
63924
63925  protected void composeNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
63926    if (element != null) {
63927      open(name);
63928      composeNotesComponentProperties(element);
63929      close();
63930    }
63931  }
63932
63933  protected void composeNotesComponentProperties(PaymentReconciliation.NotesComponent element) throws IOException {
63934    composeBackboneElementProperties(element);
63935      if (element.hasTypeElement()) {
63936        composeEnumerationCore("type", element.getTypeElement(), new PaymentReconciliation.NoteTypeEnumFactory(), false);
63937        composeEnumerationExtras("type", element.getTypeElement(), new PaymentReconciliation.NoteTypeEnumFactory(), false);
63938      }
63939      if (element.hasTextElement()) {
63940        composeStringCore("text", element.getTextElement(), false);
63941        composeStringExtras("text", element.getTextElement(), false);
63942      }
63943  }
63944
63945  protected void composePermission(String name, Permission element) throws IOException {
63946    if (element != null) {
63947      prop("resourceType", name);
63948      composePermissionProperties(element);
63949    }
63950  }
63951
63952  protected void composePermissionProperties(Permission element) throws IOException {
63953    composeDomainResourceProperties(element);
63954      if (element.hasStatusElement()) {
63955        composeEnumerationCore("status", element.getStatusElement(), new Permission.PermissionStatusEnumFactory(), false);
63956        composeEnumerationExtras("status", element.getStatusElement(), new Permission.PermissionStatusEnumFactory(), false);
63957      }
63958      if (element.hasAsserter()) {
63959        composeReference("asserter", element.getAsserter());
63960      }
63961      if (element.hasDate()) {
63962        if (anyHasValue(element.getDate())) {
63963          openArray("date");
63964          for (DateTimeType e : element.getDate()) 
63965            composeDateTimeCore(null, e, e != element.getDate().get(element.getDate().size()-1));
63966          closeArray();
63967        }
63968        if (anyHasExtras(element.getDate())) {
63969          openArray("_date");
63970          for (DateTimeType e : element.getDate()) 
63971            composeDateTimeExtras(null, e, true);
63972          closeArray();
63973        }
63974      };
63975      if (element.hasValidity()) {
63976        composePeriod("validity", element.getValidity());
63977      }
63978      if (element.hasJustification()) {
63979        composePermissionJustificationComponent("justification", element.getJustification());
63980      }
63981      if (element.hasCombiningElement()) {
63982        composeEnumerationCore("combining", element.getCombiningElement(), new Permission.PermissionRuleCombiningEnumFactory(), false);
63983        composeEnumerationExtras("combining", element.getCombiningElement(), new Permission.PermissionRuleCombiningEnumFactory(), false);
63984      }
63985      if (element.hasRule()) {
63986        openArray("rule");
63987        for (Permission.RuleComponent e : element.getRule()) 
63988          composeRuleComponent(null, e);
63989        closeArray();
63990      };
63991  }
63992
63993  protected void composePermissionJustificationComponent(String name, Permission.PermissionJustificationComponent element) throws IOException {
63994    if (element != null) {
63995      open(name);
63996      composePermissionJustificationComponentProperties(element);
63997      close();
63998    }
63999  }
64000
64001  protected void composePermissionJustificationComponentProperties(Permission.PermissionJustificationComponent element) throws IOException {
64002    composeBackboneElementProperties(element);
64003      if (element.hasBasis()) {
64004        openArray("basis");
64005        for (CodeableConcept e : element.getBasis()) 
64006          composeCodeableConcept(null, e);
64007        closeArray();
64008      };
64009      if (element.hasEvidence()) {
64010        openArray("evidence");
64011        for (Reference e : element.getEvidence()) 
64012          composeReference(null, e);
64013        closeArray();
64014      };
64015  }
64016
64017  protected void composeRuleComponent(String name, Permission.RuleComponent element) throws IOException {
64018    if (element != null) {
64019      open(name);
64020      composeRuleComponentProperties(element);
64021      close();
64022    }
64023  }
64024
64025  protected void composeRuleComponentProperties(Permission.RuleComponent element) throws IOException {
64026    composeBackboneElementProperties(element);
64027      if (element.hasTypeElement()) {
64028        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
64029        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
64030      }
64031      if (element.hasData()) {
64032        openArray("data");
64033        for (Permission.RuleDataComponent e : element.getData()) 
64034          composeRuleDataComponent(null, e);
64035        closeArray();
64036      };
64037      if (element.hasActivity()) {
64038        openArray("activity");
64039        for (Permission.RuleActivityComponent e : element.getActivity()) 
64040          composeRuleActivityComponent(null, e);
64041        closeArray();
64042      };
64043      if (element.hasLimit()) {
64044        openArray("limit");
64045        for (CodeableConcept e : element.getLimit()) 
64046          composeCodeableConcept(null, e);
64047        closeArray();
64048      };
64049  }
64050
64051  protected void composeRuleDataComponent(String name, Permission.RuleDataComponent element) throws IOException {
64052    if (element != null) {
64053      open(name);
64054      composeRuleDataComponentProperties(element);
64055      close();
64056    }
64057  }
64058
64059  protected void composeRuleDataComponentProperties(Permission.RuleDataComponent element) throws IOException {
64060    composeBackboneElementProperties(element);
64061      if (element.hasResource()) {
64062        openArray("resource");
64063        for (Permission.RuleDataResourceComponent e : element.getResource()) 
64064          composeRuleDataResourceComponent(null, e);
64065        closeArray();
64066      };
64067      if (element.hasSecurity()) {
64068        openArray("security");
64069        for (Coding e : element.getSecurity()) 
64070          composeCoding(null, e);
64071        closeArray();
64072      };
64073      if (element.hasPeriod()) {
64074        openArray("period");
64075        for (Period e : element.getPeriod()) 
64076          composePeriod(null, e);
64077        closeArray();
64078      };
64079      if (element.hasExpression()) {
64080        composeExpression("expression", element.getExpression());
64081      }
64082  }
64083
64084  protected void composeRuleDataResourceComponent(String name, Permission.RuleDataResourceComponent element) throws IOException {
64085    if (element != null) {
64086      open(name);
64087      composeRuleDataResourceComponentProperties(element);
64088      close();
64089    }
64090  }
64091
64092  protected void composeRuleDataResourceComponentProperties(Permission.RuleDataResourceComponent element) throws IOException {
64093    composeBackboneElementProperties(element);
64094      if (element.hasMeaningElement()) {
64095        composeEnumerationCore("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
64096        composeEnumerationExtras("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
64097      }
64098      if (element.hasReference()) {
64099        composeReference("reference", element.getReference());
64100      }
64101  }
64102
64103  protected void composeRuleActivityComponent(String name, Permission.RuleActivityComponent element) throws IOException {
64104    if (element != null) {
64105      open(name);
64106      composeRuleActivityComponentProperties(element);
64107      close();
64108    }
64109  }
64110
64111  protected void composeRuleActivityComponentProperties(Permission.RuleActivityComponent element) throws IOException {
64112    composeBackboneElementProperties(element);
64113      if (element.hasActor()) {
64114        openArray("actor");
64115        for (Reference e : element.getActor()) 
64116          composeReference(null, e);
64117        closeArray();
64118      };
64119      if (element.hasAction()) {
64120        openArray("action");
64121        for (CodeableConcept e : element.getAction()) 
64122          composeCodeableConcept(null, e);
64123        closeArray();
64124      };
64125      if (element.hasPurpose()) {
64126        openArray("purpose");
64127        for (CodeableConcept e : element.getPurpose()) 
64128          composeCodeableConcept(null, e);
64129        closeArray();
64130      };
64131  }
64132
64133  protected void composePerson(String name, Person element) throws IOException {
64134    if (element != null) {
64135      prop("resourceType", name);
64136      composePersonProperties(element);
64137    }
64138  }
64139
64140  protected void composePersonProperties(Person element) throws IOException {
64141    composeDomainResourceProperties(element);
64142      if (element.hasIdentifier()) {
64143        openArray("identifier");
64144        for (Identifier e : element.getIdentifier()) 
64145          composeIdentifier(null, e);
64146        closeArray();
64147      };
64148      if (element.hasActiveElement()) {
64149        composeBooleanCore("active", element.getActiveElement(), false);
64150        composeBooleanExtras("active", element.getActiveElement(), false);
64151      }
64152      if (element.hasName()) {
64153        openArray("name");
64154        for (HumanName e : element.getName()) 
64155          composeHumanName(null, e);
64156        closeArray();
64157      };
64158      if (element.hasTelecom()) {
64159        openArray("telecom");
64160        for (ContactPoint e : element.getTelecom()) 
64161          composeContactPoint(null, e);
64162        closeArray();
64163      };
64164      if (element.hasGenderElement()) {
64165        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64166        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64167      }
64168      if (element.hasBirthDateElement()) {
64169        composeDateCore("birthDate", element.getBirthDateElement(), false);
64170        composeDateExtras("birthDate", element.getBirthDateElement(), false);
64171      }
64172      if (element.hasDeceased()) {
64173        composeType("deceased", element.getDeceased());
64174      }
64175      if (element.hasAddress()) {
64176        openArray("address");
64177        for (Address e : element.getAddress()) 
64178          composeAddress(null, e);
64179        closeArray();
64180      };
64181      if (element.hasMaritalStatus()) {
64182        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
64183      }
64184      if (element.hasPhoto()) {
64185        openArray("photo");
64186        for (Attachment e : element.getPhoto()) 
64187          composeAttachment(null, e);
64188        closeArray();
64189      };
64190      if (element.hasCommunication()) {
64191        openArray("communication");
64192        for (Person.PersonCommunicationComponent e : element.getCommunication()) 
64193          composePersonCommunicationComponent(null, e);
64194        closeArray();
64195      };
64196      if (element.hasManagingOrganization()) {
64197        composeReference("managingOrganization", element.getManagingOrganization());
64198      }
64199      if (element.hasLink()) {
64200        openArray("link");
64201        for (Person.PersonLinkComponent e : element.getLink()) 
64202          composePersonLinkComponent(null, e);
64203        closeArray();
64204      };
64205  }
64206
64207  protected void composePersonCommunicationComponent(String name, Person.PersonCommunicationComponent element) throws IOException {
64208    if (element != null) {
64209      open(name);
64210      composePersonCommunicationComponentProperties(element);
64211      close();
64212    }
64213  }
64214
64215  protected void composePersonCommunicationComponentProperties(Person.PersonCommunicationComponent element) throws IOException {
64216    composeBackboneElementProperties(element);
64217      if (element.hasLanguage()) {
64218        composeCodeableConcept("language", element.getLanguage());
64219      }
64220      if (element.hasPreferredElement()) {
64221        composeBooleanCore("preferred", element.getPreferredElement(), false);
64222        composeBooleanExtras("preferred", element.getPreferredElement(), false);
64223      }
64224  }
64225
64226  protected void composePersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
64227    if (element != null) {
64228      open(name);
64229      composePersonLinkComponentProperties(element);
64230      close();
64231    }
64232  }
64233
64234  protected void composePersonLinkComponentProperties(Person.PersonLinkComponent element) throws IOException {
64235    composeBackboneElementProperties(element);
64236      if (element.hasTarget()) {
64237        composeReference("target", element.getTarget());
64238      }
64239      if (element.hasAssuranceElement()) {
64240        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
64241        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
64242      }
64243  }
64244
64245  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
64246    if (element != null) {
64247      prop("resourceType", name);
64248      composePlanDefinitionProperties(element);
64249    }
64250  }
64251
64252  protected void composePlanDefinitionProperties(PlanDefinition element) throws IOException {
64253    composeMetadataResourceProperties(element);
64254      if (element.hasUrlElement()) {
64255        composeUriCore("url", element.getUrlElement(), false);
64256        composeUriExtras("url", element.getUrlElement(), false);
64257      }
64258      if (element.hasIdentifier()) {
64259        openArray("identifier");
64260        for (Identifier e : element.getIdentifier()) 
64261          composeIdentifier(null, e);
64262        closeArray();
64263      };
64264      if (element.hasVersionElement()) {
64265        composeStringCore("version", element.getVersionElement(), false);
64266        composeStringExtras("version", element.getVersionElement(), false);
64267      }
64268      if (element.hasVersionAlgorithm()) {
64269        composeType("versionAlgorithm", element.getVersionAlgorithm());
64270      }
64271      if (element.hasNameElement()) {
64272        composeStringCore("name", element.getNameElement(), false);
64273        composeStringExtras("name", element.getNameElement(), false);
64274      }
64275      if (element.hasTitleElement()) {
64276        composeStringCore("title", element.getTitleElement(), false);
64277        composeStringExtras("title", element.getTitleElement(), false);
64278      }
64279      if (element.hasSubtitleElement()) {
64280        composeStringCore("subtitle", element.getSubtitleElement(), false);
64281        composeStringExtras("subtitle", element.getSubtitleElement(), false);
64282      }
64283      if (element.hasType()) {
64284        composeCodeableConcept("type", element.getType());
64285      }
64286      if (element.hasStatusElement()) {
64287        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
64288        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
64289      }
64290      if (element.hasExperimentalElement()) {
64291        composeBooleanCore("experimental", element.getExperimentalElement(), false);
64292        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
64293      }
64294      if (element.hasSubject()) {
64295        composeType("subject", element.getSubject());
64296      }
64297      if (element.hasDateElement()) {
64298        composeDateTimeCore("date", element.getDateElement(), false);
64299        composeDateTimeExtras("date", element.getDateElement(), false);
64300      }
64301      if (element.hasPublisherElement()) {
64302        composeStringCore("publisher", element.getPublisherElement(), false);
64303        composeStringExtras("publisher", element.getPublisherElement(), false);
64304      }
64305      if (element.hasContact()) {
64306        openArray("contact");
64307        for (ContactDetail e : element.getContact()) 
64308          composeContactDetail(null, e);
64309        closeArray();
64310      };
64311      if (element.hasDescriptionElement()) {
64312        composeMarkdownCore("description", element.getDescriptionElement(), false);
64313        composeMarkdownExtras("description", element.getDescriptionElement(), false);
64314      }
64315      if (element.hasUseContext()) {
64316        openArray("useContext");
64317        for (UsageContext e : element.getUseContext()) 
64318          composeUsageContext(null, e);
64319        closeArray();
64320      };
64321      if (element.hasJurisdiction()) {
64322        openArray("jurisdiction");
64323        for (CodeableConcept e : element.getJurisdiction()) 
64324          composeCodeableConcept(null, e);
64325        closeArray();
64326      };
64327      if (element.hasPurposeElement()) {
64328        composeMarkdownCore("purpose", element.getPurposeElement(), false);
64329        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
64330      }
64331      if (element.hasUsageElement()) {
64332        composeMarkdownCore("usage", element.getUsageElement(), false);
64333        composeMarkdownExtras("usage", element.getUsageElement(), false);
64334      }
64335      if (element.hasCopyrightElement()) {
64336        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
64337        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
64338      }
64339      if (element.hasCopyrightLabelElement()) {
64340        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
64341        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
64342      }
64343      if (element.hasApprovalDateElement()) {
64344        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
64345        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
64346      }
64347      if (element.hasLastReviewDateElement()) {
64348        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
64349        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
64350      }
64351      if (element.hasEffectivePeriod()) {
64352        composePeriod("effectivePeriod", element.getEffectivePeriod());
64353      }
64354      if (element.hasTopic()) {
64355        openArray("topic");
64356        for (CodeableConcept e : element.getTopic()) 
64357          composeCodeableConcept(null, e);
64358        closeArray();
64359      };
64360      if (element.hasAuthor()) {
64361        openArray("author");
64362        for (ContactDetail e : element.getAuthor()) 
64363          composeContactDetail(null, e);
64364        closeArray();
64365      };
64366      if (element.hasEditor()) {
64367        openArray("editor");
64368        for (ContactDetail e : element.getEditor()) 
64369          composeContactDetail(null, e);
64370        closeArray();
64371      };
64372      if (element.hasReviewer()) {
64373        openArray("reviewer");
64374        for (ContactDetail e : element.getReviewer()) 
64375          composeContactDetail(null, e);
64376        closeArray();
64377      };
64378      if (element.hasEndorser()) {
64379        openArray("endorser");
64380        for (ContactDetail e : element.getEndorser()) 
64381          composeContactDetail(null, e);
64382        closeArray();
64383      };
64384      if (element.hasRelatedArtifact()) {
64385        openArray("relatedArtifact");
64386        for (RelatedArtifact e : element.getRelatedArtifact()) 
64387          composeRelatedArtifact(null, e);
64388        closeArray();
64389      };
64390      if (element.hasLibrary()) {
64391        if (anyHasValue(element.getLibrary())) {
64392          openArray("library");
64393          for (CanonicalType e : element.getLibrary()) 
64394            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
64395          closeArray();
64396        }
64397        if (anyHasExtras(element.getLibrary())) {
64398          openArray("_library");
64399          for (CanonicalType e : element.getLibrary()) 
64400            composeCanonicalExtras(null, e, true);
64401          closeArray();
64402        }
64403      };
64404      if (element.hasGoal()) {
64405        openArray("goal");
64406        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
64407          composePlanDefinitionGoalComponent(null, e);
64408        closeArray();
64409      };
64410      if (element.hasActor()) {
64411        openArray("actor");
64412        for (PlanDefinition.PlanDefinitionActorComponent e : element.getActor()) 
64413          composePlanDefinitionActorComponent(null, e);
64414        closeArray();
64415      };
64416      if (element.hasAction()) {
64417        openArray("action");
64418        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
64419          composePlanDefinitionActionComponent(null, e);
64420        closeArray();
64421      };
64422      if (element.hasAsNeeded()) {
64423        composeType("asNeeded", element.getAsNeeded());
64424      }
64425  }
64426
64427  protected void composePlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
64428    if (element != null) {
64429      open(name);
64430      composePlanDefinitionGoalComponentProperties(element);
64431      close();
64432    }
64433  }
64434
64435  protected void composePlanDefinitionGoalComponentProperties(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
64436    composeBackboneElementProperties(element);
64437      if (element.hasCategory()) {
64438        composeCodeableConcept("category", element.getCategory());
64439      }
64440      if (element.hasDescription()) {
64441        composeCodeableConcept("description", element.getDescription());
64442      }
64443      if (element.hasPriority()) {
64444        composeCodeableConcept("priority", element.getPriority());
64445      }
64446      if (element.hasStart()) {
64447        composeCodeableConcept("start", element.getStart());
64448      }
64449      if (element.hasAddresses()) {
64450        openArray("addresses");
64451        for (CodeableConcept e : element.getAddresses()) 
64452          composeCodeableConcept(null, e);
64453        closeArray();
64454      };
64455      if (element.hasDocumentation()) {
64456        openArray("documentation");
64457        for (RelatedArtifact e : element.getDocumentation()) 
64458          composeRelatedArtifact(null, e);
64459        closeArray();
64460      };
64461      if (element.hasTarget()) {
64462        openArray("target");
64463        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
64464          composePlanDefinitionGoalTargetComponent(null, e);
64465        closeArray();
64466      };
64467  }
64468
64469  protected void composePlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
64470    if (element != null) {
64471      open(name);
64472      composePlanDefinitionGoalTargetComponentProperties(element);
64473      close();
64474    }
64475  }
64476
64477  protected void composePlanDefinitionGoalTargetComponentProperties(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
64478    composeBackboneElementProperties(element);
64479      if (element.hasMeasure()) {
64480        composeCodeableConcept("measure", element.getMeasure());
64481      }
64482      if (element.hasDetail()) {
64483        composeType("detail", element.getDetail());
64484      }
64485      if (element.hasDue()) {
64486        composeDuration("due", element.getDue());
64487      }
64488  }
64489
64490  protected void composePlanDefinitionActorComponent(String name, PlanDefinition.PlanDefinitionActorComponent element) throws IOException {
64491    if (element != null) {
64492      open(name);
64493      composePlanDefinitionActorComponentProperties(element);
64494      close();
64495    }
64496  }
64497
64498  protected void composePlanDefinitionActorComponentProperties(PlanDefinition.PlanDefinitionActorComponent element) throws IOException {
64499    composeBackboneElementProperties(element);
64500      if (element.hasTitleElement()) {
64501        composeStringCore("title", element.getTitleElement(), false);
64502        composeStringExtras("title", element.getTitleElement(), false);
64503      }
64504      if (element.hasDescriptionElement()) {
64505        composeMarkdownCore("description", element.getDescriptionElement(), false);
64506        composeMarkdownExtras("description", element.getDescriptionElement(), false);
64507      }
64508      if (element.hasOption()) {
64509        openArray("option");
64510        for (PlanDefinition.PlanDefinitionActorOptionComponent e : element.getOption()) 
64511          composePlanDefinitionActorOptionComponent(null, e);
64512        closeArray();
64513      };
64514  }
64515
64516  protected void composePlanDefinitionActorOptionComponent(String name, PlanDefinition.PlanDefinitionActorOptionComponent element) throws IOException {
64517    if (element != null) {
64518      open(name);
64519      composePlanDefinitionActorOptionComponentProperties(element);
64520      close();
64521    }
64522  }
64523
64524  protected void composePlanDefinitionActorOptionComponentProperties(PlanDefinition.PlanDefinitionActorOptionComponent element) throws IOException {
64525    composeBackboneElementProperties(element);
64526      if (element.hasTypeElement()) {
64527        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64528        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64529      }
64530      if (element.hasTypeCanonicalElement()) {
64531        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
64532        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
64533      }
64534      if (element.hasTypeReference()) {
64535        composeReference("typeReference", element.getTypeReference());
64536      }
64537      if (element.hasRole()) {
64538        composeCodeableConcept("role", element.getRole());
64539      }
64540  }
64541
64542  protected void composePlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
64543    if (element != null) {
64544      open(name);
64545      composePlanDefinitionActionComponentProperties(element);
64546      close();
64547    }
64548  }
64549
64550  protected void composePlanDefinitionActionComponentProperties(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
64551    composeBackboneElementProperties(element);
64552      if (element.hasLinkIdElement()) {
64553        composeStringCore("linkId", element.getLinkIdElement(), false);
64554        composeStringExtras("linkId", element.getLinkIdElement(), false);
64555      }
64556      if (element.hasPrefixElement()) {
64557        composeStringCore("prefix", element.getPrefixElement(), false);
64558        composeStringExtras("prefix", element.getPrefixElement(), false);
64559      }
64560      if (element.hasTitleElement()) {
64561        composeStringCore("title", element.getTitleElement(), false);
64562        composeStringExtras("title", element.getTitleElement(), false);
64563      }
64564      if (element.hasDescriptionElement()) {
64565        composeMarkdownCore("description", element.getDescriptionElement(), false);
64566        composeMarkdownExtras("description", element.getDescriptionElement(), false);
64567      }
64568      if (element.hasTextEquivalentElement()) {
64569        composeMarkdownCore("textEquivalent", element.getTextEquivalentElement(), false);
64570        composeMarkdownExtras("textEquivalent", element.getTextEquivalentElement(), false);
64571      }
64572      if (element.hasPriorityElement()) {
64573        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
64574        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
64575      }
64576      if (element.hasCode()) {
64577        composeCodeableConcept("code", element.getCode());
64578      }
64579      if (element.hasReason()) {
64580        openArray("reason");
64581        for (CodeableConcept e : element.getReason()) 
64582          composeCodeableConcept(null, e);
64583        closeArray();
64584      };
64585      if (element.hasDocumentation()) {
64586        openArray("documentation");
64587        for (RelatedArtifact e : element.getDocumentation()) 
64588          composeRelatedArtifact(null, e);
64589        closeArray();
64590      };
64591      if (element.hasGoalId()) {
64592        if (anyHasValue(element.getGoalId())) {
64593          openArray("goalId");
64594          for (IdType e : element.getGoalId()) 
64595            composeIdCore(null, e, e != element.getGoalId().get(element.getGoalId().size()-1));
64596          closeArray();
64597        }
64598        if (anyHasExtras(element.getGoalId())) {
64599          openArray("_goalId");
64600          for (IdType e : element.getGoalId()) 
64601            composeIdExtras(null, e, true);
64602          closeArray();
64603        }
64604      };
64605      if (element.hasSubject()) {
64606        composeType("subject", element.getSubject());
64607      }
64608      if (element.hasTrigger()) {
64609        openArray("trigger");
64610        for (TriggerDefinition e : element.getTrigger()) 
64611          composeTriggerDefinition(null, e);
64612        closeArray();
64613      };
64614      if (element.hasCondition()) {
64615        openArray("condition");
64616        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
64617          composePlanDefinitionActionConditionComponent(null, e);
64618        closeArray();
64619      };
64620      if (element.hasInput()) {
64621        openArray("input");
64622        for (PlanDefinition.PlanDefinitionActionInputComponent e : element.getInput()) 
64623          composePlanDefinitionActionInputComponent(null, e);
64624        closeArray();
64625      };
64626      if (element.hasOutput()) {
64627        openArray("output");
64628        for (PlanDefinition.PlanDefinitionActionOutputComponent e : element.getOutput()) 
64629          composePlanDefinitionActionOutputComponent(null, e);
64630        closeArray();
64631      };
64632      if (element.hasRelatedAction()) {
64633        openArray("relatedAction");
64634        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
64635          composePlanDefinitionActionRelatedActionComponent(null, e);
64636        closeArray();
64637      };
64638      if (element.hasTiming()) {
64639        composeType("timing", element.getTiming());
64640      }
64641      if (element.hasLocation()) {
64642        composeCodeableReference("location", element.getLocation());
64643      }
64644      if (element.hasParticipant()) {
64645        openArray("participant");
64646        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
64647          composePlanDefinitionActionParticipantComponent(null, e);
64648        closeArray();
64649      };
64650      if (element.hasType()) {
64651        composeCodeableConcept("type", element.getType());
64652      }
64653      if (element.hasGroupingBehaviorElement()) {
64654        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
64655        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
64656      }
64657      if (element.hasSelectionBehaviorElement()) {
64658        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
64659        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
64660      }
64661      if (element.hasRequiredBehaviorElement()) {
64662        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
64663        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
64664      }
64665      if (element.hasPrecheckBehaviorElement()) {
64666        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
64667        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
64668      }
64669      if (element.hasCardinalityBehaviorElement()) {
64670        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
64671        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
64672      }
64673      if (element.hasDefinition()) {
64674        composeType("definition", element.getDefinition());
64675      }
64676      if (element.hasTransformElement()) {
64677        composeCanonicalCore("transform", element.getTransformElement(), false);
64678        composeCanonicalExtras("transform", element.getTransformElement(), false);
64679      }
64680      if (element.hasDynamicValue()) {
64681        openArray("dynamicValue");
64682        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
64683          composePlanDefinitionActionDynamicValueComponent(null, e);
64684        closeArray();
64685      };
64686      if (element.hasAction()) {
64687        openArray("action");
64688        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
64689          composePlanDefinitionActionComponent(null, e);
64690        closeArray();
64691      };
64692  }
64693
64694  protected void composePlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
64695    if (element != null) {
64696      open(name);
64697      composePlanDefinitionActionConditionComponentProperties(element);
64698      close();
64699    }
64700  }
64701
64702  protected void composePlanDefinitionActionConditionComponentProperties(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
64703    composeBackboneElementProperties(element);
64704      if (element.hasKindElement()) {
64705        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
64706        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
64707      }
64708      if (element.hasExpression()) {
64709        composeExpression("expression", element.getExpression());
64710      }
64711  }
64712
64713  protected void composePlanDefinitionActionInputComponent(String name, PlanDefinition.PlanDefinitionActionInputComponent element) throws IOException {
64714    if (element != null) {
64715      open(name);
64716      composePlanDefinitionActionInputComponentProperties(element);
64717      close();
64718    }
64719  }
64720
64721  protected void composePlanDefinitionActionInputComponentProperties(PlanDefinition.PlanDefinitionActionInputComponent element) throws IOException {
64722    composeBackboneElementProperties(element);
64723      if (element.hasTitleElement()) {
64724        composeStringCore("title", element.getTitleElement(), false);
64725        composeStringExtras("title", element.getTitleElement(), false);
64726      }
64727      if (element.hasRequirement()) {
64728        composeDataRequirement("requirement", element.getRequirement());
64729      }
64730      if (element.hasRelatedDataElement()) {
64731        composeIdCore("relatedData", element.getRelatedDataElement(), false);
64732        composeIdExtras("relatedData", element.getRelatedDataElement(), false);
64733      }
64734  }
64735
64736  protected void composePlanDefinitionActionOutputComponent(String name, PlanDefinition.PlanDefinitionActionOutputComponent element) throws IOException {
64737    if (element != null) {
64738      open(name);
64739      composePlanDefinitionActionOutputComponentProperties(element);
64740      close();
64741    }
64742  }
64743
64744  protected void composePlanDefinitionActionOutputComponentProperties(PlanDefinition.PlanDefinitionActionOutputComponent element) throws IOException {
64745    composeBackboneElementProperties(element);
64746      if (element.hasTitleElement()) {
64747        composeStringCore("title", element.getTitleElement(), false);
64748        composeStringExtras("title", element.getTitleElement(), false);
64749      }
64750      if (element.hasRequirement()) {
64751        composeDataRequirement("requirement", element.getRequirement());
64752      }
64753      if (element.hasRelatedDataElement()) {
64754        composeStringCore("relatedData", element.getRelatedDataElement(), false);
64755        composeStringExtras("relatedData", element.getRelatedDataElement(), false);
64756      }
64757  }
64758
64759  protected void composePlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
64760    if (element != null) {
64761      open(name);
64762      composePlanDefinitionActionRelatedActionComponentProperties(element);
64763      close();
64764    }
64765  }
64766
64767  protected void composePlanDefinitionActionRelatedActionComponentProperties(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
64768    composeBackboneElementProperties(element);
64769      if (element.hasTargetIdElement()) {
64770        composeIdCore("targetId", element.getTargetIdElement(), false);
64771        composeIdExtras("targetId", element.getTargetIdElement(), false);
64772      }
64773      if (element.hasRelationshipElement()) {
64774        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64775        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64776      }
64777      if (element.hasEndRelationshipElement()) {
64778        composeEnumerationCore("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64779        composeEnumerationExtras("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64780      }
64781      if (element.hasOffset()) {
64782        composeType("offset", element.getOffset());
64783      }
64784  }
64785
64786  protected void composePlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
64787    if (element != null) {
64788      open(name);
64789      composePlanDefinitionActionParticipantComponentProperties(element);
64790      close();
64791    }
64792  }
64793
64794  protected void composePlanDefinitionActionParticipantComponentProperties(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
64795    composeBackboneElementProperties(element);
64796      if (element.hasActorIdElement()) {
64797        composeStringCore("actorId", element.getActorIdElement(), false);
64798        composeStringExtras("actorId", element.getActorIdElement(), false);
64799      }
64800      if (element.hasTypeElement()) {
64801        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64802        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64803      }
64804      if (element.hasTypeCanonicalElement()) {
64805        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
64806        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
64807      }
64808      if (element.hasTypeReference()) {
64809        composeReference("typeReference", element.getTypeReference());
64810      }
64811      if (element.hasRole()) {
64812        composeCodeableConcept("role", element.getRole());
64813      }
64814      if (element.hasFunction()) {
64815        composeCodeableConcept("function", element.getFunction());
64816      }
64817  }
64818
64819  protected void composePlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
64820    if (element != null) {
64821      open(name);
64822      composePlanDefinitionActionDynamicValueComponentProperties(element);
64823      close();
64824    }
64825  }
64826
64827  protected void composePlanDefinitionActionDynamicValueComponentProperties(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
64828    composeBackboneElementProperties(element);
64829      if (element.hasPathElement()) {
64830        composeStringCore("path", element.getPathElement(), false);
64831        composeStringExtras("path", element.getPathElement(), false);
64832      }
64833      if (element.hasExpression()) {
64834        composeExpression("expression", element.getExpression());
64835      }
64836  }
64837
64838  protected void composePractitioner(String name, Practitioner element) throws IOException {
64839    if (element != null) {
64840      prop("resourceType", name);
64841      composePractitionerProperties(element);
64842    }
64843  }
64844
64845  protected void composePractitionerProperties(Practitioner element) throws IOException {
64846    composeDomainResourceProperties(element);
64847      if (element.hasIdentifier()) {
64848        openArray("identifier");
64849        for (Identifier e : element.getIdentifier()) 
64850          composeIdentifier(null, e);
64851        closeArray();
64852      };
64853      if (element.hasActiveElement()) {
64854        composeBooleanCore("active", element.getActiveElement(), false);
64855        composeBooleanExtras("active", element.getActiveElement(), false);
64856      }
64857      if (element.hasName()) {
64858        openArray("name");
64859        for (HumanName e : element.getName()) 
64860          composeHumanName(null, e);
64861        closeArray();
64862      };
64863      if (element.hasTelecom()) {
64864        openArray("telecom");
64865        for (ContactPoint e : element.getTelecom()) 
64866          composeContactPoint(null, e);
64867        closeArray();
64868      };
64869      if (element.hasGenderElement()) {
64870        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64871        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64872      }
64873      if (element.hasBirthDateElement()) {
64874        composeDateCore("birthDate", element.getBirthDateElement(), false);
64875        composeDateExtras("birthDate", element.getBirthDateElement(), false);
64876      }
64877      if (element.hasDeceased()) {
64878        composeType("deceased", element.getDeceased());
64879      }
64880      if (element.hasAddress()) {
64881        openArray("address");
64882        for (Address e : element.getAddress()) 
64883          composeAddress(null, e);
64884        closeArray();
64885      };
64886      if (element.hasPhoto()) {
64887        openArray("photo");
64888        for (Attachment e : element.getPhoto()) 
64889          composeAttachment(null, e);
64890        closeArray();
64891      };
64892      if (element.hasQualification()) {
64893        openArray("qualification");
64894        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
64895          composePractitionerQualificationComponent(null, e);
64896        closeArray();
64897      };
64898      if (element.hasCommunication()) {
64899        openArray("communication");
64900        for (Practitioner.PractitionerCommunicationComponent e : element.getCommunication()) 
64901          composePractitionerCommunicationComponent(null, e);
64902        closeArray();
64903      };
64904  }
64905
64906  protected void composePractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
64907    if (element != null) {
64908      open(name);
64909      composePractitionerQualificationComponentProperties(element);
64910      close();
64911    }
64912  }
64913
64914  protected void composePractitionerQualificationComponentProperties(Practitioner.PractitionerQualificationComponent element) throws IOException {
64915    composeBackboneElementProperties(element);
64916      if (element.hasIdentifier()) {
64917        openArray("identifier");
64918        for (Identifier e : element.getIdentifier()) 
64919          composeIdentifier(null, e);
64920        closeArray();
64921      };
64922      if (element.hasCode()) {
64923        composeCodeableConcept("code", element.getCode());
64924      }
64925      if (element.hasPeriod()) {
64926        composePeriod("period", element.getPeriod());
64927      }
64928      if (element.hasIssuer()) {
64929        composeReference("issuer", element.getIssuer());
64930      }
64931  }
64932
64933  protected void composePractitionerCommunicationComponent(String name, Practitioner.PractitionerCommunicationComponent element) throws IOException {
64934    if (element != null) {
64935      open(name);
64936      composePractitionerCommunicationComponentProperties(element);
64937      close();
64938    }
64939  }
64940
64941  protected void composePractitionerCommunicationComponentProperties(Practitioner.PractitionerCommunicationComponent element) throws IOException {
64942    composeBackboneElementProperties(element);
64943      if (element.hasLanguage()) {
64944        composeCodeableConcept("language", element.getLanguage());
64945      }
64946      if (element.hasPreferredElement()) {
64947        composeBooleanCore("preferred", element.getPreferredElement(), false);
64948        composeBooleanExtras("preferred", element.getPreferredElement(), false);
64949      }
64950  }
64951
64952  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
64953    if (element != null) {
64954      prop("resourceType", name);
64955      composePractitionerRoleProperties(element);
64956    }
64957  }
64958
64959  protected void composePractitionerRoleProperties(PractitionerRole element) throws IOException {
64960    composeDomainResourceProperties(element);
64961      if (element.hasIdentifier()) {
64962        openArray("identifier");
64963        for (Identifier e : element.getIdentifier()) 
64964          composeIdentifier(null, e);
64965        closeArray();
64966      };
64967      if (element.hasActiveElement()) {
64968        composeBooleanCore("active", element.getActiveElement(), false);
64969        composeBooleanExtras("active", element.getActiveElement(), false);
64970      }
64971      if (element.hasPeriod()) {
64972        composePeriod("period", element.getPeriod());
64973      }
64974      if (element.hasPractitioner()) {
64975        composeReference("practitioner", element.getPractitioner());
64976      }
64977      if (element.hasOrganization()) {
64978        composeReference("organization", element.getOrganization());
64979      }
64980      if (element.hasCode()) {
64981        openArray("code");
64982        for (CodeableConcept e : element.getCode()) 
64983          composeCodeableConcept(null, e);
64984        closeArray();
64985      };
64986      if (element.hasSpecialty()) {
64987        openArray("specialty");
64988        for (CodeableConcept e : element.getSpecialty()) 
64989          composeCodeableConcept(null, e);
64990        closeArray();
64991      };
64992      if (element.hasLocation()) {
64993        openArray("location");
64994        for (Reference e : element.getLocation()) 
64995          composeReference(null, e);
64996        closeArray();
64997      };
64998      if (element.hasHealthcareService()) {
64999        openArray("healthcareService");
65000        for (Reference e : element.getHealthcareService()) 
65001          composeReference(null, e);
65002        closeArray();
65003      };
65004      if (element.hasContact()) {
65005        openArray("contact");
65006        for (ExtendedContactDetail e : element.getContact()) 
65007          composeExtendedContactDetail(null, e);
65008        closeArray();
65009      };
65010      if (element.hasCharacteristic()) {
65011        openArray("characteristic");
65012        for (CodeableConcept e : element.getCharacteristic()) 
65013          composeCodeableConcept(null, e);
65014        closeArray();
65015      };
65016      if (element.hasCommunication()) {
65017        openArray("communication");
65018        for (CodeableConcept e : element.getCommunication()) 
65019          composeCodeableConcept(null, e);
65020        closeArray();
65021      };
65022      if (element.hasAvailability()) {
65023        openArray("availability");
65024        for (Availability e : element.getAvailability()) 
65025          composeAvailability(null, e);
65026        closeArray();
65027      };
65028      if (element.hasEndpoint()) {
65029        openArray("endpoint");
65030        for (Reference e : element.getEndpoint()) 
65031          composeReference(null, e);
65032        closeArray();
65033      };
65034  }
65035
65036  protected void composeProcedure(String name, Procedure element) throws IOException {
65037    if (element != null) {
65038      prop("resourceType", name);
65039      composeProcedureProperties(element);
65040    }
65041  }
65042
65043  protected void composeProcedureProperties(Procedure element) throws IOException {
65044    composeDomainResourceProperties(element);
65045      if (element.hasIdentifier()) {
65046        openArray("identifier");
65047        for (Identifier e : element.getIdentifier()) 
65048          composeIdentifier(null, e);
65049        closeArray();
65050      };
65051      if (element.hasInstantiatesCanonical()) {
65052        if (anyHasValue(element.getInstantiatesCanonical())) {
65053          openArray("instantiatesCanonical");
65054          for (CanonicalType e : element.getInstantiatesCanonical()) 
65055            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
65056          closeArray();
65057        }
65058        if (anyHasExtras(element.getInstantiatesCanonical())) {
65059          openArray("_instantiatesCanonical");
65060          for (CanonicalType e : element.getInstantiatesCanonical()) 
65061            composeCanonicalExtras(null, e, true);
65062          closeArray();
65063        }
65064      };
65065      if (element.hasInstantiatesUri()) {
65066        if (anyHasValue(element.getInstantiatesUri())) {
65067          openArray("instantiatesUri");
65068          for (UriType e : element.getInstantiatesUri()) 
65069            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
65070          closeArray();
65071        }
65072        if (anyHasExtras(element.getInstantiatesUri())) {
65073          openArray("_instantiatesUri");
65074          for (UriType e : element.getInstantiatesUri()) 
65075            composeUriExtras(null, e, true);
65076          closeArray();
65077        }
65078      };
65079      if (element.hasBasedOn()) {
65080        openArray("basedOn");
65081        for (Reference e : element.getBasedOn()) 
65082          composeReference(null, e);
65083        closeArray();
65084      };
65085      if (element.hasPartOf()) {
65086        openArray("partOf");
65087        for (Reference e : element.getPartOf()) 
65088          composeReference(null, e);
65089        closeArray();
65090      };
65091      if (element.hasStatusElement()) {
65092        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
65093        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
65094      }
65095      if (element.hasStatusReason()) {
65096        composeCodeableConcept("statusReason", element.getStatusReason());
65097      }
65098      if (element.hasCategory()) {
65099        openArray("category");
65100        for (CodeableConcept e : element.getCategory()) 
65101          composeCodeableConcept(null, e);
65102        closeArray();
65103      };
65104      if (element.hasCode()) {
65105        composeCodeableConcept("code", element.getCode());
65106      }
65107      if (element.hasSubject()) {
65108        composeReference("subject", element.getSubject());
65109      }
65110      if (element.hasFocus()) {
65111        composeReference("focus", element.getFocus());
65112      }
65113      if (element.hasEncounter()) {
65114        composeReference("encounter", element.getEncounter());
65115      }
65116      if (element.hasOccurrence()) {
65117        composeType("occurrence", element.getOccurrence());
65118      }
65119      if (element.hasRecordedElement()) {
65120        composeDateTimeCore("recorded", element.getRecordedElement(), false);
65121        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
65122      }
65123      if (element.hasRecorder()) {
65124        composeReference("recorder", element.getRecorder());
65125      }
65126      if (element.hasReported()) {
65127        composeType("reported", element.getReported());
65128      }
65129      if (element.hasPerformer()) {
65130        openArray("performer");
65131        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
65132          composeProcedurePerformerComponent(null, e);
65133        closeArray();
65134      };
65135      if (element.hasLocation()) {
65136        composeReference("location", element.getLocation());
65137      }
65138      if (element.hasReason()) {
65139        openArray("reason");
65140        for (CodeableReference e : element.getReason()) 
65141          composeCodeableReference(null, e);
65142        closeArray();
65143      };
65144      if (element.hasBodySite()) {
65145        openArray("bodySite");
65146        for (CodeableConcept e : element.getBodySite()) 
65147          composeCodeableConcept(null, e);
65148        closeArray();
65149      };
65150      if (element.hasOutcome()) {
65151        composeCodeableConcept("outcome", element.getOutcome());
65152      }
65153      if (element.hasReport()) {
65154        openArray("report");
65155        for (Reference e : element.getReport()) 
65156          composeReference(null, e);
65157        closeArray();
65158      };
65159      if (element.hasComplication()) {
65160        openArray("complication");
65161        for (CodeableReference e : element.getComplication()) 
65162          composeCodeableReference(null, e);
65163        closeArray();
65164      };
65165      if (element.hasFollowUp()) {
65166        openArray("followUp");
65167        for (CodeableConcept e : element.getFollowUp()) 
65168          composeCodeableConcept(null, e);
65169        closeArray();
65170      };
65171      if (element.hasNote()) {
65172        openArray("note");
65173        for (Annotation e : element.getNote()) 
65174          composeAnnotation(null, e);
65175        closeArray();
65176      };
65177      if (element.hasFocalDevice()) {
65178        openArray("focalDevice");
65179        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
65180          composeProcedureFocalDeviceComponent(null, e);
65181        closeArray();
65182      };
65183      if (element.hasUsed()) {
65184        openArray("used");
65185        for (CodeableReference e : element.getUsed()) 
65186          composeCodeableReference(null, e);
65187        closeArray();
65188      };
65189      if (element.hasSupportingInfo()) {
65190        openArray("supportingInfo");
65191        for (Reference e : element.getSupportingInfo()) 
65192          composeReference(null, e);
65193        closeArray();
65194      };
65195  }
65196
65197  protected void composeProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
65198    if (element != null) {
65199      open(name);
65200      composeProcedurePerformerComponentProperties(element);
65201      close();
65202    }
65203  }
65204
65205  protected void composeProcedurePerformerComponentProperties(Procedure.ProcedurePerformerComponent element) throws IOException {
65206    composeBackboneElementProperties(element);
65207      if (element.hasFunction()) {
65208        composeCodeableConcept("function", element.getFunction());
65209      }
65210      if (element.hasActor()) {
65211        composeReference("actor", element.getActor());
65212      }
65213      if (element.hasOnBehalfOf()) {
65214        composeReference("onBehalfOf", element.getOnBehalfOf());
65215      }
65216      if (element.hasPeriod()) {
65217        composePeriod("period", element.getPeriod());
65218      }
65219  }
65220
65221  protected void composeProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
65222    if (element != null) {
65223      open(name);
65224      composeProcedureFocalDeviceComponentProperties(element);
65225      close();
65226    }
65227  }
65228
65229  protected void composeProcedureFocalDeviceComponentProperties(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
65230    composeBackboneElementProperties(element);
65231      if (element.hasAction()) {
65232        composeCodeableConcept("action", element.getAction());
65233      }
65234      if (element.hasManipulated()) {
65235        composeReference("manipulated", element.getManipulated());
65236      }
65237  }
65238
65239  protected void composeProvenance(String name, Provenance element) throws IOException {
65240    if (element != null) {
65241      prop("resourceType", name);
65242      composeProvenanceProperties(element);
65243    }
65244  }
65245
65246  protected void composeProvenanceProperties(Provenance element) throws IOException {
65247    composeDomainResourceProperties(element);
65248      if (element.hasTarget()) {
65249        openArray("target");
65250        for (Reference e : element.getTarget()) 
65251          composeReference(null, e);
65252        closeArray();
65253      };
65254      if (element.hasOccurred()) {
65255        composeType("occurred", element.getOccurred());
65256      }
65257      if (element.hasRecordedElement()) {
65258        composeInstantCore("recorded", element.getRecordedElement(), false);
65259        composeInstantExtras("recorded", element.getRecordedElement(), false);
65260      }
65261      if (element.hasPolicy()) {
65262        if (anyHasValue(element.getPolicy())) {
65263          openArray("policy");
65264          for (UriType e : element.getPolicy()) 
65265            composeUriCore(null, e, e != element.getPolicy().get(element.getPolicy().size()-1));
65266          closeArray();
65267        }
65268        if (anyHasExtras(element.getPolicy())) {
65269          openArray("_policy");
65270          for (UriType e : element.getPolicy()) 
65271            composeUriExtras(null, e, true);
65272          closeArray();
65273        }
65274      };
65275      if (element.hasLocation()) {
65276        composeReference("location", element.getLocation());
65277      }
65278      if (element.hasAuthorization()) {
65279        openArray("authorization");
65280        for (CodeableReference e : element.getAuthorization()) 
65281          composeCodeableReference(null, e);
65282        closeArray();
65283      };
65284      if (element.hasActivity()) {
65285        composeCodeableConcept("activity", element.getActivity());
65286      }
65287      if (element.hasBasedOn()) {
65288        openArray("basedOn");
65289        for (Reference e : element.getBasedOn()) 
65290          composeReference(null, e);
65291        closeArray();
65292      };
65293      if (element.hasPatient()) {
65294        composeReference("patient", element.getPatient());
65295      }
65296      if (element.hasEncounter()) {
65297        composeReference("encounter", element.getEncounter());
65298      }
65299      if (element.hasAgent()) {
65300        openArray("agent");
65301        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
65302          composeProvenanceAgentComponent(null, e);
65303        closeArray();
65304      };
65305      if (element.hasEntity()) {
65306        openArray("entity");
65307        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
65308          composeProvenanceEntityComponent(null, e);
65309        closeArray();
65310      };
65311      if (element.hasSignature()) {
65312        openArray("signature");
65313        for (Signature e : element.getSignature()) 
65314          composeSignature(null, e);
65315        closeArray();
65316      };
65317  }
65318
65319  protected void composeProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
65320    if (element != null) {
65321      open(name);
65322      composeProvenanceAgentComponentProperties(element);
65323      close();
65324    }
65325  }
65326
65327  protected void composeProvenanceAgentComponentProperties(Provenance.ProvenanceAgentComponent element) throws IOException {
65328    composeBackboneElementProperties(element);
65329      if (element.hasType()) {
65330        composeCodeableConcept("type", element.getType());
65331      }
65332      if (element.hasRole()) {
65333        openArray("role");
65334        for (CodeableConcept e : element.getRole()) 
65335          composeCodeableConcept(null, e);
65336        closeArray();
65337      };
65338      if (element.hasWho()) {
65339        composeReference("who", element.getWho());
65340      }
65341      if (element.hasOnBehalfOf()) {
65342        composeReference("onBehalfOf", element.getOnBehalfOf());
65343      }
65344  }
65345
65346  protected void composeProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
65347    if (element != null) {
65348      open(name);
65349      composeProvenanceEntityComponentProperties(element);
65350      close();
65351    }
65352  }
65353
65354  protected void composeProvenanceEntityComponentProperties(Provenance.ProvenanceEntityComponent element) throws IOException {
65355    composeBackboneElementProperties(element);
65356      if (element.hasRoleElement()) {
65357        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
65358        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
65359      }
65360      if (element.hasWhat()) {
65361        composeReference("what", element.getWhat());
65362      }
65363      if (element.hasAgent()) {
65364        openArray("agent");
65365        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
65366          composeProvenanceAgentComponent(null, e);
65367        closeArray();
65368      };
65369  }
65370
65371  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
65372    if (element != null) {
65373      prop("resourceType", name);
65374      composeQuestionnaireProperties(element);
65375    }
65376  }
65377
65378  protected void composeQuestionnaireProperties(Questionnaire element) throws IOException {
65379    composeMetadataResourceProperties(element);
65380      if (element.hasUrlElement()) {
65381        composeUriCore("url", element.getUrlElement(), false);
65382        composeUriExtras("url", element.getUrlElement(), false);
65383      }
65384      if (element.hasIdentifier()) {
65385        openArray("identifier");
65386        for (Identifier e : element.getIdentifier()) 
65387          composeIdentifier(null, e);
65388        closeArray();
65389      };
65390      if (element.hasVersionElement()) {
65391        composeStringCore("version", element.getVersionElement(), false);
65392        composeStringExtras("version", element.getVersionElement(), false);
65393      }
65394      if (element.hasVersionAlgorithm()) {
65395        composeType("versionAlgorithm", element.getVersionAlgorithm());
65396      }
65397      if (element.hasNameElement()) {
65398        composeStringCore("name", element.getNameElement(), false);
65399        composeStringExtras("name", element.getNameElement(), false);
65400      }
65401      if (element.hasTitleElement()) {
65402        composeStringCore("title", element.getTitleElement(), false);
65403        composeStringExtras("title", element.getTitleElement(), false);
65404      }
65405      if (element.hasDerivedFrom()) {
65406        if (anyHasValue(element.getDerivedFrom())) {
65407          openArray("derivedFrom");
65408          for (CanonicalType e : element.getDerivedFrom()) 
65409            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
65410          closeArray();
65411        }
65412        if (anyHasExtras(element.getDerivedFrom())) {
65413          openArray("_derivedFrom");
65414          for (CanonicalType e : element.getDerivedFrom()) 
65415            composeCanonicalExtras(null, e, true);
65416          closeArray();
65417        }
65418      };
65419      if (element.hasStatusElement()) {
65420        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
65421        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
65422      }
65423      if (element.hasExperimentalElement()) {
65424        composeBooleanCore("experimental", element.getExperimentalElement(), false);
65425        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
65426      }
65427      if (element.hasSubjectType()) {
65428        if (anyHasValue(element.getSubjectType())) {
65429          openArray("subjectType");
65430          for (CodeType e : element.getSubjectType()) 
65431            composeCodeCore(null, e, e != element.getSubjectType().get(element.getSubjectType().size()-1));
65432          closeArray();
65433        }
65434        if (anyHasExtras(element.getSubjectType())) {
65435          openArray("_subjectType");
65436          for (CodeType e : element.getSubjectType()) 
65437            composeCodeExtras(null, e, true);
65438          closeArray();
65439        }
65440      };
65441      if (element.hasDateElement()) {
65442        composeDateTimeCore("date", element.getDateElement(), false);
65443        composeDateTimeExtras("date", element.getDateElement(), false);
65444      }
65445      if (element.hasPublisherElement()) {
65446        composeStringCore("publisher", element.getPublisherElement(), false);
65447        composeStringExtras("publisher", element.getPublisherElement(), false);
65448      }
65449      if (element.hasContact()) {
65450        openArray("contact");
65451        for (ContactDetail e : element.getContact()) 
65452          composeContactDetail(null, e);
65453        closeArray();
65454      };
65455      if (element.hasDescriptionElement()) {
65456        composeMarkdownCore("description", element.getDescriptionElement(), false);
65457        composeMarkdownExtras("description", element.getDescriptionElement(), false);
65458      }
65459      if (element.hasUseContext()) {
65460        openArray("useContext");
65461        for (UsageContext e : element.getUseContext()) 
65462          composeUsageContext(null, e);
65463        closeArray();
65464      };
65465      if (element.hasJurisdiction()) {
65466        openArray("jurisdiction");
65467        for (CodeableConcept e : element.getJurisdiction()) 
65468          composeCodeableConcept(null, e);
65469        closeArray();
65470      };
65471      if (element.hasPurposeElement()) {
65472        composeMarkdownCore("purpose", element.getPurposeElement(), false);
65473        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
65474      }
65475      if (element.hasCopyrightElement()) {
65476        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
65477        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
65478      }
65479      if (element.hasCopyrightLabelElement()) {
65480        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
65481        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
65482      }
65483      if (element.hasApprovalDateElement()) {
65484        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
65485        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
65486      }
65487      if (element.hasLastReviewDateElement()) {
65488        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
65489        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
65490      }
65491      if (element.hasEffectivePeriod()) {
65492        composePeriod("effectivePeriod", element.getEffectivePeriod());
65493      }
65494      if (element.hasCode()) {
65495        openArray("code");
65496        for (Coding e : element.getCode()) 
65497          composeCoding(null, e);
65498        closeArray();
65499      };
65500      if (element.hasItem()) {
65501        openArray("item");
65502        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
65503          composeQuestionnaireItemComponent(null, e);
65504        closeArray();
65505      };
65506  }
65507
65508  protected void composeQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
65509    if (element != null) {
65510      open(name);
65511      composeQuestionnaireItemComponentProperties(element);
65512      close();
65513    }
65514  }
65515
65516  protected void composeQuestionnaireItemComponentProperties(Questionnaire.QuestionnaireItemComponent element) throws IOException {
65517    composeBackboneElementProperties(element);
65518      if (element.hasLinkIdElement()) {
65519        composeStringCore("linkId", element.getLinkIdElement(), false);
65520        composeStringExtras("linkId", element.getLinkIdElement(), false);
65521      }
65522      if (element.hasDefinitionElement()) {
65523        composeUriCore("definition", element.getDefinitionElement(), false);
65524        composeUriExtras("definition", element.getDefinitionElement(), false);
65525      }
65526      if (element.hasCode()) {
65527        openArray("code");
65528        for (Coding e : element.getCode()) 
65529          composeCoding(null, e);
65530        closeArray();
65531      };
65532      if (element.hasPrefixElement()) {
65533        composeStringCore("prefix", element.getPrefixElement(), false);
65534        composeStringExtras("prefix", element.getPrefixElement(), false);
65535      }
65536      if (element.hasTextElement()) {
65537        composeStringCore("text", element.getTextElement(), false);
65538        composeStringExtras("text", element.getTextElement(), false);
65539      }
65540      if (element.hasTypeElement()) {
65541        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
65542        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
65543      }
65544      if (element.hasEnableWhen()) {
65545        openArray("enableWhen");
65546        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
65547          composeQuestionnaireItemEnableWhenComponent(null, e);
65548        closeArray();
65549      };
65550      if (element.hasEnableBehaviorElement()) {
65551        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
65552        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
65553      }
65554      if (element.hasDisabledDisplayElement()) {
65555        composeEnumerationCore("disabledDisplay", element.getDisabledDisplayElement(), new Questionnaire.QuestionnaireItemDisabledDisplayEnumFactory(), false);
65556        composeEnumerationExtras("disabledDisplay", element.getDisabledDisplayElement(), new Questionnaire.QuestionnaireItemDisabledDisplayEnumFactory(), false);
65557      }
65558      if (element.hasRequiredElement()) {
65559        composeBooleanCore("required", element.getRequiredElement(), false);
65560        composeBooleanExtras("required", element.getRequiredElement(), false);
65561      }
65562      if (element.hasRepeatsElement()) {
65563        composeBooleanCore("repeats", element.getRepeatsElement(), false);
65564        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
65565      }
65566      if (element.hasReadOnlyElement()) {
65567        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
65568        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
65569      }
65570      if (element.hasMaxLengthElement()) {
65571        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
65572        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
65573      }
65574      if (element.hasAnswerConstraintElement()) {
65575        composeEnumerationCore("answerConstraint", element.getAnswerConstraintElement(), new Questionnaire.QuestionnaireAnswerConstraintEnumFactory(), false);
65576        composeEnumerationExtras("answerConstraint", element.getAnswerConstraintElement(), new Questionnaire.QuestionnaireAnswerConstraintEnumFactory(), false);
65577      }
65578      if (element.hasAnswerValueSetElement()) {
65579        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
65580        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
65581      }
65582      if (element.hasAnswerOption()) {
65583        openArray("answerOption");
65584        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
65585          composeQuestionnaireItemAnswerOptionComponent(null, e);
65586        closeArray();
65587      };
65588      if (element.hasInitial()) {
65589        openArray("initial");
65590        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
65591          composeQuestionnaireItemInitialComponent(null, e);
65592        closeArray();
65593      };
65594      if (element.hasItem()) {
65595        openArray("item");
65596        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
65597          composeQuestionnaireItemComponent(null, e);
65598        closeArray();
65599      };
65600  }
65601
65602  protected void composeQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
65603    if (element != null) {
65604      open(name);
65605      composeQuestionnaireItemEnableWhenComponentProperties(element);
65606      close();
65607    }
65608  }
65609
65610  protected void composeQuestionnaireItemEnableWhenComponentProperties(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
65611    composeBackboneElementProperties(element);
65612      if (element.hasQuestionElement()) {
65613        composeStringCore("question", element.getQuestionElement(), false);
65614        composeStringExtras("question", element.getQuestionElement(), false);
65615      }
65616      if (element.hasOperatorElement()) {
65617        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
65618        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
65619      }
65620      if (element.hasAnswer()) {
65621        composeType("answer", element.getAnswer());
65622      }
65623  }
65624
65625  protected void composeQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
65626    if (element != null) {
65627      open(name);
65628      composeQuestionnaireItemAnswerOptionComponentProperties(element);
65629      close();
65630    }
65631  }
65632
65633  protected void composeQuestionnaireItemAnswerOptionComponentProperties(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
65634    composeBackboneElementProperties(element);
65635      if (element.hasValue()) {
65636        composeType("value", element.getValue());
65637      }
65638      if (element.hasInitialSelectedElement()) {
65639        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
65640        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
65641      }
65642  }
65643
65644  protected void composeQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
65645    if (element != null) {
65646      open(name);
65647      composeQuestionnaireItemInitialComponentProperties(element);
65648      close();
65649    }
65650  }
65651
65652  protected void composeQuestionnaireItemInitialComponentProperties(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
65653    composeBackboneElementProperties(element);
65654      if (element.hasValue()) {
65655        composeType("value", element.getValue());
65656      }
65657  }
65658
65659  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
65660    if (element != null) {
65661      prop("resourceType", name);
65662      composeQuestionnaireResponseProperties(element);
65663    }
65664  }
65665
65666  protected void composeQuestionnaireResponseProperties(QuestionnaireResponse element) throws IOException {
65667    composeDomainResourceProperties(element);
65668      if (element.hasIdentifier()) {
65669        openArray("identifier");
65670        for (Identifier e : element.getIdentifier()) 
65671          composeIdentifier(null, e);
65672        closeArray();
65673      };
65674      if (element.hasBasedOn()) {
65675        openArray("basedOn");
65676        for (Reference e : element.getBasedOn()) 
65677          composeReference(null, e);
65678        closeArray();
65679      };
65680      if (element.hasPartOf()) {
65681        openArray("partOf");
65682        for (Reference e : element.getPartOf()) 
65683          composeReference(null, e);
65684        closeArray();
65685      };
65686      if (element.hasQuestionnaireElement()) {
65687        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
65688        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
65689      }
65690      if (element.hasStatusElement()) {
65691        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
65692        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
65693      }
65694      if (element.hasSubject()) {
65695        composeReference("subject", element.getSubject());
65696      }
65697      if (element.hasEncounter()) {
65698        composeReference("encounter", element.getEncounter());
65699      }
65700      if (element.hasAuthoredElement()) {
65701        composeDateTimeCore("authored", element.getAuthoredElement(), false);
65702        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
65703      }
65704      if (element.hasAuthor()) {
65705        composeReference("author", element.getAuthor());
65706      }
65707      if (element.hasSource()) {
65708        composeReference("source", element.getSource());
65709      }
65710      if (element.hasItem()) {
65711        openArray("item");
65712        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
65713          composeQuestionnaireResponseItemComponent(null, e);
65714        closeArray();
65715      };
65716  }
65717
65718  protected void composeQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
65719    if (element != null) {
65720      open(name);
65721      composeQuestionnaireResponseItemComponentProperties(element);
65722      close();
65723    }
65724  }
65725
65726  protected void composeQuestionnaireResponseItemComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
65727    composeBackboneElementProperties(element);
65728      if (element.hasLinkIdElement()) {
65729        composeStringCore("linkId", element.getLinkIdElement(), false);
65730        composeStringExtras("linkId", element.getLinkIdElement(), false);
65731      }
65732      if (element.hasDefinitionElement()) {
65733        composeUriCore("definition", element.getDefinitionElement(), false);
65734        composeUriExtras("definition", element.getDefinitionElement(), false);
65735      }
65736      if (element.hasTextElement()) {
65737        composeStringCore("text", element.getTextElement(), false);
65738        composeStringExtras("text", element.getTextElement(), false);
65739      }
65740      if (element.hasAnswer()) {
65741        openArray("answer");
65742        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
65743          composeQuestionnaireResponseItemAnswerComponent(null, e);
65744        closeArray();
65745      };
65746      if (element.hasItem()) {
65747        openArray("item");
65748        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
65749          composeQuestionnaireResponseItemComponent(null, e);
65750        closeArray();
65751      };
65752  }
65753
65754  protected void composeQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
65755    if (element != null) {
65756      open(name);
65757      composeQuestionnaireResponseItemAnswerComponentProperties(element);
65758      close();
65759    }
65760  }
65761
65762  protected void composeQuestionnaireResponseItemAnswerComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
65763    composeBackboneElementProperties(element);
65764      if (element.hasValue()) {
65765        composeType("value", element.getValue());
65766      }
65767      if (element.hasItem()) {
65768        openArray("item");
65769        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
65770          composeQuestionnaireResponseItemComponent(null, e);
65771        closeArray();
65772      };
65773  }
65774
65775  protected void composeRegulatedAuthorization(String name, RegulatedAuthorization element) throws IOException {
65776    if (element != null) {
65777      prop("resourceType", name);
65778      composeRegulatedAuthorizationProperties(element);
65779    }
65780  }
65781
65782  protected void composeRegulatedAuthorizationProperties(RegulatedAuthorization element) throws IOException {
65783    composeDomainResourceProperties(element);
65784      if (element.hasIdentifier()) {
65785        openArray("identifier");
65786        for (Identifier e : element.getIdentifier()) 
65787          composeIdentifier(null, e);
65788        closeArray();
65789      };
65790      if (element.hasSubject()) {
65791        openArray("subject");
65792        for (Reference e : element.getSubject()) 
65793          composeReference(null, e);
65794        closeArray();
65795      };
65796      if (element.hasType()) {
65797        composeCodeableConcept("type", element.getType());
65798      }
65799      if (element.hasDescriptionElement()) {
65800        composeMarkdownCore("description", element.getDescriptionElement(), false);
65801        composeMarkdownExtras("description", element.getDescriptionElement(), false);
65802      }
65803      if (element.hasRegion()) {
65804        openArray("region");
65805        for (CodeableConcept e : element.getRegion()) 
65806          composeCodeableConcept(null, e);
65807        closeArray();
65808      };
65809      if (element.hasStatus()) {
65810        composeCodeableConcept("status", element.getStatus());
65811      }
65812      if (element.hasStatusDateElement()) {
65813        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
65814        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
65815      }
65816      if (element.hasValidityPeriod()) {
65817        composePeriod("validityPeriod", element.getValidityPeriod());
65818      }
65819      if (element.hasIndication()) {
65820        openArray("indication");
65821        for (CodeableReference e : element.getIndication()) 
65822          composeCodeableReference(null, e);
65823        closeArray();
65824      };
65825      if (element.hasIntendedUse()) {
65826        composeCodeableConcept("intendedUse", element.getIntendedUse());
65827      }
65828      if (element.hasBasis()) {
65829        openArray("basis");
65830        for (CodeableConcept e : element.getBasis()) 
65831          composeCodeableConcept(null, e);
65832        closeArray();
65833      };
65834      if (element.hasHolder()) {
65835        composeReference("holder", element.getHolder());
65836      }
65837      if (element.hasRegulator()) {
65838        composeReference("regulator", element.getRegulator());
65839      }
65840      if (element.hasAttachedDocument()) {
65841        openArray("attachedDocument");
65842        for (Reference e : element.getAttachedDocument()) 
65843          composeReference(null, e);
65844        closeArray();
65845      };
65846      if (element.hasCase()) {
65847        composeRegulatedAuthorizationCaseComponent("case", element.getCase());
65848      }
65849  }
65850
65851  protected void composeRegulatedAuthorizationCaseComponent(String name, RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
65852    if (element != null) {
65853      open(name);
65854      composeRegulatedAuthorizationCaseComponentProperties(element);
65855      close();
65856    }
65857  }
65858
65859  protected void composeRegulatedAuthorizationCaseComponentProperties(RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
65860    composeBackboneElementProperties(element);
65861      if (element.hasIdentifier()) {
65862        composeIdentifier("identifier", element.getIdentifier());
65863      }
65864      if (element.hasType()) {
65865        composeCodeableConcept("type", element.getType());
65866      }
65867      if (element.hasStatus()) {
65868        composeCodeableConcept("status", element.getStatus());
65869      }
65870      if (element.hasDate()) {
65871        composeType("date", element.getDate());
65872      }
65873      if (element.hasApplication()) {
65874        openArray("application");
65875        for (RegulatedAuthorization.RegulatedAuthorizationCaseComponent e : element.getApplication()) 
65876          composeRegulatedAuthorizationCaseComponent(null, e);
65877        closeArray();
65878      };
65879  }
65880
65881  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
65882    if (element != null) {
65883      prop("resourceType", name);
65884      composeRelatedPersonProperties(element);
65885    }
65886  }
65887
65888  protected void composeRelatedPersonProperties(RelatedPerson element) throws IOException {
65889    composeDomainResourceProperties(element);
65890      if (element.hasIdentifier()) {
65891        openArray("identifier");
65892        for (Identifier e : element.getIdentifier()) 
65893          composeIdentifier(null, e);
65894        closeArray();
65895      };
65896      if (element.hasActiveElement()) {
65897        composeBooleanCore("active", element.getActiveElement(), false);
65898        composeBooleanExtras("active", element.getActiveElement(), false);
65899      }
65900      if (element.hasPatient()) {
65901        composeReference("patient", element.getPatient());
65902      }
65903      if (element.hasRelationship()) {
65904        openArray("relationship");
65905        for (CodeableConcept e : element.getRelationship()) 
65906          composeCodeableConcept(null, e);
65907        closeArray();
65908      };
65909      if (element.hasName()) {
65910        openArray("name");
65911        for (HumanName e : element.getName()) 
65912          composeHumanName(null, e);
65913        closeArray();
65914      };
65915      if (element.hasTelecom()) {
65916        openArray("telecom");
65917        for (ContactPoint e : element.getTelecom()) 
65918          composeContactPoint(null, e);
65919        closeArray();
65920      };
65921      if (element.hasGenderElement()) {
65922        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
65923        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
65924      }
65925      if (element.hasBirthDateElement()) {
65926        composeDateCore("birthDate", element.getBirthDateElement(), false);
65927        composeDateExtras("birthDate", element.getBirthDateElement(), false);
65928      }
65929      if (element.hasAddress()) {
65930        openArray("address");
65931        for (Address e : element.getAddress()) 
65932          composeAddress(null, e);
65933        closeArray();
65934      };
65935      if (element.hasPhoto()) {
65936        openArray("photo");
65937        for (Attachment e : element.getPhoto()) 
65938          composeAttachment(null, e);
65939        closeArray();
65940      };
65941      if (element.hasPeriod()) {
65942        composePeriod("period", element.getPeriod());
65943      }
65944      if (element.hasCommunication()) {
65945        openArray("communication");
65946        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
65947          composeRelatedPersonCommunicationComponent(null, e);
65948        closeArray();
65949      };
65950  }
65951
65952  protected void composeRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
65953    if (element != null) {
65954      open(name);
65955      composeRelatedPersonCommunicationComponentProperties(element);
65956      close();
65957    }
65958  }
65959
65960  protected void composeRelatedPersonCommunicationComponentProperties(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
65961    composeBackboneElementProperties(element);
65962      if (element.hasLanguage()) {
65963        composeCodeableConcept("language", element.getLanguage());
65964      }
65965      if (element.hasPreferredElement()) {
65966        composeBooleanCore("preferred", element.getPreferredElement(), false);
65967        composeBooleanExtras("preferred", element.getPreferredElement(), false);
65968      }
65969  }
65970
65971  protected void composeRequestOrchestration(String name, RequestOrchestration element) throws IOException {
65972    if (element != null) {
65973      prop("resourceType", name);
65974      composeRequestOrchestrationProperties(element);
65975    }
65976  }
65977
65978  protected void composeRequestOrchestrationProperties(RequestOrchestration element) throws IOException {
65979    composeDomainResourceProperties(element);
65980      if (element.hasIdentifier()) {
65981        openArray("identifier");
65982        for (Identifier e : element.getIdentifier()) 
65983          composeIdentifier(null, e);
65984        closeArray();
65985      };
65986      if (element.hasInstantiatesCanonical()) {
65987        if (anyHasValue(element.getInstantiatesCanonical())) {
65988          openArray("instantiatesCanonical");
65989          for (CanonicalType e : element.getInstantiatesCanonical()) 
65990            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
65991          closeArray();
65992        }
65993        if (anyHasExtras(element.getInstantiatesCanonical())) {
65994          openArray("_instantiatesCanonical");
65995          for (CanonicalType e : element.getInstantiatesCanonical()) 
65996            composeCanonicalExtras(null, e, true);
65997          closeArray();
65998        }
65999      };
66000      if (element.hasInstantiatesUri()) {
66001        if (anyHasValue(element.getInstantiatesUri())) {
66002          openArray("instantiatesUri");
66003          for (UriType e : element.getInstantiatesUri()) 
66004            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
66005          closeArray();
66006        }
66007        if (anyHasExtras(element.getInstantiatesUri())) {
66008          openArray("_instantiatesUri");
66009          for (UriType e : element.getInstantiatesUri()) 
66010            composeUriExtras(null, e, true);
66011          closeArray();
66012        }
66013      };
66014      if (element.hasBasedOn()) {
66015        openArray("basedOn");
66016        for (Reference e : element.getBasedOn()) 
66017          composeReference(null, e);
66018        closeArray();
66019      };
66020      if (element.hasReplaces()) {
66021        openArray("replaces");
66022        for (Reference e : element.getReplaces()) 
66023          composeReference(null, e);
66024        closeArray();
66025      };
66026      if (element.hasGroupIdentifier()) {
66027        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
66028      }
66029      if (element.hasStatusElement()) {
66030        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
66031        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
66032      }
66033      if (element.hasIntentElement()) {
66034        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
66035        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
66036      }
66037      if (element.hasPriorityElement()) {
66038        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66039        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66040      }
66041      if (element.hasCode()) {
66042        composeCodeableConcept("code", element.getCode());
66043      }
66044      if (element.hasSubject()) {
66045        composeReference("subject", element.getSubject());
66046      }
66047      if (element.hasEncounter()) {
66048        composeReference("encounter", element.getEncounter());
66049      }
66050      if (element.hasAuthoredOnElement()) {
66051        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
66052        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
66053      }
66054      if (element.hasAuthor()) {
66055        composeReference("author", element.getAuthor());
66056      }
66057      if (element.hasReason()) {
66058        openArray("reason");
66059        for (CodeableReference e : element.getReason()) 
66060          composeCodeableReference(null, e);
66061        closeArray();
66062      };
66063      if (element.hasGoal()) {
66064        openArray("goal");
66065        for (Reference e : element.getGoal()) 
66066          composeReference(null, e);
66067        closeArray();
66068      };
66069      if (element.hasNote()) {
66070        openArray("note");
66071        for (Annotation e : element.getNote()) 
66072          composeAnnotation(null, e);
66073        closeArray();
66074      };
66075      if (element.hasAction()) {
66076        openArray("action");
66077        for (RequestOrchestration.RequestOrchestrationActionComponent e : element.getAction()) 
66078          composeRequestOrchestrationActionComponent(null, e);
66079        closeArray();
66080      };
66081  }
66082
66083  protected void composeRequestOrchestrationActionComponent(String name, RequestOrchestration.RequestOrchestrationActionComponent element) throws IOException {
66084    if (element != null) {
66085      open(name);
66086      composeRequestOrchestrationActionComponentProperties(element);
66087      close();
66088    }
66089  }
66090
66091  protected void composeRequestOrchestrationActionComponentProperties(RequestOrchestration.RequestOrchestrationActionComponent element) throws IOException {
66092    composeBackboneElementProperties(element);
66093      if (element.hasLinkIdElement()) {
66094        composeStringCore("linkId", element.getLinkIdElement(), false);
66095        composeStringExtras("linkId", element.getLinkIdElement(), false);
66096      }
66097      if (element.hasPrefixElement()) {
66098        composeStringCore("prefix", element.getPrefixElement(), false);
66099        composeStringExtras("prefix", element.getPrefixElement(), false);
66100      }
66101      if (element.hasTitleElement()) {
66102        composeStringCore("title", element.getTitleElement(), false);
66103        composeStringExtras("title", element.getTitleElement(), false);
66104      }
66105      if (element.hasDescriptionElement()) {
66106        composeMarkdownCore("description", element.getDescriptionElement(), false);
66107        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66108      }
66109      if (element.hasTextEquivalentElement()) {
66110        composeMarkdownCore("textEquivalent", element.getTextEquivalentElement(), false);
66111        composeMarkdownExtras("textEquivalent", element.getTextEquivalentElement(), false);
66112      }
66113      if (element.hasPriorityElement()) {
66114        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66115        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66116      }
66117      if (element.hasCode()) {
66118        openArray("code");
66119        for (CodeableConcept e : element.getCode()) 
66120          composeCodeableConcept(null, e);
66121        closeArray();
66122      };
66123      if (element.hasDocumentation()) {
66124        openArray("documentation");
66125        for (RelatedArtifact e : element.getDocumentation()) 
66126          composeRelatedArtifact(null, e);
66127        closeArray();
66128      };
66129      if (element.hasGoal()) {
66130        openArray("goal");
66131        for (Reference e : element.getGoal()) 
66132          composeReference(null, e);
66133        closeArray();
66134      };
66135      if (element.hasCondition()) {
66136        openArray("condition");
66137        for (RequestOrchestration.RequestOrchestrationActionConditionComponent e : element.getCondition()) 
66138          composeRequestOrchestrationActionConditionComponent(null, e);
66139        closeArray();
66140      };
66141      if (element.hasInput()) {
66142        openArray("input");
66143        for (RequestOrchestration.RequestOrchestrationActionInputComponent e : element.getInput()) 
66144          composeRequestOrchestrationActionInputComponent(null, e);
66145        closeArray();
66146      };
66147      if (element.hasOutput()) {
66148        openArray("output");
66149        for (RequestOrchestration.RequestOrchestrationActionOutputComponent e : element.getOutput()) 
66150          composeRequestOrchestrationActionOutputComponent(null, e);
66151        closeArray();
66152      };
66153      if (element.hasRelatedAction()) {
66154        openArray("relatedAction");
66155        for (RequestOrchestration.RequestOrchestrationActionRelatedActionComponent e : element.getRelatedAction()) 
66156          composeRequestOrchestrationActionRelatedActionComponent(null, e);
66157        closeArray();
66158      };
66159      if (element.hasTiming()) {
66160        composeType("timing", element.getTiming());
66161      }
66162      if (element.hasLocation()) {
66163        composeCodeableReference("location", element.getLocation());
66164      }
66165      if (element.hasParticipant()) {
66166        openArray("participant");
66167        for (RequestOrchestration.RequestOrchestrationActionParticipantComponent e : element.getParticipant()) 
66168          composeRequestOrchestrationActionParticipantComponent(null, e);
66169        closeArray();
66170      };
66171      if (element.hasType()) {
66172        composeCodeableConcept("type", element.getType());
66173      }
66174      if (element.hasGroupingBehaviorElement()) {
66175        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
66176        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
66177      }
66178      if (element.hasSelectionBehaviorElement()) {
66179        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
66180        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
66181      }
66182      if (element.hasRequiredBehaviorElement()) {
66183        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
66184        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
66185      }
66186      if (element.hasPrecheckBehaviorElement()) {
66187        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
66188        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
66189      }
66190      if (element.hasCardinalityBehaviorElement()) {
66191        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
66192        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
66193      }
66194      if (element.hasResource()) {
66195        composeReference("resource", element.getResource());
66196      }
66197      if (element.hasDefinition()) {
66198        composeType("definition", element.getDefinition());
66199      }
66200      if (element.hasTransformElement()) {
66201        composeCanonicalCore("transform", element.getTransformElement(), false);
66202        composeCanonicalExtras("transform", element.getTransformElement(), false);
66203      }
66204      if (element.hasDynamicValue()) {
66205        openArray("dynamicValue");
66206        for (RequestOrchestration.RequestOrchestrationActionDynamicValueComponent e : element.getDynamicValue()) 
66207          composeRequestOrchestrationActionDynamicValueComponent(null, e);
66208        closeArray();
66209      };
66210      if (element.hasAction()) {
66211        openArray("action");
66212        for (RequestOrchestration.RequestOrchestrationActionComponent e : element.getAction()) 
66213          composeRequestOrchestrationActionComponent(null, e);
66214        closeArray();
66215      };
66216  }
66217
66218  protected void composeRequestOrchestrationActionConditionComponent(String name, RequestOrchestration.RequestOrchestrationActionConditionComponent element) throws IOException {
66219    if (element != null) {
66220      open(name);
66221      composeRequestOrchestrationActionConditionComponentProperties(element);
66222      close();
66223    }
66224  }
66225
66226  protected void composeRequestOrchestrationActionConditionComponentProperties(RequestOrchestration.RequestOrchestrationActionConditionComponent element) throws IOException {
66227    composeBackboneElementProperties(element);
66228      if (element.hasKindElement()) {
66229        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
66230        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
66231      }
66232      if (element.hasExpression()) {
66233        composeExpression("expression", element.getExpression());
66234      }
66235  }
66236
66237  protected void composeRequestOrchestrationActionInputComponent(String name, RequestOrchestration.RequestOrchestrationActionInputComponent element) throws IOException {
66238    if (element != null) {
66239      open(name);
66240      composeRequestOrchestrationActionInputComponentProperties(element);
66241      close();
66242    }
66243  }
66244
66245  protected void composeRequestOrchestrationActionInputComponentProperties(RequestOrchestration.RequestOrchestrationActionInputComponent element) throws IOException {
66246    composeBackboneElementProperties(element);
66247      if (element.hasTitleElement()) {
66248        composeStringCore("title", element.getTitleElement(), false);
66249        composeStringExtras("title", element.getTitleElement(), false);
66250      }
66251      if (element.hasRequirement()) {
66252        composeDataRequirement("requirement", element.getRequirement());
66253      }
66254      if (element.hasRelatedDataElement()) {
66255        composeIdCore("relatedData", element.getRelatedDataElement(), false);
66256        composeIdExtras("relatedData", element.getRelatedDataElement(), false);
66257      }
66258  }
66259
66260  protected void composeRequestOrchestrationActionOutputComponent(String name, RequestOrchestration.RequestOrchestrationActionOutputComponent element) throws IOException {
66261    if (element != null) {
66262      open(name);
66263      composeRequestOrchestrationActionOutputComponentProperties(element);
66264      close();
66265    }
66266  }
66267
66268  protected void composeRequestOrchestrationActionOutputComponentProperties(RequestOrchestration.RequestOrchestrationActionOutputComponent element) throws IOException {
66269    composeBackboneElementProperties(element);
66270      if (element.hasTitleElement()) {
66271        composeStringCore("title", element.getTitleElement(), false);
66272        composeStringExtras("title", element.getTitleElement(), false);
66273      }
66274      if (element.hasRequirement()) {
66275        composeDataRequirement("requirement", element.getRequirement());
66276      }
66277      if (element.hasRelatedDataElement()) {
66278        composeStringCore("relatedData", element.getRelatedDataElement(), false);
66279        composeStringExtras("relatedData", element.getRelatedDataElement(), false);
66280      }
66281  }
66282
66283  protected void composeRequestOrchestrationActionRelatedActionComponent(String name, RequestOrchestration.RequestOrchestrationActionRelatedActionComponent element) throws IOException {
66284    if (element != null) {
66285      open(name);
66286      composeRequestOrchestrationActionRelatedActionComponentProperties(element);
66287      close();
66288    }
66289  }
66290
66291  protected void composeRequestOrchestrationActionRelatedActionComponentProperties(RequestOrchestration.RequestOrchestrationActionRelatedActionComponent element) throws IOException {
66292    composeBackboneElementProperties(element);
66293      if (element.hasTargetIdElement()) {
66294        composeIdCore("targetId", element.getTargetIdElement(), false);
66295        composeIdExtras("targetId", element.getTargetIdElement(), false);
66296      }
66297      if (element.hasRelationshipElement()) {
66298        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66299        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66300      }
66301      if (element.hasEndRelationshipElement()) {
66302        composeEnumerationCore("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66303        composeEnumerationExtras("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66304      }
66305      if (element.hasOffset()) {
66306        composeType("offset", element.getOffset());
66307      }
66308  }
66309
66310  protected void composeRequestOrchestrationActionParticipantComponent(String name, RequestOrchestration.RequestOrchestrationActionParticipantComponent element) throws IOException {
66311    if (element != null) {
66312      open(name);
66313      composeRequestOrchestrationActionParticipantComponentProperties(element);
66314      close();
66315    }
66316  }
66317
66318  protected void composeRequestOrchestrationActionParticipantComponentProperties(RequestOrchestration.RequestOrchestrationActionParticipantComponent element) throws IOException {
66319    composeBackboneElementProperties(element);
66320      if (element.hasTypeElement()) {
66321        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
66322        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
66323      }
66324      if (element.hasTypeCanonicalElement()) {
66325        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
66326        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
66327      }
66328      if (element.hasTypeReference()) {
66329        composeReference("typeReference", element.getTypeReference());
66330      }
66331      if (element.hasRole()) {
66332        composeCodeableConcept("role", element.getRole());
66333      }
66334      if (element.hasFunction()) {
66335        composeCodeableConcept("function", element.getFunction());
66336      }
66337      if (element.hasActor()) {
66338        composeType("actor", element.getActor());
66339      }
66340  }
66341
66342  protected void composeRequestOrchestrationActionDynamicValueComponent(String name, RequestOrchestration.RequestOrchestrationActionDynamicValueComponent element) throws IOException {
66343    if (element != null) {
66344      open(name);
66345      composeRequestOrchestrationActionDynamicValueComponentProperties(element);
66346      close();
66347    }
66348  }
66349
66350  protected void composeRequestOrchestrationActionDynamicValueComponentProperties(RequestOrchestration.RequestOrchestrationActionDynamicValueComponent element) throws IOException {
66351    composeBackboneElementProperties(element);
66352      if (element.hasPathElement()) {
66353        composeStringCore("path", element.getPathElement(), false);
66354        composeStringExtras("path", element.getPathElement(), false);
66355      }
66356      if (element.hasExpression()) {
66357        composeExpression("expression", element.getExpression());
66358      }
66359  }
66360
66361  protected void composeRequirements(String name, Requirements element) throws IOException {
66362    if (element != null) {
66363      prop("resourceType", name);
66364      composeRequirementsProperties(element);
66365    }
66366  }
66367
66368  protected void composeRequirementsProperties(Requirements element) throws IOException {
66369    composeCanonicalResourceProperties(element);
66370      if (element.hasUrlElement()) {
66371        composeUriCore("url", element.getUrlElement(), false);
66372        composeUriExtras("url", element.getUrlElement(), false);
66373      }
66374      if (element.hasIdentifier()) {
66375        openArray("identifier");
66376        for (Identifier e : element.getIdentifier()) 
66377          composeIdentifier(null, e);
66378        closeArray();
66379      };
66380      if (element.hasVersionElement()) {
66381        composeStringCore("version", element.getVersionElement(), false);
66382        composeStringExtras("version", element.getVersionElement(), false);
66383      }
66384      if (element.hasVersionAlgorithm()) {
66385        composeType("versionAlgorithm", element.getVersionAlgorithm());
66386      }
66387      if (element.hasNameElement()) {
66388        composeStringCore("name", element.getNameElement(), false);
66389        composeStringExtras("name", element.getNameElement(), false);
66390      }
66391      if (element.hasTitleElement()) {
66392        composeStringCore("title", element.getTitleElement(), false);
66393        composeStringExtras("title", element.getTitleElement(), false);
66394      }
66395      if (element.hasStatusElement()) {
66396        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66397        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66398      }
66399      if (element.hasExperimentalElement()) {
66400        composeBooleanCore("experimental", element.getExperimentalElement(), false);
66401        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
66402      }
66403      if (element.hasDateElement()) {
66404        composeDateTimeCore("date", element.getDateElement(), false);
66405        composeDateTimeExtras("date", element.getDateElement(), false);
66406      }
66407      if (element.hasPublisherElement()) {
66408        composeStringCore("publisher", element.getPublisherElement(), false);
66409        composeStringExtras("publisher", element.getPublisherElement(), false);
66410      }
66411      if (element.hasContact()) {
66412        openArray("contact");
66413        for (ContactDetail e : element.getContact()) 
66414          composeContactDetail(null, e);
66415        closeArray();
66416      };
66417      if (element.hasDescriptionElement()) {
66418        composeMarkdownCore("description", element.getDescriptionElement(), false);
66419        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66420      }
66421      if (element.hasUseContext()) {
66422        openArray("useContext");
66423        for (UsageContext e : element.getUseContext()) 
66424          composeUsageContext(null, e);
66425        closeArray();
66426      };
66427      if (element.hasJurisdiction()) {
66428        openArray("jurisdiction");
66429        for (CodeableConcept e : element.getJurisdiction()) 
66430          composeCodeableConcept(null, e);
66431        closeArray();
66432      };
66433      if (element.hasPurposeElement()) {
66434        composeMarkdownCore("purpose", element.getPurposeElement(), false);
66435        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
66436      }
66437      if (element.hasCopyrightElement()) {
66438        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
66439        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
66440      }
66441      if (element.hasCopyrightLabelElement()) {
66442        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
66443        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
66444      }
66445      if (element.hasDerivedFrom()) {
66446        if (anyHasValue(element.getDerivedFrom())) {
66447          openArray("derivedFrom");
66448          for (CanonicalType e : element.getDerivedFrom()) 
66449            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
66450          closeArray();
66451        }
66452        if (anyHasExtras(element.getDerivedFrom())) {
66453          openArray("_derivedFrom");
66454          for (CanonicalType e : element.getDerivedFrom()) 
66455            composeCanonicalExtras(null, e, true);
66456          closeArray();
66457        }
66458      };
66459      if (element.hasReference()) {
66460        if (anyHasValue(element.getReference())) {
66461          openArray("reference");
66462          for (UrlType e : element.getReference()) 
66463            composeUrlCore(null, e, e != element.getReference().get(element.getReference().size()-1));
66464          closeArray();
66465        }
66466        if (anyHasExtras(element.getReference())) {
66467          openArray("_reference");
66468          for (UrlType e : element.getReference()) 
66469            composeUrlExtras(null, e, true);
66470          closeArray();
66471        }
66472      };
66473      if (element.hasActor()) {
66474        if (anyHasValue(element.getActor())) {
66475          openArray("actor");
66476          for (CanonicalType e : element.getActor()) 
66477            composeCanonicalCore(null, e, e != element.getActor().get(element.getActor().size()-1));
66478          closeArray();
66479        }
66480        if (anyHasExtras(element.getActor())) {
66481          openArray("_actor");
66482          for (CanonicalType e : element.getActor()) 
66483            composeCanonicalExtras(null, e, true);
66484          closeArray();
66485        }
66486      };
66487      if (element.hasStatement()) {
66488        openArray("statement");
66489        for (Requirements.RequirementsStatementComponent e : element.getStatement()) 
66490          composeRequirementsStatementComponent(null, e);
66491        closeArray();
66492      };
66493  }
66494
66495  protected void composeRequirementsStatementComponent(String name, Requirements.RequirementsStatementComponent element) throws IOException {
66496    if (element != null) {
66497      open(name);
66498      composeRequirementsStatementComponentProperties(element);
66499      close();
66500    }
66501  }
66502
66503  protected void composeRequirementsStatementComponentProperties(Requirements.RequirementsStatementComponent element) throws IOException {
66504    composeBackboneElementProperties(element);
66505      if (element.hasKeyElement()) {
66506        composeIdCore("key", element.getKeyElement(), false);
66507        composeIdExtras("key", element.getKeyElement(), false);
66508      }
66509      if (element.hasLabelElement()) {
66510        composeStringCore("label", element.getLabelElement(), false);
66511        composeStringExtras("label", element.getLabelElement(), false);
66512      }
66513      if (element.hasConformance()) {
66514        openArray("conformance");
66515        for (Enumeration<Requirements.ConformanceExpectation> e : element.getConformance()) 
66516          composeEnumerationCore(null, e, new Requirements.ConformanceExpectationEnumFactory(), true);
66517        closeArray();
66518        if (anyHasExtras(element.getConformance())) {
66519          openArray("_conformance");
66520          for (Enumeration<Requirements.ConformanceExpectation> e : element.getConformance()) 
66521            composeEnumerationExtras(null, e, new Requirements.ConformanceExpectationEnumFactory(), true);
66522          closeArray();
66523        }
66524      };
66525      if (element.hasConditionalityElement()) {
66526        composeBooleanCore("conditionality", element.getConditionalityElement(), false);
66527        composeBooleanExtras("conditionality", element.getConditionalityElement(), false);
66528      }
66529      if (element.hasRequirementElement()) {
66530        composeMarkdownCore("requirement", element.getRequirementElement(), false);
66531        composeMarkdownExtras("requirement", element.getRequirementElement(), false);
66532      }
66533      if (element.hasDerivedFromElement()) {
66534        composeStringCore("derivedFrom", element.getDerivedFromElement(), false);
66535        composeStringExtras("derivedFrom", element.getDerivedFromElement(), false);
66536      }
66537      if (element.hasParentElement()) {
66538        composeStringCore("parent", element.getParentElement(), false);
66539        composeStringExtras("parent", element.getParentElement(), false);
66540      }
66541      if (element.hasSatisfiedBy()) {
66542        if (anyHasValue(element.getSatisfiedBy())) {
66543          openArray("satisfiedBy");
66544          for (UrlType e : element.getSatisfiedBy()) 
66545            composeUrlCore(null, e, e != element.getSatisfiedBy().get(element.getSatisfiedBy().size()-1));
66546          closeArray();
66547        }
66548        if (anyHasExtras(element.getSatisfiedBy())) {
66549          openArray("_satisfiedBy");
66550          for (UrlType e : element.getSatisfiedBy()) 
66551            composeUrlExtras(null, e, true);
66552          closeArray();
66553        }
66554      };
66555      if (element.hasReference()) {
66556        if (anyHasValue(element.getReference())) {
66557          openArray("reference");
66558          for (UrlType e : element.getReference()) 
66559            composeUrlCore(null, e, e != element.getReference().get(element.getReference().size()-1));
66560          closeArray();
66561        }
66562        if (anyHasExtras(element.getReference())) {
66563          openArray("_reference");
66564          for (UrlType e : element.getReference()) 
66565            composeUrlExtras(null, e, true);
66566          closeArray();
66567        }
66568      };
66569      if (element.hasSource()) {
66570        openArray("source");
66571        for (Reference e : element.getSource()) 
66572          composeReference(null, e);
66573        closeArray();
66574      };
66575  }
66576
66577  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
66578    if (element != null) {
66579      prop("resourceType", name);
66580      composeResearchStudyProperties(element);
66581    }
66582  }
66583
66584  protected void composeResearchStudyProperties(ResearchStudy element) throws IOException {
66585    composeDomainResourceProperties(element);
66586      if (element.hasUrlElement()) {
66587        composeUriCore("url", element.getUrlElement(), false);
66588        composeUriExtras("url", element.getUrlElement(), false);
66589      }
66590      if (element.hasIdentifier()) {
66591        openArray("identifier");
66592        for (Identifier e : element.getIdentifier()) 
66593          composeIdentifier(null, e);
66594        closeArray();
66595      };
66596      if (element.hasVersionElement()) {
66597        composeStringCore("version", element.getVersionElement(), false);
66598        composeStringExtras("version", element.getVersionElement(), false);
66599      }
66600      if (element.hasNameElement()) {
66601        composeStringCore("name", element.getNameElement(), false);
66602        composeStringExtras("name", element.getNameElement(), false);
66603      }
66604      if (element.hasTitleElement()) {
66605        composeStringCore("title", element.getTitleElement(), false);
66606        composeStringExtras("title", element.getTitleElement(), false);
66607      }
66608      if (element.hasLabel()) {
66609        openArray("label");
66610        for (ResearchStudy.ResearchStudyLabelComponent e : element.getLabel()) 
66611          composeResearchStudyLabelComponent(null, e);
66612        closeArray();
66613      };
66614      if (element.hasProtocol()) {
66615        openArray("protocol");
66616        for (Reference e : element.getProtocol()) 
66617          composeReference(null, e);
66618        closeArray();
66619      };
66620      if (element.hasPartOf()) {
66621        openArray("partOf");
66622        for (Reference e : element.getPartOf()) 
66623          composeReference(null, e);
66624        closeArray();
66625      };
66626      if (element.hasRelatedArtifact()) {
66627        openArray("relatedArtifact");
66628        for (RelatedArtifact e : element.getRelatedArtifact()) 
66629          composeRelatedArtifact(null, e);
66630        closeArray();
66631      };
66632      if (element.hasDateElement()) {
66633        composeDateTimeCore("date", element.getDateElement(), false);
66634        composeDateTimeExtras("date", element.getDateElement(), false);
66635      }
66636      if (element.hasStatusElement()) {
66637        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66638        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66639      }
66640      if (element.hasPrimaryPurposeType()) {
66641        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
66642      }
66643      if (element.hasPhase()) {
66644        composeCodeableConcept("phase", element.getPhase());
66645      }
66646      if (element.hasStudyDesign()) {
66647        openArray("studyDesign");
66648        for (CodeableConcept e : element.getStudyDesign()) 
66649          composeCodeableConcept(null, e);
66650        closeArray();
66651      };
66652      if (element.hasFocus()) {
66653        openArray("focus");
66654        for (CodeableReference e : element.getFocus()) 
66655          composeCodeableReference(null, e);
66656        closeArray();
66657      };
66658      if (element.hasCondition()) {
66659        openArray("condition");
66660        for (CodeableConcept e : element.getCondition()) 
66661          composeCodeableConcept(null, e);
66662        closeArray();
66663      };
66664      if (element.hasKeyword()) {
66665        openArray("keyword");
66666        for (CodeableConcept e : element.getKeyword()) 
66667          composeCodeableConcept(null, e);
66668        closeArray();
66669      };
66670      if (element.hasRegion()) {
66671        openArray("region");
66672        for (CodeableConcept e : element.getRegion()) 
66673          composeCodeableConcept(null, e);
66674        closeArray();
66675      };
66676      if (element.hasDescriptionSummaryElement()) {
66677        composeMarkdownCore("descriptionSummary", element.getDescriptionSummaryElement(), false);
66678        composeMarkdownExtras("descriptionSummary", element.getDescriptionSummaryElement(), false);
66679      }
66680      if (element.hasDescriptionElement()) {
66681        composeMarkdownCore("description", element.getDescriptionElement(), false);
66682        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66683      }
66684      if (element.hasPeriod()) {
66685        composePeriod("period", element.getPeriod());
66686      }
66687      if (element.hasSite()) {
66688        openArray("site");
66689        for (Reference e : element.getSite()) 
66690          composeReference(null, e);
66691        closeArray();
66692      };
66693      if (element.hasNote()) {
66694        openArray("note");
66695        for (Annotation e : element.getNote()) 
66696          composeAnnotation(null, e);
66697        closeArray();
66698      };
66699      if (element.hasClassifier()) {
66700        openArray("classifier");
66701        for (CodeableConcept e : element.getClassifier()) 
66702          composeCodeableConcept(null, e);
66703        closeArray();
66704      };
66705      if (element.hasAssociatedParty()) {
66706        openArray("associatedParty");
66707        for (ResearchStudy.ResearchStudyAssociatedPartyComponent e : element.getAssociatedParty()) 
66708          composeResearchStudyAssociatedPartyComponent(null, e);
66709        closeArray();
66710      };
66711      if (element.hasProgressStatus()) {
66712        openArray("progressStatus");
66713        for (ResearchStudy.ResearchStudyProgressStatusComponent e : element.getProgressStatus()) 
66714          composeResearchStudyProgressStatusComponent(null, e);
66715        closeArray();
66716      };
66717      if (element.hasWhyStopped()) {
66718        composeCodeableConcept("whyStopped", element.getWhyStopped());
66719      }
66720      if (element.hasRecruitment()) {
66721        composeResearchStudyRecruitmentComponent("recruitment", element.getRecruitment());
66722      }
66723      if (element.hasComparisonGroup()) {
66724        openArray("comparisonGroup");
66725        for (ResearchStudy.ResearchStudyComparisonGroupComponent e : element.getComparisonGroup()) 
66726          composeResearchStudyComparisonGroupComponent(null, e);
66727        closeArray();
66728      };
66729      if (element.hasObjective()) {
66730        openArray("objective");
66731        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
66732          composeResearchStudyObjectiveComponent(null, e);
66733        closeArray();
66734      };
66735      if (element.hasOutcomeMeasure()) {
66736        openArray("outcomeMeasure");
66737        for (ResearchStudy.ResearchStudyOutcomeMeasureComponent e : element.getOutcomeMeasure()) 
66738          composeResearchStudyOutcomeMeasureComponent(null, e);
66739        closeArray();
66740      };
66741      if (element.hasResult()) {
66742        openArray("result");
66743        for (Reference e : element.getResult()) 
66744          composeReference(null, e);
66745        closeArray();
66746      };
66747  }
66748
66749  protected void composeResearchStudyLabelComponent(String name, ResearchStudy.ResearchStudyLabelComponent element) throws IOException {
66750    if (element != null) {
66751      open(name);
66752      composeResearchStudyLabelComponentProperties(element);
66753      close();
66754    }
66755  }
66756
66757  protected void composeResearchStudyLabelComponentProperties(ResearchStudy.ResearchStudyLabelComponent element) throws IOException {
66758    composeBackboneElementProperties(element);
66759      if (element.hasType()) {
66760        composeCodeableConcept("type", element.getType());
66761      }
66762      if (element.hasValueElement()) {
66763        composeStringCore("value", element.getValueElement(), false);
66764        composeStringExtras("value", element.getValueElement(), false);
66765      }
66766  }
66767
66768  protected void composeResearchStudyAssociatedPartyComponent(String name, ResearchStudy.ResearchStudyAssociatedPartyComponent element) throws IOException {
66769    if (element != null) {
66770      open(name);
66771      composeResearchStudyAssociatedPartyComponentProperties(element);
66772      close();
66773    }
66774  }
66775
66776  protected void composeResearchStudyAssociatedPartyComponentProperties(ResearchStudy.ResearchStudyAssociatedPartyComponent element) throws IOException {
66777    composeBackboneElementProperties(element);
66778      if (element.hasNameElement()) {
66779        composeStringCore("name", element.getNameElement(), false);
66780        composeStringExtras("name", element.getNameElement(), false);
66781      }
66782      if (element.hasRole()) {
66783        composeCodeableConcept("role", element.getRole());
66784      }
66785      if (element.hasPeriod()) {
66786        openArray("period");
66787        for (Period e : element.getPeriod()) 
66788          composePeriod(null, e);
66789        closeArray();
66790      };
66791      if (element.hasClassifier()) {
66792        openArray("classifier");
66793        for (CodeableConcept e : element.getClassifier()) 
66794          composeCodeableConcept(null, e);
66795        closeArray();
66796      };
66797      if (element.hasParty()) {
66798        composeReference("party", element.getParty());
66799      }
66800  }
66801
66802  protected void composeResearchStudyProgressStatusComponent(String name, ResearchStudy.ResearchStudyProgressStatusComponent element) throws IOException {
66803    if (element != null) {
66804      open(name);
66805      composeResearchStudyProgressStatusComponentProperties(element);
66806      close();
66807    }
66808  }
66809
66810  protected void composeResearchStudyProgressStatusComponentProperties(ResearchStudy.ResearchStudyProgressStatusComponent element) throws IOException {
66811    composeBackboneElementProperties(element);
66812      if (element.hasState()) {
66813        composeCodeableConcept("state", element.getState());
66814      }
66815      if (element.hasActualElement()) {
66816        composeBooleanCore("actual", element.getActualElement(), false);
66817        composeBooleanExtras("actual", element.getActualElement(), false);
66818      }
66819      if (element.hasPeriod()) {
66820        composePeriod("period", element.getPeriod());
66821      }
66822  }
66823
66824  protected void composeResearchStudyRecruitmentComponent(String name, ResearchStudy.ResearchStudyRecruitmentComponent element) throws IOException {
66825    if (element != null) {
66826      open(name);
66827      composeResearchStudyRecruitmentComponentProperties(element);
66828      close();
66829    }
66830  }
66831
66832  protected void composeResearchStudyRecruitmentComponentProperties(ResearchStudy.ResearchStudyRecruitmentComponent element) throws IOException {
66833    composeBackboneElementProperties(element);
66834      if (element.hasTargetNumberElement()) {
66835        composeUnsignedIntCore("targetNumber", element.getTargetNumberElement(), false);
66836        composeUnsignedIntExtras("targetNumber", element.getTargetNumberElement(), false);
66837      }
66838      if (element.hasActualNumberElement()) {
66839        composeUnsignedIntCore("actualNumber", element.getActualNumberElement(), false);
66840        composeUnsignedIntExtras("actualNumber", element.getActualNumberElement(), false);
66841      }
66842      if (element.hasEligibility()) {
66843        composeReference("eligibility", element.getEligibility());
66844      }
66845      if (element.hasActualGroup()) {
66846        composeReference("actualGroup", element.getActualGroup());
66847      }
66848  }
66849
66850  protected void composeResearchStudyComparisonGroupComponent(String name, ResearchStudy.ResearchStudyComparisonGroupComponent element) throws IOException {
66851    if (element != null) {
66852      open(name);
66853      composeResearchStudyComparisonGroupComponentProperties(element);
66854      close();
66855    }
66856  }
66857
66858  protected void composeResearchStudyComparisonGroupComponentProperties(ResearchStudy.ResearchStudyComparisonGroupComponent element) throws IOException {
66859    composeBackboneElementProperties(element);
66860      if (element.hasLinkIdElement()) {
66861        composeIdCore("linkId", element.getLinkIdElement(), false);
66862        composeIdExtras("linkId", element.getLinkIdElement(), false);
66863      }
66864      if (element.hasNameElement()) {
66865        composeStringCore("name", element.getNameElement(), false);
66866        composeStringExtras("name", element.getNameElement(), false);
66867      }
66868      if (element.hasType()) {
66869        composeCodeableConcept("type", element.getType());
66870      }
66871      if (element.hasDescriptionElement()) {
66872        composeMarkdownCore("description", element.getDescriptionElement(), false);
66873        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66874      }
66875      if (element.hasIntendedExposure()) {
66876        openArray("intendedExposure");
66877        for (Reference e : element.getIntendedExposure()) 
66878          composeReference(null, e);
66879        closeArray();
66880      };
66881      if (element.hasObservedGroup()) {
66882        composeReference("observedGroup", element.getObservedGroup());
66883      }
66884  }
66885
66886  protected void composeResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
66887    if (element != null) {
66888      open(name);
66889      composeResearchStudyObjectiveComponentProperties(element);
66890      close();
66891    }
66892  }
66893
66894  protected void composeResearchStudyObjectiveComponentProperties(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
66895    composeBackboneElementProperties(element);
66896      if (element.hasNameElement()) {
66897        composeStringCore("name", element.getNameElement(), false);
66898        composeStringExtras("name", element.getNameElement(), false);
66899      }
66900      if (element.hasType()) {
66901        composeCodeableConcept("type", element.getType());
66902      }
66903      if (element.hasDescriptionElement()) {
66904        composeMarkdownCore("description", element.getDescriptionElement(), false);
66905        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66906      }
66907  }
66908
66909  protected void composeResearchStudyOutcomeMeasureComponent(String name, ResearchStudy.ResearchStudyOutcomeMeasureComponent element) throws IOException {
66910    if (element != null) {
66911      open(name);
66912      composeResearchStudyOutcomeMeasureComponentProperties(element);
66913      close();
66914    }
66915  }
66916
66917  protected void composeResearchStudyOutcomeMeasureComponentProperties(ResearchStudy.ResearchStudyOutcomeMeasureComponent element) throws IOException {
66918    composeBackboneElementProperties(element);
66919      if (element.hasNameElement()) {
66920        composeStringCore("name", element.getNameElement(), false);
66921        composeStringExtras("name", element.getNameElement(), false);
66922      }
66923      if (element.hasType()) {
66924        openArray("type");
66925        for (CodeableConcept e : element.getType()) 
66926          composeCodeableConcept(null, e);
66927        closeArray();
66928      };
66929      if (element.hasDescriptionElement()) {
66930        composeMarkdownCore("description", element.getDescriptionElement(), false);
66931        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66932      }
66933      if (element.hasReference()) {
66934        composeReference("reference", element.getReference());
66935      }
66936  }
66937
66938  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
66939    if (element != null) {
66940      prop("resourceType", name);
66941      composeResearchSubjectProperties(element);
66942    }
66943  }
66944
66945  protected void composeResearchSubjectProperties(ResearchSubject element) throws IOException {
66946    composeDomainResourceProperties(element);
66947      if (element.hasIdentifier()) {
66948        openArray("identifier");
66949        for (Identifier e : element.getIdentifier()) 
66950          composeIdentifier(null, e);
66951        closeArray();
66952      };
66953      if (element.hasStatusElement()) {
66954        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66955        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66956      }
66957      if (element.hasProgress()) {
66958        openArray("progress");
66959        for (ResearchSubject.ResearchSubjectProgressComponent e : element.getProgress()) 
66960          composeResearchSubjectProgressComponent(null, e);
66961        closeArray();
66962      };
66963      if (element.hasPeriod()) {
66964        composePeriod("period", element.getPeriod());
66965      }
66966      if (element.hasStudy()) {
66967        composeReference("study", element.getStudy());
66968      }
66969      if (element.hasSubject()) {
66970        composeReference("subject", element.getSubject());
66971      }
66972      if (element.hasAssignedComparisonGroupElement()) {
66973        composeIdCore("assignedComparisonGroup", element.getAssignedComparisonGroupElement(), false);
66974        composeIdExtras("assignedComparisonGroup", element.getAssignedComparisonGroupElement(), false);
66975      }
66976      if (element.hasActualComparisonGroupElement()) {
66977        composeIdCore("actualComparisonGroup", element.getActualComparisonGroupElement(), false);
66978        composeIdExtras("actualComparisonGroup", element.getActualComparisonGroupElement(), false);
66979      }
66980      if (element.hasConsent()) {
66981        openArray("consent");
66982        for (Reference e : element.getConsent()) 
66983          composeReference(null, e);
66984        closeArray();
66985      };
66986  }
66987
66988  protected void composeResearchSubjectProgressComponent(String name, ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
66989    if (element != null) {
66990      open(name);
66991      composeResearchSubjectProgressComponentProperties(element);
66992      close();
66993    }
66994  }
66995
66996  protected void composeResearchSubjectProgressComponentProperties(ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
66997    composeBackboneElementProperties(element);
66998      if (element.hasType()) {
66999        composeCodeableConcept("type", element.getType());
67000      }
67001      if (element.hasSubjectState()) {
67002        composeCodeableConcept("subjectState", element.getSubjectState());
67003      }
67004      if (element.hasMilestone()) {
67005        composeCodeableConcept("milestone", element.getMilestone());
67006      }
67007      if (element.hasReason()) {
67008        composeCodeableConcept("reason", element.getReason());
67009      }
67010      if (element.hasStartDateElement()) {
67011        composeDateTimeCore("startDate", element.getStartDateElement(), false);
67012        composeDateTimeExtras("startDate", element.getStartDateElement(), false);
67013      }
67014      if (element.hasEndDateElement()) {
67015        composeDateTimeCore("endDate", element.getEndDateElement(), false);
67016        composeDateTimeExtras("endDate", element.getEndDateElement(), false);
67017      }
67018  }
67019
67020  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
67021    if (element != null) {
67022      prop("resourceType", name);
67023      composeRiskAssessmentProperties(element);
67024    }
67025  }
67026
67027  protected void composeRiskAssessmentProperties(RiskAssessment element) throws IOException {
67028    composeDomainResourceProperties(element);
67029      if (element.hasIdentifier()) {
67030        openArray("identifier");
67031        for (Identifier e : element.getIdentifier()) 
67032          composeIdentifier(null, e);
67033        closeArray();
67034      };
67035      if (element.hasBasedOn()) {
67036        composeReference("basedOn", element.getBasedOn());
67037      }
67038      if (element.hasParent()) {
67039        composeReference("parent", element.getParent());
67040      }
67041      if (element.hasStatusElement()) {
67042        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
67043        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
67044      }
67045      if (element.hasMethod()) {
67046        composeCodeableConcept("method", element.getMethod());
67047      }
67048      if (element.hasCode()) {
67049        composeCodeableConcept("code", element.getCode());
67050      }
67051      if (element.hasSubject()) {
67052        composeReference("subject", element.getSubject());
67053      }
67054      if (element.hasEncounter()) {
67055        composeReference("encounter", element.getEncounter());
67056      }
67057      if (element.hasOccurrence()) {
67058        composeType("occurrence", element.getOccurrence());
67059      }
67060      if (element.hasCondition()) {
67061        composeReference("condition", element.getCondition());
67062      }
67063      if (element.hasPerformer()) {
67064        composeReference("performer", element.getPerformer());
67065      }
67066      if (element.hasReason()) {
67067        openArray("reason");
67068        for (CodeableReference e : element.getReason()) 
67069          composeCodeableReference(null, e);
67070        closeArray();
67071      };
67072      if (element.hasBasis()) {
67073        openArray("basis");
67074        for (Reference e : element.getBasis()) 
67075          composeReference(null, e);
67076        closeArray();
67077      };
67078      if (element.hasPrediction()) {
67079        openArray("prediction");
67080        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
67081          composeRiskAssessmentPredictionComponent(null, e);
67082        closeArray();
67083      };
67084      if (element.hasMitigationElement()) {
67085        composeStringCore("mitigation", element.getMitigationElement(), false);
67086        composeStringExtras("mitigation", element.getMitigationElement(), false);
67087      }
67088      if (element.hasNote()) {
67089        openArray("note");
67090        for (Annotation e : element.getNote()) 
67091          composeAnnotation(null, e);
67092        closeArray();
67093      };
67094  }
67095
67096  protected void composeRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
67097    if (element != null) {
67098      open(name);
67099      composeRiskAssessmentPredictionComponentProperties(element);
67100      close();
67101    }
67102  }
67103
67104  protected void composeRiskAssessmentPredictionComponentProperties(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
67105    composeBackboneElementProperties(element);
67106      if (element.hasOutcome()) {
67107        composeCodeableConcept("outcome", element.getOutcome());
67108      }
67109      if (element.hasProbability()) {
67110        composeType("probability", element.getProbability());
67111      }
67112      if (element.hasQualitativeRisk()) {
67113        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
67114      }
67115      if (element.hasRelativeRiskElement()) {
67116        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
67117        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
67118      }
67119      if (element.hasWhen()) {
67120        composeType("when", element.getWhen());
67121      }
67122      if (element.hasRationaleElement()) {
67123        composeStringCore("rationale", element.getRationaleElement(), false);
67124        composeStringExtras("rationale", element.getRationaleElement(), false);
67125      }
67126  }
67127
67128  protected void composeSchedule(String name, Schedule element) throws IOException {
67129    if (element != null) {
67130      prop("resourceType", name);
67131      composeScheduleProperties(element);
67132    }
67133  }
67134
67135  protected void composeScheduleProperties(Schedule element) throws IOException {
67136    composeDomainResourceProperties(element);
67137      if (element.hasIdentifier()) {
67138        openArray("identifier");
67139        for (Identifier e : element.getIdentifier()) 
67140          composeIdentifier(null, e);
67141        closeArray();
67142      };
67143      if (element.hasActiveElement()) {
67144        composeBooleanCore("active", element.getActiveElement(), false);
67145        composeBooleanExtras("active", element.getActiveElement(), false);
67146      }
67147      if (element.hasServiceCategory()) {
67148        openArray("serviceCategory");
67149        for (CodeableConcept e : element.getServiceCategory()) 
67150          composeCodeableConcept(null, e);
67151        closeArray();
67152      };
67153      if (element.hasServiceType()) {
67154        openArray("serviceType");
67155        for (CodeableReference e : element.getServiceType()) 
67156          composeCodeableReference(null, e);
67157        closeArray();
67158      };
67159      if (element.hasSpecialty()) {
67160        openArray("specialty");
67161        for (CodeableConcept e : element.getSpecialty()) 
67162          composeCodeableConcept(null, e);
67163        closeArray();
67164      };
67165      if (element.hasNameElement()) {
67166        composeStringCore("name", element.getNameElement(), false);
67167        composeStringExtras("name", element.getNameElement(), false);
67168      }
67169      if (element.hasActor()) {
67170        openArray("actor");
67171        for (Reference e : element.getActor()) 
67172          composeReference(null, e);
67173        closeArray();
67174      };
67175      if (element.hasPlanningHorizon()) {
67176        composePeriod("planningHorizon", element.getPlanningHorizon());
67177      }
67178      if (element.hasCommentElement()) {
67179        composeMarkdownCore("comment", element.getCommentElement(), false);
67180        composeMarkdownExtras("comment", element.getCommentElement(), false);
67181      }
67182  }
67183
67184  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
67185    if (element != null) {
67186      prop("resourceType", name);
67187      composeSearchParameterProperties(element);
67188    }
67189  }
67190
67191  protected void composeSearchParameterProperties(SearchParameter element) throws IOException {
67192    composeCanonicalResourceProperties(element);
67193      if (element.hasUrlElement()) {
67194        composeUriCore("url", element.getUrlElement(), false);
67195        composeUriExtras("url", element.getUrlElement(), false);
67196      }
67197      if (element.hasIdentifier()) {
67198        openArray("identifier");
67199        for (Identifier e : element.getIdentifier()) 
67200          composeIdentifier(null, e);
67201        closeArray();
67202      };
67203      if (element.hasVersionElement()) {
67204        composeStringCore("version", element.getVersionElement(), false);
67205        composeStringExtras("version", element.getVersionElement(), false);
67206      }
67207      if (element.hasVersionAlgorithm()) {
67208        composeType("versionAlgorithm", element.getVersionAlgorithm());
67209      }
67210      if (element.hasNameElement()) {
67211        composeStringCore("name", element.getNameElement(), false);
67212        composeStringExtras("name", element.getNameElement(), false);
67213      }
67214      if (element.hasTitleElement()) {
67215        composeStringCore("title", element.getTitleElement(), false);
67216        composeStringExtras("title", element.getTitleElement(), false);
67217      }
67218      if (element.hasDerivedFromElement()) {
67219        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
67220        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
67221      }
67222      if (element.hasStatusElement()) {
67223        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67224        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67225      }
67226      if (element.hasExperimentalElement()) {
67227        composeBooleanCore("experimental", element.getExperimentalElement(), false);
67228        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
67229      }
67230      if (element.hasDateElement()) {
67231        composeDateTimeCore("date", element.getDateElement(), false);
67232        composeDateTimeExtras("date", element.getDateElement(), false);
67233      }
67234      if (element.hasPublisherElement()) {
67235        composeStringCore("publisher", element.getPublisherElement(), false);
67236        composeStringExtras("publisher", element.getPublisherElement(), false);
67237      }
67238      if (element.hasContact()) {
67239        openArray("contact");
67240        for (ContactDetail e : element.getContact()) 
67241          composeContactDetail(null, e);
67242        closeArray();
67243      };
67244      if (element.hasDescriptionElement()) {
67245        composeMarkdownCore("description", element.getDescriptionElement(), false);
67246        composeMarkdownExtras("description", element.getDescriptionElement(), false);
67247      }
67248      if (element.hasUseContext()) {
67249        openArray("useContext");
67250        for (UsageContext e : element.getUseContext()) 
67251          composeUsageContext(null, e);
67252        closeArray();
67253      };
67254      if (element.hasJurisdiction()) {
67255        openArray("jurisdiction");
67256        for (CodeableConcept e : element.getJurisdiction()) 
67257          composeCodeableConcept(null, e);
67258        closeArray();
67259      };
67260      if (element.hasPurposeElement()) {
67261        composeMarkdownCore("purpose", element.getPurposeElement(), false);
67262        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
67263      }
67264      if (element.hasCopyrightElement()) {
67265        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
67266        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
67267      }
67268      if (element.hasCopyrightLabelElement()) {
67269        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
67270        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
67271      }
67272      if (element.hasCodeElement()) {
67273        composeCodeCore("code", element.getCodeElement(), false);
67274        composeCodeExtras("code", element.getCodeElement(), false);
67275      }
67276      if (element.hasBase()) {
67277        openArray("base");
67278        for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getBase()) 
67279          composeEnumerationCore(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67280        closeArray();
67281        if (anyHasExtras(element.getBase())) {
67282          openArray("_base");
67283          for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getBase()) 
67284            composeEnumerationExtras(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67285          closeArray();
67286        }
67287      };
67288      if (element.hasTypeElement()) {
67289        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
67290        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
67291      }
67292      if (element.hasExpressionElement()) {
67293        composeStringCore("expression", element.getExpressionElement(), false);
67294        composeStringExtras("expression", element.getExpressionElement(), false);
67295      }
67296      if (element.hasProcessingModeElement()) {
67297        composeEnumerationCore("processingMode", element.getProcessingModeElement(), new SearchParameter.SearchProcessingModeTypeEnumFactory(), false);
67298        composeEnumerationExtras("processingMode", element.getProcessingModeElement(), new SearchParameter.SearchProcessingModeTypeEnumFactory(), false);
67299      }
67300      if (element.hasConstraintElement()) {
67301        composeStringCore("constraint", element.getConstraintElement(), false);
67302        composeStringExtras("constraint", element.getConstraintElement(), false);
67303      }
67304      if (element.hasTarget()) {
67305        openArray("target");
67306        for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getTarget()) 
67307          composeEnumerationCore(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67308        closeArray();
67309        if (anyHasExtras(element.getTarget())) {
67310          openArray("_target");
67311          for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getTarget()) 
67312            composeEnumerationExtras(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67313          closeArray();
67314        }
67315      };
67316      if (element.hasMultipleOrElement()) {
67317        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
67318        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
67319      }
67320      if (element.hasMultipleAndElement()) {
67321        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
67322        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
67323      }
67324      if (element.hasComparator()) {
67325        openArray("comparator");
67326        for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
67327          composeEnumerationCore(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
67328        closeArray();
67329        if (anyHasExtras(element.getComparator())) {
67330          openArray("_comparator");
67331          for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
67332            composeEnumerationExtras(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
67333          closeArray();
67334        }
67335      };
67336      if (element.hasModifier()) {
67337        openArray("modifier");
67338        for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
67339          composeEnumerationCore(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
67340        closeArray();
67341        if (anyHasExtras(element.getModifier())) {
67342          openArray("_modifier");
67343          for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
67344            composeEnumerationExtras(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
67345          closeArray();
67346        }
67347      };
67348      if (element.hasChain()) {
67349        if (anyHasValue(element.getChain())) {
67350          openArray("chain");
67351          for (StringType e : element.getChain()) 
67352            composeStringCore(null, e, e != element.getChain().get(element.getChain().size()-1));
67353          closeArray();
67354        }
67355        if (anyHasExtras(element.getChain())) {
67356          openArray("_chain");
67357          for (StringType e : element.getChain()) 
67358            composeStringExtras(null, e, true);
67359          closeArray();
67360        }
67361      };
67362      if (element.hasComponent()) {
67363        openArray("component");
67364        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
67365          composeSearchParameterComponentComponent(null, e);
67366        closeArray();
67367      };
67368  }
67369
67370  protected void composeSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
67371    if (element != null) {
67372      open(name);
67373      composeSearchParameterComponentComponentProperties(element);
67374      close();
67375    }
67376  }
67377
67378  protected void composeSearchParameterComponentComponentProperties(SearchParameter.SearchParameterComponentComponent element) throws IOException {
67379    composeBackboneElementProperties(element);
67380      if (element.hasDefinitionElement()) {
67381        composeCanonicalCore("definition", element.getDefinitionElement(), false);
67382        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
67383      }
67384      if (element.hasExpressionElement()) {
67385        composeStringCore("expression", element.getExpressionElement(), false);
67386        composeStringExtras("expression", element.getExpressionElement(), false);
67387      }
67388  }
67389
67390  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
67391    if (element != null) {
67392      prop("resourceType", name);
67393      composeServiceRequestProperties(element);
67394    }
67395  }
67396
67397  protected void composeServiceRequestProperties(ServiceRequest element) throws IOException {
67398    composeDomainResourceProperties(element);
67399      if (element.hasIdentifier()) {
67400        openArray("identifier");
67401        for (Identifier e : element.getIdentifier()) 
67402          composeIdentifier(null, e);
67403        closeArray();
67404      };
67405      if (element.hasInstantiatesCanonical()) {
67406        if (anyHasValue(element.getInstantiatesCanonical())) {
67407          openArray("instantiatesCanonical");
67408          for (CanonicalType e : element.getInstantiatesCanonical()) 
67409            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
67410          closeArray();
67411        }
67412        if (anyHasExtras(element.getInstantiatesCanonical())) {
67413          openArray("_instantiatesCanonical");
67414          for (CanonicalType e : element.getInstantiatesCanonical()) 
67415            composeCanonicalExtras(null, e, true);
67416          closeArray();
67417        }
67418      };
67419      if (element.hasInstantiatesUri()) {
67420        if (anyHasValue(element.getInstantiatesUri())) {
67421          openArray("instantiatesUri");
67422          for (UriType e : element.getInstantiatesUri()) 
67423            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
67424          closeArray();
67425        }
67426        if (anyHasExtras(element.getInstantiatesUri())) {
67427          openArray("_instantiatesUri");
67428          for (UriType e : element.getInstantiatesUri()) 
67429            composeUriExtras(null, e, true);
67430          closeArray();
67431        }
67432      };
67433      if (element.hasBasedOn()) {
67434        openArray("basedOn");
67435        for (Reference e : element.getBasedOn()) 
67436          composeReference(null, e);
67437        closeArray();
67438      };
67439      if (element.hasReplaces()) {
67440        openArray("replaces");
67441        for (Reference e : element.getReplaces()) 
67442          composeReference(null, e);
67443        closeArray();
67444      };
67445      if (element.hasRequisition()) {
67446        composeIdentifier("requisition", element.getRequisition());
67447      }
67448      if (element.hasStatusElement()) {
67449        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
67450        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
67451      }
67452      if (element.hasIntentElement()) {
67453        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
67454        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
67455      }
67456      if (element.hasCategory()) {
67457        openArray("category");
67458        for (CodeableConcept e : element.getCategory()) 
67459          composeCodeableConcept(null, e);
67460        closeArray();
67461      };
67462      if (element.hasPriorityElement()) {
67463        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
67464        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
67465      }
67466      if (element.hasDoNotPerformElement()) {
67467        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
67468        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
67469      }
67470      if (element.hasCode()) {
67471        composeCodeableReference("code", element.getCode());
67472      }
67473      if (element.hasOrderDetail()) {
67474        openArray("orderDetail");
67475        for (ServiceRequest.ServiceRequestOrderDetailComponent e : element.getOrderDetail()) 
67476          composeServiceRequestOrderDetailComponent(null, e);
67477        closeArray();
67478      };
67479      if (element.hasQuantity()) {
67480        composeType("quantity", element.getQuantity());
67481      }
67482      if (element.hasSubject()) {
67483        composeReference("subject", element.getSubject());
67484      }
67485      if (element.hasFocus()) {
67486        openArray("focus");
67487        for (Reference e : element.getFocus()) 
67488          composeReference(null, e);
67489        closeArray();
67490      };
67491      if (element.hasEncounter()) {
67492        composeReference("encounter", element.getEncounter());
67493      }
67494      if (element.hasOccurrence()) {
67495        composeType("occurrence", element.getOccurrence());
67496      }
67497      if (element.hasAsNeeded()) {
67498        composeType("asNeeded", element.getAsNeeded());
67499      }
67500      if (element.hasAuthoredOnElement()) {
67501        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
67502        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
67503      }
67504      if (element.hasRequester()) {
67505        composeReference("requester", element.getRequester());
67506      }
67507      if (element.hasPerformerType()) {
67508        composeCodeableConcept("performerType", element.getPerformerType());
67509      }
67510      if (element.hasPerformer()) {
67511        openArray("performer");
67512        for (Reference e : element.getPerformer()) 
67513          composeReference(null, e);
67514        closeArray();
67515      };
67516      if (element.hasLocation()) {
67517        openArray("location");
67518        for (CodeableReference e : element.getLocation()) 
67519          composeCodeableReference(null, e);
67520        closeArray();
67521      };
67522      if (element.hasReason()) {
67523        openArray("reason");
67524        for (CodeableReference e : element.getReason()) 
67525          composeCodeableReference(null, e);
67526        closeArray();
67527      };
67528      if (element.hasInsurance()) {
67529        openArray("insurance");
67530        for (Reference e : element.getInsurance()) 
67531          composeReference(null, e);
67532        closeArray();
67533      };
67534      if (element.hasSupportingInfo()) {
67535        openArray("supportingInfo");
67536        for (CodeableReference e : element.getSupportingInfo()) 
67537          composeCodeableReference(null, e);
67538        closeArray();
67539      };
67540      if (element.hasSpecimen()) {
67541        openArray("specimen");
67542        for (Reference e : element.getSpecimen()) 
67543          composeReference(null, e);
67544        closeArray();
67545      };
67546      if (element.hasBodySite()) {
67547        openArray("bodySite");
67548        for (CodeableConcept e : element.getBodySite()) 
67549          composeCodeableConcept(null, e);
67550        closeArray();
67551      };
67552      if (element.hasBodyStructure()) {
67553        composeReference("bodyStructure", element.getBodyStructure());
67554      }
67555      if (element.hasNote()) {
67556        openArray("note");
67557        for (Annotation e : element.getNote()) 
67558          composeAnnotation(null, e);
67559        closeArray();
67560      };
67561      if (element.hasPatientInstruction()) {
67562        openArray("patientInstruction");
67563        for (ServiceRequest.ServiceRequestPatientInstructionComponent e : element.getPatientInstruction()) 
67564          composeServiceRequestPatientInstructionComponent(null, e);
67565        closeArray();
67566      };
67567      if (element.hasRelevantHistory()) {
67568        openArray("relevantHistory");
67569        for (Reference e : element.getRelevantHistory()) 
67570          composeReference(null, e);
67571        closeArray();
67572      };
67573  }
67574
67575  protected void composeServiceRequestOrderDetailComponent(String name, ServiceRequest.ServiceRequestOrderDetailComponent element) throws IOException {
67576    if (element != null) {
67577      open(name);
67578      composeServiceRequestOrderDetailComponentProperties(element);
67579      close();
67580    }
67581  }
67582
67583  protected void composeServiceRequestOrderDetailComponentProperties(ServiceRequest.ServiceRequestOrderDetailComponent element) throws IOException {
67584    composeBackboneElementProperties(element);
67585      if (element.hasParameterFocus()) {
67586        composeCodeableReference("parameterFocus", element.getParameterFocus());
67587      }
67588      if (element.hasParameter()) {
67589        openArray("parameter");
67590        for (ServiceRequest.ServiceRequestOrderDetailParameterComponent e : element.getParameter()) 
67591          composeServiceRequestOrderDetailParameterComponent(null, e);
67592        closeArray();
67593      };
67594  }
67595
67596  protected void composeServiceRequestOrderDetailParameterComponent(String name, ServiceRequest.ServiceRequestOrderDetailParameterComponent element) throws IOException {
67597    if (element != null) {
67598      open(name);
67599      composeServiceRequestOrderDetailParameterComponentProperties(element);
67600      close();
67601    }
67602  }
67603
67604  protected void composeServiceRequestOrderDetailParameterComponentProperties(ServiceRequest.ServiceRequestOrderDetailParameterComponent element) throws IOException {
67605    composeBackboneElementProperties(element);
67606      if (element.hasCode()) {
67607        composeCodeableConcept("code", element.getCode());
67608      }
67609      if (element.hasValue()) {
67610        composeType("value", element.getValue());
67611      }
67612  }
67613
67614  protected void composeServiceRequestPatientInstructionComponent(String name, ServiceRequest.ServiceRequestPatientInstructionComponent element) throws IOException {
67615    if (element != null) {
67616      open(name);
67617      composeServiceRequestPatientInstructionComponentProperties(element);
67618      close();
67619    }
67620  }
67621
67622  protected void composeServiceRequestPatientInstructionComponentProperties(ServiceRequest.ServiceRequestPatientInstructionComponent element) throws IOException {
67623    composeBackboneElementProperties(element);
67624      if (element.hasInstruction()) {
67625        composeType("instruction", element.getInstruction());
67626      }
67627  }
67628
67629  protected void composeSlot(String name, Slot element) throws IOException {
67630    if (element != null) {
67631      prop("resourceType", name);
67632      composeSlotProperties(element);
67633    }
67634  }
67635
67636  protected void composeSlotProperties(Slot element) throws IOException {
67637    composeDomainResourceProperties(element);
67638      if (element.hasIdentifier()) {
67639        openArray("identifier");
67640        for (Identifier e : element.getIdentifier()) 
67641          composeIdentifier(null, e);
67642        closeArray();
67643      };
67644      if (element.hasServiceCategory()) {
67645        openArray("serviceCategory");
67646        for (CodeableConcept e : element.getServiceCategory()) 
67647          composeCodeableConcept(null, e);
67648        closeArray();
67649      };
67650      if (element.hasServiceType()) {
67651        openArray("serviceType");
67652        for (CodeableReference e : element.getServiceType()) 
67653          composeCodeableReference(null, e);
67654        closeArray();
67655      };
67656      if (element.hasSpecialty()) {
67657        openArray("specialty");
67658        for (CodeableConcept e : element.getSpecialty()) 
67659          composeCodeableConcept(null, e);
67660        closeArray();
67661      };
67662      if (element.hasAppointmentType()) {
67663        openArray("appointmentType");
67664        for (CodeableConcept e : element.getAppointmentType()) 
67665          composeCodeableConcept(null, e);
67666        closeArray();
67667      };
67668      if (element.hasSchedule()) {
67669        composeReference("schedule", element.getSchedule());
67670      }
67671      if (element.hasStatusElement()) {
67672        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
67673        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
67674      }
67675      if (element.hasStartElement()) {
67676        composeInstantCore("start", element.getStartElement(), false);
67677        composeInstantExtras("start", element.getStartElement(), false);
67678      }
67679      if (element.hasEndElement()) {
67680        composeInstantCore("end", element.getEndElement(), false);
67681        composeInstantExtras("end", element.getEndElement(), false);
67682      }
67683      if (element.hasOverbookedElement()) {
67684        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
67685        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
67686      }
67687      if (element.hasCommentElement()) {
67688        composeStringCore("comment", element.getCommentElement(), false);
67689        composeStringExtras("comment", element.getCommentElement(), false);
67690      }
67691  }
67692
67693  protected void composeSpecimen(String name, Specimen element) throws IOException {
67694    if (element != null) {
67695      prop("resourceType", name);
67696      composeSpecimenProperties(element);
67697    }
67698  }
67699
67700  protected void composeSpecimenProperties(Specimen element) throws IOException {
67701    composeDomainResourceProperties(element);
67702      if (element.hasIdentifier()) {
67703        openArray("identifier");
67704        for (Identifier e : element.getIdentifier()) 
67705          composeIdentifier(null, e);
67706        closeArray();
67707      };
67708      if (element.hasAccessionIdentifier()) {
67709        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
67710      }
67711      if (element.hasStatusElement()) {
67712        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
67713        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
67714      }
67715      if (element.hasType()) {
67716        composeCodeableConcept("type", element.getType());
67717      }
67718      if (element.hasSubject()) {
67719        composeReference("subject", element.getSubject());
67720      }
67721      if (element.hasReceivedTimeElement()) {
67722        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
67723        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
67724      }
67725      if (element.hasParent()) {
67726        openArray("parent");
67727        for (Reference e : element.getParent()) 
67728          composeReference(null, e);
67729        closeArray();
67730      };
67731      if (element.hasRequest()) {
67732        openArray("request");
67733        for (Reference e : element.getRequest()) 
67734          composeReference(null, e);
67735        closeArray();
67736      };
67737      if (element.hasCombinedElement()) {
67738        composeEnumerationCore("combined", element.getCombinedElement(), new Specimen.SpecimenCombinedEnumFactory(), false);
67739        composeEnumerationExtras("combined", element.getCombinedElement(), new Specimen.SpecimenCombinedEnumFactory(), false);
67740      }
67741      if (element.hasRole()) {
67742        openArray("role");
67743        for (CodeableConcept e : element.getRole()) 
67744          composeCodeableConcept(null, e);
67745        closeArray();
67746      };
67747      if (element.hasFeature()) {
67748        openArray("feature");
67749        for (Specimen.SpecimenFeatureComponent e : element.getFeature()) 
67750          composeSpecimenFeatureComponent(null, e);
67751        closeArray();
67752      };
67753      if (element.hasCollection()) {
67754        composeSpecimenCollectionComponent("collection", element.getCollection());
67755      }
67756      if (element.hasProcessing()) {
67757        openArray("processing");
67758        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
67759          composeSpecimenProcessingComponent(null, e);
67760        closeArray();
67761      };
67762      if (element.hasContainer()) {
67763        openArray("container");
67764        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
67765          composeSpecimenContainerComponent(null, e);
67766        closeArray();
67767      };
67768      if (element.hasCondition()) {
67769        openArray("condition");
67770        for (CodeableConcept e : element.getCondition()) 
67771          composeCodeableConcept(null, e);
67772        closeArray();
67773      };
67774      if (element.hasNote()) {
67775        openArray("note");
67776        for (Annotation e : element.getNote()) 
67777          composeAnnotation(null, e);
67778        closeArray();
67779      };
67780  }
67781
67782  protected void composeSpecimenFeatureComponent(String name, Specimen.SpecimenFeatureComponent element) throws IOException {
67783    if (element != null) {
67784      open(name);
67785      composeSpecimenFeatureComponentProperties(element);
67786      close();
67787    }
67788  }
67789
67790  protected void composeSpecimenFeatureComponentProperties(Specimen.SpecimenFeatureComponent element) throws IOException {
67791    composeBackboneElementProperties(element);
67792      if (element.hasType()) {
67793        composeCodeableConcept("type", element.getType());
67794      }
67795      if (element.hasDescriptionElement()) {
67796        composeStringCore("description", element.getDescriptionElement(), false);
67797        composeStringExtras("description", element.getDescriptionElement(), false);
67798      }
67799  }
67800
67801  protected void composeSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
67802    if (element != null) {
67803      open(name);
67804      composeSpecimenCollectionComponentProperties(element);
67805      close();
67806    }
67807  }
67808
67809  protected void composeSpecimenCollectionComponentProperties(Specimen.SpecimenCollectionComponent element) throws IOException {
67810    composeBackboneElementProperties(element);
67811      if (element.hasCollector()) {
67812        composeReference("collector", element.getCollector());
67813      }
67814      if (element.hasCollected()) {
67815        composeType("collected", element.getCollected());
67816      }
67817      if (element.hasDuration()) {
67818        composeDuration("duration", element.getDuration());
67819      }
67820      if (element.hasQuantity()) {
67821        composeQuantity("quantity", element.getQuantity());
67822      }
67823      if (element.hasMethod()) {
67824        composeCodeableConcept("method", element.getMethod());
67825      }
67826      if (element.hasDevice()) {
67827        composeCodeableReference("device", element.getDevice());
67828      }
67829      if (element.hasProcedure()) {
67830        composeReference("procedure", element.getProcedure());
67831      }
67832      if (element.hasBodySite()) {
67833        composeCodeableReference("bodySite", element.getBodySite());
67834      }
67835      if (element.hasFastingStatus()) {
67836        composeType("fastingStatus", element.getFastingStatus());
67837      }
67838  }
67839
67840  protected void composeSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
67841    if (element != null) {
67842      open(name);
67843      composeSpecimenProcessingComponentProperties(element);
67844      close();
67845    }
67846  }
67847
67848  protected void composeSpecimenProcessingComponentProperties(Specimen.SpecimenProcessingComponent element) throws IOException {
67849    composeBackboneElementProperties(element);
67850      if (element.hasDescriptionElement()) {
67851        composeStringCore("description", element.getDescriptionElement(), false);
67852        composeStringExtras("description", element.getDescriptionElement(), false);
67853      }
67854      if (element.hasMethod()) {
67855        composeCodeableConcept("method", element.getMethod());
67856      }
67857      if (element.hasAdditive()) {
67858        openArray("additive");
67859        for (Reference e : element.getAdditive()) 
67860          composeReference(null, e);
67861        closeArray();
67862      };
67863      if (element.hasTime()) {
67864        composeType("time", element.getTime());
67865      }
67866  }
67867
67868  protected void composeSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
67869    if (element != null) {
67870      open(name);
67871      composeSpecimenContainerComponentProperties(element);
67872      close();
67873    }
67874  }
67875
67876  protected void composeSpecimenContainerComponentProperties(Specimen.SpecimenContainerComponent element) throws IOException {
67877    composeBackboneElementProperties(element);
67878      if (element.hasDevice()) {
67879        composeReference("device", element.getDevice());
67880      }
67881      if (element.hasLocation()) {
67882        composeReference("location", element.getLocation());
67883      }
67884      if (element.hasSpecimenQuantity()) {
67885        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
67886      }
67887  }
67888
67889  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
67890    if (element != null) {
67891      prop("resourceType", name);
67892      composeSpecimenDefinitionProperties(element);
67893    }
67894  }
67895
67896  protected void composeSpecimenDefinitionProperties(SpecimenDefinition element) throws IOException {
67897    composeDomainResourceProperties(element);
67898      if (element.hasUrlElement()) {
67899        composeUriCore("url", element.getUrlElement(), false);
67900        composeUriExtras("url", element.getUrlElement(), false);
67901      }
67902      if (element.hasIdentifier()) {
67903        composeIdentifier("identifier", element.getIdentifier());
67904      }
67905      if (element.hasVersionElement()) {
67906        composeStringCore("version", element.getVersionElement(), false);
67907        composeStringExtras("version", element.getVersionElement(), false);
67908      }
67909      if (element.hasVersionAlgorithm()) {
67910        composeType("versionAlgorithm", element.getVersionAlgorithm());
67911      }
67912      if (element.hasNameElement()) {
67913        composeStringCore("name", element.getNameElement(), false);
67914        composeStringExtras("name", element.getNameElement(), false);
67915      }
67916      if (element.hasTitleElement()) {
67917        composeStringCore("title", element.getTitleElement(), false);
67918        composeStringExtras("title", element.getTitleElement(), false);
67919      }
67920      if (element.hasDerivedFromCanonical()) {
67921        if (anyHasValue(element.getDerivedFromCanonical())) {
67922          openArray("derivedFromCanonical");
67923          for (CanonicalType e : element.getDerivedFromCanonical()) 
67924            composeCanonicalCore(null, e, e != element.getDerivedFromCanonical().get(element.getDerivedFromCanonical().size()-1));
67925          closeArray();
67926        }
67927        if (anyHasExtras(element.getDerivedFromCanonical())) {
67928          openArray("_derivedFromCanonical");
67929          for (CanonicalType e : element.getDerivedFromCanonical()) 
67930            composeCanonicalExtras(null, e, true);
67931          closeArray();
67932        }
67933      };
67934      if (element.hasDerivedFromUri()) {
67935        if (anyHasValue(element.getDerivedFromUri())) {
67936          openArray("derivedFromUri");
67937          for (UriType e : element.getDerivedFromUri()) 
67938            composeUriCore(null, e, e != element.getDerivedFromUri().get(element.getDerivedFromUri().size()-1));
67939          closeArray();
67940        }
67941        if (anyHasExtras(element.getDerivedFromUri())) {
67942          openArray("_derivedFromUri");
67943          for (UriType e : element.getDerivedFromUri()) 
67944            composeUriExtras(null, e, true);
67945          closeArray();
67946        }
67947      };
67948      if (element.hasStatusElement()) {
67949        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67950        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67951      }
67952      if (element.hasExperimentalElement()) {
67953        composeBooleanCore("experimental", element.getExperimentalElement(), false);
67954        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
67955      }
67956      if (element.hasSubject()) {
67957        composeType("subject", element.getSubject());
67958      }
67959      if (element.hasDateElement()) {
67960        composeDateTimeCore("date", element.getDateElement(), false);
67961        composeDateTimeExtras("date", element.getDateElement(), false);
67962      }
67963      if (element.hasPublisherElement()) {
67964        composeStringCore("publisher", element.getPublisherElement(), false);
67965        composeStringExtras("publisher", element.getPublisherElement(), false);
67966      }
67967      if (element.hasContact()) {
67968        openArray("contact");
67969        for (ContactDetail e : element.getContact()) 
67970          composeContactDetail(null, e);
67971        closeArray();
67972      };
67973      if (element.hasDescriptionElement()) {
67974        composeMarkdownCore("description", element.getDescriptionElement(), false);
67975        composeMarkdownExtras("description", element.getDescriptionElement(), false);
67976      }
67977      if (element.hasUseContext()) {
67978        openArray("useContext");
67979        for (UsageContext e : element.getUseContext()) 
67980          composeUsageContext(null, e);
67981        closeArray();
67982      };
67983      if (element.hasJurisdiction()) {
67984        openArray("jurisdiction");
67985        for (CodeableConcept e : element.getJurisdiction()) 
67986          composeCodeableConcept(null, e);
67987        closeArray();
67988      };
67989      if (element.hasPurposeElement()) {
67990        composeMarkdownCore("purpose", element.getPurposeElement(), false);
67991        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
67992      }
67993      if (element.hasCopyrightElement()) {
67994        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
67995        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
67996      }
67997      if (element.hasCopyrightLabelElement()) {
67998        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
67999        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
68000      }
68001      if (element.hasApprovalDateElement()) {
68002        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
68003        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
68004      }
68005      if (element.hasLastReviewDateElement()) {
68006        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
68007        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
68008      }
68009      if (element.hasEffectivePeriod()) {
68010        composePeriod("effectivePeriod", element.getEffectivePeriod());
68011      }
68012      if (element.hasTypeCollected()) {
68013        composeCodeableConcept("typeCollected", element.getTypeCollected());
68014      }
68015      if (element.hasPatientPreparation()) {
68016        openArray("patientPreparation");
68017        for (CodeableConcept e : element.getPatientPreparation()) 
68018          composeCodeableConcept(null, e);
68019        closeArray();
68020      };
68021      if (element.hasTimeAspectElement()) {
68022        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
68023        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
68024      }
68025      if (element.hasCollection()) {
68026        openArray("collection");
68027        for (CodeableConcept e : element.getCollection()) 
68028          composeCodeableConcept(null, e);
68029        closeArray();
68030      };
68031      if (element.hasTypeTested()) {
68032        openArray("typeTested");
68033        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
68034          composeSpecimenDefinitionTypeTestedComponent(null, e);
68035        closeArray();
68036      };
68037  }
68038
68039  protected void composeSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
68040    if (element != null) {
68041      open(name);
68042      composeSpecimenDefinitionTypeTestedComponentProperties(element);
68043      close();
68044    }
68045  }
68046
68047  protected void composeSpecimenDefinitionTypeTestedComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
68048    composeBackboneElementProperties(element);
68049      if (element.hasIsDerivedElement()) {
68050        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
68051        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
68052      }
68053      if (element.hasType()) {
68054        composeCodeableConcept("type", element.getType());
68055      }
68056      if (element.hasPreferenceElement()) {
68057        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
68058        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
68059      }
68060      if (element.hasContainer()) {
68061        composeSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
68062      }
68063      if (element.hasRequirementElement()) {
68064        composeMarkdownCore("requirement", element.getRequirementElement(), false);
68065        composeMarkdownExtras("requirement", element.getRequirementElement(), false);
68066      }
68067      if (element.hasRetentionTime()) {
68068        composeDuration("retentionTime", element.getRetentionTime());
68069      }
68070      if (element.hasSingleUseElement()) {
68071        composeBooleanCore("singleUse", element.getSingleUseElement(), false);
68072        composeBooleanExtras("singleUse", element.getSingleUseElement(), false);
68073      }
68074      if (element.hasRejectionCriterion()) {
68075        openArray("rejectionCriterion");
68076        for (CodeableConcept e : element.getRejectionCriterion()) 
68077          composeCodeableConcept(null, e);
68078        closeArray();
68079      };
68080      if (element.hasHandling()) {
68081        openArray("handling");
68082        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
68083          composeSpecimenDefinitionTypeTestedHandlingComponent(null, e);
68084        closeArray();
68085      };
68086      if (element.hasTestingDestination()) {
68087        openArray("testingDestination");
68088        for (CodeableConcept e : element.getTestingDestination()) 
68089          composeCodeableConcept(null, e);
68090        closeArray();
68091      };
68092  }
68093
68094  protected void composeSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
68095    if (element != null) {
68096      open(name);
68097      composeSpecimenDefinitionTypeTestedContainerComponentProperties(element);
68098      close();
68099    }
68100  }
68101
68102  protected void composeSpecimenDefinitionTypeTestedContainerComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
68103    composeBackboneElementProperties(element);
68104      if (element.hasMaterial()) {
68105        composeCodeableConcept("material", element.getMaterial());
68106      }
68107      if (element.hasType()) {
68108        composeCodeableConcept("type", element.getType());
68109      }
68110      if (element.hasCap()) {
68111        composeCodeableConcept("cap", element.getCap());
68112      }
68113      if (element.hasDescriptionElement()) {
68114        composeMarkdownCore("description", element.getDescriptionElement(), false);
68115        composeMarkdownExtras("description", element.getDescriptionElement(), false);
68116      }
68117      if (element.hasCapacity()) {
68118        composeQuantity("capacity", element.getCapacity());
68119      }
68120      if (element.hasMinimumVolume()) {
68121        composeType("minimumVolume", element.getMinimumVolume());
68122      }
68123      if (element.hasAdditive()) {
68124        openArray("additive");
68125        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
68126          composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
68127        closeArray();
68128      };
68129      if (element.hasPreparationElement()) {
68130        composeMarkdownCore("preparation", element.getPreparationElement(), false);
68131        composeMarkdownExtras("preparation", element.getPreparationElement(), false);
68132      }
68133  }
68134
68135  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
68136    if (element != null) {
68137      open(name);
68138      composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(element);
68139      close();
68140    }
68141  }
68142
68143  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
68144    composeBackboneElementProperties(element);
68145      if (element.hasAdditive()) {
68146        composeType("additive", element.getAdditive());
68147      }
68148  }
68149
68150  protected void composeSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
68151    if (element != null) {
68152      open(name);
68153      composeSpecimenDefinitionTypeTestedHandlingComponentProperties(element);
68154      close();
68155    }
68156  }
68157
68158  protected void composeSpecimenDefinitionTypeTestedHandlingComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
68159    composeBackboneElementProperties(element);
68160      if (element.hasTemperatureQualifier()) {
68161        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
68162      }
68163      if (element.hasTemperatureRange()) {
68164        composeRange("temperatureRange", element.getTemperatureRange());
68165      }
68166      if (element.hasMaxDuration()) {
68167        composeDuration("maxDuration", element.getMaxDuration());
68168      }
68169      if (element.hasInstructionElement()) {
68170        composeMarkdownCore("instruction", element.getInstructionElement(), false);
68171        composeMarkdownExtras("instruction", element.getInstructionElement(), false);
68172      }
68173  }
68174
68175  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
68176    if (element != null) {
68177      prop("resourceType", name);
68178      composeStructureDefinitionProperties(element);
68179    }
68180  }
68181
68182  protected void composeStructureDefinitionProperties(StructureDefinition element) throws IOException {
68183    composeCanonicalResourceProperties(element);
68184      if (element.hasUrlElement()) {
68185        composeUriCore("url", element.getUrlElement(), false);
68186        composeUriExtras("url", element.getUrlElement(), false);
68187      }
68188      if (element.hasIdentifier()) {
68189        openArray("identifier");
68190        for (Identifier e : element.getIdentifier()) 
68191          composeIdentifier(null, e);
68192        closeArray();
68193      };
68194      if (element.hasVersionElement()) {
68195        composeStringCore("version", element.getVersionElement(), false);
68196        composeStringExtras("version", element.getVersionElement(), false);
68197      }
68198      if (element.hasVersionAlgorithm()) {
68199        composeType("versionAlgorithm", element.getVersionAlgorithm());
68200      }
68201      if (element.hasNameElement()) {
68202        composeStringCore("name", element.getNameElement(), false);
68203        composeStringExtras("name", element.getNameElement(), false);
68204      }
68205      if (element.hasTitleElement()) {
68206        composeStringCore("title", element.getTitleElement(), false);
68207        composeStringExtras("title", element.getTitleElement(), false);
68208      }
68209      if (element.hasStatusElement()) {
68210        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68211        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68212      }
68213      if (element.hasExperimentalElement()) {
68214        composeBooleanCore("experimental", element.getExperimentalElement(), false);
68215        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
68216      }
68217      if (element.hasDateElement()) {
68218        composeDateTimeCore("date", element.getDateElement(), false);
68219        composeDateTimeExtras("date", element.getDateElement(), false);
68220      }
68221      if (element.hasPublisherElement()) {
68222        composeStringCore("publisher", element.getPublisherElement(), false);
68223        composeStringExtras("publisher", element.getPublisherElement(), false);
68224      }
68225      if (element.hasContact()) {
68226        openArray("contact");
68227        for (ContactDetail e : element.getContact()) 
68228          composeContactDetail(null, e);
68229        closeArray();
68230      };
68231      if (element.hasDescriptionElement()) {
68232        composeMarkdownCore("description", element.getDescriptionElement(), false);
68233        composeMarkdownExtras("description", element.getDescriptionElement(), false);
68234      }
68235      if (element.hasUseContext()) {
68236        openArray("useContext");
68237        for (UsageContext e : element.getUseContext()) 
68238          composeUsageContext(null, e);
68239        closeArray();
68240      };
68241      if (element.hasJurisdiction()) {
68242        openArray("jurisdiction");
68243        for (CodeableConcept e : element.getJurisdiction()) 
68244          composeCodeableConcept(null, e);
68245        closeArray();
68246      };
68247      if (element.hasPurposeElement()) {
68248        composeMarkdownCore("purpose", element.getPurposeElement(), false);
68249        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
68250      }
68251      if (element.hasCopyrightElement()) {
68252        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
68253        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
68254      }
68255      if (element.hasCopyrightLabelElement()) {
68256        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
68257        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
68258      }
68259      if (element.hasKeyword()) {
68260        openArray("keyword");
68261        for (Coding e : element.getKeyword()) 
68262          composeCoding(null, e);
68263        closeArray();
68264      };
68265      if (element.hasFhirVersionElement()) {
68266        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
68267        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
68268      }
68269      if (element.hasMapping()) {
68270        openArray("mapping");
68271        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
68272          composeStructureDefinitionMappingComponent(null, e);
68273        closeArray();
68274      };
68275      if (element.hasKindElement()) {
68276        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
68277        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
68278      }
68279      if (element.hasAbstractElement()) {
68280        composeBooleanCore("abstract", element.getAbstractElement(), false);
68281        composeBooleanExtras("abstract", element.getAbstractElement(), false);
68282      }
68283      if (element.hasContext()) {
68284        openArray("context");
68285        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
68286          composeStructureDefinitionContextComponent(null, e);
68287        closeArray();
68288      };
68289      if (element.hasContextInvariant()) {
68290        if (anyHasValue(element.getContextInvariant())) {
68291          openArray("contextInvariant");
68292          for (StringType e : element.getContextInvariant()) 
68293            composeStringCore(null, e, e != element.getContextInvariant().get(element.getContextInvariant().size()-1));
68294          closeArray();
68295        }
68296        if (anyHasExtras(element.getContextInvariant())) {
68297          openArray("_contextInvariant");
68298          for (StringType e : element.getContextInvariant()) 
68299            composeStringExtras(null, e, true);
68300          closeArray();
68301        }
68302      };
68303      if (element.hasTypeElement()) {
68304        composeUriCore("type", element.getTypeElement(), false);
68305        composeUriExtras("type", element.getTypeElement(), false);
68306      }
68307      if (element.hasBaseDefinitionElement()) {
68308        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
68309        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
68310      }
68311      if (element.hasDerivationElement()) {
68312        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
68313        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
68314      }
68315      if (element.hasSnapshot()) {
68316        composeStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
68317      }
68318      if (element.hasDifferential()) {
68319        composeStructureDefinitionDifferentialComponent("differential", element.getDifferential());
68320      }
68321  }
68322
68323  protected void composeStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
68324    if (element != null) {
68325      open(name);
68326      composeStructureDefinitionMappingComponentProperties(element);
68327      close();
68328    }
68329  }
68330
68331  protected void composeStructureDefinitionMappingComponentProperties(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
68332    composeBackboneElementProperties(element);
68333      if (element.hasIdentityElement()) {
68334        composeIdCore("identity", element.getIdentityElement(), false);
68335        composeIdExtras("identity", element.getIdentityElement(), false);
68336      }
68337      if (element.hasUriElement()) {
68338        composeUriCore("uri", element.getUriElement(), false);
68339        composeUriExtras("uri", element.getUriElement(), false);
68340      }
68341      if (element.hasNameElement()) {
68342        composeStringCore("name", element.getNameElement(), false);
68343        composeStringExtras("name", element.getNameElement(), false);
68344      }
68345      if (element.hasCommentElement()) {
68346        composeStringCore("comment", element.getCommentElement(), false);
68347        composeStringExtras("comment", element.getCommentElement(), false);
68348      }
68349  }
68350
68351  protected void composeStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
68352    if (element != null) {
68353      open(name);
68354      composeStructureDefinitionContextComponentProperties(element);
68355      close();
68356    }
68357  }
68358
68359  protected void composeStructureDefinitionContextComponentProperties(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
68360    composeBackboneElementProperties(element);
68361      if (element.hasTypeElement()) {
68362        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
68363        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
68364      }
68365      if (element.hasExpressionElement()) {
68366        composeStringCore("expression", element.getExpressionElement(), false);
68367        composeStringExtras("expression", element.getExpressionElement(), false);
68368      }
68369  }
68370
68371  protected void composeStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
68372    if (element != null) {
68373      open(name);
68374      composeStructureDefinitionSnapshotComponentProperties(element);
68375      close();
68376    }
68377  }
68378
68379  protected void composeStructureDefinitionSnapshotComponentProperties(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
68380    composeBackboneElementProperties(element);
68381      if (element.hasElement()) {
68382        openArray("element");
68383        for (ElementDefinition e : element.getElement()) 
68384          composeElementDefinition(null, e);
68385        closeArray();
68386      };
68387  }
68388
68389  protected void composeStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
68390    if (element != null) {
68391      open(name);
68392      composeStructureDefinitionDifferentialComponentProperties(element);
68393      close();
68394    }
68395  }
68396
68397  protected void composeStructureDefinitionDifferentialComponentProperties(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
68398    composeBackboneElementProperties(element);
68399      if (element.hasElement()) {
68400        openArray("element");
68401        for (ElementDefinition e : element.getElement()) 
68402          composeElementDefinition(null, e);
68403        closeArray();
68404      };
68405  }
68406
68407  protected void composeStructureMap(String name, StructureMap element) throws IOException {
68408    if (element != null) {
68409      prop("resourceType", name);
68410      composeStructureMapProperties(element);
68411    }
68412  }
68413
68414  protected void composeStructureMapProperties(StructureMap element) throws IOException {
68415    composeCanonicalResourceProperties(element);
68416      if (element.hasUrlElement()) {
68417        composeUriCore("url", element.getUrlElement(), false);
68418        composeUriExtras("url", element.getUrlElement(), false);
68419      }
68420      if (element.hasIdentifier()) {
68421        openArray("identifier");
68422        for (Identifier e : element.getIdentifier()) 
68423          composeIdentifier(null, e);
68424        closeArray();
68425      };
68426      if (element.hasVersionElement()) {
68427        composeStringCore("version", element.getVersionElement(), false);
68428        composeStringExtras("version", element.getVersionElement(), false);
68429      }
68430      if (element.hasVersionAlgorithm()) {
68431        composeType("versionAlgorithm", element.getVersionAlgorithm());
68432      }
68433      if (element.hasNameElement()) {
68434        composeStringCore("name", element.getNameElement(), false);
68435        composeStringExtras("name", element.getNameElement(), false);
68436      }
68437      if (element.hasTitleElement()) {
68438        composeStringCore("title", element.getTitleElement(), false);
68439        composeStringExtras("title", element.getTitleElement(), false);
68440      }
68441      if (element.hasStatusElement()) {
68442        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68443        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68444      }
68445      if (element.hasExperimentalElement()) {
68446        composeBooleanCore("experimental", element.getExperimentalElement(), false);
68447        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
68448      }
68449      if (element.hasDateElement()) {
68450        composeDateTimeCore("date", element.getDateElement(), false);
68451        composeDateTimeExtras("date", element.getDateElement(), false);
68452      }
68453      if (element.hasPublisherElement()) {
68454        composeStringCore("publisher", element.getPublisherElement(), false);
68455        composeStringExtras("publisher", element.getPublisherElement(), false);
68456      }
68457      if (element.hasContact()) {
68458        openArray("contact");
68459        for (ContactDetail e : element.getContact()) 
68460          composeContactDetail(null, e);
68461        closeArray();
68462      };
68463      if (element.hasDescriptionElement()) {
68464        composeMarkdownCore("description", element.getDescriptionElement(), false);
68465        composeMarkdownExtras("description", element.getDescriptionElement(), false);
68466      }
68467      if (element.hasUseContext()) {
68468        openArray("useContext");
68469        for (UsageContext e : element.getUseContext()) 
68470          composeUsageContext(null, e);
68471        closeArray();
68472      };
68473      if (element.hasJurisdiction()) {
68474        openArray("jurisdiction");
68475        for (CodeableConcept e : element.getJurisdiction()) 
68476          composeCodeableConcept(null, e);
68477        closeArray();
68478      };
68479      if (element.hasPurposeElement()) {
68480        composeMarkdownCore("purpose", element.getPurposeElement(), false);
68481        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
68482      }
68483      if (element.hasCopyrightElement()) {
68484        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
68485        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
68486      }
68487      if (element.hasCopyrightLabelElement()) {
68488        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
68489        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
68490      }
68491      if (element.hasStructure()) {
68492        openArray("structure");
68493        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
68494          composeStructureMapStructureComponent(null, e);
68495        closeArray();
68496      };
68497      if (element.hasImport()) {
68498        if (anyHasValue(element.getImport())) {
68499          openArray("import");
68500          for (CanonicalType e : element.getImport()) 
68501            composeCanonicalCore(null, e, e != element.getImport().get(element.getImport().size()-1));
68502          closeArray();
68503        }
68504        if (anyHasExtras(element.getImport())) {
68505          openArray("_import");
68506          for (CanonicalType e : element.getImport()) 
68507            composeCanonicalExtras(null, e, true);
68508          closeArray();
68509        }
68510      };
68511      if (element.hasConst()) {
68512        openArray("const");
68513        for (StructureMap.StructureMapConstComponent e : element.getConst()) 
68514          composeStructureMapConstComponent(null, e);
68515        closeArray();
68516      };
68517      if (element.hasGroup()) {
68518        openArray("group");
68519        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
68520          composeStructureMapGroupComponent(null, e);
68521        closeArray();
68522      };
68523  }
68524
68525  protected void composeStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
68526    if (element != null) {
68527      open(name);
68528      composeStructureMapStructureComponentProperties(element);
68529      close();
68530    }
68531  }
68532
68533  protected void composeStructureMapStructureComponentProperties(StructureMap.StructureMapStructureComponent element) throws IOException {
68534    composeBackboneElementProperties(element);
68535      if (element.hasUrlElement()) {
68536        composeCanonicalCore("url", element.getUrlElement(), false);
68537        composeCanonicalExtras("url", element.getUrlElement(), false);
68538      }
68539      if (element.hasModeElement()) {
68540        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
68541        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
68542      }
68543      if (element.hasAliasElement()) {
68544        composeStringCore("alias", element.getAliasElement(), false);
68545        composeStringExtras("alias", element.getAliasElement(), false);
68546      }
68547      if (element.hasDocumentationElement()) {
68548        composeStringCore("documentation", element.getDocumentationElement(), false);
68549        composeStringExtras("documentation", element.getDocumentationElement(), false);
68550      }
68551  }
68552
68553  protected void composeStructureMapConstComponent(String name, StructureMap.StructureMapConstComponent element) throws IOException {
68554    if (element != null) {
68555      open(name);
68556      composeStructureMapConstComponentProperties(element);
68557      close();
68558    }
68559  }
68560
68561  protected void composeStructureMapConstComponentProperties(StructureMap.StructureMapConstComponent element) throws IOException {
68562    composeBackboneElementProperties(element);
68563      if (element.hasNameElement()) {
68564        composeIdCore("name", element.getNameElement(), false);
68565        composeIdExtras("name", element.getNameElement(), false);
68566      }
68567      if (element.hasValueElement()) {
68568        composeStringCore("value", element.getValueElement(), false);
68569        composeStringExtras("value", element.getValueElement(), false);
68570      }
68571  }
68572
68573  protected void composeStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
68574    if (element != null) {
68575      open(name);
68576      composeStructureMapGroupComponentProperties(element);
68577      close();
68578    }
68579  }
68580
68581  protected void composeStructureMapGroupComponentProperties(StructureMap.StructureMapGroupComponent element) throws IOException {
68582    composeBackboneElementProperties(element);
68583      if (element.hasNameElement()) {
68584        composeIdCore("name", element.getNameElement(), false);
68585        composeIdExtras("name", element.getNameElement(), false);
68586      }
68587      if (element.hasExtendsElement()) {
68588        composeIdCore("extends", element.getExtendsElement(), false);
68589        composeIdExtras("extends", element.getExtendsElement(), false);
68590      }
68591      if (element.hasTypeModeElement()) {
68592        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
68593        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
68594      }
68595      if (element.hasDocumentationElement()) {
68596        composeStringCore("documentation", element.getDocumentationElement(), false);
68597        composeStringExtras("documentation", element.getDocumentationElement(), false);
68598      }
68599      if (element.hasInput()) {
68600        openArray("input");
68601        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
68602          composeStructureMapGroupInputComponent(null, e);
68603        closeArray();
68604      };
68605      if (element.hasRule()) {
68606        openArray("rule");
68607        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
68608          composeStructureMapGroupRuleComponent(null, e);
68609        closeArray();
68610      };
68611  }
68612
68613  protected void composeStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
68614    if (element != null) {
68615      open(name);
68616      composeStructureMapGroupInputComponentProperties(element);
68617      close();
68618    }
68619  }
68620
68621  protected void composeStructureMapGroupInputComponentProperties(StructureMap.StructureMapGroupInputComponent element) throws IOException {
68622    composeBackboneElementProperties(element);
68623      if (element.hasNameElement()) {
68624        composeIdCore("name", element.getNameElement(), false);
68625        composeIdExtras("name", element.getNameElement(), false);
68626      }
68627      if (element.hasTypeElement()) {
68628        composeStringCore("type", element.getTypeElement(), false);
68629        composeStringExtras("type", element.getTypeElement(), false);
68630      }
68631      if (element.hasModeElement()) {
68632        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
68633        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
68634      }
68635      if (element.hasDocumentationElement()) {
68636        composeStringCore("documentation", element.getDocumentationElement(), false);
68637        composeStringExtras("documentation", element.getDocumentationElement(), false);
68638      }
68639  }
68640
68641  protected void composeStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
68642    if (element != null) {
68643      open(name);
68644      composeStructureMapGroupRuleComponentProperties(element);
68645      close();
68646    }
68647  }
68648
68649  protected void composeStructureMapGroupRuleComponentProperties(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
68650    composeBackboneElementProperties(element);
68651      if (element.hasNameElement()) {
68652        composeIdCore("name", element.getNameElement(), false);
68653        composeIdExtras("name", element.getNameElement(), false);
68654      }
68655      if (element.hasSource()) {
68656        openArray("source");
68657        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
68658          composeStructureMapGroupRuleSourceComponent(null, e);
68659        closeArray();
68660      };
68661      if (element.hasTarget()) {
68662        openArray("target");
68663        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
68664          composeStructureMapGroupRuleTargetComponent(null, e);
68665        closeArray();
68666      };
68667      if (element.hasRule()) {
68668        openArray("rule");
68669        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
68670          composeStructureMapGroupRuleComponent(null, e);
68671        closeArray();
68672      };
68673      if (element.hasDependent()) {
68674        openArray("dependent");
68675        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
68676          composeStructureMapGroupRuleDependentComponent(null, e);
68677        closeArray();
68678      };
68679      if (element.hasDocumentationElement()) {
68680        composeStringCore("documentation", element.getDocumentationElement(), false);
68681        composeStringExtras("documentation", element.getDocumentationElement(), false);
68682      }
68683  }
68684
68685  protected void composeStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
68686    if (element != null) {
68687      open(name);
68688      composeStructureMapGroupRuleSourceComponentProperties(element);
68689      close();
68690    }
68691  }
68692
68693  protected void composeStructureMapGroupRuleSourceComponentProperties(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
68694    composeBackboneElementProperties(element);
68695      if (element.hasContextElement()) {
68696        composeIdCore("context", element.getContextElement(), false);
68697        composeIdExtras("context", element.getContextElement(), false);
68698      }
68699      if (element.hasMinElement()) {
68700        composeIntegerCore("min", element.getMinElement(), false);
68701        composeIntegerExtras("min", element.getMinElement(), false);
68702      }
68703      if (element.hasMaxElement()) {
68704        composeStringCore("max", element.getMaxElement(), false);
68705        composeStringExtras("max", element.getMaxElement(), false);
68706      }
68707      if (element.hasTypeElement()) {
68708        composeStringCore("type", element.getTypeElement(), false);
68709        composeStringExtras("type", element.getTypeElement(), false);
68710      }
68711      if (element.hasDefaultValueElement()) {
68712        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
68713        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
68714      }
68715      if (element.hasElementElement()) {
68716        composeStringCore("element", element.getElementElement(), false);
68717        composeStringExtras("element", element.getElementElement(), false);
68718      }
68719      if (element.hasListModeElement()) {
68720        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
68721        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
68722      }
68723      if (element.hasVariableElement()) {
68724        composeIdCore("variable", element.getVariableElement(), false);
68725        composeIdExtras("variable", element.getVariableElement(), false);
68726      }
68727      if (element.hasConditionElement()) {
68728        composeStringCore("condition", element.getConditionElement(), false);
68729        composeStringExtras("condition", element.getConditionElement(), false);
68730      }
68731      if (element.hasCheckElement()) {
68732        composeStringCore("check", element.getCheckElement(), false);
68733        composeStringExtras("check", element.getCheckElement(), false);
68734      }
68735      if (element.hasLogMessageElement()) {
68736        composeStringCore("logMessage", element.getLogMessageElement(), false);
68737        composeStringExtras("logMessage", element.getLogMessageElement(), false);
68738      }
68739  }
68740
68741  protected void composeStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
68742    if (element != null) {
68743      open(name);
68744      composeStructureMapGroupRuleTargetComponentProperties(element);
68745      close();
68746    }
68747  }
68748
68749  protected void composeStructureMapGroupRuleTargetComponentProperties(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
68750    composeBackboneElementProperties(element);
68751      if (element.hasContextElement()) {
68752        composeStringCore("context", element.getContextElement(), false);
68753        composeStringExtras("context", element.getContextElement(), false);
68754      }
68755      if (element.hasElementElement()) {
68756        composeStringCore("element", element.getElementElement(), false);
68757        composeStringExtras("element", element.getElementElement(), false);
68758      }
68759      if (element.hasVariableElement()) {
68760        composeIdCore("variable", element.getVariableElement(), false);
68761        composeIdExtras("variable", element.getVariableElement(), false);
68762      }
68763      if (element.hasListMode()) {
68764        openArray("listMode");
68765        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
68766          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
68767        closeArray();
68768        if (anyHasExtras(element.getListMode())) {
68769          openArray("_listMode");
68770          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
68771            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
68772          closeArray();
68773        }
68774      };
68775      if (element.hasListRuleIdElement()) {
68776        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
68777        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
68778      }
68779      if (element.hasTransformElement()) {
68780        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
68781        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
68782      }
68783      if (element.hasParameter()) {
68784        openArray("parameter");
68785        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
68786          composeStructureMapGroupRuleTargetParameterComponent(null, e);
68787        closeArray();
68788      };
68789  }
68790
68791  protected void composeStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
68792    if (element != null) {
68793      open(name);
68794      composeStructureMapGroupRuleTargetParameterComponentProperties(element);
68795      close();
68796    }
68797  }
68798
68799  protected void composeStructureMapGroupRuleTargetParameterComponentProperties(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
68800    composeBackboneElementProperties(element);
68801      if (element.hasValue()) {
68802        composeType("value", element.getValue());
68803      }
68804  }
68805
68806  protected void composeStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
68807    if (element != null) {
68808      open(name);
68809      composeStructureMapGroupRuleDependentComponentProperties(element);
68810      close();
68811    }
68812  }
68813
68814  protected void composeStructureMapGroupRuleDependentComponentProperties(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
68815    composeBackboneElementProperties(element);
68816      if (element.hasNameElement()) {
68817        composeIdCore("name", element.getNameElement(), false);
68818        composeIdExtras("name", element.getNameElement(), false);
68819      }
68820      if (element.hasParameter()) {
68821        openArray("parameter");
68822        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
68823          composeStructureMapGroupRuleTargetParameterComponent(null, e);
68824        closeArray();
68825      };
68826  }
68827
68828  protected void composeSubscription(String name, Subscription element) throws IOException {
68829    if (element != null) {
68830      prop("resourceType", name);
68831      composeSubscriptionProperties(element);
68832    }
68833  }
68834
68835  protected void composeSubscriptionProperties(Subscription element) throws IOException {
68836    composeDomainResourceProperties(element);
68837      if (element.hasIdentifier()) {
68838        openArray("identifier");
68839        for (Identifier e : element.getIdentifier()) 
68840          composeIdentifier(null, e);
68841        closeArray();
68842      };
68843      if (element.hasNameElement()) {
68844        composeStringCore("name", element.getNameElement(), false);
68845        composeStringExtras("name", element.getNameElement(), false);
68846      }
68847      if (element.hasStatusElement()) {
68848        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68849        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68850      }
68851      if (element.hasTopicElement()) {
68852        composeCanonicalCore("topic", element.getTopicElement(), false);
68853        composeCanonicalExtras("topic", element.getTopicElement(), false);
68854      }
68855      if (element.hasContact()) {
68856        openArray("contact");
68857        for (ContactPoint e : element.getContact()) 
68858          composeContactPoint(null, e);
68859        closeArray();
68860      };
68861      if (element.hasEndElement()) {
68862        composeInstantCore("end", element.getEndElement(), false);
68863        composeInstantExtras("end", element.getEndElement(), false);
68864      }
68865      if (element.hasManagingEntity()) {
68866        composeReference("managingEntity", element.getManagingEntity());
68867      }
68868      if (element.hasReasonElement()) {
68869        composeStringCore("reason", element.getReasonElement(), false);
68870        composeStringExtras("reason", element.getReasonElement(), false);
68871      }
68872      if (element.hasFilterBy()) {
68873        openArray("filterBy");
68874        for (Subscription.SubscriptionFilterByComponent e : element.getFilterBy()) 
68875          composeSubscriptionFilterByComponent(null, e);
68876        closeArray();
68877      };
68878      if (element.hasChannelType()) {
68879        composeCoding("channelType", element.getChannelType());
68880      }
68881      if (element.hasEndpointElement()) {
68882        composeUrlCore("endpoint", element.getEndpointElement(), false);
68883        composeUrlExtras("endpoint", element.getEndpointElement(), false);
68884      }
68885      if (element.hasParameter()) {
68886        openArray("parameter");
68887        for (Subscription.SubscriptionParameterComponent e : element.getParameter()) 
68888          composeSubscriptionParameterComponent(null, e);
68889        closeArray();
68890      };
68891      if (element.hasHeartbeatPeriodElement()) {
68892        composeUnsignedIntCore("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
68893        composeUnsignedIntExtras("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
68894      }
68895      if (element.hasTimeoutElement()) {
68896        composeUnsignedIntCore("timeout", element.getTimeoutElement(), false);
68897        composeUnsignedIntExtras("timeout", element.getTimeoutElement(), false);
68898      }
68899      if (element.hasContentTypeElement()) {
68900        composeCodeCore("contentType", element.getContentTypeElement(), false);
68901        composeCodeExtras("contentType", element.getContentTypeElement(), false);
68902      }
68903      if (element.hasContentElement()) {
68904        composeEnumerationCore("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
68905        composeEnumerationExtras("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
68906      }
68907      if (element.hasMaxCountElement()) {
68908        composePositiveIntCore("maxCount", element.getMaxCountElement(), false);
68909        composePositiveIntExtras("maxCount", element.getMaxCountElement(), false);
68910      }
68911  }
68912
68913  protected void composeSubscriptionFilterByComponent(String name, Subscription.SubscriptionFilterByComponent element) throws IOException {
68914    if (element != null) {
68915      open(name);
68916      composeSubscriptionFilterByComponentProperties(element);
68917      close();
68918    }
68919  }
68920
68921  protected void composeSubscriptionFilterByComponentProperties(Subscription.SubscriptionFilterByComponent element) throws IOException {
68922    composeBackboneElementProperties(element);
68923      if (element.hasResourceTypeElement()) {
68924        composeUriCore("resourceType", element.getResourceTypeElement(), false);
68925        composeUriExtras("resourceType", element.getResourceTypeElement(), false);
68926      }
68927      if (element.hasFilterParameterElement()) {
68928        composeStringCore("filterParameter", element.getFilterParameterElement(), false);
68929        composeStringExtras("filterParameter", element.getFilterParameterElement(), false);
68930      }
68931      if (element.hasComparatorElement()) {
68932        composeEnumerationCore("comparator", element.getComparatorElement(), new Enumerations.SearchComparatorEnumFactory(), false);
68933        composeEnumerationExtras("comparator", element.getComparatorElement(), new Enumerations.SearchComparatorEnumFactory(), false);
68934      }
68935      if (element.hasModifierElement()) {
68936        composeEnumerationCore("modifier", element.getModifierElement(), new Enumerations.SearchModifierCodeEnumFactory(), false);
68937        composeEnumerationExtras("modifier", element.getModifierElement(), new Enumerations.SearchModifierCodeEnumFactory(), false);
68938      }
68939      if (element.hasValueElement()) {
68940        composeStringCore("value", element.getValueElement(), false);
68941        composeStringExtras("value", element.getValueElement(), false);
68942      }
68943  }
68944
68945  protected void composeSubscriptionParameterComponent(String name, Subscription.SubscriptionParameterComponent element) throws IOException {
68946    if (element != null) {
68947      open(name);
68948      composeSubscriptionParameterComponentProperties(element);
68949      close();
68950    }
68951  }
68952
68953  protected void composeSubscriptionParameterComponentProperties(Subscription.SubscriptionParameterComponent element) throws IOException {
68954    composeBackboneElementProperties(element);
68955      if (element.hasNameElement()) {
68956        composeStringCore("name", element.getNameElement(), false);
68957        composeStringExtras("name", element.getNameElement(), false);
68958      }
68959      if (element.hasValueElement()) {
68960        composeStringCore("value", element.getValueElement(), false);
68961        composeStringExtras("value", element.getValueElement(), false);
68962      }
68963  }
68964
68965  protected void composeSubscriptionStatus(String name, SubscriptionStatus element) throws IOException {
68966    if (element != null) {
68967      prop("resourceType", name);
68968      composeSubscriptionStatusProperties(element);
68969    }
68970  }
68971
68972  protected void composeSubscriptionStatusProperties(SubscriptionStatus element) throws IOException {
68973    composeDomainResourceProperties(element);
68974      if (element.hasStatusElement()) {
68975        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68976        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68977      }
68978      if (element.hasTypeElement()) {
68979        composeEnumerationCore("type", element.getTypeElement(), new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory(), false);
68980        composeEnumerationExtras("type", element.getTypeElement(), new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory(), false);
68981      }
68982      if (element.hasEventsSinceSubscriptionStartElement()) {
68983        composeInteger64Core("eventsSinceSubscriptionStart", element.getEventsSinceSubscriptionStartElement(), false);
68984        composeInteger64Extras("eventsSinceSubscriptionStart", element.getEventsSinceSubscriptionStartElement(), false);
68985      }
68986      if (element.hasNotificationEvent()) {
68987        openArray("notificationEvent");
68988        for (SubscriptionStatus.SubscriptionStatusNotificationEventComponent e : element.getNotificationEvent()) 
68989          composeSubscriptionStatusNotificationEventComponent(null, e);
68990        closeArray();
68991      };
68992      if (element.hasSubscription()) {
68993        composeReference("subscription", element.getSubscription());
68994      }
68995      if (element.hasTopicElement()) {
68996        composeCanonicalCore("topic", element.getTopicElement(), false);
68997        composeCanonicalExtras("topic", element.getTopicElement(), false);
68998      }
68999      if (element.hasError()) {
69000        openArray("error");
69001        for (CodeableConcept e : element.getError()) 
69002          composeCodeableConcept(null, e);
69003        closeArray();
69004      };
69005  }
69006
69007  protected void composeSubscriptionStatusNotificationEventComponent(String name, SubscriptionStatus.SubscriptionStatusNotificationEventComponent element) throws IOException {
69008    if (element != null) {
69009      open(name);
69010      composeSubscriptionStatusNotificationEventComponentProperties(element);
69011      close();
69012    }
69013  }
69014
69015  protected void composeSubscriptionStatusNotificationEventComponentProperties(SubscriptionStatus.SubscriptionStatusNotificationEventComponent element) throws IOException {
69016    composeBackboneElementProperties(element);
69017      if (element.hasEventNumberElement()) {
69018        composeInteger64Core("eventNumber", element.getEventNumberElement(), false);
69019        composeInteger64Extras("eventNumber", element.getEventNumberElement(), false);
69020      }
69021      if (element.hasTimestampElement()) {
69022        composeInstantCore("timestamp", element.getTimestampElement(), false);
69023        composeInstantExtras("timestamp", element.getTimestampElement(), false);
69024      }
69025      if (element.hasFocus()) {
69026        composeReference("focus", element.getFocus());
69027      }
69028      if (element.hasAdditionalContext()) {
69029        openArray("additionalContext");
69030        for (Reference e : element.getAdditionalContext()) 
69031          composeReference(null, e);
69032        closeArray();
69033      };
69034  }
69035
69036  protected void composeSubscriptionTopic(String name, SubscriptionTopic element) throws IOException {
69037    if (element != null) {
69038      prop("resourceType", name);
69039      composeSubscriptionTopicProperties(element);
69040    }
69041  }
69042
69043  protected void composeSubscriptionTopicProperties(SubscriptionTopic element) throws IOException {
69044    composeCanonicalResourceProperties(element);
69045      if (element.hasUrlElement()) {
69046        composeUriCore("url", element.getUrlElement(), false);
69047        composeUriExtras("url", element.getUrlElement(), false);
69048      }
69049      if (element.hasIdentifier()) {
69050        openArray("identifier");
69051        for (Identifier e : element.getIdentifier()) 
69052          composeIdentifier(null, e);
69053        closeArray();
69054      };
69055      if (element.hasVersionElement()) {
69056        composeStringCore("version", element.getVersionElement(), false);
69057        composeStringExtras("version", element.getVersionElement(), false);
69058      }
69059      if (element.hasVersionAlgorithm()) {
69060        composeType("versionAlgorithm", element.getVersionAlgorithm());
69061      }
69062      if (element.hasNameElement()) {
69063        composeStringCore("name", element.getNameElement(), false);
69064        composeStringExtras("name", element.getNameElement(), false);
69065      }
69066      if (element.hasTitleElement()) {
69067        composeStringCore("title", element.getTitleElement(), false);
69068        composeStringExtras("title", element.getTitleElement(), false);
69069      }
69070      if (element.hasDerivedFrom()) {
69071        if (anyHasValue(element.getDerivedFrom())) {
69072          openArray("derivedFrom");
69073          for (CanonicalType e : element.getDerivedFrom()) 
69074            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
69075          closeArray();
69076        }
69077        if (anyHasExtras(element.getDerivedFrom())) {
69078          openArray("_derivedFrom");
69079          for (CanonicalType e : element.getDerivedFrom()) 
69080            composeCanonicalExtras(null, e, true);
69081          closeArray();
69082        }
69083      };
69084      if (element.hasStatusElement()) {
69085        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
69086        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
69087      }
69088      if (element.hasExperimentalElement()) {
69089        composeBooleanCore("experimental", element.getExperimentalElement(), false);
69090        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
69091      }
69092      if (element.hasDateElement()) {
69093        composeDateTimeCore("date", element.getDateElement(), false);
69094        composeDateTimeExtras("date", element.getDateElement(), false);
69095      }
69096      if (element.hasPublisherElement()) {
69097        composeStringCore("publisher", element.getPublisherElement(), false);
69098        composeStringExtras("publisher", element.getPublisherElement(), false);
69099      }
69100      if (element.hasContact()) {
69101        openArray("contact");
69102        for (ContactDetail e : element.getContact()) 
69103          composeContactDetail(null, e);
69104        closeArray();
69105      };
69106      if (element.hasDescriptionElement()) {
69107        composeMarkdownCore("description", element.getDescriptionElement(), false);
69108        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69109      }
69110      if (element.hasUseContext()) {
69111        openArray("useContext");
69112        for (UsageContext e : element.getUseContext()) 
69113          composeUsageContext(null, e);
69114        closeArray();
69115      };
69116      if (element.hasJurisdiction()) {
69117        openArray("jurisdiction");
69118        for (CodeableConcept e : element.getJurisdiction()) 
69119          composeCodeableConcept(null, e);
69120        closeArray();
69121      };
69122      if (element.hasPurposeElement()) {
69123        composeMarkdownCore("purpose", element.getPurposeElement(), false);
69124        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
69125      }
69126      if (element.hasCopyrightElement()) {
69127        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
69128        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
69129      }
69130      if (element.hasCopyrightLabelElement()) {
69131        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
69132        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
69133      }
69134      if (element.hasApprovalDateElement()) {
69135        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
69136        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
69137      }
69138      if (element.hasLastReviewDateElement()) {
69139        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
69140        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
69141      }
69142      if (element.hasEffectivePeriod()) {
69143        composePeriod("effectivePeriod", element.getEffectivePeriod());
69144      }
69145      if (element.hasResourceTrigger()) {
69146        openArray("resourceTrigger");
69147        for (SubscriptionTopic.SubscriptionTopicResourceTriggerComponent e : element.getResourceTrigger()) 
69148          composeSubscriptionTopicResourceTriggerComponent(null, e);
69149        closeArray();
69150      };
69151      if (element.hasEventTrigger()) {
69152        openArray("eventTrigger");
69153        for (SubscriptionTopic.SubscriptionTopicEventTriggerComponent e : element.getEventTrigger()) 
69154          composeSubscriptionTopicEventTriggerComponent(null, e);
69155        closeArray();
69156      };
69157      if (element.hasCanFilterBy()) {
69158        openArray("canFilterBy");
69159        for (SubscriptionTopic.SubscriptionTopicCanFilterByComponent e : element.getCanFilterBy()) 
69160          composeSubscriptionTopicCanFilterByComponent(null, e);
69161        closeArray();
69162      };
69163      if (element.hasNotificationShape()) {
69164        openArray("notificationShape");
69165        for (SubscriptionTopic.SubscriptionTopicNotificationShapeComponent e : element.getNotificationShape()) 
69166          composeSubscriptionTopicNotificationShapeComponent(null, e);
69167        closeArray();
69168      };
69169  }
69170
69171  protected void composeSubscriptionTopicResourceTriggerComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
69172    if (element != null) {
69173      open(name);
69174      composeSubscriptionTopicResourceTriggerComponentProperties(element);
69175      close();
69176    }
69177  }
69178
69179  protected void composeSubscriptionTopicResourceTriggerComponentProperties(SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
69180    composeBackboneElementProperties(element);
69181      if (element.hasDescriptionElement()) {
69182        composeMarkdownCore("description", element.getDescriptionElement(), false);
69183        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69184      }
69185      if (element.hasResourceElement()) {
69186        composeUriCore("resource", element.getResourceElement(), false);
69187        composeUriExtras("resource", element.getResourceElement(), false);
69188      }
69189      if (element.hasSupportedInteraction()) {
69190        openArray("supportedInteraction");
69191        for (Enumeration<SubscriptionTopic.InteractionTrigger> e : element.getSupportedInteraction()) 
69192          composeEnumerationCore(null, e, new SubscriptionTopic.InteractionTriggerEnumFactory(), true);
69193        closeArray();
69194        if (anyHasExtras(element.getSupportedInteraction())) {
69195          openArray("_supportedInteraction");
69196          for (Enumeration<SubscriptionTopic.InteractionTrigger> e : element.getSupportedInteraction()) 
69197            composeEnumerationExtras(null, e, new SubscriptionTopic.InteractionTriggerEnumFactory(), true);
69198          closeArray();
69199        }
69200      };
69201      if (element.hasQueryCriteria()) {
69202        composeSubscriptionTopicResourceTriggerQueryCriteriaComponent("queryCriteria", element.getQueryCriteria());
69203      }
69204      if (element.hasFhirPathCriteriaElement()) {
69205        composeStringCore("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
69206        composeStringExtras("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
69207      }
69208  }
69209
69210  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
69211    if (element != null) {
69212      open(name);
69213      composeSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(element);
69214      close();
69215    }
69216  }
69217
69218  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
69219    composeBackboneElementProperties(element);
69220      if (element.hasPreviousElement()) {
69221        composeStringCore("previous", element.getPreviousElement(), false);
69222        composeStringExtras("previous", element.getPreviousElement(), false);
69223      }
69224      if (element.hasResultForCreateElement()) {
69225        composeEnumerationCore("resultForCreate", element.getResultForCreateElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69226        composeEnumerationExtras("resultForCreate", element.getResultForCreateElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69227      }
69228      if (element.hasCurrentElement()) {
69229        composeStringCore("current", element.getCurrentElement(), false);
69230        composeStringExtras("current", element.getCurrentElement(), false);
69231      }
69232      if (element.hasResultForDeleteElement()) {
69233        composeEnumerationCore("resultForDelete", element.getResultForDeleteElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69234        composeEnumerationExtras("resultForDelete", element.getResultForDeleteElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69235      }
69236      if (element.hasRequireBothElement()) {
69237        composeBooleanCore("requireBoth", element.getRequireBothElement(), false);
69238        composeBooleanExtras("requireBoth", element.getRequireBothElement(), false);
69239      }
69240  }
69241
69242  protected void composeSubscriptionTopicEventTriggerComponent(String name, SubscriptionTopic.SubscriptionTopicEventTriggerComponent element) throws IOException {
69243    if (element != null) {
69244      open(name);
69245      composeSubscriptionTopicEventTriggerComponentProperties(element);
69246      close();
69247    }
69248  }
69249
69250  protected void composeSubscriptionTopicEventTriggerComponentProperties(SubscriptionTopic.SubscriptionTopicEventTriggerComponent element) throws IOException {
69251    composeBackboneElementProperties(element);
69252      if (element.hasDescriptionElement()) {
69253        composeMarkdownCore("description", element.getDescriptionElement(), false);
69254        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69255      }
69256      if (element.hasEvent()) {
69257        composeCodeableConcept("event", element.getEvent());
69258      }
69259      if (element.hasResourceElement()) {
69260        composeUriCore("resource", element.getResourceElement(), false);
69261        composeUriExtras("resource", element.getResourceElement(), false);
69262      }
69263  }
69264
69265  protected void composeSubscriptionTopicCanFilterByComponent(String name, SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
69266    if (element != null) {
69267      open(name);
69268      composeSubscriptionTopicCanFilterByComponentProperties(element);
69269      close();
69270    }
69271  }
69272
69273  protected void composeSubscriptionTopicCanFilterByComponentProperties(SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
69274    composeBackboneElementProperties(element);
69275      if (element.hasDescriptionElement()) {
69276        composeMarkdownCore("description", element.getDescriptionElement(), false);
69277        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69278      }
69279      if (element.hasResourceElement()) {
69280        composeUriCore("resource", element.getResourceElement(), false);
69281        composeUriExtras("resource", element.getResourceElement(), false);
69282      }
69283      if (element.hasFilterParameterElement()) {
69284        composeStringCore("filterParameter", element.getFilterParameterElement(), false);
69285        composeStringExtras("filterParameter", element.getFilterParameterElement(), false);
69286      }
69287      if (element.hasFilterDefinitionElement()) {
69288        composeUriCore("filterDefinition", element.getFilterDefinitionElement(), false);
69289        composeUriExtras("filterDefinition", element.getFilterDefinitionElement(), false);
69290      }
69291      if (element.hasComparator()) {
69292        openArray("comparator");
69293        for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
69294          composeEnumerationCore(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
69295        closeArray();
69296        if (anyHasExtras(element.getComparator())) {
69297          openArray("_comparator");
69298          for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
69299            composeEnumerationExtras(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
69300          closeArray();
69301        }
69302      };
69303      if (element.hasModifier()) {
69304        openArray("modifier");
69305        for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
69306          composeEnumerationCore(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
69307        closeArray();
69308        if (anyHasExtras(element.getModifier())) {
69309          openArray("_modifier");
69310          for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
69311            composeEnumerationExtras(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
69312          closeArray();
69313        }
69314      };
69315  }
69316
69317  protected void composeSubscriptionTopicNotificationShapeComponent(String name, SubscriptionTopic.SubscriptionTopicNotificationShapeComponent element) throws IOException {
69318    if (element != null) {
69319      open(name);
69320      composeSubscriptionTopicNotificationShapeComponentProperties(element);
69321      close();
69322    }
69323  }
69324
69325  protected void composeSubscriptionTopicNotificationShapeComponentProperties(SubscriptionTopic.SubscriptionTopicNotificationShapeComponent element) throws IOException {
69326    composeBackboneElementProperties(element);
69327      if (element.hasResourceElement()) {
69328        composeUriCore("resource", element.getResourceElement(), false);
69329        composeUriExtras("resource", element.getResourceElement(), false);
69330      }
69331      if (element.hasInclude()) {
69332        if (anyHasValue(element.getInclude())) {
69333          openArray("include");
69334          for (StringType e : element.getInclude()) 
69335            composeStringCore(null, e, e != element.getInclude().get(element.getInclude().size()-1));
69336          closeArray();
69337        }
69338        if (anyHasExtras(element.getInclude())) {
69339          openArray("_include");
69340          for (StringType e : element.getInclude()) 
69341            composeStringExtras(null, e, true);
69342          closeArray();
69343        }
69344      };
69345      if (element.hasRevInclude()) {
69346        if (anyHasValue(element.getRevInclude())) {
69347          openArray("revInclude");
69348          for (StringType e : element.getRevInclude()) 
69349            composeStringCore(null, e, e != element.getRevInclude().get(element.getRevInclude().size()-1));
69350          closeArray();
69351        }
69352        if (anyHasExtras(element.getRevInclude())) {
69353          openArray("_revInclude");
69354          for (StringType e : element.getRevInclude()) 
69355            composeStringExtras(null, e, true);
69356          closeArray();
69357        }
69358      };
69359  }
69360
69361  protected void composeSubstance(String name, Substance element) throws IOException {
69362    if (element != null) {
69363      prop("resourceType", name);
69364      composeSubstanceProperties(element);
69365    }
69366  }
69367
69368  protected void composeSubstanceProperties(Substance element) throws IOException {
69369    composeDomainResourceProperties(element);
69370      if (element.hasIdentifier()) {
69371        openArray("identifier");
69372        for (Identifier e : element.getIdentifier()) 
69373          composeIdentifier(null, e);
69374        closeArray();
69375      };
69376      if (element.hasInstanceElement()) {
69377        composeBooleanCore("instance", element.getInstanceElement(), false);
69378        composeBooleanExtras("instance", element.getInstanceElement(), false);
69379      }
69380      if (element.hasStatusElement()) {
69381        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
69382        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
69383      }
69384      if (element.hasCategory()) {
69385        openArray("category");
69386        for (CodeableConcept e : element.getCategory()) 
69387          composeCodeableConcept(null, e);
69388        closeArray();
69389      };
69390      if (element.hasCode()) {
69391        composeCodeableReference("code", element.getCode());
69392      }
69393      if (element.hasDescriptionElement()) {
69394        composeMarkdownCore("description", element.getDescriptionElement(), false);
69395        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69396      }
69397      if (element.hasExpiryElement()) {
69398        composeDateTimeCore("expiry", element.getExpiryElement(), false);
69399        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
69400      }
69401      if (element.hasQuantity()) {
69402        composeQuantity("quantity", element.getQuantity());
69403      }
69404      if (element.hasIngredient()) {
69405        openArray("ingredient");
69406        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
69407          composeSubstanceIngredientComponent(null, e);
69408        closeArray();
69409      };
69410  }
69411
69412  protected void composeSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
69413    if (element != null) {
69414      open(name);
69415      composeSubstanceIngredientComponentProperties(element);
69416      close();
69417    }
69418  }
69419
69420  protected void composeSubstanceIngredientComponentProperties(Substance.SubstanceIngredientComponent element) throws IOException {
69421    composeBackboneElementProperties(element);
69422      if (element.hasQuantity()) {
69423        composeRatio("quantity", element.getQuantity());
69424      }
69425      if (element.hasSubstance()) {
69426        composeType("substance", element.getSubstance());
69427      }
69428  }
69429
69430  protected void composeSubstanceDefinition(String name, SubstanceDefinition element) throws IOException {
69431    if (element != null) {
69432      prop("resourceType", name);
69433      composeSubstanceDefinitionProperties(element);
69434    }
69435  }
69436
69437  protected void composeSubstanceDefinitionProperties(SubstanceDefinition element) throws IOException {
69438    composeDomainResourceProperties(element);
69439      if (element.hasIdentifier()) {
69440        openArray("identifier");
69441        for (Identifier e : element.getIdentifier()) 
69442          composeIdentifier(null, e);
69443        closeArray();
69444      };
69445      if (element.hasVersionElement()) {
69446        composeStringCore("version", element.getVersionElement(), false);
69447        composeStringExtras("version", element.getVersionElement(), false);
69448      }
69449      if (element.hasStatus()) {
69450        composeCodeableConcept("status", element.getStatus());
69451      }
69452      if (element.hasClassification()) {
69453        openArray("classification");
69454        for (CodeableConcept e : element.getClassification()) 
69455          composeCodeableConcept(null, e);
69456        closeArray();
69457      };
69458      if (element.hasDomain()) {
69459        composeCodeableConcept("domain", element.getDomain());
69460      }
69461      if (element.hasGrade()) {
69462        openArray("grade");
69463        for (CodeableConcept e : element.getGrade()) 
69464          composeCodeableConcept(null, e);
69465        closeArray();
69466      };
69467      if (element.hasDescriptionElement()) {
69468        composeMarkdownCore("description", element.getDescriptionElement(), false);
69469        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69470      }
69471      if (element.hasInformationSource()) {
69472        openArray("informationSource");
69473        for (Reference e : element.getInformationSource()) 
69474          composeReference(null, e);
69475        closeArray();
69476      };
69477      if (element.hasNote()) {
69478        openArray("note");
69479        for (Annotation e : element.getNote()) 
69480          composeAnnotation(null, e);
69481        closeArray();
69482      };
69483      if (element.hasManufacturer()) {
69484        openArray("manufacturer");
69485        for (Reference e : element.getManufacturer()) 
69486          composeReference(null, e);
69487        closeArray();
69488      };
69489      if (element.hasSupplier()) {
69490        openArray("supplier");
69491        for (Reference e : element.getSupplier()) 
69492          composeReference(null, e);
69493        closeArray();
69494      };
69495      if (element.hasMoiety()) {
69496        openArray("moiety");
69497        for (SubstanceDefinition.SubstanceDefinitionMoietyComponent e : element.getMoiety()) 
69498          composeSubstanceDefinitionMoietyComponent(null, e);
69499        closeArray();
69500      };
69501      if (element.hasCharacterization()) {
69502        openArray("characterization");
69503        for (SubstanceDefinition.SubstanceDefinitionCharacterizationComponent e : element.getCharacterization()) 
69504          composeSubstanceDefinitionCharacterizationComponent(null, e);
69505        closeArray();
69506      };
69507      if (element.hasProperty()) {
69508        openArray("property");
69509        for (SubstanceDefinition.SubstanceDefinitionPropertyComponent e : element.getProperty()) 
69510          composeSubstanceDefinitionPropertyComponent(null, e);
69511        closeArray();
69512      };
69513      if (element.hasReferenceInformation()) {
69514        composeReference("referenceInformation", element.getReferenceInformation());
69515      }
69516      if (element.hasMolecularWeight()) {
69517        openArray("molecularWeight");
69518        for (SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent e : element.getMolecularWeight()) 
69519          composeSubstanceDefinitionMolecularWeightComponent(null, e);
69520        closeArray();
69521      };
69522      if (element.hasStructure()) {
69523        composeSubstanceDefinitionStructureComponent("structure", element.getStructure());
69524      }
69525      if (element.hasCode()) {
69526        openArray("code");
69527        for (SubstanceDefinition.SubstanceDefinitionCodeComponent e : element.getCode()) 
69528          composeSubstanceDefinitionCodeComponent(null, e);
69529        closeArray();
69530      };
69531      if (element.hasName()) {
69532        openArray("name");
69533        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getName()) 
69534          composeSubstanceDefinitionNameComponent(null, e);
69535        closeArray();
69536      };
69537      if (element.hasRelationship()) {
69538        openArray("relationship");
69539        for (SubstanceDefinition.SubstanceDefinitionRelationshipComponent e : element.getRelationship()) 
69540          composeSubstanceDefinitionRelationshipComponent(null, e);
69541        closeArray();
69542      };
69543      if (element.hasNucleicAcid()) {
69544        composeReference("nucleicAcid", element.getNucleicAcid());
69545      }
69546      if (element.hasPolymer()) {
69547        composeReference("polymer", element.getPolymer());
69548      }
69549      if (element.hasProtein()) {
69550        composeReference("protein", element.getProtein());
69551      }
69552      if (element.hasSourceMaterial()) {
69553        composeSubstanceDefinitionSourceMaterialComponent("sourceMaterial", element.getSourceMaterial());
69554      }
69555  }
69556
69557  protected void composeSubstanceDefinitionMoietyComponent(String name, SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
69558    if (element != null) {
69559      open(name);
69560      composeSubstanceDefinitionMoietyComponentProperties(element);
69561      close();
69562    }
69563  }
69564
69565  protected void composeSubstanceDefinitionMoietyComponentProperties(SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
69566    composeBackboneElementProperties(element);
69567      if (element.hasRole()) {
69568        composeCodeableConcept("role", element.getRole());
69569      }
69570      if (element.hasIdentifier()) {
69571        composeIdentifier("identifier", element.getIdentifier());
69572      }
69573      if (element.hasNameElement()) {
69574        composeStringCore("name", element.getNameElement(), false);
69575        composeStringExtras("name", element.getNameElement(), false);
69576      }
69577      if (element.hasStereochemistry()) {
69578        composeCodeableConcept("stereochemistry", element.getStereochemistry());
69579      }
69580      if (element.hasOpticalActivity()) {
69581        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
69582      }
69583      if (element.hasMolecularFormulaElement()) {
69584        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
69585        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
69586      }
69587      if (element.hasAmount()) {
69588        composeType("amount", element.getAmount());
69589      }
69590      if (element.hasMeasurementType()) {
69591        composeCodeableConcept("measurementType", element.getMeasurementType());
69592      }
69593  }
69594
69595  protected void composeSubstanceDefinitionCharacterizationComponent(String name, SubstanceDefinition.SubstanceDefinitionCharacterizationComponent element) throws IOException {
69596    if (element != null) {
69597      open(name);
69598      composeSubstanceDefinitionCharacterizationComponentProperties(element);
69599      close();
69600    }
69601  }
69602
69603  protected void composeSubstanceDefinitionCharacterizationComponentProperties(SubstanceDefinition.SubstanceDefinitionCharacterizationComponent element) throws IOException {
69604    composeBackboneElementProperties(element);
69605      if (element.hasTechnique()) {
69606        composeCodeableConcept("technique", element.getTechnique());
69607      }
69608      if (element.hasForm()) {
69609        composeCodeableConcept("form", element.getForm());
69610      }
69611      if (element.hasDescriptionElement()) {
69612        composeMarkdownCore("description", element.getDescriptionElement(), false);
69613        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69614      }
69615      if (element.hasFile()) {
69616        openArray("file");
69617        for (Attachment e : element.getFile()) 
69618          composeAttachment(null, e);
69619        closeArray();
69620      };
69621  }
69622
69623  protected void composeSubstanceDefinitionPropertyComponent(String name, SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
69624    if (element != null) {
69625      open(name);
69626      composeSubstanceDefinitionPropertyComponentProperties(element);
69627      close();
69628    }
69629  }
69630
69631  protected void composeSubstanceDefinitionPropertyComponentProperties(SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
69632    composeBackboneElementProperties(element);
69633      if (element.hasType()) {
69634        composeCodeableConcept("type", element.getType());
69635      }
69636      if (element.hasValue()) {
69637        composeType("value", element.getValue());
69638      }
69639  }
69640
69641  protected void composeSubstanceDefinitionMolecularWeightComponent(String name, SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent element) throws IOException {
69642    if (element != null) {
69643      open(name);
69644      composeSubstanceDefinitionMolecularWeightComponentProperties(element);
69645      close();
69646    }
69647  }
69648
69649  protected void composeSubstanceDefinitionMolecularWeightComponentProperties(SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent element) throws IOException {
69650    composeBackboneElementProperties(element);
69651      if (element.hasMethod()) {
69652        composeCodeableConcept("method", element.getMethod());
69653      }
69654      if (element.hasType()) {
69655        composeCodeableConcept("type", element.getType());
69656      }
69657      if (element.hasAmount()) {
69658        composeQuantity("amount", element.getAmount());
69659      }
69660  }
69661
69662  protected void composeSubstanceDefinitionStructureComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
69663    if (element != null) {
69664      open(name);
69665      composeSubstanceDefinitionStructureComponentProperties(element);
69666      close();
69667    }
69668  }
69669
69670  protected void composeSubstanceDefinitionStructureComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
69671    composeBackboneElementProperties(element);
69672      if (element.hasStereochemistry()) {
69673        composeCodeableConcept("stereochemistry", element.getStereochemistry());
69674      }
69675      if (element.hasOpticalActivity()) {
69676        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
69677      }
69678      if (element.hasMolecularFormulaElement()) {
69679        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
69680        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
69681      }
69682      if (element.hasMolecularFormulaByMoietyElement()) {
69683        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
69684        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
69685      }
69686      if (element.hasMolecularWeight()) {
69687        composeSubstanceDefinitionMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
69688      }
69689      if (element.hasTechnique()) {
69690        openArray("technique");
69691        for (CodeableConcept e : element.getTechnique()) 
69692          composeCodeableConcept(null, e);
69693        closeArray();
69694      };
69695      if (element.hasSourceDocument()) {
69696        openArray("sourceDocument");
69697        for (Reference e : element.getSourceDocument()) 
69698          composeReference(null, e);
69699        closeArray();
69700      };
69701      if (element.hasRepresentation()) {
69702        openArray("representation");
69703        for (SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent e : element.getRepresentation()) 
69704          composeSubstanceDefinitionStructureRepresentationComponent(null, e);
69705        closeArray();
69706      };
69707  }
69708
69709  protected void composeSubstanceDefinitionStructureRepresentationComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
69710    if (element != null) {
69711      open(name);
69712      composeSubstanceDefinitionStructureRepresentationComponentProperties(element);
69713      close();
69714    }
69715  }
69716
69717  protected void composeSubstanceDefinitionStructureRepresentationComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
69718    composeBackboneElementProperties(element);
69719      if (element.hasType()) {
69720        composeCodeableConcept("type", element.getType());
69721      }
69722      if (element.hasRepresentationElement()) {
69723        composeStringCore("representation", element.getRepresentationElement(), false);
69724        composeStringExtras("representation", element.getRepresentationElement(), false);
69725      }
69726      if (element.hasFormat()) {
69727        composeCodeableConcept("format", element.getFormat());
69728      }
69729      if (element.hasDocument()) {
69730        composeReference("document", element.getDocument());
69731      }
69732  }
69733
69734  protected void composeSubstanceDefinitionCodeComponent(String name, SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
69735    if (element != null) {
69736      open(name);
69737      composeSubstanceDefinitionCodeComponentProperties(element);
69738      close();
69739    }
69740  }
69741
69742  protected void composeSubstanceDefinitionCodeComponentProperties(SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
69743    composeBackboneElementProperties(element);
69744      if (element.hasCode()) {
69745        composeCodeableConcept("code", element.getCode());
69746      }
69747      if (element.hasStatus()) {
69748        composeCodeableConcept("status", element.getStatus());
69749      }
69750      if (element.hasStatusDateElement()) {
69751        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
69752        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
69753      }
69754      if (element.hasNote()) {
69755        openArray("note");
69756        for (Annotation e : element.getNote()) 
69757          composeAnnotation(null, e);
69758        closeArray();
69759      };
69760      if (element.hasSource()) {
69761        openArray("source");
69762        for (Reference e : element.getSource()) 
69763          composeReference(null, e);
69764        closeArray();
69765      };
69766  }
69767
69768  protected void composeSubstanceDefinitionNameComponent(String name, SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
69769    if (element != null) {
69770      open(name);
69771      composeSubstanceDefinitionNameComponentProperties(element);
69772      close();
69773    }
69774  }
69775
69776  protected void composeSubstanceDefinitionNameComponentProperties(SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
69777    composeBackboneElementProperties(element);
69778      if (element.hasNameElement()) {
69779        composeStringCore("name", element.getNameElement(), false);
69780        composeStringExtras("name", element.getNameElement(), false);
69781      }
69782      if (element.hasType()) {
69783        composeCodeableConcept("type", element.getType());
69784      }
69785      if (element.hasStatus()) {
69786        composeCodeableConcept("status", element.getStatus());
69787      }
69788      if (element.hasPreferredElement()) {
69789        composeBooleanCore("preferred", element.getPreferredElement(), false);
69790        composeBooleanExtras("preferred", element.getPreferredElement(), false);
69791      }
69792      if (element.hasLanguage()) {
69793        openArray("language");
69794        for (CodeableConcept e : element.getLanguage()) 
69795          composeCodeableConcept(null, e);
69796        closeArray();
69797      };
69798      if (element.hasDomain()) {
69799        openArray("domain");
69800        for (CodeableConcept e : element.getDomain()) 
69801          composeCodeableConcept(null, e);
69802        closeArray();
69803      };
69804      if (element.hasJurisdiction()) {
69805        openArray("jurisdiction");
69806        for (CodeableConcept e : element.getJurisdiction()) 
69807          composeCodeableConcept(null, e);
69808        closeArray();
69809      };
69810      if (element.hasSynonym()) {
69811        openArray("synonym");
69812        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getSynonym()) 
69813          composeSubstanceDefinitionNameComponent(null, e);
69814        closeArray();
69815      };
69816      if (element.hasTranslation()) {
69817        openArray("translation");
69818        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getTranslation()) 
69819          composeSubstanceDefinitionNameComponent(null, e);
69820        closeArray();
69821      };
69822      if (element.hasOfficial()) {
69823        openArray("official");
69824        for (SubstanceDefinition.SubstanceDefinitionNameOfficialComponent e : element.getOfficial()) 
69825          composeSubstanceDefinitionNameOfficialComponent(null, e);
69826        closeArray();
69827      };
69828      if (element.hasSource()) {
69829        openArray("source");
69830        for (Reference e : element.getSource()) 
69831          composeReference(null, e);
69832        closeArray();
69833      };
69834  }
69835
69836  protected void composeSubstanceDefinitionNameOfficialComponent(String name, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
69837    if (element != null) {
69838      open(name);
69839      composeSubstanceDefinitionNameOfficialComponentProperties(element);
69840      close();
69841    }
69842  }
69843
69844  protected void composeSubstanceDefinitionNameOfficialComponentProperties(SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
69845    composeBackboneElementProperties(element);
69846      if (element.hasAuthority()) {
69847        composeCodeableConcept("authority", element.getAuthority());
69848      }
69849      if (element.hasStatus()) {
69850        composeCodeableConcept("status", element.getStatus());
69851      }
69852      if (element.hasDateElement()) {
69853        composeDateTimeCore("date", element.getDateElement(), false);
69854        composeDateTimeExtras("date", element.getDateElement(), false);
69855      }
69856  }
69857
69858  protected void composeSubstanceDefinitionRelationshipComponent(String name, SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
69859    if (element != null) {
69860      open(name);
69861      composeSubstanceDefinitionRelationshipComponentProperties(element);
69862      close();
69863    }
69864  }
69865
69866  protected void composeSubstanceDefinitionRelationshipComponentProperties(SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
69867    composeBackboneElementProperties(element);
69868      if (element.hasSubstanceDefinition()) {
69869        composeType("substanceDefinition", element.getSubstanceDefinition());
69870      }
69871      if (element.hasType()) {
69872        composeCodeableConcept("type", element.getType());
69873      }
69874      if (element.hasIsDefiningElement()) {
69875        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
69876        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
69877      }
69878      if (element.hasAmount()) {
69879        composeType("amount", element.getAmount());
69880      }
69881      if (element.hasRatioHighLimitAmount()) {
69882        composeRatio("ratioHighLimitAmount", element.getRatioHighLimitAmount());
69883      }
69884      if (element.hasComparator()) {
69885        composeCodeableConcept("comparator", element.getComparator());
69886      }
69887      if (element.hasSource()) {
69888        openArray("source");
69889        for (Reference e : element.getSource()) 
69890          composeReference(null, e);
69891        closeArray();
69892      };
69893  }
69894
69895  protected void composeSubstanceDefinitionSourceMaterialComponent(String name, SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent element) throws IOException {
69896    if (element != null) {
69897      open(name);
69898      composeSubstanceDefinitionSourceMaterialComponentProperties(element);
69899      close();
69900    }
69901  }
69902
69903  protected void composeSubstanceDefinitionSourceMaterialComponentProperties(SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent element) throws IOException {
69904    composeBackboneElementProperties(element);
69905      if (element.hasType()) {
69906        composeCodeableConcept("type", element.getType());
69907      }
69908      if (element.hasGenus()) {
69909        composeCodeableConcept("genus", element.getGenus());
69910      }
69911      if (element.hasSpecies()) {
69912        composeCodeableConcept("species", element.getSpecies());
69913      }
69914      if (element.hasPart()) {
69915        composeCodeableConcept("part", element.getPart());
69916      }
69917      if (element.hasCountryOfOrigin()) {
69918        openArray("countryOfOrigin");
69919        for (CodeableConcept e : element.getCountryOfOrigin()) 
69920          composeCodeableConcept(null, e);
69921        closeArray();
69922      };
69923  }
69924
69925  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
69926    if (element != null) {
69927      prop("resourceType", name);
69928      composeSubstanceNucleicAcidProperties(element);
69929    }
69930  }
69931
69932  protected void composeSubstanceNucleicAcidProperties(SubstanceNucleicAcid element) throws IOException {
69933    composeDomainResourceProperties(element);
69934      if (element.hasSequenceType()) {
69935        composeCodeableConcept("sequenceType", element.getSequenceType());
69936      }
69937      if (element.hasNumberOfSubunitsElement()) {
69938        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
69939        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
69940      }
69941      if (element.hasAreaOfHybridisationElement()) {
69942        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
69943        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
69944      }
69945      if (element.hasOligoNucleotideType()) {
69946        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
69947      }
69948      if (element.hasSubunit()) {
69949        openArray("subunit");
69950        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
69951          composeSubstanceNucleicAcidSubunitComponent(null, e);
69952        closeArray();
69953      };
69954  }
69955
69956  protected void composeSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
69957    if (element != null) {
69958      open(name);
69959      composeSubstanceNucleicAcidSubunitComponentProperties(element);
69960      close();
69961    }
69962  }
69963
69964  protected void composeSubstanceNucleicAcidSubunitComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
69965    composeBackboneElementProperties(element);
69966      if (element.hasSubunitElement()) {
69967        composeIntegerCore("subunit", element.getSubunitElement(), false);
69968        composeIntegerExtras("subunit", element.getSubunitElement(), false);
69969      }
69970      if (element.hasSequenceElement()) {
69971        composeStringCore("sequence", element.getSequenceElement(), false);
69972        composeStringExtras("sequence", element.getSequenceElement(), false);
69973      }
69974      if (element.hasLengthElement()) {
69975        composeIntegerCore("length", element.getLengthElement(), false);
69976        composeIntegerExtras("length", element.getLengthElement(), false);
69977      }
69978      if (element.hasSequenceAttachment()) {
69979        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
69980      }
69981      if (element.hasFivePrime()) {
69982        composeCodeableConcept("fivePrime", element.getFivePrime());
69983      }
69984      if (element.hasThreePrime()) {
69985        composeCodeableConcept("threePrime", element.getThreePrime());
69986      }
69987      if (element.hasLinkage()) {
69988        openArray("linkage");
69989        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
69990          composeSubstanceNucleicAcidSubunitLinkageComponent(null, e);
69991        closeArray();
69992      };
69993      if (element.hasSugar()) {
69994        openArray("sugar");
69995        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
69996          composeSubstanceNucleicAcidSubunitSugarComponent(null, e);
69997        closeArray();
69998      };
69999  }
70000
70001  protected void composeSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
70002    if (element != null) {
70003      open(name);
70004      composeSubstanceNucleicAcidSubunitLinkageComponentProperties(element);
70005      close();
70006    }
70007  }
70008
70009  protected void composeSubstanceNucleicAcidSubunitLinkageComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
70010    composeBackboneElementProperties(element);
70011      if (element.hasConnectivityElement()) {
70012        composeStringCore("connectivity", element.getConnectivityElement(), false);
70013        composeStringExtras("connectivity", element.getConnectivityElement(), false);
70014      }
70015      if (element.hasIdentifier()) {
70016        composeIdentifier("identifier", element.getIdentifier());
70017      }
70018      if (element.hasNameElement()) {
70019        composeStringCore("name", element.getNameElement(), false);
70020        composeStringExtras("name", element.getNameElement(), false);
70021      }
70022      if (element.hasResidueSiteElement()) {
70023        composeStringCore("residueSite", element.getResidueSiteElement(), false);
70024        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
70025      }
70026  }
70027
70028  protected void composeSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
70029    if (element != null) {
70030      open(name);
70031      composeSubstanceNucleicAcidSubunitSugarComponentProperties(element);
70032      close();
70033    }
70034  }
70035
70036  protected void composeSubstanceNucleicAcidSubunitSugarComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
70037    composeBackboneElementProperties(element);
70038      if (element.hasIdentifier()) {
70039        composeIdentifier("identifier", element.getIdentifier());
70040      }
70041      if (element.hasNameElement()) {
70042        composeStringCore("name", element.getNameElement(), false);
70043        composeStringExtras("name", element.getNameElement(), false);
70044      }
70045      if (element.hasResidueSiteElement()) {
70046        composeStringCore("residueSite", element.getResidueSiteElement(), false);
70047        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
70048      }
70049  }
70050
70051  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
70052    if (element != null) {
70053      prop("resourceType", name);
70054      composeSubstancePolymerProperties(element);
70055    }
70056  }
70057
70058  protected void composeSubstancePolymerProperties(SubstancePolymer element) throws IOException {
70059    composeDomainResourceProperties(element);
70060      if (element.hasIdentifier()) {
70061        composeIdentifier("identifier", element.getIdentifier());
70062      }
70063      if (element.hasClass_()) {
70064        composeCodeableConcept("class", element.getClass_());
70065      }
70066      if (element.hasGeometry()) {
70067        composeCodeableConcept("geometry", element.getGeometry());
70068      }
70069      if (element.hasCopolymerConnectivity()) {
70070        openArray("copolymerConnectivity");
70071        for (CodeableConcept e : element.getCopolymerConnectivity()) 
70072          composeCodeableConcept(null, e);
70073        closeArray();
70074      };
70075      if (element.hasModificationElement()) {
70076        composeStringCore("modification", element.getModificationElement(), false);
70077        composeStringExtras("modification", element.getModificationElement(), false);
70078      }
70079      if (element.hasMonomerSet()) {
70080        openArray("monomerSet");
70081        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
70082          composeSubstancePolymerMonomerSetComponent(null, e);
70083        closeArray();
70084      };
70085      if (element.hasRepeat()) {
70086        openArray("repeat");
70087        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
70088          composeSubstancePolymerRepeatComponent(null, e);
70089        closeArray();
70090      };
70091  }
70092
70093  protected void composeSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
70094    if (element != null) {
70095      open(name);
70096      composeSubstancePolymerMonomerSetComponentProperties(element);
70097      close();
70098    }
70099  }
70100
70101  protected void composeSubstancePolymerMonomerSetComponentProperties(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
70102    composeBackboneElementProperties(element);
70103      if (element.hasRatioType()) {
70104        composeCodeableConcept("ratioType", element.getRatioType());
70105      }
70106      if (element.hasStartingMaterial()) {
70107        openArray("startingMaterial");
70108        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
70109          composeSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
70110        closeArray();
70111      };
70112  }
70113
70114  protected void composeSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
70115    if (element != null) {
70116      open(name);
70117      composeSubstancePolymerMonomerSetStartingMaterialComponentProperties(element);
70118      close();
70119    }
70120  }
70121
70122  protected void composeSubstancePolymerMonomerSetStartingMaterialComponentProperties(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
70123    composeBackboneElementProperties(element);
70124      if (element.hasCode()) {
70125        composeCodeableConcept("code", element.getCode());
70126      }
70127      if (element.hasCategory()) {
70128        composeCodeableConcept("category", element.getCategory());
70129      }
70130      if (element.hasIsDefiningElement()) {
70131        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
70132        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
70133      }
70134      if (element.hasAmount()) {
70135        composeQuantity("amount", element.getAmount());
70136      }
70137  }
70138
70139  protected void composeSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
70140    if (element != null) {
70141      open(name);
70142      composeSubstancePolymerRepeatComponentProperties(element);
70143      close();
70144    }
70145  }
70146
70147  protected void composeSubstancePolymerRepeatComponentProperties(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
70148    composeBackboneElementProperties(element);
70149      if (element.hasAverageMolecularFormulaElement()) {
70150        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
70151        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
70152      }
70153      if (element.hasRepeatUnitAmountType()) {
70154        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
70155      }
70156      if (element.hasRepeatUnit()) {
70157        openArray("repeatUnit");
70158        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
70159          composeSubstancePolymerRepeatRepeatUnitComponent(null, e);
70160        closeArray();
70161      };
70162  }
70163
70164  protected void composeSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
70165    if (element != null) {
70166      open(name);
70167      composeSubstancePolymerRepeatRepeatUnitComponentProperties(element);
70168      close();
70169    }
70170  }
70171
70172  protected void composeSubstancePolymerRepeatRepeatUnitComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
70173    composeBackboneElementProperties(element);
70174      if (element.hasUnitElement()) {
70175        composeStringCore("unit", element.getUnitElement(), false);
70176        composeStringExtras("unit", element.getUnitElement(), false);
70177      }
70178      if (element.hasOrientation()) {
70179        composeCodeableConcept("orientation", element.getOrientation());
70180      }
70181      if (element.hasAmountElement()) {
70182        composeIntegerCore("amount", element.getAmountElement(), false);
70183        composeIntegerExtras("amount", element.getAmountElement(), false);
70184      }
70185      if (element.hasDegreeOfPolymerisation()) {
70186        openArray("degreeOfPolymerisation");
70187        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
70188          composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
70189        closeArray();
70190      };
70191      if (element.hasStructuralRepresentation()) {
70192        openArray("structuralRepresentation");
70193        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
70194          composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
70195        closeArray();
70196      };
70197  }
70198
70199  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
70200    if (element != null) {
70201      open(name);
70202      composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(element);
70203      close();
70204    }
70205  }
70206
70207  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
70208    composeBackboneElementProperties(element);
70209      if (element.hasType()) {
70210        composeCodeableConcept("type", element.getType());
70211      }
70212      if (element.hasAverageElement()) {
70213        composeIntegerCore("average", element.getAverageElement(), false);
70214        composeIntegerExtras("average", element.getAverageElement(), false);
70215      }
70216      if (element.hasLowElement()) {
70217        composeIntegerCore("low", element.getLowElement(), false);
70218        composeIntegerExtras("low", element.getLowElement(), false);
70219      }
70220      if (element.hasHighElement()) {
70221        composeIntegerCore("high", element.getHighElement(), false);
70222        composeIntegerExtras("high", element.getHighElement(), false);
70223      }
70224  }
70225
70226  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
70227    if (element != null) {
70228      open(name);
70229      composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(element);
70230      close();
70231    }
70232  }
70233
70234  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
70235    composeBackboneElementProperties(element);
70236      if (element.hasType()) {
70237        composeCodeableConcept("type", element.getType());
70238      }
70239      if (element.hasRepresentationElement()) {
70240        composeStringCore("representation", element.getRepresentationElement(), false);
70241        composeStringExtras("representation", element.getRepresentationElement(), false);
70242      }
70243      if (element.hasFormat()) {
70244        composeCodeableConcept("format", element.getFormat());
70245      }
70246      if (element.hasAttachment()) {
70247        composeAttachment("attachment", element.getAttachment());
70248      }
70249  }
70250
70251  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
70252    if (element != null) {
70253      prop("resourceType", name);
70254      composeSubstanceProteinProperties(element);
70255    }
70256  }
70257
70258  protected void composeSubstanceProteinProperties(SubstanceProtein element) throws IOException {
70259    composeDomainResourceProperties(element);
70260      if (element.hasSequenceType()) {
70261        composeCodeableConcept("sequenceType", element.getSequenceType());
70262      }
70263      if (element.hasNumberOfSubunitsElement()) {
70264        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
70265        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
70266      }
70267      if (element.hasDisulfideLinkage()) {
70268        if (anyHasValue(element.getDisulfideLinkage())) {
70269          openArray("disulfideLinkage");
70270          for (StringType e : element.getDisulfideLinkage()) 
70271            composeStringCore(null, e, e != element.getDisulfideLinkage().get(element.getDisulfideLinkage().size()-1));
70272          closeArray();
70273        }
70274        if (anyHasExtras(element.getDisulfideLinkage())) {
70275          openArray("_disulfideLinkage");
70276          for (StringType e : element.getDisulfideLinkage()) 
70277            composeStringExtras(null, e, true);
70278          closeArray();
70279        }
70280      };
70281      if (element.hasSubunit()) {
70282        openArray("subunit");
70283        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
70284          composeSubstanceProteinSubunitComponent(null, e);
70285        closeArray();
70286      };
70287  }
70288
70289  protected void composeSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
70290    if (element != null) {
70291      open(name);
70292      composeSubstanceProteinSubunitComponentProperties(element);
70293      close();
70294    }
70295  }
70296
70297  protected void composeSubstanceProteinSubunitComponentProperties(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
70298    composeBackboneElementProperties(element);
70299      if (element.hasSubunitElement()) {
70300        composeIntegerCore("subunit", element.getSubunitElement(), false);
70301        composeIntegerExtras("subunit", element.getSubunitElement(), false);
70302      }
70303      if (element.hasSequenceElement()) {
70304        composeStringCore("sequence", element.getSequenceElement(), false);
70305        composeStringExtras("sequence", element.getSequenceElement(), false);
70306      }
70307      if (element.hasLengthElement()) {
70308        composeIntegerCore("length", element.getLengthElement(), false);
70309        composeIntegerExtras("length", element.getLengthElement(), false);
70310      }
70311      if (element.hasSequenceAttachment()) {
70312        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
70313      }
70314      if (element.hasNTerminalModificationId()) {
70315        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
70316      }
70317      if (element.hasNTerminalModificationElement()) {
70318        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
70319        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
70320      }
70321      if (element.hasCTerminalModificationId()) {
70322        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
70323      }
70324      if (element.hasCTerminalModificationElement()) {
70325        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
70326        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
70327      }
70328  }
70329
70330  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
70331    if (element != null) {
70332      prop("resourceType", name);
70333      composeSubstanceReferenceInformationProperties(element);
70334    }
70335  }
70336
70337  protected void composeSubstanceReferenceInformationProperties(SubstanceReferenceInformation element) throws IOException {
70338    composeDomainResourceProperties(element);
70339      if (element.hasCommentElement()) {
70340        composeStringCore("comment", element.getCommentElement(), false);
70341        composeStringExtras("comment", element.getCommentElement(), false);
70342      }
70343      if (element.hasGene()) {
70344        openArray("gene");
70345        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
70346          composeSubstanceReferenceInformationGeneComponent(null, e);
70347        closeArray();
70348      };
70349      if (element.hasGeneElement()) {
70350        openArray("geneElement");
70351        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
70352          composeSubstanceReferenceInformationGeneElementComponent(null, e);
70353        closeArray();
70354      };
70355      if (element.hasTarget()) {
70356        openArray("target");
70357        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
70358          composeSubstanceReferenceInformationTargetComponent(null, e);
70359        closeArray();
70360      };
70361  }
70362
70363  protected void composeSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
70364    if (element != null) {
70365      open(name);
70366      composeSubstanceReferenceInformationGeneComponentProperties(element);
70367      close();
70368    }
70369  }
70370
70371  protected void composeSubstanceReferenceInformationGeneComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
70372    composeBackboneElementProperties(element);
70373      if (element.hasGeneSequenceOrigin()) {
70374        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
70375      }
70376      if (element.hasGene()) {
70377        composeCodeableConcept("gene", element.getGene());
70378      }
70379      if (element.hasSource()) {
70380        openArray("source");
70381        for (Reference e : element.getSource()) 
70382          composeReference(null, e);
70383        closeArray();
70384      };
70385  }
70386
70387  protected void composeSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
70388    if (element != null) {
70389      open(name);
70390      composeSubstanceReferenceInformationGeneElementComponentProperties(element);
70391      close();
70392    }
70393  }
70394
70395  protected void composeSubstanceReferenceInformationGeneElementComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
70396    composeBackboneElementProperties(element);
70397      if (element.hasType()) {
70398        composeCodeableConcept("type", element.getType());
70399      }
70400      if (element.hasElement()) {
70401        composeIdentifier("element", element.getElement());
70402      }
70403      if (element.hasSource()) {
70404        openArray("source");
70405        for (Reference e : element.getSource()) 
70406          composeReference(null, e);
70407        closeArray();
70408      };
70409  }
70410
70411  protected void composeSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
70412    if (element != null) {
70413      open(name);
70414      composeSubstanceReferenceInformationTargetComponentProperties(element);
70415      close();
70416    }
70417  }
70418
70419  protected void composeSubstanceReferenceInformationTargetComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
70420    composeBackboneElementProperties(element);
70421      if (element.hasTarget()) {
70422        composeIdentifier("target", element.getTarget());
70423      }
70424      if (element.hasType()) {
70425        composeCodeableConcept("type", element.getType());
70426      }
70427      if (element.hasInteraction()) {
70428        composeCodeableConcept("interaction", element.getInteraction());
70429      }
70430      if (element.hasOrganism()) {
70431        composeCodeableConcept("organism", element.getOrganism());
70432      }
70433      if (element.hasOrganismType()) {
70434        composeCodeableConcept("organismType", element.getOrganismType());
70435      }
70436      if (element.hasAmount()) {
70437        composeType("amount", element.getAmount());
70438      }
70439      if (element.hasAmountType()) {
70440        composeCodeableConcept("amountType", element.getAmountType());
70441      }
70442      if (element.hasSource()) {
70443        openArray("source");
70444        for (Reference e : element.getSource()) 
70445          composeReference(null, e);
70446        closeArray();
70447      };
70448  }
70449
70450  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
70451    if (element != null) {
70452      prop("resourceType", name);
70453      composeSubstanceSourceMaterialProperties(element);
70454    }
70455  }
70456
70457  protected void composeSubstanceSourceMaterialProperties(SubstanceSourceMaterial element) throws IOException {
70458    composeDomainResourceProperties(element);
70459      if (element.hasSourceMaterialClass()) {
70460        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
70461      }
70462      if (element.hasSourceMaterialType()) {
70463        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
70464      }
70465      if (element.hasSourceMaterialState()) {
70466        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
70467      }
70468      if (element.hasOrganismId()) {
70469        composeIdentifier("organismId", element.getOrganismId());
70470      }
70471      if (element.hasOrganismNameElement()) {
70472        composeStringCore("organismName", element.getOrganismNameElement(), false);
70473        composeStringExtras("organismName", element.getOrganismNameElement(), false);
70474      }
70475      if (element.hasParentSubstanceId()) {
70476        openArray("parentSubstanceId");
70477        for (Identifier e : element.getParentSubstanceId()) 
70478          composeIdentifier(null, e);
70479        closeArray();
70480      };
70481      if (element.hasParentSubstanceName()) {
70482        if (anyHasValue(element.getParentSubstanceName())) {
70483          openArray("parentSubstanceName");
70484          for (StringType e : element.getParentSubstanceName()) 
70485            composeStringCore(null, e, e != element.getParentSubstanceName().get(element.getParentSubstanceName().size()-1));
70486          closeArray();
70487        }
70488        if (anyHasExtras(element.getParentSubstanceName())) {
70489          openArray("_parentSubstanceName");
70490          for (StringType e : element.getParentSubstanceName()) 
70491            composeStringExtras(null, e, true);
70492          closeArray();
70493        }
70494      };
70495      if (element.hasCountryOfOrigin()) {
70496        openArray("countryOfOrigin");
70497        for (CodeableConcept e : element.getCountryOfOrigin()) 
70498          composeCodeableConcept(null, e);
70499        closeArray();
70500      };
70501      if (element.hasGeographicalLocation()) {
70502        if (anyHasValue(element.getGeographicalLocation())) {
70503          openArray("geographicalLocation");
70504          for (StringType e : element.getGeographicalLocation()) 
70505            composeStringCore(null, e, e != element.getGeographicalLocation().get(element.getGeographicalLocation().size()-1));
70506          closeArray();
70507        }
70508        if (anyHasExtras(element.getGeographicalLocation())) {
70509          openArray("_geographicalLocation");
70510          for (StringType e : element.getGeographicalLocation()) 
70511            composeStringExtras(null, e, true);
70512          closeArray();
70513        }
70514      };
70515      if (element.hasDevelopmentStage()) {
70516        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
70517      }
70518      if (element.hasFractionDescription()) {
70519        openArray("fractionDescription");
70520        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
70521          composeSubstanceSourceMaterialFractionDescriptionComponent(null, e);
70522        closeArray();
70523      };
70524      if (element.hasOrganism()) {
70525        composeSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
70526      }
70527      if (element.hasPartDescription()) {
70528        openArray("partDescription");
70529        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
70530          composeSubstanceSourceMaterialPartDescriptionComponent(null, e);
70531        closeArray();
70532      };
70533  }
70534
70535  protected void composeSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
70536    if (element != null) {
70537      open(name);
70538      composeSubstanceSourceMaterialFractionDescriptionComponentProperties(element);
70539      close();
70540    }
70541  }
70542
70543  protected void composeSubstanceSourceMaterialFractionDescriptionComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
70544    composeBackboneElementProperties(element);
70545      if (element.hasFractionElement()) {
70546        composeStringCore("fraction", element.getFractionElement(), false);
70547        composeStringExtras("fraction", element.getFractionElement(), false);
70548      }
70549      if (element.hasMaterialType()) {
70550        composeCodeableConcept("materialType", element.getMaterialType());
70551      }
70552  }
70553
70554  protected void composeSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
70555    if (element != null) {
70556      open(name);
70557      composeSubstanceSourceMaterialOrganismComponentProperties(element);
70558      close();
70559    }
70560  }
70561
70562  protected void composeSubstanceSourceMaterialOrganismComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
70563    composeBackboneElementProperties(element);
70564      if (element.hasFamily()) {
70565        composeCodeableConcept("family", element.getFamily());
70566      }
70567      if (element.hasGenus()) {
70568        composeCodeableConcept("genus", element.getGenus());
70569      }
70570      if (element.hasSpecies()) {
70571        composeCodeableConcept("species", element.getSpecies());
70572      }
70573      if (element.hasIntraspecificType()) {
70574        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
70575      }
70576      if (element.hasIntraspecificDescriptionElement()) {
70577        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
70578        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
70579      }
70580      if (element.hasAuthor()) {
70581        openArray("author");
70582        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
70583          composeSubstanceSourceMaterialOrganismAuthorComponent(null, e);
70584        closeArray();
70585      };
70586      if (element.hasHybrid()) {
70587        composeSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
70588      }
70589      if (element.hasOrganismGeneral()) {
70590        composeSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
70591      }
70592  }
70593
70594  protected void composeSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
70595    if (element != null) {
70596      open(name);
70597      composeSubstanceSourceMaterialOrganismAuthorComponentProperties(element);
70598      close();
70599    }
70600  }
70601
70602  protected void composeSubstanceSourceMaterialOrganismAuthorComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
70603    composeBackboneElementProperties(element);
70604      if (element.hasAuthorType()) {
70605        composeCodeableConcept("authorType", element.getAuthorType());
70606      }
70607      if (element.hasAuthorDescriptionElement()) {
70608        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
70609        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
70610      }
70611  }
70612
70613  protected void composeSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
70614    if (element != null) {
70615      open(name);
70616      composeSubstanceSourceMaterialOrganismHybridComponentProperties(element);
70617      close();
70618    }
70619  }
70620
70621  protected void composeSubstanceSourceMaterialOrganismHybridComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
70622    composeBackboneElementProperties(element);
70623      if (element.hasMaternalOrganismIdElement()) {
70624        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
70625        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
70626      }
70627      if (element.hasMaternalOrganismNameElement()) {
70628        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
70629        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
70630      }
70631      if (element.hasPaternalOrganismIdElement()) {
70632        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
70633        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
70634      }
70635      if (element.hasPaternalOrganismNameElement()) {
70636        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
70637        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
70638      }
70639      if (element.hasHybridType()) {
70640        composeCodeableConcept("hybridType", element.getHybridType());
70641      }
70642  }
70643
70644  protected void composeSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
70645    if (element != null) {
70646      open(name);
70647      composeSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(element);
70648      close();
70649    }
70650  }
70651
70652  protected void composeSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
70653    composeBackboneElementProperties(element);
70654      if (element.hasKingdom()) {
70655        composeCodeableConcept("kingdom", element.getKingdom());
70656      }
70657      if (element.hasPhylum()) {
70658        composeCodeableConcept("phylum", element.getPhylum());
70659      }
70660      if (element.hasClass_()) {
70661        composeCodeableConcept("class", element.getClass_());
70662      }
70663      if (element.hasOrder()) {
70664        composeCodeableConcept("order", element.getOrder());
70665      }
70666  }
70667
70668  protected void composeSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
70669    if (element != null) {
70670      open(name);
70671      composeSubstanceSourceMaterialPartDescriptionComponentProperties(element);
70672      close();
70673    }
70674  }
70675
70676  protected void composeSubstanceSourceMaterialPartDescriptionComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
70677    composeBackboneElementProperties(element);
70678      if (element.hasPart()) {
70679        composeCodeableConcept("part", element.getPart());
70680      }
70681      if (element.hasPartLocation()) {
70682        composeCodeableConcept("partLocation", element.getPartLocation());
70683      }
70684  }
70685
70686  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
70687    if (element != null) {
70688      prop("resourceType", name);
70689      composeSupplyDeliveryProperties(element);
70690    }
70691  }
70692
70693  protected void composeSupplyDeliveryProperties(SupplyDelivery element) throws IOException {
70694    composeDomainResourceProperties(element);
70695      if (element.hasIdentifier()) {
70696        openArray("identifier");
70697        for (Identifier e : element.getIdentifier()) 
70698          composeIdentifier(null, e);
70699        closeArray();
70700      };
70701      if (element.hasBasedOn()) {
70702        openArray("basedOn");
70703        for (Reference e : element.getBasedOn()) 
70704          composeReference(null, e);
70705        closeArray();
70706      };
70707      if (element.hasPartOf()) {
70708        openArray("partOf");
70709        for (Reference e : element.getPartOf()) 
70710          composeReference(null, e);
70711        closeArray();
70712      };
70713      if (element.hasStatusElement()) {
70714        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
70715        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
70716      }
70717      if (element.hasPatient()) {
70718        composeReference("patient", element.getPatient());
70719      }
70720      if (element.hasType()) {
70721        composeCodeableConcept("type", element.getType());
70722      }
70723      if (element.hasSuppliedItem()) {
70724        openArray("suppliedItem");
70725        for (SupplyDelivery.SupplyDeliverySuppliedItemComponent e : element.getSuppliedItem()) 
70726          composeSupplyDeliverySuppliedItemComponent(null, e);
70727        closeArray();
70728      };
70729      if (element.hasOccurrence()) {
70730        composeType("occurrence", element.getOccurrence());
70731      }
70732      if (element.hasSupplier()) {
70733        composeReference("supplier", element.getSupplier());
70734      }
70735      if (element.hasDestination()) {
70736        composeReference("destination", element.getDestination());
70737      }
70738      if (element.hasReceiver()) {
70739        openArray("receiver");
70740        for (Reference e : element.getReceiver()) 
70741          composeReference(null, e);
70742        closeArray();
70743      };
70744  }
70745
70746  protected void composeSupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
70747    if (element != null) {
70748      open(name);
70749      composeSupplyDeliverySuppliedItemComponentProperties(element);
70750      close();
70751    }
70752  }
70753
70754  protected void composeSupplyDeliverySuppliedItemComponentProperties(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
70755    composeBackboneElementProperties(element);
70756      if (element.hasQuantity()) {
70757        composeQuantity("quantity", element.getQuantity());
70758      }
70759      if (element.hasItem()) {
70760        composeType("item", element.getItem());
70761      }
70762  }
70763
70764  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
70765    if (element != null) {
70766      prop("resourceType", name);
70767      composeSupplyRequestProperties(element);
70768    }
70769  }
70770
70771  protected void composeSupplyRequestProperties(SupplyRequest element) throws IOException {
70772    composeDomainResourceProperties(element);
70773      if (element.hasIdentifier()) {
70774        openArray("identifier");
70775        for (Identifier e : element.getIdentifier()) 
70776          composeIdentifier(null, e);
70777        closeArray();
70778      };
70779      if (element.hasStatusElement()) {
70780        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
70781        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
70782      }
70783      if (element.hasBasedOn()) {
70784        openArray("basedOn");
70785        for (Reference e : element.getBasedOn()) 
70786          composeReference(null, e);
70787        closeArray();
70788      };
70789      if (element.hasCategory()) {
70790        composeCodeableConcept("category", element.getCategory());
70791      }
70792      if (element.hasPriorityElement()) {
70793        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70794        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70795      }
70796      if (element.hasDeliverFor()) {
70797        composeReference("deliverFor", element.getDeliverFor());
70798      }
70799      if (element.hasItem()) {
70800        composeCodeableReference("item", element.getItem());
70801      }
70802      if (element.hasQuantity()) {
70803        composeQuantity("quantity", element.getQuantity());
70804      }
70805      if (element.hasParameter()) {
70806        openArray("parameter");
70807        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
70808          composeSupplyRequestParameterComponent(null, e);
70809        closeArray();
70810      };
70811      if (element.hasOccurrence()) {
70812        composeType("occurrence", element.getOccurrence());
70813      }
70814      if (element.hasAuthoredOnElement()) {
70815        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
70816        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
70817      }
70818      if (element.hasRequester()) {
70819        composeReference("requester", element.getRequester());
70820      }
70821      if (element.hasSupplier()) {
70822        openArray("supplier");
70823        for (Reference e : element.getSupplier()) 
70824          composeReference(null, e);
70825        closeArray();
70826      };
70827      if (element.hasReason()) {
70828        openArray("reason");
70829        for (CodeableReference e : element.getReason()) 
70830          composeCodeableReference(null, e);
70831        closeArray();
70832      };
70833      if (element.hasDeliverFrom()) {
70834        composeReference("deliverFrom", element.getDeliverFrom());
70835      }
70836      if (element.hasDeliverTo()) {
70837        composeReference("deliverTo", element.getDeliverTo());
70838      }
70839  }
70840
70841  protected void composeSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
70842    if (element != null) {
70843      open(name);
70844      composeSupplyRequestParameterComponentProperties(element);
70845      close();
70846    }
70847  }
70848
70849  protected void composeSupplyRequestParameterComponentProperties(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
70850    composeBackboneElementProperties(element);
70851      if (element.hasCode()) {
70852        composeCodeableConcept("code", element.getCode());
70853      }
70854      if (element.hasValue()) {
70855        composeType("value", element.getValue());
70856      }
70857  }
70858
70859  protected void composeTask(String name, Task element) throws IOException {
70860    if (element != null) {
70861      prop("resourceType", name);
70862      composeTaskProperties(element);
70863    }
70864  }
70865
70866  protected void composeTaskProperties(Task element) throws IOException {
70867    composeDomainResourceProperties(element);
70868      if (element.hasIdentifier()) {
70869        openArray("identifier");
70870        for (Identifier e : element.getIdentifier()) 
70871          composeIdentifier(null, e);
70872        closeArray();
70873      };
70874      if (element.hasInstantiatesCanonicalElement()) {
70875        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
70876        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
70877      }
70878      if (element.hasInstantiatesUriElement()) {
70879        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
70880        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
70881      }
70882      if (element.hasBasedOn()) {
70883        openArray("basedOn");
70884        for (Reference e : element.getBasedOn()) 
70885          composeReference(null, e);
70886        closeArray();
70887      };
70888      if (element.hasGroupIdentifier()) {
70889        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
70890      }
70891      if (element.hasPartOf()) {
70892        openArray("partOf");
70893        for (Reference e : element.getPartOf()) 
70894          composeReference(null, e);
70895        closeArray();
70896      };
70897      if (element.hasStatusElement()) {
70898        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
70899        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
70900      }
70901      if (element.hasStatusReason()) {
70902        composeCodeableReference("statusReason", element.getStatusReason());
70903      }
70904      if (element.hasBusinessStatus()) {
70905        composeCodeableConcept("businessStatus", element.getBusinessStatus());
70906      }
70907      if (element.hasIntentElement()) {
70908        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
70909        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
70910      }
70911      if (element.hasPriorityElement()) {
70912        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70913        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70914      }
70915      if (element.hasDoNotPerformElement()) {
70916        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
70917        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
70918      }
70919      if (element.hasCode()) {
70920        composeCodeableConcept("code", element.getCode());
70921      }
70922      if (element.hasDescriptionElement()) {
70923        composeStringCore("description", element.getDescriptionElement(), false);
70924        composeStringExtras("description", element.getDescriptionElement(), false);
70925      }
70926      if (element.hasFocus()) {
70927        composeReference("focus", element.getFocus());
70928      }
70929      if (element.hasFor()) {
70930        composeReference("for", element.getFor());
70931      }
70932      if (element.hasEncounter()) {
70933        composeReference("encounter", element.getEncounter());
70934      }
70935      if (element.hasRequestedPeriod()) {
70936        composePeriod("requestedPeriod", element.getRequestedPeriod());
70937      }
70938      if (element.hasExecutionPeriod()) {
70939        composePeriod("executionPeriod", element.getExecutionPeriod());
70940      }
70941      if (element.hasAuthoredOnElement()) {
70942        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
70943        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
70944      }
70945      if (element.hasLastModifiedElement()) {
70946        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
70947        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
70948      }
70949      if (element.hasRequester()) {
70950        composeReference("requester", element.getRequester());
70951      }
70952      if (element.hasRequestedPerformer()) {
70953        openArray("requestedPerformer");
70954        for (CodeableReference e : element.getRequestedPerformer()) 
70955          composeCodeableReference(null, e);
70956        closeArray();
70957      };
70958      if (element.hasOwner()) {
70959        composeReference("owner", element.getOwner());
70960      }
70961      if (element.hasPerformer()) {
70962        openArray("performer");
70963        for (Task.TaskPerformerComponent e : element.getPerformer()) 
70964          composeTaskPerformerComponent(null, e);
70965        closeArray();
70966      };
70967      if (element.hasLocation()) {
70968        composeReference("location", element.getLocation());
70969      }
70970      if (element.hasReason()) {
70971        openArray("reason");
70972        for (CodeableReference e : element.getReason()) 
70973          composeCodeableReference(null, e);
70974        closeArray();
70975      };
70976      if (element.hasInsurance()) {
70977        openArray("insurance");
70978        for (Reference e : element.getInsurance()) 
70979          composeReference(null, e);
70980        closeArray();
70981      };
70982      if (element.hasNote()) {
70983        openArray("note");
70984        for (Annotation e : element.getNote()) 
70985          composeAnnotation(null, e);
70986        closeArray();
70987      };
70988      if (element.hasRelevantHistory()) {
70989        openArray("relevantHistory");
70990        for (Reference e : element.getRelevantHistory()) 
70991          composeReference(null, e);
70992        closeArray();
70993      };
70994      if (element.hasRestriction()) {
70995        composeTaskRestrictionComponent("restriction", element.getRestriction());
70996      }
70997      if (element.hasInput()) {
70998        openArray("input");
70999        for (Task.TaskInputComponent e : element.getInput()) 
71000          composeTaskInputComponent(null, e);
71001        closeArray();
71002      };
71003      if (element.hasOutput()) {
71004        openArray("output");
71005        for (Task.TaskOutputComponent e : element.getOutput()) 
71006          composeTaskOutputComponent(null, e);
71007        closeArray();
71008      };
71009  }
71010
71011  protected void composeTaskPerformerComponent(String name, Task.TaskPerformerComponent element) throws IOException {
71012    if (element != null) {
71013      open(name);
71014      composeTaskPerformerComponentProperties(element);
71015      close();
71016    }
71017  }
71018
71019  protected void composeTaskPerformerComponentProperties(Task.TaskPerformerComponent element) throws IOException {
71020    composeBackboneElementProperties(element);
71021      if (element.hasFunction()) {
71022        composeCodeableConcept("function", element.getFunction());
71023      }
71024      if (element.hasActor()) {
71025        composeReference("actor", element.getActor());
71026      }
71027  }
71028
71029  protected void composeTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
71030    if (element != null) {
71031      open(name);
71032      composeTaskRestrictionComponentProperties(element);
71033      close();
71034    }
71035  }
71036
71037  protected void composeTaskRestrictionComponentProperties(Task.TaskRestrictionComponent element) throws IOException {
71038    composeBackboneElementProperties(element);
71039      if (element.hasRepetitionsElement()) {
71040        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
71041        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
71042      }
71043      if (element.hasPeriod()) {
71044        composePeriod("period", element.getPeriod());
71045      }
71046      if (element.hasRecipient()) {
71047        openArray("recipient");
71048        for (Reference e : element.getRecipient()) 
71049          composeReference(null, e);
71050        closeArray();
71051      };
71052  }
71053
71054  protected void composeTaskInputComponent(String name, Task.TaskInputComponent element) throws IOException {
71055    if (element != null) {
71056      open(name);
71057      composeTaskInputComponentProperties(element);
71058      close();
71059    }
71060  }
71061
71062  protected void composeTaskInputComponentProperties(Task.TaskInputComponent element) throws IOException {
71063    composeBackboneElementProperties(element);
71064      if (element.hasType()) {
71065        composeCodeableConcept("type", element.getType());
71066      }
71067      if (element.hasValue()) {
71068        composeType("value", element.getValue());
71069      }
71070  }
71071
71072  protected void composeTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
71073    if (element != null) {
71074      open(name);
71075      composeTaskOutputComponentProperties(element);
71076      close();
71077    }
71078  }
71079
71080  protected void composeTaskOutputComponentProperties(Task.TaskOutputComponent element) throws IOException {
71081    composeBackboneElementProperties(element);
71082      if (element.hasType()) {
71083        composeCodeableConcept("type", element.getType());
71084      }
71085      if (element.hasValue()) {
71086        composeType("value", element.getValue());
71087      }
71088  }
71089
71090  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
71091    if (element != null) {
71092      prop("resourceType", name);
71093      composeTerminologyCapabilitiesProperties(element);
71094    }
71095  }
71096
71097  protected void composeTerminologyCapabilitiesProperties(TerminologyCapabilities element) throws IOException {
71098    composeCanonicalResourceProperties(element);
71099      if (element.hasUrlElement()) {
71100        composeUriCore("url", element.getUrlElement(), false);
71101        composeUriExtras("url", element.getUrlElement(), false);
71102      }
71103      if (element.hasIdentifier()) {
71104        openArray("identifier");
71105        for (Identifier e : element.getIdentifier()) 
71106          composeIdentifier(null, e);
71107        closeArray();
71108      };
71109      if (element.hasVersionElement()) {
71110        composeStringCore("version", element.getVersionElement(), false);
71111        composeStringExtras("version", element.getVersionElement(), false);
71112      }
71113      if (element.hasVersionAlgorithm()) {
71114        composeType("versionAlgorithm", element.getVersionAlgorithm());
71115      }
71116      if (element.hasNameElement()) {
71117        composeStringCore("name", element.getNameElement(), false);
71118        composeStringExtras("name", element.getNameElement(), false);
71119      }
71120      if (element.hasTitleElement()) {
71121        composeStringCore("title", element.getTitleElement(), false);
71122        composeStringExtras("title", element.getTitleElement(), false);
71123      }
71124      if (element.hasStatusElement()) {
71125        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71126        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71127      }
71128      if (element.hasExperimentalElement()) {
71129        composeBooleanCore("experimental", element.getExperimentalElement(), false);
71130        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
71131      }
71132      if (element.hasDateElement()) {
71133        composeDateTimeCore("date", element.getDateElement(), false);
71134        composeDateTimeExtras("date", element.getDateElement(), false);
71135      }
71136      if (element.hasPublisherElement()) {
71137        composeStringCore("publisher", element.getPublisherElement(), false);
71138        composeStringExtras("publisher", element.getPublisherElement(), false);
71139      }
71140      if (element.hasContact()) {
71141        openArray("contact");
71142        for (ContactDetail e : element.getContact()) 
71143          composeContactDetail(null, e);
71144        closeArray();
71145      };
71146      if (element.hasDescriptionElement()) {
71147        composeMarkdownCore("description", element.getDescriptionElement(), false);
71148        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71149      }
71150      if (element.hasUseContext()) {
71151        openArray("useContext");
71152        for (UsageContext e : element.getUseContext()) 
71153          composeUsageContext(null, e);
71154        closeArray();
71155      };
71156      if (element.hasJurisdiction()) {
71157        openArray("jurisdiction");
71158        for (CodeableConcept e : element.getJurisdiction()) 
71159          composeCodeableConcept(null, e);
71160        closeArray();
71161      };
71162      if (element.hasPurposeElement()) {
71163        composeMarkdownCore("purpose", element.getPurposeElement(), false);
71164        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
71165      }
71166      if (element.hasCopyrightElement()) {
71167        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
71168        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
71169      }
71170      if (element.hasCopyrightLabelElement()) {
71171        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
71172        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
71173      }
71174      if (element.hasKindElement()) {
71175        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
71176        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
71177      }
71178      if (element.hasSoftware()) {
71179        composeTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
71180      }
71181      if (element.hasImplementation()) {
71182        composeTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
71183      }
71184      if (element.hasLockedDateElement()) {
71185        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
71186        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
71187      }
71188      if (element.hasCodeSystem()) {
71189        openArray("codeSystem");
71190        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
71191          composeTerminologyCapabilitiesCodeSystemComponent(null, e);
71192        closeArray();
71193      };
71194      if (element.hasExpansion()) {
71195        composeTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
71196      }
71197      if (element.hasCodeSearchElement()) {
71198        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
71199        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
71200      }
71201      if (element.hasValidateCode()) {
71202        composeTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
71203      }
71204      if (element.hasTranslation()) {
71205        composeTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
71206      }
71207      if (element.hasClosure()) {
71208        composeTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
71209      }
71210  }
71211
71212  protected void composeTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
71213    if (element != null) {
71214      open(name);
71215      composeTerminologyCapabilitiesSoftwareComponentProperties(element);
71216      close();
71217    }
71218  }
71219
71220  protected void composeTerminologyCapabilitiesSoftwareComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
71221    composeBackboneElementProperties(element);
71222      if (element.hasNameElement()) {
71223        composeStringCore("name", element.getNameElement(), false);
71224        composeStringExtras("name", element.getNameElement(), false);
71225      }
71226      if (element.hasVersionElement()) {
71227        composeStringCore("version", element.getVersionElement(), false);
71228        composeStringExtras("version", element.getVersionElement(), false);
71229      }
71230  }
71231
71232  protected void composeTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
71233    if (element != null) {
71234      open(name);
71235      composeTerminologyCapabilitiesImplementationComponentProperties(element);
71236      close();
71237    }
71238  }
71239
71240  protected void composeTerminologyCapabilitiesImplementationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
71241    composeBackboneElementProperties(element);
71242      if (element.hasDescriptionElement()) {
71243        composeStringCore("description", element.getDescriptionElement(), false);
71244        composeStringExtras("description", element.getDescriptionElement(), false);
71245      }
71246      if (element.hasUrlElement()) {
71247        composeUrlCore("url", element.getUrlElement(), false);
71248        composeUrlExtras("url", element.getUrlElement(), false);
71249      }
71250  }
71251
71252  protected void composeTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
71253    if (element != null) {
71254      open(name);
71255      composeTerminologyCapabilitiesCodeSystemComponentProperties(element);
71256      close();
71257    }
71258  }
71259
71260  protected void composeTerminologyCapabilitiesCodeSystemComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
71261    composeBackboneElementProperties(element);
71262      if (element.hasUriElement()) {
71263        composeCanonicalCore("uri", element.getUriElement(), false);
71264        composeCanonicalExtras("uri", element.getUriElement(), false);
71265      }
71266      if (element.hasVersion()) {
71267        openArray("version");
71268        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
71269          composeTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
71270        closeArray();
71271      };
71272      if (element.hasContentElement()) {
71273        composeEnumerationCore("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
71274        composeEnumerationExtras("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
71275      }
71276      if (element.hasSubsumptionElement()) {
71277        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
71278        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
71279      }
71280  }
71281
71282  protected void composeTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
71283    if (element != null) {
71284      open(name);
71285      composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(element);
71286      close();
71287    }
71288  }
71289
71290  protected void composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
71291    composeBackboneElementProperties(element);
71292      if (element.hasCodeElement()) {
71293        composeStringCore("code", element.getCodeElement(), false);
71294        composeStringExtras("code", element.getCodeElement(), false);
71295      }
71296      if (element.hasIsDefaultElement()) {
71297        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
71298        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
71299      }
71300      if (element.hasCompositionalElement()) {
71301        composeBooleanCore("compositional", element.getCompositionalElement(), false);
71302        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
71303      }
71304      if (element.hasLanguage()) {
71305        openArray("language");
71306        for (Enumeration<Enumerations.CommonLanguages> e : element.getLanguage()) 
71307          composeEnumerationCore(null, e, new Enumerations.CommonLanguagesEnumFactory(), true);
71308        closeArray();
71309        if (anyHasExtras(element.getLanguage())) {
71310          openArray("_language");
71311          for (Enumeration<Enumerations.CommonLanguages> e : element.getLanguage()) 
71312            composeEnumerationExtras(null, e, new Enumerations.CommonLanguagesEnumFactory(), true);
71313          closeArray();
71314        }
71315      };
71316      if (element.hasFilter()) {
71317        openArray("filter");
71318        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
71319          composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
71320        closeArray();
71321      };
71322      if (element.hasProperty()) {
71323        if (anyHasValue(element.getProperty())) {
71324          openArray("property");
71325          for (CodeType e : element.getProperty()) 
71326            composeCodeCore(null, e, e != element.getProperty().get(element.getProperty().size()-1));
71327          closeArray();
71328        }
71329        if (anyHasExtras(element.getProperty())) {
71330          openArray("_property");
71331          for (CodeType e : element.getProperty()) 
71332            composeCodeExtras(null, e, true);
71333          closeArray();
71334        }
71335      };
71336  }
71337
71338  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
71339    if (element != null) {
71340      open(name);
71341      composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(element);
71342      close();
71343    }
71344  }
71345
71346  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
71347    composeBackboneElementProperties(element);
71348      if (element.hasCodeElement()) {
71349        composeCodeCore("code", element.getCodeElement(), false);
71350        composeCodeExtras("code", element.getCodeElement(), false);
71351      }
71352      if (element.hasOp()) {
71353        if (anyHasValue(element.getOp())) {
71354          openArray("op");
71355          for (CodeType e : element.getOp()) 
71356            composeCodeCore(null, e, e != element.getOp().get(element.getOp().size()-1));
71357          closeArray();
71358        }
71359        if (anyHasExtras(element.getOp())) {
71360          openArray("_op");
71361          for (CodeType e : element.getOp()) 
71362            composeCodeExtras(null, e, true);
71363          closeArray();
71364        }
71365      };
71366  }
71367
71368  protected void composeTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
71369    if (element != null) {
71370      open(name);
71371      composeTerminologyCapabilitiesExpansionComponentProperties(element);
71372      close();
71373    }
71374  }
71375
71376  protected void composeTerminologyCapabilitiesExpansionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
71377    composeBackboneElementProperties(element);
71378      if (element.hasHierarchicalElement()) {
71379        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
71380        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
71381      }
71382      if (element.hasPagingElement()) {
71383        composeBooleanCore("paging", element.getPagingElement(), false);
71384        composeBooleanExtras("paging", element.getPagingElement(), false);
71385      }
71386      if (element.hasIncompleteElement()) {
71387        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
71388        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
71389      }
71390      if (element.hasParameter()) {
71391        openArray("parameter");
71392        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
71393          composeTerminologyCapabilitiesExpansionParameterComponent(null, e);
71394        closeArray();
71395      };
71396      if (element.hasTextFilterElement()) {
71397        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
71398        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
71399      }
71400  }
71401
71402  protected void composeTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
71403    if (element != null) {
71404      open(name);
71405      composeTerminologyCapabilitiesExpansionParameterComponentProperties(element);
71406      close();
71407    }
71408  }
71409
71410  protected void composeTerminologyCapabilitiesExpansionParameterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
71411    composeBackboneElementProperties(element);
71412      if (element.hasNameElement()) {
71413        composeCodeCore("name", element.getNameElement(), false);
71414        composeCodeExtras("name", element.getNameElement(), false);
71415      }
71416      if (element.hasDocumentationElement()) {
71417        composeStringCore("documentation", element.getDocumentationElement(), false);
71418        composeStringExtras("documentation", element.getDocumentationElement(), false);
71419      }
71420  }
71421
71422  protected void composeTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
71423    if (element != null) {
71424      open(name);
71425      composeTerminologyCapabilitiesValidateCodeComponentProperties(element);
71426      close();
71427    }
71428  }
71429
71430  protected void composeTerminologyCapabilitiesValidateCodeComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
71431    composeBackboneElementProperties(element);
71432      if (element.hasTranslationsElement()) {
71433        composeBooleanCore("translations", element.getTranslationsElement(), false);
71434        composeBooleanExtras("translations", element.getTranslationsElement(), false);
71435      }
71436  }
71437
71438  protected void composeTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
71439    if (element != null) {
71440      open(name);
71441      composeTerminologyCapabilitiesTranslationComponentProperties(element);
71442      close();
71443    }
71444  }
71445
71446  protected void composeTerminologyCapabilitiesTranslationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
71447    composeBackboneElementProperties(element);
71448      if (element.hasNeedsMapElement()) {
71449        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
71450        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
71451      }
71452  }
71453
71454  protected void composeTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
71455    if (element != null) {
71456      open(name);
71457      composeTerminologyCapabilitiesClosureComponentProperties(element);
71458      close();
71459    }
71460  }
71461
71462  protected void composeTerminologyCapabilitiesClosureComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
71463    composeBackboneElementProperties(element);
71464      if (element.hasTranslationElement()) {
71465        composeBooleanCore("translation", element.getTranslationElement(), false);
71466        composeBooleanExtras("translation", element.getTranslationElement(), false);
71467      }
71468  }
71469
71470  protected void composeTestPlan(String name, TestPlan element) throws IOException {
71471    if (element != null) {
71472      prop("resourceType", name);
71473      composeTestPlanProperties(element);
71474    }
71475  }
71476
71477  protected void composeTestPlanProperties(TestPlan element) throws IOException {
71478    composeCanonicalResourceProperties(element);
71479      if (element.hasUrlElement()) {
71480        composeUriCore("url", element.getUrlElement(), false);
71481        composeUriExtras("url", element.getUrlElement(), false);
71482      }
71483      if (element.hasIdentifier()) {
71484        openArray("identifier");
71485        for (Identifier e : element.getIdentifier()) 
71486          composeIdentifier(null, e);
71487        closeArray();
71488      };
71489      if (element.hasVersionElement()) {
71490        composeStringCore("version", element.getVersionElement(), false);
71491        composeStringExtras("version", element.getVersionElement(), false);
71492        }
71493      if (element.hasVersionAlgorithm()) {
71494        composeType("versionAlgorithm", element.getVersionAlgorithm());
71495      }
71496      if (element.hasNameElement()) {
71497        composeStringCore("name", element.getNameElement(), false);
71498        composeStringExtras("name", element.getNameElement(), false);
71499        }
71500      if (element.hasTitleElement()) {
71501        composeStringCore("title", element.getTitleElement(), false);
71502        composeStringExtras("title", element.getTitleElement(), false);
71503      }
71504      if (element.hasStatusElement()) {
71505        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71506        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71507      }
71508      if (element.hasExperimentalElement()) {
71509        composeBooleanCore("experimental", element.getExperimentalElement(), false);
71510        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
71511      }
71512      if (element.hasDateElement()) {
71513        composeDateTimeCore("date", element.getDateElement(), false);
71514        composeDateTimeExtras("date", element.getDateElement(), false);
71515      }
71516      if (element.hasPublisherElement()) {
71517        composeStringCore("publisher", element.getPublisherElement(), false);
71518        composeStringExtras("publisher", element.getPublisherElement(), false);
71519        }
71520      if (element.hasContact()) {
71521        openArray("contact");
71522        for (ContactDetail e : element.getContact()) 
71523          composeContactDetail(null, e);
71524        closeArray();
71525      };
71526      if (element.hasDescriptionElement()) {
71527        composeMarkdownCore("description", element.getDescriptionElement(), false);
71528        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71529      }
71530      if (element.hasUseContext()) {
71531        openArray("useContext");
71532        for (UsageContext e : element.getUseContext()) 
71533          composeUsageContext(null, e);
71534        closeArray();
71535      };
71536      if (element.hasJurisdiction()) {
71537        openArray("jurisdiction");
71538        for (CodeableConcept e : element.getJurisdiction()) 
71539          composeCodeableConcept(null, e);
71540        closeArray();
71541      };
71542      if (element.hasPurposeElement()) {
71543        composeMarkdownCore("purpose", element.getPurposeElement(), false);
71544        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
71545      }
71546      if (element.hasCopyrightElement()) {
71547        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
71548        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
71549      }
71550      if (element.hasCopyrightLabelElement()) {
71551        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
71552        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
71553      }
71554      if (element.hasCategory()) {
71555        openArray("category");
71556        for (CodeableConcept e : element.getCategory()) 
71557          composeCodeableConcept(null, e);
71558        closeArray();
71559      };
71560      if (element.hasScope()) {
71561        openArray("scope");
71562        for (Reference e : element.getScope()) 
71563          composeReference(null, e);
71564        closeArray();
71565      };
71566      if (element.hasTestToolsElement()) {
71567        composeMarkdownCore("testTools", element.getTestToolsElement(), false);
71568        composeMarkdownExtras("testTools", element.getTestToolsElement(), false);
71569      }
71570      if (element.hasDependency()) {
71571        openArray("dependency");
71572        for (TestPlan.TestPlanDependencyComponent e : element.getDependency()) 
71573          composeTestPlanDependencyComponent(null, e);
71574        closeArray();
71575      };
71576      if (element.hasExitCriteriaElement()) {
71577        composeMarkdownCore("exitCriteria", element.getExitCriteriaElement(), false);
71578        composeMarkdownExtras("exitCriteria", element.getExitCriteriaElement(), false);
71579      }
71580      if (element.hasTestCase()) {
71581        openArray("testCase");
71582        for (TestPlan.TestPlanTestCaseComponent e : element.getTestCase()) 
71583          composeTestPlanTestCaseComponent(null, e);
71584        closeArray();
71585      };
71586  }
71587
71588  protected void composeTestPlanDependencyComponent(String name, TestPlan.TestPlanDependencyComponent element) throws IOException {
71589    if (element != null) {
71590      open(name);
71591      composeTestPlanDependencyComponentProperties(element);
71592      close();
71593    }
71594  }
71595
71596  protected void composeTestPlanDependencyComponentProperties(TestPlan.TestPlanDependencyComponent element) throws IOException {
71597    composeBackboneElementProperties(element);
71598      if (element.hasDescriptionElement()) {
71599        composeMarkdownCore("description", element.getDescriptionElement(), false);
71600        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71601      }
71602      if (element.hasPredecessor()) {
71603        composeReference("predecessor", element.getPredecessor());
71604      }
71605  }
71606
71607  protected void composeTestPlanTestCaseComponent(String name, TestPlan.TestPlanTestCaseComponent element) throws IOException {
71608    if (element != null) {
71609      open(name);
71610      composeTestPlanTestCaseComponentProperties(element);
71611      close();
71612    }
71613  }
71614
71615  protected void composeTestPlanTestCaseComponentProperties(TestPlan.TestPlanTestCaseComponent element) throws IOException {
71616    composeBackboneElementProperties(element);
71617      if (element.hasSequenceElement()) {
71618        composeIntegerCore("sequence", element.getSequenceElement(), false);
71619        composeIntegerExtras("sequence", element.getSequenceElement(), false);
71620      }
71621      if (element.hasScope()) {
71622        openArray("scope");
71623        for (Reference e : element.getScope()) 
71624          composeReference(null, e);
71625        closeArray();
71626      };
71627      if (element.hasDependency()) {
71628        openArray("dependency");
71629        for (TestPlan.TestCaseDependencyComponent e : element.getDependency()) 
71630          composeTestCaseDependencyComponent(null, e);
71631        closeArray();
71632      };
71633      if (element.hasTestRun()) {
71634        openArray("testRun");
71635        for (TestPlan.TestPlanTestCaseTestRunComponent e : element.getTestRun()) 
71636          composeTestPlanTestCaseTestRunComponent(null, e);
71637        closeArray();
71638      };
71639      if (element.hasTestData()) {
71640        openArray("testData");
71641        for (TestPlan.TestPlanTestCaseTestDataComponent e : element.getTestData()) 
71642          composeTestPlanTestCaseTestDataComponent(null, e);
71643        closeArray();
71644      };
71645      if (element.hasAssertion()) {
71646        openArray("assertion");
71647        for (TestPlan.TestPlanTestCaseAssertionComponent e : element.getAssertion()) 
71648          composeTestPlanTestCaseAssertionComponent(null, e);
71649        closeArray();
71650      };
71651  }
71652
71653  protected void composeTestCaseDependencyComponent(String name, TestPlan.TestCaseDependencyComponent element) throws IOException {
71654    if (element != null) {
71655      open(name);
71656      composeTestCaseDependencyComponentProperties(element);
71657      close();
71658    }
71659  }
71660
71661  protected void composeTestCaseDependencyComponentProperties(TestPlan.TestCaseDependencyComponent element) throws IOException {
71662    composeBackboneElementProperties(element);
71663      if (element.hasDescriptionElement()) {
71664        composeMarkdownCore("description", element.getDescriptionElement(), false);
71665        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71666      }
71667      if (element.hasPredecessor()) {
71668        composeReference("predecessor", element.getPredecessor());
71669      }
71670  }
71671
71672  protected void composeTestPlanTestCaseTestRunComponent(String name, TestPlan.TestPlanTestCaseTestRunComponent element) throws IOException {
71673    if (element != null) {
71674      open(name);
71675      composeTestPlanTestCaseTestRunComponentProperties(element);
71676      close();
71677    }
71678  }
71679
71680  protected void composeTestPlanTestCaseTestRunComponentProperties(TestPlan.TestPlanTestCaseTestRunComponent element) throws IOException {
71681    composeBackboneElementProperties(element);
71682      if (element.hasNarrativeElement()) {
71683        composeMarkdownCore("narrative", element.getNarrativeElement(), false);
71684        composeMarkdownExtras("narrative", element.getNarrativeElement(), false);
71685      }
71686      if (element.hasScript()) {
71687        composeTestPlanTestCaseTestRunScriptComponent("script", element.getScript());
71688      }
71689  }
71690
71691  protected void composeTestPlanTestCaseTestRunScriptComponent(String name, TestPlan.TestPlanTestCaseTestRunScriptComponent element) throws IOException {
71692    if (element != null) {
71693      open(name);
71694      composeTestPlanTestCaseTestRunScriptComponentProperties(element);
71695      close();
71696    }
71697  }
71698
71699  protected void composeTestPlanTestCaseTestRunScriptComponentProperties(TestPlan.TestPlanTestCaseTestRunScriptComponent element) throws IOException {
71700    composeBackboneElementProperties(element);
71701      if (element.hasLanguage()) {
71702        composeCodeableConcept("language", element.getLanguage());
71703      }
71704      if (element.hasSource()) {
71705        composeType("source", element.getSource());
71706      }
71707  }
71708
71709  protected void composeTestPlanTestCaseTestDataComponent(String name, TestPlan.TestPlanTestCaseTestDataComponent element) throws IOException {
71710    if (element != null) {
71711      open(name);
71712      composeTestPlanTestCaseTestDataComponentProperties(element);
71713      close();
71714    }
71715  }
71716
71717  protected void composeTestPlanTestCaseTestDataComponentProperties(TestPlan.TestPlanTestCaseTestDataComponent element) throws IOException {
71718    composeBackboneElementProperties(element);
71719      if (element.hasType()) {
71720        composeCoding("type", element.getType());
71721      }
71722      if (element.hasContent()) {
71723        composeReference("content", element.getContent());
71724      }
71725      if (element.hasSource()) {
71726        composeType("source", element.getSource());
71727      }
71728  }
71729
71730  protected void composeTestPlanTestCaseAssertionComponent(String name, TestPlan.TestPlanTestCaseAssertionComponent element) throws IOException {
71731    if (element != null) {
71732      open(name);
71733      composeTestPlanTestCaseAssertionComponentProperties(element);
71734      close();
71735    }
71736  }
71737
71738  protected void composeTestPlanTestCaseAssertionComponentProperties(TestPlan.TestPlanTestCaseAssertionComponent element) throws IOException {
71739    composeBackboneElementProperties(element);
71740      if (element.hasType()) {
71741        openArray("type");
71742        for (CodeableConcept e : element.getType()) 
71743          composeCodeableConcept(null, e);
71744        closeArray();
71745      };
71746      if (element.hasObject()) {
71747        openArray("object");
71748        for (CodeableReference e : element.getObject()) 
71749          composeCodeableReference(null, e);
71750        closeArray();
71751      };
71752      if (element.hasResult()) {
71753        openArray("result");
71754        for (CodeableReference e : element.getResult()) 
71755          composeCodeableReference(null, e);
71756        closeArray();
71757      };
71758  }
71759
71760  protected void composeTestReport(String name, TestReport element) throws IOException {
71761    if (element != null) {
71762      prop("resourceType", name);
71763      composeTestReportProperties(element);
71764    }
71765  }
71766
71767  protected void composeTestReportProperties(TestReport element) throws IOException {
71768    composeDomainResourceProperties(element);
71769      if (element.hasIdentifier()) {
71770        composeIdentifier("identifier", element.getIdentifier());
71771      }
71772      if (element.hasNameElement()) {
71773        composeStringCore("name", element.getNameElement(), false);
71774        composeStringExtras("name", element.getNameElement(), false);
71775      }
71776      if (element.hasStatusElement()) {
71777        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
71778        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
71779      }
71780      if (element.hasTestScriptElement()) {
71781        composeCanonicalCore("testScript", element.getTestScriptElement(), false);
71782        composeCanonicalExtras("testScript", element.getTestScriptElement(), false);
71783      }
71784      if (element.hasResultElement()) {
71785        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
71786        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
71787      }
71788      if (element.hasScoreElement()) {
71789        composeDecimalCore("score", element.getScoreElement(), false);
71790        composeDecimalExtras("score", element.getScoreElement(), false);
71791      }
71792      if (element.hasTesterElement()) {
71793        composeStringCore("tester", element.getTesterElement(), false);
71794        composeStringExtras("tester", element.getTesterElement(), false);
71795      }
71796      if (element.hasIssuedElement()) {
71797        composeDateTimeCore("issued", element.getIssuedElement(), false);
71798        composeDateTimeExtras("issued", element.getIssuedElement(), false);
71799      }
71800      if (element.hasParticipant()) {
71801        openArray("participant");
71802        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
71803          composeTestReportParticipantComponent(null, e);
71804        closeArray();
71805      };
71806      if (element.hasSetup()) {
71807        composeTestReportSetupComponent("setup", element.getSetup());
71808      }
71809      if (element.hasTest()) {
71810        openArray("test");
71811        for (TestReport.TestReportTestComponent e : element.getTest()) 
71812          composeTestReportTestComponent(null, e);
71813        closeArray();
71814      };
71815      if (element.hasTeardown()) {
71816        composeTestReportTeardownComponent("teardown", element.getTeardown());
71817      }
71818  }
71819
71820  protected void composeTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
71821    if (element != null) {
71822      open(name);
71823      composeTestReportParticipantComponentProperties(element);
71824      close();
71825    }
71826  }
71827
71828  protected void composeTestReportParticipantComponentProperties(TestReport.TestReportParticipantComponent element) throws IOException {
71829    composeBackboneElementProperties(element);
71830      if (element.hasTypeElement()) {
71831        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
71832        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
71833      }
71834      if (element.hasUriElement()) {
71835        composeUriCore("uri", element.getUriElement(), false);
71836        composeUriExtras("uri", element.getUriElement(), false);
71837      }
71838      if (element.hasDisplayElement()) {
71839        composeStringCore("display", element.getDisplayElement(), false);
71840        composeStringExtras("display", element.getDisplayElement(), false);
71841      }
71842  }
71843
71844  protected void composeTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
71845    if (element != null) {
71846      open(name);
71847      composeTestReportSetupComponentProperties(element);
71848      close();
71849    }
71850  }
71851
71852  protected void composeTestReportSetupComponentProperties(TestReport.TestReportSetupComponent element) throws IOException {
71853    composeBackboneElementProperties(element);
71854      if (element.hasAction()) {
71855        openArray("action");
71856        for (TestReport.SetupActionComponent e : element.getAction()) 
71857          composeSetupActionComponent(null, e);
71858        closeArray();
71859      };
71860  }
71861
71862  protected void composeSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
71863    if (element != null) {
71864      open(name);
71865      composeSetupActionComponentProperties(element);
71866      close();
71867    }
71868  }
71869
71870  protected void composeSetupActionComponentProperties(TestReport.SetupActionComponent element) throws IOException {
71871    composeBackboneElementProperties(element);
71872      if (element.hasOperation()) {
71873        composeSetupActionOperationComponent("operation", element.getOperation());
71874      }
71875      if (element.hasAssert()) {
71876        composeSetupActionAssertComponent("assert", element.getAssert());
71877      }
71878  }
71879
71880  protected void composeSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
71881    if (element != null) {
71882      open(name);
71883      composeSetupActionOperationComponentProperties(element);
71884      close();
71885    }
71886  }
71887
71888  protected void composeSetupActionOperationComponentProperties(TestReport.SetupActionOperationComponent element) throws IOException {
71889    composeBackboneElementProperties(element);
71890      if (element.hasResultElement()) {
71891        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71892        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71893      }
71894      if (element.hasMessageElement()) {
71895        composeMarkdownCore("message", element.getMessageElement(), false);
71896        composeMarkdownExtras("message", element.getMessageElement(), false);
71897      }
71898      if (element.hasDetailElement()) {
71899        composeUriCore("detail", element.getDetailElement(), false);
71900        composeUriExtras("detail", element.getDetailElement(), false);
71901      }
71902  }
71903
71904  protected void composeSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
71905    if (element != null) {
71906      open(name);
71907      composeSetupActionAssertComponentProperties(element);
71908      close();
71909    }
71910  }
71911
71912  protected void composeSetupActionAssertComponentProperties(TestReport.SetupActionAssertComponent element) throws IOException {
71913    composeBackboneElementProperties(element);
71914      if (element.hasResultElement()) {
71915        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71916        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71917      }
71918      if (element.hasMessageElement()) {
71919        composeMarkdownCore("message", element.getMessageElement(), false);
71920        composeMarkdownExtras("message", element.getMessageElement(), false);
71921      }
71922      if (element.hasDetailElement()) {
71923        composeStringCore("detail", element.getDetailElement(), false);
71924        composeStringExtras("detail", element.getDetailElement(), false);
71925      }
71926      if (element.hasRequirement()) {
71927        openArray("requirement");
71928        for (TestReport.SetupActionAssertRequirementComponent e : element.getRequirement()) 
71929          composeSetupActionAssertRequirementComponent(null, e);
71930        closeArray();
71931      };
71932  }
71933
71934  protected void composeSetupActionAssertRequirementComponent(String name, TestReport.SetupActionAssertRequirementComponent element) throws IOException {
71935    if (element != null) {
71936      open(name);
71937      composeSetupActionAssertRequirementComponentProperties(element);
71938      close();
71939    }
71940  }
71941
71942  protected void composeSetupActionAssertRequirementComponentProperties(TestReport.SetupActionAssertRequirementComponent element) throws IOException {
71943    composeBackboneElementProperties(element);
71944      if (element.hasLink()) {
71945        composeType("link", element.getLink());
71946      }
71947  }
71948
71949  protected void composeTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
71950    if (element != null) {
71951      open(name);
71952      composeTestReportTestComponentProperties(element);
71953      close();
71954    }
71955  }
71956
71957  protected void composeTestReportTestComponentProperties(TestReport.TestReportTestComponent element) throws IOException {
71958    composeBackboneElementProperties(element);
71959      if (element.hasNameElement()) {
71960        composeStringCore("name", element.getNameElement(), false);
71961        composeStringExtras("name", element.getNameElement(), false);
71962      }
71963      if (element.hasDescriptionElement()) {
71964        composeStringCore("description", element.getDescriptionElement(), false);
71965        composeStringExtras("description", element.getDescriptionElement(), false);
71966      }
71967      if (element.hasAction()) {
71968        openArray("action");
71969        for (TestReport.TestActionComponent e : element.getAction()) 
71970          composeTestActionComponent(null, e);
71971        closeArray();
71972      };
71973  }
71974
71975  protected void composeTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
71976    if (element != null) {
71977      open(name);
71978      composeTestActionComponentProperties(element);
71979      close();
71980    }
71981  }
71982
71983  protected void composeTestActionComponentProperties(TestReport.TestActionComponent element) throws IOException {
71984    composeBackboneElementProperties(element);
71985      if (element.hasOperation()) {
71986        composeSetupActionOperationComponent("operation", element.getOperation());
71987      }
71988      if (element.hasAssert()) {
71989        composeSetupActionAssertComponent("assert", element.getAssert());
71990      }
71991  }
71992
71993  protected void composeTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
71994    if (element != null) {
71995      open(name);
71996      composeTestReportTeardownComponentProperties(element);
71997      close();
71998    }
71999  }
72000
72001  protected void composeTestReportTeardownComponentProperties(TestReport.TestReportTeardownComponent element) throws IOException {
72002    composeBackboneElementProperties(element);
72003      if (element.hasAction()) {
72004        openArray("action");
72005        for (TestReport.TeardownActionComponent e : element.getAction()) 
72006          composeTeardownActionComponent(null, e);
72007        closeArray();
72008      };
72009  }
72010
72011  protected void composeTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
72012    if (element != null) {
72013      open(name);
72014      composeTeardownActionComponentProperties(element);
72015      close();
72016    }
72017  }
72018
72019  protected void composeTeardownActionComponentProperties(TestReport.TeardownActionComponent element) throws IOException {
72020    composeBackboneElementProperties(element);
72021      if (element.hasOperation()) {
72022        composeSetupActionOperationComponent("operation", element.getOperation());
72023      }
72024  }
72025
72026  protected void composeTestScript(String name, TestScript element) throws IOException {
72027    if (element != null) {
72028      prop("resourceType", name);
72029      composeTestScriptProperties(element);
72030    }
72031  }
72032
72033  protected void composeTestScriptProperties(TestScript element) throws IOException {
72034    composeCanonicalResourceProperties(element);
72035      if (element.hasUrlElement()) {
72036        composeUriCore("url", element.getUrlElement(), false);
72037        composeUriExtras("url", element.getUrlElement(), false);
72038      }
72039      if (element.hasIdentifier()) {
72040        openArray("identifier");
72041        for (Identifier e : element.getIdentifier()) 
72042          composeIdentifier(null, e);
72043        closeArray();
72044      };
72045      if (element.hasVersionElement()) {
72046        composeStringCore("version", element.getVersionElement(), false);
72047        composeStringExtras("version", element.getVersionElement(), false);
72048      }
72049      if (element.hasVersionAlgorithm()) {
72050        composeType("versionAlgorithm", element.getVersionAlgorithm());
72051      }
72052      if (element.hasNameElement()) {
72053        composeStringCore("name", element.getNameElement(), false);
72054        composeStringExtras("name", element.getNameElement(), false);
72055      }
72056      if (element.hasTitleElement()) {
72057        composeStringCore("title", element.getTitleElement(), false);
72058        composeStringExtras("title", element.getTitleElement(), false);
72059      }
72060      if (element.hasStatusElement()) {
72061        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72062        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72063      }
72064      if (element.hasExperimentalElement()) {
72065        composeBooleanCore("experimental", element.getExperimentalElement(), false);
72066        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
72067      }
72068      if (element.hasDateElement()) {
72069        composeDateTimeCore("date", element.getDateElement(), false);
72070        composeDateTimeExtras("date", element.getDateElement(), false);
72071      }
72072      if (element.hasPublisherElement()) {
72073        composeStringCore("publisher", element.getPublisherElement(), false);
72074        composeStringExtras("publisher", element.getPublisherElement(), false);
72075      }
72076      if (element.hasContact()) {
72077        openArray("contact");
72078        for (ContactDetail e : element.getContact()) 
72079          composeContactDetail(null, e);
72080        closeArray();
72081      };
72082      if (element.hasDescriptionElement()) {
72083        composeMarkdownCore("description", element.getDescriptionElement(), false);
72084        composeMarkdownExtras("description", element.getDescriptionElement(), false);
72085      }
72086      if (element.hasUseContext()) {
72087        openArray("useContext");
72088        for (UsageContext e : element.getUseContext()) 
72089          composeUsageContext(null, e);
72090        closeArray();
72091      };
72092      if (element.hasJurisdiction()) {
72093        openArray("jurisdiction");
72094        for (CodeableConcept e : element.getJurisdiction()) 
72095          composeCodeableConcept(null, e);
72096        closeArray();
72097      };
72098      if (element.hasPurposeElement()) {
72099        composeMarkdownCore("purpose", element.getPurposeElement(), false);
72100        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
72101      }
72102      if (element.hasCopyrightElement()) {
72103        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
72104        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
72105      }
72106      if (element.hasCopyrightLabelElement()) {
72107        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
72108        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
72109      }
72110      if (element.hasOrigin()) {
72111        openArray("origin");
72112        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
72113          composeTestScriptOriginComponent(null, e);
72114        closeArray();
72115      };
72116      if (element.hasDestination()) {
72117        openArray("destination");
72118        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
72119          composeTestScriptDestinationComponent(null, e);
72120        closeArray();
72121      };
72122      if (element.hasMetadata()) {
72123        composeTestScriptMetadataComponent("metadata", element.getMetadata());
72124      }
72125      if (element.hasScope()) {
72126        openArray("scope");
72127        for (TestScript.TestScriptScopeComponent e : element.getScope()) 
72128          composeTestScriptScopeComponent(null, e);
72129        closeArray();
72130      };
72131      if (element.hasFixture()) {
72132        openArray("fixture");
72133        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
72134          composeTestScriptFixtureComponent(null, e);
72135        closeArray();
72136      };
72137      if (element.hasProfile()) {
72138        if (anyHasValue(element.getProfile())) {
72139          openArray("profile");
72140          for (CanonicalType e : element.getProfile()) 
72141            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
72142          closeArray();
72143        }
72144        if (anyHasExtras(element.getProfile())) {
72145          openArray("_profile");
72146          for (CanonicalType e : element.getProfile()) 
72147            composeCanonicalExtras(null, e, true);
72148          closeArray();
72149        }
72150      };
72151      if (element.hasVariable()) {
72152        openArray("variable");
72153        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
72154          composeTestScriptVariableComponent(null, e);
72155        closeArray();
72156      };
72157      if (element.hasSetup()) {
72158        composeTestScriptSetupComponent("setup", element.getSetup());
72159      }
72160      if (element.hasTest()) {
72161        openArray("test");
72162        for (TestScript.TestScriptTestComponent e : element.getTest()) 
72163          composeTestScriptTestComponent(null, e);
72164        closeArray();
72165      };
72166      if (element.hasTeardown()) {
72167        composeTestScriptTeardownComponent("teardown", element.getTeardown());
72168      }
72169  }
72170
72171  protected void composeTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
72172    if (element != null) {
72173      open(name);
72174      composeTestScriptOriginComponentProperties(element);
72175      close();
72176    }
72177  }
72178
72179  protected void composeTestScriptOriginComponentProperties(TestScript.TestScriptOriginComponent element) throws IOException {
72180    composeBackboneElementProperties(element);
72181      if (element.hasIndexElement()) {
72182        composeIntegerCore("index", element.getIndexElement(), false);
72183        composeIntegerExtras("index", element.getIndexElement(), false);
72184      }
72185      if (element.hasProfile()) {
72186        composeCoding("profile", element.getProfile());
72187      }
72188      if (element.hasUrlElement()) {
72189        composeUrlCore("url", element.getUrlElement(), false);
72190        composeUrlExtras("url", element.getUrlElement(), false);
72191      }
72192  }
72193
72194  protected void composeTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
72195    if (element != null) {
72196      open(name);
72197      composeTestScriptDestinationComponentProperties(element);
72198      close();
72199    }
72200  }
72201
72202  protected void composeTestScriptDestinationComponentProperties(TestScript.TestScriptDestinationComponent element) throws IOException {
72203    composeBackboneElementProperties(element);
72204      if (element.hasIndexElement()) {
72205        composeIntegerCore("index", element.getIndexElement(), false);
72206        composeIntegerExtras("index", element.getIndexElement(), false);
72207      }
72208      if (element.hasProfile()) {
72209        composeCoding("profile", element.getProfile());
72210      }
72211      if (element.hasUrlElement()) {
72212        composeUrlCore("url", element.getUrlElement(), false);
72213        composeUrlExtras("url", element.getUrlElement(), false);
72214      }
72215  }
72216
72217  protected void composeTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
72218    if (element != null) {
72219      open(name);
72220      composeTestScriptMetadataComponentProperties(element);
72221      close();
72222    }
72223  }
72224
72225  protected void composeTestScriptMetadataComponentProperties(TestScript.TestScriptMetadataComponent element) throws IOException {
72226    composeBackboneElementProperties(element);
72227      if (element.hasLink()) {
72228        openArray("link");
72229        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
72230          composeTestScriptMetadataLinkComponent(null, e);
72231        closeArray();
72232      };
72233      if (element.hasCapability()) {
72234        openArray("capability");
72235        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
72236          composeTestScriptMetadataCapabilityComponent(null, e);
72237        closeArray();
72238      };
72239  }
72240
72241  protected void composeTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
72242    if (element != null) {
72243      open(name);
72244      composeTestScriptMetadataLinkComponentProperties(element);
72245      close();
72246    }
72247  }
72248
72249  protected void composeTestScriptMetadataLinkComponentProperties(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
72250    composeBackboneElementProperties(element);
72251      if (element.hasUrlElement()) {
72252        composeUriCore("url", element.getUrlElement(), false);
72253        composeUriExtras("url", element.getUrlElement(), false);
72254      }
72255      if (element.hasDescriptionElement()) {
72256        composeStringCore("description", element.getDescriptionElement(), false);
72257        composeStringExtras("description", element.getDescriptionElement(), false);
72258      }
72259  }
72260
72261  protected void composeTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
72262    if (element != null) {
72263      open(name);
72264      composeTestScriptMetadataCapabilityComponentProperties(element);
72265      close();
72266    }
72267  }
72268
72269  protected void composeTestScriptMetadataCapabilityComponentProperties(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
72270    composeBackboneElementProperties(element);
72271      if (element.hasRequiredElement()) {
72272        composeBooleanCore("required", element.getRequiredElement(), false);
72273        composeBooleanExtras("required", element.getRequiredElement(), false);
72274      }
72275      if (element.hasValidatedElement()) {
72276        composeBooleanCore("validated", element.getValidatedElement(), false);
72277        composeBooleanExtras("validated", element.getValidatedElement(), false);
72278      }
72279      if (element.hasDescriptionElement()) {
72280        composeStringCore("description", element.getDescriptionElement(), false);
72281        composeStringExtras("description", element.getDescriptionElement(), false);
72282      }
72283      if (element.hasOrigin()) {
72284        if (anyHasValue(element.getOrigin())) {
72285          openArray("origin");
72286          for (IntegerType e : element.getOrigin()) 
72287            composeIntegerCore(null, e, e != element.getOrigin().get(element.getOrigin().size()-1));
72288          closeArray();
72289        }
72290        if (anyHasExtras(element.getOrigin())) {
72291          openArray("_origin");
72292          for (IntegerType e : element.getOrigin()) 
72293            composeIntegerExtras(null, e, true);
72294          closeArray();
72295        }
72296      };
72297      if (element.hasDestinationElement()) {
72298        composeIntegerCore("destination", element.getDestinationElement(), false);
72299        composeIntegerExtras("destination", element.getDestinationElement(), false);
72300      }
72301      if (element.hasLink()) {
72302        if (anyHasValue(element.getLink())) {
72303          openArray("link");
72304          for (UriType e : element.getLink()) 
72305            composeUriCore(null, e, e != element.getLink().get(element.getLink().size()-1));
72306          closeArray();
72307        }
72308        if (anyHasExtras(element.getLink())) {
72309          openArray("_link");
72310          for (UriType e : element.getLink()) 
72311            composeUriExtras(null, e, true);
72312          closeArray();
72313        }
72314      };
72315      if (element.hasCapabilitiesElement()) {
72316        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
72317        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
72318      }
72319  }
72320
72321  protected void composeTestScriptScopeComponent(String name, TestScript.TestScriptScopeComponent element) throws IOException {
72322    if (element != null) {
72323      open(name);
72324      composeTestScriptScopeComponentProperties(element);
72325      close();
72326    }
72327  }
72328
72329  protected void composeTestScriptScopeComponentProperties(TestScript.TestScriptScopeComponent element) throws IOException {
72330    composeBackboneElementProperties(element);
72331      if (element.hasArtifactElement()) {
72332        composeCanonicalCore("artifact", element.getArtifactElement(), false);
72333        composeCanonicalExtras("artifact", element.getArtifactElement(), false);
72334      }
72335      if (element.hasConformance()) {
72336        composeCodeableConcept("conformance", element.getConformance());
72337      }
72338      if (element.hasPhase()) {
72339        composeCodeableConcept("phase", element.getPhase());
72340      }
72341  }
72342
72343  protected void composeTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
72344    if (element != null) {
72345      open(name);
72346      composeTestScriptFixtureComponentProperties(element);
72347      close();
72348    }
72349  }
72350
72351  protected void composeTestScriptFixtureComponentProperties(TestScript.TestScriptFixtureComponent element) throws IOException {
72352    composeBackboneElementProperties(element);
72353      if (element.hasAutocreateElement()) {
72354        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
72355        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
72356      }
72357      if (element.hasAutodeleteElement()) {
72358        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
72359        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
72360      }
72361      if (element.hasResource()) {
72362        composeReference("resource", element.getResource());
72363      }
72364  }
72365
72366  protected void composeTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
72367    if (element != null) {
72368      open(name);
72369      composeTestScriptVariableComponentProperties(element);
72370      close();
72371    }
72372  }
72373
72374  protected void composeTestScriptVariableComponentProperties(TestScript.TestScriptVariableComponent element) throws IOException {
72375    composeBackboneElementProperties(element);
72376      if (element.hasNameElement()) {
72377        composeStringCore("name", element.getNameElement(), false);
72378        composeStringExtras("name", element.getNameElement(), false);
72379      }
72380      if (element.hasDefaultValueElement()) {
72381        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
72382        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
72383      }
72384      if (element.hasDescriptionElement()) {
72385        composeStringCore("description", element.getDescriptionElement(), false);
72386        composeStringExtras("description", element.getDescriptionElement(), false);
72387      }
72388      if (element.hasExpressionElement()) {
72389        composeStringCore("expression", element.getExpressionElement(), false);
72390        composeStringExtras("expression", element.getExpressionElement(), false);
72391      }
72392      if (element.hasHeaderFieldElement()) {
72393        composeStringCore("headerField", element.getHeaderFieldElement(), false);
72394        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
72395      }
72396      if (element.hasHintElement()) {
72397        composeStringCore("hint", element.getHintElement(), false);
72398        composeStringExtras("hint", element.getHintElement(), false);
72399      }
72400      if (element.hasPathElement()) {
72401        composeStringCore("path", element.getPathElement(), false);
72402        composeStringExtras("path", element.getPathElement(), false);
72403      }
72404      if (element.hasSourceIdElement()) {
72405        composeIdCore("sourceId", element.getSourceIdElement(), false);
72406        composeIdExtras("sourceId", element.getSourceIdElement(), false);
72407      }
72408  }
72409
72410  protected void composeTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
72411    if (element != null) {
72412      open(name);
72413      composeTestScriptSetupComponentProperties(element);
72414      close();
72415    }
72416  }
72417
72418  protected void composeTestScriptSetupComponentProperties(TestScript.TestScriptSetupComponent element) throws IOException {
72419    composeBackboneElementProperties(element);
72420      if (element.hasAction()) {
72421        openArray("action");
72422        for (TestScript.SetupActionComponent e : element.getAction()) 
72423          composeSetupActionComponent(null, e);
72424        closeArray();
72425      };
72426  }
72427
72428  protected void composeSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
72429    if (element != null) {
72430      open(name);
72431      composeSetupActionComponentProperties(element);
72432      close();
72433    }
72434  }
72435
72436  protected void composeSetupActionComponentProperties(TestScript.SetupActionComponent element) throws IOException {
72437    composeBackboneElementProperties(element);
72438      if (element.hasOperation()) {
72439        composeSetupActionOperationComponent("operation", element.getOperation());
72440      }
72441      if (element.hasAssert()) {
72442        composeSetupActionAssertComponent("assert", element.getAssert());
72443      }
72444  }
72445
72446  protected void composeSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
72447    if (element != null) {
72448      open(name);
72449      composeSetupActionOperationComponentProperties(element);
72450      close();
72451    }
72452  }
72453
72454  protected void composeSetupActionOperationComponentProperties(TestScript.SetupActionOperationComponent element) throws IOException {
72455    composeBackboneElementProperties(element);
72456      if (element.hasType()) {
72457        composeCoding("type", element.getType());
72458      }
72459      if (element.hasResourceElement()) {
72460        composeUriCore("resource", element.getResourceElement(), false);
72461        composeUriExtras("resource", element.getResourceElement(), false);
72462      }
72463      if (element.hasLabelElement()) {
72464        composeStringCore("label", element.getLabelElement(), false);
72465        composeStringExtras("label", element.getLabelElement(), false);
72466      }
72467      if (element.hasDescriptionElement()) {
72468        composeStringCore("description", element.getDescriptionElement(), false);
72469        composeStringExtras("description", element.getDescriptionElement(), false);
72470      }
72471      if (element.hasAcceptElement()) {
72472        composeCodeCore("accept", element.getAcceptElement(), false);
72473        composeCodeExtras("accept", element.getAcceptElement(), false);
72474      }
72475      if (element.hasContentTypeElement()) {
72476        composeCodeCore("contentType", element.getContentTypeElement(), false);
72477        composeCodeExtras("contentType", element.getContentTypeElement(), false);
72478      }
72479      if (element.hasDestinationElement()) {
72480        composeIntegerCore("destination", element.getDestinationElement(), false);
72481        composeIntegerExtras("destination", element.getDestinationElement(), false);
72482      }
72483      if (element.hasEncodeRequestUrlElement()) {
72484        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
72485        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
72486      }
72487      if (element.hasMethodElement()) {
72488        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72489        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72490      }
72491      if (element.hasOriginElement()) {
72492        composeIntegerCore("origin", element.getOriginElement(), false);
72493        composeIntegerExtras("origin", element.getOriginElement(), false);
72494      }
72495      if (element.hasParamsElement()) {
72496        composeStringCore("params", element.getParamsElement(), false);
72497        composeStringExtras("params", element.getParamsElement(), false);
72498      }
72499      if (element.hasRequestHeader()) {
72500        openArray("requestHeader");
72501        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
72502          composeSetupActionOperationRequestHeaderComponent(null, e);
72503        closeArray();
72504      };
72505      if (element.hasRequestIdElement()) {
72506        composeIdCore("requestId", element.getRequestIdElement(), false);
72507        composeIdExtras("requestId", element.getRequestIdElement(), false);
72508      }
72509      if (element.hasResponseIdElement()) {
72510        composeIdCore("responseId", element.getResponseIdElement(), false);
72511        composeIdExtras("responseId", element.getResponseIdElement(), false);
72512      }
72513      if (element.hasSourceIdElement()) {
72514        composeIdCore("sourceId", element.getSourceIdElement(), false);
72515        composeIdExtras("sourceId", element.getSourceIdElement(), false);
72516      }
72517      if (element.hasTargetIdElement()) {
72518        composeIdCore("targetId", element.getTargetIdElement(), false);
72519        composeIdExtras("targetId", element.getTargetIdElement(), false);
72520      }
72521      if (element.hasUrlElement()) {
72522        composeStringCore("url", element.getUrlElement(), false);
72523        composeStringExtras("url", element.getUrlElement(), false);
72524      }
72525  }
72526
72527  protected void composeSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
72528    if (element != null) {
72529      open(name);
72530      composeSetupActionOperationRequestHeaderComponentProperties(element);
72531      close();
72532    }
72533  }
72534
72535  protected void composeSetupActionOperationRequestHeaderComponentProperties(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
72536    composeBackboneElementProperties(element);
72537      if (element.hasFieldElement()) {
72538        composeStringCore("field", element.getFieldElement(), false);
72539        composeStringExtras("field", element.getFieldElement(), false);
72540      }
72541      if (element.hasValueElement()) {
72542        composeStringCore("value", element.getValueElement(), false);
72543        composeStringExtras("value", element.getValueElement(), false);
72544      }
72545  }
72546
72547  protected void composeSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
72548    if (element != null) {
72549      open(name);
72550      composeSetupActionAssertComponentProperties(element);
72551      close();
72552    }
72553  }
72554
72555  protected void composeSetupActionAssertComponentProperties(TestScript.SetupActionAssertComponent element) throws IOException {
72556    composeBackboneElementProperties(element);
72557      if (element.hasLabelElement()) {
72558        composeStringCore("label", element.getLabelElement(), false);
72559        composeStringExtras("label", element.getLabelElement(), false);
72560      }
72561      if (element.hasDescriptionElement()) {
72562        composeStringCore("description", element.getDescriptionElement(), false);
72563        composeStringExtras("description", element.getDescriptionElement(), false);
72564      }
72565      if (element.hasDirectionElement()) {
72566        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
72567        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
72568      }
72569      if (element.hasCompareToSourceIdElement()) {
72570        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
72571        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
72572      }
72573      if (element.hasCompareToSourceExpressionElement()) {
72574        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
72575        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
72576      }
72577      if (element.hasCompareToSourcePathElement()) {
72578        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
72579        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
72580      }
72581      if (element.hasContentTypeElement()) {
72582        composeCodeCore("contentType", element.getContentTypeElement(), false);
72583        composeCodeExtras("contentType", element.getContentTypeElement(), false);
72584      }
72585      if (element.hasDefaultManualCompletionElement()) {
72586        composeEnumerationCore("defaultManualCompletion", element.getDefaultManualCompletionElement(), new TestScript.AssertionManualCompletionTypeEnumFactory(), false);
72587        composeEnumerationExtras("defaultManualCompletion", element.getDefaultManualCompletionElement(), new TestScript.AssertionManualCompletionTypeEnumFactory(), false);
72588      }
72589      if (element.hasExpressionElement()) {
72590        composeStringCore("expression", element.getExpressionElement(), false);
72591        composeStringExtras("expression", element.getExpressionElement(), false);
72592      }
72593      if (element.hasHeaderFieldElement()) {
72594        composeStringCore("headerField", element.getHeaderFieldElement(), false);
72595        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
72596      }
72597      if (element.hasMinimumIdElement()) {
72598        composeStringCore("minimumId", element.getMinimumIdElement(), false);
72599        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
72600      }
72601      if (element.hasNavigationLinksElement()) {
72602        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
72603        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
72604      }
72605      if (element.hasOperatorElement()) {
72606        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
72607        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
72608      }
72609      if (element.hasPathElement()) {
72610        composeStringCore("path", element.getPathElement(), false);
72611        composeStringExtras("path", element.getPathElement(), false);
72612      }
72613      if (element.hasRequestMethodElement()) {
72614        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72615        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72616      }
72617      if (element.hasRequestURLElement()) {
72618        composeStringCore("requestURL", element.getRequestURLElement(), false);
72619        composeStringExtras("requestURL", element.getRequestURLElement(), false);
72620      }
72621      if (element.hasResourceElement()) {
72622        composeUriCore("resource", element.getResourceElement(), false);
72623        composeUriExtras("resource", element.getResourceElement(), false);
72624      }
72625      if (element.hasResponseElement()) {
72626        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
72627        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
72628      }
72629      if (element.hasResponseCodeElement()) {
72630        composeStringCore("responseCode", element.getResponseCodeElement(), false);
72631        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
72632      }
72633      if (element.hasSourceIdElement()) {
72634        composeIdCore("sourceId", element.getSourceIdElement(), false);
72635        composeIdExtras("sourceId", element.getSourceIdElement(), false);
72636      }
72637      if (element.hasStopTestOnFailElement()) {
72638        composeBooleanCore("stopTestOnFail", element.getStopTestOnFailElement(), false);
72639        composeBooleanExtras("stopTestOnFail", element.getStopTestOnFailElement(), false);
72640      }
72641      if (element.hasValidateProfileIdElement()) {
72642        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
72643        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
72644      }
72645      if (element.hasValueElement()) {
72646        composeStringCore("value", element.getValueElement(), false);
72647        composeStringExtras("value", element.getValueElement(), false);
72648      }
72649      if (element.hasWarningOnlyElement()) {
72650        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
72651        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
72652      }
72653      if (element.hasRequirement()) {
72654        openArray("requirement");
72655        for (TestScript.SetupActionAssertRequirementComponent e : element.getRequirement()) 
72656          composeSetupActionAssertRequirementComponent(null, e);
72657        closeArray();
72658      };
72659  }
72660
72661  protected void composeSetupActionAssertRequirementComponent(String name, TestScript.SetupActionAssertRequirementComponent element) throws IOException {
72662    if (element != null) {
72663      open(name);
72664      composeSetupActionAssertRequirementComponentProperties(element);
72665      close();
72666    }
72667  }
72668
72669  protected void composeSetupActionAssertRequirementComponentProperties(TestScript.SetupActionAssertRequirementComponent element) throws IOException {
72670    composeBackboneElementProperties(element);
72671      if (element.hasLink()) {
72672        composeType("link", element.getLink());
72673      }
72674  }
72675
72676  protected void composeTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
72677    if (element != null) {
72678      open(name);
72679      composeTestScriptTestComponentProperties(element);
72680      close();
72681    }
72682  }
72683
72684  protected void composeTestScriptTestComponentProperties(TestScript.TestScriptTestComponent element) throws IOException {
72685    composeBackboneElementProperties(element);
72686      if (element.hasNameElement()) {
72687        composeStringCore("name", element.getNameElement(), false);
72688        composeStringExtras("name", element.getNameElement(), false);
72689      }
72690      if (element.hasDescriptionElement()) {
72691        composeStringCore("description", element.getDescriptionElement(), false);
72692        composeStringExtras("description", element.getDescriptionElement(), false);
72693      }
72694      if (element.hasAction()) {
72695        openArray("action");
72696        for (TestScript.TestActionComponent e : element.getAction()) 
72697          composeTestActionComponent(null, e);
72698        closeArray();
72699      };
72700  }
72701
72702  protected void composeTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
72703    if (element != null) {
72704      open(name);
72705      composeTestActionComponentProperties(element);
72706      close();
72707    }
72708  }
72709
72710  protected void composeTestActionComponentProperties(TestScript.TestActionComponent element) throws IOException {
72711    composeBackboneElementProperties(element);
72712      if (element.hasOperation()) {
72713        composeSetupActionOperationComponent("operation", element.getOperation());
72714      }
72715      if (element.hasAssert()) {
72716        composeSetupActionAssertComponent("assert", element.getAssert());
72717      }
72718  }
72719
72720  protected void composeTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
72721    if (element != null) {
72722      open(name);
72723      composeTestScriptTeardownComponentProperties(element);
72724      close();
72725    }
72726  }
72727
72728  protected void composeTestScriptTeardownComponentProperties(TestScript.TestScriptTeardownComponent element) throws IOException {
72729    composeBackboneElementProperties(element);
72730      if (element.hasAction()) {
72731        openArray("action");
72732        for (TestScript.TeardownActionComponent e : element.getAction()) 
72733          composeTeardownActionComponent(null, e);
72734        closeArray();
72735      };
72736  }
72737
72738  protected void composeTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
72739    if (element != null) {
72740      open(name);
72741      composeTeardownActionComponentProperties(element);
72742      close();
72743    }
72744  }
72745
72746  protected void composeTeardownActionComponentProperties(TestScript.TeardownActionComponent element) throws IOException {
72747    composeBackboneElementProperties(element);
72748      if (element.hasOperation()) {
72749        composeSetupActionOperationComponent("operation", element.getOperation());
72750      }
72751  }
72752
72753  protected void composeTransport(String name, Transport element) throws IOException {
72754    if (element != null) {
72755      prop("resourceType", name);
72756      composeTransportProperties(element);
72757    }
72758  }
72759
72760  protected void composeTransportProperties(Transport element) throws IOException {
72761    composeDomainResourceProperties(element);
72762      if (element.hasIdentifier()) {
72763        openArray("identifier");
72764        for (Identifier e : element.getIdentifier()) 
72765          composeIdentifier(null, e);
72766        closeArray();
72767      };
72768      if (element.hasInstantiatesCanonicalElement()) {
72769        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
72770        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
72771      }
72772      if (element.hasInstantiatesUriElement()) {
72773        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
72774        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
72775      }
72776      if (element.hasBasedOn()) {
72777        openArray("basedOn");
72778        for (Reference e : element.getBasedOn()) 
72779          composeReference(null, e);
72780        closeArray();
72781      };
72782      if (element.hasGroupIdentifier()) {
72783        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
72784      }
72785      if (element.hasPartOf()) {
72786        openArray("partOf");
72787        for (Reference e : element.getPartOf()) 
72788          composeReference(null, e);
72789        closeArray();
72790      };
72791      if (element.hasStatusElement()) {
72792        composeEnumerationCore("status", element.getStatusElement(), new Transport.TransportStatusEnumFactory(), false);
72793        composeEnumerationExtras("status", element.getStatusElement(), new Transport.TransportStatusEnumFactory(), false);
72794      }
72795      if (element.hasStatusReason()) {
72796        composeCodeableConcept("statusReason", element.getStatusReason());
72797      }
72798      if (element.hasIntentElement()) {
72799        composeEnumerationCore("intent", element.getIntentElement(), new Transport.TransportIntentEnumFactory(), false);
72800        composeEnumerationExtras("intent", element.getIntentElement(), new Transport.TransportIntentEnumFactory(), false);
72801      }
72802      if (element.hasPriorityElement()) {
72803        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
72804        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
72805      }
72806      if (element.hasCode()) {
72807        composeCodeableConcept("code", element.getCode());
72808      }
72809      if (element.hasDescriptionElement()) {
72810        composeStringCore("description", element.getDescriptionElement(), false);
72811        composeStringExtras("description", element.getDescriptionElement(), false);
72812      }
72813      if (element.hasFocus()) {
72814        composeReference("focus", element.getFocus());
72815      }
72816      if (element.hasFor()) {
72817        composeReference("for", element.getFor());
72818      }
72819      if (element.hasEncounter()) {
72820        composeReference("encounter", element.getEncounter());
72821      }
72822      if (element.hasCompletionTimeElement()) {
72823        composeDateTimeCore("completionTime", element.getCompletionTimeElement(), false);
72824        composeDateTimeExtras("completionTime", element.getCompletionTimeElement(), false);
72825      }
72826      if (element.hasAuthoredOnElement()) {
72827        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
72828        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
72829      }
72830      if (element.hasLastModifiedElement()) {
72831        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
72832        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
72833      }
72834      if (element.hasRequester()) {
72835        composeReference("requester", element.getRequester());
72836      }
72837      if (element.hasPerformerType()) {
72838        openArray("performerType");
72839        for (CodeableConcept e : element.getPerformerType()) 
72840          composeCodeableConcept(null, e);
72841        closeArray();
72842      };
72843      if (element.hasOwner()) {
72844        composeReference("owner", element.getOwner());
72845      }
72846      if (element.hasLocation()) {
72847        composeReference("location", element.getLocation());
72848      }
72849      if (element.hasInsurance()) {
72850        openArray("insurance");
72851        for (Reference e : element.getInsurance()) 
72852          composeReference(null, e);
72853        closeArray();
72854      };
72855      if (element.hasNote()) {
72856        openArray("note");
72857        for (Annotation e : element.getNote()) 
72858          composeAnnotation(null, e);
72859        closeArray();
72860      };
72861      if (element.hasRelevantHistory()) {
72862        openArray("relevantHistory");
72863        for (Reference e : element.getRelevantHistory()) 
72864          composeReference(null, e);
72865        closeArray();
72866      };
72867      if (element.hasRestriction()) {
72868        composeTransportRestrictionComponent("restriction", element.getRestriction());
72869      }
72870      if (element.hasInput()) {
72871        openArray("input");
72872        for (Transport.ParameterComponent e : element.getInput()) 
72873          composeParameterComponent(null, e);
72874        closeArray();
72875      };
72876      if (element.hasOutput()) {
72877        openArray("output");
72878        for (Transport.TransportOutputComponent e : element.getOutput()) 
72879          composeTransportOutputComponent(null, e);
72880        closeArray();
72881      };
72882      if (element.hasRequestedLocation()) {
72883        composeReference("requestedLocation", element.getRequestedLocation());
72884      }
72885      if (element.hasCurrentLocation()) {
72886        composeReference("currentLocation", element.getCurrentLocation());
72887      }
72888      if (element.hasReason()) {
72889        composeCodeableReference("reason", element.getReason());
72890      }
72891      if (element.hasHistory()) {
72892        composeReference("history", element.getHistory());
72893      }
72894  }
72895
72896  protected void composeTransportRestrictionComponent(String name, Transport.TransportRestrictionComponent element) throws IOException {
72897    if (element != null) {
72898      open(name);
72899      composeTransportRestrictionComponentProperties(element);
72900      close();
72901    }
72902  }
72903
72904  protected void composeTransportRestrictionComponentProperties(Transport.TransportRestrictionComponent element) throws IOException {
72905    composeBackboneElementProperties(element);
72906      if (element.hasRepetitionsElement()) {
72907        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
72908        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
72909      }
72910      if (element.hasPeriod()) {
72911        composePeriod("period", element.getPeriod());
72912      }
72913      if (element.hasRecipient()) {
72914        openArray("recipient");
72915        for (Reference e : element.getRecipient()) 
72916          composeReference(null, e);
72917        closeArray();
72918      };
72919  }
72920
72921  protected void composeParameterComponent(String name, Transport.ParameterComponent element) throws IOException {
72922    if (element != null) {
72923      open(name);
72924      composeParameterComponentProperties(element);
72925      close();
72926    }
72927  }
72928
72929  protected void composeParameterComponentProperties(Transport.ParameterComponent element) throws IOException {
72930    composeBackboneElementProperties(element);
72931      if (element.hasType()) {
72932        composeCodeableConcept("type", element.getType());
72933      }
72934      if (element.hasValue()) {
72935        composeType("value", element.getValue());
72936      }
72937  }
72938
72939  protected void composeTransportOutputComponent(String name, Transport.TransportOutputComponent element) throws IOException {
72940    if (element != null) {
72941      open(name);
72942      composeTransportOutputComponentProperties(element);
72943      close();
72944    }
72945  }
72946
72947  protected void composeTransportOutputComponentProperties(Transport.TransportOutputComponent element) throws IOException {
72948    composeBackboneElementProperties(element);
72949      if (element.hasType()) {
72950        composeCodeableConcept("type", element.getType());
72951      }
72952      if (element.hasValue()) {
72953        composeType("value", element.getValue());
72954      }
72955  }
72956
72957  protected void composeValueSet(String name, ValueSet element) throws IOException {
72958    if (element != null) {
72959      prop("resourceType", name);
72960      composeValueSetProperties(element);
72961    }
72962  }
72963
72964  protected void composeValueSetProperties(ValueSet element) throws IOException {
72965    composeMetadataResourceProperties(element);
72966      if (element.hasUrlElement()) {
72967        composeUriCore("url", element.getUrlElement(), false);
72968        composeUriExtras("url", element.getUrlElement(), false);
72969      }
72970      if (element.hasIdentifier()) {
72971        openArray("identifier");
72972        for (Identifier e : element.getIdentifier()) 
72973          composeIdentifier(null, e);
72974        closeArray();
72975      };
72976      if (element.hasVersionElement()) {
72977        composeStringCore("version", element.getVersionElement(), false);
72978        composeStringExtras("version", element.getVersionElement(), false);
72979      }
72980      if (element.hasVersionAlgorithm()) {
72981        composeType("versionAlgorithm", element.getVersionAlgorithm());
72982      }
72983      if (element.hasNameElement()) {
72984        composeStringCore("name", element.getNameElement(), false);
72985        composeStringExtras("name", element.getNameElement(), false);
72986      }
72987      if (element.hasTitleElement()) {
72988        composeStringCore("title", element.getTitleElement(), false);
72989        composeStringExtras("title", element.getTitleElement(), false);
72990      }
72991      if (element.hasStatusElement()) {
72992        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72993        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72994      }
72995      if (element.hasExperimentalElement()) {
72996        composeBooleanCore("experimental", element.getExperimentalElement(), false);
72997        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
72998      }
72999      if (element.hasDateElement()) {
73000        composeDateTimeCore("date", element.getDateElement(), false);
73001        composeDateTimeExtras("date", element.getDateElement(), false);
73002      }
73003      if (element.hasPublisherElement()) {
73004        composeStringCore("publisher", element.getPublisherElement(), false);
73005        composeStringExtras("publisher", element.getPublisherElement(), false);
73006      }
73007      if (element.hasContact()) {
73008        openArray("contact");
73009        for (ContactDetail e : element.getContact()) 
73010          composeContactDetail(null, e);
73011        closeArray();
73012      };
73013      if (element.hasDescriptionElement()) {
73014        composeMarkdownCore("description", element.getDescriptionElement(), false);
73015        composeMarkdownExtras("description", element.getDescriptionElement(), false);
73016      }
73017      if (element.hasUseContext()) {
73018        openArray("useContext");
73019        for (UsageContext e : element.getUseContext()) 
73020          composeUsageContext(null, e);
73021        closeArray();
73022      };
73023      if (element.hasJurisdiction()) {
73024        openArray("jurisdiction");
73025        for (CodeableConcept e : element.getJurisdiction()) 
73026          composeCodeableConcept(null, e);
73027        closeArray();
73028      };
73029      if (element.hasImmutableElement()) {
73030        composeBooleanCore("immutable", element.getImmutableElement(), false);
73031        composeBooleanExtras("immutable", element.getImmutableElement(), false);
73032      }
73033      if (element.hasPurposeElement()) {
73034        composeMarkdownCore("purpose", element.getPurposeElement(), false);
73035        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
73036      }
73037      if (element.hasCopyrightElement()) {
73038        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
73039        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
73040      }
73041      if (element.hasCopyrightLabelElement()) {
73042        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
73043        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
73044      }
73045      if (element.hasApprovalDateElement()) {
73046        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
73047        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
73048      }
73049      if (element.hasLastReviewDateElement()) {
73050        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
73051        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
73052      }
73053      if (element.hasEffectivePeriod()) {
73054        composePeriod("effectivePeriod", element.getEffectivePeriod());
73055      }
73056      if (element.hasTopic()) {
73057        openArray("topic");
73058        for (CodeableConcept e : element.getTopic()) 
73059          composeCodeableConcept(null, e);
73060        closeArray();
73061      };
73062      if (element.hasAuthor()) {
73063        openArray("author");
73064        for (ContactDetail e : element.getAuthor()) 
73065          composeContactDetail(null, e);
73066        closeArray();
73067      };
73068      if (element.hasEditor()) {
73069        openArray("editor");
73070        for (ContactDetail e : element.getEditor()) 
73071          composeContactDetail(null, e);
73072        closeArray();
73073      };
73074      if (element.hasReviewer()) {
73075        openArray("reviewer");
73076        for (ContactDetail e : element.getReviewer()) 
73077          composeContactDetail(null, e);
73078        closeArray();
73079      };
73080      if (element.hasEndorser()) {
73081        openArray("endorser");
73082        for (ContactDetail e : element.getEndorser()) 
73083          composeContactDetail(null, e);
73084        closeArray();
73085      };
73086      if (element.hasRelatedArtifact()) {
73087        openArray("relatedArtifact");
73088        for (RelatedArtifact e : element.getRelatedArtifact()) 
73089          composeRelatedArtifact(null, e);
73090        closeArray();
73091      };
73092      if (element.hasCompose()) {
73093        composeValueSetComposeComponent("compose", element.getCompose());
73094      }
73095      if (element.hasExpansion()) {
73096        composeValueSetExpansionComponent("expansion", element.getExpansion());
73097      }
73098      if (element.hasScope()) {
73099        composeValueSetScopeComponent("scope", element.getScope());
73100      }
73101  }
73102
73103  protected void composeValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
73104    if (element != null) {
73105      open(name);
73106      composeValueSetComposeComponentProperties(element);
73107      close();
73108    }
73109  }
73110
73111  protected void composeValueSetComposeComponentProperties(ValueSet.ValueSetComposeComponent element) throws IOException {
73112    composeBackboneElementProperties(element);
73113      if (element.hasLockedDateElement()) {
73114        composeDateCore("lockedDate", element.getLockedDateElement(), false);
73115        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
73116      }
73117      if (element.hasInactiveElement()) {
73118        composeBooleanCore("inactive", element.getInactiveElement(), false);
73119        composeBooleanExtras("inactive", element.getInactiveElement(), false);
73120      }
73121      if (element.hasInclude()) {
73122        openArray("include");
73123        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
73124          composeConceptSetComponent(null, e);
73125        closeArray();
73126      };
73127      if (element.hasExclude()) {
73128        openArray("exclude");
73129        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
73130          composeConceptSetComponent(null, e);
73131        closeArray();
73132      };
73133      if (element.hasProperty()) {
73134        if (anyHasValue(element.getProperty())) {
73135          openArray("property");
73136          for (StringType e : element.getProperty()) 
73137            composeStringCore(null, e, e != element.getProperty().get(element.getProperty().size()-1));
73138          closeArray();
73139        }
73140        if (anyHasExtras(element.getProperty())) {
73141          openArray("_property");
73142          for (StringType e : element.getProperty()) 
73143            composeStringExtras(null, e, true);
73144          closeArray();
73145        }
73146      };
73147  }
73148
73149  protected void composeConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
73150    if (element != null) {
73151      open(name);
73152      composeConceptSetComponentProperties(element);
73153      close();
73154    }
73155  }
73156
73157  protected void composeConceptSetComponentProperties(ValueSet.ConceptSetComponent element) throws IOException {
73158    composeBackboneElementProperties(element);
73159      if (element.hasSystemElement()) {
73160        composeUriCore("system", element.getSystemElement(), false);
73161        composeUriExtras("system", element.getSystemElement(), false);
73162      }
73163      if (element.hasVersionElement()) {
73164        composeStringCore("version", element.getVersionElement(), false);
73165        composeStringExtras("version", element.getVersionElement(), false);
73166      }
73167      if (element.hasConcept()) {
73168        openArray("concept");
73169        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
73170          composeConceptReferenceComponent(null, e);
73171        closeArray();
73172      };
73173      if (element.hasFilter()) {
73174        openArray("filter");
73175        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
73176          composeConceptSetFilterComponent(null, e);
73177        closeArray();
73178      };
73179      if (element.hasValueSet()) {
73180        if (anyHasValue(element.getValueSet())) {
73181          openArray("valueSet");
73182          for (CanonicalType e : element.getValueSet()) 
73183            composeCanonicalCore(null, e, e != element.getValueSet().get(element.getValueSet().size()-1));
73184          closeArray();
73185        }
73186        if (anyHasExtras(element.getValueSet())) {
73187          openArray("_valueSet");
73188          for (CanonicalType e : element.getValueSet()) 
73189            composeCanonicalExtras(null, e, true);
73190          closeArray();
73191        }
73192      };
73193      if (element.hasCopyrightElement()) {
73194        composeStringCore("copyright", element.getCopyrightElement(), false);
73195        composeStringExtras("copyright", element.getCopyrightElement(), false);
73196      }
73197  }
73198
73199  protected void composeConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
73200    if (element != null) {
73201      open(name);
73202      composeConceptReferenceComponentProperties(element);
73203      close();
73204    }
73205  }
73206
73207  protected void composeConceptReferenceComponentProperties(ValueSet.ConceptReferenceComponent element) throws IOException {
73208    composeBackboneElementProperties(element);
73209      if (element.hasCodeElement()) {
73210        composeCodeCore("code", element.getCodeElement(), false);
73211        composeCodeExtras("code", element.getCodeElement(), false);
73212      }
73213      if (element.hasDisplayElement()) {
73214        composeStringCore("display", element.getDisplayElement(), false);
73215        composeStringExtras("display", element.getDisplayElement(), false);
73216      }
73217      if (element.hasDesignation()) {
73218        openArray("designation");
73219        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
73220          composeConceptReferenceDesignationComponent(null, e);
73221        closeArray();
73222      };
73223  }
73224
73225  protected void composeConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
73226    if (element != null) {
73227      open(name);
73228      composeConceptReferenceDesignationComponentProperties(element);
73229      close();
73230    }
73231  }
73232
73233  protected void composeConceptReferenceDesignationComponentProperties(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
73234    composeBackboneElementProperties(element);
73235      if (element.hasLanguageElement()) {
73236        composeCodeCore("language", element.getLanguageElement(), false);
73237        composeCodeExtras("language", element.getLanguageElement(), false);
73238      }
73239      if (element.hasUse()) {
73240        composeCoding("use", element.getUse());
73241      }
73242      if (element.hasAdditionalUse()) {
73243        openArray("additionalUse");
73244        for (Coding e : element.getAdditionalUse()) 
73245          composeCoding(null, e);
73246        closeArray();
73247      };
73248      if (element.hasValueElement()) {
73249        composeStringCore("value", element.getValueElement(), false);
73250        composeStringExtras("value", element.getValueElement(), false);
73251      }
73252  }
73253
73254  protected void composeConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
73255    if (element != null) {
73256      open(name);
73257      composeConceptSetFilterComponentProperties(element);
73258      close();
73259    }
73260  }
73261
73262  protected void composeConceptSetFilterComponentProperties(ValueSet.ConceptSetFilterComponent element) throws IOException {
73263    composeBackboneElementProperties(element);
73264      if (element.hasPropertyElement()) {
73265        composeCodeCore("property", element.getPropertyElement(), false);
73266        composeCodeExtras("property", element.getPropertyElement(), false);
73267      }
73268      if (element.hasOpElement()) {
73269        composeEnumerationCore("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
73270        composeEnumerationExtras("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
73271      }
73272      if (element.hasValueElement()) {
73273        composeStringCore("value", element.getValueElement(), false);
73274        composeStringExtras("value", element.getValueElement(), false);
73275      }
73276  }
73277
73278  protected void composeValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
73279    if (element != null) {
73280      open(name);
73281      composeValueSetExpansionComponentProperties(element);
73282      close();
73283    }
73284  }
73285
73286  protected void composeValueSetExpansionComponentProperties(ValueSet.ValueSetExpansionComponent element) throws IOException {
73287    composeBackboneElementProperties(element);
73288      if (element.hasIdentifierElement()) {
73289        composeUriCore("identifier", element.getIdentifierElement(), false);
73290        composeUriExtras("identifier", element.getIdentifierElement(), false);
73291      }
73292      if (element.hasNextElement()) {
73293        composeUriCore("next", element.getNextElement(), false);
73294        composeUriExtras("next", element.getNextElement(), false);
73295      }
73296      if (element.hasTimestampElement()) {
73297        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
73298        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
73299      }
73300      if (element.hasTotalElement()) {
73301        composeIntegerCore("total", element.getTotalElement(), false);
73302        composeIntegerExtras("total", element.getTotalElement(), false);
73303      }
73304      if (element.hasOffsetElement()) {
73305        composeIntegerCore("offset", element.getOffsetElement(), false);
73306        composeIntegerExtras("offset", element.getOffsetElement(), false);
73307      }
73308      if (element.hasParameter()) {
73309        openArray("parameter");
73310        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
73311          composeValueSetExpansionParameterComponent(null, e);
73312        closeArray();
73313      };
73314      if (element.hasProperty()) {
73315        openArray("property");
73316        for (ValueSet.ValueSetExpansionPropertyComponent e : element.getProperty()) 
73317          composeValueSetExpansionPropertyComponent(null, e);
73318        closeArray();
73319      };
73320      if (element.hasContains()) {
73321        openArray("contains");
73322        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
73323          composeValueSetExpansionContainsComponent(null, e);
73324        closeArray();
73325      };
73326  }
73327
73328  protected void composeValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
73329    if (element != null) {
73330      open(name);
73331      composeValueSetExpansionParameterComponentProperties(element);
73332      close();
73333    }
73334  }
73335
73336  protected void composeValueSetExpansionParameterComponentProperties(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
73337    composeBackboneElementProperties(element);
73338      if (element.hasNameElement()) {
73339        composeStringCore("name", element.getNameElement(), false);
73340        composeStringExtras("name", element.getNameElement(), false);
73341      }
73342      if (element.hasValue()) {
73343        composeType("value", element.getValue());
73344      }
73345  }
73346
73347  protected void composeValueSetExpansionPropertyComponent(String name, ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
73348    if (element != null) {
73349      open(name);
73350      composeValueSetExpansionPropertyComponentProperties(element);
73351      close();
73352    }
73353  }
73354
73355  protected void composeValueSetExpansionPropertyComponentProperties(ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
73356    composeBackboneElementProperties(element);
73357      if (element.hasCodeElement()) {
73358        composeCodeCore("code", element.getCodeElement(), false);
73359        composeCodeExtras("code", element.getCodeElement(), false);
73360      }
73361      if (element.hasUriElement()) {
73362        composeUriCore("uri", element.getUriElement(), false);
73363        composeUriExtras("uri", element.getUriElement(), false);
73364      }
73365  }
73366
73367  protected void composeValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
73368    if (element != null) {
73369      open(name);
73370      composeValueSetExpansionContainsComponentProperties(element);
73371      close();
73372    }
73373  }
73374
73375  protected void composeValueSetExpansionContainsComponentProperties(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
73376    composeBackboneElementProperties(element);
73377      if (element.hasSystemElement()) {
73378        composeUriCore("system", element.getSystemElement(), false);
73379        composeUriExtras("system", element.getSystemElement(), false);
73380      }
73381      if (element.hasAbstractElement()) {
73382        composeBooleanCore("abstract", element.getAbstractElement(), false);
73383        composeBooleanExtras("abstract", element.getAbstractElement(), false);
73384      }
73385      if (element.hasInactiveElement()) {
73386        composeBooleanCore("inactive", element.getInactiveElement(), false);
73387        composeBooleanExtras("inactive", element.getInactiveElement(), false);
73388      }
73389      if (element.hasVersionElement()) {
73390        composeStringCore("version", element.getVersionElement(), false);
73391        composeStringExtras("version", element.getVersionElement(), false);
73392      }
73393      if (element.hasCodeElement()) {
73394        composeCodeCore("code", element.getCodeElement(), false);
73395        composeCodeExtras("code", element.getCodeElement(), false);
73396      }
73397      if (element.hasDisplayElement()) {
73398        composeStringCore("display", element.getDisplayElement(), false);
73399        composeStringExtras("display", element.getDisplayElement(), false);
73400      }
73401      if (element.hasDesignation()) {
73402        openArray("designation");
73403        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
73404          composeConceptReferenceDesignationComponent(null, e);
73405        closeArray();
73406      };
73407      if (element.hasProperty()) {
73408        openArray("property");
73409        for (ValueSet.ConceptPropertyComponent e : element.getProperty()) 
73410          composeConceptPropertyComponent(null, e);
73411        closeArray();
73412      };
73413      if (element.hasContains()) {
73414        openArray("contains");
73415        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
73416          composeValueSetExpansionContainsComponent(null, e);
73417        closeArray();
73418      };
73419  }
73420
73421  protected void composeConceptPropertyComponent(String name, ValueSet.ConceptPropertyComponent element) throws IOException {
73422    if (element != null) {
73423      open(name);
73424      composeConceptPropertyComponentProperties(element);
73425      close();
73426    }
73427  }
73428
73429  protected void composeConceptPropertyComponentProperties(ValueSet.ConceptPropertyComponent element) throws IOException {
73430    composeBackboneElementProperties(element);
73431      if (element.hasCodeElement()) {
73432        composeCodeCore("code", element.getCodeElement(), false);
73433        composeCodeExtras("code", element.getCodeElement(), false);
73434      }
73435      if (element.hasValue()) {
73436        composeType("value", element.getValue());
73437      }
73438      if (element.hasSubProperty()) {
73439        openArray("subProperty");
73440        for (ValueSet.ConceptSubPropertyComponent e : element.getSubProperty()) 
73441          composeConceptSubPropertyComponent(null, e);
73442        closeArray();
73443      };
73444  }
73445
73446  protected void composeConceptSubPropertyComponent(String name, ValueSet.ConceptSubPropertyComponent element) throws IOException {
73447    if (element != null) {
73448      open(name);
73449      composeConceptSubPropertyComponentProperties(element);
73450      close();
73451    }
73452  }
73453
73454  protected void composeConceptSubPropertyComponentProperties(ValueSet.ConceptSubPropertyComponent element) throws IOException {
73455    composeBackboneElementProperties(element);
73456      if (element.hasCodeElement()) {
73457        composeCodeCore("code", element.getCodeElement(), false);
73458        composeCodeExtras("code", element.getCodeElement(), false);
73459      }
73460      if (element.hasValue()) {
73461        composeType("value", element.getValue());
73462      }
73463  }
73464
73465  protected void composeValueSetScopeComponent(String name, ValueSet.ValueSetScopeComponent element) throws IOException {
73466    if (element != null) {
73467      open(name);
73468      composeValueSetScopeComponentProperties(element);
73469      close();
73470    }
73471  }
73472
73473  protected void composeValueSetScopeComponentProperties(ValueSet.ValueSetScopeComponent element) throws IOException {
73474    composeBackboneElementProperties(element);
73475      if (element.hasInclusionCriteriaElement()) {
73476        composeStringCore("inclusionCriteria", element.getInclusionCriteriaElement(), false);
73477        composeStringExtras("inclusionCriteria", element.getInclusionCriteriaElement(), false);
73478      }
73479      if (element.hasExclusionCriteriaElement()) {
73480        composeStringCore("exclusionCriteria", element.getExclusionCriteriaElement(), false);
73481        composeStringExtras("exclusionCriteria", element.getExclusionCriteriaElement(), false);
73482      }
73483  }
73484
73485  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
73486    if (element != null) {
73487      prop("resourceType", name);
73488      composeVerificationResultProperties(element);
73489    }
73490  }
73491
73492  protected void composeVerificationResultProperties(VerificationResult element) throws IOException {
73493    composeDomainResourceProperties(element);
73494      if (element.hasTarget()) {
73495        openArray("target");
73496        for (Reference e : element.getTarget()) 
73497          composeReference(null, e);
73498        closeArray();
73499      };
73500      if (element.hasTargetLocation()) {
73501        if (anyHasValue(element.getTargetLocation())) {
73502          openArray("targetLocation");
73503          for (StringType e : element.getTargetLocation()) 
73504            composeStringCore(null, e, e != element.getTargetLocation().get(element.getTargetLocation().size()-1));
73505          closeArray();
73506        }
73507        if (anyHasExtras(element.getTargetLocation())) {
73508          openArray("_targetLocation");
73509          for (StringType e : element.getTargetLocation()) 
73510            composeStringExtras(null, e, true);
73511          closeArray();
73512        }
73513      };
73514      if (element.hasNeed()) {
73515        composeCodeableConcept("need", element.getNeed());
73516      }
73517      if (element.hasStatusElement()) {
73518        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.VerificationResultStatusEnumFactory(), false);
73519        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.VerificationResultStatusEnumFactory(), false);
73520      }
73521      if (element.hasStatusDateElement()) {
73522        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
73523        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
73524      }
73525      if (element.hasValidationType()) {
73526        composeCodeableConcept("validationType", element.getValidationType());
73527      }
73528      if (element.hasValidationProcess()) {
73529        openArray("validationProcess");
73530        for (CodeableConcept e : element.getValidationProcess()) 
73531          composeCodeableConcept(null, e);
73532        closeArray();
73533      };
73534      if (element.hasFrequency()) {
73535        composeTiming("frequency", element.getFrequency());
73536      }
73537      if (element.hasLastPerformedElement()) {
73538        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
73539        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
73540      }
73541      if (element.hasNextScheduledElement()) {
73542        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
73543        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
73544      }
73545      if (element.hasFailureAction()) {
73546        composeCodeableConcept("failureAction", element.getFailureAction());
73547      }
73548      if (element.hasPrimarySource()) {
73549        openArray("primarySource");
73550        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
73551          composeVerificationResultPrimarySourceComponent(null, e);
73552        closeArray();
73553      };
73554      if (element.hasAttestation()) {
73555        composeVerificationResultAttestationComponent("attestation", element.getAttestation());
73556      }
73557      if (element.hasValidator()) {
73558        openArray("validator");
73559        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
73560          composeVerificationResultValidatorComponent(null, e);
73561        closeArray();
73562      };
73563  }
73564
73565  protected void composeVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
73566    if (element != null) {
73567      open(name);
73568      composeVerificationResultPrimarySourceComponentProperties(element);
73569      close();
73570    }
73571  }
73572
73573  protected void composeVerificationResultPrimarySourceComponentProperties(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
73574    composeBackboneElementProperties(element);
73575      if (element.hasWho()) {
73576        composeReference("who", element.getWho());
73577      }
73578      if (element.hasType()) {
73579        openArray("type");
73580        for (CodeableConcept e : element.getType()) 
73581          composeCodeableConcept(null, e);
73582        closeArray();
73583      };
73584      if (element.hasCommunicationMethod()) {
73585        openArray("communicationMethod");
73586        for (CodeableConcept e : element.getCommunicationMethod()) 
73587          composeCodeableConcept(null, e);
73588        closeArray();
73589      };
73590      if (element.hasValidationStatus()) {
73591        composeCodeableConcept("validationStatus", element.getValidationStatus());
73592      }
73593      if (element.hasValidationDateElement()) {
73594        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
73595        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
73596      }
73597      if (element.hasCanPushUpdates()) {
73598        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
73599      }
73600      if (element.hasPushTypeAvailable()) {
73601        openArray("pushTypeAvailable");
73602        for (CodeableConcept e : element.getPushTypeAvailable()) 
73603          composeCodeableConcept(null, e);
73604        closeArray();
73605      };
73606  }
73607
73608  protected void composeVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
73609    if (element != null) {
73610      open(name);
73611      composeVerificationResultAttestationComponentProperties(element);
73612      close();
73613    }
73614  }
73615
73616  protected void composeVerificationResultAttestationComponentProperties(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
73617    composeBackboneElementProperties(element);
73618      if (element.hasWho()) {
73619        composeReference("who", element.getWho());
73620      }
73621      if (element.hasOnBehalfOf()) {
73622        composeReference("onBehalfOf", element.getOnBehalfOf());
73623      }
73624      if (element.hasCommunicationMethod()) {
73625        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
73626      }
73627      if (element.hasDateElement()) {
73628        composeDateCore("date", element.getDateElement(), false);
73629        composeDateExtras("date", element.getDateElement(), false);
73630      }
73631      if (element.hasSourceIdentityCertificateElement()) {
73632        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
73633        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
73634      }
73635      if (element.hasProxyIdentityCertificateElement()) {
73636        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
73637        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
73638      }
73639      if (element.hasProxySignature()) {
73640        composeSignature("proxySignature", element.getProxySignature());
73641      }
73642      if (element.hasSourceSignature()) {
73643        composeSignature("sourceSignature", element.getSourceSignature());
73644      }
73645  }
73646
73647  protected void composeVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
73648    if (element != null) {
73649      open(name);
73650      composeVerificationResultValidatorComponentProperties(element);
73651      close();
73652    }
73653  }
73654
73655  protected void composeVerificationResultValidatorComponentProperties(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
73656    composeBackboneElementProperties(element);
73657      if (element.hasOrganization()) {
73658        composeReference("organization", element.getOrganization());
73659      }
73660      if (element.hasIdentityCertificateElement()) {
73661        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
73662        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
73663      }
73664      if (element.hasAttestationSignature()) {
73665        composeSignature("attestationSignature", element.getAttestationSignature());
73666      }
73667  }
73668
73669  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
73670    if (element != null) {
73671      prop("resourceType", name);
73672      composeVisionPrescriptionProperties(element);
73673    }
73674  }
73675
73676  protected void composeVisionPrescriptionProperties(VisionPrescription element) throws IOException {
73677    composeDomainResourceProperties(element);
73678      if (element.hasIdentifier()) {
73679        openArray("identifier");
73680        for (Identifier e : element.getIdentifier()) 
73681          composeIdentifier(null, e);
73682        closeArray();
73683      };
73684      if (element.hasStatusElement()) {
73685        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
73686        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
73687      }
73688      if (element.hasCreatedElement()) {
73689        composeDateTimeCore("created", element.getCreatedElement(), false);
73690        composeDateTimeExtras("created", element.getCreatedElement(), false);
73691      }
73692      if (element.hasPatient()) {
73693        composeReference("patient", element.getPatient());
73694      }
73695      if (element.hasEncounter()) {
73696        composeReference("encounter", element.getEncounter());
73697      }
73698      if (element.hasDateWrittenElement()) {
73699        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
73700        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
73701      }
73702      if (element.hasPrescriber()) {
73703        composeReference("prescriber", element.getPrescriber());
73704      }
73705      if (element.hasLensSpecification()) {
73706        openArray("lensSpecification");
73707        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
73708          composeVisionPrescriptionLensSpecificationComponent(null, e);
73709        closeArray();
73710      };
73711  }
73712
73713  protected void composeVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
73714    if (element != null) {
73715      open(name);
73716      composeVisionPrescriptionLensSpecificationComponentProperties(element);
73717      close();
73718    }
73719  }
73720
73721  protected void composeVisionPrescriptionLensSpecificationComponentProperties(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
73722    composeBackboneElementProperties(element);
73723      if (element.hasProduct()) {
73724        composeCodeableConcept("product", element.getProduct());
73725      }
73726      if (element.hasEyeElement()) {
73727        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
73728        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
73729      }
73730      if (element.hasSphereElement()) {
73731        composeDecimalCore("sphere", element.getSphereElement(), false);
73732        composeDecimalExtras("sphere", element.getSphereElement(), false);
73733      }
73734      if (element.hasCylinderElement()) {
73735        composeDecimalCore("cylinder", element.getCylinderElement(), false);
73736        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
73737      }
73738      if (element.hasAxisElement()) {
73739        composeIntegerCore("axis", element.getAxisElement(), false);
73740        composeIntegerExtras("axis", element.getAxisElement(), false);
73741      }
73742      if (element.hasPrism()) {
73743        openArray("prism");
73744        for (VisionPrescription.PrismComponent e : element.getPrism()) 
73745          composePrismComponent(null, e);
73746        closeArray();
73747      };
73748      if (element.hasAddElement()) {
73749        composeDecimalCore("add", element.getAddElement(), false);
73750        composeDecimalExtras("add", element.getAddElement(), false);
73751      }
73752      if (element.hasPowerElement()) {
73753        composeDecimalCore("power", element.getPowerElement(), false);
73754        composeDecimalExtras("power", element.getPowerElement(), false);
73755      }
73756      if (element.hasBackCurveElement()) {
73757        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
73758        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
73759      }
73760      if (element.hasDiameterElement()) {
73761        composeDecimalCore("diameter", element.getDiameterElement(), false);
73762        composeDecimalExtras("diameter", element.getDiameterElement(), false);
73763      }
73764      if (element.hasDuration()) {
73765        composeQuantity("duration", element.getDuration());
73766      }
73767      if (element.hasColorElement()) {
73768        composeStringCore("color", element.getColorElement(), false);
73769        composeStringExtras("color", element.getColorElement(), false);
73770      }
73771      if (element.hasBrandElement()) {
73772        composeStringCore("brand", element.getBrandElement(), false);
73773        composeStringExtras("brand", element.getBrandElement(), false);
73774      }
73775      if (element.hasNote()) {
73776        openArray("note");
73777        for (Annotation e : element.getNote()) 
73778          composeAnnotation(null, e);
73779        closeArray();
73780      };
73781  }
73782
73783  protected void composePrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
73784    if (element != null) {
73785      open(name);
73786      composePrismComponentProperties(element);
73787      close();
73788    }
73789  }
73790
73791  protected void composePrismComponentProperties(VisionPrescription.PrismComponent element) throws IOException {
73792    composeBackboneElementProperties(element);
73793      if (element.hasAmountElement()) {
73794        composeDecimalCore("amount", element.getAmountElement(), false);
73795        composeDecimalExtras("amount", element.getAmountElement(), false);
73796      }
73797      if (element.hasBaseElement()) {
73798        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
73799        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
73800      }
73801  }
73802
73803
73804
73805  @Override
73806  protected void composeResource(Resource resource) throws IOException {
73807    if (resource == null) {
73808      throw new Error("Unhandled resource type "+resource.getClass().getName());
73809    } else if (resource instanceof Account) {
73810      composeAccount("Account", (Account)resource);
73811    } else if (resource instanceof ActivityDefinition) {
73812      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
73813    } else if (resource instanceof ActorDefinition) {
73814      composeActorDefinition("ActorDefinition", (ActorDefinition)resource);
73815    } else if (resource instanceof AdministrableProductDefinition) {
73816      composeAdministrableProductDefinition("AdministrableProductDefinition", (AdministrableProductDefinition)resource);
73817    } else if (resource instanceof AdverseEvent) {
73818      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
73819    } else if (resource instanceof AllergyIntolerance) {
73820      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
73821    } else if (resource instanceof Appointment) {
73822      composeAppointment("Appointment", (Appointment)resource);
73823    } else if (resource instanceof AppointmentResponse) {
73824      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
73825    } else if (resource instanceof ArtifactAssessment) {
73826      composeArtifactAssessment("ArtifactAssessment", (ArtifactAssessment)resource);
73827    } else if (resource instanceof AuditEvent) {
73828      composeAuditEvent("AuditEvent", (AuditEvent)resource);
73829    } else if (resource instanceof Basic) {
73830      composeBasic("Basic", (Basic)resource);
73831    } else if (resource instanceof Binary) {
73832      composeBinary("Binary", (Binary)resource);
73833    } else if (resource instanceof BiologicallyDerivedProduct) {
73834      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
73835    } else if (resource instanceof BiologicallyDerivedProductDispense) {
73836      composeBiologicallyDerivedProductDispense("BiologicallyDerivedProductDispense", (BiologicallyDerivedProductDispense)resource);
73837    } else if (resource instanceof BodyStructure) {
73838      composeBodyStructure("BodyStructure", (BodyStructure)resource);
73839    } else if (resource instanceof Bundle) {
73840      composeBundle("Bundle", (Bundle)resource);
73841    } else if (resource instanceof CapabilityStatement) {
73842      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
73843    } else if (resource instanceof CarePlan) {
73844      composeCarePlan("CarePlan", (CarePlan)resource);
73845    } else if (resource instanceof CareTeam) {
73846      composeCareTeam("CareTeam", (CareTeam)resource);
73847    } else if (resource instanceof ChargeItem) {
73848      composeChargeItem("ChargeItem", (ChargeItem)resource);
73849    } else if (resource instanceof ChargeItemDefinition) {
73850      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
73851    } else if (resource instanceof Citation) {
73852      composeCitation("Citation", (Citation)resource);
73853    } else if (resource instanceof Claim) {
73854      composeClaim("Claim", (Claim)resource);
73855    } else if (resource instanceof ClaimResponse) {
73856      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
73857    } else if (resource instanceof ClinicalImpression) {
73858      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
73859    } else if (resource instanceof ClinicalUseDefinition) {
73860      composeClinicalUseDefinition("ClinicalUseDefinition", (ClinicalUseDefinition)resource);
73861    } else if (resource instanceof CodeSystem) {
73862      composeCodeSystem("CodeSystem", (CodeSystem)resource);
73863    } else if (resource instanceof Communication) {
73864      composeCommunication("Communication", (Communication)resource);
73865    } else if (resource instanceof CommunicationRequest) {
73866      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
73867    } else if (resource instanceof CompartmentDefinition) {
73868      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
73869    } else if (resource instanceof Composition) {
73870      composeComposition("Composition", (Composition)resource);
73871    } else if (resource instanceof ConceptMap) {
73872      composeConceptMap("ConceptMap", (ConceptMap)resource);
73873    } else if (resource instanceof Condition) {
73874      composeCondition("Condition", (Condition)resource);
73875    } else if (resource instanceof ConditionDefinition) {
73876      composeConditionDefinition("ConditionDefinition", (ConditionDefinition)resource);
73877    } else if (resource instanceof Consent) {
73878      composeConsent("Consent", (Consent)resource);
73879    } else if (resource instanceof Contract) {
73880      composeContract("Contract", (Contract)resource);
73881    } else if (resource instanceof Coverage) {
73882      composeCoverage("Coverage", (Coverage)resource);
73883    } else if (resource instanceof CoverageEligibilityRequest) {
73884      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
73885    } else if (resource instanceof CoverageEligibilityResponse) {
73886      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
73887    } else if (resource instanceof DetectedIssue) {
73888      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
73889    } else if (resource instanceof Device) {
73890      composeDevice("Device", (Device)resource);
73891    } else if (resource instanceof DeviceAssociation) {
73892      composeDeviceAssociation("DeviceAssociation", (DeviceAssociation)resource);
73893    } else if (resource instanceof DeviceDefinition) {
73894      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
73895    } else if (resource instanceof DeviceDispense) {
73896      composeDeviceDispense("DeviceDispense", (DeviceDispense)resource);
73897    } else if (resource instanceof DeviceMetric) {
73898      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
73899    } else if (resource instanceof DeviceRequest) {
73900      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
73901    } else if (resource instanceof DeviceUsage) {
73902      composeDeviceUsage("DeviceUsage", (DeviceUsage)resource);
73903    } else if (resource instanceof DiagnosticReport) {
73904      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
73905    } else if (resource instanceof DocumentReference) {
73906      composeDocumentReference("DocumentReference", (DocumentReference)resource);
73907    } else if (resource instanceof Encounter) {
73908      composeEncounter("Encounter", (Encounter)resource);
73909    } else if (resource instanceof EncounterHistory) {
73910      composeEncounterHistory("EncounterHistory", (EncounterHistory)resource);
73911    } else if (resource instanceof Endpoint) {
73912      composeEndpoint("Endpoint", (Endpoint)resource);
73913    } else if (resource instanceof EnrollmentRequest) {
73914      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
73915    } else if (resource instanceof EnrollmentResponse) {
73916      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
73917    } else if (resource instanceof EpisodeOfCare) {
73918      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
73919    } else if (resource instanceof EventDefinition) {
73920      composeEventDefinition("EventDefinition", (EventDefinition)resource);
73921    } else if (resource instanceof Evidence) {
73922      composeEvidence("Evidence", (Evidence)resource);
73923    } else if (resource instanceof EvidenceReport) {
73924      composeEvidenceReport("EvidenceReport", (EvidenceReport)resource);
73925    } else if (resource instanceof EvidenceVariable) {
73926      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
73927    } else if (resource instanceof ExampleScenario) {
73928      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
73929    } else if (resource instanceof ExplanationOfBenefit) {
73930      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
73931    } else if (resource instanceof FamilyMemberHistory) {
73932      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
73933    } else if (resource instanceof Flag) {
73934      composeFlag("Flag", (Flag)resource);
73935    } else if (resource instanceof FormularyItem) {
73936      composeFormularyItem("FormularyItem", (FormularyItem)resource);
73937    } else if (resource instanceof GenomicStudy) {
73938      composeGenomicStudy("GenomicStudy", (GenomicStudy)resource);
73939    } else if (resource instanceof Goal) {
73940      composeGoal("Goal", (Goal)resource);
73941    } else if (resource instanceof GraphDefinition) {
73942      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
73943    } else if (resource instanceof Group) {
73944      composeGroup("Group", (Group)resource);
73945    } else if (resource instanceof GuidanceResponse) {
73946      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
73947    } else if (resource instanceof HealthcareService) {
73948      composeHealthcareService("HealthcareService", (HealthcareService)resource);
73949    } else if (resource instanceof ImagingSelection) {
73950      composeImagingSelection("ImagingSelection", (ImagingSelection)resource);
73951    } else if (resource instanceof ImagingStudy) {
73952      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
73953    } else if (resource instanceof Immunization) {
73954      composeImmunization("Immunization", (Immunization)resource);
73955    } else if (resource instanceof ImmunizationEvaluation) {
73956      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
73957    } else if (resource instanceof ImmunizationRecommendation) {
73958      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
73959    } else if (resource instanceof ImplementationGuide) {
73960      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
73961    } else if (resource instanceof Ingredient) {
73962      composeIngredient("Ingredient", (Ingredient)resource);
73963    } else if (resource instanceof InsurancePlan) {
73964      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
73965    } else if (resource instanceof InventoryItem) {
73966      composeInventoryItem("InventoryItem", (InventoryItem)resource);
73967    } else if (resource instanceof InventoryReport) {
73968      composeInventoryReport("InventoryReport", (InventoryReport)resource);
73969    } else if (resource instanceof Invoice) {
73970      composeInvoice("Invoice", (Invoice)resource);
73971    } else if (resource instanceof Library) {
73972      composeLibrary("Library", (Library)resource);
73973    } else if (resource instanceof Linkage) {
73974      composeLinkage("Linkage", (Linkage)resource);
73975    } else if (resource instanceof ListResource) {
73976      composeListResource("List", (ListResource)resource);
73977    } else if (resource instanceof Location) {
73978      composeLocation("Location", (Location)resource);
73979    } else if (resource instanceof ManufacturedItemDefinition) {
73980      composeManufacturedItemDefinition("ManufacturedItemDefinition", (ManufacturedItemDefinition)resource);
73981    } else if (resource instanceof Measure) {
73982      composeMeasure("Measure", (Measure)resource);
73983    } else if (resource instanceof MeasureReport) {
73984      composeMeasureReport("MeasureReport", (MeasureReport)resource);
73985    } else if (resource instanceof Medication) {
73986      composeMedication("Medication", (Medication)resource);
73987    } else if (resource instanceof MedicationAdministration) {
73988      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
73989    } else if (resource instanceof MedicationDispense) {
73990      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
73991    } else if (resource instanceof MedicationKnowledge) {
73992      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
73993    } else if (resource instanceof MedicationRequest) {
73994      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
73995    } else if (resource instanceof MedicationStatement) {
73996      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
73997    } else if (resource instanceof MedicinalProductDefinition) {
73998      composeMedicinalProductDefinition("MedicinalProductDefinition", (MedicinalProductDefinition)resource);
73999    } else if (resource instanceof MessageDefinition) {
74000      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
74001    } else if (resource instanceof MessageHeader) {
74002      composeMessageHeader("MessageHeader", (MessageHeader)resource);
74003    } else if (resource instanceof MolecularSequence) {
74004      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
74005    } else if (resource instanceof NamingSystem) {
74006      composeNamingSystem("NamingSystem", (NamingSystem)resource);
74007    } else if (resource instanceof NutritionIntake) {
74008      composeNutritionIntake("NutritionIntake", (NutritionIntake)resource);
74009    } else if (resource instanceof NutritionOrder) {
74010      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
74011    } else if (resource instanceof NutritionProduct) {
74012      composeNutritionProduct("NutritionProduct", (NutritionProduct)resource);
74013    } else if (resource instanceof Observation) {
74014      composeObservation("Observation", (Observation)resource);
74015    } else if (resource instanceof ObservationDefinition) {
74016      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
74017    } else if (resource instanceof OperationDefinition) {
74018      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
74019    } else if (resource instanceof OperationOutcome) {
74020      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
74021    } else if (resource instanceof Organization) {
74022      composeOrganization("Organization", (Organization)resource);
74023    } else if (resource instanceof OrganizationAffiliation) {
74024      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
74025    } else if (resource instanceof PackagedProductDefinition) {
74026      composePackagedProductDefinition("PackagedProductDefinition", (PackagedProductDefinition)resource);
74027    } else if (resource instanceof Parameters) {
74028      composeParameters("Parameters", (Parameters)resource);
74029    } else if (resource instanceof Patient) {
74030      composePatient("Patient", (Patient)resource);
74031    } else if (resource instanceof PaymentNotice) {
74032      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
74033    } else if (resource instanceof PaymentReconciliation) {
74034      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
74035    } else if (resource instanceof Permission) {
74036      composePermission("Permission", (Permission)resource);
74037    } else if (resource instanceof Person) {
74038      composePerson("Person", (Person)resource);
74039    } else if (resource instanceof PlanDefinition) {
74040      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
74041    } else if (resource instanceof Practitioner) {
74042      composePractitioner("Practitioner", (Practitioner)resource);
74043    } else if (resource instanceof PractitionerRole) {
74044      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
74045    } else if (resource instanceof Procedure) {
74046      composeProcedure("Procedure", (Procedure)resource);
74047    } else if (resource instanceof Provenance) {
74048      composeProvenance("Provenance", (Provenance)resource);
74049    } else if (resource instanceof Questionnaire) {
74050      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
74051    } else if (resource instanceof QuestionnaireResponse) {
74052      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
74053    } else if (resource instanceof RegulatedAuthorization) {
74054      composeRegulatedAuthorization("RegulatedAuthorization", (RegulatedAuthorization)resource);
74055    } else if (resource instanceof RelatedPerson) {
74056      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
74057    } else if (resource instanceof RequestOrchestration) {
74058      composeRequestOrchestration("RequestOrchestration", (RequestOrchestration)resource);
74059    } else if (resource instanceof Requirements) {
74060      composeRequirements("Requirements", (Requirements)resource);
74061    } else if (resource instanceof ResearchStudy) {
74062      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
74063    } else if (resource instanceof ResearchSubject) {
74064      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
74065    } else if (resource instanceof RiskAssessment) {
74066      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
74067    } else if (resource instanceof Schedule) {
74068      composeSchedule("Schedule", (Schedule)resource);
74069    } else if (resource instanceof SearchParameter) {
74070      composeSearchParameter("SearchParameter", (SearchParameter)resource);
74071    } else if (resource instanceof ServiceRequest) {
74072      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
74073    } else if (resource instanceof Slot) {
74074      composeSlot("Slot", (Slot)resource);
74075    } else if (resource instanceof Specimen) {
74076      composeSpecimen("Specimen", (Specimen)resource);
74077    } else if (resource instanceof SpecimenDefinition) {
74078      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
74079    } else if (resource instanceof StructureDefinition) {
74080      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
74081    } else if (resource instanceof StructureMap) {
74082      composeStructureMap("StructureMap", (StructureMap)resource);
74083    } else if (resource instanceof Subscription) {
74084      composeSubscription("Subscription", (Subscription)resource);
74085    } else if (resource instanceof SubscriptionStatus) {
74086      composeSubscriptionStatus("SubscriptionStatus", (SubscriptionStatus)resource);
74087    } else if (resource instanceof SubscriptionTopic) {
74088      composeSubscriptionTopic("SubscriptionTopic", (SubscriptionTopic)resource);
74089    } else if (resource instanceof Substance) {
74090      composeSubstance("Substance", (Substance)resource);
74091    } else if (resource instanceof SubstanceDefinition) {
74092      composeSubstanceDefinition("SubstanceDefinition", (SubstanceDefinition)resource);
74093    } else if (resource instanceof SubstanceNucleicAcid) {
74094      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
74095    } else if (resource instanceof SubstancePolymer) {
74096      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
74097    } else if (resource instanceof SubstanceProtein) {
74098      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
74099    } else if (resource instanceof SubstanceReferenceInformation) {
74100      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
74101    } else if (resource instanceof SubstanceSourceMaterial) {
74102      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
74103    } else if (resource instanceof SupplyDelivery) {
74104      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
74105    } else if (resource instanceof SupplyRequest) {
74106      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
74107    } else if (resource instanceof Task) {
74108      composeTask("Task", (Task)resource);
74109    } else if (resource instanceof TerminologyCapabilities) {
74110      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
74111    } else if (resource instanceof TestPlan) {
74112      composeTestPlan("TestPlan", (TestPlan)resource);
74113    } else if (resource instanceof TestReport) {
74114      composeTestReport("TestReport", (TestReport)resource);
74115    } else if (resource instanceof TestScript) {
74116      composeTestScript("TestScript", (TestScript)resource);
74117    } else if (resource instanceof Transport) {
74118      composeTransport("Transport", (Transport)resource);
74119    } else if (resource instanceof ValueSet) {
74120      composeValueSet("ValueSet", (ValueSet)resource);
74121    } else if (resource instanceof VerificationResult) {
74122      composeVerificationResult("VerificationResult", (VerificationResult)resource);
74123    } else if (resource instanceof VisionPrescription) {
74124      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
74125 
74126    } else
74127      throw new Error("Unhandled resource type "+resource.getClass().getName());
74128  }
74129
74130  protected void composeNamedReference(String name, Resource resource) throws IOException {
74131    if (resource == null) {
74132      throw new Error("Unhandled resource type "+resource.getClass().getName());
74133    } else if (resource instanceof Account) {
74134      composeAccount(name, (Account)resource);
74135    } else if (resource instanceof ActivityDefinition) {
74136      composeActivityDefinition(name, (ActivityDefinition)resource);
74137    } else if (resource instanceof ActorDefinition) {
74138      composeActorDefinition(name, (ActorDefinition)resource);
74139    } else if (resource instanceof AdministrableProductDefinition) {
74140      composeAdministrableProductDefinition(name, (AdministrableProductDefinition)resource);
74141    } else if (resource instanceof AdverseEvent) {
74142      composeAdverseEvent(name, (AdverseEvent)resource);
74143    } else if (resource instanceof AllergyIntolerance) {
74144      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
74145    } else if (resource instanceof Appointment) {
74146      composeAppointment(name, (Appointment)resource);
74147    } else if (resource instanceof AppointmentResponse) {
74148      composeAppointmentResponse(name, (AppointmentResponse)resource);
74149    } else if (resource instanceof ArtifactAssessment) {
74150      composeArtifactAssessment(name, (ArtifactAssessment)resource);
74151    } else if (resource instanceof AuditEvent) {
74152      composeAuditEvent(name, (AuditEvent)resource);
74153    } else if (resource instanceof Basic) {
74154      composeBasic(name, (Basic)resource);
74155    } else if (resource instanceof Binary) {
74156      composeBinary(name, (Binary)resource);
74157    } else if (resource instanceof BiologicallyDerivedProduct) {
74158      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
74159    } else if (resource instanceof BiologicallyDerivedProductDispense) {
74160      composeBiologicallyDerivedProductDispense(name, (BiologicallyDerivedProductDispense)resource);
74161    } else if (resource instanceof BodyStructure) {
74162      composeBodyStructure(name, (BodyStructure)resource);
74163    } else if (resource instanceof Bundle) {
74164      composeBundle(name, (Bundle)resource);
74165    } else if (resource instanceof CapabilityStatement) {
74166      composeCapabilityStatement(name, (CapabilityStatement)resource);
74167    } else if (resource instanceof CarePlan) {
74168      composeCarePlan(name, (CarePlan)resource);
74169    } else if (resource instanceof CareTeam) {
74170      composeCareTeam(name, (CareTeam)resource);
74171    } else if (resource instanceof ChargeItem) {
74172      composeChargeItem(name, (ChargeItem)resource);
74173    } else if (resource instanceof ChargeItemDefinition) {
74174      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
74175    } else if (resource instanceof Citation) {
74176      composeCitation(name, (Citation)resource);
74177    } else if (resource instanceof Claim) {
74178      composeClaim(name, (Claim)resource);
74179    } else if (resource instanceof ClaimResponse) {
74180      composeClaimResponse(name, (ClaimResponse)resource);
74181    } else if (resource instanceof ClinicalImpression) {
74182      composeClinicalImpression(name, (ClinicalImpression)resource);
74183    } else if (resource instanceof ClinicalUseDefinition) {
74184      composeClinicalUseDefinition(name, (ClinicalUseDefinition)resource);
74185    } else if (resource instanceof CodeSystem) {
74186      composeCodeSystem(name, (CodeSystem)resource);
74187    } else if (resource instanceof Communication) {
74188      composeCommunication(name, (Communication)resource);
74189    } else if (resource instanceof CommunicationRequest) {
74190      composeCommunicationRequest(name, (CommunicationRequest)resource);
74191    } else if (resource instanceof CompartmentDefinition) {
74192      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
74193    } else if (resource instanceof Composition) {
74194      composeComposition(name, (Composition)resource);
74195    } else if (resource instanceof ConceptMap) {
74196      composeConceptMap(name, (ConceptMap)resource);
74197    } else if (resource instanceof Condition) {
74198      composeCondition(name, (Condition)resource);
74199    } else if (resource instanceof ConditionDefinition) {
74200      composeConditionDefinition(name, (ConditionDefinition)resource);
74201    } else if (resource instanceof Consent) {
74202      composeConsent(name, (Consent)resource);
74203    } else if (resource instanceof Contract) {
74204      composeContract(name, (Contract)resource);
74205    } else if (resource instanceof Coverage) {
74206      composeCoverage(name, (Coverage)resource);
74207    } else if (resource instanceof CoverageEligibilityRequest) {
74208      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
74209    } else if (resource instanceof CoverageEligibilityResponse) {
74210      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
74211    } else if (resource instanceof DetectedIssue) {
74212      composeDetectedIssue(name, (DetectedIssue)resource);
74213    } else if (resource instanceof Device) {
74214      composeDevice(name, (Device)resource);
74215    } else if (resource instanceof DeviceAssociation) {
74216      composeDeviceAssociation(name, (DeviceAssociation)resource);
74217    } else if (resource instanceof DeviceDefinition) {
74218      composeDeviceDefinition(name, (DeviceDefinition)resource);
74219    } else if (resource instanceof DeviceDispense) {
74220      composeDeviceDispense(name, (DeviceDispense)resource);
74221    } else if (resource instanceof DeviceMetric) {
74222      composeDeviceMetric(name, (DeviceMetric)resource);
74223    } else if (resource instanceof DeviceRequest) {
74224      composeDeviceRequest(name, (DeviceRequest)resource);
74225    } else if (resource instanceof DeviceUsage) {
74226      composeDeviceUsage(name, (DeviceUsage)resource);
74227    } else if (resource instanceof DiagnosticReport) {
74228      composeDiagnosticReport(name, (DiagnosticReport)resource);
74229    } else if (resource instanceof DocumentReference) {
74230      composeDocumentReference(name, (DocumentReference)resource);
74231    } else if (resource instanceof Encounter) {
74232      composeEncounter(name, (Encounter)resource);
74233    } else if (resource instanceof EncounterHistory) {
74234      composeEncounterHistory(name, (EncounterHistory)resource);
74235    } else if (resource instanceof Endpoint) {
74236      composeEndpoint(name, (Endpoint)resource);
74237    } else if (resource instanceof EnrollmentRequest) {
74238      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
74239    } else if (resource instanceof EnrollmentResponse) {
74240      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
74241    } else if (resource instanceof EpisodeOfCare) {
74242      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
74243    } else if (resource instanceof EventDefinition) {
74244      composeEventDefinition(name, (EventDefinition)resource);
74245    } else if (resource instanceof Evidence) {
74246      composeEvidence(name, (Evidence)resource);
74247    } else if (resource instanceof EvidenceReport) {
74248      composeEvidenceReport(name, (EvidenceReport)resource);
74249    } else if (resource instanceof EvidenceVariable) {
74250      composeEvidenceVariable(name, (EvidenceVariable)resource);
74251    } else if (resource instanceof ExampleScenario) {
74252      composeExampleScenario(name, (ExampleScenario)resource);
74253    } else if (resource instanceof ExplanationOfBenefit) {
74254      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
74255    } else if (resource instanceof FamilyMemberHistory) {
74256      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
74257    } else if (resource instanceof Flag) {
74258      composeFlag(name, (Flag)resource);
74259    } else if (resource instanceof FormularyItem) {
74260      composeFormularyItem(name, (FormularyItem)resource);
74261    } else if (resource instanceof GenomicStudy) {
74262      composeGenomicStudy(name, (GenomicStudy)resource);
74263    } else if (resource instanceof Goal) {
74264      composeGoal(name, (Goal)resource);
74265    } else if (resource instanceof GraphDefinition) {
74266      composeGraphDefinition(name, (GraphDefinition)resource);
74267    } else if (resource instanceof Group) {
74268      composeGroup(name, (Group)resource);
74269    } else if (resource instanceof GuidanceResponse) {
74270      composeGuidanceResponse(name, (GuidanceResponse)resource);
74271    } else if (resource instanceof HealthcareService) {
74272      composeHealthcareService(name, (HealthcareService)resource);
74273    } else if (resource instanceof ImagingSelection) {
74274      composeImagingSelection(name, (ImagingSelection)resource);
74275    } else if (resource instanceof ImagingStudy) {
74276      composeImagingStudy(name, (ImagingStudy)resource);
74277    } else if (resource instanceof Immunization) {
74278      composeImmunization(name, (Immunization)resource);
74279    } else if (resource instanceof ImmunizationEvaluation) {
74280      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
74281    } else if (resource instanceof ImmunizationRecommendation) {
74282      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
74283    } else if (resource instanceof ImplementationGuide) {
74284      composeImplementationGuide(name, (ImplementationGuide)resource);
74285    } else if (resource instanceof Ingredient) {
74286      composeIngredient(name, (Ingredient)resource);
74287    } else if (resource instanceof InsurancePlan) {
74288      composeInsurancePlan(name, (InsurancePlan)resource);
74289    } else if (resource instanceof InventoryItem) {
74290      composeInventoryItem(name, (InventoryItem)resource);
74291    } else if (resource instanceof InventoryReport) {
74292      composeInventoryReport(name, (InventoryReport)resource);
74293    } else if (resource instanceof Invoice) {
74294      composeInvoice(name, (Invoice)resource);
74295    } else if (resource instanceof Library) {
74296      composeLibrary(name, (Library)resource);
74297    } else if (resource instanceof Linkage) {
74298      composeLinkage(name, (Linkage)resource);
74299    } else if (resource instanceof ListResource) {
74300      composeListResource(name, (ListResource)resource);
74301    } else if (resource instanceof Location) {
74302      composeLocation(name, (Location)resource);
74303    } else if (resource instanceof ManufacturedItemDefinition) {
74304      composeManufacturedItemDefinition(name, (ManufacturedItemDefinition)resource);
74305    } else if (resource instanceof Measure) {
74306      composeMeasure(name, (Measure)resource);
74307    } else if (resource instanceof MeasureReport) {
74308      composeMeasureReport(name, (MeasureReport)resource);
74309    } else if (resource instanceof Medication) {
74310      composeMedication(name, (Medication)resource);
74311    } else if (resource instanceof MedicationAdministration) {
74312      composeMedicationAdministration(name, (MedicationAdministration)resource);
74313    } else if (resource instanceof MedicationDispense) {
74314      composeMedicationDispense(name, (MedicationDispense)resource);
74315    } else if (resource instanceof MedicationKnowledge) {
74316      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
74317    } else if (resource instanceof MedicationRequest) {
74318      composeMedicationRequest(name, (MedicationRequest)resource);
74319    } else if (resource instanceof MedicationStatement) {
74320      composeMedicationStatement(name, (MedicationStatement)resource);
74321    } else if (resource instanceof MedicinalProductDefinition) {
74322      composeMedicinalProductDefinition(name, (MedicinalProductDefinition)resource);
74323    } else if (resource instanceof MessageDefinition) {
74324      composeMessageDefinition(name, (MessageDefinition)resource);
74325    } else if (resource instanceof MessageHeader) {
74326      composeMessageHeader(name, (MessageHeader)resource);
74327    } else if (resource instanceof MolecularSequence) {
74328      composeMolecularSequence(name, (MolecularSequence)resource);
74329    } else if (resource instanceof NamingSystem) {
74330      composeNamingSystem(name, (NamingSystem)resource);
74331    } else if (resource instanceof NutritionIntake) {
74332      composeNutritionIntake(name, (NutritionIntake)resource);
74333    } else if (resource instanceof NutritionOrder) {
74334      composeNutritionOrder(name, (NutritionOrder)resource);
74335    } else if (resource instanceof NutritionProduct) {
74336      composeNutritionProduct(name, (NutritionProduct)resource);
74337    } else if (resource instanceof Observation) {
74338      composeObservation(name, (Observation)resource);
74339    } else if (resource instanceof ObservationDefinition) {
74340      composeObservationDefinition(name, (ObservationDefinition)resource);
74341    } else if (resource instanceof OperationDefinition) {
74342      composeOperationDefinition(name, (OperationDefinition)resource);
74343    } else if (resource instanceof OperationOutcome) {
74344      composeOperationOutcome(name, (OperationOutcome)resource);
74345    } else if (resource instanceof Organization) {
74346      composeOrganization(name, (Organization)resource);
74347    } else if (resource instanceof OrganizationAffiliation) {
74348      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
74349    } else if (resource instanceof PackagedProductDefinition) {
74350      composePackagedProductDefinition(name, (PackagedProductDefinition)resource);
74351    } else if (resource instanceof Parameters) {
74352      composeParameters(name, (Parameters)resource);
74353    } else if (resource instanceof Patient) {
74354      composePatient(name, (Patient)resource);
74355    } else if (resource instanceof PaymentNotice) {
74356      composePaymentNotice(name, (PaymentNotice)resource);
74357    } else if (resource instanceof PaymentReconciliation) {
74358      composePaymentReconciliation(name, (PaymentReconciliation)resource);
74359    } else if (resource instanceof Permission) {
74360      composePermission(name, (Permission)resource);
74361    } else if (resource instanceof Person) {
74362      composePerson(name, (Person)resource);
74363    } else if (resource instanceof PlanDefinition) {
74364      composePlanDefinition(name, (PlanDefinition)resource);
74365    } else if (resource instanceof Practitioner) {
74366      composePractitioner(name, (Practitioner)resource);
74367    } else if (resource instanceof PractitionerRole) {
74368      composePractitionerRole(name, (PractitionerRole)resource);
74369    } else if (resource instanceof Procedure) {
74370      composeProcedure(name, (Procedure)resource);
74371    } else if (resource instanceof Provenance) {
74372      composeProvenance(name, (Provenance)resource);
74373    } else if (resource instanceof Questionnaire) {
74374      composeQuestionnaire(name, (Questionnaire)resource);
74375    } else if (resource instanceof QuestionnaireResponse) {
74376      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
74377    } else if (resource instanceof RegulatedAuthorization) {
74378      composeRegulatedAuthorization(name, (RegulatedAuthorization)resource);
74379    } else if (resource instanceof RelatedPerson) {
74380      composeRelatedPerson(name, (RelatedPerson)resource);
74381    } else if (resource instanceof RequestOrchestration) {
74382      composeRequestOrchestration(name, (RequestOrchestration)resource);
74383    } else if (resource instanceof Requirements) {
74384      composeRequirements(name, (Requirements)resource);
74385    } else if (resource instanceof ResearchStudy) {
74386      composeResearchStudy(name, (ResearchStudy)resource);
74387    } else if (resource instanceof ResearchSubject) {
74388      composeResearchSubject(name, (ResearchSubject)resource);
74389    } else if (resource instanceof RiskAssessment) {
74390      composeRiskAssessment(name, (RiskAssessment)resource);
74391    } else if (resource instanceof Schedule) {
74392      composeSchedule(name, (Schedule)resource);
74393    } else if (resource instanceof SearchParameter) {
74394      composeSearchParameter(name, (SearchParameter)resource);
74395    } else if (resource instanceof ServiceRequest) {
74396      composeServiceRequest(name, (ServiceRequest)resource);
74397    } else if (resource instanceof Slot) {
74398      composeSlot(name, (Slot)resource);
74399    } else if (resource instanceof Specimen) {
74400      composeSpecimen(name, (Specimen)resource);
74401    } else if (resource instanceof SpecimenDefinition) {
74402      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
74403    } else if (resource instanceof StructureDefinition) {
74404      composeStructureDefinition(name, (StructureDefinition)resource);
74405    } else if (resource instanceof StructureMap) {
74406      composeStructureMap(name, (StructureMap)resource);
74407    } else if (resource instanceof Subscription) {
74408      composeSubscription(name, (Subscription)resource);
74409    } else if (resource instanceof SubscriptionStatus) {
74410      composeSubscriptionStatus(name, (SubscriptionStatus)resource);
74411    } else if (resource instanceof SubscriptionTopic) {
74412      composeSubscriptionTopic(name, (SubscriptionTopic)resource);
74413    } else if (resource instanceof Substance) {
74414      composeSubstance(name, (Substance)resource);
74415    } else if (resource instanceof SubstanceDefinition) {
74416      composeSubstanceDefinition(name, (SubstanceDefinition)resource);
74417    } else if (resource instanceof SubstanceNucleicAcid) {
74418      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
74419    } else if (resource instanceof SubstancePolymer) {
74420      composeSubstancePolymer(name, (SubstancePolymer)resource);
74421    } else if (resource instanceof SubstanceProtein) {
74422      composeSubstanceProtein(name, (SubstanceProtein)resource);
74423    } else if (resource instanceof SubstanceReferenceInformation) {
74424      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
74425    } else if (resource instanceof SubstanceSourceMaterial) {
74426      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
74427    } else if (resource instanceof SupplyDelivery) {
74428      composeSupplyDelivery(name, (SupplyDelivery)resource);
74429    } else if (resource instanceof SupplyRequest) {
74430      composeSupplyRequest(name, (SupplyRequest)resource);
74431    } else if (resource instanceof Task) {
74432      composeTask(name, (Task)resource);
74433    } else if (resource instanceof TerminologyCapabilities) {
74434      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
74435    } else if (resource instanceof TestPlan) {
74436      composeTestPlan(name, (TestPlan)resource);
74437    } else if (resource instanceof TestReport) {
74438      composeTestReport(name, (TestReport)resource);
74439    } else if (resource instanceof TestScript) {
74440      composeTestScript(name, (TestScript)resource);
74441    } else if (resource instanceof Transport) {
74442      composeTransport(name, (Transport)resource);
74443    } else if (resource instanceof ValueSet) {
74444      composeValueSet(name, (ValueSet)resource);
74445    } else if (resource instanceof VerificationResult) {
74446      composeVerificationResult(name, (VerificationResult)resource);
74447    } else if (resource instanceof VisionPrescription) {
74448      composeVisionPrescription(name, (VisionPrescription)resource);
74449 
74450    } else
74451      throw new Error("Unhandled resource type "+resource.getClass().getName());
74452  }
74453
74454  protected void composeType(String prefix, DataType type) throws IOException {
74455    if (type == null) {
74456      ;
74457    } else if (type instanceof Address) {
74458       composeAddress(prefix+"Address", (Address) type);
74459    } else if (type instanceof Age) {
74460       composeAge(prefix+"Age", (Age) type);
74461    } else if (type instanceof Annotation) {
74462       composeAnnotation(prefix+"Annotation", (Annotation) type);
74463    } else if (type instanceof Attachment) {
74464       composeAttachment(prefix+"Attachment", (Attachment) type);
74465    } else if (type instanceof Availability) {
74466       composeAvailability(prefix+"Availability", (Availability) type);
74467    } else if (type instanceof CodeableConcept) {
74468       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
74469    } else if (type instanceof CodeableReference) {
74470       composeCodeableReference(prefix+"CodeableReference", (CodeableReference) type);
74471    } else if (type instanceof Coding) {
74472       composeCoding(prefix+"Coding", (Coding) type);
74473    } else if (type instanceof ContactDetail) {
74474       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
74475    } else if (type instanceof ContactPoint) {
74476       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
74477    } else if (type instanceof Contributor) {
74478       composeContributor(prefix+"Contributor", (Contributor) type);
74479    } else if (type instanceof Count) {
74480       composeCount(prefix+"Count", (Count) type);
74481    } else if (type instanceof DataRequirement) {
74482       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
74483    } else if (type instanceof Distance) {
74484       composeDistance(prefix+"Distance", (Distance) type);
74485    } else if (type instanceof Dosage) {
74486       composeDosage(prefix+"Dosage", (Dosage) type);
74487    } else if (type instanceof Duration) {
74488       composeDuration(prefix+"Duration", (Duration) type);
74489    } else if (type instanceof ElementDefinition) {
74490       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
74491    } else if (type instanceof Expression) {
74492       composeExpression(prefix+"Expression", (Expression) type);
74493    } else if (type instanceof ExtendedContactDetail) {
74494       composeExtendedContactDetail(prefix+"ExtendedContactDetail", (ExtendedContactDetail) type);
74495    } else if (type instanceof Extension) {
74496       composeExtension(prefix+"Extension", (Extension) type);
74497    } else if (type instanceof HumanName) {
74498       composeHumanName(prefix+"HumanName", (HumanName) type);
74499    } else if (type instanceof Identifier) {
74500       composeIdentifier(prefix+"Identifier", (Identifier) type);
74501    } else if (type instanceof MarketingStatus) {
74502       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
74503    } else if (type instanceof Meta) {
74504       composeMeta(prefix+"Meta", (Meta) type);
74505    } else if (type instanceof MonetaryComponent) {
74506       composeMonetaryComponent(prefix+"MonetaryComponent", (MonetaryComponent) type);
74507    } else if (type instanceof Money) {
74508       composeMoney(prefix+"Money", (Money) type);
74509    } else if (type instanceof Narrative) {
74510       composeNarrative(prefix+"Narrative", (Narrative) type);
74511    } else if (type instanceof ParameterDefinition) {
74512       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
74513    } else if (type instanceof Period) {
74514       composePeriod(prefix+"Period", (Period) type);
74515    } else if (type instanceof ProductShelfLife) {
74516       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
74517    } else if (type instanceof Quantity) {
74518       composeQuantity(prefix+"Quantity", (Quantity) type);
74519    } else if (type instanceof Range) {
74520       composeRange(prefix+"Range", (Range) type);
74521    } else if (type instanceof Ratio) {
74522       composeRatio(prefix+"Ratio", (Ratio) type);
74523    } else if (type instanceof RatioRange) {
74524       composeRatioRange(prefix+"RatioRange", (RatioRange) type);
74525    } else if (type instanceof Reference) {
74526       composeReference(prefix+"Reference", (Reference) type);
74527    } else if (type instanceof RelatedArtifact) {
74528       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
74529    } else if (type instanceof SampledData) {
74530       composeSampledData(prefix+"SampledData", (SampledData) type);
74531    } else if (type instanceof Signature) {
74532       composeSignature(prefix+"Signature", (Signature) type);
74533    } else if (type instanceof Timing) {
74534       composeTiming(prefix+"Timing", (Timing) type);
74535    } else if (type instanceof TriggerDefinition) {
74536       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
74537    } else if (type instanceof UsageContext) {
74538       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
74539    } else if (type instanceof VirtualServiceDetail) {
74540       composeVirtualServiceDetail(prefix+"VirtualServiceDetail", (VirtualServiceDetail) type);
74541 
74542    } else if (type instanceof CodeType) {
74543      composeCodeCore(prefix+"Code", (CodeType) type, false);
74544      composeCodeExtras(prefix+"Code", (CodeType) type, false);
74545    }
74546    else if (type instanceof OidType) {
74547      composeOidCore(prefix+"Oid", (OidType) type, false);
74548      composeOidExtras(prefix+"Oid", (OidType) type, false);
74549    }
74550    else if (type instanceof CanonicalType) {
74551      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
74552      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
74553    }
74554    else if (type instanceof UuidType) {
74555      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
74556      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
74557    }
74558    else if (type instanceof UrlType) {
74559      composeUrlCore(prefix+"Url", (UrlType) type, false);
74560      composeUrlExtras(prefix+"Url", (UrlType) type, false);
74561    }
74562    else if (type instanceof UnsignedIntType) {
74563      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
74564      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
74565    }
74566    else if (type instanceof MarkdownType) {
74567      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
74568      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
74569    }
74570    else if (type instanceof IdType) {
74571      composeIdCore(prefix+"Id", (IdType) type, false);
74572      composeIdExtras(prefix+"Id", (IdType) type, false);
74573    }
74574    else if (type instanceof PositiveIntType) {
74575      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
74576      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
74577    }
74578    else if (type instanceof DateType) {
74579      composeDateCore(prefix+"Date", (DateType) type, false);
74580      composeDateExtras(prefix+"Date", (DateType) type, false);
74581    }
74582    else if (type instanceof DateTimeType) {
74583      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
74584      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
74585    }
74586    else if (type instanceof StringType) {
74587      composeStringCore(prefix+"String", (StringType) type, false);
74588      composeStringExtras(prefix+"String", (StringType) type, false);
74589    }
74590    else if (type instanceof IntegerType) {
74591      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
74592      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
74593    }
74594    else if (type instanceof Integer64Type) {
74595      composeInteger64Core(prefix+"Integer64", (Integer64Type) type, false);
74596      composeInteger64Extras(prefix+"Integer64", (Integer64Type) type, false);
74597    }
74598    else if (type instanceof UriType) {
74599      composeUriCore(prefix+"Uri", (UriType) type, false);
74600      composeUriExtras(prefix+"Uri", (UriType) type, false);
74601    }
74602    else if (type instanceof InstantType) {
74603      composeInstantCore(prefix+"Instant", (InstantType) type, false);
74604      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
74605    }
74606    else if (type instanceof BooleanType) {
74607      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
74608      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
74609    }
74610    else if (type instanceof Base64BinaryType) {
74611      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
74612      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
74613    }
74614    else if (type instanceof TimeType) {
74615      composeTimeCore(prefix+"Time", (TimeType) type, false);
74616      composeTimeExtras(prefix+"Time", (TimeType) type, false);
74617    }
74618    else if (type instanceof DecimalType) {
74619      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
74620      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
74621    } else
74622      throw new Error("Unhandled type");
74623  }
74624
74625  protected void composeTypeInner(DataType type) throws IOException {
74626    if (type == null) {
74627      ;
74628    } else if (type instanceof Address) {
74629       composeAddressProperties((Address) type);
74630    } else if (type instanceof Age) {
74631       composeAgeProperties((Age) type);
74632    } else if (type instanceof Annotation) {
74633       composeAnnotationProperties((Annotation) type);
74634    } else if (type instanceof Attachment) {
74635       composeAttachmentProperties((Attachment) type);
74636    } else if (type instanceof Availability) {
74637       composeAvailabilityProperties((Availability) type);
74638    } else if (type instanceof CodeableConcept) {
74639       composeCodeableConceptProperties((CodeableConcept) type);
74640    } else if (type instanceof CodeableReference) {
74641       composeCodeableReferenceProperties((CodeableReference) type);
74642    } else if (type instanceof Coding) {
74643       composeCodingProperties((Coding) type);
74644    } else if (type instanceof ContactDetail) {
74645       composeContactDetailProperties((ContactDetail) type);
74646    } else if (type instanceof ContactPoint) {
74647       composeContactPointProperties((ContactPoint) type);
74648    } else if (type instanceof Contributor) {
74649       composeContributorProperties((Contributor) type);
74650    } else if (type instanceof Count) {
74651       composeCountProperties((Count) type);
74652    } else if (type instanceof DataRequirement) {
74653       composeDataRequirementProperties((DataRequirement) type);
74654    } else if (type instanceof Distance) {
74655       composeDistanceProperties((Distance) type);
74656    } else if (type instanceof Dosage) {
74657       composeDosageProperties((Dosage) type);
74658    } else if (type instanceof Duration) {
74659       composeDurationProperties((Duration) type);
74660    } else if (type instanceof ElementDefinition) {
74661       composeElementDefinitionProperties((ElementDefinition) type);
74662    } else if (type instanceof Expression) {
74663       composeExpressionProperties((Expression) type);
74664    } else if (type instanceof ExtendedContactDetail) {
74665       composeExtendedContactDetailProperties((ExtendedContactDetail) type);
74666    } else if (type instanceof Extension) {
74667       composeExtensionProperties((Extension) type);
74668    } else if (type instanceof HumanName) {
74669       composeHumanNameProperties((HumanName) type);
74670    } else if (type instanceof Identifier) {
74671       composeIdentifierProperties((Identifier) type);
74672    } else if (type instanceof MarketingStatus) {
74673       composeMarketingStatusProperties((MarketingStatus) type);
74674    } else if (type instanceof Meta) {
74675       composeMetaProperties((Meta) type);
74676    } else if (type instanceof MonetaryComponent) {
74677       composeMonetaryComponentProperties((MonetaryComponent) type);
74678    } else if (type instanceof Money) {
74679       composeMoneyProperties((Money) type);
74680    } else if (type instanceof Narrative) {
74681       composeNarrativeProperties((Narrative) type);
74682    } else if (type instanceof ParameterDefinition) {
74683       composeParameterDefinitionProperties((ParameterDefinition) type);
74684    } else if (type instanceof Period) {
74685       composePeriodProperties((Period) type);
74686    } else if (type instanceof ProductShelfLife) {
74687       composeProductShelfLifeProperties((ProductShelfLife) type);
74688    } else if (type instanceof Quantity) {
74689       composeQuantityProperties((Quantity) type);
74690    } else if (type instanceof Range) {
74691       composeRangeProperties((Range) type);
74692    } else if (type instanceof Ratio) {
74693       composeRatioProperties((Ratio) type);
74694    } else if (type instanceof RatioRange) {
74695       composeRatioRangeProperties((RatioRange) type);
74696    } else if (type instanceof Reference) {
74697       composeReferenceProperties((Reference) type);
74698    } else if (type instanceof RelatedArtifact) {
74699       composeRelatedArtifactProperties((RelatedArtifact) type);
74700    } else if (type instanceof SampledData) {
74701       composeSampledDataProperties((SampledData) type);
74702    } else if (type instanceof Signature) {
74703       composeSignatureProperties((Signature) type);
74704    } else if (type instanceof Timing) {
74705       composeTimingProperties((Timing) type);
74706    } else if (type instanceof TriggerDefinition) {
74707       composeTriggerDefinitionProperties((TriggerDefinition) type);
74708    } else if (type instanceof UsageContext) {
74709       composeUsageContextProperties((UsageContext) type);
74710    } else if (type instanceof VirtualServiceDetail) {
74711       composeVirtualServiceDetailProperties((VirtualServiceDetail) type);
74712 
74713    } else
74714      throw new Error("Unhandled type: "+type.fhirType());
74715  }
74716
74717}