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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i), 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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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(getJsonObjectFromArray(array, i)));
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    } else {
35390      Resource res = parseCustomResource(t, json);
35391      if (res != null) {
35392        return res;
35393      } else {
35394        throw new FHIRFormatError("Unknown/Unrecognised resource type '"+t+"' (in property 'resourceType')");
35395      }
35396    }
35397  }
35398
35399  protected DataType parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
35400    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
35401      DataType t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
35402      if (json.has("_"+prefix+"Date"))
35403        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
35404      return t;
35405    }
35406    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
35407      DataType t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
35408      if (json.has("_"+prefix+"DateTime"))
35409        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
35410      return t;
35411    }
35412    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
35413      DataType t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
35414      if (json.has("_"+prefix+"Code"))
35415        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
35416      return t;
35417    }
35418    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
35419      DataType t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
35420      if (json.has("_"+prefix+"String"))
35421        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
35422      return t;
35423    }
35424    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
35425      DataType t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
35426      if (json.has("_"+prefix+"Integer"))
35427        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
35428      return t;
35429    }
35430    else if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64")) {
35431      DataType t = json.has(prefix+"Integer64") ? parseInteger64(json.get(prefix+"Integer64").getAsLong()) : new Integer64Type();
35432      if (json.has("_"+prefix+"Integer64"))
35433        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer64"), t);
35434      return t;
35435    }
35436    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
35437      DataType t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
35438      if (json.has("_"+prefix+"Oid"))
35439        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
35440      return t;
35441    }
35442    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
35443      DataType t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
35444      if (json.has("_"+prefix+"Canonical"))
35445        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
35446      return t;
35447    }
35448    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
35449      DataType t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
35450      if (json.has("_"+prefix+"Uri"))
35451        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
35452      return t;
35453    }
35454    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
35455      DataType t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
35456      if (json.has("_"+prefix+"Uuid"))
35457        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
35458      return t;
35459    }
35460    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
35461      DataType t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
35462      if (json.has("_"+prefix+"Url"))
35463        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
35464      return t;
35465    }
35466    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
35467      DataType t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
35468      if (json.has("_"+prefix+"Instant"))
35469        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
35470      return t;
35471    }
35472    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
35473      DataType t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
35474      if (json.has("_"+prefix+"Boolean"))
35475        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
35476      return t;
35477    }
35478    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
35479      DataType t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
35480      if (json.has("_"+prefix+"Base64Binary"))
35481        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
35482      return t;
35483    }
35484    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
35485      DataType t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
35486      if (json.has("_"+prefix+"UnsignedInt"))
35487        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
35488      return t;
35489    }
35490    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
35491      DataType t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
35492      if (json.has("_"+prefix+"Markdown"))
35493        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
35494      return t;
35495    }
35496    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
35497      DataType t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
35498      if (json.has("_"+prefix+"Time"))
35499        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
35500      return t;
35501    }
35502    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
35503      DataType t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
35504      if (json.has("_"+prefix+"Id"))
35505        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
35506      return t;
35507    }
35508    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
35509      DataType t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
35510      if (json.has("_"+prefix+"PositiveInt"))
35511        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
35512      return t;
35513    }
35514    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
35515      DataType t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
35516      if (json.has("_"+prefix+"Decimal"))
35517        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
35518      return t;
35519    } else if (json.has(prefix+"Address")) {
35520      return parseAddress(getJObject(json, prefix+"Address"));
35521    } else if (json.has(prefix+"Age")) {
35522      return parseAge(getJObject(json, prefix+"Age"));
35523    } else if (json.has(prefix+"Annotation")) {
35524      return parseAnnotation(getJObject(json, prefix+"Annotation"));
35525    } else if (json.has(prefix+"Attachment")) {
35526      return parseAttachment(getJObject(json, prefix+"Attachment"));
35527    } else if (json.has(prefix+"Availability")) {
35528      return parseAvailability(getJObject(json, prefix+"Availability"));
35529    } else if (json.has(prefix+"CodeableConcept")) {
35530      return parseCodeableConcept(getJObject(json, prefix+"CodeableConcept"));
35531    } else if (json.has(prefix+"CodeableReference")) {
35532      return parseCodeableReference(getJObject(json, prefix+"CodeableReference"));
35533    } else if (json.has(prefix+"Coding")) {
35534      return parseCoding(getJObject(json, prefix+"Coding"));
35535    } else if (json.has(prefix+"ContactDetail")) {
35536      return parseContactDetail(getJObject(json, prefix+"ContactDetail"));
35537    } else if (json.has(prefix+"ContactPoint")) {
35538      return parseContactPoint(getJObject(json, prefix+"ContactPoint"));
35539    } else if (json.has(prefix+"Contributor")) {
35540      return parseContributor(getJObject(json, prefix+"Contributor"));
35541    } else if (json.has(prefix+"Count")) {
35542      return parseCount(getJObject(json, prefix+"Count"));
35543    } else if (json.has(prefix+"DataRequirement")) {
35544      return parseDataRequirement(getJObject(json, prefix+"DataRequirement"));
35545    } else if (json.has(prefix+"Distance")) {
35546      return parseDistance(getJObject(json, prefix+"Distance"));
35547    } else if (json.has(prefix+"Dosage")) {
35548      return parseDosage(getJObject(json, prefix+"Dosage"));
35549    } else if (json.has(prefix+"Duration")) {
35550      return parseDuration(getJObject(json, prefix+"Duration"));
35551    } else if (json.has(prefix+"ElementDefinition")) {
35552      return parseElementDefinition(getJObject(json, prefix+"ElementDefinition"));
35553    } else if (json.has(prefix+"Expression")) {
35554      return parseExpression(getJObject(json, prefix+"Expression"));
35555    } else if (json.has(prefix+"ExtendedContactDetail")) {
35556      return parseExtendedContactDetail(getJObject(json, prefix+"ExtendedContactDetail"));
35557    } else if (json.has(prefix+"Extension")) {
35558      return parseExtension(getJObject(json, prefix+"Extension"));
35559    } else if (json.has(prefix+"HumanName")) {
35560      return parseHumanName(getJObject(json, prefix+"HumanName"));
35561    } else if (json.has(prefix+"Identifier")) {
35562      return parseIdentifier(getJObject(json, prefix+"Identifier"));
35563    } else if (json.has(prefix+"MarketingStatus")) {
35564      return parseMarketingStatus(getJObject(json, prefix+"MarketingStatus"));
35565    } else if (json.has(prefix+"Meta")) {
35566      return parseMeta(getJObject(json, prefix+"Meta"));
35567    } else if (json.has(prefix+"MonetaryComponent")) {
35568      return parseMonetaryComponent(getJObject(json, prefix+"MonetaryComponent"));
35569    } else if (json.has(prefix+"Money")) {
35570      return parseMoney(getJObject(json, prefix+"Money"));
35571    } else if (json.has(prefix+"Narrative")) {
35572      return parseNarrative(getJObject(json, prefix+"Narrative"));
35573    } else if (json.has(prefix+"ParameterDefinition")) {
35574      return parseParameterDefinition(getJObject(json, prefix+"ParameterDefinition"));
35575    } else if (json.has(prefix+"Period")) {
35576      return parsePeriod(getJObject(json, prefix+"Period"));
35577    } else if (json.has(prefix+"ProductShelfLife")) {
35578      return parseProductShelfLife(getJObject(json, prefix+"ProductShelfLife"));
35579    } else if (json.has(prefix+"Quantity")) {
35580      return parseQuantity(getJObject(json, prefix+"Quantity"));
35581    } else if (json.has(prefix+"Range")) {
35582      return parseRange(getJObject(json, prefix+"Range"));
35583    } else if (json.has(prefix+"Ratio")) {
35584      return parseRatio(getJObject(json, prefix+"Ratio"));
35585    } else if (json.has(prefix+"RatioRange")) {
35586      return parseRatioRange(getJObject(json, prefix+"RatioRange"));
35587    } else if (json.has(prefix+"Reference")) {
35588      return parseReference(getJObject(json, prefix+"Reference"));
35589    } else if (json.has(prefix+"RelatedArtifact")) {
35590      return parseRelatedArtifact(getJObject(json, prefix+"RelatedArtifact"));
35591    } else if (json.has(prefix+"SampledData")) {
35592      return parseSampledData(getJObject(json, prefix+"SampledData"));
35593    } else if (json.has(prefix+"Signature")) {
35594      return parseSignature(getJObject(json, prefix+"Signature"));
35595    } else if (json.has(prefix+"Timing")) {
35596      return parseTiming(getJObject(json, prefix+"Timing"));
35597    } else if (json.has(prefix+"TriggerDefinition")) {
35598      return parseTriggerDefinition(getJObject(json, prefix+"TriggerDefinition"));
35599    } else if (json.has(prefix+"UsageContext")) {
35600      return parseUsageContext(getJObject(json, prefix+"UsageContext"));
35601    } else if (json.has(prefix+"VirtualServiceDetail")) {
35602      return parseVirtualServiceDetail(getJObject(json, prefix+"VirtualServiceDetail"));
35603
35604    } else {
35605      return null;
35606    }
35607  }
35608
35609  protected DataType parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
35610    return parseType(json, type);
35611  }
35612
35613  protected DataType parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
35614    if (Utilities.noString(type)) {
35615      throw new FHIRFormatError("Unable to parse type - type not specified"); 
35616   } else if (type.equals("Address")) {
35617      return parseAddress(json);
35618   } else if (type.equals("Age")) {
35619      return parseAge(json);
35620   } else if (type.equals("Annotation")) {
35621      return parseAnnotation(json);
35622   } else if (type.equals("Attachment")) {
35623      return parseAttachment(json);
35624   } else if (type.equals("Availability")) {
35625      return parseAvailability(json);
35626   } else if (type.equals("CodeableConcept")) {
35627      return parseCodeableConcept(json);
35628   } else if (type.equals("CodeableReference")) {
35629      return parseCodeableReference(json);
35630   } else if (type.equals("Coding")) {
35631      return parseCoding(json);
35632   } else if (type.equals("ContactDetail")) {
35633      return parseContactDetail(json);
35634   } else if (type.equals("ContactPoint")) {
35635      return parseContactPoint(json);
35636   } else if (type.equals("Contributor")) {
35637      return parseContributor(json);
35638   } else if (type.equals("Count")) {
35639      return parseCount(json);
35640   } else if (type.equals("DataRequirement")) {
35641      return parseDataRequirement(json);
35642   } else if (type.equals("Distance")) {
35643      return parseDistance(json);
35644   } else if (type.equals("Dosage")) {
35645      return parseDosage(json);
35646   } else if (type.equals("Duration")) {
35647      return parseDuration(json);
35648   } else if (type.equals("ElementDefinition")) {
35649      return parseElementDefinition(json);
35650   } else if (type.equals("Expression")) {
35651      return parseExpression(json);
35652   } else if (type.equals("ExtendedContactDetail")) {
35653      return parseExtendedContactDetail(json);
35654   } else if (type.equals("Extension")) {
35655      return parseExtension(json);
35656   } else if (type.equals("HumanName")) {
35657      return parseHumanName(json);
35658   } else if (type.equals("Identifier")) {
35659      return parseIdentifier(json);
35660   } else if (type.equals("MarketingStatus")) {
35661      return parseMarketingStatus(json);
35662   } else if (type.equals("Meta")) {
35663      return parseMeta(json);
35664   } else if (type.equals("MonetaryComponent")) {
35665      return parseMonetaryComponent(json);
35666   } else if (type.equals("Money")) {
35667      return parseMoney(json);
35668   } else if (type.equals("Narrative")) {
35669      return parseNarrative(json);
35670   } else if (type.equals("ParameterDefinition")) {
35671      return parseParameterDefinition(json);
35672   } else if (type.equals("Period")) {
35673      return parsePeriod(json);
35674   } else if (type.equals("ProductShelfLife")) {
35675      return parseProductShelfLife(json);
35676   } else if (type.equals("Quantity")) {
35677      return parseQuantity(json);
35678   } else if (type.equals("Range")) {
35679      return parseRange(json);
35680   } else if (type.equals("Ratio")) {
35681      return parseRatio(json);
35682   } else if (type.equals("RatioRange")) {
35683      return parseRatioRange(json);
35684   } else if (type.equals("Reference")) {
35685      return parseReference(json);
35686   } else if (type.equals("RelatedArtifact")) {
35687      return parseRelatedArtifact(json);
35688   } else if (type.equals("SampledData")) {
35689      return parseSampledData(json);
35690   } else if (type.equals("Signature")) {
35691      return parseSignature(json);
35692   } else if (type.equals("Timing")) {
35693      return parseTiming(json);
35694   } else if (type.equals("TriggerDefinition")) {
35695      return parseTriggerDefinition(json);
35696   } else if (type.equals("UsageContext")) {
35697      return parseUsageContext(json);
35698   } else if (type.equals("VirtualServiceDetail")) {
35699      return parseVirtualServiceDetail(json);
35700
35701    } else {
35702      throw new FHIRFormatError("Unknown Type "+type);
35703    }
35704  }
35705
35706  protected boolean hasTypeName(JsonObject json, String prefix) {
35707    if (json.has(prefix+"Address")) {
35708      return true;
35709    };
35710    if (json.has(prefix+"Age")) {
35711      return true;
35712    };
35713    if (json.has(prefix+"Annotation")) {
35714      return true;
35715    };
35716    if (json.has(prefix+"Attachment")) {
35717      return true;
35718    };
35719    if (json.has(prefix+"Availability")) {
35720      return true;
35721    };
35722    if (json.has(prefix+"CodeableConcept")) {
35723      return true;
35724    };
35725    if (json.has(prefix+"CodeableReference")) {
35726      return true;
35727    };
35728    if (json.has(prefix+"Coding")) {
35729      return true;
35730    };
35731    if (json.has(prefix+"ContactDetail")) {
35732      return true;
35733    };
35734    if (json.has(prefix+"ContactPoint")) {
35735      return true;
35736    };
35737    if (json.has(prefix+"Contributor")) {
35738      return true;
35739    };
35740    if (json.has(prefix+"Count")) {
35741      return true;
35742    };
35743    if (json.has(prefix+"DataRequirement")) {
35744      return true;
35745    };
35746    if (json.has(prefix+"Distance")) {
35747      return true;
35748    };
35749    if (json.has(prefix+"Dosage")) {
35750      return true;
35751    };
35752    if (json.has(prefix+"Duration")) {
35753      return true;
35754    };
35755    if (json.has(prefix+"ElementDefinition")) {
35756      return true;
35757    };
35758    if (json.has(prefix+"Expression")) {
35759      return true;
35760    };
35761    if (json.has(prefix+"ExtendedContactDetail")) {
35762      return true;
35763    };
35764    if (json.has(prefix+"Extension")) {
35765      return true;
35766    };
35767    if (json.has(prefix+"HumanName")) {
35768      return true;
35769    };
35770    if (json.has(prefix+"Identifier")) {
35771      return true;
35772    };
35773    if (json.has(prefix+"MarketingStatus")) {
35774      return true;
35775    };
35776    if (json.has(prefix+"Meta")) {
35777      return true;
35778    };
35779    if (json.has(prefix+"MonetaryComponent")) {
35780      return true;
35781    };
35782    if (json.has(prefix+"Money")) {
35783      return true;
35784    };
35785    if (json.has(prefix+"Narrative")) {
35786      return true;
35787    };
35788    if (json.has(prefix+"ParameterDefinition")) {
35789      return true;
35790    };
35791    if (json.has(prefix+"Period")) {
35792      return true;
35793    };
35794    if (json.has(prefix+"ProductShelfLife")) {
35795      return true;
35796    };
35797    if (json.has(prefix+"Quantity")) {
35798      return true;
35799    };
35800    if (json.has(prefix+"Range")) {
35801      return true;
35802    };
35803    if (json.has(prefix+"Ratio")) {
35804      return true;
35805    };
35806    if (json.has(prefix+"RatioRange")) {
35807      return true;
35808    };
35809    if (json.has(prefix+"Reference")) {
35810      return true;
35811    };
35812    if (json.has(prefix+"RelatedArtifact")) {
35813      return true;
35814    };
35815    if (json.has(prefix+"SampledData")) {
35816      return true;
35817    };
35818    if (json.has(prefix+"Signature")) {
35819      return true;
35820    };
35821    if (json.has(prefix+"Timing")) {
35822      return true;
35823    };
35824    if (json.has(prefix+"TriggerDefinition")) {
35825      return true;
35826    };
35827    if (json.has(prefix+"UsageContext")) {
35828      return true;
35829    };
35830    if (json.has(prefix+"VirtualServiceDetail")) {
35831      return true;
35832    };
35833    if (json.has(prefix+"Account")) {
35834      return true;
35835    };
35836    if (json.has(prefix+"ActivityDefinition")) {
35837      return true;
35838    };
35839    if (json.has(prefix+"ActorDefinition")) {
35840      return true;
35841    };
35842    if (json.has(prefix+"AdministrableProductDefinition")) {
35843      return true;
35844    };
35845    if (json.has(prefix+"AdverseEvent")) {
35846      return true;
35847    };
35848    if (json.has(prefix+"AllergyIntolerance")) {
35849      return true;
35850    };
35851    if (json.has(prefix+"Appointment")) {
35852      return true;
35853    };
35854    if (json.has(prefix+"AppointmentResponse")) {
35855      return true;
35856    };
35857    if (json.has(prefix+"ArtifactAssessment")) {
35858      return true;
35859    };
35860    if (json.has(prefix+"AuditEvent")) {
35861      return true;
35862    };
35863    if (json.has(prefix+"Basic")) {
35864      return true;
35865    };
35866    if (json.has(prefix+"Binary")) {
35867      return true;
35868    };
35869    if (json.has(prefix+"BiologicallyDerivedProduct")) {
35870      return true;
35871    };
35872    if (json.has(prefix+"BiologicallyDerivedProductDispense")) {
35873      return true;
35874    };
35875    if (json.has(prefix+"BodyStructure")) {
35876      return true;
35877    };
35878    if (json.has(prefix+"Bundle")) {
35879      return true;
35880    };
35881    if (json.has(prefix+"CapabilityStatement")) {
35882      return true;
35883    };
35884    if (json.has(prefix+"CarePlan")) {
35885      return true;
35886    };
35887    if (json.has(prefix+"CareTeam")) {
35888      return true;
35889    };
35890    if (json.has(prefix+"ChargeItem")) {
35891      return true;
35892    };
35893    if (json.has(prefix+"ChargeItemDefinition")) {
35894      return true;
35895    };
35896    if (json.has(prefix+"Citation")) {
35897      return true;
35898    };
35899    if (json.has(prefix+"Claim")) {
35900      return true;
35901    };
35902    if (json.has(prefix+"ClaimResponse")) {
35903      return true;
35904    };
35905    if (json.has(prefix+"ClinicalImpression")) {
35906      return true;
35907    };
35908    if (json.has(prefix+"ClinicalUseDefinition")) {
35909      return true;
35910    };
35911    if (json.has(prefix+"CodeSystem")) {
35912      return true;
35913    };
35914    if (json.has(prefix+"Communication")) {
35915      return true;
35916    };
35917    if (json.has(prefix+"CommunicationRequest")) {
35918      return true;
35919    };
35920    if (json.has(prefix+"CompartmentDefinition")) {
35921      return true;
35922    };
35923    if (json.has(prefix+"Composition")) {
35924      return true;
35925    };
35926    if (json.has(prefix+"ConceptMap")) {
35927      return true;
35928    };
35929    if (json.has(prefix+"Condition")) {
35930      return true;
35931    };
35932    if (json.has(prefix+"ConditionDefinition")) {
35933      return true;
35934    };
35935    if (json.has(prefix+"Consent")) {
35936      return true;
35937    };
35938    if (json.has(prefix+"Contract")) {
35939      return true;
35940    };
35941    if (json.has(prefix+"Coverage")) {
35942      return true;
35943    };
35944    if (json.has(prefix+"CoverageEligibilityRequest")) {
35945      return true;
35946    };
35947    if (json.has(prefix+"CoverageEligibilityResponse")) {
35948      return true;
35949    };
35950    if (json.has(prefix+"DetectedIssue")) {
35951      return true;
35952    };
35953    if (json.has(prefix+"Device")) {
35954      return true;
35955    };
35956    if (json.has(prefix+"DeviceAssociation")) {
35957      return true;
35958    };
35959    if (json.has(prefix+"DeviceDefinition")) {
35960      return true;
35961    };
35962    if (json.has(prefix+"DeviceDispense")) {
35963      return true;
35964    };
35965    if (json.has(prefix+"DeviceMetric")) {
35966      return true;
35967    };
35968    if (json.has(prefix+"DeviceRequest")) {
35969      return true;
35970    };
35971    if (json.has(prefix+"DeviceUsage")) {
35972      return true;
35973    };
35974    if (json.has(prefix+"DiagnosticReport")) {
35975      return true;
35976    };
35977    if (json.has(prefix+"DocumentReference")) {
35978      return true;
35979    };
35980    if (json.has(prefix+"Encounter")) {
35981      return true;
35982    };
35983    if (json.has(prefix+"EncounterHistory")) {
35984      return true;
35985    };
35986    if (json.has(prefix+"Endpoint")) {
35987      return true;
35988    };
35989    if (json.has(prefix+"EnrollmentRequest")) {
35990      return true;
35991    };
35992    if (json.has(prefix+"EnrollmentResponse")) {
35993      return true;
35994    };
35995    if (json.has(prefix+"EpisodeOfCare")) {
35996      return true;
35997    };
35998    if (json.has(prefix+"EventDefinition")) {
35999      return true;
36000    };
36001    if (json.has(prefix+"Evidence")) {
36002      return true;
36003    };
36004    if (json.has(prefix+"EvidenceReport")) {
36005      return true;
36006    };
36007    if (json.has(prefix+"EvidenceVariable")) {
36008      return true;
36009    };
36010    if (json.has(prefix+"ExampleScenario")) {
36011      return true;
36012    };
36013    if (json.has(prefix+"ExplanationOfBenefit")) {
36014      return true;
36015    };
36016    if (json.has(prefix+"FamilyMemberHistory")) {
36017      return true;
36018    };
36019    if (json.has(prefix+"Flag")) {
36020      return true;
36021    };
36022    if (json.has(prefix+"FormularyItem")) {
36023      return true;
36024    };
36025    if (json.has(prefix+"GenomicStudy")) {
36026      return true;
36027    };
36028    if (json.has(prefix+"Goal")) {
36029      return true;
36030    };
36031    if (json.has(prefix+"GraphDefinition")) {
36032      return true;
36033    };
36034    if (json.has(prefix+"Group")) {
36035      return true;
36036    };
36037    if (json.has(prefix+"GuidanceResponse")) {
36038      return true;
36039    };
36040    if (json.has(prefix+"HealthcareService")) {
36041      return true;
36042    };
36043    if (json.has(prefix+"ImagingSelection")) {
36044      return true;
36045    };
36046    if (json.has(prefix+"ImagingStudy")) {
36047      return true;
36048    };
36049    if (json.has(prefix+"Immunization")) {
36050      return true;
36051    };
36052    if (json.has(prefix+"ImmunizationEvaluation")) {
36053      return true;
36054    };
36055    if (json.has(prefix+"ImmunizationRecommendation")) {
36056      return true;
36057    };
36058    if (json.has(prefix+"ImplementationGuide")) {
36059      return true;
36060    };
36061    if (json.has(prefix+"Ingredient")) {
36062      return true;
36063    };
36064    if (json.has(prefix+"InsurancePlan")) {
36065      return true;
36066    };
36067    if (json.has(prefix+"InventoryItem")) {
36068      return true;
36069    };
36070    if (json.has(prefix+"InventoryReport")) {
36071      return true;
36072    };
36073    if (json.has(prefix+"Invoice")) {
36074      return true;
36075    };
36076    if (json.has(prefix+"Library")) {
36077      return true;
36078    };
36079    if (json.has(prefix+"Linkage")) {
36080      return true;
36081    };
36082    if (json.has(prefix+"List")) {
36083      return true;
36084    };
36085    if (json.has(prefix+"Location")) {
36086      return true;
36087    };
36088    if (json.has(prefix+"ManufacturedItemDefinition")) {
36089      return true;
36090    };
36091    if (json.has(prefix+"Measure")) {
36092      return true;
36093    };
36094    if (json.has(prefix+"MeasureReport")) {
36095      return true;
36096    };
36097    if (json.has(prefix+"Medication")) {
36098      return true;
36099    };
36100    if (json.has(prefix+"MedicationAdministration")) {
36101      return true;
36102    };
36103    if (json.has(prefix+"MedicationDispense")) {
36104      return true;
36105    };
36106    if (json.has(prefix+"MedicationKnowledge")) {
36107      return true;
36108    };
36109    if (json.has(prefix+"MedicationRequest")) {
36110      return true;
36111    };
36112    if (json.has(prefix+"MedicationStatement")) {
36113      return true;
36114    };
36115    if (json.has(prefix+"MedicinalProductDefinition")) {
36116      return true;
36117    };
36118    if (json.has(prefix+"MessageDefinition")) {
36119      return true;
36120    };
36121    if (json.has(prefix+"MessageHeader")) {
36122      return true;
36123    };
36124    if (json.has(prefix+"MolecularSequence")) {
36125      return true;
36126    };
36127    if (json.has(prefix+"NamingSystem")) {
36128      return true;
36129    };
36130    if (json.has(prefix+"NutritionIntake")) {
36131      return true;
36132    };
36133    if (json.has(prefix+"NutritionOrder")) {
36134      return true;
36135    };
36136    if (json.has(prefix+"NutritionProduct")) {
36137      return true;
36138    };
36139    if (json.has(prefix+"Observation")) {
36140      return true;
36141    };
36142    if (json.has(prefix+"ObservationDefinition")) {
36143      return true;
36144    };
36145    if (json.has(prefix+"OperationDefinition")) {
36146      return true;
36147    };
36148    if (json.has(prefix+"OperationOutcome")) {
36149      return true;
36150    };
36151    if (json.has(prefix+"Organization")) {
36152      return true;
36153    };
36154    if (json.has(prefix+"OrganizationAffiliation")) {
36155      return true;
36156    };
36157    if (json.has(prefix+"PackagedProductDefinition")) {
36158      return true;
36159    };
36160    if (json.has(prefix+"Parameters")) {
36161      return true;
36162    };
36163    if (json.has(prefix+"Patient")) {
36164      return true;
36165    };
36166    if (json.has(prefix+"PaymentNotice")) {
36167      return true;
36168    };
36169    if (json.has(prefix+"PaymentReconciliation")) {
36170      return true;
36171    };
36172    if (json.has(prefix+"Permission")) {
36173      return true;
36174    };
36175    if (json.has(prefix+"Person")) {
36176      return true;
36177    };
36178    if (json.has(prefix+"PlanDefinition")) {
36179      return true;
36180    };
36181    if (json.has(prefix+"Practitioner")) {
36182      return true;
36183    };
36184    if (json.has(prefix+"PractitionerRole")) {
36185      return true;
36186    };
36187    if (json.has(prefix+"Procedure")) {
36188      return true;
36189    };
36190    if (json.has(prefix+"Provenance")) {
36191      return true;
36192    };
36193    if (json.has(prefix+"Questionnaire")) {
36194      return true;
36195    };
36196    if (json.has(prefix+"QuestionnaireResponse")) {
36197      return true;
36198    };
36199    if (json.has(prefix+"RegulatedAuthorization")) {
36200      return true;
36201    };
36202    if (json.has(prefix+"RelatedPerson")) {
36203      return true;
36204    };
36205    if (json.has(prefix+"RequestOrchestration")) {
36206      return true;
36207    };
36208    if (json.has(prefix+"Requirements")) {
36209      return true;
36210    };
36211    if (json.has(prefix+"ResearchStudy")) {
36212      return true;
36213    };
36214    if (json.has(prefix+"ResearchSubject")) {
36215      return true;
36216    };
36217    if (json.has(prefix+"RiskAssessment")) {
36218      return true;
36219    };
36220    if (json.has(prefix+"Schedule")) {
36221      return true;
36222    };
36223    if (json.has(prefix+"SearchParameter")) {
36224      return true;
36225    };
36226    if (json.has(prefix+"ServiceRequest")) {
36227      return true;
36228    };
36229    if (json.has(prefix+"Slot")) {
36230      return true;
36231    };
36232    if (json.has(prefix+"Specimen")) {
36233      return true;
36234    };
36235    if (json.has(prefix+"SpecimenDefinition")) {
36236      return true;
36237    };
36238    if (json.has(prefix+"StructureDefinition")) {
36239      return true;
36240    };
36241    if (json.has(prefix+"StructureMap")) {
36242      return true;
36243    };
36244    if (json.has(prefix+"Subscription")) {
36245      return true;
36246    };
36247    if (json.has(prefix+"SubscriptionStatus")) {
36248      return true;
36249    };
36250    if (json.has(prefix+"SubscriptionTopic")) {
36251      return true;
36252    };
36253    if (json.has(prefix+"Substance")) {
36254      return true;
36255    };
36256    if (json.has(prefix+"SubstanceDefinition")) {
36257      return true;
36258    };
36259    if (json.has(prefix+"SubstanceNucleicAcid")) {
36260      return true;
36261    };
36262    if (json.has(prefix+"SubstancePolymer")) {
36263      return true;
36264    };
36265    if (json.has(prefix+"SubstanceProtein")) {
36266      return true;
36267    };
36268    if (json.has(prefix+"SubstanceReferenceInformation")) {
36269      return true;
36270    };
36271    if (json.has(prefix+"SubstanceSourceMaterial")) {
36272      return true;
36273    };
36274    if (json.has(prefix+"SupplyDelivery")) {
36275      return true;
36276    };
36277    if (json.has(prefix+"SupplyRequest")) {
36278      return true;
36279    };
36280    if (json.has(prefix+"Task")) {
36281      return true;
36282    };
36283    if (json.has(prefix+"TerminologyCapabilities")) {
36284      return true;
36285    };
36286    if (json.has(prefix+"TestPlan")) {
36287      return true;
36288    };
36289    if (json.has(prefix+"TestReport")) {
36290      return true;
36291    };
36292    if (json.has(prefix+"TestScript")) {
36293      return true;
36294    };
36295    if (json.has(prefix+"Transport")) {
36296      return true;
36297    };
36298    if (json.has(prefix+"ValueSet")) {
36299      return true;
36300    };
36301    if (json.has(prefix+"VerificationResult")) {
36302      return true;
36303    };
36304    if (json.has(prefix+"VisionPrescription")) {
36305      return true;
36306    };
36307
36308    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
36309      return true;
36310    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
36311      return true;
36312    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
36313      return true;
36314    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
36315      return true;
36316    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
36317      return true;
36318    if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64"))
36319      return true;
36320    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
36321      return true;
36322    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
36323      return true;
36324    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
36325      return true;
36326    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
36327      return true;
36328    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
36329      return true;
36330    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
36331      return true;
36332    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
36333      return true;
36334    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
36335      return true;
36336    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
36337      return true;
36338    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
36339      return true;
36340    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
36341      return true;
36342    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
36343      return true;
36344    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
36345      return true;
36346    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
36347      return true;
36348    return false;
36349  }
36350
36351// -- compose ---------------------------------------------------------------------------------------------------------------------
36352
36353  protected void composeBaseProperties(Base element) throws IOException {
36354  }
36355
36356
36357  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
36358    if (value != null && value.getValue() != null) {
36359      prop(name, e.toCode(value.getValue()));
36360    } else if (inArray)   
36361      writeNull(name);
36362  }    
36363
36364  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
36365    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36366      open(inArray ? null : "_"+name);
36367      composeElementProperties(value);
36368      close();
36369    } else if (inArray)   
36370      writeNull(name);
36371  }    
36372
36373  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
36374    if (value != null && value.hasValue()) {
36375        prop(name, value.asStringValue());
36376    }    
36377    else if (inArray) 
36378      writeNull(name); 
36379  }    
36380
36381  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
36382    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36383      open(inArray ? null : "_"+name);
36384      composeElementProperties(value);
36385      close();
36386    }
36387    else if (inArray) 
36388      writeNull(name); 
36389  }
36390
36391  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
36392    if (value != null && value.hasValue()) {
36393        prop(name, value.asStringValue());
36394    }    
36395    else if (inArray) 
36396      writeNull(name); 
36397  }    
36398
36399  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
36400    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36401      open(inArray ? null : "_"+name);
36402      composeElementProperties(value);
36403      close();
36404    }
36405    else if (inArray) 
36406      writeNull(name); 
36407  }
36408
36409  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
36410    if (value != null && value.hasValue()) {
36411        prop(name, toString(value.getValue()));
36412    }    
36413    else if (inArray) 
36414      writeNull(name); 
36415  }    
36416
36417  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
36418    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36419      open(inArray ? null : "_"+name);
36420      composeElementProperties(value);
36421      close();
36422    }
36423    else if (inArray) 
36424      writeNull(name); 
36425  }
36426
36427  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
36428    if (value != null && value.hasValue()) {
36429        prop(name, toString(value.getValue()));
36430    }    
36431    else if (inArray) 
36432      writeNull(name); 
36433  }    
36434
36435  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
36436    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36437      open(inArray ? null : "_"+name);
36438      composeElementProperties(value);
36439      close();
36440    }
36441    else if (inArray) 
36442      writeNull(name); 
36443  }
36444
36445  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
36446    if (value != null && value.hasValue()) {
36447        prop(name, Integer.valueOf(value.getValue()));
36448    }    
36449    else if (inArray) 
36450      writeNull(name); 
36451  }    
36452
36453  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
36454    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36455      open(inArray ? null : "_"+name);
36456      composeElementProperties(value);
36457      close();
36458    }
36459    else if (inArray) 
36460      writeNull(name); 
36461  }
36462
36463  protected void composeInteger64Core(String name, Integer64Type value, boolean inArray) throws IOException {
36464    if (value != null && value.hasValue()) {
36465        prop(name, value.getValue().toString());
36466    }    
36467    else if (inArray) 
36468      writeNull(name); 
36469  }    
36470
36471  protected void composeInteger64Extras(String name, Integer64Type value, boolean inArray) throws IOException {
36472    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36473      open(inArray ? null : "_"+name);
36474      composeElementProperties(value);
36475      close();
36476    }
36477    else if (inArray) 
36478      writeNull(name); 
36479  }
36480
36481  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
36482    if (value != null && value.hasValue()) {
36483        prop(name, toString(value.getValue()));
36484    }    
36485    else if (inArray) 
36486      writeNull(name); 
36487  }    
36488
36489  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
36490    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36491      open(inArray ? null : "_"+name);
36492      composeElementProperties(value);
36493      close();
36494    }
36495    else if (inArray) 
36496      writeNull(name); 
36497  }
36498
36499  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
36500    if (value != null && value.hasValue()) {
36501        prop(name, toString(value.getValue()));
36502    }    
36503    else if (inArray) 
36504      writeNull(name); 
36505  }    
36506
36507  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
36508    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36509      open(inArray ? null : "_"+name);
36510      composeElementProperties(value);
36511      close();
36512    }
36513    else if (inArray) 
36514      writeNull(name); 
36515  }
36516
36517  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
36518    if (value != null && value.hasValue()) {
36519        prop(name, toString(value.getValue()));
36520    }    
36521    else if (inArray) 
36522      writeNull(name); 
36523  }    
36524
36525  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
36526    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36527      open(inArray ? null : "_"+name);
36528      composeElementProperties(value);
36529      close();
36530    }
36531    else if (inArray) 
36532      writeNull(name); 
36533  }
36534
36535  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
36536    if (value != null && value.hasValue()) {
36537        prop(name, toString(value.getValue()));
36538    }    
36539    else if (inArray) 
36540      writeNull(name); 
36541  }    
36542
36543  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
36544    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36545      open(inArray ? null : "_"+name);
36546      composeElementProperties(value);
36547      close();
36548    }
36549    else if (inArray) 
36550      writeNull(name); 
36551  }
36552
36553  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
36554    if (value != null && value.hasValue()) {
36555        prop(name, toString(value.getValue()));
36556    }    
36557    else if (inArray) 
36558      writeNull(name); 
36559  }    
36560
36561  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
36562    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36563      open(inArray ? null : "_"+name);
36564      composeElementProperties(value);
36565      close();
36566    }
36567    else if (inArray) 
36568      writeNull(name); 
36569  }
36570
36571  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
36572    if (value != null && value.hasValue()) {
36573        prop(name, value.asStringValue());
36574    }    
36575    else if (inArray) 
36576      writeNull(name); 
36577  }    
36578
36579  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
36580    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36581      open(inArray ? null : "_"+name);
36582      composeElementProperties(value);
36583      close();
36584    }
36585    else if (inArray) 
36586      writeNull(name); 
36587  }
36588
36589  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
36590    if (value != null && value.hasValue()) {
36591        prop(name, value.getValue());
36592    }    
36593    else if (inArray) 
36594      writeNull(name); 
36595  }    
36596
36597  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
36598    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36599      open(inArray ? null : "_"+name);
36600      composeElementProperties(value);
36601      close();
36602    }
36603    else if (inArray) 
36604      writeNull(name); 
36605  }
36606
36607  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
36608    if (value != null && value.hasValue()) {
36609        prop(name, toString(value.getValue()));
36610    }    
36611    else if (inArray) 
36612      writeNull(name); 
36613  }    
36614
36615  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
36616    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36617      open(inArray ? null : "_"+name);
36618      composeElementProperties(value);
36619      close();
36620    }
36621    else if (inArray) 
36622      writeNull(name); 
36623  }
36624
36625  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
36626    if (value != null && value.hasValue()) {
36627        prop(name, Integer.valueOf(value.getValue()));
36628    }    
36629    else if (inArray) 
36630      writeNull(name); 
36631  }    
36632
36633  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
36634    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36635      open(inArray ? null : "_"+name);
36636      composeElementProperties(value);
36637      close();
36638    }
36639    else if (inArray) 
36640      writeNull(name); 
36641  }
36642
36643  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
36644    if (value != null && value.hasValue()) {
36645        prop(name, toString(value.getValue()));
36646    }    
36647    else if (inArray) 
36648      writeNull(name); 
36649  }    
36650
36651  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
36652    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36653      open(inArray ? null : "_"+name);
36654      composeElementProperties(value);
36655      close();
36656    }
36657    else if (inArray) 
36658      writeNull(name); 
36659  }
36660
36661  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
36662    if (value != null && value.hasValue()) {
36663        prop(name, value.asStringValue());
36664    }    
36665    else if (inArray) 
36666      writeNull(name); 
36667  }    
36668
36669  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
36670    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36671      open(inArray ? null : "_"+name);
36672      composeElementProperties(value);
36673      close();
36674    }
36675    else if (inArray) 
36676      writeNull(name); 
36677  }
36678
36679  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
36680    if (value != null && value.hasValue()) {
36681        prop(name, toString(value.getValue()));
36682    }    
36683    else if (inArray) 
36684      writeNull(name); 
36685  }    
36686
36687  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
36688    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36689      open(inArray ? null : "_"+name);
36690      composeElementProperties(value);
36691      close();
36692    }
36693    else if (inArray) 
36694      writeNull(name); 
36695  }
36696
36697  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
36698    if (value != null && value.hasValue()) {
36699        prop(name, Integer.valueOf(value.getValue()));
36700    }    
36701    else if (inArray) 
36702      writeNull(name); 
36703  }    
36704
36705  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
36706    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36707      open(inArray ? null : "_"+name);
36708      composeElementProperties(value);
36709      close();
36710    }
36711    else if (inArray) 
36712      writeNull(name); 
36713  }
36714
36715  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
36716    if (value != null && value.hasValue()) {
36717        prop(name, value.getValue());
36718    }    
36719    else if (inArray) 
36720      writeNull(name); 
36721  }    
36722
36723  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
36724    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
36725      open(inArray ? null : "_"+name);
36726      composeElementProperties(value);
36727      close();
36728    }
36729    else if (inArray) 
36730      writeNull(name); 
36731  }
36732
36733  protected void composeBackboneElementProperties(BackboneElement element) throws IOException {
36734      composeElementProperties(element);
36735      if (element.hasModifierExtension()) {
36736        openArray("modifierExtension");
36737        for (Extension e : element.getModifierExtension()) 
36738          composeExtension(null, e);
36739        closeArray();
36740      };
36741  }
36742
36743  protected void composeBackboneTypeProperties(BackboneType element) throws IOException {
36744      composeDataTypeProperties(element);
36745      if (element.hasModifierExtension()) {
36746        openArray("modifierExtension");
36747        for (Extension e : element.getModifierExtension()) 
36748          composeExtension(null, e);
36749        closeArray();
36750      };
36751  }
36752
36753  protected void composeDataTypeProperties(DataType element) throws IOException {
36754      composeElementProperties(element);
36755  }
36756
36757  protected void composeElementProperties(Element element) throws IOException {
36758      if (element.hasIdElement()) {
36759        composeStringCore("id", element.getIdElement(), false);
36760        composeStringExtras("id", element.getIdElement(), false);
36761      }
36762      if (element.hasExtension()) {
36763        openArray("extension");
36764        for (Extension e : element.getExtension()) 
36765          composeExtension(null, e);
36766        closeArray();
36767      };
36768  }
36769
36770  protected void composeAddress(String name, Address element) throws IOException {
36771    if (element != null) {
36772      open(name);
36773      composeAddressProperties(element);
36774      close();
36775    }
36776  }
36777
36778  protected void composeAddressProperties(Address element) throws IOException {
36779    composeDataTypeProperties(element);
36780      if (element.hasUseElement()) {
36781        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
36782        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
36783      }
36784      if (element.hasTypeElement()) {
36785        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
36786        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
36787      }
36788      if (element.hasTextElement()) {
36789        composeStringCore("text", element.getTextElement(), false);
36790        composeStringExtras("text", element.getTextElement(), false);
36791      }
36792      if (element.hasLine()) {
36793        if (anyHasValue(element.getLine())) {
36794          openArray("line");
36795          for (StringType e : element.getLine()) 
36796            composeStringCore(null, e, e != element.getLine().get(element.getLine().size()-1));
36797          closeArray();
36798        }
36799        if (anyHasExtras(element.getLine())) {
36800          openArray("_line");
36801          for (StringType e : element.getLine()) 
36802            composeStringExtras(null, e, true);
36803          closeArray();
36804        }
36805      };
36806      if (element.hasCityElement()) {
36807        composeStringCore("city", element.getCityElement(), false);
36808        composeStringExtras("city", element.getCityElement(), false);
36809      }
36810      if (element.hasDistrictElement()) {
36811        composeStringCore("district", element.getDistrictElement(), false);
36812        composeStringExtras("district", element.getDistrictElement(), false);
36813      }
36814      if (element.hasStateElement()) {
36815        composeStringCore("state", element.getStateElement(), false);
36816        composeStringExtras("state", element.getStateElement(), false);
36817      }
36818      if (element.hasPostalCodeElement()) {
36819        composeStringCore("postalCode", element.getPostalCodeElement(), false);
36820        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
36821      }
36822      if (element.hasCountryElement()) {
36823        composeStringCore("country", element.getCountryElement(), false);
36824        composeStringExtras("country", element.getCountryElement(), false);
36825      }
36826      if (element.hasPeriod()) {
36827        composePeriod("period", element.getPeriod());
36828      }
36829  }
36830
36831  protected void composeAge(String name, Age element) throws IOException {
36832    if (element != null) {
36833      open(name);
36834      composeAgeProperties(element);
36835      close();
36836    }
36837  }
36838
36839  protected void composeAgeProperties(Age element) throws IOException {
36840    composeQuantityProperties(element);
36841  }
36842
36843  protected void composeAnnotation(String name, Annotation element) throws IOException {
36844    if (element != null) {
36845      open(name);
36846      composeAnnotationProperties(element);
36847      close();
36848    }
36849  }
36850
36851  protected void composeAnnotationProperties(Annotation element) throws IOException {
36852    composeDataTypeProperties(element);
36853      if (element.hasAuthor()) {
36854        composeType("author", element.getAuthor());
36855      }
36856      if (element.hasTimeElement()) {
36857        composeDateTimeCore("time", element.getTimeElement(), false);
36858        composeDateTimeExtras("time", element.getTimeElement(), false);
36859      }
36860      if (element.hasTextElement()) {
36861        composeMarkdownCore("text", element.getTextElement(), false);
36862        composeMarkdownExtras("text", element.getTextElement(), false);
36863      }
36864  }
36865
36866  protected void composeAttachment(String name, Attachment element) throws IOException {
36867    if (element != null) {
36868      open(name);
36869      composeAttachmentProperties(element);
36870      close();
36871    }
36872  }
36873
36874  protected void composeAttachmentProperties(Attachment element) throws IOException {
36875    composeDataTypeProperties(element);
36876      if (element.hasContentTypeElement()) {
36877        composeCodeCore("contentType", element.getContentTypeElement(), false);
36878        composeCodeExtras("contentType", element.getContentTypeElement(), false);
36879      }
36880      if (element.hasLanguageElement()) {
36881        composeCodeCore("language", element.getLanguageElement(), false);
36882        composeCodeExtras("language", element.getLanguageElement(), false);
36883      }
36884      if (element.hasDataElement()) {
36885        composeBase64BinaryCore("data", element.getDataElement(), false);
36886        composeBase64BinaryExtras("data", element.getDataElement(), false);
36887      }
36888      if (element.hasUrlElement()) {
36889        composeUrlCore("url", element.getUrlElement(), false);
36890        composeUrlExtras("url", element.getUrlElement(), false);
36891      }
36892      if (element.hasSizeElement()) {
36893        composeInteger64Core("size", element.getSizeElement(), false);
36894        composeInteger64Extras("size", element.getSizeElement(), false);
36895      }
36896      if (element.hasHashElement()) {
36897        composeBase64BinaryCore("hash", element.getHashElement(), false);
36898        composeBase64BinaryExtras("hash", element.getHashElement(), false);
36899      }
36900      if (element.hasTitleElement()) {
36901        composeStringCore("title", element.getTitleElement(), false);
36902        composeStringExtras("title", element.getTitleElement(), false);
36903      }
36904      if (element.hasCreationElement()) {
36905        composeDateTimeCore("creation", element.getCreationElement(), false);
36906        composeDateTimeExtras("creation", element.getCreationElement(), false);
36907      }
36908      if (element.hasHeightElement()) {
36909        composePositiveIntCore("height", element.getHeightElement(), false);
36910        composePositiveIntExtras("height", element.getHeightElement(), false);
36911      }
36912      if (element.hasWidthElement()) {
36913        composePositiveIntCore("width", element.getWidthElement(), false);
36914        composePositiveIntExtras("width", element.getWidthElement(), false);
36915      }
36916      if (element.hasFramesElement()) {
36917        composePositiveIntCore("frames", element.getFramesElement(), false);
36918        composePositiveIntExtras("frames", element.getFramesElement(), false);
36919      }
36920      if (element.hasDurationElement()) {
36921        composeDecimalCore("duration", element.getDurationElement(), false);
36922        composeDecimalExtras("duration", element.getDurationElement(), false);
36923      }
36924      if (element.hasPagesElement()) {
36925        composePositiveIntCore("pages", element.getPagesElement(), false);
36926        composePositiveIntExtras("pages", element.getPagesElement(), false);
36927      }
36928  }
36929
36930  protected void composeAvailability(String name, Availability element) throws IOException {
36931    if (element != null) {
36932      open(name);
36933      composeAvailabilityProperties(element);
36934      close();
36935    }
36936  }
36937
36938  protected void composeAvailabilityProperties(Availability element) throws IOException {
36939    composeDataTypeProperties(element);
36940      if (element.hasAvailableTime()) {
36941        openArray("availableTime");
36942        for (Availability.AvailabilityAvailableTimeComponent e : element.getAvailableTime()) 
36943          composeAvailabilityAvailableTimeComponent(null, e);
36944        closeArray();
36945      };
36946      if (element.hasNotAvailableTime()) {
36947        openArray("notAvailableTime");
36948        for (Availability.AvailabilityNotAvailableTimeComponent e : element.getNotAvailableTime()) 
36949          composeAvailabilityNotAvailableTimeComponent(null, e);
36950        closeArray();
36951      };
36952  }
36953
36954  protected void composeAvailabilityAvailableTimeComponent(String name, Availability.AvailabilityAvailableTimeComponent element) throws IOException {
36955    if (element != null) {
36956      open(name);
36957      composeAvailabilityAvailableTimeComponentProperties(element);
36958      close();
36959    }
36960  }
36961
36962  protected void composeAvailabilityAvailableTimeComponentProperties(Availability.AvailabilityAvailableTimeComponent element) throws IOException {
36963    composeElementProperties(element);
36964      if (element.hasDaysOfWeek()) {
36965        openArray("daysOfWeek");
36966        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
36967          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
36968        closeArray();
36969        if (anyHasExtras(element.getDaysOfWeek())) {
36970          openArray("_daysOfWeek");
36971          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
36972            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
36973          closeArray();
36974        }
36975      };
36976      if (element.hasAllDayElement()) {
36977        composeBooleanCore("allDay", element.getAllDayElement(), false);
36978        composeBooleanExtras("allDay", element.getAllDayElement(), false);
36979      }
36980      if (element.hasAvailableStartTimeElement()) {
36981        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
36982        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
36983      }
36984      if (element.hasAvailableEndTimeElement()) {
36985        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
36986        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
36987      }
36988  }
36989
36990  protected void composeAvailabilityNotAvailableTimeComponent(String name, Availability.AvailabilityNotAvailableTimeComponent element) throws IOException {
36991    if (element != null) {
36992      open(name);
36993      composeAvailabilityNotAvailableTimeComponentProperties(element);
36994      close();
36995    }
36996  }
36997
36998  protected void composeAvailabilityNotAvailableTimeComponentProperties(Availability.AvailabilityNotAvailableTimeComponent element) throws IOException {
36999    composeElementProperties(element);
37000      if (element.hasDescriptionElement()) {
37001        composeStringCore("description", element.getDescriptionElement(), false);
37002        composeStringExtras("description", element.getDescriptionElement(), false);
37003      }
37004      if (element.hasDuring()) {
37005        composePeriod("during", element.getDuring());
37006      }
37007  }
37008
37009  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
37010    if (element != null) {
37011      open(name);
37012      composeCodeableConceptProperties(element);
37013      close();
37014    }
37015  }
37016
37017  protected void composeCodeableConceptProperties(CodeableConcept element) throws IOException {
37018    composeDataTypeProperties(element);
37019      if (element.hasCoding()) {
37020        openArray("coding");
37021        for (Coding e : element.getCoding()) 
37022          composeCoding(null, e);
37023        closeArray();
37024      };
37025      if (element.hasTextElement()) {
37026        composeStringCore("text", element.getTextElement(), false);
37027        composeStringExtras("text", element.getTextElement(), false);
37028      }
37029  }
37030
37031  protected void composeCodeableReference(String name, CodeableReference element) throws IOException {
37032    if (element != null) {
37033      open(name);
37034      composeCodeableReferenceProperties(element);
37035      close();
37036    }
37037  }
37038
37039  protected void composeCodeableReferenceProperties(CodeableReference element) throws IOException {
37040    composeDataTypeProperties(element);
37041      if (element.hasConcept()) {
37042        composeCodeableConcept("concept", element.getConcept());
37043      }
37044      if (element.hasReference()) {
37045        composeReference("reference", element.getReference());
37046      }
37047  }
37048
37049  protected void composeCoding(String name, Coding element) throws IOException {
37050    if (element != null) {
37051      open(name);
37052      composeCodingProperties(element);
37053      close();
37054    }
37055  }
37056
37057  protected void composeCodingProperties(Coding element) throws IOException {
37058    composeDataTypeProperties(element);
37059      if (element.hasSystemElement()) {
37060        composeUriCore("system", element.getSystemElement(), false);
37061        composeUriExtras("system", element.getSystemElement(), false);
37062      }
37063      if (element.hasVersionElement()) {
37064        composeStringCore("version", element.getVersionElement(), false);
37065        composeStringExtras("version", element.getVersionElement(), false);
37066      }
37067      if (element.hasCodeElement()) {
37068        composeCodeCore("code", element.getCodeElement(), false);
37069        composeCodeExtras("code", element.getCodeElement(), false);
37070      }
37071      if (element.hasDisplayElement()) {
37072        composeStringCore("display", element.getDisplayElement(), false);
37073        composeStringExtras("display", element.getDisplayElement(), false);
37074      }
37075      if (element.hasUserSelectedElement()) {
37076        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
37077        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
37078      }
37079  }
37080
37081  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
37082    if (element != null) {
37083      open(name);
37084      composeContactDetailProperties(element);
37085      close();
37086    }
37087  }
37088
37089  protected void composeContactDetailProperties(ContactDetail element) throws IOException {
37090    composeDataTypeProperties(element);
37091      if (element.hasNameElement()) {
37092        composeStringCore("name", element.getNameElement(), false);
37093        composeStringExtras("name", element.getNameElement(), false);
37094      }
37095      if (element.hasTelecom()) {
37096        openArray("telecom");
37097        for (ContactPoint e : element.getTelecom()) 
37098          composeContactPoint(null, e);
37099        closeArray();
37100      };
37101  }
37102
37103  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
37104    if (element != null) {
37105      open(name);
37106      composeContactPointProperties(element);
37107      close();
37108    }
37109  }
37110
37111  protected void composeContactPointProperties(ContactPoint element) throws IOException {
37112    composeDataTypeProperties(element);
37113      if (element.hasSystemElement()) {
37114        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
37115        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
37116      }
37117      if (element.hasValueElement()) {
37118        composeStringCore("value", element.getValueElement(), false);
37119        composeStringExtras("value", element.getValueElement(), false);
37120      }
37121      if (element.hasUseElement()) {
37122        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
37123        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
37124      }
37125      if (element.hasRankElement()) {
37126        composePositiveIntCore("rank", element.getRankElement(), false);
37127        composePositiveIntExtras("rank", element.getRankElement(), false);
37128      }
37129      if (element.hasPeriod()) {
37130        composePeriod("period", element.getPeriod());
37131      }
37132  }
37133
37134  protected void composeContributor(String name, Contributor element) throws IOException {
37135    if (element != null) {
37136      open(name);
37137      composeContributorProperties(element);
37138      close();
37139    }
37140  }
37141
37142  protected void composeContributorProperties(Contributor element) throws IOException {
37143    composeDataTypeProperties(element);
37144      if (element.hasTypeElement()) {
37145        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
37146        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
37147      }
37148      if (element.hasNameElement()) {
37149        composeStringCore("name", element.getNameElement(), false);
37150        composeStringExtras("name", element.getNameElement(), false);
37151      }
37152      if (element.hasContact()) {
37153        openArray("contact");
37154        for (ContactDetail e : element.getContact()) 
37155          composeContactDetail(null, e);
37156        closeArray();
37157      };
37158  }
37159
37160  protected void composeCount(String name, Count element) throws IOException {
37161    if (element != null) {
37162      open(name);
37163      composeCountProperties(element);
37164      close();
37165    }
37166  }
37167
37168  protected void composeCountProperties(Count element) throws IOException {
37169    composeQuantityProperties(element);
37170  }
37171
37172  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
37173    if (element != null) {
37174      open(name);
37175      composeDataRequirementProperties(element);
37176      close();
37177    }
37178  }
37179
37180  protected void composeDataRequirementProperties(DataRequirement element) throws IOException {
37181    composeDataTypeProperties(element);
37182      if (element.hasTypeElement()) {
37183        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
37184        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
37185      }
37186      if (element.hasProfile()) {
37187        if (anyHasValue(element.getProfile())) {
37188          openArray("profile");
37189          for (CanonicalType e : element.getProfile()) 
37190            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
37191          closeArray();
37192        }
37193        if (anyHasExtras(element.getProfile())) {
37194          openArray("_profile");
37195          for (CanonicalType e : element.getProfile()) 
37196            composeCanonicalExtras(null, e, true);
37197          closeArray();
37198        }
37199      };
37200      if (element.hasSubject()) {
37201        composeType("subject", element.getSubject());
37202      }
37203      if (element.hasMustSupport()) {
37204        if (anyHasValue(element.getMustSupport())) {
37205          openArray("mustSupport");
37206          for (StringType e : element.getMustSupport()) 
37207            composeStringCore(null, e, e != element.getMustSupport().get(element.getMustSupport().size()-1));
37208          closeArray();
37209        }
37210        if (anyHasExtras(element.getMustSupport())) {
37211          openArray("_mustSupport");
37212          for (StringType e : element.getMustSupport()) 
37213            composeStringExtras(null, e, true);
37214          closeArray();
37215        }
37216      };
37217      if (element.hasCodeFilter()) {
37218        openArray("codeFilter");
37219        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
37220          composeDataRequirementCodeFilterComponent(null, e);
37221        closeArray();
37222      };
37223      if (element.hasDateFilter()) {
37224        openArray("dateFilter");
37225        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
37226          composeDataRequirementDateFilterComponent(null, e);
37227        closeArray();
37228      };
37229      if (element.hasValueFilter()) {
37230        openArray("valueFilter");
37231        for (DataRequirement.DataRequirementValueFilterComponent e : element.getValueFilter()) 
37232          composeDataRequirementValueFilterComponent(null, e);
37233        closeArray();
37234      };
37235      if (element.hasLimitElement()) {
37236        composePositiveIntCore("limit", element.getLimitElement(), false);
37237        composePositiveIntExtras("limit", element.getLimitElement(), false);
37238      }
37239      if (element.hasSort()) {
37240        openArray("sort");
37241        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
37242          composeDataRequirementSortComponent(null, e);
37243        closeArray();
37244      };
37245  }
37246
37247  protected void composeDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
37248    if (element != null) {
37249      open(name);
37250      composeDataRequirementCodeFilterComponentProperties(element);
37251      close();
37252    }
37253  }
37254
37255  protected void composeDataRequirementCodeFilterComponentProperties(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
37256    composeElementProperties(element);
37257      if (element.hasPathElement()) {
37258        composeStringCore("path", element.getPathElement(), false);
37259        composeStringExtras("path", element.getPathElement(), false);
37260      }
37261      if (element.hasSearchParamElement()) {
37262        composeStringCore("searchParam", element.getSearchParamElement(), false);
37263        composeStringExtras("searchParam", element.getSearchParamElement(), false);
37264      }
37265      if (element.hasValueSetElement()) {
37266        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37267        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37268      }
37269      if (element.hasCode()) {
37270        openArray("code");
37271        for (Coding e : element.getCode()) 
37272          composeCoding(null, e);
37273        closeArray();
37274      };
37275  }
37276
37277  protected void composeDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
37278    if (element != null) {
37279      open(name);
37280      composeDataRequirementDateFilterComponentProperties(element);
37281      close();
37282    }
37283  }
37284
37285  protected void composeDataRequirementDateFilterComponentProperties(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
37286    composeElementProperties(element);
37287      if (element.hasPathElement()) {
37288        composeStringCore("path", element.getPathElement(), false);
37289        composeStringExtras("path", element.getPathElement(), false);
37290      }
37291      if (element.hasSearchParamElement()) {
37292        composeStringCore("searchParam", element.getSearchParamElement(), false);
37293        composeStringExtras("searchParam", element.getSearchParamElement(), false);
37294      }
37295      if (element.hasValue()) {
37296        composeType("value", element.getValue());
37297      }
37298  }
37299
37300  protected void composeDataRequirementValueFilterComponent(String name, DataRequirement.DataRequirementValueFilterComponent element) throws IOException {
37301    if (element != null) {
37302      open(name);
37303      composeDataRequirementValueFilterComponentProperties(element);
37304      close();
37305    }
37306  }
37307
37308  protected void composeDataRequirementValueFilterComponentProperties(DataRequirement.DataRequirementValueFilterComponent element) throws IOException {
37309    composeElementProperties(element);
37310      if (element.hasPathElement()) {
37311        composeStringCore("path", element.getPathElement(), false);
37312        composeStringExtras("path", element.getPathElement(), false);
37313      }
37314      if (element.hasSearchParamElement()) {
37315        composeStringCore("searchParam", element.getSearchParamElement(), false);
37316        composeStringExtras("searchParam", element.getSearchParamElement(), false);
37317      }
37318      if (element.hasComparatorElement()) {
37319        composeEnumerationCore("comparator", element.getComparatorElement(), new DataRequirement.ValueFilterComparatorEnumFactory(), false);
37320        composeEnumerationExtras("comparator", element.getComparatorElement(), new DataRequirement.ValueFilterComparatorEnumFactory(), false);
37321      }
37322      if (element.hasValue()) {
37323        composeType("value", element.getValue());
37324      }
37325  }
37326
37327  protected void composeDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
37328    if (element != null) {
37329      open(name);
37330      composeDataRequirementSortComponentProperties(element);
37331      close();
37332    }
37333  }
37334
37335  protected void composeDataRequirementSortComponentProperties(DataRequirement.DataRequirementSortComponent element) throws IOException {
37336    composeElementProperties(element);
37337      if (element.hasPathElement()) {
37338        composeStringCore("path", element.getPathElement(), false);
37339        composeStringExtras("path", element.getPathElement(), false);
37340      }
37341      if (element.hasDirectionElement()) {
37342        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
37343        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
37344      }
37345  }
37346
37347  protected void composeDistance(String name, Distance element) throws IOException {
37348    if (element != null) {
37349      open(name);
37350      composeDistanceProperties(element);
37351      close();
37352    }
37353  }
37354
37355  protected void composeDistanceProperties(Distance element) throws IOException {
37356    composeQuantityProperties(element);
37357  }
37358
37359  protected void composeDosage(String name, Dosage element) throws IOException {
37360    if (element != null) {
37361      open(name);
37362      composeDosageProperties(element);
37363      close();
37364    }
37365  }
37366
37367  protected void composeDosageProperties(Dosage element) throws IOException {
37368    composeBackboneTypeProperties(element);
37369      if (element.hasSequenceElement()) {
37370        composeIntegerCore("sequence", element.getSequenceElement(), false);
37371        composeIntegerExtras("sequence", element.getSequenceElement(), false);
37372      }
37373      if (element.hasTextElement()) {
37374        composeStringCore("text", element.getTextElement(), false);
37375        composeStringExtras("text", element.getTextElement(), false);
37376      }
37377      if (element.hasAdditionalInstruction()) {
37378        openArray("additionalInstruction");
37379        for (CodeableConcept e : element.getAdditionalInstruction()) 
37380          composeCodeableConcept(null, e);
37381        closeArray();
37382      };
37383      if (element.hasPatientInstructionElement()) {
37384        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
37385        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
37386      }
37387      if (element.hasTiming()) {
37388        composeTiming("timing", element.getTiming());
37389      }
37390      if (element.hasAsNeededElement()) {
37391        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
37392        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
37393      }
37394      if (element.hasAsNeededFor()) {
37395        openArray("asNeededFor");
37396        for (CodeableConcept e : element.getAsNeededFor()) 
37397          composeCodeableConcept(null, e);
37398        closeArray();
37399      };
37400      if (element.hasSite()) {
37401        composeCodeableConcept("site", element.getSite());
37402      }
37403      if (element.hasRoute()) {
37404        composeCodeableConcept("route", element.getRoute());
37405      }
37406      if (element.hasMethod()) {
37407        composeCodeableConcept("method", element.getMethod());
37408      }
37409      if (element.hasDoseAndRate()) {
37410        openArray("doseAndRate");
37411        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
37412          composeDosageDoseAndRateComponent(null, e);
37413        closeArray();
37414      };
37415      if (element.hasMaxDosePerPeriod()) {
37416        openArray("maxDosePerPeriod");
37417        for (Ratio e : element.getMaxDosePerPeriod()) 
37418          composeRatio(null, e);
37419        closeArray();
37420      };
37421      if (element.hasMaxDosePerAdministration()) {
37422        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
37423      }
37424      if (element.hasMaxDosePerLifetime()) {
37425        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
37426      }
37427  }
37428
37429  protected void composeDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
37430    if (element != null) {
37431      open(name);
37432      composeDosageDoseAndRateComponentProperties(element);
37433      close();
37434    }
37435  }
37436
37437  protected void composeDosageDoseAndRateComponentProperties(Dosage.DosageDoseAndRateComponent element) throws IOException {
37438    composeElementProperties(element);
37439      if (element.hasType()) {
37440        composeCodeableConcept("type", element.getType());
37441      }
37442      if (element.hasDose()) {
37443        composeType("dose", element.getDose());
37444      }
37445      if (element.hasRate()) {
37446        composeType("rate", element.getRate());
37447      }
37448  }
37449
37450  protected void composeDuration(String name, Duration element) throws IOException {
37451    if (element != null) {
37452      open(name);
37453      composeDurationProperties(element);
37454      close();
37455    }
37456  }
37457
37458  protected void composeDurationProperties(Duration element) throws IOException {
37459    composeQuantityProperties(element);
37460  }
37461
37462  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
37463    if (element != null) {
37464      open(name);
37465      composeElementDefinitionProperties(element);
37466      close();
37467    }
37468  }
37469
37470  protected void composeElementDefinitionProperties(ElementDefinition element) throws IOException {
37471    composeBackboneTypeProperties(element);
37472      if (element.hasPathElement()) {
37473        composeStringCore("path", element.getPathElement(), false);
37474        composeStringExtras("path", element.getPathElement(), false);
37475      }
37476      if (element.hasRepresentation()) {
37477        openArray("representation");
37478        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
37479          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
37480        closeArray();
37481        if (anyHasExtras(element.getRepresentation())) {
37482          openArray("_representation");
37483          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
37484            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
37485          closeArray();
37486        }
37487      };
37488      if (element.hasSliceNameElement()) {
37489        composeStringCore("sliceName", element.getSliceNameElement(), false);
37490        composeStringExtras("sliceName", element.getSliceNameElement(), false);
37491      }
37492      if (element.hasSliceIsConstrainingElement()) {
37493        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
37494        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
37495      }
37496      if (element.hasLabelElement()) {
37497        composeStringCore("label", element.getLabelElement(), false);
37498        composeStringExtras("label", element.getLabelElement(), false);
37499      }
37500      if (element.hasCode()) {
37501        openArray("code");
37502        for (Coding e : element.getCode()) 
37503          composeCoding(null, e);
37504        closeArray();
37505      };
37506      if (element.hasSlicing()) {
37507        composeElementDefinitionSlicingComponent("slicing", element.getSlicing());
37508      }
37509      if (element.hasShortElement()) {
37510        composeStringCore("short", element.getShortElement(), false);
37511        composeStringExtras("short", element.getShortElement(), false);
37512      }
37513      if (element.hasDefinitionElement()) {
37514        composeMarkdownCore("definition", element.getDefinitionElement(), false);
37515        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
37516      }
37517      if (element.hasCommentElement()) {
37518        composeMarkdownCore("comment", element.getCommentElement(), false);
37519        composeMarkdownExtras("comment", element.getCommentElement(), false);
37520      }
37521      if (element.hasRequirementsElement()) {
37522        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
37523        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
37524      }
37525      if (element.hasAlias()) {
37526        if (anyHasValue(element.getAlias())) {
37527          openArray("alias");
37528          for (StringType e : element.getAlias()) 
37529            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
37530          closeArray();
37531        }
37532        if (anyHasExtras(element.getAlias())) {
37533          openArray("_alias");
37534          for (StringType e : element.getAlias()) 
37535            composeStringExtras(null, e, true);
37536          closeArray();
37537        }
37538      };
37539      if (element.hasMinElement()) {
37540        composeUnsignedIntCore("min", element.getMinElement(), false);
37541        composeUnsignedIntExtras("min", element.getMinElement(), false);
37542      }
37543      if (element.hasMaxElement()) {
37544        composeStringCore("max", element.getMaxElement(), false);
37545        composeStringExtras("max", element.getMaxElement(), false);
37546      }
37547      if (element.hasBase()) {
37548        composeElementDefinitionBaseComponent("base", element.getBase());
37549      }
37550      if (element.hasContentReferenceElement()) {
37551        composeUriCore("contentReference", element.getContentReferenceElement(), false);
37552        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
37553      }
37554      if (element.hasType()) {
37555        openArray("type");
37556        for (ElementDefinition.TypeRefComponent e : element.getType()) 
37557          composeTypeRefComponent(null, e);
37558        closeArray();
37559      };
37560      if (element.hasDefaultValue()) {
37561        composeType("defaultValue", element.getDefaultValue());
37562      }
37563      if (element.hasMeaningWhenMissingElement()) {
37564        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
37565        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
37566      }
37567      if (element.hasOrderMeaningElement()) {
37568        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
37569        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
37570      }
37571      if (element.hasFixed()) {
37572        composeType("fixed", element.getFixed());
37573      }
37574      if (element.hasPattern()) {
37575        composeType("pattern", element.getPattern());
37576      }
37577      if (element.hasExample()) {
37578        openArray("example");
37579        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
37580          composeElementDefinitionExampleComponent(null, e);
37581        closeArray();
37582      };
37583      if (element.hasMinValue()) {
37584        composeType("minValue", element.getMinValue());
37585      }
37586      if (element.hasMaxValue()) {
37587        composeType("maxValue", element.getMaxValue());
37588      }
37589      if (element.hasMaxLengthElement()) {
37590        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
37591        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
37592      }
37593      if (element.hasCondition()) {
37594        if (anyHasValue(element.getCondition())) {
37595          openArray("condition");
37596          for (IdType e : element.getCondition()) 
37597            composeIdCore(null, e, e != element.getCondition().get(element.getCondition().size()-1));
37598          closeArray();
37599        }
37600        if (anyHasExtras(element.getCondition())) {
37601          openArray("_condition");
37602          for (IdType e : element.getCondition()) 
37603            composeIdExtras(null, e, true);
37604          closeArray();
37605        }
37606      };
37607      if (element.hasConstraint()) {
37608        openArray("constraint");
37609        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
37610          composeElementDefinitionConstraintComponent(null, e);
37611        closeArray();
37612      };
37613      if (element.hasMustHaveValueElement()) {
37614        composeBooleanCore("mustHaveValue", element.getMustHaveValueElement(), false);
37615        composeBooleanExtras("mustHaveValue", element.getMustHaveValueElement(), false);
37616      }
37617      if (element.hasValueAlternatives()) {
37618        if (anyHasValue(element.getValueAlternatives())) {
37619          openArray("valueAlternatives");
37620          for (CanonicalType e : element.getValueAlternatives()) 
37621            composeCanonicalCore(null, e, e != element.getValueAlternatives().get(element.getValueAlternatives().size()-1));
37622          closeArray();
37623        }
37624        if (anyHasExtras(element.getValueAlternatives())) {
37625          openArray("_valueAlternatives");
37626          for (CanonicalType e : element.getValueAlternatives()) 
37627            composeCanonicalExtras(null, e, true);
37628          closeArray();
37629        }
37630      };
37631      if (element.hasMustSupportElement()) {
37632        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
37633        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
37634      }
37635      if (element.hasIsModifierElement()) {
37636        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
37637        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
37638      }
37639      if (element.hasIsModifierReasonElement()) {
37640        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
37641        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
37642      }
37643      if (element.hasIsSummaryElement()) {
37644        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
37645        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
37646      }
37647      if (element.hasBinding()) {
37648        composeElementDefinitionBindingComponent("binding", element.getBinding());
37649      }
37650      if (element.hasMapping()) {
37651        openArray("mapping");
37652        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
37653          composeElementDefinitionMappingComponent(null, e);
37654        closeArray();
37655      };
37656  }
37657
37658  protected void composeElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
37659    if (element != null) {
37660      open(name);
37661      composeElementDefinitionSlicingComponentProperties(element);
37662      close();
37663    }
37664  }
37665
37666  protected void composeElementDefinitionSlicingComponentProperties(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
37667    composeElementProperties(element);
37668      if (element.hasDiscriminator()) {
37669        openArray("discriminator");
37670        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
37671          composeElementDefinitionSlicingDiscriminatorComponent(null, e);
37672        closeArray();
37673      };
37674      if (element.hasDescriptionElement()) {
37675        composeStringCore("description", element.getDescriptionElement(), false);
37676        composeStringExtras("description", element.getDescriptionElement(), false);
37677      }
37678      if (element.hasOrderedElement()) {
37679        composeBooleanCore("ordered", element.getOrderedElement(), false);
37680        composeBooleanExtras("ordered", element.getOrderedElement(), false);
37681      }
37682      if (element.hasRulesElement()) {
37683        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
37684        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
37685      }
37686  }
37687
37688  protected void composeElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
37689    if (element != null) {
37690      open(name);
37691      composeElementDefinitionSlicingDiscriminatorComponentProperties(element);
37692      close();
37693    }
37694  }
37695
37696  protected void composeElementDefinitionSlicingDiscriminatorComponentProperties(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
37697    composeElementProperties(element);
37698      if (element.hasTypeElement()) {
37699        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
37700        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
37701      }
37702      if (element.hasPathElement()) {
37703        composeStringCore("path", element.getPathElement(), false);
37704        composeStringExtras("path", element.getPathElement(), false);
37705      }
37706  }
37707
37708  protected void composeElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
37709    if (element != null) {
37710      open(name);
37711      composeElementDefinitionBaseComponentProperties(element);
37712      close();
37713    }
37714  }
37715
37716  protected void composeElementDefinitionBaseComponentProperties(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
37717    composeElementProperties(element);
37718      if (element.hasPathElement()) {
37719        composeStringCore("path", element.getPathElement(), false);
37720        composeStringExtras("path", element.getPathElement(), false);
37721      }
37722      if (element.hasMinElement()) {
37723        composeUnsignedIntCore("min", element.getMinElement(), false);
37724        composeUnsignedIntExtras("min", element.getMinElement(), false);
37725      }
37726      if (element.hasMaxElement()) {
37727        composeStringCore("max", element.getMaxElement(), false);
37728        composeStringExtras("max", element.getMaxElement(), false);
37729      }
37730  }
37731
37732  protected void composeTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
37733    if (element != null) {
37734      open(name);
37735      composeTypeRefComponentProperties(element);
37736      close();
37737    }
37738  }
37739
37740  protected void composeTypeRefComponentProperties(ElementDefinition.TypeRefComponent element) throws IOException {
37741    composeElementProperties(element);
37742      if (element.hasCodeElement()) {
37743        composeUriCore("code", element.getCodeElement(), false);
37744        composeUriExtras("code", element.getCodeElement(), false);
37745      }
37746      if (element.hasProfile()) {
37747        if (anyHasValue(element.getProfile())) {
37748          openArray("profile");
37749          for (CanonicalType e : element.getProfile()) 
37750            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
37751          closeArray();
37752        }
37753        if (anyHasExtras(element.getProfile())) {
37754          openArray("_profile");
37755          for (CanonicalType e : element.getProfile()) 
37756            composeCanonicalExtras(null, e, true);
37757          closeArray();
37758        }
37759      };
37760      if (element.hasTargetProfile()) {
37761        if (anyHasValue(element.getTargetProfile())) {
37762          openArray("targetProfile");
37763          for (CanonicalType e : element.getTargetProfile()) 
37764            composeCanonicalCore(null, e, e != element.getTargetProfile().get(element.getTargetProfile().size()-1));
37765          closeArray();
37766        }
37767        if (anyHasExtras(element.getTargetProfile())) {
37768          openArray("_targetProfile");
37769          for (CanonicalType e : element.getTargetProfile()) 
37770            composeCanonicalExtras(null, e, true);
37771          closeArray();
37772        }
37773      };
37774      if (element.hasAggregation()) {
37775        openArray("aggregation");
37776        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
37777          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
37778        closeArray();
37779        if (anyHasExtras(element.getAggregation())) {
37780          openArray("_aggregation");
37781          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
37782            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
37783          closeArray();
37784        }
37785      };
37786      if (element.hasVersioningElement()) {
37787        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
37788        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
37789      }
37790  }
37791
37792  protected void composeElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
37793    if (element != null) {
37794      open(name);
37795      composeElementDefinitionExampleComponentProperties(element);
37796      close();
37797    }
37798  }
37799
37800  protected void composeElementDefinitionExampleComponentProperties(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
37801    composeElementProperties(element);
37802      if (element.hasLabelElement()) {
37803        composeStringCore("label", element.getLabelElement(), false);
37804        composeStringExtras("label", element.getLabelElement(), false);
37805      }
37806      if (element.hasValue()) {
37807        composeType("value", element.getValue());
37808      }
37809  }
37810
37811  protected void composeElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
37812    if (element != null) {
37813      open(name);
37814      composeElementDefinitionConstraintComponentProperties(element);
37815      close();
37816    }
37817  }
37818
37819  protected void composeElementDefinitionConstraintComponentProperties(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
37820    composeElementProperties(element);
37821      if (element.hasKeyElement()) {
37822        composeIdCore("key", element.getKeyElement(), false);
37823        composeIdExtras("key", element.getKeyElement(), false);
37824      }
37825      if (element.hasRequirementsElement()) {
37826        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
37827        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
37828      }
37829      if (element.hasSeverityElement()) {
37830        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
37831        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
37832      }
37833      if (element.hasSuppressElement()) {
37834        composeBooleanCore("suppress", element.getSuppressElement(), false);
37835        composeBooleanExtras("suppress", element.getSuppressElement(), false);
37836      }
37837      if (element.hasHumanElement()) {
37838        composeStringCore("human", element.getHumanElement(), false);
37839        composeStringExtras("human", element.getHumanElement(), false);
37840      }
37841      if (element.hasExpressionElement()) {
37842        composeStringCore("expression", element.getExpressionElement(), false);
37843        composeStringExtras("expression", element.getExpressionElement(), false);
37844      }
37845      if (element.hasSourceElement()) {
37846        composeCanonicalCore("source", element.getSourceElement(), false);
37847        composeCanonicalExtras("source", element.getSourceElement(), false);
37848      }
37849  }
37850
37851  protected void composeElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
37852    if (element != null) {
37853      open(name);
37854      composeElementDefinitionBindingComponentProperties(element);
37855      close();
37856    }
37857  }
37858
37859  protected void composeElementDefinitionBindingComponentProperties(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
37860    composeElementProperties(element);
37861      if (element.hasStrengthElement()) {
37862        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
37863        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
37864      }
37865      if (element.hasDescriptionElement()) {
37866        composeMarkdownCore("description", element.getDescriptionElement(), false);
37867        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37868      }
37869      if (element.hasValueSetElement()) {
37870        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37871        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37872      }
37873      if (element.hasAdditional()) {
37874        openArray("additional");
37875        for (ElementDefinition.ElementDefinitionBindingAdditionalComponent e : element.getAdditional()) 
37876          composeElementDefinitionBindingAdditionalComponent(null, e);
37877        closeArray();
37878      };
37879  }
37880
37881  protected void composeElementDefinitionBindingAdditionalComponent(String name, ElementDefinition.ElementDefinitionBindingAdditionalComponent element) throws IOException {
37882    if (element != null) {
37883      open(name);
37884      composeElementDefinitionBindingAdditionalComponentProperties(element);
37885      close();
37886    }
37887  }
37888
37889  protected void composeElementDefinitionBindingAdditionalComponentProperties(ElementDefinition.ElementDefinitionBindingAdditionalComponent element) throws IOException {
37890    composeElementProperties(element);
37891      if (element.hasPurposeElement()) {
37892        composeEnumerationCore("purpose", element.getPurposeElement(), new ElementDefinition.AdditionalBindingPurposeVSEnumFactory(), false);
37893        composeEnumerationExtras("purpose", element.getPurposeElement(), new ElementDefinition.AdditionalBindingPurposeVSEnumFactory(), false);
37894      }
37895      if (element.hasValueSetElement()) {
37896        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37897        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37898      }
37899      if (element.hasDocumentationElement()) {
37900        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37901        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37902      }
37903      if (element.hasShortDocoElement()) {
37904        composeStringCore("shortDoco", element.getShortDocoElement(), false);
37905        composeStringExtras("shortDoco", element.getShortDocoElement(), false);
37906      }
37907      if (element.hasUsage()) {
37908        openArray("usage");
37909        for (UsageContext e : element.getUsage()) 
37910          composeUsageContext(null, e);
37911        closeArray();
37912      };
37913      if (element.hasAnyElement()) {
37914        composeBooleanCore("any", element.getAnyElement(), false);
37915        composeBooleanExtras("any", element.getAnyElement(), false);
37916      }
37917  }
37918
37919  protected void composeElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
37920    if (element != null) {
37921      open(name);
37922      composeElementDefinitionMappingComponentProperties(element);
37923      close();
37924    }
37925  }
37926
37927  protected void composeElementDefinitionMappingComponentProperties(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
37928    composeElementProperties(element);
37929      if (element.hasIdentityElement()) {
37930        composeIdCore("identity", element.getIdentityElement(), false);
37931        composeIdExtras("identity", element.getIdentityElement(), false);
37932      }
37933      if (element.hasLanguageElement()) {
37934        composeCodeCore("language", element.getLanguageElement(), false);
37935        composeCodeExtras("language", element.getLanguageElement(), false);
37936      }
37937      if (element.hasMapElement()) {
37938        composeStringCore("map", element.getMapElement(), false);
37939        composeStringExtras("map", element.getMapElement(), false);
37940      }
37941      if (element.hasCommentElement()) {
37942        composeMarkdownCore("comment", element.getCommentElement(), false);
37943        composeMarkdownExtras("comment", element.getCommentElement(), false);
37944      }
37945  }
37946
37947  protected void composeExpression(String name, Expression element) throws IOException {
37948    if (element != null) {
37949      open(name);
37950      composeExpressionProperties(element);
37951      close();
37952    }
37953  }
37954
37955  protected void composeExpressionProperties(Expression element) throws IOException {
37956    composeDataTypeProperties(element);
37957      if (element.hasDescriptionElement()) {
37958        composeStringCore("description", element.getDescriptionElement(), false);
37959        composeStringExtras("description", element.getDescriptionElement(), false);
37960      }
37961      if (element.hasNameElement()) {
37962        composeCodeCore("name", element.getNameElement(), false);
37963        composeCodeExtras("name", element.getNameElement(), false);
37964      }
37965      if (element.hasLanguageElement()) {
37966        composeCodeCore("language", element.getLanguageElement(), false);
37967        composeCodeExtras("language", element.getLanguageElement(), false);
37968      }
37969      if (element.hasExpressionElement()) {
37970        composeStringCore("expression", element.getExpressionElement(), false);
37971        composeStringExtras("expression", element.getExpressionElement(), false);
37972      }
37973      if (element.hasReferenceElement()) {
37974        composeUriCore("reference", element.getReferenceElement(), false);
37975        composeUriExtras("reference", element.getReferenceElement(), false);
37976      }
37977  }
37978
37979  protected void composeExtendedContactDetail(String name, ExtendedContactDetail element) throws IOException {
37980    if (element != null) {
37981      open(name);
37982      composeExtendedContactDetailProperties(element);
37983      close();
37984    }
37985  }
37986
37987  protected void composeExtendedContactDetailProperties(ExtendedContactDetail element) throws IOException {
37988    composeDataTypeProperties(element);
37989      if (element.hasPurpose()) {
37990        composeCodeableConcept("purpose", element.getPurpose());
37991      }
37992      if (element.hasName()) {
37993        openArray("name");
37994        for (HumanName e : element.getName()) 
37995          composeHumanName(null, e);
37996        closeArray();
37997      };
37998      if (element.hasTelecom()) {
37999        openArray("telecom");
38000        for (ContactPoint e : element.getTelecom()) 
38001          composeContactPoint(null, e);
38002        closeArray();
38003      };
38004      if (element.hasAddress()) {
38005        composeAddress("address", element.getAddress());
38006      }
38007      if (element.hasOrganization()) {
38008        composeReference("organization", element.getOrganization());
38009      }
38010      if (element.hasPeriod()) {
38011        composePeriod("period", element.getPeriod());
38012      }
38013  }
38014
38015  protected void composeExtension(String name, Extension element) throws IOException {
38016    if (element != null) {
38017      open(name);
38018      composeExtensionProperties(element);
38019      close();
38020    }
38021  }
38022
38023  protected void composeExtensionProperties(Extension element) throws IOException {
38024    composeDataTypeProperties(element);
38025      if (element.hasUrlElement()) {
38026        composeUriCore("url", element.getUrlElement(), false);
38027        composeUriExtras("url", element.getUrlElement(), false);
38028      }
38029      if (element.hasValue()) {
38030        composeType("value", element.getValue());
38031      }
38032  }
38033
38034  protected void composeHumanName(String name, HumanName element) throws IOException {
38035    if (element != null) {
38036      open(name);
38037      composeHumanNameProperties(element);
38038      close();
38039    }
38040  }
38041
38042  protected void composeHumanNameProperties(HumanName element) throws IOException {
38043    composeDataTypeProperties(element);
38044      if (element.hasUseElement()) {
38045        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
38046        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
38047      }
38048      if (element.hasTextElement()) {
38049        composeStringCore("text", element.getTextElement(), false);
38050        composeStringExtras("text", element.getTextElement(), false);
38051      }
38052      if (element.hasFamilyElement()) {
38053        composeStringCore("family", element.getFamilyElement(), false);
38054        composeStringExtras("family", element.getFamilyElement(), false);
38055      }
38056      if (element.hasGiven()) {
38057        if (anyHasValue(element.getGiven())) {
38058          openArray("given");
38059          for (StringType e : element.getGiven()) 
38060            composeStringCore(null, e, e != element.getGiven().get(element.getGiven().size()-1));
38061          closeArray();
38062        }
38063        if (anyHasExtras(element.getGiven())) {
38064          openArray("_given");
38065          for (StringType e : element.getGiven()) 
38066            composeStringExtras(null, e, true);
38067          closeArray();
38068        }
38069      };
38070      if (element.hasPrefix()) {
38071        if (anyHasValue(element.getPrefix())) {
38072          openArray("prefix");
38073          for (StringType e : element.getPrefix()) 
38074            composeStringCore(null, e, e != element.getPrefix().get(element.getPrefix().size()-1));
38075          closeArray();
38076        }
38077        if (anyHasExtras(element.getPrefix())) {
38078          openArray("_prefix");
38079          for (StringType e : element.getPrefix()) 
38080            composeStringExtras(null, e, true);
38081          closeArray();
38082        }
38083      };
38084      if (element.hasSuffix()) {
38085        if (anyHasValue(element.getSuffix())) {
38086          openArray("suffix");
38087          for (StringType e : element.getSuffix()) 
38088            composeStringCore(null, e, e != element.getSuffix().get(element.getSuffix().size()-1));
38089          closeArray();
38090        }
38091        if (anyHasExtras(element.getSuffix())) {
38092          openArray("_suffix");
38093          for (StringType e : element.getSuffix()) 
38094            composeStringExtras(null, e, true);
38095          closeArray();
38096        }
38097      };
38098      if (element.hasPeriod()) {
38099        composePeriod("period", element.getPeriod());
38100      }
38101  }
38102
38103  protected void composeIdentifier(String name, Identifier element) throws IOException {
38104    if (element != null) {
38105      open(name);
38106      composeIdentifierProperties(element);
38107      close();
38108    }
38109  }
38110
38111  protected void composeIdentifierProperties(Identifier element) throws IOException {
38112    composeDataTypeProperties(element);
38113      if (element.hasUseElement()) {
38114        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
38115        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
38116      }
38117      if (element.hasType()) {
38118        composeCodeableConcept("type", element.getType());
38119      }
38120      if (element.hasSystemElement()) {
38121        composeUriCore("system", element.getSystemElement(), false);
38122        composeUriExtras("system", element.getSystemElement(), false);
38123      }
38124      if (element.hasValueElement()) {
38125        composeStringCore("value", element.getValueElement(), false);
38126        composeStringExtras("value", element.getValueElement(), false);
38127      }
38128      if (element.hasPeriod()) {
38129        composePeriod("period", element.getPeriod());
38130      }
38131      if (element.hasAssigner()) {
38132        composeReference("assigner", element.getAssigner());
38133      }
38134  }
38135
38136  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
38137    if (element != null) {
38138      open(name);
38139      composeMarketingStatusProperties(element);
38140      close();
38141    }
38142  }
38143
38144  protected void composeMarketingStatusProperties(MarketingStatus element) throws IOException {
38145    composeBackboneTypeProperties(element);
38146      if (element.hasCountry()) {
38147        composeCodeableConcept("country", element.getCountry());
38148      }
38149      if (element.hasJurisdiction()) {
38150        composeCodeableConcept("jurisdiction", element.getJurisdiction());
38151      }
38152      if (element.hasStatus()) {
38153        composeCodeableConcept("status", element.getStatus());
38154      }
38155      if (element.hasDateRange()) {
38156        composePeriod("dateRange", element.getDateRange());
38157      }
38158      if (element.hasRestoreDateElement()) {
38159        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
38160        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
38161      }
38162  }
38163
38164  protected void composeMeta(String name, Meta element) throws IOException {
38165    if (element != null) {
38166      open(name);
38167      composeMetaProperties(element);
38168      close();
38169    }
38170  }
38171
38172  protected void composeMetaProperties(Meta element) throws IOException {
38173    composeDataTypeProperties(element);
38174      if (element.hasVersionIdElement()) {
38175        composeIdCore("versionId", element.getVersionIdElement(), false);
38176        composeIdExtras("versionId", element.getVersionIdElement(), false);
38177      }
38178      if (element.hasLastUpdatedElement()) {
38179        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
38180        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
38181      }
38182      if (element.hasSourceElement()) {
38183        composeUriCore("source", element.getSourceElement(), false);
38184        composeUriExtras("source", element.getSourceElement(), false);
38185      }
38186      if (element.hasProfile()) {
38187        if (anyHasValue(element.getProfile())) {
38188          openArray("profile");
38189          for (CanonicalType e : element.getProfile()) 
38190            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
38191          closeArray();
38192        }
38193        if (anyHasExtras(element.getProfile())) {
38194          openArray("_profile");
38195          for (CanonicalType e : element.getProfile()) 
38196            composeCanonicalExtras(null, e, true);
38197          closeArray();
38198        }
38199      };
38200      if (element.hasSecurity()) {
38201        openArray("security");
38202        for (Coding e : element.getSecurity()) 
38203          composeCoding(null, e);
38204        closeArray();
38205      };
38206      if (element.hasTag()) {
38207        openArray("tag");
38208        for (Coding e : element.getTag()) 
38209          composeCoding(null, e);
38210        closeArray();
38211      };
38212  }
38213
38214  protected void composeMonetaryComponent(String name, MonetaryComponent element) throws IOException {
38215    if (element != null) {
38216      open(name);
38217      composeMonetaryComponentProperties(element);
38218      close();
38219    }
38220  }
38221
38222  protected void composeMonetaryComponentProperties(MonetaryComponent element) throws IOException {
38223    composeDataTypeProperties(element);
38224      if (element.hasTypeElement()) {
38225        composeEnumerationCore("type", element.getTypeElement(), new MonetaryComponent.PriceComponentTypeEnumFactory(), false);
38226        composeEnumerationExtras("type", element.getTypeElement(), new MonetaryComponent.PriceComponentTypeEnumFactory(), false);
38227      }
38228      if (element.hasCode()) {
38229        composeCodeableConcept("code", element.getCode());
38230      }
38231      if (element.hasFactorElement()) {
38232        composeDecimalCore("factor", element.getFactorElement(), false);
38233        composeDecimalExtras("factor", element.getFactorElement(), false);
38234      }
38235      if (element.hasAmount()) {
38236        composeMoney("amount", element.getAmount());
38237      }
38238  }
38239
38240  protected void composeMoney(String name, Money element) throws IOException {
38241    if (element != null) {
38242      open(name);
38243      composeMoneyProperties(element);
38244      close();
38245    }
38246  }
38247
38248  protected void composeMoneyProperties(Money element) throws IOException {
38249    composeDataTypeProperties(element);
38250      if (element.hasValueElement()) {
38251        composeDecimalCore("value", element.getValueElement(), false);
38252        composeDecimalExtras("value", element.getValueElement(), false);
38253      }
38254      if (element.hasCurrencyElement()) {
38255        composeCodeCore("currency", element.getCurrencyElement(), false);
38256        composeCodeExtras("currency", element.getCurrencyElement(), false);
38257      }
38258  }
38259
38260  protected void composeNarrative(String name, Narrative element) throws IOException {
38261    if (element != null) {
38262      open(name);
38263      composeNarrativeProperties(element);
38264      close();
38265    }
38266  }
38267
38268  protected void composeNarrativeProperties(Narrative element) throws IOException {
38269    composeDataTypeProperties(element);
38270      if (element.hasStatusElement()) {
38271        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
38272        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
38273      }
38274      if (element.hasDiv()) {
38275        XhtmlNode node = element.getDiv();
38276        if (node.getNsDecl() == null) {
38277          node.attribute("xmlns", XHTML_NS);
38278        }
38279        composeXhtml("div", node);
38280      }
38281  }
38282
38283  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
38284    if (element != null) {
38285      open(name);
38286      composeParameterDefinitionProperties(element);
38287      close();
38288    }
38289  }
38290
38291  protected void composeParameterDefinitionProperties(ParameterDefinition element) throws IOException {
38292    composeDataTypeProperties(element);
38293      if (element.hasNameElement()) {
38294        composeCodeCore("name", element.getNameElement(), false);
38295        composeCodeExtras("name", element.getNameElement(), false);
38296      }
38297      if (element.hasUseElement()) {
38298        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
38299        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
38300      }
38301      if (element.hasMinElement()) {
38302        composeIntegerCore("min", element.getMinElement(), false);
38303        composeIntegerExtras("min", element.getMinElement(), false);
38304      }
38305      if (element.hasMaxElement()) {
38306        composeStringCore("max", element.getMaxElement(), false);
38307        composeStringExtras("max", element.getMaxElement(), false);
38308      }
38309      if (element.hasDocumentationElement()) {
38310        composeStringCore("documentation", element.getDocumentationElement(), false);
38311        composeStringExtras("documentation", element.getDocumentationElement(), false);
38312      }
38313      if (element.hasTypeElement()) {
38314        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
38315        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
38316      }
38317      if (element.hasProfileElement()) {
38318        composeCanonicalCore("profile", element.getProfileElement(), false);
38319        composeCanonicalExtras("profile", element.getProfileElement(), false);
38320      }
38321  }
38322
38323  protected void composePeriod(String name, Period element) throws IOException {
38324    if (element != null) {
38325      open(name);
38326      composePeriodProperties(element);
38327      close();
38328    }
38329  }
38330
38331  protected void composePeriodProperties(Period element) throws IOException {
38332    composeDataTypeProperties(element);
38333      if (element.hasStartElement()) {
38334        composeDateTimeCore("start", element.getStartElement(), false);
38335        composeDateTimeExtras("start", element.getStartElement(), false);
38336      }
38337      if (element.hasEndElement()) {
38338        composeDateTimeCore("end", element.getEndElement(), false);
38339        composeDateTimeExtras("end", element.getEndElement(), false);
38340      }
38341  }
38342
38343  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
38344    if (element != null) {
38345      open(name);
38346      composeProductShelfLifeProperties(element);
38347      close();
38348    }
38349  }
38350
38351  protected void composeProductShelfLifeProperties(ProductShelfLife element) throws IOException {
38352    composeBackboneTypeProperties(element);
38353      if (element.hasType()) {
38354        composeCodeableConcept("type", element.getType());
38355      }
38356      if (element.hasPeriod()) {
38357        composeType("period", element.getPeriod());
38358      }
38359      if (element.hasSpecialPrecautionsForStorage()) {
38360        openArray("specialPrecautionsForStorage");
38361        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
38362          composeCodeableConcept(null, e);
38363        closeArray();
38364      };
38365  }
38366
38367  protected void composeQuantity(String name, Quantity element) throws IOException {
38368    if (element != null) {
38369      open(name);
38370      composeQuantityProperties(element);
38371      close();
38372    }
38373  }
38374
38375  protected void composeQuantityProperties(Quantity element) throws IOException {
38376    composeDataTypeProperties(element);
38377      if (element.hasValueElement()) {
38378        composeDecimalCore("value", element.getValueElement(), false);
38379        composeDecimalExtras("value", element.getValueElement(), false);
38380      }
38381      if (element.hasComparatorElement()) {
38382        composeEnumerationCore("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
38383        composeEnumerationExtras("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
38384      }
38385      if (element.hasUnitElement()) {
38386        composeStringCore("unit", element.getUnitElement(), false);
38387        composeStringExtras("unit", element.getUnitElement(), false);
38388      }
38389      if (element.hasSystemElement()) {
38390        composeUriCore("system", element.getSystemElement(), false);
38391        composeUriExtras("system", element.getSystemElement(), false);
38392      }
38393      if (element.hasCodeElement()) {
38394        composeCodeCore("code", element.getCodeElement(), false);
38395        composeCodeExtras("code", element.getCodeElement(), false);
38396      }
38397  }
38398
38399  protected void composeRange(String name, Range element) throws IOException {
38400    if (element != null) {
38401      open(name);
38402      composeRangeProperties(element);
38403      close();
38404    }
38405  }
38406
38407  protected void composeRangeProperties(Range element) throws IOException {
38408    composeDataTypeProperties(element);
38409      if (element.hasLow()) {
38410        composeQuantity("low", element.getLow());
38411      }
38412      if (element.hasHigh()) {
38413        composeQuantity("high", element.getHigh());
38414      }
38415  }
38416
38417  protected void composeRatio(String name, Ratio element) throws IOException {
38418    if (element != null) {
38419      open(name);
38420      composeRatioProperties(element);
38421      close();
38422    }
38423  }
38424
38425  protected void composeRatioProperties(Ratio element) throws IOException {
38426    composeDataTypeProperties(element);
38427      if (element.hasNumerator()) {
38428        composeQuantity("numerator", element.getNumerator());
38429      }
38430      if (element.hasDenominator()) {
38431        composeQuantity("denominator", element.getDenominator());
38432      }
38433  }
38434
38435  protected void composeRatioRange(String name, RatioRange element) throws IOException {
38436    if (element != null) {
38437      open(name);
38438      composeRatioRangeProperties(element);
38439      close();
38440    }
38441  }
38442
38443  protected void composeRatioRangeProperties(RatioRange element) throws IOException {
38444    composeDataTypeProperties(element);
38445      if (element.hasLowNumerator()) {
38446        composeQuantity("lowNumerator", element.getLowNumerator());
38447      }
38448      if (element.hasHighNumerator()) {
38449        composeQuantity("highNumerator", element.getHighNumerator());
38450      }
38451      if (element.hasDenominator()) {
38452        composeQuantity("denominator", element.getDenominator());
38453      }
38454  }
38455
38456  protected void composeReference(String name, Reference element) throws IOException {
38457    if (element != null) {
38458      open(name);
38459      composeReferenceProperties(element);
38460      close();
38461    }
38462  }
38463
38464  protected void composeReferenceProperties(Reference element) throws IOException {
38465    composeDataTypeProperties(element);
38466      if (element.hasReferenceElement()) {
38467        composeStringCore("reference", element.getReferenceElement(), false);
38468        composeStringExtras("reference", element.getReferenceElement(), false);
38469      }
38470      if (element.hasTypeElement()) {
38471        composeUriCore("type", element.getTypeElement(), false);
38472        composeUriExtras("type", element.getTypeElement(), false);
38473      }
38474      if (element.hasIdentifier()) {
38475        composeIdentifier("identifier", element.getIdentifier());
38476      }
38477      if (element.hasDisplayElement()) {
38478        composeStringCore("display", element.getDisplayElement(), false);
38479        composeStringExtras("display", element.getDisplayElement(), false);
38480      }
38481  }
38482
38483  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
38484    if (element != null) {
38485      open(name);
38486      composeRelatedArtifactProperties(element);
38487      close();
38488    }
38489  }
38490
38491  protected void composeRelatedArtifactProperties(RelatedArtifact element) throws IOException {
38492    composeDataTypeProperties(element);
38493      if (element.hasTypeElement()) {
38494        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
38495        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
38496      }
38497      if (element.hasClassifier()) {
38498        openArray("classifier");
38499        for (CodeableConcept e : element.getClassifier()) 
38500          composeCodeableConcept(null, e);
38501        closeArray();
38502      };
38503      if (element.hasLabelElement()) {
38504        composeStringCore("label", element.getLabelElement(), false);
38505        composeStringExtras("label", element.getLabelElement(), false);
38506      }
38507      if (element.hasDisplayElement()) {
38508        composeStringCore("display", element.getDisplayElement(), false);
38509        composeStringExtras("display", element.getDisplayElement(), false);
38510      }
38511      if (element.hasCitationElement()) {
38512        composeMarkdownCore("citation", element.getCitationElement(), false);
38513        composeMarkdownExtras("citation", element.getCitationElement(), false);
38514      }
38515      if (element.hasDocument()) {
38516        composeAttachment("document", element.getDocument());
38517      }
38518      if (element.hasResourceElement()) {
38519        composeCanonicalCore("resource", element.getResourceElement(), false);
38520        composeCanonicalExtras("resource", element.getResourceElement(), false);
38521      }
38522      if (element.hasResourceReference()) {
38523        composeReference("resourceReference", element.getResourceReference());
38524      }
38525      if (element.hasPublicationStatusElement()) {
38526        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38527        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38528      }
38529      if (element.hasPublicationDateElement()) {
38530        composeDateCore("publicationDate", element.getPublicationDateElement(), false);
38531        composeDateExtras("publicationDate", element.getPublicationDateElement(), false);
38532      }
38533  }
38534
38535  protected void composeSampledData(String name, SampledData element) throws IOException {
38536    if (element != null) {
38537      open(name);
38538      composeSampledDataProperties(element);
38539      close();
38540    }
38541  }
38542
38543  protected void composeSampledDataProperties(SampledData element) throws IOException {
38544    composeDataTypeProperties(element);
38545      if (element.hasOrigin()) {
38546        composeQuantity("origin", element.getOrigin());
38547      }
38548      if (element.hasIntervalElement()) {
38549        composeDecimalCore("interval", element.getIntervalElement(), false);
38550        composeDecimalExtras("interval", element.getIntervalElement(), false);
38551      }
38552      if (element.hasIntervalUnitElement()) {
38553        composeCodeCore("intervalUnit", element.getIntervalUnitElement(), false);
38554        composeCodeExtras("intervalUnit", element.getIntervalUnitElement(), false);
38555      }
38556      if (element.hasFactorElement()) {
38557        composeDecimalCore("factor", element.getFactorElement(), false);
38558        composeDecimalExtras("factor", element.getFactorElement(), false);
38559      }
38560      if (element.hasLowerLimitElement()) {
38561        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
38562        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
38563      }
38564      if (element.hasUpperLimitElement()) {
38565        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
38566        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
38567      }
38568      if (element.hasDimensionsElement()) {
38569        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
38570        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
38571      }
38572      if (element.hasCodeMapElement()) {
38573        composeCanonicalCore("codeMap", element.getCodeMapElement(), false);
38574        composeCanonicalExtras("codeMap", element.getCodeMapElement(), false);
38575      }
38576      if (element.hasOffsetsElement()) {
38577        composeStringCore("offsets", element.getOffsetsElement(), false);
38578        composeStringExtras("offsets", element.getOffsetsElement(), false);
38579      }
38580      if (element.hasDataElement()) {
38581        composeStringCore("data", element.getDataElement(), false);
38582        composeStringExtras("data", element.getDataElement(), false);
38583      }
38584  }
38585
38586  protected void composeSignature(String name, Signature element) throws IOException {
38587    if (element != null) {
38588      open(name);
38589      composeSignatureProperties(element);
38590      close();
38591    }
38592  }
38593
38594  protected void composeSignatureProperties(Signature element) throws IOException {
38595    composeDataTypeProperties(element);
38596      if (element.hasType()) {
38597        openArray("type");
38598        for (Coding e : element.getType()) 
38599          composeCoding(null, e);
38600        closeArray();
38601      };
38602      if (element.hasWhenElement()) {
38603        composeInstantCore("when", element.getWhenElement(), false);
38604        composeInstantExtras("when", element.getWhenElement(), false);
38605      }
38606      if (element.hasWho()) {
38607        composeReference("who", element.getWho());
38608      }
38609      if (element.hasOnBehalfOf()) {
38610        composeReference("onBehalfOf", element.getOnBehalfOf());
38611      }
38612      if (element.hasTargetFormatElement()) {
38613        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
38614        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
38615      }
38616      if (element.hasSigFormatElement()) {
38617        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
38618        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
38619      }
38620      if (element.hasDataElement()) {
38621        composeBase64BinaryCore("data", element.getDataElement(), false);
38622        composeBase64BinaryExtras("data", element.getDataElement(), false);
38623      }
38624  }
38625
38626  protected void composeTiming(String name, Timing element) throws IOException {
38627    if (element != null) {
38628      open(name);
38629      composeTimingProperties(element);
38630      close();
38631    }
38632  }
38633
38634  protected void composeTimingProperties(Timing element) throws IOException {
38635    composeBackboneTypeProperties(element);
38636      if (element.hasEvent()) {
38637        if (anyHasValue(element.getEvent())) {
38638          openArray("event");
38639          for (DateTimeType e : element.getEvent()) 
38640            composeDateTimeCore(null, e, e != element.getEvent().get(element.getEvent().size()-1));
38641          closeArray();
38642        }
38643        if (anyHasExtras(element.getEvent())) {
38644          openArray("_event");
38645          for (DateTimeType e : element.getEvent()) 
38646            composeDateTimeExtras(null, e, true);
38647          closeArray();
38648        }
38649      };
38650      if (element.hasRepeat()) {
38651        composeTimingRepeatComponent("repeat", element.getRepeat());
38652      }
38653      if (element.hasCode()) {
38654        composeCodeableConcept("code", element.getCode());
38655      }
38656  }
38657
38658  protected void composeTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
38659    if (element != null) {
38660      open(name);
38661      composeTimingRepeatComponentProperties(element);
38662      close();
38663    }
38664  }
38665
38666  protected void composeTimingRepeatComponentProperties(Timing.TimingRepeatComponent element) throws IOException {
38667    composeElementProperties(element);
38668      if (element.hasBounds()) {
38669        composeType("bounds", element.getBounds());
38670      }
38671      if (element.hasCountElement()) {
38672        composePositiveIntCore("count", element.getCountElement(), false);
38673        composePositiveIntExtras("count", element.getCountElement(), false);
38674      }
38675      if (element.hasCountMaxElement()) {
38676        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
38677        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
38678      }
38679      if (element.hasDurationElement()) {
38680        composeDecimalCore("duration", element.getDurationElement(), false);
38681        composeDecimalExtras("duration", element.getDurationElement(), false);
38682      }
38683      if (element.hasDurationMaxElement()) {
38684        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
38685        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
38686      }
38687      if (element.hasDurationUnitElement()) {
38688        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38689        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38690      }
38691      if (element.hasFrequencyElement()) {
38692        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
38693        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
38694      }
38695      if (element.hasFrequencyMaxElement()) {
38696        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
38697        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
38698      }
38699      if (element.hasPeriodElement()) {
38700        composeDecimalCore("period", element.getPeriodElement(), false);
38701        composeDecimalExtras("period", element.getPeriodElement(), false);
38702      }
38703      if (element.hasPeriodMaxElement()) {
38704        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
38705        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
38706      }
38707      if (element.hasPeriodUnitElement()) {
38708        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38709        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
38710      }
38711      if (element.hasDayOfWeek()) {
38712        openArray("dayOfWeek");
38713        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
38714          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
38715        closeArray();
38716        if (anyHasExtras(element.getDayOfWeek())) {
38717          openArray("_dayOfWeek");
38718          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
38719            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
38720          closeArray();
38721        }
38722      };
38723      if (element.hasTimeOfDay()) {
38724        if (anyHasValue(element.getTimeOfDay())) {
38725          openArray("timeOfDay");
38726          for (TimeType e : element.getTimeOfDay()) 
38727            composeTimeCore(null, e, e != element.getTimeOfDay().get(element.getTimeOfDay().size()-1));
38728          closeArray();
38729        }
38730        if (anyHasExtras(element.getTimeOfDay())) {
38731          openArray("_timeOfDay");
38732          for (TimeType e : element.getTimeOfDay()) 
38733            composeTimeExtras(null, e, true);
38734          closeArray();
38735        }
38736      };
38737      if (element.hasWhen()) {
38738        openArray("when");
38739        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
38740          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
38741        closeArray();
38742        if (anyHasExtras(element.getWhen())) {
38743          openArray("_when");
38744          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
38745            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
38746          closeArray();
38747        }
38748      };
38749      if (element.hasOffsetElement()) {
38750        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
38751        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
38752      }
38753  }
38754
38755  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
38756    if (element != null) {
38757      open(name);
38758      composeTriggerDefinitionProperties(element);
38759      close();
38760    }
38761  }
38762
38763  protected void composeTriggerDefinitionProperties(TriggerDefinition element) throws IOException {
38764    composeDataTypeProperties(element);
38765      if (element.hasTypeElement()) {
38766        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
38767        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
38768      }
38769      if (element.hasNameElement()) {
38770        composeStringCore("name", element.getNameElement(), false);
38771        composeStringExtras("name", element.getNameElement(), false);
38772      }
38773      if (element.hasCode()) {
38774        composeCodeableConcept("code", element.getCode());
38775      }
38776      if (element.hasSubscriptionTopicElement()) {
38777        composeCanonicalCore("subscriptionTopic", element.getSubscriptionTopicElement(), false);
38778        composeCanonicalExtras("subscriptionTopic", element.getSubscriptionTopicElement(), false);
38779      }
38780      if (element.hasTiming()) {
38781        composeType("timing", element.getTiming());
38782      }
38783      if (element.hasData()) {
38784        openArray("data");
38785        for (DataRequirement e : element.getData()) 
38786          composeDataRequirement(null, e);
38787        closeArray();
38788      };
38789      if (element.hasCondition()) {
38790        composeExpression("condition", element.getCondition());
38791      }
38792  }
38793
38794  protected void composeUsageContext(String name, UsageContext element) throws IOException {
38795    if (element != null) {
38796      open(name);
38797      composeUsageContextProperties(element);
38798      close();
38799    }
38800  }
38801
38802  protected void composeUsageContextProperties(UsageContext element) throws IOException {
38803    composeDataTypeProperties(element);
38804      if (element.hasCode()) {
38805        composeCoding("code", element.getCode());
38806      }
38807      if (element.hasValue()) {
38808        composeType("value", element.getValue());
38809      }
38810  }
38811
38812  protected void composeVirtualServiceDetail(String name, VirtualServiceDetail element) throws IOException {
38813    if (element != null) {
38814      open(name);
38815      composeVirtualServiceDetailProperties(element);
38816      close();
38817    }
38818  }
38819
38820  protected void composeVirtualServiceDetailProperties(VirtualServiceDetail element) throws IOException {
38821    composeDataTypeProperties(element);
38822      if (element.hasChannelType()) {
38823        composeCoding("channelType", element.getChannelType());
38824      }
38825      if (element.hasAddress()) {
38826        composeType("address", element.getAddress());
38827      }
38828      if (element.hasAdditionalInfo()) {
38829        if (anyHasValue(element.getAdditionalInfo())) {
38830          openArray("additionalInfo");
38831          for (UrlType e : element.getAdditionalInfo()) 
38832            composeUrlCore(null, e, e != element.getAdditionalInfo().get(element.getAdditionalInfo().size()-1));
38833          closeArray();
38834        }
38835        if (anyHasExtras(element.getAdditionalInfo())) {
38836          openArray("_additionalInfo");
38837          for (UrlType e : element.getAdditionalInfo()) 
38838            composeUrlExtras(null, e, true);
38839          closeArray();
38840        }
38841      };
38842      if (element.hasMaxParticipantsElement()) {
38843        composePositiveIntCore("maxParticipants", element.getMaxParticipantsElement(), false);
38844        composePositiveIntExtras("maxParticipants", element.getMaxParticipantsElement(), false);
38845      }
38846      if (element.hasSessionKeyElement()) {
38847        composeStringCore("sessionKey", element.getSessionKeyElement(), false);
38848        composeStringExtras("sessionKey", element.getSessionKeyElement(), false);
38849      }
38850  }
38851
38852  protected void composeCanonicalResourceProperties(CanonicalResource element) throws IOException {
38853      composeDomainResourceProperties(element);
38854  }
38855
38856  protected void composeDomainResourceProperties(DomainResource element) throws IOException {
38857      composeResourceProperties(element);
38858      if (element.hasText()) {
38859        composeNarrative("text", element.getText());
38860      }
38861      if (element.hasContained()) {
38862        openArray("contained");
38863        for (Resource e : element.getContained()) {
38864          open(null);
38865          composeResource(e);
38866          close();
38867        }
38868        closeArray();
38869      };
38870      if (element.hasExtension()) {
38871        openArray("extension");
38872        for (Extension e : element.getExtension()) 
38873          composeExtension(null, e);
38874        closeArray();
38875      };
38876      if (element.hasModifierExtension()) {
38877        openArray("modifierExtension");
38878        for (Extension e : element.getModifierExtension()) 
38879          composeExtension(null, e);
38880        closeArray();
38881      };
38882  }
38883
38884  protected void composeMetadataResourceProperties(MetadataResource element) throws IOException {
38885      composeCanonicalResourceProperties(element);
38886  }
38887
38888  protected void composeResourceProperties(Resource element) throws IOException {
38889      composeBaseProperties(element);
38890      if (element.hasIdElement()) {
38891        composeIdCore("id", element.getIdElement(), false);
38892        composeIdExtras("id", element.getIdElement(), false);
38893      }
38894      if (element.hasMeta()) {
38895        composeMeta("meta", element.getMeta());
38896      }
38897      if (element.hasImplicitRulesElement()) {
38898        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
38899        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
38900      }
38901      if (element.hasLanguageElement()) {
38902        composeCodeCore("language", element.getLanguageElement(), false);
38903        composeCodeExtras("language", element.getLanguageElement(), false);
38904      }
38905  }
38906
38907  protected void composeAccount(String name, Account element) throws IOException {
38908    if (element != null) {
38909      prop("resourceType", name);
38910      composeAccountProperties(element);
38911    }
38912  }
38913
38914  protected void composeAccountProperties(Account element) throws IOException {
38915    composeDomainResourceProperties(element);
38916      if (element.hasIdentifier()) {
38917        openArray("identifier");
38918        for (Identifier e : element.getIdentifier()) 
38919          composeIdentifier(null, e);
38920        closeArray();
38921      };
38922      if (element.hasStatusElement()) {
38923        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
38924        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
38925      }
38926      if (element.hasBillingStatus()) {
38927        composeCodeableConcept("billingStatus", element.getBillingStatus());
38928      }
38929      if (element.hasType()) {
38930        composeCodeableConcept("type", element.getType());
38931      }
38932      if (element.hasNameElement()) {
38933        composeStringCore("name", element.getNameElement(), false);
38934        composeStringExtras("name", element.getNameElement(), false);
38935      }
38936      if (element.hasSubject()) {
38937        openArray("subject");
38938        for (Reference e : element.getSubject()) 
38939          composeReference(null, e);
38940        closeArray();
38941      };
38942      if (element.hasServicePeriod()) {
38943        composePeriod("servicePeriod", element.getServicePeriod());
38944      }
38945      if (element.hasCoverage()) {
38946        openArray("coverage");
38947        for (Account.CoverageComponent e : element.getCoverage()) 
38948          composeCoverageComponent(null, e);
38949        closeArray();
38950      };
38951      if (element.hasOwner()) {
38952        composeReference("owner", element.getOwner());
38953      }
38954      if (element.hasDescriptionElement()) {
38955        composeMarkdownCore("description", element.getDescriptionElement(), false);
38956        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38957      }
38958      if (element.hasGuarantor()) {
38959        openArray("guarantor");
38960        for (Account.GuarantorComponent e : element.getGuarantor()) 
38961          composeGuarantorComponent(null, e);
38962        closeArray();
38963      };
38964      if (element.hasDiagnosis()) {
38965        openArray("diagnosis");
38966        for (Account.AccountDiagnosisComponent e : element.getDiagnosis()) 
38967          composeAccountDiagnosisComponent(null, e);
38968        closeArray();
38969      };
38970      if (element.hasProcedure()) {
38971        openArray("procedure");
38972        for (Account.AccountProcedureComponent e : element.getProcedure()) 
38973          composeAccountProcedureComponent(null, e);
38974        closeArray();
38975      };
38976      if (element.hasRelatedAccount()) {
38977        openArray("relatedAccount");
38978        for (Account.AccountRelatedAccountComponent e : element.getRelatedAccount()) 
38979          composeAccountRelatedAccountComponent(null, e);
38980        closeArray();
38981      };
38982      if (element.hasCurrency()) {
38983        composeCodeableConcept("currency", element.getCurrency());
38984      }
38985      if (element.hasBalance()) {
38986        openArray("balance");
38987        for (Account.AccountBalanceComponent e : element.getBalance()) 
38988          composeAccountBalanceComponent(null, e);
38989        closeArray();
38990      };
38991      if (element.hasCalculatedAtElement()) {
38992        composeInstantCore("calculatedAt", element.getCalculatedAtElement(), false);
38993        composeInstantExtras("calculatedAt", element.getCalculatedAtElement(), false);
38994      }
38995  }
38996
38997  protected void composeCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
38998    if (element != null) {
38999      open(name);
39000      composeCoverageComponentProperties(element);
39001      close();
39002    }
39003  }
39004
39005  protected void composeCoverageComponentProperties(Account.CoverageComponent element) throws IOException {
39006    composeBackboneElementProperties(element);
39007      if (element.hasCoverage()) {
39008        composeReference("coverage", element.getCoverage());
39009      }
39010      if (element.hasPriorityElement()) {
39011        composePositiveIntCore("priority", element.getPriorityElement(), false);
39012        composePositiveIntExtras("priority", element.getPriorityElement(), false);
39013      }
39014  }
39015
39016  protected void composeGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
39017    if (element != null) {
39018      open(name);
39019      composeGuarantorComponentProperties(element);
39020      close();
39021    }
39022  }
39023
39024  protected void composeGuarantorComponentProperties(Account.GuarantorComponent element) throws IOException {
39025    composeBackboneElementProperties(element);
39026      if (element.hasParty()) {
39027        composeReference("party", element.getParty());
39028      }
39029      if (element.hasOnHoldElement()) {
39030        composeBooleanCore("onHold", element.getOnHoldElement(), false);
39031        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
39032      }
39033      if (element.hasPeriod()) {
39034        composePeriod("period", element.getPeriod());
39035      }
39036  }
39037
39038  protected void composeAccountDiagnosisComponent(String name, Account.AccountDiagnosisComponent element) throws IOException {
39039    if (element != null) {
39040      open(name);
39041      composeAccountDiagnosisComponentProperties(element);
39042      close();
39043    }
39044  }
39045
39046  protected void composeAccountDiagnosisComponentProperties(Account.AccountDiagnosisComponent element) throws IOException {
39047    composeBackboneElementProperties(element);
39048      if (element.hasSequenceElement()) {
39049        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39050        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39051      }
39052      if (element.hasCondition()) {
39053        composeCodeableReference("condition", element.getCondition());
39054      }
39055      if (element.hasDateOfDiagnosisElement()) {
39056        composeDateTimeCore("dateOfDiagnosis", element.getDateOfDiagnosisElement(), false);
39057        composeDateTimeExtras("dateOfDiagnosis", element.getDateOfDiagnosisElement(), false);
39058      }
39059      if (element.hasType()) {
39060        openArray("type");
39061        for (CodeableConcept e : element.getType()) 
39062          composeCodeableConcept(null, e);
39063        closeArray();
39064      };
39065      if (element.hasOnAdmissionElement()) {
39066        composeBooleanCore("onAdmission", element.getOnAdmissionElement(), false);
39067        composeBooleanExtras("onAdmission", element.getOnAdmissionElement(), false);
39068      }
39069      if (element.hasPackageCode()) {
39070        openArray("packageCode");
39071        for (CodeableConcept e : element.getPackageCode()) 
39072          composeCodeableConcept(null, e);
39073        closeArray();
39074      };
39075  }
39076
39077  protected void composeAccountProcedureComponent(String name, Account.AccountProcedureComponent element) throws IOException {
39078    if (element != null) {
39079      open(name);
39080      composeAccountProcedureComponentProperties(element);
39081      close();
39082    }
39083  }
39084
39085  protected void composeAccountProcedureComponentProperties(Account.AccountProcedureComponent element) throws IOException {
39086    composeBackboneElementProperties(element);
39087      if (element.hasSequenceElement()) {
39088        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39089        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39090      }
39091      if (element.hasCode()) {
39092        composeCodeableReference("code", element.getCode());
39093      }
39094      if (element.hasDateOfServiceElement()) {
39095        composeDateTimeCore("dateOfService", element.getDateOfServiceElement(), false);
39096        composeDateTimeExtras("dateOfService", element.getDateOfServiceElement(), false);
39097      }
39098      if (element.hasType()) {
39099        openArray("type");
39100        for (CodeableConcept e : element.getType()) 
39101          composeCodeableConcept(null, e);
39102        closeArray();
39103      };
39104      if (element.hasPackageCode()) {
39105        openArray("packageCode");
39106        for (CodeableConcept e : element.getPackageCode()) 
39107          composeCodeableConcept(null, e);
39108        closeArray();
39109      };
39110      if (element.hasDevice()) {
39111        openArray("device");
39112        for (Reference e : element.getDevice()) 
39113          composeReference(null, e);
39114        closeArray();
39115      };
39116  }
39117
39118  protected void composeAccountRelatedAccountComponent(String name, Account.AccountRelatedAccountComponent element) throws IOException {
39119    if (element != null) {
39120      open(name);
39121      composeAccountRelatedAccountComponentProperties(element);
39122      close();
39123    }
39124  }
39125
39126  protected void composeAccountRelatedAccountComponentProperties(Account.AccountRelatedAccountComponent element) throws IOException {
39127    composeBackboneElementProperties(element);
39128      if (element.hasRelationship()) {
39129        composeCodeableConcept("relationship", element.getRelationship());
39130      }
39131      if (element.hasAccount()) {
39132        composeReference("account", element.getAccount());
39133      }
39134  }
39135
39136  protected void composeAccountBalanceComponent(String name, Account.AccountBalanceComponent element) throws IOException {
39137    if (element != null) {
39138      open(name);
39139      composeAccountBalanceComponentProperties(element);
39140      close();
39141    }
39142  }
39143
39144  protected void composeAccountBalanceComponentProperties(Account.AccountBalanceComponent element) throws IOException {
39145    composeBackboneElementProperties(element);
39146      if (element.hasAggregate()) {
39147        composeCodeableConcept("aggregate", element.getAggregate());
39148      }
39149      if (element.hasTerm()) {
39150        composeCodeableConcept("term", element.getTerm());
39151      }
39152      if (element.hasEstimateElement()) {
39153        composeBooleanCore("estimate", element.getEstimateElement(), false);
39154        composeBooleanExtras("estimate", element.getEstimateElement(), false);
39155      }
39156      if (element.hasAmount()) {
39157        composeMoney("amount", element.getAmount());
39158      }
39159  }
39160
39161  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
39162    if (element != null) {
39163      prop("resourceType", name);
39164      composeActivityDefinitionProperties(element);
39165    }
39166  }
39167
39168  protected void composeActivityDefinitionProperties(ActivityDefinition element) throws IOException {
39169    composeMetadataResourceProperties(element);
39170      if (element.hasUrlElement()) {
39171        composeUriCore("url", element.getUrlElement(), false);
39172        composeUriExtras("url", element.getUrlElement(), false);
39173      }
39174      if (element.hasIdentifier()) {
39175        openArray("identifier");
39176        for (Identifier e : element.getIdentifier()) 
39177          composeIdentifier(null, e);
39178        closeArray();
39179      };
39180      if (element.hasVersionElement()) {
39181        composeStringCore("version", element.getVersionElement(), false);
39182        composeStringExtras("version", element.getVersionElement(), false);
39183      }
39184      if (element.hasVersionAlgorithm()) {
39185        composeType("versionAlgorithm", element.getVersionAlgorithm());
39186      }
39187      if (element.hasNameElement()) {
39188        composeStringCore("name", element.getNameElement(), false);
39189        composeStringExtras("name", element.getNameElement(), false);
39190      }
39191      if (element.hasTitleElement()) {
39192        composeStringCore("title", element.getTitleElement(), false);
39193        composeStringExtras("title", element.getTitleElement(), false);
39194      }
39195      if (element.hasSubtitleElement()) {
39196        composeStringCore("subtitle", element.getSubtitleElement(), false);
39197        composeStringExtras("subtitle", element.getSubtitleElement(), false);
39198      }
39199      if (element.hasStatusElement()) {
39200        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39201        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39202      }
39203      if (element.hasExperimentalElement()) {
39204        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39205        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39206      }
39207      if (element.hasSubject()) {
39208        composeType("subject", element.getSubject());
39209      }
39210      if (element.hasDateElement()) {
39211        composeDateTimeCore("date", element.getDateElement(), false);
39212        composeDateTimeExtras("date", element.getDateElement(), false);
39213      }
39214      if (element.hasPublisherElement()) {
39215        composeStringCore("publisher", element.getPublisherElement(), false);
39216        composeStringExtras("publisher", element.getPublisherElement(), false);
39217      }
39218      if (element.hasContact()) {
39219        openArray("contact");
39220        for (ContactDetail e : element.getContact()) 
39221          composeContactDetail(null, e);
39222        closeArray();
39223      };
39224      if (element.hasDescriptionElement()) {
39225        composeMarkdownCore("description", element.getDescriptionElement(), false);
39226        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39227      }
39228      if (element.hasUseContext()) {
39229        openArray("useContext");
39230        for (UsageContext e : element.getUseContext()) 
39231          composeUsageContext(null, e);
39232        closeArray();
39233      };
39234      if (element.hasJurisdiction()) {
39235        openArray("jurisdiction");
39236        for (CodeableConcept e : element.getJurisdiction()) 
39237          composeCodeableConcept(null, e);
39238        closeArray();
39239      };
39240      if (element.hasPurposeElement()) {
39241        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39242        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39243      }
39244      if (element.hasUsageElement()) {
39245        composeMarkdownCore("usage", element.getUsageElement(), false);
39246        composeMarkdownExtras("usage", element.getUsageElement(), false);
39247      }
39248      if (element.hasCopyrightElement()) {
39249        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39250        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39251      }
39252      if (element.hasCopyrightLabelElement()) {
39253        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
39254        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
39255      }
39256      if (element.hasApprovalDateElement()) {
39257        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39258        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39259      }
39260      if (element.hasLastReviewDateElement()) {
39261        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39262        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39263      }
39264      if (element.hasEffectivePeriod()) {
39265        composePeriod("effectivePeriod", element.getEffectivePeriod());
39266      }
39267      if (element.hasTopic()) {
39268        openArray("topic");
39269        for (CodeableConcept e : element.getTopic()) 
39270          composeCodeableConcept(null, e);
39271        closeArray();
39272      };
39273      if (element.hasAuthor()) {
39274        openArray("author");
39275        for (ContactDetail e : element.getAuthor()) 
39276          composeContactDetail(null, e);
39277        closeArray();
39278      };
39279      if (element.hasEditor()) {
39280        openArray("editor");
39281        for (ContactDetail e : element.getEditor()) 
39282          composeContactDetail(null, e);
39283        closeArray();
39284      };
39285      if (element.hasReviewer()) {
39286        openArray("reviewer");
39287        for (ContactDetail e : element.getReviewer()) 
39288          composeContactDetail(null, e);
39289        closeArray();
39290      };
39291      if (element.hasEndorser()) {
39292        openArray("endorser");
39293        for (ContactDetail e : element.getEndorser()) 
39294          composeContactDetail(null, e);
39295        closeArray();
39296      };
39297      if (element.hasRelatedArtifact()) {
39298        openArray("relatedArtifact");
39299        for (RelatedArtifact e : element.getRelatedArtifact()) 
39300          composeRelatedArtifact(null, e);
39301        closeArray();
39302      };
39303      if (element.hasLibrary()) {
39304        if (anyHasValue(element.getLibrary())) {
39305          openArray("library");
39306          for (CanonicalType e : element.getLibrary()) 
39307            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
39308          closeArray();
39309        }
39310        if (anyHasExtras(element.getLibrary())) {
39311          openArray("_library");
39312          for (CanonicalType e : element.getLibrary()) 
39313            composeCanonicalExtras(null, e, true);
39314          closeArray();
39315        }
39316      };
39317      if (element.hasKindElement()) {
39318        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypesEnumFactory(), false);
39319        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypesEnumFactory(), false);
39320      }
39321      if (element.hasProfileElement()) {
39322        composeCanonicalCore("profile", element.getProfileElement(), false);
39323        composeCanonicalExtras("profile", element.getProfileElement(), false);
39324      }
39325      if (element.hasCode()) {
39326        composeCodeableConcept("code", element.getCode());
39327      }
39328      if (element.hasIntentElement()) {
39329        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
39330        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
39331      }
39332      if (element.hasPriorityElement()) {
39333        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
39334        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
39335      }
39336      if (element.hasDoNotPerformElement()) {
39337        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
39338        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
39339      }
39340      if (element.hasTiming()) {
39341        composeType("timing", element.getTiming());
39342      }
39343      if (element.hasAsNeeded()) {
39344        composeType("asNeeded", element.getAsNeeded());
39345      }
39346      if (element.hasLocation()) {
39347        composeCodeableReference("location", element.getLocation());
39348      }
39349      if (element.hasParticipant()) {
39350        openArray("participant");
39351        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
39352          composeActivityDefinitionParticipantComponent(null, e);
39353        closeArray();
39354      };
39355      if (element.hasProduct()) {
39356        composeType("product", element.getProduct());
39357      }
39358      if (element.hasQuantity()) {
39359        composeQuantity("quantity", element.getQuantity());
39360      }
39361      if (element.hasDosage()) {
39362        openArray("dosage");
39363        for (Dosage e : element.getDosage()) 
39364          composeDosage(null, e);
39365        closeArray();
39366      };
39367      if (element.hasBodySite()) {
39368        openArray("bodySite");
39369        for (CodeableConcept e : element.getBodySite()) 
39370          composeCodeableConcept(null, e);
39371        closeArray();
39372      };
39373      if (element.hasSpecimenRequirement()) {
39374        if (anyHasValue(element.getSpecimenRequirement())) {
39375          openArray("specimenRequirement");
39376          for (CanonicalType e : element.getSpecimenRequirement()) 
39377            composeCanonicalCore(null, e, e != element.getSpecimenRequirement().get(element.getSpecimenRequirement().size()-1));
39378          closeArray();
39379        }
39380        if (anyHasExtras(element.getSpecimenRequirement())) {
39381          openArray("_specimenRequirement");
39382          for (CanonicalType e : element.getSpecimenRequirement()) 
39383            composeCanonicalExtras(null, e, true);
39384          closeArray();
39385        }
39386      };
39387      if (element.hasObservationRequirement()) {
39388        if (anyHasValue(element.getObservationRequirement())) {
39389          openArray("observationRequirement");
39390          for (CanonicalType e : element.getObservationRequirement()) 
39391            composeCanonicalCore(null, e, e != element.getObservationRequirement().get(element.getObservationRequirement().size()-1));
39392          closeArray();
39393        }
39394        if (anyHasExtras(element.getObservationRequirement())) {
39395          openArray("_observationRequirement");
39396          for (CanonicalType e : element.getObservationRequirement()) 
39397            composeCanonicalExtras(null, e, true);
39398          closeArray();
39399        }
39400      };
39401      if (element.hasObservationResultRequirement()) {
39402        if (anyHasValue(element.getObservationResultRequirement())) {
39403          openArray("observationResultRequirement");
39404          for (CanonicalType e : element.getObservationResultRequirement()) 
39405            composeCanonicalCore(null, e, e != element.getObservationResultRequirement().get(element.getObservationResultRequirement().size()-1));
39406          closeArray();
39407        }
39408        if (anyHasExtras(element.getObservationResultRequirement())) {
39409          openArray("_observationResultRequirement");
39410          for (CanonicalType e : element.getObservationResultRequirement()) 
39411            composeCanonicalExtras(null, e, true);
39412          closeArray();
39413        }
39414      };
39415      if (element.hasTransformElement()) {
39416        composeCanonicalCore("transform", element.getTransformElement(), false);
39417        composeCanonicalExtras("transform", element.getTransformElement(), false);
39418      }
39419      if (element.hasDynamicValue()) {
39420        openArray("dynamicValue");
39421        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
39422          composeActivityDefinitionDynamicValueComponent(null, e);
39423        closeArray();
39424      };
39425  }
39426
39427  protected void composeActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
39428    if (element != null) {
39429      open(name);
39430      composeActivityDefinitionParticipantComponentProperties(element);
39431      close();
39432    }
39433  }
39434
39435  protected void composeActivityDefinitionParticipantComponentProperties(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
39436    composeBackboneElementProperties(element);
39437      if (element.hasTypeElement()) {
39438        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
39439        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
39440      }
39441      if (element.hasTypeCanonicalElement()) {
39442        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
39443        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
39444      }
39445      if (element.hasTypeReference()) {
39446        composeReference("typeReference", element.getTypeReference());
39447      }
39448      if (element.hasRole()) {
39449        composeCodeableConcept("role", element.getRole());
39450      }
39451      if (element.hasFunction()) {
39452        composeCodeableConcept("function", element.getFunction());
39453      }
39454  }
39455
39456  protected void composeActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
39457    if (element != null) {
39458      open(name);
39459      composeActivityDefinitionDynamicValueComponentProperties(element);
39460      close();
39461    }
39462  }
39463
39464  protected void composeActivityDefinitionDynamicValueComponentProperties(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
39465    composeBackboneElementProperties(element);
39466      if (element.hasPathElement()) {
39467        composeStringCore("path", element.getPathElement(), false);
39468        composeStringExtras("path", element.getPathElement(), false);
39469      }
39470      if (element.hasExpression()) {
39471        composeExpression("expression", element.getExpression());
39472      }
39473  }
39474
39475  protected void composeActorDefinition(String name, ActorDefinition element) throws IOException {
39476    if (element != null) {
39477      prop("resourceType", name);
39478      composeActorDefinitionProperties(element);
39479    }
39480  }
39481
39482  protected void composeActorDefinitionProperties(ActorDefinition element) throws IOException {
39483    composeCanonicalResourceProperties(element);
39484      if (element.hasUrlElement()) {
39485        composeUriCore("url", element.getUrlElement(), false);
39486        composeUriExtras("url", element.getUrlElement(), false);
39487      }
39488      if (element.hasIdentifier()) {
39489        openArray("identifier");
39490        for (Identifier e : element.getIdentifier()) 
39491          composeIdentifier(null, e);
39492        closeArray();
39493      };
39494      if (element.hasVersionElement()) {
39495        composeStringCore("version", element.getVersionElement(), false);
39496        composeStringExtras("version", element.getVersionElement(), false);
39497      }
39498      if (element.hasVersionAlgorithm()) {
39499        composeType("versionAlgorithm", element.getVersionAlgorithm());
39500      }
39501      if (element.hasNameElement()) {
39502        composeStringCore("name", element.getNameElement(), false);
39503        composeStringExtras("name", element.getNameElement(), false);
39504      }
39505      if (element.hasTitleElement()) {
39506        composeStringCore("title", element.getTitleElement(), false);
39507        composeStringExtras("title", element.getTitleElement(), false);
39508      }
39509      if (element.hasStatusElement()) {
39510        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39511        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39512      }
39513      if (element.hasExperimentalElement()) {
39514        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39515        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39516      }
39517      if (element.hasDateElement()) {
39518        composeDateTimeCore("date", element.getDateElement(), false);
39519        composeDateTimeExtras("date", element.getDateElement(), false);
39520      }
39521      if (element.hasPublisherElement()) {
39522        composeStringCore("publisher", element.getPublisherElement(), false);
39523        composeStringExtras("publisher", element.getPublisherElement(), false);
39524      }
39525      if (element.hasContact()) {
39526        openArray("contact");
39527        for (ContactDetail e : element.getContact()) 
39528          composeContactDetail(null, e);
39529        closeArray();
39530      };
39531      if (element.hasDescriptionElement()) {
39532        composeMarkdownCore("description", element.getDescriptionElement(), false);
39533        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39534      }
39535      if (element.hasUseContext()) {
39536        openArray("useContext");
39537        for (UsageContext e : element.getUseContext()) 
39538          composeUsageContext(null, e);
39539        closeArray();
39540      };
39541      if (element.hasJurisdiction()) {
39542        openArray("jurisdiction");
39543        for (CodeableConcept e : element.getJurisdiction()) 
39544          composeCodeableConcept(null, e);
39545        closeArray();
39546      };
39547      if (element.hasPurposeElement()) {
39548        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39549        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39550      }
39551      if (element.hasCopyrightElement()) {
39552        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39553        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39554      }
39555      if (element.hasCopyrightLabelElement()) {
39556        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
39557        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
39558      }
39559      if (element.hasTypeElement()) {
39560        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
39561        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
39562      }
39563      if (element.hasDocumentationElement()) {
39564        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
39565        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
39566      }
39567      if (element.hasReference()) {
39568        if (anyHasValue(element.getReference())) {
39569          openArray("reference");
39570          for (UrlType e : element.getReference()) 
39571            composeUrlCore(null, e, e != element.getReference().get(element.getReference().size()-1));
39572          closeArray();
39573        }
39574        if (anyHasExtras(element.getReference())) {
39575          openArray("_reference");
39576          for (UrlType e : element.getReference()) 
39577            composeUrlExtras(null, e, true);
39578          closeArray();
39579        }
39580      };
39581      if (element.hasCapabilitiesElement()) {
39582        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
39583        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
39584      }
39585      if (element.hasDerivedFrom()) {
39586        if (anyHasValue(element.getDerivedFrom())) {
39587          openArray("derivedFrom");
39588          for (CanonicalType e : element.getDerivedFrom()) 
39589            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
39590          closeArray();
39591        }
39592        if (anyHasExtras(element.getDerivedFrom())) {
39593          openArray("_derivedFrom");
39594          for (CanonicalType e : element.getDerivedFrom()) 
39595            composeCanonicalExtras(null, e, true);
39596          closeArray();
39597        }
39598      };
39599  }
39600
39601  protected void composeAdministrableProductDefinition(String name, AdministrableProductDefinition element) throws IOException {
39602    if (element != null) {
39603      prop("resourceType", name);
39604      composeAdministrableProductDefinitionProperties(element);
39605    }
39606  }
39607
39608  protected void composeAdministrableProductDefinitionProperties(AdministrableProductDefinition element) throws IOException {
39609    composeDomainResourceProperties(element);
39610      if (element.hasIdentifier()) {
39611        openArray("identifier");
39612        for (Identifier e : element.getIdentifier()) 
39613          composeIdentifier(null, e);
39614        closeArray();
39615      };
39616      if (element.hasStatusElement()) {
39617        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39618        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39619      }
39620      if (element.hasFormOf()) {
39621        openArray("formOf");
39622        for (Reference e : element.getFormOf()) 
39623          composeReference(null, e);
39624        closeArray();
39625      };
39626      if (element.hasAdministrableDoseForm()) {
39627        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
39628      }
39629      if (element.hasUnitOfPresentation()) {
39630        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
39631      }
39632      if (element.hasProducedFrom()) {
39633        openArray("producedFrom");
39634        for (Reference e : element.getProducedFrom()) 
39635          composeReference(null, e);
39636        closeArray();
39637      };
39638      if (element.hasIngredient()) {
39639        openArray("ingredient");
39640        for (CodeableConcept e : element.getIngredient()) 
39641          composeCodeableConcept(null, e);
39642        closeArray();
39643      };
39644      if (element.hasDevice()) {
39645        composeReference("device", element.getDevice());
39646      }
39647      if (element.hasDescriptionElement()) {
39648        composeMarkdownCore("description", element.getDescriptionElement(), false);
39649        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39650      }
39651      if (element.hasProperty()) {
39652        openArray("property");
39653        for (AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent e : element.getProperty()) 
39654          composeAdministrableProductDefinitionPropertyComponent(null, e);
39655        closeArray();
39656      };
39657      if (element.hasRouteOfAdministration()) {
39658        openArray("routeOfAdministration");
39659        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
39660          composeAdministrableProductDefinitionRouteOfAdministrationComponent(null, e);
39661        closeArray();
39662      };
39663  }
39664
39665  protected void composeAdministrableProductDefinitionPropertyComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
39666    if (element != null) {
39667      open(name);
39668      composeAdministrableProductDefinitionPropertyComponentProperties(element);
39669      close();
39670    }
39671  }
39672
39673  protected void composeAdministrableProductDefinitionPropertyComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
39674    composeBackboneElementProperties(element);
39675      if (element.hasType()) {
39676        composeCodeableConcept("type", element.getType());
39677      }
39678      if (element.hasValue()) {
39679        composeType("value", element.getValue());
39680      }
39681      if (element.hasStatus()) {
39682        composeCodeableConcept("status", element.getStatus());
39683      }
39684  }
39685
39686  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
39687    if (element != null) {
39688      open(name);
39689      composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(element);
39690      close();
39691    }
39692  }
39693
39694  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
39695    composeBackboneElementProperties(element);
39696      if (element.hasCode()) {
39697        composeCodeableConcept("code", element.getCode());
39698      }
39699      if (element.hasFirstDose()) {
39700        composeQuantity("firstDose", element.getFirstDose());
39701      }
39702      if (element.hasMaxSingleDose()) {
39703        composeQuantity("maxSingleDose", element.getMaxSingleDose());
39704      }
39705      if (element.hasMaxDosePerDay()) {
39706        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
39707      }
39708      if (element.hasMaxDosePerTreatmentPeriod()) {
39709        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
39710      }
39711      if (element.hasMaxTreatmentPeriod()) {
39712        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
39713      }
39714      if (element.hasTargetSpecies()) {
39715        openArray("targetSpecies");
39716        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
39717          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(null, e);
39718        closeArray();
39719      };
39720  }
39721
39722  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
39723    if (element != null) {
39724      open(name);
39725      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(element);
39726      close();
39727    }
39728  }
39729
39730  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
39731    composeBackboneElementProperties(element);
39732      if (element.hasCode()) {
39733        composeCodeableConcept("code", element.getCode());
39734      }
39735      if (element.hasWithdrawalPeriod()) {
39736        openArray("withdrawalPeriod");
39737        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
39738          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
39739        closeArray();
39740      };
39741  }
39742
39743  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
39744    if (element != null) {
39745      open(name);
39746      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(element);
39747      close();
39748    }
39749  }
39750
39751  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
39752    composeBackboneElementProperties(element);
39753      if (element.hasTissue()) {
39754        composeCodeableConcept("tissue", element.getTissue());
39755      }
39756      if (element.hasValue()) {
39757        composeQuantity("value", element.getValue());
39758      }
39759      if (element.hasSupportingInformationElement()) {
39760        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
39761        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
39762      }
39763  }
39764
39765  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
39766    if (element != null) {
39767      prop("resourceType", name);
39768      composeAdverseEventProperties(element);
39769    }
39770  }
39771
39772  protected void composeAdverseEventProperties(AdverseEvent element) throws IOException {
39773    composeDomainResourceProperties(element);
39774      if (element.hasIdentifier()) {
39775        openArray("identifier");
39776        for (Identifier e : element.getIdentifier()) 
39777          composeIdentifier(null, e);
39778        closeArray();
39779      };
39780      if (element.hasStatusElement()) {
39781        composeEnumerationCore("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
39782        composeEnumerationExtras("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
39783      }
39784      if (element.hasActualityElement()) {
39785        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
39786        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
39787      }
39788      if (element.hasCategory()) {
39789        openArray("category");
39790        for (CodeableConcept e : element.getCategory()) 
39791          composeCodeableConcept(null, e);
39792        closeArray();
39793      };
39794      if (element.hasCode()) {
39795        composeCodeableConcept("code", element.getCode());
39796      }
39797      if (element.hasSubject()) {
39798        composeReference("subject", element.getSubject());
39799      }
39800      if (element.hasEncounter()) {
39801        composeReference("encounter", element.getEncounter());
39802      }
39803      if (element.hasOccurrence()) {
39804        composeType("occurrence", element.getOccurrence());
39805      }
39806      if (element.hasDetectedElement()) {
39807        composeDateTimeCore("detected", element.getDetectedElement(), false);
39808        composeDateTimeExtras("detected", element.getDetectedElement(), false);
39809      }
39810      if (element.hasRecordedDateElement()) {
39811        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
39812        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
39813      }
39814      if (element.hasResultingEffect()) {
39815        openArray("resultingEffect");
39816        for (Reference e : element.getResultingEffect()) 
39817          composeReference(null, e);
39818        closeArray();
39819      };
39820      if (element.hasLocation()) {
39821        composeReference("location", element.getLocation());
39822      }
39823      if (element.hasSeriousness()) {
39824        composeCodeableConcept("seriousness", element.getSeriousness());
39825      }
39826      if (element.hasOutcome()) {
39827        openArray("outcome");
39828        for (CodeableConcept e : element.getOutcome()) 
39829          composeCodeableConcept(null, e);
39830        closeArray();
39831      };
39832      if (element.hasRecorder()) {
39833        composeReference("recorder", element.getRecorder());
39834      }
39835      if (element.hasParticipant()) {
39836        openArray("participant");
39837        for (AdverseEvent.AdverseEventParticipantComponent e : element.getParticipant()) 
39838          composeAdverseEventParticipantComponent(null, e);
39839        closeArray();
39840      };
39841      if (element.hasStudy()) {
39842        openArray("study");
39843        for (Reference e : element.getStudy()) 
39844          composeReference(null, e);
39845        closeArray();
39846      };
39847      if (element.hasExpectedInResearchStudyElement()) {
39848        composeBooleanCore("expectedInResearchStudy", element.getExpectedInResearchStudyElement(), false);
39849        composeBooleanExtras("expectedInResearchStudy", element.getExpectedInResearchStudyElement(), false);
39850      }
39851      if (element.hasSuspectEntity()) {
39852        openArray("suspectEntity");
39853        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
39854          composeAdverseEventSuspectEntityComponent(null, e);
39855        closeArray();
39856      };
39857      if (element.hasContributingFactor()) {
39858        openArray("contributingFactor");
39859        for (AdverseEvent.AdverseEventContributingFactorComponent e : element.getContributingFactor()) 
39860          composeAdverseEventContributingFactorComponent(null, e);
39861        closeArray();
39862      };
39863      if (element.hasPreventiveAction()) {
39864        openArray("preventiveAction");
39865        for (AdverseEvent.AdverseEventPreventiveActionComponent e : element.getPreventiveAction()) 
39866          composeAdverseEventPreventiveActionComponent(null, e);
39867        closeArray();
39868      };
39869      if (element.hasMitigatingAction()) {
39870        openArray("mitigatingAction");
39871        for (AdverseEvent.AdverseEventMitigatingActionComponent e : element.getMitigatingAction()) 
39872          composeAdverseEventMitigatingActionComponent(null, e);
39873        closeArray();
39874      };
39875      if (element.hasSupportingInfo()) {
39876        openArray("supportingInfo");
39877        for (AdverseEvent.AdverseEventSupportingInfoComponent e : element.getSupportingInfo()) 
39878          composeAdverseEventSupportingInfoComponent(null, e);
39879        closeArray();
39880      };
39881      if (element.hasNote()) {
39882        openArray("note");
39883        for (Annotation e : element.getNote()) 
39884          composeAnnotation(null, e);
39885        closeArray();
39886      };
39887  }
39888
39889  protected void composeAdverseEventParticipantComponent(String name, AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
39890    if (element != null) {
39891      open(name);
39892      composeAdverseEventParticipantComponentProperties(element);
39893      close();
39894    }
39895  }
39896
39897  protected void composeAdverseEventParticipantComponentProperties(AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
39898    composeBackboneElementProperties(element);
39899      if (element.hasFunction()) {
39900        composeCodeableConcept("function", element.getFunction());
39901      }
39902      if (element.hasActor()) {
39903        composeReference("actor", element.getActor());
39904      }
39905  }
39906
39907  protected void composeAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
39908    if (element != null) {
39909      open(name);
39910      composeAdverseEventSuspectEntityComponentProperties(element);
39911      close();
39912    }
39913  }
39914
39915  protected void composeAdverseEventSuspectEntityComponentProperties(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
39916    composeBackboneElementProperties(element);
39917      if (element.hasInstance()) {
39918        composeType("instance", element.getInstance());
39919      }
39920      if (element.hasCausality()) {
39921        composeAdverseEventSuspectEntityCausalityComponent("causality", element.getCausality());
39922      }
39923  }
39924
39925  protected void composeAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
39926    if (element != null) {
39927      open(name);
39928      composeAdverseEventSuspectEntityCausalityComponentProperties(element);
39929      close();
39930    }
39931  }
39932
39933  protected void composeAdverseEventSuspectEntityCausalityComponentProperties(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
39934    composeBackboneElementProperties(element);
39935      if (element.hasAssessmentMethod()) {
39936        composeCodeableConcept("assessmentMethod", element.getAssessmentMethod());
39937      }
39938      if (element.hasEntityRelatedness()) {
39939        composeCodeableConcept("entityRelatedness", element.getEntityRelatedness());
39940      }
39941      if (element.hasAuthor()) {
39942        composeReference("author", element.getAuthor());
39943      }
39944  }
39945
39946  protected void composeAdverseEventContributingFactorComponent(String name, AdverseEvent.AdverseEventContributingFactorComponent element) throws IOException {
39947    if (element != null) {
39948      open(name);
39949      composeAdverseEventContributingFactorComponentProperties(element);
39950      close();
39951    }
39952  }
39953
39954  protected void composeAdverseEventContributingFactorComponentProperties(AdverseEvent.AdverseEventContributingFactorComponent element) throws IOException {
39955    composeBackboneElementProperties(element);
39956      if (element.hasItem()) {
39957        composeType("item", element.getItem());
39958      }
39959  }
39960
39961  protected void composeAdverseEventPreventiveActionComponent(String name, AdverseEvent.AdverseEventPreventiveActionComponent element) throws IOException {
39962    if (element != null) {
39963      open(name);
39964      composeAdverseEventPreventiveActionComponentProperties(element);
39965      close();
39966    }
39967  }
39968
39969  protected void composeAdverseEventPreventiveActionComponentProperties(AdverseEvent.AdverseEventPreventiveActionComponent element) throws IOException {
39970    composeBackboneElementProperties(element);
39971      if (element.hasItem()) {
39972        composeType("item", element.getItem());
39973      }
39974  }
39975
39976  protected void composeAdverseEventMitigatingActionComponent(String name, AdverseEvent.AdverseEventMitigatingActionComponent element) throws IOException {
39977    if (element != null) {
39978      open(name);
39979      composeAdverseEventMitigatingActionComponentProperties(element);
39980      close();
39981    }
39982  }
39983
39984  protected void composeAdverseEventMitigatingActionComponentProperties(AdverseEvent.AdverseEventMitigatingActionComponent element) throws IOException {
39985    composeBackboneElementProperties(element);
39986      if (element.hasItem()) {
39987        composeType("item", element.getItem());
39988      }
39989  }
39990
39991  protected void composeAdverseEventSupportingInfoComponent(String name, AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
39992    if (element != null) {
39993      open(name);
39994      composeAdverseEventSupportingInfoComponentProperties(element);
39995      close();
39996    }
39997  }
39998
39999  protected void composeAdverseEventSupportingInfoComponentProperties(AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
40000    composeBackboneElementProperties(element);
40001      if (element.hasItem()) {
40002        composeType("item", element.getItem());
40003      }
40004  }
40005
40006  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
40007    if (element != null) {
40008      prop("resourceType", name);
40009      composeAllergyIntoleranceProperties(element);
40010    }
40011  }
40012
40013  protected void composeAllergyIntoleranceProperties(AllergyIntolerance element) throws IOException {
40014    composeDomainResourceProperties(element);
40015      if (element.hasIdentifier()) {
40016        openArray("identifier");
40017        for (Identifier e : element.getIdentifier()) 
40018          composeIdentifier(null, e);
40019        closeArray();
40020      };
40021      if (element.hasClinicalStatus()) {
40022        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
40023      }
40024      if (element.hasVerificationStatus()) {
40025        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
40026      }
40027      if (element.hasType()) {
40028        composeCodeableConcept("type", element.getType());
40029      }
40030      if (element.hasCategory()) {
40031        openArray("category");
40032        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
40033          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
40034        closeArray();
40035        if (anyHasExtras(element.getCategory())) {
40036          openArray("_category");
40037          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
40038            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
40039          closeArray();
40040        }
40041      };
40042      if (element.hasCriticalityElement()) {
40043        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
40044        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
40045      }
40046      if (element.hasCode()) {
40047        composeCodeableConcept("code", element.getCode());
40048      }
40049      if (element.hasPatient()) {
40050        composeReference("patient", element.getPatient());
40051      }
40052      if (element.hasEncounter()) {
40053        composeReference("encounter", element.getEncounter());
40054      }
40055      if (element.hasOnset()) {
40056        composeType("onset", element.getOnset());
40057      }
40058      if (element.hasRecordedDateElement()) {
40059        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
40060        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
40061      }
40062      if (element.hasParticipant()) {
40063        openArray("participant");
40064        for (AllergyIntolerance.AllergyIntoleranceParticipantComponent e : element.getParticipant()) 
40065          composeAllergyIntoleranceParticipantComponent(null, e);
40066        closeArray();
40067      };
40068      if (element.hasLastOccurrenceElement()) {
40069        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
40070        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
40071      }
40072      if (element.hasNote()) {
40073        openArray("note");
40074        for (Annotation e : element.getNote()) 
40075          composeAnnotation(null, e);
40076        closeArray();
40077      };
40078      if (element.hasReaction()) {
40079        openArray("reaction");
40080        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
40081          composeAllergyIntoleranceReactionComponent(null, e);
40082        closeArray();
40083      };
40084  }
40085
40086  protected void composeAllergyIntoleranceParticipantComponent(String name, AllergyIntolerance.AllergyIntoleranceParticipantComponent element) throws IOException {
40087    if (element != null) {
40088      open(name);
40089      composeAllergyIntoleranceParticipantComponentProperties(element);
40090      close();
40091    }
40092  }
40093
40094  protected void composeAllergyIntoleranceParticipantComponentProperties(AllergyIntolerance.AllergyIntoleranceParticipantComponent element) throws IOException {
40095    composeBackboneElementProperties(element);
40096      if (element.hasFunction()) {
40097        composeCodeableConcept("function", element.getFunction());
40098      }
40099      if (element.hasActor()) {
40100        composeReference("actor", element.getActor());
40101      }
40102  }
40103
40104  protected void composeAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
40105    if (element != null) {
40106      open(name);
40107      composeAllergyIntoleranceReactionComponentProperties(element);
40108      close();
40109    }
40110  }
40111
40112  protected void composeAllergyIntoleranceReactionComponentProperties(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
40113    composeBackboneElementProperties(element);
40114      if (element.hasSubstance()) {
40115        composeCodeableConcept("substance", element.getSubstance());
40116      }
40117      if (element.hasManifestation()) {
40118        openArray("manifestation");
40119        for (CodeableReference e : element.getManifestation()) 
40120          composeCodeableReference(null, e);
40121        closeArray();
40122      };
40123      if (element.hasDescriptionElement()) {
40124        composeStringCore("description", element.getDescriptionElement(), false);
40125        composeStringExtras("description", element.getDescriptionElement(), false);
40126      }
40127      if (element.hasOnsetElement()) {
40128        composeDateTimeCore("onset", element.getOnsetElement(), false);
40129        composeDateTimeExtras("onset", element.getOnsetElement(), false);
40130      }
40131      if (element.hasSeverityElement()) {
40132        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
40133        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
40134      }
40135      if (element.hasExposureRoute()) {
40136        composeCodeableConcept("exposureRoute", element.getExposureRoute());
40137      }
40138      if (element.hasNote()) {
40139        openArray("note");
40140        for (Annotation e : element.getNote()) 
40141          composeAnnotation(null, e);
40142        closeArray();
40143      };
40144  }
40145
40146  protected void composeAppointment(String name, Appointment element) throws IOException {
40147    if (element != null) {
40148      prop("resourceType", name);
40149      composeAppointmentProperties(element);
40150    }
40151  }
40152
40153  protected void composeAppointmentProperties(Appointment element) throws IOException {
40154    composeDomainResourceProperties(element);
40155      if (element.hasIdentifier()) {
40156        openArray("identifier");
40157        for (Identifier e : element.getIdentifier()) 
40158          composeIdentifier(null, e);
40159        closeArray();
40160      };
40161      if (element.hasStatusElement()) {
40162        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
40163        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
40164      }
40165      if (element.hasCancellationReason()) {
40166        composeCodeableConcept("cancellationReason", element.getCancellationReason());
40167      }
40168      if (element.hasClass_()) {
40169        openArray("class");
40170        for (CodeableConcept e : element.getClass_()) 
40171          composeCodeableConcept(null, e);
40172        closeArray();
40173      };
40174      if (element.hasServiceCategory()) {
40175        openArray("serviceCategory");
40176        for (CodeableConcept e : element.getServiceCategory()) 
40177          composeCodeableConcept(null, e);
40178        closeArray();
40179      };
40180      if (element.hasServiceType()) {
40181        openArray("serviceType");
40182        for (CodeableReference e : element.getServiceType()) 
40183          composeCodeableReference(null, e);
40184        closeArray();
40185      };
40186      if (element.hasSpecialty()) {
40187        openArray("specialty");
40188        for (CodeableConcept e : element.getSpecialty()) 
40189          composeCodeableConcept(null, e);
40190        closeArray();
40191      };
40192      if (element.hasAppointmentType()) {
40193        composeCodeableConcept("appointmentType", element.getAppointmentType());
40194      }
40195      if (element.hasReason()) {
40196        openArray("reason");
40197        for (CodeableReference e : element.getReason()) 
40198          composeCodeableReference(null, e);
40199        closeArray();
40200      };
40201      if (element.hasPriority()) {
40202        composeCodeableConcept("priority", element.getPriority());
40203      }
40204      if (element.hasDescriptionElement()) {
40205        composeStringCore("description", element.getDescriptionElement(), false);
40206        composeStringExtras("description", element.getDescriptionElement(), false);
40207      }
40208      if (element.hasReplaces()) {
40209        openArray("replaces");
40210        for (Reference e : element.getReplaces()) 
40211          composeReference(null, e);
40212        closeArray();
40213      };
40214      if (element.hasVirtualService()) {
40215        openArray("virtualService");
40216        for (VirtualServiceDetail e : element.getVirtualService()) 
40217          composeVirtualServiceDetail(null, e);
40218        closeArray();
40219      };
40220      if (element.hasSupportingInformation()) {
40221        openArray("supportingInformation");
40222        for (Reference e : element.getSupportingInformation()) 
40223          composeReference(null, e);
40224        closeArray();
40225      };
40226      if (element.hasPreviousAppointment()) {
40227        composeReference("previousAppointment", element.getPreviousAppointment());
40228      }
40229      if (element.hasOriginatingAppointment()) {
40230        composeReference("originatingAppointment", element.getOriginatingAppointment());
40231      }
40232      if (element.hasStartElement()) {
40233        composeInstantCore("start", element.getStartElement(), false);
40234        composeInstantExtras("start", element.getStartElement(), false);
40235      }
40236      if (element.hasEndElement()) {
40237        composeInstantCore("end", element.getEndElement(), false);
40238        composeInstantExtras("end", element.getEndElement(), false);
40239      }
40240      if (element.hasMinutesDurationElement()) {
40241        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
40242        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
40243      }
40244      if (element.hasRequestedPeriod()) {
40245        openArray("requestedPeriod");
40246        for (Period e : element.getRequestedPeriod()) 
40247          composePeriod(null, e);
40248        closeArray();
40249      };
40250      if (element.hasSlot()) {
40251        openArray("slot");
40252        for (Reference e : element.getSlot()) 
40253          composeReference(null, e);
40254        closeArray();
40255      };
40256      if (element.hasAccount()) {
40257        openArray("account");
40258        for (Reference e : element.getAccount()) 
40259          composeReference(null, e);
40260        closeArray();
40261      };
40262      if (element.hasCreatedElement()) {
40263        composeDateTimeCore("created", element.getCreatedElement(), false);
40264        composeDateTimeExtras("created", element.getCreatedElement(), false);
40265      }
40266      if (element.hasCancellationDateElement()) {
40267        composeDateTimeCore("cancellationDate", element.getCancellationDateElement(), false);
40268        composeDateTimeExtras("cancellationDate", element.getCancellationDateElement(), false);
40269      }
40270      if (element.hasNote()) {
40271        openArray("note");
40272        for (Annotation e : element.getNote()) 
40273          composeAnnotation(null, e);
40274        closeArray();
40275      };
40276      if (element.hasPatientInstruction()) {
40277        openArray("patientInstruction");
40278        for (CodeableReference e : element.getPatientInstruction()) 
40279          composeCodeableReference(null, e);
40280        closeArray();
40281      };
40282      if (element.hasBasedOn()) {
40283        openArray("basedOn");
40284        for (Reference e : element.getBasedOn()) 
40285          composeReference(null, e);
40286        closeArray();
40287      };
40288      if (element.hasSubject()) {
40289        composeReference("subject", element.getSubject());
40290      }
40291      if (element.hasParticipant()) {
40292        openArray("participant");
40293        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
40294          composeAppointmentParticipantComponent(null, e);
40295        closeArray();
40296      };
40297      if (element.hasRecurrenceIdElement()) {
40298        composePositiveIntCore("recurrenceId", element.getRecurrenceIdElement(), false);
40299        composePositiveIntExtras("recurrenceId", element.getRecurrenceIdElement(), false);
40300      }
40301      if (element.hasOccurrenceChangedElement()) {
40302        composeBooleanCore("occurrenceChanged", element.getOccurrenceChangedElement(), false);
40303        composeBooleanExtras("occurrenceChanged", element.getOccurrenceChangedElement(), false);
40304      }
40305      if (element.hasRecurrenceTemplate()) {
40306        openArray("recurrenceTemplate");
40307        for (Appointment.AppointmentRecurrenceTemplateComponent e : element.getRecurrenceTemplate()) 
40308          composeAppointmentRecurrenceTemplateComponent(null, e);
40309        closeArray();
40310      };
40311  }
40312
40313  protected void composeAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
40314    if (element != null) {
40315      open(name);
40316      composeAppointmentParticipantComponentProperties(element);
40317      close();
40318    }
40319  }
40320
40321  protected void composeAppointmentParticipantComponentProperties(Appointment.AppointmentParticipantComponent element) throws IOException {
40322    composeBackboneElementProperties(element);
40323      if (element.hasType()) {
40324        openArray("type");
40325        for (CodeableConcept e : element.getType()) 
40326          composeCodeableConcept(null, e);
40327        closeArray();
40328      };
40329      if (element.hasPeriod()) {
40330        composePeriod("period", element.getPeriod());
40331      }
40332      if (element.hasActor()) {
40333        composeReference("actor", element.getActor());
40334      }
40335      if (element.hasRequiredElement()) {
40336        composeBooleanCore("required", element.getRequiredElement(), false);
40337        composeBooleanExtras("required", element.getRequiredElement(), false);
40338      }
40339      if (element.hasStatusElement()) {
40340        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
40341        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
40342      }
40343  }
40344
40345  protected void composeAppointmentRecurrenceTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateComponent element) throws IOException {
40346    if (element != null) {
40347      open(name);
40348      composeAppointmentRecurrenceTemplateComponentProperties(element);
40349      close();
40350    }
40351  }
40352
40353  protected void composeAppointmentRecurrenceTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateComponent element) throws IOException {
40354    composeBackboneElementProperties(element);
40355      if (element.hasTimezone()) {
40356        composeCodeableConcept("timezone", element.getTimezone());
40357      }
40358      if (element.hasRecurrenceType()) {
40359        composeCodeableConcept("recurrenceType", element.getRecurrenceType());
40360      }
40361      if (element.hasLastOccurrenceDateElement()) {
40362        composeDateCore("lastOccurrenceDate", element.getLastOccurrenceDateElement(), false);
40363        composeDateExtras("lastOccurrenceDate", element.getLastOccurrenceDateElement(), false);
40364      }
40365      if (element.hasOccurrenceCountElement()) {
40366        composePositiveIntCore("occurrenceCount", element.getOccurrenceCountElement(), false);
40367        composePositiveIntExtras("occurrenceCount", element.getOccurrenceCountElement(), false);
40368      }
40369      if (element.hasOccurrenceDate()) {
40370        if (anyHasValue(element.getOccurrenceDate())) {
40371          openArray("occurrenceDate");
40372          for (DateType e : element.getOccurrenceDate()) 
40373            composeDateCore(null, e, e != element.getOccurrenceDate().get(element.getOccurrenceDate().size()-1));
40374          closeArray();
40375        }
40376        if (anyHasExtras(element.getOccurrenceDate())) {
40377          openArray("_occurrenceDate");
40378          for (DateType e : element.getOccurrenceDate()) 
40379            composeDateExtras(null, e, true);
40380          closeArray();
40381        }
40382      };
40383      if (element.hasWeeklyTemplate()) {
40384        composeAppointmentRecurrenceTemplateWeeklyTemplateComponent("weeklyTemplate", element.getWeeklyTemplate());
40385      }
40386      if (element.hasMonthlyTemplate()) {
40387        composeAppointmentRecurrenceTemplateMonthlyTemplateComponent("monthlyTemplate", element.getMonthlyTemplate());
40388      }
40389      if (element.hasYearlyTemplate()) {
40390        composeAppointmentRecurrenceTemplateYearlyTemplateComponent("yearlyTemplate", element.getYearlyTemplate());
40391      }
40392      if (element.hasExcludingDate()) {
40393        if (anyHasValue(element.getExcludingDate())) {
40394          openArray("excludingDate");
40395          for (DateType e : element.getExcludingDate()) 
40396            composeDateCore(null, e, e != element.getExcludingDate().get(element.getExcludingDate().size()-1));
40397          closeArray();
40398        }
40399        if (anyHasExtras(element.getExcludingDate())) {
40400          openArray("_excludingDate");
40401          for (DateType e : element.getExcludingDate()) 
40402            composeDateExtras(null, e, true);
40403          closeArray();
40404        }
40405      };
40406      if (element.hasExcludingRecurrenceId()) {
40407        if (anyHasValue(element.getExcludingRecurrenceId())) {
40408          openArray("excludingRecurrenceId");
40409          for (PositiveIntType e : element.getExcludingRecurrenceId()) 
40410            composePositiveIntCore(null, e, e != element.getExcludingRecurrenceId().get(element.getExcludingRecurrenceId().size()-1));
40411          closeArray();
40412        }
40413        if (anyHasExtras(element.getExcludingRecurrenceId())) {
40414          openArray("_excludingRecurrenceId");
40415          for (PositiveIntType e : element.getExcludingRecurrenceId()) 
40416            composePositiveIntExtras(null, e, true);
40417          closeArray();
40418        }
40419      };
40420  }
40421
40422  protected void composeAppointmentRecurrenceTemplateWeeklyTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent element) throws IOException {
40423    if (element != null) {
40424      open(name);
40425      composeAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(element);
40426      close();
40427    }
40428  }
40429
40430  protected void composeAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent element) throws IOException {
40431    composeBackboneElementProperties(element);
40432      if (element.hasMondayElement()) {
40433        composeBooleanCore("monday", element.getMondayElement(), false);
40434        composeBooleanExtras("monday", element.getMondayElement(), false);
40435      }
40436      if (element.hasTuesdayElement()) {
40437        composeBooleanCore("tuesday", element.getTuesdayElement(), false);
40438        composeBooleanExtras("tuesday", element.getTuesdayElement(), false);
40439      }
40440      if (element.hasWednesdayElement()) {
40441        composeBooleanCore("wednesday", element.getWednesdayElement(), false);
40442        composeBooleanExtras("wednesday", element.getWednesdayElement(), false);
40443      }
40444      if (element.hasThursdayElement()) {
40445        composeBooleanCore("thursday", element.getThursdayElement(), false);
40446        composeBooleanExtras("thursday", element.getThursdayElement(), false);
40447      }
40448      if (element.hasFridayElement()) {
40449        composeBooleanCore("friday", element.getFridayElement(), false);
40450        composeBooleanExtras("friday", element.getFridayElement(), false);
40451      }
40452      if (element.hasSaturdayElement()) {
40453        composeBooleanCore("saturday", element.getSaturdayElement(), false);
40454        composeBooleanExtras("saturday", element.getSaturdayElement(), false);
40455      }
40456      if (element.hasSundayElement()) {
40457        composeBooleanCore("sunday", element.getSundayElement(), false);
40458        composeBooleanExtras("sunday", element.getSundayElement(), false);
40459      }
40460      if (element.hasWeekIntervalElement()) {
40461        composePositiveIntCore("weekInterval", element.getWeekIntervalElement(), false);
40462        composePositiveIntExtras("weekInterval", element.getWeekIntervalElement(), false);
40463      }
40464  }
40465
40466  protected void composeAppointmentRecurrenceTemplateMonthlyTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent element) throws IOException {
40467    if (element != null) {
40468      open(name);
40469      composeAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(element);
40470      close();
40471    }
40472  }
40473
40474  protected void composeAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent element) throws IOException {
40475    composeBackboneElementProperties(element);
40476      if (element.hasDayOfMonthElement()) {
40477        composePositiveIntCore("dayOfMonth", element.getDayOfMonthElement(), false);
40478        composePositiveIntExtras("dayOfMonth", element.getDayOfMonthElement(), false);
40479      }
40480      if (element.hasNthWeekOfMonth()) {
40481        composeCoding("nthWeekOfMonth", element.getNthWeekOfMonth());
40482      }
40483      if (element.hasDayOfWeek()) {
40484        composeCoding("dayOfWeek", element.getDayOfWeek());
40485      }
40486      if (element.hasMonthIntervalElement()) {
40487        composePositiveIntCore("monthInterval", element.getMonthIntervalElement(), false);
40488        composePositiveIntExtras("monthInterval", element.getMonthIntervalElement(), false);
40489      }
40490  }
40491
40492  protected void composeAppointmentRecurrenceTemplateYearlyTemplateComponent(String name, Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent element) throws IOException {
40493    if (element != null) {
40494      open(name);
40495      composeAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(element);
40496      close();
40497    }
40498  }
40499
40500  protected void composeAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent element) throws IOException {
40501    composeBackboneElementProperties(element);
40502      if (element.hasYearIntervalElement()) {
40503        composePositiveIntCore("yearInterval", element.getYearIntervalElement(), false);
40504        composePositiveIntExtras("yearInterval", element.getYearIntervalElement(), false);
40505      }
40506  }
40507
40508  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
40509    if (element != null) {
40510      prop("resourceType", name);
40511      composeAppointmentResponseProperties(element);
40512    }
40513  }
40514
40515  protected void composeAppointmentResponseProperties(AppointmentResponse element) throws IOException {
40516    composeDomainResourceProperties(element);
40517      if (element.hasIdentifier()) {
40518        openArray("identifier");
40519        for (Identifier e : element.getIdentifier()) 
40520          composeIdentifier(null, e);
40521        closeArray();
40522      };
40523      if (element.hasAppointment()) {
40524        composeReference("appointment", element.getAppointment());
40525      }
40526      if (element.hasProposedNewTimeElement()) {
40527        composeBooleanCore("proposedNewTime", element.getProposedNewTimeElement(), false);
40528        composeBooleanExtras("proposedNewTime", element.getProposedNewTimeElement(), false);
40529      }
40530      if (element.hasStartElement()) {
40531        composeInstantCore("start", element.getStartElement(), false);
40532        composeInstantExtras("start", element.getStartElement(), false);
40533      }
40534      if (element.hasEndElement()) {
40535        composeInstantCore("end", element.getEndElement(), false);
40536        composeInstantExtras("end", element.getEndElement(), false);
40537      }
40538      if (element.hasParticipantType()) {
40539        openArray("participantType");
40540        for (CodeableConcept e : element.getParticipantType()) 
40541          composeCodeableConcept(null, e);
40542        closeArray();
40543      };
40544      if (element.hasActor()) {
40545        composeReference("actor", element.getActor());
40546      }
40547      if (element.hasParticipantStatusElement()) {
40548        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.AppointmentResponseStatusEnumFactory(), false);
40549        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.AppointmentResponseStatusEnumFactory(), false);
40550      }
40551      if (element.hasCommentElement()) {
40552        composeMarkdownCore("comment", element.getCommentElement(), false);
40553        composeMarkdownExtras("comment", element.getCommentElement(), false);
40554      }
40555      if (element.hasRecurringElement()) {
40556        composeBooleanCore("recurring", element.getRecurringElement(), false);
40557        composeBooleanExtras("recurring", element.getRecurringElement(), false);
40558      }
40559      if (element.hasOccurrenceDateElement()) {
40560        composeDateCore("occurrenceDate", element.getOccurrenceDateElement(), false);
40561        composeDateExtras("occurrenceDate", element.getOccurrenceDateElement(), false);
40562      }
40563      if (element.hasRecurrenceIdElement()) {
40564        composePositiveIntCore("recurrenceId", element.getRecurrenceIdElement(), false);
40565        composePositiveIntExtras("recurrenceId", element.getRecurrenceIdElement(), false);
40566      }
40567  }
40568
40569  protected void composeArtifactAssessment(String name, ArtifactAssessment element) throws IOException {
40570    if (element != null) {
40571      prop("resourceType", name);
40572      composeArtifactAssessmentProperties(element);
40573    }
40574  }
40575
40576  protected void composeArtifactAssessmentProperties(ArtifactAssessment element) throws IOException {
40577    composeDomainResourceProperties(element);
40578      if (element.hasIdentifier()) {
40579        openArray("identifier");
40580        for (Identifier e : element.getIdentifier()) 
40581          composeIdentifier(null, e);
40582        closeArray();
40583      };
40584      if (element.hasTitleElement()) {
40585        composeStringCore("title", element.getTitleElement(), false);
40586        composeStringExtras("title", element.getTitleElement(), false);
40587      }
40588      if (element.hasCiteAs()) {
40589        composeType("citeAs", element.getCiteAs());
40590      }
40591      if (element.hasDateElement()) {
40592        composeDateTimeCore("date", element.getDateElement(), false);
40593        composeDateTimeExtras("date", element.getDateElement(), false);
40594      }
40595      if (element.hasCopyrightElement()) {
40596        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40597        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40598      }
40599      if (element.hasApprovalDateElement()) {
40600        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40601        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40602      }
40603      if (element.hasLastReviewDateElement()) {
40604        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40605        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40606      }
40607      if (element.hasArtifact()) {
40608        composeType("artifact", element.getArtifact());
40609      }
40610      if (element.hasContent()) {
40611        openArray("content");
40612        for (ArtifactAssessment.ArtifactAssessmentContentComponent e : element.getContent()) 
40613          composeArtifactAssessmentContentComponent(null, e);
40614        closeArray();
40615      };
40616      if (element.hasWorkflowStatusElement()) {
40617        composeEnumerationCore("workflowStatus", element.getWorkflowStatusElement(), new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory(), false);
40618        composeEnumerationExtras("workflowStatus", element.getWorkflowStatusElement(), new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory(), false);
40619      }
40620      if (element.hasDispositionElement()) {
40621        composeEnumerationCore("disposition", element.getDispositionElement(), new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory(), false);
40622        composeEnumerationExtras("disposition", element.getDispositionElement(), new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory(), false);
40623      }
40624  }
40625
40626  protected void composeArtifactAssessmentContentComponent(String name, ArtifactAssessment.ArtifactAssessmentContentComponent element) throws IOException {
40627    if (element != null) {
40628      open(name);
40629      composeArtifactAssessmentContentComponentProperties(element);
40630      close();
40631    }
40632  }
40633
40634  protected void composeArtifactAssessmentContentComponentProperties(ArtifactAssessment.ArtifactAssessmentContentComponent element) throws IOException {
40635    composeBackboneElementProperties(element);
40636      if (element.hasInformationTypeElement()) {
40637        composeEnumerationCore("informationType", element.getInformationTypeElement(), new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory(), false);
40638        composeEnumerationExtras("informationType", element.getInformationTypeElement(), new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory(), false);
40639      }
40640      if (element.hasSummaryElement()) {
40641        composeMarkdownCore("summary", element.getSummaryElement(), false);
40642        composeMarkdownExtras("summary", element.getSummaryElement(), false);
40643      }
40644      if (element.hasType()) {
40645        composeCodeableConcept("type", element.getType());
40646      }
40647      if (element.hasClassifier()) {
40648        openArray("classifier");
40649        for (CodeableConcept e : element.getClassifier()) 
40650          composeCodeableConcept(null, e);
40651        closeArray();
40652      };
40653      if (element.hasQuantity()) {
40654        composeQuantity("quantity", element.getQuantity());
40655      }
40656      if (element.hasAuthor()) {
40657        composeReference("author", element.getAuthor());
40658      }
40659      if (element.hasPath()) {
40660        if (anyHasValue(element.getPath())) {
40661          openArray("path");
40662          for (UriType e : element.getPath()) 
40663            composeUriCore(null, e, e != element.getPath().get(element.getPath().size()-1));
40664          closeArray();
40665        }
40666        if (anyHasExtras(element.getPath())) {
40667          openArray("_path");
40668          for (UriType e : element.getPath()) 
40669            composeUriExtras(null, e, true);
40670          closeArray();
40671        }
40672      };
40673      if (element.hasRelatedArtifact()) {
40674        openArray("relatedArtifact");
40675        for (RelatedArtifact e : element.getRelatedArtifact()) 
40676          composeRelatedArtifact(null, e);
40677        closeArray();
40678      };
40679      if (element.hasFreeToShareElement()) {
40680        composeBooleanCore("freeToShare", element.getFreeToShareElement(), false);
40681        composeBooleanExtras("freeToShare", element.getFreeToShareElement(), false);
40682      }
40683      if (element.hasComponent()) {
40684        openArray("component");
40685        for (ArtifactAssessment.ArtifactAssessmentContentComponent e : element.getComponent()) 
40686          composeArtifactAssessmentContentComponent(null, e);
40687        closeArray();
40688      };
40689  }
40690
40691  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
40692    if (element != null) {
40693      prop("resourceType", name);
40694      composeAuditEventProperties(element);
40695    }
40696  }
40697
40698  protected void composeAuditEventProperties(AuditEvent element) throws IOException {
40699    composeDomainResourceProperties(element);
40700      if (element.hasCategory()) {
40701        openArray("category");
40702        for (CodeableConcept e : element.getCategory()) 
40703          composeCodeableConcept(null, e);
40704        closeArray();
40705      };
40706      if (element.hasCode()) {
40707        composeCodeableConcept("code", element.getCode());
40708      }
40709      if (element.hasActionElement()) {
40710        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
40711        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
40712      }
40713      if (element.hasSeverityElement()) {
40714        composeEnumerationCore("severity", element.getSeverityElement(), new AuditEvent.AuditEventSeverityEnumFactory(), false);
40715        composeEnumerationExtras("severity", element.getSeverityElement(), new AuditEvent.AuditEventSeverityEnumFactory(), false);
40716      }
40717      if (element.hasOccurred()) {
40718        composeType("occurred", element.getOccurred());
40719      }
40720      if (element.hasRecordedElement()) {
40721        composeInstantCore("recorded", element.getRecordedElement(), false);
40722        composeInstantExtras("recorded", element.getRecordedElement(), false);
40723      }
40724      if (element.hasOutcome()) {
40725        composeAuditEventOutcomeComponent("outcome", element.getOutcome());
40726      }
40727      if (element.hasAuthorization()) {
40728        openArray("authorization");
40729        for (CodeableConcept e : element.getAuthorization()) 
40730          composeCodeableConcept(null, e);
40731        closeArray();
40732      };
40733      if (element.hasBasedOn()) {
40734        openArray("basedOn");
40735        for (Reference e : element.getBasedOn()) 
40736          composeReference(null, e);
40737        closeArray();
40738      };
40739      if (element.hasPatient()) {
40740        composeReference("patient", element.getPatient());
40741      }
40742      if (element.hasEncounter()) {
40743        composeReference("encounter", element.getEncounter());
40744      }
40745      if (element.hasAgent()) {
40746        openArray("agent");
40747        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
40748          composeAuditEventAgentComponent(null, e);
40749        closeArray();
40750      };
40751      if (element.hasSource()) {
40752        composeAuditEventSourceComponent("source", element.getSource());
40753      }
40754      if (element.hasEntity()) {
40755        openArray("entity");
40756        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
40757          composeAuditEventEntityComponent(null, e);
40758        closeArray();
40759      };
40760  }
40761
40762  protected void composeAuditEventOutcomeComponent(String name, AuditEvent.AuditEventOutcomeComponent element) throws IOException {
40763    if (element != null) {
40764      open(name);
40765      composeAuditEventOutcomeComponentProperties(element);
40766      close();
40767    }
40768  }
40769
40770  protected void composeAuditEventOutcomeComponentProperties(AuditEvent.AuditEventOutcomeComponent element) throws IOException {
40771    composeBackboneElementProperties(element);
40772      if (element.hasCode()) {
40773        composeCoding("code", element.getCode());
40774      }
40775      if (element.hasDetail()) {
40776        openArray("detail");
40777        for (CodeableConcept e : element.getDetail()) 
40778          composeCodeableConcept(null, e);
40779        closeArray();
40780      };
40781  }
40782
40783  protected void composeAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
40784    if (element != null) {
40785      open(name);
40786      composeAuditEventAgentComponentProperties(element);
40787      close();
40788    }
40789  }
40790
40791  protected void composeAuditEventAgentComponentProperties(AuditEvent.AuditEventAgentComponent element) throws IOException {
40792    composeBackboneElementProperties(element);
40793      if (element.hasType()) {
40794        composeCodeableConcept("type", element.getType());
40795      }
40796      if (element.hasRole()) {
40797        openArray("role");
40798        for (CodeableConcept e : element.getRole()) 
40799          composeCodeableConcept(null, e);
40800        closeArray();
40801      };
40802      if (element.hasWho()) {
40803        composeReference("who", element.getWho());
40804      }
40805      if (element.hasRequestorElement()) {
40806        composeBooleanCore("requestor", element.getRequestorElement(), false);
40807        composeBooleanExtras("requestor", element.getRequestorElement(), false);
40808      }
40809      if (element.hasLocation()) {
40810        composeReference("location", element.getLocation());
40811      }
40812      if (element.hasPolicy()) {
40813        if (anyHasValue(element.getPolicy())) {
40814          openArray("policy");
40815          for (UriType e : element.getPolicy()) 
40816            composeUriCore(null, e, e != element.getPolicy().get(element.getPolicy().size()-1));
40817          closeArray();
40818        }
40819        if (anyHasExtras(element.getPolicy())) {
40820          openArray("_policy");
40821          for (UriType e : element.getPolicy()) 
40822            composeUriExtras(null, e, true);
40823          closeArray();
40824        }
40825      };
40826      if (element.hasNetwork()) {
40827        composeType("network", element.getNetwork());
40828      }
40829      if (element.hasAuthorization()) {
40830        openArray("authorization");
40831        for (CodeableConcept e : element.getAuthorization()) 
40832          composeCodeableConcept(null, e);
40833        closeArray();
40834      };
40835  }
40836
40837  protected void composeAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
40838    if (element != null) {
40839      open(name);
40840      composeAuditEventSourceComponentProperties(element);
40841      close();
40842    }
40843  }
40844
40845  protected void composeAuditEventSourceComponentProperties(AuditEvent.AuditEventSourceComponent element) throws IOException {
40846    composeBackboneElementProperties(element);
40847      if (element.hasSite()) {
40848        composeReference("site", element.getSite());
40849      }
40850      if (element.hasObserver()) {
40851        composeReference("observer", element.getObserver());
40852      }
40853      if (element.hasType()) {
40854        openArray("type");
40855        for (CodeableConcept e : element.getType()) 
40856          composeCodeableConcept(null, e);
40857        closeArray();
40858      };
40859  }
40860
40861  protected void composeAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
40862    if (element != null) {
40863      open(name);
40864      composeAuditEventEntityComponentProperties(element);
40865      close();
40866    }
40867  }
40868
40869  protected void composeAuditEventEntityComponentProperties(AuditEvent.AuditEventEntityComponent element) throws IOException {
40870    composeBackboneElementProperties(element);
40871      if (element.hasWhat()) {
40872        composeReference("what", element.getWhat());
40873      }
40874      if (element.hasRole()) {
40875        composeCodeableConcept("role", element.getRole());
40876      }
40877      if (element.hasSecurityLabel()) {
40878        openArray("securityLabel");
40879        for (CodeableConcept e : element.getSecurityLabel()) 
40880          composeCodeableConcept(null, e);
40881        closeArray();
40882      };
40883      if (element.hasQueryElement()) {
40884        composeBase64BinaryCore("query", element.getQueryElement(), false);
40885        composeBase64BinaryExtras("query", element.getQueryElement(), false);
40886      }
40887      if (element.hasDetail()) {
40888        openArray("detail");
40889        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
40890          composeAuditEventEntityDetailComponent(null, e);
40891        closeArray();
40892      };
40893      if (element.hasAgent()) {
40894        openArray("agent");
40895        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
40896          composeAuditEventAgentComponent(null, e);
40897        closeArray();
40898      };
40899  }
40900
40901  protected void composeAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
40902    if (element != null) {
40903      open(name);
40904      composeAuditEventEntityDetailComponentProperties(element);
40905      close();
40906    }
40907  }
40908
40909  protected void composeAuditEventEntityDetailComponentProperties(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
40910    composeBackboneElementProperties(element);
40911      if (element.hasType()) {
40912        composeCodeableConcept("type", element.getType());
40913      }
40914      if (element.hasValue()) {
40915        composeType("value", element.getValue());
40916      }
40917  }
40918
40919  protected void composeBasic(String name, Basic element) throws IOException {
40920    if (element != null) {
40921      prop("resourceType", name);
40922      composeBasicProperties(element);
40923    }
40924  }
40925
40926  protected void composeBasicProperties(Basic element) throws IOException {
40927    composeDomainResourceProperties(element);
40928      if (element.hasIdentifier()) {
40929        openArray("identifier");
40930        for (Identifier e : element.getIdentifier()) 
40931          composeIdentifier(null, e);
40932        closeArray();
40933      };
40934      if (element.hasCode()) {
40935        composeCodeableConcept("code", element.getCode());
40936      }
40937      if (element.hasSubject()) {
40938        composeReference("subject", element.getSubject());
40939      }
40940      if (element.hasCreatedElement()) {
40941        composeDateTimeCore("created", element.getCreatedElement(), false);
40942        composeDateTimeExtras("created", element.getCreatedElement(), false);
40943      }
40944      if (element.hasAuthor()) {
40945        composeReference("author", element.getAuthor());
40946      }
40947  }
40948
40949  protected void composeBinary(String name, Binary element) throws IOException {
40950    if (element != null) {
40951      prop("resourceType", name);
40952      composeBinaryProperties(element);
40953    }
40954  }
40955
40956  protected void composeBinaryProperties(Binary element) throws IOException {
40957    composeResourceProperties(element);
40958      if (element.hasContentTypeElement()) {
40959        composeCodeCore("contentType", element.getContentTypeElement(), false);
40960        composeCodeExtras("contentType", element.getContentTypeElement(), false);
40961      }
40962      if (element.hasSecurityContext()) {
40963        composeReference("securityContext", element.getSecurityContext());
40964      }
40965      if (element.hasDataElement()) {
40966        composeBase64BinaryCore("data", element.getDataElement(), false);
40967        composeBase64BinaryExtras("data", element.getDataElement(), false);
40968      }
40969  }
40970
40971  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
40972    if (element != null) {
40973      prop("resourceType", name);
40974      composeBiologicallyDerivedProductProperties(element);
40975    }
40976  }
40977
40978  protected void composeBiologicallyDerivedProductProperties(BiologicallyDerivedProduct element) throws IOException {
40979    composeDomainResourceProperties(element);
40980      if (element.hasProductCategory()) {
40981        composeCoding("productCategory", element.getProductCategory());
40982      }
40983      if (element.hasProductCode()) {
40984        composeCodeableConcept("productCode", element.getProductCode());
40985      }
40986      if (element.hasParent()) {
40987        openArray("parent");
40988        for (Reference e : element.getParent()) 
40989          composeReference(null, e);
40990        closeArray();
40991      };
40992      if (element.hasRequest()) {
40993        openArray("request");
40994        for (Reference e : element.getRequest()) 
40995          composeReference(null, e);
40996        closeArray();
40997      };
40998      if (element.hasIdentifier()) {
40999        openArray("identifier");
41000        for (Identifier e : element.getIdentifier()) 
41001          composeIdentifier(null, e);
41002        closeArray();
41003      };
41004      if (element.hasBiologicalSourceEvent()) {
41005        composeIdentifier("biologicalSourceEvent", element.getBiologicalSourceEvent());
41006      }
41007      if (element.hasProcessingFacility()) {
41008        openArray("processingFacility");
41009        for (Reference e : element.getProcessingFacility()) 
41010          composeReference(null, e);
41011        closeArray();
41012      };
41013      if (element.hasDivisionElement()) {
41014        composeStringCore("division", element.getDivisionElement(), false);
41015        composeStringExtras("division", element.getDivisionElement(), false);
41016      }
41017      if (element.hasProductStatus()) {
41018        composeCoding("productStatus", element.getProductStatus());
41019      }
41020      if (element.hasExpirationDateElement()) {
41021        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
41022        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
41023      }
41024      if (element.hasCollection()) {
41025        composeBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
41026      }
41027      if (element.hasStorageTempRequirements()) {
41028        composeRange("storageTempRequirements", element.getStorageTempRequirements());
41029      }
41030      if (element.hasProperty()) {
41031        openArray("property");
41032        for (BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent e : element.getProperty()) 
41033          composeBiologicallyDerivedProductPropertyComponent(null, e);
41034        closeArray();
41035      };
41036  }
41037
41038  protected void composeBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
41039    if (element != null) {
41040      open(name);
41041      composeBiologicallyDerivedProductCollectionComponentProperties(element);
41042      close();
41043    }
41044  }
41045
41046  protected void composeBiologicallyDerivedProductCollectionComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
41047    composeBackboneElementProperties(element);
41048      if (element.hasCollector()) {
41049        composeReference("collector", element.getCollector());
41050      }
41051      if (element.hasSource()) {
41052        composeReference("source", element.getSource());
41053      }
41054      if (element.hasCollected()) {
41055        composeType("collected", element.getCollected());
41056      }
41057  }
41058
41059  protected void composeBiologicallyDerivedProductPropertyComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent element) throws IOException {
41060    if (element != null) {
41061      open(name);
41062      composeBiologicallyDerivedProductPropertyComponentProperties(element);
41063      close();
41064    }
41065  }
41066
41067  protected void composeBiologicallyDerivedProductPropertyComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent element) throws IOException {
41068    composeBackboneElementProperties(element);
41069      if (element.hasType()) {
41070        composeCodeableConcept("type", element.getType());
41071      }
41072      if (element.hasValue()) {
41073        composeType("value", element.getValue());
41074      }
41075  }
41076
41077  protected void composeBiologicallyDerivedProductDispense(String name, BiologicallyDerivedProductDispense element) throws IOException {
41078    if (element != null) {
41079      prop("resourceType", name);
41080      composeBiologicallyDerivedProductDispenseProperties(element);
41081    }
41082  }
41083
41084  protected void composeBiologicallyDerivedProductDispenseProperties(BiologicallyDerivedProductDispense element) throws IOException {
41085    composeDomainResourceProperties(element);
41086      if (element.hasIdentifier()) {
41087        openArray("identifier");
41088        for (Identifier e : element.getIdentifier()) 
41089          composeIdentifier(null, e);
41090        closeArray();
41091      };
41092      if (element.hasBasedOn()) {
41093        openArray("basedOn");
41094        for (Reference e : element.getBasedOn()) 
41095          composeReference(null, e);
41096        closeArray();
41097      };
41098      if (element.hasPartOf()) {
41099        openArray("partOf");
41100        for (Reference e : element.getPartOf()) 
41101          composeReference(null, e);
41102        closeArray();
41103      };
41104      if (element.hasStatusElement()) {
41105        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispenseCodesEnumFactory(), false);
41106        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispenseCodesEnumFactory(), false);
41107      }
41108      if (element.hasOriginRelationshipType()) {
41109        composeCodeableConcept("originRelationshipType", element.getOriginRelationshipType());
41110      }
41111      if (element.hasProduct()) {
41112        composeReference("product", element.getProduct());
41113      }
41114      if (element.hasPatient()) {
41115        composeReference("patient", element.getPatient());
41116      }
41117      if (element.hasMatchStatus()) {
41118        composeCodeableConcept("matchStatus", element.getMatchStatus());
41119      }
41120      if (element.hasPerformer()) {
41121        openArray("performer");
41122        for (BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent e : element.getPerformer()) 
41123          composeBiologicallyDerivedProductDispensePerformerComponent(null, e);
41124        closeArray();
41125      };
41126      if (element.hasLocation()) {
41127        composeReference("location", element.getLocation());
41128      }
41129      if (element.hasQuantity()) {
41130        composeQuantity("quantity", element.getQuantity());
41131      }
41132      if (element.hasPreparedDateElement()) {
41133        composeDateTimeCore("preparedDate", element.getPreparedDateElement(), false);
41134        composeDateTimeExtras("preparedDate", element.getPreparedDateElement(), false);
41135      }
41136      if (element.hasWhenHandedOverElement()) {
41137        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
41138        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
41139      }
41140      if (element.hasDestination()) {
41141        composeReference("destination", element.getDestination());
41142      }
41143      if (element.hasNote()) {
41144        openArray("note");
41145        for (Annotation e : element.getNote()) 
41146          composeAnnotation(null, e);
41147        closeArray();
41148      };
41149      if (element.hasUsageInstructionElement()) {
41150        composeStringCore("usageInstruction", element.getUsageInstructionElement(), false);
41151        composeStringExtras("usageInstruction", element.getUsageInstructionElement(), false);
41152      }
41153  }
41154
41155  protected void composeBiologicallyDerivedProductDispensePerformerComponent(String name, BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent element) throws IOException {
41156    if (element != null) {
41157      open(name);
41158      composeBiologicallyDerivedProductDispensePerformerComponentProperties(element);
41159      close();
41160    }
41161  }
41162
41163  protected void composeBiologicallyDerivedProductDispensePerformerComponentProperties(BiologicallyDerivedProductDispense.BiologicallyDerivedProductDispensePerformerComponent element) throws IOException {
41164    composeBackboneElementProperties(element);
41165      if (element.hasFunction()) {
41166        composeCodeableConcept("function", element.getFunction());
41167      }
41168      if (element.hasActor()) {
41169        composeReference("actor", element.getActor());
41170      }
41171  }
41172
41173  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
41174    if (element != null) {
41175      prop("resourceType", name);
41176      composeBodyStructureProperties(element);
41177    }
41178  }
41179
41180  protected void composeBodyStructureProperties(BodyStructure element) throws IOException {
41181    composeDomainResourceProperties(element);
41182      if (element.hasIdentifier()) {
41183        openArray("identifier");
41184        for (Identifier e : element.getIdentifier()) 
41185          composeIdentifier(null, e);
41186        closeArray();
41187      };
41188      if (element.hasActiveElement()) {
41189        composeBooleanCore("active", element.getActiveElement(), false);
41190        composeBooleanExtras("active", element.getActiveElement(), false);
41191      }
41192      if (element.hasMorphology()) {
41193        composeCodeableConcept("morphology", element.getMorphology());
41194      }
41195      if (element.hasIncludedStructure()) {
41196        openArray("includedStructure");
41197        for (BodyStructure.BodyStructureIncludedStructureComponent e : element.getIncludedStructure()) 
41198          composeBodyStructureIncludedStructureComponent(null, e);
41199        closeArray();
41200      };
41201      if (element.hasExcludedStructure()) {
41202        openArray("excludedStructure");
41203        for (BodyStructure.BodyStructureIncludedStructureComponent e : element.getExcludedStructure()) 
41204          composeBodyStructureIncludedStructureComponent(null, e);
41205        closeArray();
41206      };
41207      if (element.hasDescriptionElement()) {
41208        composeMarkdownCore("description", element.getDescriptionElement(), false);
41209        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41210      }
41211      if (element.hasImage()) {
41212        openArray("image");
41213        for (Attachment e : element.getImage()) 
41214          composeAttachment(null, e);
41215        closeArray();
41216      };
41217      if (element.hasPatient()) {
41218        composeReference("patient", element.getPatient());
41219      }
41220  }
41221
41222  protected void composeBodyStructureIncludedStructureComponent(String name, BodyStructure.BodyStructureIncludedStructureComponent element) throws IOException {
41223    if (element != null) {
41224      open(name);
41225      composeBodyStructureIncludedStructureComponentProperties(element);
41226      close();
41227    }
41228  }
41229
41230  protected void composeBodyStructureIncludedStructureComponentProperties(BodyStructure.BodyStructureIncludedStructureComponent element) throws IOException {
41231    composeBackboneElementProperties(element);
41232      if (element.hasStructure()) {
41233        composeCodeableConcept("structure", element.getStructure());
41234      }
41235      if (element.hasLaterality()) {
41236        composeCodeableConcept("laterality", element.getLaterality());
41237      }
41238      if (element.hasBodyLandmarkOrientation()) {
41239        openArray("bodyLandmarkOrientation");
41240        for (BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent e : element.getBodyLandmarkOrientation()) 
41241          composeBodyStructureIncludedStructureBodyLandmarkOrientationComponent(null, e);
41242        closeArray();
41243      };
41244      if (element.hasSpatialReference()) {
41245        openArray("spatialReference");
41246        for (Reference e : element.getSpatialReference()) 
41247          composeReference(null, e);
41248        closeArray();
41249      };
41250      if (element.hasQualifier()) {
41251        openArray("qualifier");
41252        for (CodeableConcept e : element.getQualifier()) 
41253          composeCodeableConcept(null, e);
41254        closeArray();
41255      };
41256  }
41257
41258  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationComponent(String name, BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent element) throws IOException {
41259    if (element != null) {
41260      open(name);
41261      composeBodyStructureIncludedStructureBodyLandmarkOrientationComponentProperties(element);
41262      close();
41263    }
41264  }
41265
41266  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationComponentProperties(BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationComponent element) throws IOException {
41267    composeBackboneElementProperties(element);
41268      if (element.hasLandmarkDescription()) {
41269        openArray("landmarkDescription");
41270        for (CodeableConcept e : element.getLandmarkDescription()) 
41271          composeCodeableConcept(null, e);
41272        closeArray();
41273      };
41274      if (element.hasClockFacePosition()) {
41275        openArray("clockFacePosition");
41276        for (CodeableConcept e : element.getClockFacePosition()) 
41277          composeCodeableConcept(null, e);
41278        closeArray();
41279      };
41280      if (element.hasDistanceFromLandmark()) {
41281        openArray("distanceFromLandmark");
41282        for (BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent e : element.getDistanceFromLandmark()) 
41283          composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent(null, e);
41284        closeArray();
41285      };
41286      if (element.hasSurfaceOrientation()) {
41287        openArray("surfaceOrientation");
41288        for (CodeableConcept e : element.getSurfaceOrientation()) 
41289          composeCodeableConcept(null, e);
41290        closeArray();
41291      };
41292  }
41293
41294  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent(String name, BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent element) throws IOException {
41295    if (element != null) {
41296      open(name);
41297      composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponentProperties(element);
41298      close();
41299    }
41300  }
41301
41302  protected void composeBodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponentProperties(BodyStructure.BodyStructureIncludedStructureBodyLandmarkOrientationDistanceFromLandmarkComponent element) throws IOException {
41303    composeBackboneElementProperties(element);
41304      if (element.hasDevice()) {
41305        openArray("device");
41306        for (CodeableReference e : element.getDevice()) 
41307          composeCodeableReference(null, e);
41308        closeArray();
41309      };
41310      if (element.hasValue()) {
41311        openArray("value");
41312        for (Quantity e : element.getValue()) 
41313          composeQuantity(null, e);
41314        closeArray();
41315      };
41316  }
41317
41318  protected void composeBundle(String name, Bundle element) throws IOException {
41319    if (element != null) {
41320      prop("resourceType", name);
41321      composeBundleProperties(element);
41322    }
41323  }
41324
41325  protected void composeBundleProperties(Bundle element) throws IOException {
41326    composeResourceProperties(element);
41327      if (element.hasIdentifier()) {
41328        composeIdentifier("identifier", element.getIdentifier());
41329      }
41330      if (element.hasTypeElement()) {
41331        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
41332        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
41333      }
41334      if (element.hasTimestampElement()) {
41335        composeInstantCore("timestamp", element.getTimestampElement(), false);
41336        composeInstantExtras("timestamp", element.getTimestampElement(), false);
41337      }
41338      if (element.hasTotalElement()) {
41339        composeUnsignedIntCore("total", element.getTotalElement(), false);
41340        composeUnsignedIntExtras("total", element.getTotalElement(), false);
41341      }
41342      if (element.hasLink()) {
41343        openArray("link");
41344        for (Bundle.BundleLinkComponent e : element.getLink()) 
41345          composeBundleLinkComponent(null, e);
41346        closeArray();
41347      };
41348      if (element.hasEntry()) {
41349        openArray("entry");
41350        for (Bundle.BundleEntryComponent e : element.getEntry()) 
41351          composeBundleEntryComponent(null, e);
41352        closeArray();
41353      };
41354      if (element.hasSignature()) {
41355        composeSignature("signature", element.getSignature());
41356      }
41357        if (element.hasIssues()) {
41358          open("issues");
41359          composeResource(element.getIssues());
41360          close();
41361        }
41362  }
41363
41364  protected void composeBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
41365    if (element != null) {
41366      open(name);
41367      composeBundleLinkComponentProperties(element);
41368      close();
41369    }
41370  }
41371
41372  protected void composeBundleLinkComponentProperties(Bundle.BundleLinkComponent element) throws IOException {
41373    composeBackboneElementProperties(element);
41374      if (element.hasRelationElement()) {
41375        composeEnumerationCore("relation", element.getRelationElement(), new Bundle.LinkRelationTypesEnumFactory(), false);
41376        composeEnumerationExtras("relation", element.getRelationElement(), new Bundle.LinkRelationTypesEnumFactory(), false);
41377      }
41378      if (element.hasUrlElement()) {
41379        composeUriCore("url", element.getUrlElement(), false);
41380        composeUriExtras("url", element.getUrlElement(), false);
41381      }
41382  }
41383
41384  protected void composeBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
41385    if (element != null) {
41386      open(name);
41387      composeBundleEntryComponentProperties(element);
41388      close();
41389    }
41390  }
41391
41392  protected void composeBundleEntryComponentProperties(Bundle.BundleEntryComponent element) throws IOException {
41393    composeBackboneElementProperties(element);
41394      if (element.hasLink()) {
41395        openArray("link");
41396        for (Bundle.BundleLinkComponent e : element.getLink()) 
41397          composeBundleLinkComponent(null, e);
41398        closeArray();
41399      };
41400      if (element.hasFullUrlElement()) {
41401        composeUriCore("fullUrl", element.getFullUrlElement(), false);
41402        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
41403      }
41404        if (element.hasResource()) {
41405          open("resource");
41406          composeResource(element.getResource());
41407          close();
41408        }
41409      if (element.hasSearch()) {
41410        composeBundleEntrySearchComponent("search", element.getSearch());
41411      }
41412      if (element.hasRequest()) {
41413        composeBundleEntryRequestComponent("request", element.getRequest());
41414      }
41415      if (element.hasResponse()) {
41416        composeBundleEntryResponseComponent("response", element.getResponse());
41417      }
41418  }
41419
41420  protected void composeBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
41421    if (element != null) {
41422      open(name);
41423      composeBundleEntrySearchComponentProperties(element);
41424      close();
41425    }
41426  }
41427
41428  protected void composeBundleEntrySearchComponentProperties(Bundle.BundleEntrySearchComponent element) throws IOException {
41429    composeBackboneElementProperties(element);
41430      if (element.hasModeElement()) {
41431        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
41432        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
41433      }
41434      if (element.hasScoreElement()) {
41435        composeDecimalCore("score", element.getScoreElement(), false);
41436        composeDecimalExtras("score", element.getScoreElement(), false);
41437      }
41438  }
41439
41440  protected void composeBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
41441    if (element != null) {
41442      open(name);
41443      composeBundleEntryRequestComponentProperties(element);
41444      close();
41445    }
41446  }
41447
41448  protected void composeBundleEntryRequestComponentProperties(Bundle.BundleEntryRequestComponent element) throws IOException {
41449    composeBackboneElementProperties(element);
41450      if (element.hasMethodElement()) {
41451        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
41452        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
41453      }
41454      if (element.hasUrlElement()) {
41455        composeUriCore("url", element.getUrlElement(), false);
41456        composeUriExtras("url", element.getUrlElement(), false);
41457      }
41458      if (element.hasIfNoneMatchElement()) {
41459        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
41460        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
41461      }
41462      if (element.hasIfModifiedSinceElement()) {
41463        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
41464        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
41465      }
41466      if (element.hasIfMatchElement()) {
41467        composeStringCore("ifMatch", element.getIfMatchElement(), false);
41468        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
41469      }
41470      if (element.hasIfNoneExistElement()) {
41471        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
41472        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
41473      }
41474  }
41475
41476  protected void composeBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
41477    if (element != null) {
41478      open(name);
41479      composeBundleEntryResponseComponentProperties(element);
41480      close();
41481    }
41482  }
41483
41484  protected void composeBundleEntryResponseComponentProperties(Bundle.BundleEntryResponseComponent element) throws IOException {
41485    composeBackboneElementProperties(element);
41486      if (element.hasStatusElement()) {
41487        composeStringCore("status", element.getStatusElement(), false);
41488        composeStringExtras("status", element.getStatusElement(), false);
41489      }
41490      if (element.hasLocationElement()) {
41491        composeUriCore("location", element.getLocationElement(), false);
41492        composeUriExtras("location", element.getLocationElement(), false);
41493      }
41494      if (element.hasEtagElement()) {
41495        composeStringCore("etag", element.getEtagElement(), false);
41496        composeStringExtras("etag", element.getEtagElement(), false);
41497      }
41498      if (element.hasLastModifiedElement()) {
41499        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
41500        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
41501      }
41502        if (element.hasOutcome()) {
41503          open("outcome");
41504          composeResource(element.getOutcome());
41505          close();
41506        }
41507  }
41508
41509  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
41510    if (element != null) {
41511      prop("resourceType", name);
41512      composeCapabilityStatementProperties(element);
41513    }
41514  }
41515
41516  protected void composeCapabilityStatementProperties(CapabilityStatement element) throws IOException {
41517    composeCanonicalResourceProperties(element);
41518      if (element.hasUrlElement()) {
41519        composeUriCore("url", element.getUrlElement(), false);
41520        composeUriExtras("url", element.getUrlElement(), false);
41521      }
41522      if (element.hasIdentifier()) {
41523        openArray("identifier");
41524        for (Identifier e : element.getIdentifier()) 
41525          composeIdentifier(null, e);
41526        closeArray();
41527      };
41528      if (element.hasVersionElement()) {
41529        composeStringCore("version", element.getVersionElement(), false);
41530        composeStringExtras("version", element.getVersionElement(), false);
41531      }
41532      if (element.hasVersionAlgorithm()) {
41533        composeType("versionAlgorithm", element.getVersionAlgorithm());
41534      }
41535      if (element.hasNameElement()) {
41536        composeStringCore("name", element.getNameElement(), false);
41537        composeStringExtras("name", element.getNameElement(), false);
41538      }
41539      if (element.hasTitleElement()) {
41540        composeStringCore("title", element.getTitleElement(), false);
41541        composeStringExtras("title", element.getTitleElement(), false);
41542      }
41543      if (element.hasStatusElement()) {
41544        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41545        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41546      }
41547      if (element.hasExperimentalElement()) {
41548        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41549        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41550      }
41551      if (element.hasDateElement()) {
41552        composeDateTimeCore("date", element.getDateElement(), false);
41553        composeDateTimeExtras("date", element.getDateElement(), false);
41554      }
41555      if (element.hasPublisherElement()) {
41556        composeStringCore("publisher", element.getPublisherElement(), false);
41557        composeStringExtras("publisher", element.getPublisherElement(), false);
41558      }
41559      if (element.hasContact()) {
41560        openArray("contact");
41561        for (ContactDetail e : element.getContact()) 
41562          composeContactDetail(null, e);
41563        closeArray();
41564      };
41565      if (element.hasDescriptionElement()) {
41566        composeMarkdownCore("description", element.getDescriptionElement(), false);
41567        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41568      }
41569      if (element.hasUseContext()) {
41570        openArray("useContext");
41571        for (UsageContext e : element.getUseContext()) 
41572          composeUsageContext(null, e);
41573        closeArray();
41574      };
41575      if (element.hasJurisdiction()) {
41576        openArray("jurisdiction");
41577        for (CodeableConcept e : element.getJurisdiction()) 
41578          composeCodeableConcept(null, e);
41579        closeArray();
41580      };
41581      if (element.hasPurposeElement()) {
41582        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41583        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41584      }
41585      if (element.hasCopyrightElement()) {
41586        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41587        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41588      }
41589      if (element.hasCopyrightLabelElement()) {
41590        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
41591        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
41592      }
41593      if (element.hasKindElement()) {
41594        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
41595        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
41596      }
41597      if (element.hasInstantiates()) {
41598        if (anyHasValue(element.getInstantiates())) {
41599          openArray("instantiates");
41600          for (CanonicalType e : element.getInstantiates()) 
41601            composeCanonicalCore(null, e, e != element.getInstantiates().get(element.getInstantiates().size()-1));
41602          closeArray();
41603        }
41604        if (anyHasExtras(element.getInstantiates())) {
41605          openArray("_instantiates");
41606          for (CanonicalType e : element.getInstantiates()) 
41607            composeCanonicalExtras(null, e, true);
41608          closeArray();
41609        }
41610      };
41611      if (element.hasImports()) {
41612        if (anyHasValue(element.getImports())) {
41613          openArray("imports");
41614          for (CanonicalType e : element.getImports()) 
41615            composeCanonicalCore(null, e, e != element.getImports().get(element.getImports().size()-1));
41616          closeArray();
41617        }
41618        if (anyHasExtras(element.getImports())) {
41619          openArray("_imports");
41620          for (CanonicalType e : element.getImports()) 
41621            composeCanonicalExtras(null, e, true);
41622          closeArray();
41623        }
41624      };
41625      if (element.hasSoftware()) {
41626        composeCapabilityStatementSoftwareComponent("software", element.getSoftware());
41627      }
41628      if (element.hasImplementation()) {
41629        composeCapabilityStatementImplementationComponent("implementation", element.getImplementation());
41630      }
41631      if (element.hasFhirVersionElement()) {
41632        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
41633        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
41634      }
41635      if (element.hasFormat()) {
41636        if (anyHasValue(element.getFormat())) {
41637          openArray("format");
41638          for (CodeType e : element.getFormat()) 
41639            composeCodeCore(null, e, e != element.getFormat().get(element.getFormat().size()-1));
41640          closeArray();
41641        }
41642        if (anyHasExtras(element.getFormat())) {
41643          openArray("_format");
41644          for (CodeType e : element.getFormat()) 
41645            composeCodeExtras(null, e, true);
41646          closeArray();
41647        }
41648      };
41649      if (element.hasPatchFormat()) {
41650        if (anyHasValue(element.getPatchFormat())) {
41651          openArray("patchFormat");
41652          for (CodeType e : element.getPatchFormat()) 
41653            composeCodeCore(null, e, e != element.getPatchFormat().get(element.getPatchFormat().size()-1));
41654          closeArray();
41655        }
41656        if (anyHasExtras(element.getPatchFormat())) {
41657          openArray("_patchFormat");
41658          for (CodeType e : element.getPatchFormat()) 
41659            composeCodeExtras(null, e, true);
41660          closeArray();
41661        }
41662      };
41663      if (element.hasAcceptLanguage()) {
41664        if (anyHasValue(element.getAcceptLanguage())) {
41665          openArray("acceptLanguage");
41666          for (CodeType e : element.getAcceptLanguage()) 
41667            composeCodeCore(null, e, e != element.getAcceptLanguage().get(element.getAcceptLanguage().size()-1));
41668          closeArray();
41669        }
41670        if (anyHasExtras(element.getAcceptLanguage())) {
41671          openArray("_acceptLanguage");
41672          for (CodeType e : element.getAcceptLanguage()) 
41673            composeCodeExtras(null, e, true);
41674          closeArray();
41675        }
41676      };
41677      if (element.hasImplementationGuide()) {
41678        if (anyHasValue(element.getImplementationGuide())) {
41679          openArray("implementationGuide");
41680          for (CanonicalType e : element.getImplementationGuide()) 
41681            composeCanonicalCore(null, e, e != element.getImplementationGuide().get(element.getImplementationGuide().size()-1));
41682          closeArray();
41683        }
41684        if (anyHasExtras(element.getImplementationGuide())) {
41685          openArray("_implementationGuide");
41686          for (CanonicalType e : element.getImplementationGuide()) 
41687            composeCanonicalExtras(null, e, true);
41688          closeArray();
41689        }
41690      };
41691      if (element.hasRest()) {
41692        openArray("rest");
41693        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
41694          composeCapabilityStatementRestComponent(null, e);
41695        closeArray();
41696      };
41697      if (element.hasMessaging()) {
41698        openArray("messaging");
41699        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
41700          composeCapabilityStatementMessagingComponent(null, e);
41701        closeArray();
41702      };
41703      if (element.hasDocument()) {
41704        openArray("document");
41705        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
41706          composeCapabilityStatementDocumentComponent(null, e);
41707        closeArray();
41708      };
41709  }
41710
41711  protected void composeCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
41712    if (element != null) {
41713      open(name);
41714      composeCapabilityStatementSoftwareComponentProperties(element);
41715      close();
41716    }
41717  }
41718
41719  protected void composeCapabilityStatementSoftwareComponentProperties(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
41720    composeBackboneElementProperties(element);
41721      if (element.hasNameElement()) {
41722        composeStringCore("name", element.getNameElement(), false);
41723        composeStringExtras("name", element.getNameElement(), false);
41724      }
41725      if (element.hasVersionElement()) {
41726        composeStringCore("version", element.getVersionElement(), false);
41727        composeStringExtras("version", element.getVersionElement(), false);
41728      }
41729      if (element.hasReleaseDateElement()) {
41730        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
41731        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
41732      }
41733  }
41734
41735  protected void composeCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
41736    if (element != null) {
41737      open(name);
41738      composeCapabilityStatementImplementationComponentProperties(element);
41739      close();
41740    }
41741  }
41742
41743  protected void composeCapabilityStatementImplementationComponentProperties(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
41744    composeBackboneElementProperties(element);
41745      if (element.hasDescriptionElement()) {
41746        composeMarkdownCore("description", element.getDescriptionElement(), false);
41747        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41748      }
41749      if (element.hasUrlElement()) {
41750        composeUrlCore("url", element.getUrlElement(), false);
41751        composeUrlExtras("url", element.getUrlElement(), false);
41752      }
41753      if (element.hasCustodian()) {
41754        composeReference("custodian", element.getCustodian());
41755      }
41756  }
41757
41758  protected void composeCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
41759    if (element != null) {
41760      open(name);
41761      composeCapabilityStatementRestComponentProperties(element);
41762      close();
41763    }
41764  }
41765
41766  protected void composeCapabilityStatementRestComponentProperties(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
41767    composeBackboneElementProperties(element);
41768      if (element.hasModeElement()) {
41769        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
41770        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
41771      }
41772      if (element.hasDocumentationElement()) {
41773        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
41774        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
41775      }
41776      if (element.hasSecurity()) {
41777        composeCapabilityStatementRestSecurityComponent("security", element.getSecurity());
41778      }
41779      if (element.hasResource()) {
41780        openArray("resource");
41781        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
41782          composeCapabilityStatementRestResourceComponent(null, e);
41783        closeArray();
41784      };
41785      if (element.hasInteraction()) {
41786        openArray("interaction");
41787        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
41788          composeSystemInteractionComponent(null, e);
41789        closeArray();
41790      };
41791      if (element.hasSearchParam()) {
41792        openArray("searchParam");
41793        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
41794          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
41795        closeArray();
41796      };
41797      if (element.hasOperation()) {
41798        openArray("operation");
41799        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
41800          composeCapabilityStatementRestResourceOperationComponent(null, e);
41801        closeArray();
41802      };
41803      if (element.hasCompartment()) {
41804        if (anyHasValue(element.getCompartment())) {
41805          openArray("compartment");
41806          for (CanonicalType e : element.getCompartment()) 
41807            composeCanonicalCore(null, e, e != element.getCompartment().get(element.getCompartment().size()-1));
41808          closeArray();
41809        }
41810        if (anyHasExtras(element.getCompartment())) {
41811          openArray("_compartment");
41812          for (CanonicalType e : element.getCompartment()) 
41813            composeCanonicalExtras(null, e, true);
41814          closeArray();
41815        }
41816      };
41817  }
41818
41819  protected void composeCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
41820    if (element != null) {
41821      open(name);
41822      composeCapabilityStatementRestSecurityComponentProperties(element);
41823      close();
41824    }
41825  }
41826
41827  protected void composeCapabilityStatementRestSecurityComponentProperties(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
41828    composeBackboneElementProperties(element);
41829      if (element.hasCorsElement()) {
41830        composeBooleanCore("cors", element.getCorsElement(), false);
41831        composeBooleanExtras("cors", element.getCorsElement(), false);
41832      }
41833      if (element.hasService()) {
41834        openArray("service");
41835        for (CodeableConcept e : element.getService()) 
41836          composeCodeableConcept(null, e);
41837        closeArray();
41838      };
41839      if (element.hasDescriptionElement()) {
41840        composeMarkdownCore("description", element.getDescriptionElement(), false);
41841        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41842      }
41843  }
41844
41845  protected void composeCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
41846    if (element != null) {
41847      open(name);
41848      composeCapabilityStatementRestResourceComponentProperties(element);
41849      close();
41850    }
41851  }
41852
41853  protected void composeCapabilityStatementRestResourceComponentProperties(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
41854    composeBackboneElementProperties(element);
41855      if (element.hasTypeElement()) {
41856        composeCodeCore("type", element.getTypeElement(), false);
41857        composeCodeExtras("type", element.getTypeElement(), false);
41858      }
41859      if (element.hasProfileElement()) {
41860        composeCanonicalCore("profile", element.getProfileElement(), false);
41861        composeCanonicalExtras("profile", element.getProfileElement(), false);
41862      }
41863      if (element.hasSupportedProfile()) {
41864        if (anyHasValue(element.getSupportedProfile())) {
41865          openArray("supportedProfile");
41866          for (CanonicalType e : element.getSupportedProfile()) 
41867            composeCanonicalCore(null, e, e != element.getSupportedProfile().get(element.getSupportedProfile().size()-1));
41868          closeArray();
41869        }
41870        if (anyHasExtras(element.getSupportedProfile())) {
41871          openArray("_supportedProfile");
41872          for (CanonicalType e : element.getSupportedProfile()) 
41873            composeCanonicalExtras(null, e, true);
41874          closeArray();
41875        }
41876      };
41877      if (element.hasDocumentationElement()) {
41878        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
41879        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
41880      }
41881      if (element.hasInteraction()) {
41882        openArray("interaction");
41883        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
41884          composeResourceInteractionComponent(null, e);
41885        closeArray();
41886      };
41887      if (element.hasVersioningElement()) {
41888        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
41889        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
41890      }
41891      if (element.hasReadHistoryElement()) {
41892        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
41893        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
41894      }
41895      if (element.hasUpdateCreateElement()) {
41896        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
41897        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
41898      }
41899      if (element.hasConditionalCreateElement()) {
41900        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
41901        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
41902      }
41903      if (element.hasConditionalReadElement()) {
41904        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
41905        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
41906      }
41907      if (element.hasConditionalUpdateElement()) {
41908        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
41909        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
41910      }
41911      if (element.hasConditionalPatchElement()) {
41912        composeBooleanCore("conditionalPatch", element.getConditionalPatchElement(), false);
41913        composeBooleanExtras("conditionalPatch", element.getConditionalPatchElement(), false);
41914      }
41915      if (element.hasConditionalDeleteElement()) {
41916        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
41917        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
41918      }
41919      if (element.hasReferencePolicy()) {
41920        openArray("referencePolicy");
41921        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
41922          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
41923        closeArray();
41924        if (anyHasExtras(element.getReferencePolicy())) {
41925          openArray("_referencePolicy");
41926          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
41927            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
41928          closeArray();
41929        }
41930      };
41931      if (element.hasSearchInclude()) {
41932        if (anyHasValue(element.getSearchInclude())) {
41933          openArray("searchInclude");
41934          for (StringType e : element.getSearchInclude()) 
41935            composeStringCore(null, e, e != element.getSearchInclude().get(element.getSearchInclude().size()-1));
41936          closeArray();
41937        }
41938        if (anyHasExtras(element.getSearchInclude())) {
41939          openArray("_searchInclude");
41940          for (StringType e : element.getSearchInclude()) 
41941            composeStringExtras(null, e, true);
41942          closeArray();
41943        }
41944      };
41945      if (element.hasSearchRevInclude()) {
41946        if (anyHasValue(element.getSearchRevInclude())) {
41947          openArray("searchRevInclude");
41948          for (StringType e : element.getSearchRevInclude()) 
41949            composeStringCore(null, e, e != element.getSearchRevInclude().get(element.getSearchRevInclude().size()-1));
41950          closeArray();
41951        }
41952        if (anyHasExtras(element.getSearchRevInclude())) {
41953          openArray("_searchRevInclude");
41954          for (StringType e : element.getSearchRevInclude()) 
41955            composeStringExtras(null, e, true);
41956          closeArray();
41957        }
41958      };
41959      if (element.hasSearchParam()) {
41960        openArray("searchParam");
41961        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
41962          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
41963        closeArray();
41964      };
41965      if (element.hasOperation()) {
41966        openArray("operation");
41967        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
41968          composeCapabilityStatementRestResourceOperationComponent(null, e);
41969        closeArray();
41970      };
41971  }
41972
41973  protected void composeResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
41974    if (element != null) {
41975      open(name);
41976      composeResourceInteractionComponentProperties(element);
41977      close();
41978    }
41979  }
41980
41981  protected void composeResourceInteractionComponentProperties(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
41982    composeBackboneElementProperties(element);
41983      if (element.hasCodeElement()) {
41984        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
41985        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
41986      }
41987      if (element.hasDocumentationElement()) {
41988        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
41989        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
41990      }
41991  }
41992
41993  protected void composeCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
41994    if (element != null) {
41995      open(name);
41996      composeCapabilityStatementRestResourceSearchParamComponentProperties(element);
41997      close();
41998    }
41999  }
42000
42001  protected void composeCapabilityStatementRestResourceSearchParamComponentProperties(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
42002    composeBackboneElementProperties(element);
42003      if (element.hasNameElement()) {
42004        composeStringCore("name", element.getNameElement(), false);
42005        composeStringExtras("name", element.getNameElement(), false);
42006      }
42007      if (element.hasDefinitionElement()) {
42008        composeCanonicalCore("definition", element.getDefinitionElement(), false);
42009        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
42010      }
42011      if (element.hasTypeElement()) {
42012        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
42013        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
42014      }
42015      if (element.hasDocumentationElement()) {
42016        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42017        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42018      }
42019  }
42020
42021  protected void composeCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
42022    if (element != null) {
42023      open(name);
42024      composeCapabilityStatementRestResourceOperationComponentProperties(element);
42025      close();
42026    }
42027  }
42028
42029  protected void composeCapabilityStatementRestResourceOperationComponentProperties(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
42030    composeBackboneElementProperties(element);
42031      if (element.hasNameElement()) {
42032        composeStringCore("name", element.getNameElement(), false);
42033        composeStringExtras("name", element.getNameElement(), false);
42034      }
42035      if (element.hasDefinitionElement()) {
42036        composeCanonicalCore("definition", element.getDefinitionElement(), false);
42037        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
42038      }
42039      if (element.hasDocumentationElement()) {
42040        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42041        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42042      }
42043  }
42044
42045  protected void composeSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
42046    if (element != null) {
42047      open(name);
42048      composeSystemInteractionComponentProperties(element);
42049      close();
42050    }
42051  }
42052
42053  protected void composeSystemInteractionComponentProperties(CapabilityStatement.SystemInteractionComponent element) throws IOException {
42054    composeBackboneElementProperties(element);
42055      if (element.hasCodeElement()) {
42056        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
42057        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
42058      }
42059      if (element.hasDocumentationElement()) {
42060        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42061        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42062      }
42063  }
42064
42065  protected void composeCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
42066    if (element != null) {
42067      open(name);
42068      composeCapabilityStatementMessagingComponentProperties(element);
42069      close();
42070    }
42071  }
42072
42073  protected void composeCapabilityStatementMessagingComponentProperties(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
42074    composeBackboneElementProperties(element);
42075      if (element.hasEndpoint()) {
42076        openArray("endpoint");
42077        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
42078          composeCapabilityStatementMessagingEndpointComponent(null, e);
42079        closeArray();
42080      };
42081      if (element.hasReliableCacheElement()) {
42082        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
42083        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
42084      }
42085      if (element.hasDocumentationElement()) {
42086        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42087        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42088      }
42089      if (element.hasSupportedMessage()) {
42090        openArray("supportedMessage");
42091        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
42092          composeCapabilityStatementMessagingSupportedMessageComponent(null, e);
42093        closeArray();
42094      };
42095  }
42096
42097  protected void composeCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
42098    if (element != null) {
42099      open(name);
42100      composeCapabilityStatementMessagingEndpointComponentProperties(element);
42101      close();
42102    }
42103  }
42104
42105  protected void composeCapabilityStatementMessagingEndpointComponentProperties(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
42106    composeBackboneElementProperties(element);
42107      if (element.hasProtocol()) {
42108        composeCoding("protocol", element.getProtocol());
42109      }
42110      if (element.hasAddressElement()) {
42111        composeUrlCore("address", element.getAddressElement(), false);
42112        composeUrlExtras("address", element.getAddressElement(), false);
42113      }
42114  }
42115
42116  protected void composeCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
42117    if (element != null) {
42118      open(name);
42119      composeCapabilityStatementMessagingSupportedMessageComponentProperties(element);
42120      close();
42121    }
42122  }
42123
42124  protected void composeCapabilityStatementMessagingSupportedMessageComponentProperties(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
42125    composeBackboneElementProperties(element);
42126      if (element.hasModeElement()) {
42127        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
42128        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
42129      }
42130      if (element.hasDefinitionElement()) {
42131        composeCanonicalCore("definition", element.getDefinitionElement(), false);
42132        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
42133      }
42134  }
42135
42136  protected void composeCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
42137    if (element != null) {
42138      open(name);
42139      composeCapabilityStatementDocumentComponentProperties(element);
42140      close();
42141    }
42142  }
42143
42144  protected void composeCapabilityStatementDocumentComponentProperties(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
42145    composeBackboneElementProperties(element);
42146      if (element.hasModeElement()) {
42147        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
42148        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
42149      }
42150      if (element.hasDocumentationElement()) {
42151        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
42152        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
42153      }
42154      if (element.hasProfileElement()) {
42155        composeCanonicalCore("profile", element.getProfileElement(), false);
42156        composeCanonicalExtras("profile", element.getProfileElement(), false);
42157      }
42158  }
42159
42160  protected void composeCarePlan(String name, CarePlan element) throws IOException {
42161    if (element != null) {
42162      prop("resourceType", name);
42163      composeCarePlanProperties(element);
42164    }
42165  }
42166
42167  protected void composeCarePlanProperties(CarePlan element) throws IOException {
42168    composeDomainResourceProperties(element);
42169      if (element.hasIdentifier()) {
42170        openArray("identifier");
42171        for (Identifier e : element.getIdentifier()) 
42172          composeIdentifier(null, e);
42173        closeArray();
42174      };
42175      if (element.hasInstantiatesCanonical()) {
42176        if (anyHasValue(element.getInstantiatesCanonical())) {
42177          openArray("instantiatesCanonical");
42178          for (CanonicalType e : element.getInstantiatesCanonical()) 
42179            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
42180          closeArray();
42181        }
42182        if (anyHasExtras(element.getInstantiatesCanonical())) {
42183          openArray("_instantiatesCanonical");
42184          for (CanonicalType e : element.getInstantiatesCanonical()) 
42185            composeCanonicalExtras(null, e, true);
42186          closeArray();
42187        }
42188      };
42189      if (element.hasInstantiatesUri()) {
42190        if (anyHasValue(element.getInstantiatesUri())) {
42191          openArray("instantiatesUri");
42192          for (UriType e : element.getInstantiatesUri()) 
42193            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
42194          closeArray();
42195        }
42196        if (anyHasExtras(element.getInstantiatesUri())) {
42197          openArray("_instantiatesUri");
42198          for (UriType e : element.getInstantiatesUri()) 
42199            composeUriExtras(null, e, true);
42200          closeArray();
42201        }
42202      };
42203      if (element.hasBasedOn()) {
42204        openArray("basedOn");
42205        for (Reference e : element.getBasedOn()) 
42206          composeReference(null, e);
42207        closeArray();
42208      };
42209      if (element.hasReplaces()) {
42210        openArray("replaces");
42211        for (Reference e : element.getReplaces()) 
42212          composeReference(null, e);
42213        closeArray();
42214      };
42215      if (element.hasPartOf()) {
42216        openArray("partOf");
42217        for (Reference e : element.getPartOf()) 
42218          composeReference(null, e);
42219        closeArray();
42220      };
42221      if (element.hasStatusElement()) {
42222        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
42223        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
42224      }
42225      if (element.hasIntentElement()) {
42226        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
42227        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
42228      }
42229      if (element.hasCategory()) {
42230        openArray("category");
42231        for (CodeableConcept e : element.getCategory()) 
42232          composeCodeableConcept(null, e);
42233        closeArray();
42234      };
42235      if (element.hasTitleElement()) {
42236        composeStringCore("title", element.getTitleElement(), false);
42237        composeStringExtras("title", element.getTitleElement(), false);
42238      }
42239      if (element.hasDescriptionElement()) {
42240        composeStringCore("description", element.getDescriptionElement(), false);
42241        composeStringExtras("description", element.getDescriptionElement(), false);
42242      }
42243      if (element.hasSubject()) {
42244        composeReference("subject", element.getSubject());
42245      }
42246      if (element.hasEncounter()) {
42247        composeReference("encounter", element.getEncounter());
42248      }
42249      if (element.hasPeriod()) {
42250        composePeriod("period", element.getPeriod());
42251      }
42252      if (element.hasCreatedElement()) {
42253        composeDateTimeCore("created", element.getCreatedElement(), false);
42254        composeDateTimeExtras("created", element.getCreatedElement(), false);
42255      }
42256      if (element.hasCustodian()) {
42257        composeReference("custodian", element.getCustodian());
42258      }
42259      if (element.hasContributor()) {
42260        openArray("contributor");
42261        for (Reference e : element.getContributor()) 
42262          composeReference(null, e);
42263        closeArray();
42264      };
42265      if (element.hasCareTeam()) {
42266        openArray("careTeam");
42267        for (Reference e : element.getCareTeam()) 
42268          composeReference(null, e);
42269        closeArray();
42270      };
42271      if (element.hasAddresses()) {
42272        openArray("addresses");
42273        for (CodeableReference e : element.getAddresses()) 
42274          composeCodeableReference(null, e);
42275        closeArray();
42276      };
42277      if (element.hasSupportingInfo()) {
42278        openArray("supportingInfo");
42279        for (Reference e : element.getSupportingInfo()) 
42280          composeReference(null, e);
42281        closeArray();
42282      };
42283      if (element.hasGoal()) {
42284        openArray("goal");
42285        for (Reference e : element.getGoal()) 
42286          composeReference(null, e);
42287        closeArray();
42288      };
42289      if (element.hasActivity()) {
42290        openArray("activity");
42291        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
42292          composeCarePlanActivityComponent(null, e);
42293        closeArray();
42294      };
42295      if (element.hasNote()) {
42296        openArray("note");
42297        for (Annotation e : element.getNote()) 
42298          composeAnnotation(null, e);
42299        closeArray();
42300      };
42301  }
42302
42303  protected void composeCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
42304    if (element != null) {
42305      open(name);
42306      composeCarePlanActivityComponentProperties(element);
42307      close();
42308    }
42309  }
42310
42311  protected void composeCarePlanActivityComponentProperties(CarePlan.CarePlanActivityComponent element) throws IOException {
42312    composeBackboneElementProperties(element);
42313      if (element.hasPerformedActivity()) {
42314        openArray("performedActivity");
42315        for (CodeableReference e : element.getPerformedActivity()) 
42316          composeCodeableReference(null, e);
42317        closeArray();
42318      };
42319      if (element.hasProgress()) {
42320        openArray("progress");
42321        for (Annotation e : element.getProgress()) 
42322          composeAnnotation(null, e);
42323        closeArray();
42324      };
42325      if (element.hasPlannedActivityReference()) {
42326        composeReference("plannedActivityReference", element.getPlannedActivityReference());
42327      }
42328  }
42329
42330  protected void composeCareTeam(String name, CareTeam element) throws IOException {
42331    if (element != null) {
42332      prop("resourceType", name);
42333      composeCareTeamProperties(element);
42334    }
42335  }
42336
42337  protected void composeCareTeamProperties(CareTeam element) throws IOException {
42338    composeDomainResourceProperties(element);
42339      if (element.hasIdentifier()) {
42340        openArray("identifier");
42341        for (Identifier e : element.getIdentifier()) 
42342          composeIdentifier(null, e);
42343        closeArray();
42344      };
42345      if (element.hasStatusElement()) {
42346        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
42347        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
42348      }
42349      if (element.hasCategory()) {
42350        openArray("category");
42351        for (CodeableConcept e : element.getCategory()) 
42352          composeCodeableConcept(null, e);
42353        closeArray();
42354      };
42355      if (element.hasNameElement()) {
42356        composeStringCore("name", element.getNameElement(), false);
42357        composeStringExtras("name", element.getNameElement(), false);
42358      }
42359      if (element.hasSubject()) {
42360        composeReference("subject", element.getSubject());
42361      }
42362      if (element.hasPeriod()) {
42363        composePeriod("period", element.getPeriod());
42364      }
42365      if (element.hasParticipant()) {
42366        openArray("participant");
42367        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
42368          composeCareTeamParticipantComponent(null, e);
42369        closeArray();
42370      };
42371      if (element.hasReason()) {
42372        openArray("reason");
42373        for (CodeableReference e : element.getReason()) 
42374          composeCodeableReference(null, e);
42375        closeArray();
42376      };
42377      if (element.hasManagingOrganization()) {
42378        openArray("managingOrganization");
42379        for (Reference e : element.getManagingOrganization()) 
42380          composeReference(null, e);
42381        closeArray();
42382      };
42383      if (element.hasTelecom()) {
42384        openArray("telecom");
42385        for (ContactPoint e : element.getTelecom()) 
42386          composeContactPoint(null, e);
42387        closeArray();
42388      };
42389      if (element.hasNote()) {
42390        openArray("note");
42391        for (Annotation e : element.getNote()) 
42392          composeAnnotation(null, e);
42393        closeArray();
42394      };
42395  }
42396
42397  protected void composeCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
42398    if (element != null) {
42399      open(name);
42400      composeCareTeamParticipantComponentProperties(element);
42401      close();
42402    }
42403  }
42404
42405  protected void composeCareTeamParticipantComponentProperties(CareTeam.CareTeamParticipantComponent element) throws IOException {
42406    composeBackboneElementProperties(element);
42407      if (element.hasRole()) {
42408        composeCodeableConcept("role", element.getRole());
42409      }
42410      if (element.hasMember()) {
42411        composeReference("member", element.getMember());
42412      }
42413      if (element.hasOnBehalfOf()) {
42414        composeReference("onBehalfOf", element.getOnBehalfOf());
42415      }
42416      if (element.hasCoverage()) {
42417        composeType("coverage", element.getCoverage());
42418      }
42419  }
42420
42421  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
42422    if (element != null) {
42423      prop("resourceType", name);
42424      composeChargeItemProperties(element);
42425    }
42426  }
42427
42428  protected void composeChargeItemProperties(ChargeItem element) throws IOException {
42429    composeDomainResourceProperties(element);
42430      if (element.hasIdentifier()) {
42431        openArray("identifier");
42432        for (Identifier e : element.getIdentifier()) 
42433          composeIdentifier(null, e);
42434        closeArray();
42435      };
42436      if (element.hasDefinitionUri()) {
42437        if (anyHasValue(element.getDefinitionUri())) {
42438          openArray("definitionUri");
42439          for (UriType e : element.getDefinitionUri()) 
42440            composeUriCore(null, e, e != element.getDefinitionUri().get(element.getDefinitionUri().size()-1));
42441          closeArray();
42442        }
42443        if (anyHasExtras(element.getDefinitionUri())) {
42444          openArray("_definitionUri");
42445          for (UriType e : element.getDefinitionUri()) 
42446            composeUriExtras(null, e, true);
42447          closeArray();
42448        }
42449      };
42450      if (element.hasDefinitionCanonical()) {
42451        if (anyHasValue(element.getDefinitionCanonical())) {
42452          openArray("definitionCanonical");
42453          for (CanonicalType e : element.getDefinitionCanonical()) 
42454            composeCanonicalCore(null, e, e != element.getDefinitionCanonical().get(element.getDefinitionCanonical().size()-1));
42455          closeArray();
42456        }
42457        if (anyHasExtras(element.getDefinitionCanonical())) {
42458          openArray("_definitionCanonical");
42459          for (CanonicalType e : element.getDefinitionCanonical()) 
42460            composeCanonicalExtras(null, e, true);
42461          closeArray();
42462        }
42463      };
42464      if (element.hasStatusElement()) {
42465        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
42466        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
42467      }
42468      if (element.hasPartOf()) {
42469        openArray("partOf");
42470        for (Reference e : element.getPartOf()) 
42471          composeReference(null, e);
42472        closeArray();
42473      };
42474      if (element.hasCode()) {
42475        composeCodeableConcept("code", element.getCode());
42476      }
42477      if (element.hasSubject()) {
42478        composeReference("subject", element.getSubject());
42479      }
42480      if (element.hasEncounter()) {
42481        composeReference("encounter", element.getEncounter());
42482      }
42483      if (element.hasOccurrence()) {
42484        composeType("occurrence", element.getOccurrence());
42485      }
42486      if (element.hasPerformer()) {
42487        openArray("performer");
42488        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
42489          composeChargeItemPerformerComponent(null, e);
42490        closeArray();
42491      };
42492      if (element.hasPerformingOrganization()) {
42493        composeReference("performingOrganization", element.getPerformingOrganization());
42494      }
42495      if (element.hasRequestingOrganization()) {
42496        composeReference("requestingOrganization", element.getRequestingOrganization());
42497      }
42498      if (element.hasCostCenter()) {
42499        composeReference("costCenter", element.getCostCenter());
42500      }
42501      if (element.hasQuantity()) {
42502        composeQuantity("quantity", element.getQuantity());
42503      }
42504      if (element.hasBodysite()) {
42505        openArray("bodysite");
42506        for (CodeableConcept e : element.getBodysite()) 
42507          composeCodeableConcept(null, e);
42508        closeArray();
42509      };
42510      if (element.hasUnitPriceComponent()) {
42511        composeMonetaryComponent("unitPriceComponent", element.getUnitPriceComponent());
42512      }
42513      if (element.hasTotalPriceComponent()) {
42514        composeMonetaryComponent("totalPriceComponent", element.getTotalPriceComponent());
42515      }
42516      if (element.hasOverrideReason()) {
42517        composeCodeableConcept("overrideReason", element.getOverrideReason());
42518      }
42519      if (element.hasEnterer()) {
42520        composeReference("enterer", element.getEnterer());
42521      }
42522      if (element.hasEnteredDateElement()) {
42523        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
42524        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
42525      }
42526      if (element.hasReason()) {
42527        openArray("reason");
42528        for (CodeableConcept e : element.getReason()) 
42529          composeCodeableConcept(null, e);
42530        closeArray();
42531      };
42532      if (element.hasService()) {
42533        openArray("service");
42534        for (CodeableReference e : element.getService()) 
42535          composeCodeableReference(null, e);
42536        closeArray();
42537      };
42538      if (element.hasProduct()) {
42539        openArray("product");
42540        for (CodeableReference e : element.getProduct()) 
42541          composeCodeableReference(null, e);
42542        closeArray();
42543      };
42544      if (element.hasAccount()) {
42545        openArray("account");
42546        for (Reference e : element.getAccount()) 
42547          composeReference(null, e);
42548        closeArray();
42549      };
42550      if (element.hasNote()) {
42551        openArray("note");
42552        for (Annotation e : element.getNote()) 
42553          composeAnnotation(null, e);
42554        closeArray();
42555      };
42556      if (element.hasSupportingInformation()) {
42557        openArray("supportingInformation");
42558        for (Reference e : element.getSupportingInformation()) 
42559          composeReference(null, e);
42560        closeArray();
42561      };
42562  }
42563
42564  protected void composeChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
42565    if (element != null) {
42566      open(name);
42567      composeChargeItemPerformerComponentProperties(element);
42568      close();
42569    }
42570  }
42571
42572  protected void composeChargeItemPerformerComponentProperties(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
42573    composeBackboneElementProperties(element);
42574      if (element.hasFunction()) {
42575        composeCodeableConcept("function", element.getFunction());
42576      }
42577      if (element.hasActor()) {
42578        composeReference("actor", element.getActor());
42579      }
42580  }
42581
42582  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
42583    if (element != null) {
42584      prop("resourceType", name);
42585      composeChargeItemDefinitionProperties(element);
42586    }
42587  }
42588
42589  protected void composeChargeItemDefinitionProperties(ChargeItemDefinition element) throws IOException {
42590    composeMetadataResourceProperties(element);
42591      if (element.hasUrlElement()) {
42592        composeUriCore("url", element.getUrlElement(), false);
42593        composeUriExtras("url", element.getUrlElement(), false);
42594      }
42595      if (element.hasIdentifier()) {
42596        openArray("identifier");
42597        for (Identifier e : element.getIdentifier()) 
42598          composeIdentifier(null, e);
42599        closeArray();
42600      };
42601      if (element.hasVersionElement()) {
42602        composeStringCore("version", element.getVersionElement(), false);
42603        composeStringExtras("version", element.getVersionElement(), false);
42604      }
42605      if (element.hasVersionAlgorithm()) {
42606        composeType("versionAlgorithm", element.getVersionAlgorithm());
42607      }
42608      if (element.hasNameElement()) {
42609        composeStringCore("name", element.getNameElement(), false);
42610        composeStringExtras("name", element.getNameElement(), false);
42611      }
42612      if (element.hasTitleElement()) {
42613        composeStringCore("title", element.getTitleElement(), false);
42614        composeStringExtras("title", element.getTitleElement(), false);
42615      }
42616      if (element.hasDerivedFromUri()) {
42617        if (anyHasValue(element.getDerivedFromUri())) {
42618          openArray("derivedFromUri");
42619          for (UriType e : element.getDerivedFromUri()) 
42620            composeUriCore(null, e, e != element.getDerivedFromUri().get(element.getDerivedFromUri().size()-1));
42621          closeArray();
42622        }
42623        if (anyHasExtras(element.getDerivedFromUri())) {
42624          openArray("_derivedFromUri");
42625          for (UriType e : element.getDerivedFromUri()) 
42626            composeUriExtras(null, e, true);
42627          closeArray();
42628        }
42629      };
42630      if (element.hasPartOf()) {
42631        if (anyHasValue(element.getPartOf())) {
42632          openArray("partOf");
42633          for (CanonicalType e : element.getPartOf()) 
42634            composeCanonicalCore(null, e, e != element.getPartOf().get(element.getPartOf().size()-1));
42635          closeArray();
42636        }
42637        if (anyHasExtras(element.getPartOf())) {
42638          openArray("_partOf");
42639          for (CanonicalType e : element.getPartOf()) 
42640            composeCanonicalExtras(null, e, true);
42641          closeArray();
42642        }
42643      };
42644      if (element.hasReplaces()) {
42645        if (anyHasValue(element.getReplaces())) {
42646          openArray("replaces");
42647          for (CanonicalType e : element.getReplaces()) 
42648            composeCanonicalCore(null, e, e != element.getReplaces().get(element.getReplaces().size()-1));
42649          closeArray();
42650        }
42651        if (anyHasExtras(element.getReplaces())) {
42652          openArray("_replaces");
42653          for (CanonicalType e : element.getReplaces()) 
42654            composeCanonicalExtras(null, e, true);
42655          closeArray();
42656        }
42657      };
42658      if (element.hasStatusElement()) {
42659        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42660        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42661      }
42662      if (element.hasExperimentalElement()) {
42663        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42664        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42665      }
42666      if (element.hasDateElement()) {
42667        composeDateTimeCore("date", element.getDateElement(), false);
42668        composeDateTimeExtras("date", element.getDateElement(), false);
42669      }
42670      if (element.hasPublisherElement()) {
42671        composeStringCore("publisher", element.getPublisherElement(), false);
42672        composeStringExtras("publisher", element.getPublisherElement(), false);
42673      }
42674      if (element.hasContact()) {
42675        openArray("contact");
42676        for (ContactDetail e : element.getContact()) 
42677          composeContactDetail(null, e);
42678        closeArray();
42679      };
42680      if (element.hasDescriptionElement()) {
42681        composeMarkdownCore("description", element.getDescriptionElement(), false);
42682        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42683      }
42684      if (element.hasUseContext()) {
42685        openArray("useContext");
42686        for (UsageContext e : element.getUseContext()) 
42687          composeUsageContext(null, e);
42688        closeArray();
42689      };
42690      if (element.hasJurisdiction()) {
42691        openArray("jurisdiction");
42692        for (CodeableConcept e : element.getJurisdiction()) 
42693          composeCodeableConcept(null, e);
42694        closeArray();
42695      };
42696      if (element.hasPurposeElement()) {
42697        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42698        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42699      }
42700      if (element.hasCopyrightElement()) {
42701        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42702        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42703      }
42704      if (element.hasCopyrightLabelElement()) {
42705        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
42706        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
42707      }
42708      if (element.hasApprovalDateElement()) {
42709        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42710        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42711      }
42712      if (element.hasLastReviewDateElement()) {
42713        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42714        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42715      }
42716      if (element.hasCode()) {
42717        composeCodeableConcept("code", element.getCode());
42718      }
42719      if (element.hasInstance()) {
42720        openArray("instance");
42721        for (Reference e : element.getInstance()) 
42722          composeReference(null, e);
42723        closeArray();
42724      };
42725      if (element.hasApplicability()) {
42726        openArray("applicability");
42727        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
42728          composeChargeItemDefinitionApplicabilityComponent(null, e);
42729        closeArray();
42730      };
42731      if (element.hasPropertyGroup()) {
42732        openArray("propertyGroup");
42733        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
42734          composeChargeItemDefinitionPropertyGroupComponent(null, e);
42735        closeArray();
42736      };
42737  }
42738
42739  protected void composeChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
42740    if (element != null) {
42741      open(name);
42742      composeChargeItemDefinitionApplicabilityComponentProperties(element);
42743      close();
42744    }
42745  }
42746
42747  protected void composeChargeItemDefinitionApplicabilityComponentProperties(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
42748    composeBackboneElementProperties(element);
42749      if (element.hasCondition()) {
42750        composeExpression("condition", element.getCondition());
42751      }
42752      if (element.hasEffectivePeriod()) {
42753        composePeriod("effectivePeriod", element.getEffectivePeriod());
42754      }
42755      if (element.hasRelatedArtifact()) {
42756        composeRelatedArtifact("relatedArtifact", element.getRelatedArtifact());
42757      }
42758  }
42759
42760  protected void composeChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
42761    if (element != null) {
42762      open(name);
42763      composeChargeItemDefinitionPropertyGroupComponentProperties(element);
42764      close();
42765    }
42766  }
42767
42768  protected void composeChargeItemDefinitionPropertyGroupComponentProperties(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
42769    composeBackboneElementProperties(element);
42770      if (element.hasApplicability()) {
42771        openArray("applicability");
42772        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
42773          composeChargeItemDefinitionApplicabilityComponent(null, e);
42774        closeArray();
42775      };
42776      if (element.hasPriceComponent()) {
42777        openArray("priceComponent");
42778        for (MonetaryComponent e : element.getPriceComponent()) 
42779          composeMonetaryComponent(null, e);
42780        closeArray();
42781      };
42782  }
42783
42784  protected void composeCitation(String name, Citation element) throws IOException {
42785    if (element != null) {
42786      prop("resourceType", name);
42787      composeCitationProperties(element);
42788    }
42789  }
42790
42791  protected void composeCitationProperties(Citation element) throws IOException {
42792    composeMetadataResourceProperties(element);
42793      if (element.hasUrlElement()) {
42794        composeUriCore("url", element.getUrlElement(), false);
42795        composeUriExtras("url", element.getUrlElement(), false);
42796      }
42797      if (element.hasIdentifier()) {
42798        openArray("identifier");
42799        for (Identifier e : element.getIdentifier()) 
42800          composeIdentifier(null, e);
42801        closeArray();
42802      };
42803      if (element.hasVersionElement()) {
42804        composeStringCore("version", element.getVersionElement(), false);
42805        composeStringExtras("version", element.getVersionElement(), false);
42806      }
42807      if (element.hasVersionAlgorithm()) {
42808        composeType("versionAlgorithm", element.getVersionAlgorithm());
42809      }
42810      if (element.hasNameElement()) {
42811        composeStringCore("name", element.getNameElement(), false);
42812        composeStringExtras("name", element.getNameElement(), false);
42813      }
42814      if (element.hasTitleElement()) {
42815        composeStringCore("title", element.getTitleElement(), false);
42816        composeStringExtras("title", element.getTitleElement(), false);
42817      }
42818      if (element.hasStatusElement()) {
42819        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42820        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42821      }
42822      if (element.hasExperimentalElement()) {
42823        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42824        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42825      }
42826      if (element.hasDateElement()) {
42827        composeDateTimeCore("date", element.getDateElement(), false);
42828        composeDateTimeExtras("date", element.getDateElement(), false);
42829      }
42830      if (element.hasPublisherElement()) {
42831        composeStringCore("publisher", element.getPublisherElement(), false);
42832        composeStringExtras("publisher", element.getPublisherElement(), false);
42833      }
42834      if (element.hasContact()) {
42835        openArray("contact");
42836        for (ContactDetail e : element.getContact()) 
42837          composeContactDetail(null, e);
42838        closeArray();
42839      };
42840      if (element.hasDescriptionElement()) {
42841        composeMarkdownCore("description", element.getDescriptionElement(), false);
42842        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42843      }
42844      if (element.hasUseContext()) {
42845        openArray("useContext");
42846        for (UsageContext e : element.getUseContext()) 
42847          composeUsageContext(null, e);
42848        closeArray();
42849      };
42850      if (element.hasJurisdiction()) {
42851        openArray("jurisdiction");
42852        for (CodeableConcept e : element.getJurisdiction()) 
42853          composeCodeableConcept(null, e);
42854        closeArray();
42855      };
42856      if (element.hasPurposeElement()) {
42857        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42858        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42859      }
42860      if (element.hasCopyrightElement()) {
42861        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42862        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42863      }
42864      if (element.hasCopyrightLabelElement()) {
42865        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
42866        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
42867      }
42868      if (element.hasApprovalDateElement()) {
42869        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42870        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42871      }
42872      if (element.hasLastReviewDateElement()) {
42873        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42874        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42875      }
42876      if (element.hasEffectivePeriod()) {
42877        composePeriod("effectivePeriod", element.getEffectivePeriod());
42878      }
42879      if (element.hasAuthor()) {
42880        openArray("author");
42881        for (ContactDetail e : element.getAuthor()) 
42882          composeContactDetail(null, e);
42883        closeArray();
42884      };
42885      if (element.hasEditor()) {
42886        openArray("editor");
42887        for (ContactDetail e : element.getEditor()) 
42888          composeContactDetail(null, e);
42889        closeArray();
42890      };
42891      if (element.hasReviewer()) {
42892        openArray("reviewer");
42893        for (ContactDetail e : element.getReviewer()) 
42894          composeContactDetail(null, e);
42895        closeArray();
42896      };
42897      if (element.hasEndorser()) {
42898        openArray("endorser");
42899        for (ContactDetail e : element.getEndorser()) 
42900          composeContactDetail(null, e);
42901        closeArray();
42902      };
42903      if (element.hasSummary()) {
42904        openArray("summary");
42905        for (Citation.CitationSummaryComponent e : element.getSummary()) 
42906          composeCitationSummaryComponent(null, e);
42907        closeArray();
42908      };
42909      if (element.hasClassification()) {
42910        openArray("classification");
42911        for (Citation.CitationClassificationComponent e : element.getClassification()) 
42912          composeCitationClassificationComponent(null, e);
42913        closeArray();
42914      };
42915      if (element.hasNote()) {
42916        openArray("note");
42917        for (Annotation e : element.getNote()) 
42918          composeAnnotation(null, e);
42919        closeArray();
42920      };
42921      if (element.hasCurrentState()) {
42922        openArray("currentState");
42923        for (CodeableConcept e : element.getCurrentState()) 
42924          composeCodeableConcept(null, e);
42925        closeArray();
42926      };
42927      if (element.hasStatusDate()) {
42928        openArray("statusDate");
42929        for (Citation.CitationStatusDateComponent e : element.getStatusDate()) 
42930          composeCitationStatusDateComponent(null, e);
42931        closeArray();
42932      };
42933      if (element.hasRelatedArtifact()) {
42934        openArray("relatedArtifact");
42935        for (RelatedArtifact e : element.getRelatedArtifact()) 
42936          composeRelatedArtifact(null, e);
42937        closeArray();
42938      };
42939      if (element.hasCitedArtifact()) {
42940        composeCitationCitedArtifactComponent("citedArtifact", element.getCitedArtifact());
42941      }
42942  }
42943
42944  protected void composeCitationSummaryComponent(String name, Citation.CitationSummaryComponent element) throws IOException {
42945    if (element != null) {
42946      open(name);
42947      composeCitationSummaryComponentProperties(element);
42948      close();
42949    }
42950  }
42951
42952  protected void composeCitationSummaryComponentProperties(Citation.CitationSummaryComponent element) throws IOException {
42953    composeBackboneElementProperties(element);
42954      if (element.hasStyle()) {
42955        composeCodeableConcept("style", element.getStyle());
42956      }
42957      if (element.hasTextElement()) {
42958        composeMarkdownCore("text", element.getTextElement(), false);
42959        composeMarkdownExtras("text", element.getTextElement(), false);
42960      }
42961  }
42962
42963  protected void composeCitationClassificationComponent(String name, Citation.CitationClassificationComponent element) throws IOException {
42964    if (element != null) {
42965      open(name);
42966      composeCitationClassificationComponentProperties(element);
42967      close();
42968    }
42969  }
42970
42971  protected void composeCitationClassificationComponentProperties(Citation.CitationClassificationComponent element) throws IOException {
42972    composeBackboneElementProperties(element);
42973      if (element.hasType()) {
42974        composeCodeableConcept("type", element.getType());
42975      }
42976      if (element.hasClassifier()) {
42977        openArray("classifier");
42978        for (CodeableConcept e : element.getClassifier()) 
42979          composeCodeableConcept(null, e);
42980        closeArray();
42981      };
42982  }
42983
42984  protected void composeCitationStatusDateComponent(String name, Citation.CitationStatusDateComponent element) throws IOException {
42985    if (element != null) {
42986      open(name);
42987      composeCitationStatusDateComponentProperties(element);
42988      close();
42989    }
42990  }
42991
42992  protected void composeCitationStatusDateComponentProperties(Citation.CitationStatusDateComponent element) throws IOException {
42993    composeBackboneElementProperties(element);
42994      if (element.hasActivity()) {
42995        composeCodeableConcept("activity", element.getActivity());
42996      }
42997      if (element.hasActualElement()) {
42998        composeBooleanCore("actual", element.getActualElement(), false);
42999        composeBooleanExtras("actual", element.getActualElement(), false);
43000      }
43001      if (element.hasPeriod()) {
43002        composePeriod("period", element.getPeriod());
43003      }
43004  }
43005
43006  protected void composeCitationCitedArtifactComponent(String name, Citation.CitationCitedArtifactComponent element) throws IOException {
43007    if (element != null) {
43008      open(name);
43009      composeCitationCitedArtifactComponentProperties(element);
43010      close();
43011    }
43012  }
43013
43014  protected void composeCitationCitedArtifactComponentProperties(Citation.CitationCitedArtifactComponent element) throws IOException {
43015    composeBackboneElementProperties(element);
43016      if (element.hasIdentifier()) {
43017        openArray("identifier");
43018        for (Identifier e : element.getIdentifier()) 
43019          composeIdentifier(null, e);
43020        closeArray();
43021      };
43022      if (element.hasRelatedIdentifier()) {
43023        openArray("relatedIdentifier");
43024        for (Identifier e : element.getRelatedIdentifier()) 
43025          composeIdentifier(null, e);
43026        closeArray();
43027      };
43028      if (element.hasDateAccessedElement()) {
43029        composeDateTimeCore("dateAccessed", element.getDateAccessedElement(), false);
43030        composeDateTimeExtras("dateAccessed", element.getDateAccessedElement(), false);
43031      }
43032      if (element.hasVersion()) {
43033        composeCitationCitedArtifactVersionComponent("version", element.getVersion());
43034      }
43035      if (element.hasCurrentState()) {
43036        openArray("currentState");
43037        for (CodeableConcept e : element.getCurrentState()) 
43038          composeCodeableConcept(null, e);
43039        closeArray();
43040      };
43041      if (element.hasStatusDate()) {
43042        openArray("statusDate");
43043        for (Citation.CitationCitedArtifactStatusDateComponent e : element.getStatusDate()) 
43044          composeCitationCitedArtifactStatusDateComponent(null, e);
43045        closeArray();
43046      };
43047      if (element.hasTitle()) {
43048        openArray("title");
43049        for (Citation.CitationCitedArtifactTitleComponent e : element.getTitle()) 
43050          composeCitationCitedArtifactTitleComponent(null, e);
43051        closeArray();
43052      };
43053      if (element.hasAbstract()) {
43054        openArray("abstract");
43055        for (Citation.CitationCitedArtifactAbstractComponent e : element.getAbstract()) 
43056          composeCitationCitedArtifactAbstractComponent(null, e);
43057        closeArray();
43058      };
43059      if (element.hasPart()) {
43060        composeCitationCitedArtifactPartComponent("part", element.getPart());
43061      }
43062      if (element.hasRelatesTo()) {
43063        openArray("relatesTo");
43064        for (Citation.CitationCitedArtifactRelatesToComponent e : element.getRelatesTo()) 
43065          composeCitationCitedArtifactRelatesToComponent(null, e);
43066        closeArray();
43067      };
43068      if (element.hasPublicationForm()) {
43069        openArray("publicationForm");
43070        for (Citation.CitationCitedArtifactPublicationFormComponent e : element.getPublicationForm()) 
43071          composeCitationCitedArtifactPublicationFormComponent(null, e);
43072        closeArray();
43073      };
43074      if (element.hasWebLocation()) {
43075        openArray("webLocation");
43076        for (Citation.CitationCitedArtifactWebLocationComponent e : element.getWebLocation()) 
43077          composeCitationCitedArtifactWebLocationComponent(null, e);
43078        closeArray();
43079      };
43080      if (element.hasClassification()) {
43081        openArray("classification");
43082        for (Citation.CitationCitedArtifactClassificationComponent e : element.getClassification()) 
43083          composeCitationCitedArtifactClassificationComponent(null, e);
43084        closeArray();
43085      };
43086      if (element.hasContributorship()) {
43087        composeCitationCitedArtifactContributorshipComponent("contributorship", element.getContributorship());
43088      }
43089      if (element.hasNote()) {
43090        openArray("note");
43091        for (Annotation e : element.getNote()) 
43092          composeAnnotation(null, e);
43093        closeArray();
43094      };
43095  }
43096
43097  protected void composeCitationCitedArtifactVersionComponent(String name, Citation.CitationCitedArtifactVersionComponent element) throws IOException {
43098    if (element != null) {
43099      open(name);
43100      composeCitationCitedArtifactVersionComponentProperties(element);
43101      close();
43102    }
43103  }
43104
43105  protected void composeCitationCitedArtifactVersionComponentProperties(Citation.CitationCitedArtifactVersionComponent element) throws IOException {
43106    composeBackboneElementProperties(element);
43107      if (element.hasValueElement()) {
43108        composeStringCore("value", element.getValueElement(), false);
43109        composeStringExtras("value", element.getValueElement(), false);
43110      }
43111      if (element.hasBaseCitation()) {
43112        composeReference("baseCitation", element.getBaseCitation());
43113      }
43114  }
43115
43116  protected void composeCitationCitedArtifactStatusDateComponent(String name, Citation.CitationCitedArtifactStatusDateComponent element) throws IOException {
43117    if (element != null) {
43118      open(name);
43119      composeCitationCitedArtifactStatusDateComponentProperties(element);
43120      close();
43121    }
43122  }
43123
43124  protected void composeCitationCitedArtifactStatusDateComponentProperties(Citation.CitationCitedArtifactStatusDateComponent element) throws IOException {
43125    composeBackboneElementProperties(element);
43126      if (element.hasActivity()) {
43127        composeCodeableConcept("activity", element.getActivity());
43128      }
43129      if (element.hasActualElement()) {
43130        composeBooleanCore("actual", element.getActualElement(), false);
43131        composeBooleanExtras("actual", element.getActualElement(), false);
43132      }
43133      if (element.hasPeriod()) {
43134        composePeriod("period", element.getPeriod());
43135      }
43136  }
43137
43138  protected void composeCitationCitedArtifactTitleComponent(String name, Citation.CitationCitedArtifactTitleComponent element) throws IOException {
43139    if (element != null) {
43140      open(name);
43141      composeCitationCitedArtifactTitleComponentProperties(element);
43142      close();
43143    }
43144  }
43145
43146  protected void composeCitationCitedArtifactTitleComponentProperties(Citation.CitationCitedArtifactTitleComponent element) throws IOException {
43147    composeBackboneElementProperties(element);
43148      if (element.hasType()) {
43149        openArray("type");
43150        for (CodeableConcept e : element.getType()) 
43151          composeCodeableConcept(null, e);
43152        closeArray();
43153      };
43154      if (element.hasLanguage()) {
43155        composeCodeableConcept("language", element.getLanguage());
43156      }
43157      if (element.hasTextElement()) {
43158        composeMarkdownCore("text", element.getTextElement(), false);
43159        composeMarkdownExtras("text", element.getTextElement(), false);
43160      }
43161  }
43162
43163  protected void composeCitationCitedArtifactAbstractComponent(String name, Citation.CitationCitedArtifactAbstractComponent element) throws IOException {
43164    if (element != null) {
43165      open(name);
43166      composeCitationCitedArtifactAbstractComponentProperties(element);
43167      close();
43168    }
43169  }
43170
43171  protected void composeCitationCitedArtifactAbstractComponentProperties(Citation.CitationCitedArtifactAbstractComponent element) throws IOException {
43172    composeBackboneElementProperties(element);
43173      if (element.hasType()) {
43174        composeCodeableConcept("type", element.getType());
43175      }
43176      if (element.hasLanguage()) {
43177        composeCodeableConcept("language", element.getLanguage());
43178      }
43179      if (element.hasTextElement()) {
43180        composeMarkdownCore("text", element.getTextElement(), false);
43181        composeMarkdownExtras("text", element.getTextElement(), false);
43182      }
43183      if (element.hasCopyrightElement()) {
43184        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43185        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43186      }
43187  }
43188
43189  protected void composeCitationCitedArtifactPartComponent(String name, Citation.CitationCitedArtifactPartComponent element) throws IOException {
43190    if (element != null) {
43191      open(name);
43192      composeCitationCitedArtifactPartComponentProperties(element);
43193      close();
43194    }
43195  }
43196
43197  protected void composeCitationCitedArtifactPartComponentProperties(Citation.CitationCitedArtifactPartComponent element) throws IOException {
43198    composeBackboneElementProperties(element);
43199      if (element.hasType()) {
43200        composeCodeableConcept("type", element.getType());
43201      }
43202      if (element.hasValueElement()) {
43203        composeStringCore("value", element.getValueElement(), false);
43204        composeStringExtras("value", element.getValueElement(), false);
43205      }
43206      if (element.hasBaseCitation()) {
43207        composeReference("baseCitation", element.getBaseCitation());
43208      }
43209  }
43210
43211  protected void composeCitationCitedArtifactRelatesToComponent(String name, Citation.CitationCitedArtifactRelatesToComponent element) throws IOException {
43212    if (element != null) {
43213      open(name);
43214      composeCitationCitedArtifactRelatesToComponentProperties(element);
43215      close();
43216    }
43217  }
43218
43219  protected void composeCitationCitedArtifactRelatesToComponentProperties(Citation.CitationCitedArtifactRelatesToComponent element) throws IOException {
43220    composeBackboneElementProperties(element);
43221      if (element.hasTypeElement()) {
43222        composeEnumerationCore("type", element.getTypeElement(), new Citation.RelatedArtifactTypeExpandedEnumFactory(), false);
43223        composeEnumerationExtras("type", element.getTypeElement(), new Citation.RelatedArtifactTypeExpandedEnumFactory(), false);
43224      }
43225      if (element.hasClassifier()) {
43226        openArray("classifier");
43227        for (CodeableConcept e : element.getClassifier()) 
43228          composeCodeableConcept(null, e);
43229        closeArray();
43230      };
43231      if (element.hasLabelElement()) {
43232        composeStringCore("label", element.getLabelElement(), false);
43233        composeStringExtras("label", element.getLabelElement(), false);
43234      }
43235      if (element.hasDisplayElement()) {
43236        composeStringCore("display", element.getDisplayElement(), false);
43237        composeStringExtras("display", element.getDisplayElement(), false);
43238      }
43239      if (element.hasCitationElement()) {
43240        composeMarkdownCore("citation", element.getCitationElement(), false);
43241        composeMarkdownExtras("citation", element.getCitationElement(), false);
43242      }
43243      if (element.hasDocument()) {
43244        composeAttachment("document", element.getDocument());
43245      }
43246      if (element.hasResourceElement()) {
43247        composeCanonicalCore("resource", element.getResourceElement(), false);
43248        composeCanonicalExtras("resource", element.getResourceElement(), false);
43249      }
43250      if (element.hasResourceReference()) {
43251        composeReference("resourceReference", element.getResourceReference());
43252      }
43253  }
43254
43255  protected void composeCitationCitedArtifactPublicationFormComponent(String name, Citation.CitationCitedArtifactPublicationFormComponent element) throws IOException {
43256    if (element != null) {
43257      open(name);
43258      composeCitationCitedArtifactPublicationFormComponentProperties(element);
43259      close();
43260    }
43261  }
43262
43263  protected void composeCitationCitedArtifactPublicationFormComponentProperties(Citation.CitationCitedArtifactPublicationFormComponent element) throws IOException {
43264    composeBackboneElementProperties(element);
43265      if (element.hasPublishedIn()) {
43266        composeCitationCitedArtifactPublicationFormPublishedInComponent("publishedIn", element.getPublishedIn());
43267      }
43268      if (element.hasCitedMedium()) {
43269        composeCodeableConcept("citedMedium", element.getCitedMedium());
43270      }
43271      if (element.hasVolumeElement()) {
43272        composeStringCore("volume", element.getVolumeElement(), false);
43273        composeStringExtras("volume", element.getVolumeElement(), false);
43274      }
43275      if (element.hasIssueElement()) {
43276        composeStringCore("issue", element.getIssueElement(), false);
43277        composeStringExtras("issue", element.getIssueElement(), false);
43278      }
43279      if (element.hasArticleDateElement()) {
43280        composeDateTimeCore("articleDate", element.getArticleDateElement(), false);
43281        composeDateTimeExtras("articleDate", element.getArticleDateElement(), false);
43282      }
43283      if (element.hasPublicationDateTextElement()) {
43284        composeStringCore("publicationDateText", element.getPublicationDateTextElement(), false);
43285        composeStringExtras("publicationDateText", element.getPublicationDateTextElement(), false);
43286      }
43287      if (element.hasPublicationDateSeasonElement()) {
43288        composeStringCore("publicationDateSeason", element.getPublicationDateSeasonElement(), false);
43289        composeStringExtras("publicationDateSeason", element.getPublicationDateSeasonElement(), false);
43290      }
43291      if (element.hasLastRevisionDateElement()) {
43292        composeDateTimeCore("lastRevisionDate", element.getLastRevisionDateElement(), false);
43293        composeDateTimeExtras("lastRevisionDate", element.getLastRevisionDateElement(), false);
43294      }
43295      if (element.hasLanguage()) {
43296        openArray("language");
43297        for (CodeableConcept e : element.getLanguage()) 
43298          composeCodeableConcept(null, e);
43299        closeArray();
43300      };
43301      if (element.hasAccessionNumberElement()) {
43302        composeStringCore("accessionNumber", element.getAccessionNumberElement(), false);
43303        composeStringExtras("accessionNumber", element.getAccessionNumberElement(), false);
43304      }
43305      if (element.hasPageStringElement()) {
43306        composeStringCore("pageString", element.getPageStringElement(), false);
43307        composeStringExtras("pageString", element.getPageStringElement(), false);
43308      }
43309      if (element.hasFirstPageElement()) {
43310        composeStringCore("firstPage", element.getFirstPageElement(), false);
43311        composeStringExtras("firstPage", element.getFirstPageElement(), false);
43312      }
43313      if (element.hasLastPageElement()) {
43314        composeStringCore("lastPage", element.getLastPageElement(), false);
43315        composeStringExtras("lastPage", element.getLastPageElement(), false);
43316      }
43317      if (element.hasPageCountElement()) {
43318        composeStringCore("pageCount", element.getPageCountElement(), false);
43319        composeStringExtras("pageCount", element.getPageCountElement(), false);
43320      }
43321      if (element.hasCopyrightElement()) {
43322        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43323        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43324      }
43325  }
43326
43327  protected void composeCitationCitedArtifactPublicationFormPublishedInComponent(String name, Citation.CitationCitedArtifactPublicationFormPublishedInComponent element) throws IOException {
43328    if (element != null) {
43329      open(name);
43330      composeCitationCitedArtifactPublicationFormPublishedInComponentProperties(element);
43331      close();
43332    }
43333  }
43334
43335  protected void composeCitationCitedArtifactPublicationFormPublishedInComponentProperties(Citation.CitationCitedArtifactPublicationFormPublishedInComponent element) throws IOException {
43336    composeBackboneElementProperties(element);
43337      if (element.hasType()) {
43338        composeCodeableConcept("type", element.getType());
43339      }
43340      if (element.hasIdentifier()) {
43341        openArray("identifier");
43342        for (Identifier e : element.getIdentifier()) 
43343          composeIdentifier(null, e);
43344        closeArray();
43345      };
43346      if (element.hasTitleElement()) {
43347        composeStringCore("title", element.getTitleElement(), false);
43348        composeStringExtras("title", element.getTitleElement(), false);
43349      }
43350      if (element.hasPublisher()) {
43351        composeReference("publisher", element.getPublisher());
43352      }
43353      if (element.hasPublisherLocationElement()) {
43354        composeStringCore("publisherLocation", element.getPublisherLocationElement(), false);
43355        composeStringExtras("publisherLocation", element.getPublisherLocationElement(), false);
43356      }
43357  }
43358
43359  protected void composeCitationCitedArtifactWebLocationComponent(String name, Citation.CitationCitedArtifactWebLocationComponent element) throws IOException {
43360    if (element != null) {
43361      open(name);
43362      composeCitationCitedArtifactWebLocationComponentProperties(element);
43363      close();
43364    }
43365  }
43366
43367  protected void composeCitationCitedArtifactWebLocationComponentProperties(Citation.CitationCitedArtifactWebLocationComponent element) throws IOException {
43368    composeBackboneElementProperties(element);
43369      if (element.hasClassifier()) {
43370        openArray("classifier");
43371        for (CodeableConcept e : element.getClassifier()) 
43372          composeCodeableConcept(null, e);
43373        closeArray();
43374      };
43375      if (element.hasUrlElement()) {
43376        composeUriCore("url", element.getUrlElement(), false);
43377        composeUriExtras("url", element.getUrlElement(), false);
43378      }
43379  }
43380
43381  protected void composeCitationCitedArtifactClassificationComponent(String name, Citation.CitationCitedArtifactClassificationComponent element) throws IOException {
43382    if (element != null) {
43383      open(name);
43384      composeCitationCitedArtifactClassificationComponentProperties(element);
43385      close();
43386    }
43387  }
43388
43389  protected void composeCitationCitedArtifactClassificationComponentProperties(Citation.CitationCitedArtifactClassificationComponent element) throws IOException {
43390    composeBackboneElementProperties(element);
43391      if (element.hasType()) {
43392        composeCodeableConcept("type", element.getType());
43393      }
43394      if (element.hasClassifier()) {
43395        openArray("classifier");
43396        for (CodeableConcept e : element.getClassifier()) 
43397          composeCodeableConcept(null, e);
43398        closeArray();
43399      };
43400      if (element.hasArtifactAssessment()) {
43401        openArray("artifactAssessment");
43402        for (Reference e : element.getArtifactAssessment()) 
43403          composeReference(null, e);
43404        closeArray();
43405      };
43406  }
43407
43408  protected void composeCitationCitedArtifactContributorshipComponent(String name, Citation.CitationCitedArtifactContributorshipComponent element) throws IOException {
43409    if (element != null) {
43410      open(name);
43411      composeCitationCitedArtifactContributorshipComponentProperties(element);
43412      close();
43413    }
43414  }
43415
43416  protected void composeCitationCitedArtifactContributorshipComponentProperties(Citation.CitationCitedArtifactContributorshipComponent element) throws IOException {
43417    composeBackboneElementProperties(element);
43418      if (element.hasCompleteElement()) {
43419        composeBooleanCore("complete", element.getCompleteElement(), false);
43420        composeBooleanExtras("complete", element.getCompleteElement(), false);
43421      }
43422      if (element.hasEntry()) {
43423        openArray("entry");
43424        for (Citation.CitationCitedArtifactContributorshipEntryComponent e : element.getEntry()) 
43425          composeCitationCitedArtifactContributorshipEntryComponent(null, e);
43426        closeArray();
43427      };
43428      if (element.hasSummary()) {
43429        openArray("summary");
43430        for (Citation.ContributorshipSummaryComponent e : element.getSummary()) 
43431          composeContributorshipSummaryComponent(null, e);
43432        closeArray();
43433      };
43434  }
43435
43436  protected void composeCitationCitedArtifactContributorshipEntryComponent(String name, Citation.CitationCitedArtifactContributorshipEntryComponent element) throws IOException {
43437    if (element != null) {
43438      open(name);
43439      composeCitationCitedArtifactContributorshipEntryComponentProperties(element);
43440      close();
43441    }
43442  }
43443
43444  protected void composeCitationCitedArtifactContributorshipEntryComponentProperties(Citation.CitationCitedArtifactContributorshipEntryComponent element) throws IOException {
43445    composeBackboneElementProperties(element);
43446      if (element.hasContributor()) {
43447        composeReference("contributor", element.getContributor());
43448      }
43449      if (element.hasForenameInitialsElement()) {
43450        composeStringCore("forenameInitials", element.getForenameInitialsElement(), false);
43451        composeStringExtras("forenameInitials", element.getForenameInitialsElement(), false);
43452      }
43453      if (element.hasAffiliation()) {
43454        openArray("affiliation");
43455        for (Reference e : element.getAffiliation()) 
43456          composeReference(null, e);
43457        closeArray();
43458      };
43459      if (element.hasContributionType()) {
43460        openArray("contributionType");
43461        for (CodeableConcept e : element.getContributionType()) 
43462          composeCodeableConcept(null, e);
43463        closeArray();
43464      };
43465      if (element.hasRole()) {
43466        composeCodeableConcept("role", element.getRole());
43467      }
43468      if (element.hasContributionInstance()) {
43469        openArray("contributionInstance");
43470        for (Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent e : element.getContributionInstance()) 
43471          composeCitationCitedArtifactContributorshipEntryContributionInstanceComponent(null, e);
43472        closeArray();
43473      };
43474      if (element.hasCorrespondingContactElement()) {
43475        composeBooleanCore("correspondingContact", element.getCorrespondingContactElement(), false);
43476        composeBooleanExtras("correspondingContact", element.getCorrespondingContactElement(), false);
43477      }
43478      if (element.hasRankingOrderElement()) {
43479        composePositiveIntCore("rankingOrder", element.getRankingOrderElement(), false);
43480        composePositiveIntExtras("rankingOrder", element.getRankingOrderElement(), false);
43481      }
43482  }
43483
43484  protected void composeCitationCitedArtifactContributorshipEntryContributionInstanceComponent(String name, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent element) throws IOException {
43485    if (element != null) {
43486      open(name);
43487      composeCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(element);
43488      close();
43489    }
43490  }
43491
43492  protected void composeCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent element) throws IOException {
43493    composeBackboneElementProperties(element);
43494      if (element.hasType()) {
43495        composeCodeableConcept("type", element.getType());
43496      }
43497      if (element.hasTimeElement()) {
43498        composeDateTimeCore("time", element.getTimeElement(), false);
43499        composeDateTimeExtras("time", element.getTimeElement(), false);
43500      }
43501  }
43502
43503  protected void composeContributorshipSummaryComponent(String name, Citation.ContributorshipSummaryComponent element) throws IOException {
43504    if (element != null) {
43505      open(name);
43506      composeContributorshipSummaryComponentProperties(element);
43507      close();
43508    }
43509  }
43510
43511  protected void composeContributorshipSummaryComponentProperties(Citation.ContributorshipSummaryComponent element) throws IOException {
43512    composeBackboneElementProperties(element);
43513      if (element.hasType()) {
43514        composeCodeableConcept("type", element.getType());
43515      }
43516      if (element.hasStyle()) {
43517        composeCodeableConcept("style", element.getStyle());
43518      }
43519      if (element.hasSource()) {
43520        composeCodeableConcept("source", element.getSource());
43521      }
43522      if (element.hasValueElement()) {
43523        composeMarkdownCore("value", element.getValueElement(), false);
43524        composeMarkdownExtras("value", element.getValueElement(), false);
43525      }
43526  }
43527
43528  protected void composeClaim(String name, Claim element) throws IOException {
43529    if (element != null) {
43530      prop("resourceType", name);
43531      composeClaimProperties(element);
43532    }
43533  }
43534
43535  protected void composeClaimProperties(Claim element) throws IOException {
43536    composeDomainResourceProperties(element);
43537      if (element.hasIdentifier()) {
43538        openArray("identifier");
43539        for (Identifier e : element.getIdentifier()) 
43540          composeIdentifier(null, e);
43541        closeArray();
43542      };
43543      if (element.hasTraceNumber()) {
43544        openArray("traceNumber");
43545        for (Identifier e : element.getTraceNumber()) 
43546          composeIdentifier(null, e);
43547        closeArray();
43548      };
43549      if (element.hasStatusElement()) {
43550        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
43551        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
43552      }
43553      if (element.hasType()) {
43554        composeCodeableConcept("type", element.getType());
43555      }
43556      if (element.hasSubType()) {
43557        composeCodeableConcept("subType", element.getSubType());
43558      }
43559      if (element.hasUseElement()) {
43560        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43561        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43562      }
43563      if (element.hasPatient()) {
43564        composeReference("patient", element.getPatient());
43565      }
43566      if (element.hasBillablePeriod()) {
43567        composePeriod("billablePeriod", element.getBillablePeriod());
43568      }
43569      if (element.hasCreatedElement()) {
43570        composeDateTimeCore("created", element.getCreatedElement(), false);
43571        composeDateTimeExtras("created", element.getCreatedElement(), false);
43572      }
43573      if (element.hasEnterer()) {
43574        composeReference("enterer", element.getEnterer());
43575      }
43576      if (element.hasInsurer()) {
43577        composeReference("insurer", element.getInsurer());
43578      }
43579      if (element.hasProvider()) {
43580        composeReference("provider", element.getProvider());
43581      }
43582      if (element.hasPriority()) {
43583        composeCodeableConcept("priority", element.getPriority());
43584      }
43585      if (element.hasFundsReserve()) {
43586        composeCodeableConcept("fundsReserve", element.getFundsReserve());
43587      }
43588      if (element.hasRelated()) {
43589        openArray("related");
43590        for (Claim.RelatedClaimComponent e : element.getRelated()) 
43591          composeRelatedClaimComponent(null, e);
43592        closeArray();
43593      };
43594      if (element.hasPrescription()) {
43595        composeReference("prescription", element.getPrescription());
43596      }
43597      if (element.hasOriginalPrescription()) {
43598        composeReference("originalPrescription", element.getOriginalPrescription());
43599      }
43600      if (element.hasPayee()) {
43601        composePayeeComponent("payee", element.getPayee());
43602      }
43603      if (element.hasReferral()) {
43604        composeReference("referral", element.getReferral());
43605      }
43606      if (element.hasEncounter()) {
43607        openArray("encounter");
43608        for (Reference e : element.getEncounter()) 
43609          composeReference(null, e);
43610        closeArray();
43611      };
43612      if (element.hasFacility()) {
43613        composeReference("facility", element.getFacility());
43614      }
43615      if (element.hasDiagnosisRelatedGroup()) {
43616        composeCodeableConcept("diagnosisRelatedGroup", element.getDiagnosisRelatedGroup());
43617      }
43618      if (element.hasEvent()) {
43619        openArray("event");
43620        for (Claim.ClaimEventComponent e : element.getEvent()) 
43621          composeClaimEventComponent(null, e);
43622        closeArray();
43623      };
43624      if (element.hasCareTeam()) {
43625        openArray("careTeam");
43626        for (Claim.CareTeamComponent e : element.getCareTeam()) 
43627          composeCareTeamComponent(null, e);
43628        closeArray();
43629      };
43630      if (element.hasSupportingInfo()) {
43631        openArray("supportingInfo");
43632        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
43633          composeSupportingInformationComponent(null, e);
43634        closeArray();
43635      };
43636      if (element.hasDiagnosis()) {
43637        openArray("diagnosis");
43638        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
43639          composeDiagnosisComponent(null, e);
43640        closeArray();
43641      };
43642      if (element.hasProcedure()) {
43643        openArray("procedure");
43644        for (Claim.ProcedureComponent e : element.getProcedure()) 
43645          composeProcedureComponent(null, e);
43646        closeArray();
43647      };
43648      if (element.hasInsurance()) {
43649        openArray("insurance");
43650        for (Claim.InsuranceComponent e : element.getInsurance()) 
43651          composeInsuranceComponent(null, e);
43652        closeArray();
43653      };
43654      if (element.hasAccident()) {
43655        composeAccidentComponent("accident", element.getAccident());
43656      }
43657      if (element.hasPatientPaid()) {
43658        composeMoney("patientPaid", element.getPatientPaid());
43659      }
43660      if (element.hasItem()) {
43661        openArray("item");
43662        for (Claim.ItemComponent e : element.getItem()) 
43663          composeItemComponent(null, e);
43664        closeArray();
43665      };
43666      if (element.hasTotal()) {
43667        composeMoney("total", element.getTotal());
43668      }
43669  }
43670
43671  protected void composeRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
43672    if (element != null) {
43673      open(name);
43674      composeRelatedClaimComponentProperties(element);
43675      close();
43676    }
43677  }
43678
43679  protected void composeRelatedClaimComponentProperties(Claim.RelatedClaimComponent element) throws IOException {
43680    composeBackboneElementProperties(element);
43681      if (element.hasClaim()) {
43682        composeReference("claim", element.getClaim());
43683      }
43684      if (element.hasRelationship()) {
43685        composeCodeableConcept("relationship", element.getRelationship());
43686      }
43687      if (element.hasReference()) {
43688        composeIdentifier("reference", element.getReference());
43689      }
43690  }
43691
43692  protected void composePayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
43693    if (element != null) {
43694      open(name);
43695      composePayeeComponentProperties(element);
43696      close();
43697    }
43698  }
43699
43700  protected void composePayeeComponentProperties(Claim.PayeeComponent element) throws IOException {
43701    composeBackboneElementProperties(element);
43702      if (element.hasType()) {
43703        composeCodeableConcept("type", element.getType());
43704      }
43705      if (element.hasParty()) {
43706        composeReference("party", element.getParty());
43707      }
43708  }
43709
43710  protected void composeClaimEventComponent(String name, Claim.ClaimEventComponent element) throws IOException {
43711    if (element != null) {
43712      open(name);
43713      composeClaimEventComponentProperties(element);
43714      close();
43715    }
43716  }
43717
43718  protected void composeClaimEventComponentProperties(Claim.ClaimEventComponent element) throws IOException {
43719    composeBackboneElementProperties(element);
43720      if (element.hasType()) {
43721        composeCodeableConcept("type", element.getType());
43722      }
43723      if (element.hasWhen()) {
43724        composeType("when", element.getWhen());
43725      }
43726  }
43727
43728  protected void composeCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
43729    if (element != null) {
43730      open(name);
43731      composeCareTeamComponentProperties(element);
43732      close();
43733    }
43734  }
43735
43736  protected void composeCareTeamComponentProperties(Claim.CareTeamComponent element) throws IOException {
43737    composeBackboneElementProperties(element);
43738      if (element.hasSequenceElement()) {
43739        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43740        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43741      }
43742      if (element.hasProvider()) {
43743        composeReference("provider", element.getProvider());
43744      }
43745      if (element.hasResponsibleElement()) {
43746        composeBooleanCore("responsible", element.getResponsibleElement(), false);
43747        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
43748      }
43749      if (element.hasRole()) {
43750        composeCodeableConcept("role", element.getRole());
43751      }
43752      if (element.hasSpecialty()) {
43753        composeCodeableConcept("specialty", element.getSpecialty());
43754      }
43755  }
43756
43757  protected void composeSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
43758    if (element != null) {
43759      open(name);
43760      composeSupportingInformationComponentProperties(element);
43761      close();
43762    }
43763  }
43764
43765  protected void composeSupportingInformationComponentProperties(Claim.SupportingInformationComponent element) throws IOException {
43766    composeBackboneElementProperties(element);
43767      if (element.hasSequenceElement()) {
43768        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43769        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43770      }
43771      if (element.hasCategory()) {
43772        composeCodeableConcept("category", element.getCategory());
43773      }
43774      if (element.hasCode()) {
43775        composeCodeableConcept("code", element.getCode());
43776      }
43777      if (element.hasTiming()) {
43778        composeType("timing", element.getTiming());
43779      }
43780      if (element.hasValue()) {
43781        composeType("value", element.getValue());
43782      }
43783      if (element.hasReason()) {
43784        composeCodeableConcept("reason", element.getReason());
43785      }
43786  }
43787
43788  protected void composeDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
43789    if (element != null) {
43790      open(name);
43791      composeDiagnosisComponentProperties(element);
43792      close();
43793    }
43794  }
43795
43796  protected void composeDiagnosisComponentProperties(Claim.DiagnosisComponent element) throws IOException {
43797    composeBackboneElementProperties(element);
43798      if (element.hasSequenceElement()) {
43799        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43800        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43801      }
43802      if (element.hasDiagnosis()) {
43803        composeType("diagnosis", element.getDiagnosis());
43804      }
43805      if (element.hasType()) {
43806        openArray("type");
43807        for (CodeableConcept e : element.getType()) 
43808          composeCodeableConcept(null, e);
43809        closeArray();
43810      };
43811      if (element.hasOnAdmission()) {
43812        composeCodeableConcept("onAdmission", element.getOnAdmission());
43813      }
43814  }
43815
43816  protected void composeProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
43817    if (element != null) {
43818      open(name);
43819      composeProcedureComponentProperties(element);
43820      close();
43821    }
43822  }
43823
43824  protected void composeProcedureComponentProperties(Claim.ProcedureComponent element) throws IOException {
43825    composeBackboneElementProperties(element);
43826      if (element.hasSequenceElement()) {
43827        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43828        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43829      }
43830      if (element.hasType()) {
43831        openArray("type");
43832        for (CodeableConcept e : element.getType()) 
43833          composeCodeableConcept(null, e);
43834        closeArray();
43835      };
43836      if (element.hasDateElement()) {
43837        composeDateTimeCore("date", element.getDateElement(), false);
43838        composeDateTimeExtras("date", element.getDateElement(), false);
43839      }
43840      if (element.hasProcedure()) {
43841        composeType("procedure", element.getProcedure());
43842      }
43843      if (element.hasUdi()) {
43844        openArray("udi");
43845        for (Reference e : element.getUdi()) 
43846          composeReference(null, e);
43847        closeArray();
43848      };
43849  }
43850
43851  protected void composeInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
43852    if (element != null) {
43853      open(name);
43854      composeInsuranceComponentProperties(element);
43855      close();
43856    }
43857  }
43858
43859  protected void composeInsuranceComponentProperties(Claim.InsuranceComponent element) throws IOException {
43860    composeBackboneElementProperties(element);
43861      if (element.hasSequenceElement()) {
43862        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43863        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43864      }
43865      if (element.hasFocalElement()) {
43866        composeBooleanCore("focal", element.getFocalElement(), false);
43867        composeBooleanExtras("focal", element.getFocalElement(), false);
43868      }
43869      if (element.hasIdentifier()) {
43870        composeIdentifier("identifier", element.getIdentifier());
43871      }
43872      if (element.hasCoverage()) {
43873        composeReference("coverage", element.getCoverage());
43874      }
43875      if (element.hasBusinessArrangementElement()) {
43876        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
43877        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
43878      }
43879      if (element.hasPreAuthRef()) {
43880        if (anyHasValue(element.getPreAuthRef())) {
43881          openArray("preAuthRef");
43882          for (StringType e : element.getPreAuthRef()) 
43883            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
43884          closeArray();
43885        }
43886        if (anyHasExtras(element.getPreAuthRef())) {
43887          openArray("_preAuthRef");
43888          for (StringType e : element.getPreAuthRef()) 
43889            composeStringExtras(null, e, true);
43890          closeArray();
43891        }
43892      };
43893      if (element.hasClaimResponse()) {
43894        composeReference("claimResponse", element.getClaimResponse());
43895      }
43896  }
43897
43898  protected void composeAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
43899    if (element != null) {
43900      open(name);
43901      composeAccidentComponentProperties(element);
43902      close();
43903    }
43904  }
43905
43906  protected void composeAccidentComponentProperties(Claim.AccidentComponent element) throws IOException {
43907    composeBackboneElementProperties(element);
43908      if (element.hasDateElement()) {
43909        composeDateCore("date", element.getDateElement(), false);
43910        composeDateExtras("date", element.getDateElement(), false);
43911      }
43912      if (element.hasType()) {
43913        composeCodeableConcept("type", element.getType());
43914      }
43915      if (element.hasLocation()) {
43916        composeType("location", element.getLocation());
43917      }
43918  }
43919
43920  protected void composeItemComponent(String name, Claim.ItemComponent element) throws IOException {
43921    if (element != null) {
43922      open(name);
43923      composeItemComponentProperties(element);
43924      close();
43925    }
43926  }
43927
43928  protected void composeItemComponentProperties(Claim.ItemComponent element) throws IOException {
43929    composeBackboneElementProperties(element);
43930      if (element.hasSequenceElement()) {
43931        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43932        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43933      }
43934      if (element.hasTraceNumber()) {
43935        openArray("traceNumber");
43936        for (Identifier e : element.getTraceNumber()) 
43937          composeIdentifier(null, e);
43938        closeArray();
43939      };
43940      if (element.hasCareTeamSequence()) {
43941        if (anyHasValue(element.getCareTeamSequence())) {
43942          openArray("careTeamSequence");
43943          for (PositiveIntType e : element.getCareTeamSequence()) 
43944            composePositiveIntCore(null, e, e != element.getCareTeamSequence().get(element.getCareTeamSequence().size()-1));
43945          closeArray();
43946        }
43947        if (anyHasExtras(element.getCareTeamSequence())) {
43948          openArray("_careTeamSequence");
43949          for (PositiveIntType e : element.getCareTeamSequence()) 
43950            composePositiveIntExtras(null, e, true);
43951          closeArray();
43952        }
43953      };
43954      if (element.hasDiagnosisSequence()) {
43955        if (anyHasValue(element.getDiagnosisSequence())) {
43956          openArray("diagnosisSequence");
43957          for (PositiveIntType e : element.getDiagnosisSequence()) 
43958            composePositiveIntCore(null, e, e != element.getDiagnosisSequence().get(element.getDiagnosisSequence().size()-1));
43959          closeArray();
43960        }
43961        if (anyHasExtras(element.getDiagnosisSequence())) {
43962          openArray("_diagnosisSequence");
43963          for (PositiveIntType e : element.getDiagnosisSequence()) 
43964            composePositiveIntExtras(null, e, true);
43965          closeArray();
43966        }
43967      };
43968      if (element.hasProcedureSequence()) {
43969        if (anyHasValue(element.getProcedureSequence())) {
43970          openArray("procedureSequence");
43971          for (PositiveIntType e : element.getProcedureSequence()) 
43972            composePositiveIntCore(null, e, e != element.getProcedureSequence().get(element.getProcedureSequence().size()-1));
43973          closeArray();
43974        }
43975        if (anyHasExtras(element.getProcedureSequence())) {
43976          openArray("_procedureSequence");
43977          for (PositiveIntType e : element.getProcedureSequence()) 
43978            composePositiveIntExtras(null, e, true);
43979          closeArray();
43980        }
43981      };
43982      if (element.hasInformationSequence()) {
43983        if (anyHasValue(element.getInformationSequence())) {
43984          openArray("informationSequence");
43985          for (PositiveIntType e : element.getInformationSequence()) 
43986            composePositiveIntCore(null, e, e != element.getInformationSequence().get(element.getInformationSequence().size()-1));
43987          closeArray();
43988        }
43989        if (anyHasExtras(element.getInformationSequence())) {
43990          openArray("_informationSequence");
43991          for (PositiveIntType e : element.getInformationSequence()) 
43992            composePositiveIntExtras(null, e, true);
43993          closeArray();
43994        }
43995      };
43996      if (element.hasRevenue()) {
43997        composeCodeableConcept("revenue", element.getRevenue());
43998      }
43999      if (element.hasCategory()) {
44000        composeCodeableConcept("category", element.getCategory());
44001      }
44002      if (element.hasProductOrService()) {
44003        composeCodeableConcept("productOrService", element.getProductOrService());
44004      }
44005      if (element.hasProductOrServiceEnd()) {
44006        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44007      }
44008      if (element.hasRequest()) {
44009        openArray("request");
44010        for (Reference e : element.getRequest()) 
44011          composeReference(null, e);
44012        closeArray();
44013      };
44014      if (element.hasModifier()) {
44015        openArray("modifier");
44016        for (CodeableConcept e : element.getModifier()) 
44017          composeCodeableConcept(null, e);
44018        closeArray();
44019      };
44020      if (element.hasProgramCode()) {
44021        openArray("programCode");
44022        for (CodeableConcept e : element.getProgramCode()) 
44023          composeCodeableConcept(null, e);
44024        closeArray();
44025      };
44026      if (element.hasServiced()) {
44027        composeType("serviced", element.getServiced());
44028      }
44029      if (element.hasLocation()) {
44030        composeType("location", element.getLocation());
44031      }
44032      if (element.hasPatientPaid()) {
44033        composeMoney("patientPaid", element.getPatientPaid());
44034      }
44035      if (element.hasQuantity()) {
44036        composeQuantity("quantity", element.getQuantity());
44037      }
44038      if (element.hasUnitPrice()) {
44039        composeMoney("unitPrice", element.getUnitPrice());
44040      }
44041      if (element.hasFactorElement()) {
44042        composeDecimalCore("factor", element.getFactorElement(), false);
44043        composeDecimalExtras("factor", element.getFactorElement(), false);
44044      }
44045      if (element.hasTax()) {
44046        composeMoney("tax", element.getTax());
44047      }
44048      if (element.hasNet()) {
44049        composeMoney("net", element.getNet());
44050      }
44051      if (element.hasUdi()) {
44052        openArray("udi");
44053        for (Reference e : element.getUdi()) 
44054          composeReference(null, e);
44055        closeArray();
44056      };
44057      if (element.hasBodySite()) {
44058        openArray("bodySite");
44059        for (Claim.BodySiteComponent e : element.getBodySite()) 
44060          composeBodySiteComponent(null, e);
44061        closeArray();
44062      };
44063      if (element.hasEncounter()) {
44064        openArray("encounter");
44065        for (Reference e : element.getEncounter()) 
44066          composeReference(null, e);
44067        closeArray();
44068      };
44069      if (element.hasDetail()) {
44070        openArray("detail");
44071        for (Claim.DetailComponent e : element.getDetail()) 
44072          composeDetailComponent(null, e);
44073        closeArray();
44074      };
44075  }
44076
44077  protected void composeBodySiteComponent(String name, Claim.BodySiteComponent element) throws IOException {
44078    if (element != null) {
44079      open(name);
44080      composeBodySiteComponentProperties(element);
44081      close();
44082    }
44083  }
44084
44085  protected void composeBodySiteComponentProperties(Claim.BodySiteComponent element) throws IOException {
44086    composeBackboneElementProperties(element);
44087      if (element.hasSite()) {
44088        openArray("site");
44089        for (CodeableReference e : element.getSite()) 
44090          composeCodeableReference(null, e);
44091        closeArray();
44092      };
44093      if (element.hasSubSite()) {
44094        openArray("subSite");
44095        for (CodeableConcept e : element.getSubSite()) 
44096          composeCodeableConcept(null, e);
44097        closeArray();
44098      };
44099  }
44100
44101  protected void composeDetailComponent(String name, Claim.DetailComponent element) throws IOException {
44102    if (element != null) {
44103      open(name);
44104      composeDetailComponentProperties(element);
44105      close();
44106    }
44107  }
44108
44109  protected void composeDetailComponentProperties(Claim.DetailComponent element) throws IOException {
44110    composeBackboneElementProperties(element);
44111      if (element.hasSequenceElement()) {
44112        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44113        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44114      }
44115      if (element.hasTraceNumber()) {
44116        openArray("traceNumber");
44117        for (Identifier e : element.getTraceNumber()) 
44118          composeIdentifier(null, e);
44119        closeArray();
44120      };
44121      if (element.hasRevenue()) {
44122        composeCodeableConcept("revenue", element.getRevenue());
44123      }
44124      if (element.hasCategory()) {
44125        composeCodeableConcept("category", element.getCategory());
44126      }
44127      if (element.hasProductOrService()) {
44128        composeCodeableConcept("productOrService", element.getProductOrService());
44129      }
44130      if (element.hasProductOrServiceEnd()) {
44131        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44132      }
44133      if (element.hasModifier()) {
44134        openArray("modifier");
44135        for (CodeableConcept e : element.getModifier()) 
44136          composeCodeableConcept(null, e);
44137        closeArray();
44138      };
44139      if (element.hasProgramCode()) {
44140        openArray("programCode");
44141        for (CodeableConcept e : element.getProgramCode()) 
44142          composeCodeableConcept(null, e);
44143        closeArray();
44144      };
44145      if (element.hasPatientPaid()) {
44146        composeMoney("patientPaid", element.getPatientPaid());
44147      }
44148      if (element.hasQuantity()) {
44149        composeQuantity("quantity", element.getQuantity());
44150      }
44151      if (element.hasUnitPrice()) {
44152        composeMoney("unitPrice", element.getUnitPrice());
44153      }
44154      if (element.hasFactorElement()) {
44155        composeDecimalCore("factor", element.getFactorElement(), false);
44156        composeDecimalExtras("factor", element.getFactorElement(), false);
44157      }
44158      if (element.hasTax()) {
44159        composeMoney("tax", element.getTax());
44160      }
44161      if (element.hasNet()) {
44162        composeMoney("net", element.getNet());
44163      }
44164      if (element.hasUdi()) {
44165        openArray("udi");
44166        for (Reference e : element.getUdi()) 
44167          composeReference(null, e);
44168        closeArray();
44169      };
44170      if (element.hasSubDetail()) {
44171        openArray("subDetail");
44172        for (Claim.SubDetailComponent e : element.getSubDetail()) 
44173          composeSubDetailComponent(null, e);
44174        closeArray();
44175      };
44176  }
44177
44178  protected void composeSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
44179    if (element != null) {
44180      open(name);
44181      composeSubDetailComponentProperties(element);
44182      close();
44183    }
44184  }
44185
44186  protected void composeSubDetailComponentProperties(Claim.SubDetailComponent element) throws IOException {
44187    composeBackboneElementProperties(element);
44188      if (element.hasSequenceElement()) {
44189        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44190        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44191      }
44192      if (element.hasTraceNumber()) {
44193        openArray("traceNumber");
44194        for (Identifier e : element.getTraceNumber()) 
44195          composeIdentifier(null, e);
44196        closeArray();
44197      };
44198      if (element.hasRevenue()) {
44199        composeCodeableConcept("revenue", element.getRevenue());
44200      }
44201      if (element.hasCategory()) {
44202        composeCodeableConcept("category", element.getCategory());
44203      }
44204      if (element.hasProductOrService()) {
44205        composeCodeableConcept("productOrService", element.getProductOrService());
44206      }
44207      if (element.hasProductOrServiceEnd()) {
44208        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44209      }
44210      if (element.hasModifier()) {
44211        openArray("modifier");
44212        for (CodeableConcept e : element.getModifier()) 
44213          composeCodeableConcept(null, e);
44214        closeArray();
44215      };
44216      if (element.hasProgramCode()) {
44217        openArray("programCode");
44218        for (CodeableConcept e : element.getProgramCode()) 
44219          composeCodeableConcept(null, e);
44220        closeArray();
44221      };
44222      if (element.hasPatientPaid()) {
44223        composeMoney("patientPaid", element.getPatientPaid());
44224      }
44225      if (element.hasQuantity()) {
44226        composeQuantity("quantity", element.getQuantity());
44227      }
44228      if (element.hasUnitPrice()) {
44229        composeMoney("unitPrice", element.getUnitPrice());
44230      }
44231      if (element.hasFactorElement()) {
44232        composeDecimalCore("factor", element.getFactorElement(), false);
44233        composeDecimalExtras("factor", element.getFactorElement(), false);
44234      }
44235      if (element.hasTax()) {
44236        composeMoney("tax", element.getTax());
44237      }
44238      if (element.hasNet()) {
44239        composeMoney("net", element.getNet());
44240      }
44241      if (element.hasUdi()) {
44242        openArray("udi");
44243        for (Reference e : element.getUdi()) 
44244          composeReference(null, e);
44245        closeArray();
44246      };
44247  }
44248
44249  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
44250    if (element != null) {
44251      prop("resourceType", name);
44252      composeClaimResponseProperties(element);
44253    }
44254  }
44255
44256  protected void composeClaimResponseProperties(ClaimResponse element) throws IOException {
44257    composeDomainResourceProperties(element);
44258      if (element.hasIdentifier()) {
44259        openArray("identifier");
44260        for (Identifier e : element.getIdentifier()) 
44261          composeIdentifier(null, e);
44262        closeArray();
44263      };
44264      if (element.hasTraceNumber()) {
44265        openArray("traceNumber");
44266        for (Identifier e : element.getTraceNumber()) 
44267          composeIdentifier(null, e);
44268        closeArray();
44269      };
44270      if (element.hasStatusElement()) {
44271        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
44272        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
44273      }
44274      if (element.hasType()) {
44275        composeCodeableConcept("type", element.getType());
44276      }
44277      if (element.hasSubType()) {
44278        composeCodeableConcept("subType", element.getSubType());
44279      }
44280      if (element.hasUseElement()) {
44281        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
44282        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
44283      }
44284      if (element.hasPatient()) {
44285        composeReference("patient", element.getPatient());
44286      }
44287      if (element.hasCreatedElement()) {
44288        composeDateTimeCore("created", element.getCreatedElement(), false);
44289        composeDateTimeExtras("created", element.getCreatedElement(), false);
44290      }
44291      if (element.hasInsurer()) {
44292        composeReference("insurer", element.getInsurer());
44293      }
44294      if (element.hasRequestor()) {
44295        composeReference("requestor", element.getRequestor());
44296      }
44297      if (element.hasRequest()) {
44298        composeReference("request", element.getRequest());
44299      }
44300      if (element.hasOutcomeElement()) {
44301        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
44302        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
44303      }
44304      if (element.hasDecision()) {
44305        composeCodeableConcept("decision", element.getDecision());
44306      }
44307      if (element.hasDispositionElement()) {
44308        composeStringCore("disposition", element.getDispositionElement(), false);
44309        composeStringExtras("disposition", element.getDispositionElement(), false);
44310      }
44311      if (element.hasPreAuthRefElement()) {
44312        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
44313        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
44314      }
44315      if (element.hasPreAuthPeriod()) {
44316        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
44317      }
44318      if (element.hasEvent()) {
44319        openArray("event");
44320        for (ClaimResponse.ClaimResponseEventComponent e : element.getEvent()) 
44321          composeClaimResponseEventComponent(null, e);
44322        closeArray();
44323      };
44324      if (element.hasPayeeType()) {
44325        composeCodeableConcept("payeeType", element.getPayeeType());
44326      }
44327      if (element.hasEncounter()) {
44328        openArray("encounter");
44329        for (Reference e : element.getEncounter()) 
44330          composeReference(null, e);
44331        closeArray();
44332      };
44333      if (element.hasDiagnosisRelatedGroup()) {
44334        composeCodeableConcept("diagnosisRelatedGroup", element.getDiagnosisRelatedGroup());
44335      }
44336      if (element.hasItem()) {
44337        openArray("item");
44338        for (ClaimResponse.ItemComponent e : element.getItem()) 
44339          composeItemComponent(null, e);
44340        closeArray();
44341      };
44342      if (element.hasAddItem()) {
44343        openArray("addItem");
44344        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
44345          composeAddedItemComponent(null, e);
44346        closeArray();
44347      };
44348      if (element.hasAdjudication()) {
44349        openArray("adjudication");
44350        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44351          composeAdjudicationComponent(null, e);
44352        closeArray();
44353      };
44354      if (element.hasTotal()) {
44355        openArray("total");
44356        for (ClaimResponse.TotalComponent e : element.getTotal()) 
44357          composeTotalComponent(null, e);
44358        closeArray();
44359      };
44360      if (element.hasPayment()) {
44361        composePaymentComponent("payment", element.getPayment());
44362      }
44363      if (element.hasFundsReserve()) {
44364        composeCodeableConcept("fundsReserve", element.getFundsReserve());
44365      }
44366      if (element.hasFormCode()) {
44367        composeCodeableConcept("formCode", element.getFormCode());
44368      }
44369      if (element.hasForm()) {
44370        composeAttachment("form", element.getForm());
44371      }
44372      if (element.hasProcessNote()) {
44373        openArray("processNote");
44374        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
44375          composeNoteComponent(null, e);
44376        closeArray();
44377      };
44378      if (element.hasCommunicationRequest()) {
44379        openArray("communicationRequest");
44380        for (Reference e : element.getCommunicationRequest()) 
44381          composeReference(null, e);
44382        closeArray();
44383      };
44384      if (element.hasInsurance()) {
44385        openArray("insurance");
44386        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
44387          composeInsuranceComponent(null, e);
44388        closeArray();
44389      };
44390      if (element.hasError()) {
44391        openArray("error");
44392        for (ClaimResponse.ErrorComponent e : element.getError()) 
44393          composeErrorComponent(null, e);
44394        closeArray();
44395      };
44396  }
44397
44398  protected void composeClaimResponseEventComponent(String name, ClaimResponse.ClaimResponseEventComponent element) throws IOException {
44399    if (element != null) {
44400      open(name);
44401      composeClaimResponseEventComponentProperties(element);
44402      close();
44403    }
44404  }
44405
44406  protected void composeClaimResponseEventComponentProperties(ClaimResponse.ClaimResponseEventComponent element) throws IOException {
44407    composeBackboneElementProperties(element);
44408      if (element.hasType()) {
44409        composeCodeableConcept("type", element.getType());
44410      }
44411      if (element.hasWhen()) {
44412        composeType("when", element.getWhen());
44413      }
44414  }
44415
44416  protected void composeItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
44417    if (element != null) {
44418      open(name);
44419      composeItemComponentProperties(element);
44420      close();
44421    }
44422  }
44423
44424  protected void composeItemComponentProperties(ClaimResponse.ItemComponent element) throws IOException {
44425    composeBackboneElementProperties(element);
44426      if (element.hasItemSequenceElement()) {
44427        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
44428        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
44429      }
44430      if (element.hasTraceNumber()) {
44431        openArray("traceNumber");
44432        for (Identifier e : element.getTraceNumber()) 
44433          composeIdentifier(null, e);
44434        closeArray();
44435      };
44436      if (element.hasNoteNumber()) {
44437        if (anyHasValue(element.getNoteNumber())) {
44438          openArray("noteNumber");
44439          for (PositiveIntType e : element.getNoteNumber()) 
44440            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44441          closeArray();
44442        }
44443        if (anyHasExtras(element.getNoteNumber())) {
44444          openArray("_noteNumber");
44445          for (PositiveIntType e : element.getNoteNumber()) 
44446            composePositiveIntExtras(null, e, true);
44447          closeArray();
44448        }
44449      };
44450      if (element.hasReviewOutcome()) {
44451        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44452      }
44453      if (element.hasAdjudication()) {
44454        openArray("adjudication");
44455        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44456          composeAdjudicationComponent(null, e);
44457        closeArray();
44458      };
44459      if (element.hasDetail()) {
44460        openArray("detail");
44461        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
44462          composeItemDetailComponent(null, e);
44463        closeArray();
44464      };
44465  }
44466
44467  protected void composeReviewOutcomeComponent(String name, ClaimResponse.ReviewOutcomeComponent element) throws IOException {
44468    if (element != null) {
44469      open(name);
44470      composeReviewOutcomeComponentProperties(element);
44471      close();
44472    }
44473  }
44474
44475  protected void composeReviewOutcomeComponentProperties(ClaimResponse.ReviewOutcomeComponent element) throws IOException {
44476    composeBackboneElementProperties(element);
44477      if (element.hasDecision()) {
44478        composeCodeableConcept("decision", element.getDecision());
44479      }
44480      if (element.hasReason()) {
44481        openArray("reason");
44482        for (CodeableConcept e : element.getReason()) 
44483          composeCodeableConcept(null, e);
44484        closeArray();
44485      };
44486      if (element.hasPreAuthRefElement()) {
44487        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
44488        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
44489      }
44490      if (element.hasPreAuthPeriod()) {
44491        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
44492      }
44493  }
44494
44495  protected void composeAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
44496    if (element != null) {
44497      open(name);
44498      composeAdjudicationComponentProperties(element);
44499      close();
44500    }
44501  }
44502
44503  protected void composeAdjudicationComponentProperties(ClaimResponse.AdjudicationComponent element) throws IOException {
44504    composeBackboneElementProperties(element);
44505      if (element.hasCategory()) {
44506        composeCodeableConcept("category", element.getCategory());
44507      }
44508      if (element.hasReason()) {
44509        composeCodeableConcept("reason", element.getReason());
44510      }
44511      if (element.hasAmount()) {
44512        composeMoney("amount", element.getAmount());
44513      }
44514      if (element.hasQuantity()) {
44515        composeQuantity("quantity", element.getQuantity());
44516      }
44517  }
44518
44519  protected void composeItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
44520    if (element != null) {
44521      open(name);
44522      composeItemDetailComponentProperties(element);
44523      close();
44524    }
44525  }
44526
44527  protected void composeItemDetailComponentProperties(ClaimResponse.ItemDetailComponent element) throws IOException {
44528    composeBackboneElementProperties(element);
44529      if (element.hasDetailSequenceElement()) {
44530        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
44531        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
44532      }
44533      if (element.hasTraceNumber()) {
44534        openArray("traceNumber");
44535        for (Identifier e : element.getTraceNumber()) 
44536          composeIdentifier(null, e);
44537        closeArray();
44538      };
44539      if (element.hasNoteNumber()) {
44540        if (anyHasValue(element.getNoteNumber())) {
44541          openArray("noteNumber");
44542          for (PositiveIntType e : element.getNoteNumber()) 
44543            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44544          closeArray();
44545        }
44546        if (anyHasExtras(element.getNoteNumber())) {
44547          openArray("_noteNumber");
44548          for (PositiveIntType e : element.getNoteNumber()) 
44549            composePositiveIntExtras(null, e, true);
44550          closeArray();
44551        }
44552      };
44553      if (element.hasReviewOutcome()) {
44554        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44555      }
44556      if (element.hasAdjudication()) {
44557        openArray("adjudication");
44558        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44559          composeAdjudicationComponent(null, e);
44560        closeArray();
44561      };
44562      if (element.hasSubDetail()) {
44563        openArray("subDetail");
44564        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
44565          composeSubDetailComponent(null, e);
44566        closeArray();
44567      };
44568  }
44569
44570  protected void composeSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
44571    if (element != null) {
44572      open(name);
44573      composeSubDetailComponentProperties(element);
44574      close();
44575    }
44576  }
44577
44578  protected void composeSubDetailComponentProperties(ClaimResponse.SubDetailComponent element) throws IOException {
44579    composeBackboneElementProperties(element);
44580      if (element.hasSubDetailSequenceElement()) {
44581        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
44582        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
44583      }
44584      if (element.hasTraceNumber()) {
44585        openArray("traceNumber");
44586        for (Identifier e : element.getTraceNumber()) 
44587          composeIdentifier(null, e);
44588        closeArray();
44589      };
44590      if (element.hasNoteNumber()) {
44591        if (anyHasValue(element.getNoteNumber())) {
44592          openArray("noteNumber");
44593          for (PositiveIntType e : element.getNoteNumber()) 
44594            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44595          closeArray();
44596        }
44597        if (anyHasExtras(element.getNoteNumber())) {
44598          openArray("_noteNumber");
44599          for (PositiveIntType e : element.getNoteNumber()) 
44600            composePositiveIntExtras(null, e, true);
44601          closeArray();
44602        }
44603      };
44604      if (element.hasReviewOutcome()) {
44605        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44606      }
44607      if (element.hasAdjudication()) {
44608        openArray("adjudication");
44609        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44610          composeAdjudicationComponent(null, e);
44611        closeArray();
44612      };
44613  }
44614
44615  protected void composeAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
44616    if (element != null) {
44617      open(name);
44618      composeAddedItemComponentProperties(element);
44619      close();
44620    }
44621  }
44622
44623  protected void composeAddedItemComponentProperties(ClaimResponse.AddedItemComponent element) throws IOException {
44624    composeBackboneElementProperties(element);
44625      if (element.hasItemSequence()) {
44626        if (anyHasValue(element.getItemSequence())) {
44627          openArray("itemSequence");
44628          for (PositiveIntType e : element.getItemSequence()) 
44629            composePositiveIntCore(null, e, e != element.getItemSequence().get(element.getItemSequence().size()-1));
44630          closeArray();
44631        }
44632        if (anyHasExtras(element.getItemSequence())) {
44633          openArray("_itemSequence");
44634          for (PositiveIntType e : element.getItemSequence()) 
44635            composePositiveIntExtras(null, e, true);
44636          closeArray();
44637        }
44638      };
44639      if (element.hasDetailSequence()) {
44640        if (anyHasValue(element.getDetailSequence())) {
44641          openArray("detailSequence");
44642          for (PositiveIntType e : element.getDetailSequence()) 
44643            composePositiveIntCore(null, e, e != element.getDetailSequence().get(element.getDetailSequence().size()-1));
44644          closeArray();
44645        }
44646        if (anyHasExtras(element.getDetailSequence())) {
44647          openArray("_detailSequence");
44648          for (PositiveIntType e : element.getDetailSequence()) 
44649            composePositiveIntExtras(null, e, true);
44650          closeArray();
44651        }
44652      };
44653      if (element.hasSubdetailSequence()) {
44654        if (anyHasValue(element.getSubdetailSequence())) {
44655          openArray("subdetailSequence");
44656          for (PositiveIntType e : element.getSubdetailSequence()) 
44657            composePositiveIntCore(null, e, e != element.getSubdetailSequence().get(element.getSubdetailSequence().size()-1));
44658          closeArray();
44659        }
44660        if (anyHasExtras(element.getSubdetailSequence())) {
44661          openArray("_subdetailSequence");
44662          for (PositiveIntType e : element.getSubdetailSequence()) 
44663            composePositiveIntExtras(null, e, true);
44664          closeArray();
44665        }
44666      };
44667      if (element.hasTraceNumber()) {
44668        openArray("traceNumber");
44669        for (Identifier e : element.getTraceNumber()) 
44670          composeIdentifier(null, e);
44671        closeArray();
44672      };
44673      if (element.hasProvider()) {
44674        openArray("provider");
44675        for (Reference e : element.getProvider()) 
44676          composeReference(null, e);
44677        closeArray();
44678      };
44679      if (element.hasRevenue()) {
44680        composeCodeableConcept("revenue", element.getRevenue());
44681      }
44682      if (element.hasProductOrService()) {
44683        composeCodeableConcept("productOrService", element.getProductOrService());
44684      }
44685      if (element.hasProductOrServiceEnd()) {
44686        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44687      }
44688      if (element.hasRequest()) {
44689        openArray("request");
44690        for (Reference e : element.getRequest()) 
44691          composeReference(null, e);
44692        closeArray();
44693      };
44694      if (element.hasModifier()) {
44695        openArray("modifier");
44696        for (CodeableConcept e : element.getModifier()) 
44697          composeCodeableConcept(null, e);
44698        closeArray();
44699      };
44700      if (element.hasProgramCode()) {
44701        openArray("programCode");
44702        for (CodeableConcept e : element.getProgramCode()) 
44703          composeCodeableConcept(null, e);
44704        closeArray();
44705      };
44706      if (element.hasServiced()) {
44707        composeType("serviced", element.getServiced());
44708      }
44709      if (element.hasLocation()) {
44710        composeType("location", element.getLocation());
44711      }
44712      if (element.hasQuantity()) {
44713        composeQuantity("quantity", element.getQuantity());
44714      }
44715      if (element.hasUnitPrice()) {
44716        composeMoney("unitPrice", element.getUnitPrice());
44717      }
44718      if (element.hasFactorElement()) {
44719        composeDecimalCore("factor", element.getFactorElement(), false);
44720        composeDecimalExtras("factor", element.getFactorElement(), false);
44721      }
44722      if (element.hasTax()) {
44723        composeMoney("tax", element.getTax());
44724      }
44725      if (element.hasNet()) {
44726        composeMoney("net", element.getNet());
44727      }
44728      if (element.hasBodySite()) {
44729        openArray("bodySite");
44730        for (ClaimResponse.BodySiteComponent e : element.getBodySite()) 
44731          composeBodySiteComponent(null, e);
44732        closeArray();
44733      };
44734      if (element.hasNoteNumber()) {
44735        if (anyHasValue(element.getNoteNumber())) {
44736          openArray("noteNumber");
44737          for (PositiveIntType e : element.getNoteNumber()) 
44738            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44739          closeArray();
44740        }
44741        if (anyHasExtras(element.getNoteNumber())) {
44742          openArray("_noteNumber");
44743          for (PositiveIntType e : element.getNoteNumber()) 
44744            composePositiveIntExtras(null, e, true);
44745          closeArray();
44746        }
44747      };
44748      if (element.hasReviewOutcome()) {
44749        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44750      }
44751      if (element.hasAdjudication()) {
44752        openArray("adjudication");
44753        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44754          composeAdjudicationComponent(null, e);
44755        closeArray();
44756      };
44757      if (element.hasDetail()) {
44758        openArray("detail");
44759        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
44760          composeAddedItemDetailComponent(null, e);
44761        closeArray();
44762      };
44763  }
44764
44765  protected void composeBodySiteComponent(String name, ClaimResponse.BodySiteComponent element) throws IOException {
44766    if (element != null) {
44767      open(name);
44768      composeBodySiteComponentProperties(element);
44769      close();
44770    }
44771  }
44772
44773  protected void composeBodySiteComponentProperties(ClaimResponse.BodySiteComponent element) throws IOException {
44774    composeBackboneElementProperties(element);
44775      if (element.hasSite()) {
44776        openArray("site");
44777        for (CodeableReference e : element.getSite()) 
44778          composeCodeableReference(null, e);
44779        closeArray();
44780      };
44781      if (element.hasSubSite()) {
44782        openArray("subSite");
44783        for (CodeableConcept e : element.getSubSite()) 
44784          composeCodeableConcept(null, e);
44785        closeArray();
44786      };
44787  }
44788
44789  protected void composeAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
44790    if (element != null) {
44791      open(name);
44792      composeAddedItemDetailComponentProperties(element);
44793      close();
44794    }
44795  }
44796
44797  protected void composeAddedItemDetailComponentProperties(ClaimResponse.AddedItemDetailComponent element) throws IOException {
44798    composeBackboneElementProperties(element);
44799      if (element.hasTraceNumber()) {
44800        openArray("traceNumber");
44801        for (Identifier e : element.getTraceNumber()) 
44802          composeIdentifier(null, e);
44803        closeArray();
44804      };
44805      if (element.hasRevenue()) {
44806        composeCodeableConcept("revenue", element.getRevenue());
44807      }
44808      if (element.hasProductOrService()) {
44809        composeCodeableConcept("productOrService", element.getProductOrService());
44810      }
44811      if (element.hasProductOrServiceEnd()) {
44812        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44813      }
44814      if (element.hasModifier()) {
44815        openArray("modifier");
44816        for (CodeableConcept e : element.getModifier()) 
44817          composeCodeableConcept(null, e);
44818        closeArray();
44819      };
44820      if (element.hasQuantity()) {
44821        composeQuantity("quantity", element.getQuantity());
44822      }
44823      if (element.hasUnitPrice()) {
44824        composeMoney("unitPrice", element.getUnitPrice());
44825      }
44826      if (element.hasFactorElement()) {
44827        composeDecimalCore("factor", element.getFactorElement(), false);
44828        composeDecimalExtras("factor", element.getFactorElement(), false);
44829      }
44830      if (element.hasTax()) {
44831        composeMoney("tax", element.getTax());
44832      }
44833      if (element.hasNet()) {
44834        composeMoney("net", element.getNet());
44835      }
44836      if (element.hasNoteNumber()) {
44837        if (anyHasValue(element.getNoteNumber())) {
44838          openArray("noteNumber");
44839          for (PositiveIntType e : element.getNoteNumber()) 
44840            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44841          closeArray();
44842        }
44843        if (anyHasExtras(element.getNoteNumber())) {
44844          openArray("_noteNumber");
44845          for (PositiveIntType e : element.getNoteNumber()) 
44846            composePositiveIntExtras(null, e, true);
44847          closeArray();
44848        }
44849      };
44850      if (element.hasReviewOutcome()) {
44851        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44852      }
44853      if (element.hasAdjudication()) {
44854        openArray("adjudication");
44855        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44856          composeAdjudicationComponent(null, e);
44857        closeArray();
44858      };
44859      if (element.hasSubDetail()) {
44860        openArray("subDetail");
44861        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
44862          composeAddedItemSubDetailComponent(null, e);
44863        closeArray();
44864      };
44865  }
44866
44867  protected void composeAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
44868    if (element != null) {
44869      open(name);
44870      composeAddedItemSubDetailComponentProperties(element);
44871      close();
44872    }
44873  }
44874
44875  protected void composeAddedItemSubDetailComponentProperties(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
44876    composeBackboneElementProperties(element);
44877      if (element.hasTraceNumber()) {
44878        openArray("traceNumber");
44879        for (Identifier e : element.getTraceNumber()) 
44880          composeIdentifier(null, e);
44881        closeArray();
44882      };
44883      if (element.hasRevenue()) {
44884        composeCodeableConcept("revenue", element.getRevenue());
44885      }
44886      if (element.hasProductOrService()) {
44887        composeCodeableConcept("productOrService", element.getProductOrService());
44888      }
44889      if (element.hasProductOrServiceEnd()) {
44890        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
44891      }
44892      if (element.hasModifier()) {
44893        openArray("modifier");
44894        for (CodeableConcept e : element.getModifier()) 
44895          composeCodeableConcept(null, e);
44896        closeArray();
44897      };
44898      if (element.hasQuantity()) {
44899        composeQuantity("quantity", element.getQuantity());
44900      }
44901      if (element.hasUnitPrice()) {
44902        composeMoney("unitPrice", element.getUnitPrice());
44903      }
44904      if (element.hasFactorElement()) {
44905        composeDecimalCore("factor", element.getFactorElement(), false);
44906        composeDecimalExtras("factor", element.getFactorElement(), false);
44907      }
44908      if (element.hasTax()) {
44909        composeMoney("tax", element.getTax());
44910      }
44911      if (element.hasNet()) {
44912        composeMoney("net", element.getNet());
44913      }
44914      if (element.hasNoteNumber()) {
44915        if (anyHasValue(element.getNoteNumber())) {
44916          openArray("noteNumber");
44917          for (PositiveIntType e : element.getNoteNumber()) 
44918            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
44919          closeArray();
44920        }
44921        if (anyHasExtras(element.getNoteNumber())) {
44922          openArray("_noteNumber");
44923          for (PositiveIntType e : element.getNoteNumber()) 
44924            composePositiveIntExtras(null, e, true);
44925          closeArray();
44926        }
44927      };
44928      if (element.hasReviewOutcome()) {
44929        composeReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
44930      }
44931      if (element.hasAdjudication()) {
44932        openArray("adjudication");
44933        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
44934          composeAdjudicationComponent(null, e);
44935        closeArray();
44936      };
44937  }
44938
44939  protected void composeTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
44940    if (element != null) {
44941      open(name);
44942      composeTotalComponentProperties(element);
44943      close();
44944    }
44945  }
44946
44947  protected void composeTotalComponentProperties(ClaimResponse.TotalComponent element) throws IOException {
44948    composeBackboneElementProperties(element);
44949      if (element.hasCategory()) {
44950        composeCodeableConcept("category", element.getCategory());
44951      }
44952      if (element.hasAmount()) {
44953        composeMoney("amount", element.getAmount());
44954      }
44955  }
44956
44957  protected void composePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
44958    if (element != null) {
44959      open(name);
44960      composePaymentComponentProperties(element);
44961      close();
44962    }
44963  }
44964
44965  protected void composePaymentComponentProperties(ClaimResponse.PaymentComponent element) throws IOException {
44966    composeBackboneElementProperties(element);
44967      if (element.hasType()) {
44968        composeCodeableConcept("type", element.getType());
44969      }
44970      if (element.hasAdjustment()) {
44971        composeMoney("adjustment", element.getAdjustment());
44972      }
44973      if (element.hasAdjustmentReason()) {
44974        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
44975      }
44976      if (element.hasDateElement()) {
44977        composeDateCore("date", element.getDateElement(), false);
44978        composeDateExtras("date", element.getDateElement(), false);
44979      }
44980      if (element.hasAmount()) {
44981        composeMoney("amount", element.getAmount());
44982      }
44983      if (element.hasIdentifier()) {
44984        composeIdentifier("identifier", element.getIdentifier());
44985      }
44986  }
44987
44988  protected void composeNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
44989    if (element != null) {
44990      open(name);
44991      composeNoteComponentProperties(element);
44992      close();
44993    }
44994  }
44995
44996  protected void composeNoteComponentProperties(ClaimResponse.NoteComponent element) throws IOException {
44997    composeBackboneElementProperties(element);
44998      if (element.hasNumberElement()) {
44999        composePositiveIntCore("number", element.getNumberElement(), false);
45000        composePositiveIntExtras("number", element.getNumberElement(), false);
45001      }
45002      if (element.hasType()) {
45003        composeCodeableConcept("type", element.getType());
45004      }
45005      if (element.hasTextElement()) {
45006        composeStringCore("text", element.getTextElement(), false);
45007        composeStringExtras("text", element.getTextElement(), false);
45008      }
45009      if (element.hasLanguage()) {
45010        composeCodeableConcept("language", element.getLanguage());
45011      }
45012  }
45013
45014  protected void composeInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
45015    if (element != null) {
45016      open(name);
45017      composeInsuranceComponentProperties(element);
45018      close();
45019    }
45020  }
45021
45022  protected void composeInsuranceComponentProperties(ClaimResponse.InsuranceComponent element) throws IOException {
45023    composeBackboneElementProperties(element);
45024      if (element.hasSequenceElement()) {
45025        composePositiveIntCore("sequence", element.getSequenceElement(), false);
45026        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
45027      }
45028      if (element.hasFocalElement()) {
45029        composeBooleanCore("focal", element.getFocalElement(), false);
45030        composeBooleanExtras("focal", element.getFocalElement(), false);
45031      }
45032      if (element.hasCoverage()) {
45033        composeReference("coverage", element.getCoverage());
45034      }
45035      if (element.hasBusinessArrangementElement()) {
45036        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
45037        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
45038      }
45039      if (element.hasClaimResponse()) {
45040        composeReference("claimResponse", element.getClaimResponse());
45041      }
45042  }
45043
45044  protected void composeErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
45045    if (element != null) {
45046      open(name);
45047      composeErrorComponentProperties(element);
45048      close();
45049    }
45050  }
45051
45052  protected void composeErrorComponentProperties(ClaimResponse.ErrorComponent element) throws IOException {
45053    composeBackboneElementProperties(element);
45054      if (element.hasItemSequenceElement()) {
45055        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
45056        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
45057      }
45058      if (element.hasDetailSequenceElement()) {
45059        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
45060        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
45061      }
45062      if (element.hasSubDetailSequenceElement()) {
45063        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
45064        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
45065      }
45066      if (element.hasCode()) {
45067        composeCodeableConcept("code", element.getCode());
45068      }
45069      if (element.hasExpression()) {
45070        if (anyHasValue(element.getExpression())) {
45071          openArray("expression");
45072          for (StringType e : element.getExpression()) 
45073            composeStringCore(null, e, e != element.getExpression().get(element.getExpression().size()-1));
45074          closeArray();
45075        }
45076        if (anyHasExtras(element.getExpression())) {
45077          openArray("_expression");
45078          for (StringType e : element.getExpression()) 
45079            composeStringExtras(null, e, true);
45080          closeArray();
45081        }
45082      };
45083  }
45084
45085  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
45086    if (element != null) {
45087      prop("resourceType", name);
45088      composeClinicalImpressionProperties(element);
45089    }
45090  }
45091
45092  protected void composeClinicalImpressionProperties(ClinicalImpression element) throws IOException {
45093    composeDomainResourceProperties(element);
45094      if (element.hasIdentifier()) {
45095        openArray("identifier");
45096        for (Identifier e : element.getIdentifier()) 
45097          composeIdentifier(null, e);
45098        closeArray();
45099      };
45100      if (element.hasStatusElement()) {
45101        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45102        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45103      }
45104      if (element.hasStatusReason()) {
45105        composeCodeableConcept("statusReason", element.getStatusReason());
45106      }
45107      if (element.hasDescriptionElement()) {
45108        composeStringCore("description", element.getDescriptionElement(), false);
45109        composeStringExtras("description", element.getDescriptionElement(), false);
45110      }
45111      if (element.hasSubject()) {
45112        composeReference("subject", element.getSubject());
45113      }
45114      if (element.hasEncounter()) {
45115        composeReference("encounter", element.getEncounter());
45116      }
45117      if (element.hasEffective()) {
45118        composeType("effective", element.getEffective());
45119      }
45120      if (element.hasDateElement()) {
45121        composeDateTimeCore("date", element.getDateElement(), false);
45122        composeDateTimeExtras("date", element.getDateElement(), false);
45123      }
45124      if (element.hasPerformer()) {
45125        composeReference("performer", element.getPerformer());
45126      }
45127      if (element.hasPrevious()) {
45128        composeReference("previous", element.getPrevious());
45129      }
45130      if (element.hasProblem()) {
45131        openArray("problem");
45132        for (Reference e : element.getProblem()) 
45133          composeReference(null, e);
45134        closeArray();
45135      };
45136      if (element.hasChangePattern()) {
45137        composeCodeableConcept("changePattern", element.getChangePattern());
45138      }
45139      if (element.hasProtocol()) {
45140        if (anyHasValue(element.getProtocol())) {
45141          openArray("protocol");
45142          for (UriType e : element.getProtocol()) 
45143            composeUriCore(null, e, e != element.getProtocol().get(element.getProtocol().size()-1));
45144          closeArray();
45145        }
45146        if (anyHasExtras(element.getProtocol())) {
45147          openArray("_protocol");
45148          for (UriType e : element.getProtocol()) 
45149            composeUriExtras(null, e, true);
45150          closeArray();
45151        }
45152      };
45153      if (element.hasSummaryElement()) {
45154        composeStringCore("summary", element.getSummaryElement(), false);
45155        composeStringExtras("summary", element.getSummaryElement(), false);
45156      }
45157      if (element.hasFinding()) {
45158        openArray("finding");
45159        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
45160          composeClinicalImpressionFindingComponent(null, e);
45161        closeArray();
45162      };
45163      if (element.hasPrognosisCodeableConcept()) {
45164        openArray("prognosisCodeableConcept");
45165        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
45166          composeCodeableConcept(null, e);
45167        closeArray();
45168      };
45169      if (element.hasPrognosisReference()) {
45170        openArray("prognosisReference");
45171        for (Reference e : element.getPrognosisReference()) 
45172          composeReference(null, e);
45173        closeArray();
45174      };
45175      if (element.hasSupportingInfo()) {
45176        openArray("supportingInfo");
45177        for (Reference e : element.getSupportingInfo()) 
45178          composeReference(null, e);
45179        closeArray();
45180      };
45181      if (element.hasNote()) {
45182        openArray("note");
45183        for (Annotation e : element.getNote()) 
45184          composeAnnotation(null, e);
45185        closeArray();
45186      };
45187  }
45188
45189  protected void composeClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
45190    if (element != null) {
45191      open(name);
45192      composeClinicalImpressionFindingComponentProperties(element);
45193      close();
45194    }
45195  }
45196
45197  protected void composeClinicalImpressionFindingComponentProperties(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
45198    composeBackboneElementProperties(element);
45199      if (element.hasItem()) {
45200        composeCodeableReference("item", element.getItem());
45201      }
45202      if (element.hasBasisElement()) {
45203        composeStringCore("basis", element.getBasisElement(), false);
45204        composeStringExtras("basis", element.getBasisElement(), false);
45205      }
45206  }
45207
45208  protected void composeClinicalUseDefinition(String name, ClinicalUseDefinition element) throws IOException {
45209    if (element != null) {
45210      prop("resourceType", name);
45211      composeClinicalUseDefinitionProperties(element);
45212    }
45213  }
45214
45215  protected void composeClinicalUseDefinitionProperties(ClinicalUseDefinition element) throws IOException {
45216    composeDomainResourceProperties(element);
45217      if (element.hasIdentifier()) {
45218        openArray("identifier");
45219        for (Identifier e : element.getIdentifier()) 
45220          composeIdentifier(null, e);
45221        closeArray();
45222      };
45223      if (element.hasTypeElement()) {
45224        composeEnumerationCore("type", element.getTypeElement(), new ClinicalUseDefinition.ClinicalUseDefinitionTypeEnumFactory(), false);
45225        composeEnumerationExtras("type", element.getTypeElement(), new ClinicalUseDefinition.ClinicalUseDefinitionTypeEnumFactory(), false);
45226      }
45227      if (element.hasCategory()) {
45228        openArray("category");
45229        for (CodeableConcept e : element.getCategory()) 
45230          composeCodeableConcept(null, e);
45231        closeArray();
45232      };
45233      if (element.hasSubject()) {
45234        openArray("subject");
45235        for (Reference e : element.getSubject()) 
45236          composeReference(null, e);
45237        closeArray();
45238      };
45239      if (element.hasStatus()) {
45240        composeCodeableConcept("status", element.getStatus());
45241      }
45242      if (element.hasContraindication()) {
45243        composeClinicalUseDefinitionContraindicationComponent("contraindication", element.getContraindication());
45244      }
45245      if (element.hasIndication()) {
45246        composeClinicalUseDefinitionIndicationComponent("indication", element.getIndication());
45247      }
45248      if (element.hasInteraction()) {
45249        composeClinicalUseDefinitionInteractionComponent("interaction", element.getInteraction());
45250      }
45251      if (element.hasPopulation()) {
45252        openArray("population");
45253        for (Reference e : element.getPopulation()) 
45254          composeReference(null, e);
45255        closeArray();
45256      };
45257      if (element.hasLibrary()) {
45258        if (anyHasValue(element.getLibrary())) {
45259          openArray("library");
45260          for (CanonicalType e : element.getLibrary()) 
45261            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
45262          closeArray();
45263        }
45264        if (anyHasExtras(element.getLibrary())) {
45265          openArray("_library");
45266          for (CanonicalType e : element.getLibrary()) 
45267            composeCanonicalExtras(null, e, true);
45268          closeArray();
45269        }
45270      };
45271      if (element.hasUndesirableEffect()) {
45272        composeClinicalUseDefinitionUndesirableEffectComponent("undesirableEffect", element.getUndesirableEffect());
45273      }
45274      if (element.hasWarning()) {
45275        composeClinicalUseDefinitionWarningComponent("warning", element.getWarning());
45276      }
45277  }
45278
45279  protected void composeClinicalUseDefinitionContraindicationComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent element) throws IOException {
45280    if (element != null) {
45281      open(name);
45282      composeClinicalUseDefinitionContraindicationComponentProperties(element);
45283      close();
45284    }
45285  }
45286
45287  protected void composeClinicalUseDefinitionContraindicationComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent element) throws IOException {
45288    composeBackboneElementProperties(element);
45289      if (element.hasDiseaseSymptomProcedure()) {
45290        composeCodeableReference("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
45291      }
45292      if (element.hasDiseaseStatus()) {
45293        composeCodeableReference("diseaseStatus", element.getDiseaseStatus());
45294      }
45295      if (element.hasComorbidity()) {
45296        openArray("comorbidity");
45297        for (CodeableReference e : element.getComorbidity()) 
45298          composeCodeableReference(null, e);
45299        closeArray();
45300      };
45301      if (element.hasIndication()) {
45302        openArray("indication");
45303        for (Reference e : element.getIndication()) 
45304          composeReference(null, e);
45305        closeArray();
45306      };
45307      if (element.hasApplicability()) {
45308        composeExpression("applicability", element.getApplicability());
45309      }
45310      if (element.hasOtherTherapy()) {
45311        openArray("otherTherapy");
45312        for (ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
45313          composeClinicalUseDefinitionContraindicationOtherTherapyComponent(null, e);
45314        closeArray();
45315      };
45316  }
45317
45318  protected void composeClinicalUseDefinitionContraindicationOtherTherapyComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent element) throws IOException {
45319    if (element != null) {
45320      open(name);
45321      composeClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(element);
45322      close();
45323    }
45324  }
45325
45326  protected void composeClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent element) throws IOException {
45327    composeBackboneElementProperties(element);
45328      if (element.hasRelationshipType()) {
45329        composeCodeableConcept("relationshipType", element.getRelationshipType());
45330      }
45331      if (element.hasTreatment()) {
45332        composeCodeableReference("treatment", element.getTreatment());
45333      }
45334  }
45335
45336  protected void composeClinicalUseDefinitionIndicationComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent element) throws IOException {
45337    if (element != null) {
45338      open(name);
45339      composeClinicalUseDefinitionIndicationComponentProperties(element);
45340      close();
45341    }
45342  }
45343
45344  protected void composeClinicalUseDefinitionIndicationComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent element) throws IOException {
45345    composeBackboneElementProperties(element);
45346      if (element.hasDiseaseSymptomProcedure()) {
45347        composeCodeableReference("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
45348      }
45349      if (element.hasDiseaseStatus()) {
45350        composeCodeableReference("diseaseStatus", element.getDiseaseStatus());
45351      }
45352      if (element.hasComorbidity()) {
45353        openArray("comorbidity");
45354        for (CodeableReference e : element.getComorbidity()) 
45355          composeCodeableReference(null, e);
45356        closeArray();
45357      };
45358      if (element.hasIntendedEffect()) {
45359        composeCodeableReference("intendedEffect", element.getIntendedEffect());
45360      }
45361      if (element.hasDuration()) {
45362        composeType("duration", element.getDuration());
45363      }
45364      if (element.hasUndesirableEffect()) {
45365        openArray("undesirableEffect");
45366        for (Reference e : element.getUndesirableEffect()) 
45367          composeReference(null, e);
45368        closeArray();
45369      };
45370      if (element.hasApplicability()) {
45371        composeExpression("applicability", element.getApplicability());
45372      }
45373      if (element.hasOtherTherapy()) {
45374        openArray("otherTherapy");
45375        for (ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
45376          composeClinicalUseDefinitionContraindicationOtherTherapyComponent(null, e);
45377        closeArray();
45378      };
45379  }
45380
45381  protected void composeClinicalUseDefinitionInteractionComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent element) throws IOException {
45382    if (element != null) {
45383      open(name);
45384      composeClinicalUseDefinitionInteractionComponentProperties(element);
45385      close();
45386    }
45387  }
45388
45389  protected void composeClinicalUseDefinitionInteractionComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent element) throws IOException {
45390    composeBackboneElementProperties(element);
45391      if (element.hasInteractant()) {
45392        openArray("interactant");
45393        for (ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent e : element.getInteractant()) 
45394          composeClinicalUseDefinitionInteractionInteractantComponent(null, e);
45395        closeArray();
45396      };
45397      if (element.hasType()) {
45398        composeCodeableConcept("type", element.getType());
45399      }
45400      if (element.hasEffect()) {
45401        composeCodeableReference("effect", element.getEffect());
45402      }
45403      if (element.hasIncidence()) {
45404        composeCodeableConcept("incidence", element.getIncidence());
45405      }
45406      if (element.hasManagement()) {
45407        openArray("management");
45408        for (CodeableConcept e : element.getManagement()) 
45409          composeCodeableConcept(null, e);
45410        closeArray();
45411      };
45412  }
45413
45414  protected void composeClinicalUseDefinitionInteractionInteractantComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent element) throws IOException {
45415    if (element != null) {
45416      open(name);
45417      composeClinicalUseDefinitionInteractionInteractantComponentProperties(element);
45418      close();
45419    }
45420  }
45421
45422  protected void composeClinicalUseDefinitionInteractionInteractantComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent element) throws IOException {
45423    composeBackboneElementProperties(element);
45424      if (element.hasItem()) {
45425        composeType("item", element.getItem());
45426      }
45427  }
45428
45429  protected void composeClinicalUseDefinitionUndesirableEffectComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent element) throws IOException {
45430    if (element != null) {
45431      open(name);
45432      composeClinicalUseDefinitionUndesirableEffectComponentProperties(element);
45433      close();
45434    }
45435  }
45436
45437  protected void composeClinicalUseDefinitionUndesirableEffectComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent element) throws IOException {
45438    composeBackboneElementProperties(element);
45439      if (element.hasSymptomConditionEffect()) {
45440        composeCodeableReference("symptomConditionEffect", element.getSymptomConditionEffect());
45441      }
45442      if (element.hasClassification()) {
45443        composeCodeableConcept("classification", element.getClassification());
45444      }
45445      if (element.hasFrequencyOfOccurrence()) {
45446        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
45447      }
45448  }
45449
45450  protected void composeClinicalUseDefinitionWarningComponent(String name, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent element) throws IOException {
45451    if (element != null) {
45452      open(name);
45453      composeClinicalUseDefinitionWarningComponentProperties(element);
45454      close();
45455    }
45456  }
45457
45458  protected void composeClinicalUseDefinitionWarningComponentProperties(ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent element) throws IOException {
45459    composeBackboneElementProperties(element);
45460      if (element.hasDescriptionElement()) {
45461        composeMarkdownCore("description", element.getDescriptionElement(), false);
45462        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45463      }
45464      if (element.hasCode()) {
45465        composeCodeableConcept("code", element.getCode());
45466      }
45467  }
45468
45469  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
45470    if (element != null) {
45471      prop("resourceType", name);
45472      composeCodeSystemProperties(element);
45473    }
45474  }
45475
45476  protected void composeCodeSystemProperties(CodeSystem element) throws IOException {
45477    composeMetadataResourceProperties(element);
45478      if (element.hasUrlElement()) {
45479        composeUriCore("url", element.getUrlElement(), false);
45480        composeUriExtras("url", element.getUrlElement(), false);
45481      }
45482      if (element.hasIdentifier()) {
45483        openArray("identifier");
45484        for (Identifier e : element.getIdentifier()) 
45485          composeIdentifier(null, e);
45486        closeArray();
45487      };
45488      if (element.hasVersionElement()) {
45489        composeStringCore("version", element.getVersionElement(), false);
45490        composeStringExtras("version", element.getVersionElement(), false);
45491      }
45492      if (element.hasVersionAlgorithm()) {
45493        composeType("versionAlgorithm", element.getVersionAlgorithm());
45494      }
45495      if (element.hasNameElement()) {
45496        composeStringCore("name", element.getNameElement(), false);
45497        composeStringExtras("name", element.getNameElement(), false);
45498      }
45499      if (element.hasTitleElement()) {
45500        composeStringCore("title", element.getTitleElement(), false);
45501        composeStringExtras("title", element.getTitleElement(), false);
45502      }
45503      if (element.hasStatusElement()) {
45504        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45505        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45506      }
45507      if (element.hasExperimentalElement()) {
45508        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45509        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45510      }
45511      if (element.hasDateElement()) {
45512        composeDateTimeCore("date", element.getDateElement(), false);
45513        composeDateTimeExtras("date", element.getDateElement(), false);
45514      }
45515      if (element.hasPublisherElement()) {
45516        composeStringCore("publisher", element.getPublisherElement(), false);
45517        composeStringExtras("publisher", element.getPublisherElement(), false);
45518      }
45519      if (element.hasContact()) {
45520        openArray("contact");
45521        for (ContactDetail e : element.getContact()) 
45522          composeContactDetail(null, e);
45523        closeArray();
45524      };
45525      if (element.hasDescriptionElement()) {
45526        composeMarkdownCore("description", element.getDescriptionElement(), false);
45527        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45528      }
45529      if (element.hasUseContext()) {
45530        openArray("useContext");
45531        for (UsageContext e : element.getUseContext()) 
45532          composeUsageContext(null, e);
45533        closeArray();
45534      };
45535      if (element.hasJurisdiction()) {
45536        openArray("jurisdiction");
45537        for (CodeableConcept e : element.getJurisdiction()) 
45538          composeCodeableConcept(null, e);
45539        closeArray();
45540      };
45541      if (element.hasPurposeElement()) {
45542        composeMarkdownCore("purpose", element.getPurposeElement(), false);
45543        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45544      }
45545      if (element.hasCopyrightElement()) {
45546        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45547        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45548      }
45549      if (element.hasCopyrightLabelElement()) {
45550        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
45551        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
45552      }
45553      if (element.hasApprovalDateElement()) {
45554        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45555        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45556      }
45557      if (element.hasLastReviewDateElement()) {
45558        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45559        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45560      }
45561      if (element.hasEffectivePeriod()) {
45562        composePeriod("effectivePeriod", element.getEffectivePeriod());
45563      }
45564      if (element.hasTopic()) {
45565        openArray("topic");
45566        for (CodeableConcept e : element.getTopic()) 
45567          composeCodeableConcept(null, e);
45568        closeArray();
45569      };
45570      if (element.hasAuthor()) {
45571        openArray("author");
45572        for (ContactDetail e : element.getAuthor()) 
45573          composeContactDetail(null, e);
45574        closeArray();
45575      };
45576      if (element.hasEditor()) {
45577        openArray("editor");
45578        for (ContactDetail e : element.getEditor()) 
45579          composeContactDetail(null, e);
45580        closeArray();
45581      };
45582      if (element.hasReviewer()) {
45583        openArray("reviewer");
45584        for (ContactDetail e : element.getReviewer()) 
45585          composeContactDetail(null, e);
45586        closeArray();
45587      };
45588      if (element.hasEndorser()) {
45589        openArray("endorser");
45590        for (ContactDetail e : element.getEndorser()) 
45591          composeContactDetail(null, e);
45592        closeArray();
45593      };
45594      if (element.hasRelatedArtifact()) {
45595        openArray("relatedArtifact");
45596        for (RelatedArtifact e : element.getRelatedArtifact()) 
45597          composeRelatedArtifact(null, e);
45598        closeArray();
45599      };
45600      if (element.hasCaseSensitiveElement()) {
45601        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
45602        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
45603      }
45604      if (element.hasValueSetElement()) {
45605        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
45606        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
45607      }
45608      if (element.hasHierarchyMeaningElement()) {
45609        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
45610        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
45611      }
45612      if (element.hasCompositionalElement()) {
45613        composeBooleanCore("compositional", element.getCompositionalElement(), false);
45614        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
45615      }
45616      if (element.hasVersionNeededElement()) {
45617        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
45618        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
45619      }
45620      if (element.hasContentElement()) {
45621        composeEnumerationCore("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
45622        composeEnumerationExtras("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
45623      }
45624      if (element.hasSupplementsElement()) {
45625        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
45626        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
45627      }
45628      if (element.hasCountElement()) {
45629        composeUnsignedIntCore("count", element.getCountElement(), false);
45630        composeUnsignedIntExtras("count", element.getCountElement(), false);
45631      }
45632      if (element.hasFilter()) {
45633        openArray("filter");
45634        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
45635          composeCodeSystemFilterComponent(null, e);
45636        closeArray();
45637      };
45638      if (element.hasProperty()) {
45639        openArray("property");
45640        for (CodeSystem.PropertyComponent e : element.getProperty()) 
45641          composePropertyComponent(null, e);
45642        closeArray();
45643      };
45644      if (element.hasConcept()) {
45645        openArray("concept");
45646        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
45647          composeConceptDefinitionComponent(null, e);
45648        closeArray();
45649      };
45650  }
45651
45652  protected void composeCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
45653    if (element != null) {
45654      open(name);
45655      composeCodeSystemFilterComponentProperties(element);
45656      close();
45657    }
45658  }
45659
45660  protected void composeCodeSystemFilterComponentProperties(CodeSystem.CodeSystemFilterComponent element) throws IOException {
45661    composeBackboneElementProperties(element);
45662      if (element.hasCodeElement()) {
45663        composeCodeCore("code", element.getCodeElement(), false);
45664        composeCodeExtras("code", element.getCodeElement(), false);
45665      }
45666      if (element.hasDescriptionElement()) {
45667        composeStringCore("description", element.getDescriptionElement(), false);
45668        composeStringExtras("description", element.getDescriptionElement(), false);
45669      }
45670      if (element.hasOperator()) {
45671        openArray("operator");
45672        for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
45673          composeEnumerationCore(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
45674        closeArray();
45675        if (anyHasExtras(element.getOperator())) {
45676          openArray("_operator");
45677          for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
45678            composeEnumerationExtras(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
45679          closeArray();
45680        }
45681      };
45682      if (element.hasValueElement()) {
45683        composeStringCore("value", element.getValueElement(), false);
45684        composeStringExtras("value", element.getValueElement(), false);
45685      }
45686  }
45687
45688  protected void composePropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
45689    if (element != null) {
45690      open(name);
45691      composePropertyComponentProperties(element);
45692      close();
45693    }
45694  }
45695
45696  protected void composePropertyComponentProperties(CodeSystem.PropertyComponent element) throws IOException {
45697    composeBackboneElementProperties(element);
45698      if (element.hasCodeElement()) {
45699        composeCodeCore("code", element.getCodeElement(), false);
45700        composeCodeExtras("code", element.getCodeElement(), false);
45701      }
45702      if (element.hasUriElement()) {
45703        composeUriCore("uri", element.getUriElement(), false);
45704        composeUriExtras("uri", element.getUriElement(), false);
45705      }
45706      if (element.hasDescriptionElement()) {
45707        composeStringCore("description", element.getDescriptionElement(), false);
45708        composeStringExtras("description", element.getDescriptionElement(), false);
45709      }
45710      if (element.hasTypeElement()) {
45711        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
45712        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
45713      }
45714  }
45715
45716  protected void composeConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
45717    if (element != null) {
45718      open(name);
45719      composeConceptDefinitionComponentProperties(element);
45720      close();
45721    }
45722  }
45723
45724  protected void composeConceptDefinitionComponentProperties(CodeSystem.ConceptDefinitionComponent element) throws IOException {
45725    composeBackboneElementProperties(element);
45726      if (element.hasCodeElement()) {
45727        composeCodeCore("code", element.getCodeElement(), false);
45728        composeCodeExtras("code", element.getCodeElement(), false);
45729      }
45730      if (element.hasDisplayElement()) {
45731        composeStringCore("display", element.getDisplayElement(), false);
45732        composeStringExtras("display", element.getDisplayElement(), false);
45733      }
45734      if (element.hasDefinitionElement()) {
45735        composeStringCore("definition", element.getDefinitionElement(), false);
45736        composeStringExtras("definition", element.getDefinitionElement(), false);
45737      }
45738      if (element.hasDesignation()) {
45739        openArray("designation");
45740        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
45741          composeConceptDefinitionDesignationComponent(null, e);
45742        closeArray();
45743      };
45744      if (element.hasProperty()) {
45745        openArray("property");
45746        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
45747          composeConceptPropertyComponent(null, e);
45748        closeArray();
45749      };
45750      if (element.hasConcept()) {
45751        openArray("concept");
45752        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
45753          composeConceptDefinitionComponent(null, e);
45754        closeArray();
45755      };
45756  }
45757
45758  protected void composeConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
45759    if (element != null) {
45760      open(name);
45761      composeConceptDefinitionDesignationComponentProperties(element);
45762      close();
45763    }
45764  }
45765
45766  protected void composeConceptDefinitionDesignationComponentProperties(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
45767    composeBackboneElementProperties(element);
45768      if (element.hasLanguageElement()) {
45769        composeCodeCore("language", element.getLanguageElement(), false);
45770        composeCodeExtras("language", element.getLanguageElement(), false);
45771      }
45772      if (element.hasUse()) {
45773        composeCoding("use", element.getUse());
45774      }
45775      if (element.hasAdditionalUse()) {
45776        openArray("additionalUse");
45777        for (Coding e : element.getAdditionalUse()) 
45778          composeCoding(null, e);
45779        closeArray();
45780      };
45781      if (element.hasValueElement()) {
45782        composeStringCore("value", element.getValueElement(), false);
45783        composeStringExtras("value", element.getValueElement(), false);
45784      }
45785  }
45786
45787  protected void composeConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
45788    if (element != null) {
45789      open(name);
45790      composeConceptPropertyComponentProperties(element);
45791      close();
45792    }
45793  }
45794
45795  protected void composeConceptPropertyComponentProperties(CodeSystem.ConceptPropertyComponent element) throws IOException {
45796    composeBackboneElementProperties(element);
45797      if (element.hasCodeElement()) {
45798        composeCodeCore("code", element.getCodeElement(), false);
45799        composeCodeExtras("code", element.getCodeElement(), false);
45800      }
45801      if (element.hasValue()) {
45802        composeType("value", element.getValue());
45803      }
45804  }
45805
45806  protected void composeCommunication(String name, Communication element) throws IOException {
45807    if (element != null) {
45808      prop("resourceType", name);
45809      composeCommunicationProperties(element);
45810    }
45811  }
45812
45813  protected void composeCommunicationProperties(Communication element) throws IOException {
45814    composeDomainResourceProperties(element);
45815      if (element.hasIdentifier()) {
45816        openArray("identifier");
45817        for (Identifier e : element.getIdentifier()) 
45818          composeIdentifier(null, e);
45819        closeArray();
45820      };
45821      if (element.hasInstantiatesCanonical()) {
45822        if (anyHasValue(element.getInstantiatesCanonical())) {
45823          openArray("instantiatesCanonical");
45824          for (CanonicalType e : element.getInstantiatesCanonical()) 
45825            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
45826          closeArray();
45827        }
45828        if (anyHasExtras(element.getInstantiatesCanonical())) {
45829          openArray("_instantiatesCanonical");
45830          for (CanonicalType e : element.getInstantiatesCanonical()) 
45831            composeCanonicalExtras(null, e, true);
45832          closeArray();
45833        }
45834      };
45835      if (element.hasInstantiatesUri()) {
45836        if (anyHasValue(element.getInstantiatesUri())) {
45837          openArray("instantiatesUri");
45838          for (UriType e : element.getInstantiatesUri()) 
45839            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
45840          closeArray();
45841        }
45842        if (anyHasExtras(element.getInstantiatesUri())) {
45843          openArray("_instantiatesUri");
45844          for (UriType e : element.getInstantiatesUri()) 
45845            composeUriExtras(null, e, true);
45846          closeArray();
45847        }
45848      };
45849      if (element.hasBasedOn()) {
45850        openArray("basedOn");
45851        for (Reference e : element.getBasedOn()) 
45852          composeReference(null, e);
45853        closeArray();
45854      };
45855      if (element.hasPartOf()) {
45856        openArray("partOf");
45857        for (Reference e : element.getPartOf()) 
45858          composeReference(null, e);
45859        closeArray();
45860      };
45861      if (element.hasInResponseTo()) {
45862        openArray("inResponseTo");
45863        for (Reference e : element.getInResponseTo()) 
45864          composeReference(null, e);
45865        closeArray();
45866      };
45867      if (element.hasStatusElement()) {
45868        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45869        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
45870      }
45871      if (element.hasStatusReason()) {
45872        composeCodeableConcept("statusReason", element.getStatusReason());
45873      }
45874      if (element.hasCategory()) {
45875        openArray("category");
45876        for (CodeableConcept e : element.getCategory()) 
45877          composeCodeableConcept(null, e);
45878        closeArray();
45879      };
45880      if (element.hasPriorityElement()) {
45881        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
45882        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
45883      }
45884      if (element.hasMedium()) {
45885        openArray("medium");
45886        for (CodeableConcept e : element.getMedium()) 
45887          composeCodeableConcept(null, e);
45888        closeArray();
45889      };
45890      if (element.hasSubject()) {
45891        composeReference("subject", element.getSubject());
45892      }
45893      if (element.hasTopic()) {
45894        composeCodeableConcept("topic", element.getTopic());
45895      }
45896      if (element.hasAbout()) {
45897        openArray("about");
45898        for (Reference e : element.getAbout()) 
45899          composeReference(null, e);
45900        closeArray();
45901      };
45902      if (element.hasEncounter()) {
45903        composeReference("encounter", element.getEncounter());
45904      }
45905      if (element.hasSentElement()) {
45906        composeDateTimeCore("sent", element.getSentElement(), false);
45907        composeDateTimeExtras("sent", element.getSentElement(), false);
45908      }
45909      if (element.hasReceivedElement()) {
45910        composeDateTimeCore("received", element.getReceivedElement(), false);
45911        composeDateTimeExtras("received", element.getReceivedElement(), false);
45912      }
45913      if (element.hasRecipient()) {
45914        openArray("recipient");
45915        for (Reference e : element.getRecipient()) 
45916          composeReference(null, e);
45917        closeArray();
45918      };
45919      if (element.hasSender()) {
45920        composeReference("sender", element.getSender());
45921      }
45922      if (element.hasReason()) {
45923        openArray("reason");
45924        for (CodeableReference e : element.getReason()) 
45925          composeCodeableReference(null, e);
45926        closeArray();
45927      };
45928      if (element.hasPayload()) {
45929        openArray("payload");
45930        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
45931          composeCommunicationPayloadComponent(null, e);
45932        closeArray();
45933      };
45934      if (element.hasNote()) {
45935        openArray("note");
45936        for (Annotation e : element.getNote()) 
45937          composeAnnotation(null, e);
45938        closeArray();
45939      };
45940  }
45941
45942  protected void composeCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
45943    if (element != null) {
45944      open(name);
45945      composeCommunicationPayloadComponentProperties(element);
45946      close();
45947    }
45948  }
45949
45950  protected void composeCommunicationPayloadComponentProperties(Communication.CommunicationPayloadComponent element) throws IOException {
45951    composeBackboneElementProperties(element);
45952      if (element.hasContent()) {
45953        composeType("content", element.getContent());
45954      }
45955  }
45956
45957  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
45958    if (element != null) {
45959      prop("resourceType", name);
45960      composeCommunicationRequestProperties(element);
45961    }
45962  }
45963
45964  protected void composeCommunicationRequestProperties(CommunicationRequest element) throws IOException {
45965    composeDomainResourceProperties(element);
45966      if (element.hasIdentifier()) {
45967        openArray("identifier");
45968        for (Identifier e : element.getIdentifier()) 
45969          composeIdentifier(null, e);
45970        closeArray();
45971      };
45972      if (element.hasBasedOn()) {
45973        openArray("basedOn");
45974        for (Reference e : element.getBasedOn()) 
45975          composeReference(null, e);
45976        closeArray();
45977      };
45978      if (element.hasReplaces()) {
45979        openArray("replaces");
45980        for (Reference e : element.getReplaces()) 
45981          composeReference(null, e);
45982        closeArray();
45983      };
45984      if (element.hasGroupIdentifier()) {
45985        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
45986      }
45987      if (element.hasStatusElement()) {
45988        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
45989        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
45990      }
45991      if (element.hasStatusReason()) {
45992        composeCodeableConcept("statusReason", element.getStatusReason());
45993      }
45994      if (element.hasIntentElement()) {
45995        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
45996        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
45997      }
45998      if (element.hasCategory()) {
45999        openArray("category");
46000        for (CodeableConcept e : element.getCategory()) 
46001          composeCodeableConcept(null, e);
46002        closeArray();
46003      };
46004      if (element.hasPriorityElement()) {
46005        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
46006        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
46007      }
46008      if (element.hasDoNotPerformElement()) {
46009        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
46010        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
46011      }
46012      if (element.hasMedium()) {
46013        openArray("medium");
46014        for (CodeableConcept e : element.getMedium()) 
46015          composeCodeableConcept(null, e);
46016        closeArray();
46017      };
46018      if (element.hasSubject()) {
46019        composeReference("subject", element.getSubject());
46020      }
46021      if (element.hasAbout()) {
46022        openArray("about");
46023        for (Reference e : element.getAbout()) 
46024          composeReference(null, e);
46025        closeArray();
46026      };
46027      if (element.hasEncounter()) {
46028        composeReference("encounter", element.getEncounter());
46029      }
46030      if (element.hasPayload()) {
46031        openArray("payload");
46032        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
46033          composeCommunicationRequestPayloadComponent(null, e);
46034        closeArray();
46035      };
46036      if (element.hasOccurrence()) {
46037        composeType("occurrence", element.getOccurrence());
46038      }
46039      if (element.hasAuthoredOnElement()) {
46040        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
46041        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
46042      }
46043      if (element.hasRequester()) {
46044        composeReference("requester", element.getRequester());
46045      }
46046      if (element.hasRecipient()) {
46047        openArray("recipient");
46048        for (Reference e : element.getRecipient()) 
46049          composeReference(null, e);
46050        closeArray();
46051      };
46052      if (element.hasInformationProvider()) {
46053        openArray("informationProvider");
46054        for (Reference e : element.getInformationProvider()) 
46055          composeReference(null, e);
46056        closeArray();
46057      };
46058      if (element.hasReason()) {
46059        openArray("reason");
46060        for (CodeableReference e : element.getReason()) 
46061          composeCodeableReference(null, e);
46062        closeArray();
46063      };
46064      if (element.hasNote()) {
46065        openArray("note");
46066        for (Annotation e : element.getNote()) 
46067          composeAnnotation(null, e);
46068        closeArray();
46069      };
46070  }
46071
46072  protected void composeCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
46073    if (element != null) {
46074      open(name);
46075      composeCommunicationRequestPayloadComponentProperties(element);
46076      close();
46077    }
46078  }
46079
46080  protected void composeCommunicationRequestPayloadComponentProperties(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
46081    composeBackboneElementProperties(element);
46082      if (element.hasContent()) {
46083        composeType("content", element.getContent());
46084      }
46085  }
46086
46087  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
46088    if (element != null) {
46089      prop("resourceType", name);
46090      composeCompartmentDefinitionProperties(element);
46091    }
46092  }
46093
46094  protected void composeCompartmentDefinitionProperties(CompartmentDefinition element) throws IOException {
46095    composeCanonicalResourceProperties(element);
46096      if (element.hasUrlElement()) {
46097        composeUriCore("url", element.getUrlElement(), false);
46098        composeUriExtras("url", element.getUrlElement(), false);
46099      }
46100      if (element.hasVersionElement()) {
46101        composeStringCore("version", element.getVersionElement(), false);
46102        composeStringExtras("version", element.getVersionElement(), false);
46103      }
46104      if (element.hasVersionAlgorithm()) {
46105        composeType("versionAlgorithm", element.getVersionAlgorithm());
46106      }
46107      if (element.hasNameElement()) {
46108        composeStringCore("name", element.getNameElement(), false);
46109        composeStringExtras("name", element.getNameElement(), false);
46110      }
46111      if (element.hasTitleElement()) {
46112        composeStringCore("title", element.getTitleElement(), false);
46113        composeStringExtras("title", element.getTitleElement(), false);
46114      }
46115      if (element.hasStatusElement()) {
46116        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46117        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46118      }
46119      if (element.hasExperimentalElement()) {
46120        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46121        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46122      }
46123      if (element.hasDateElement()) {
46124        composeDateTimeCore("date", element.getDateElement(), false);
46125        composeDateTimeExtras("date", element.getDateElement(), false);
46126      }
46127      if (element.hasPublisherElement()) {
46128        composeStringCore("publisher", element.getPublisherElement(), false);
46129        composeStringExtras("publisher", element.getPublisherElement(), false);
46130      }
46131      if (element.hasContact()) {
46132        openArray("contact");
46133        for (ContactDetail e : element.getContact()) 
46134          composeContactDetail(null, e);
46135        closeArray();
46136      };
46137      if (element.hasDescriptionElement()) {
46138        composeMarkdownCore("description", element.getDescriptionElement(), false);
46139        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46140      }
46141      if (element.hasUseContext()) {
46142        openArray("useContext");
46143        for (UsageContext e : element.getUseContext()) 
46144          composeUsageContext(null, e);
46145        closeArray();
46146      };
46147      if (element.hasPurposeElement()) {
46148        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46149        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46150      }
46151      if (element.hasCodeElement()) {
46152        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
46153        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
46154      }
46155      if (element.hasSearchElement()) {
46156        composeBooleanCore("search", element.getSearchElement(), false);
46157        composeBooleanExtras("search", element.getSearchElement(), false);
46158      }
46159      if (element.hasResource()) {
46160        openArray("resource");
46161        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
46162          composeCompartmentDefinitionResourceComponent(null, e);
46163        closeArray();
46164      };
46165  }
46166
46167  protected void composeCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
46168    if (element != null) {
46169      open(name);
46170      composeCompartmentDefinitionResourceComponentProperties(element);
46171      close();
46172    }
46173  }
46174
46175  protected void composeCompartmentDefinitionResourceComponentProperties(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
46176    composeBackboneElementProperties(element);
46177      if (element.hasCodeElement()) {
46178        composeCodeCore("code", element.getCodeElement(), false);
46179        composeCodeExtras("code", element.getCodeElement(), false);
46180      }
46181      if (element.hasParam()) {
46182        if (anyHasValue(element.getParam())) {
46183          openArray("param");
46184          for (StringType e : element.getParam()) 
46185            composeStringCore(null, e, e != element.getParam().get(element.getParam().size()-1));
46186          closeArray();
46187        }
46188        if (anyHasExtras(element.getParam())) {
46189          openArray("_param");
46190          for (StringType e : element.getParam()) 
46191            composeStringExtras(null, e, true);
46192          closeArray();
46193        }
46194      };
46195      if (element.hasDocumentationElement()) {
46196        composeStringCore("documentation", element.getDocumentationElement(), false);
46197        composeStringExtras("documentation", element.getDocumentationElement(), false);
46198      }
46199      if (element.hasStartParamElement()) {
46200        composeUriCore("startParam", element.getStartParamElement(), false);
46201        composeUriExtras("startParam", element.getStartParamElement(), false);
46202      }
46203      if (element.hasEndParamElement()) {
46204        composeUriCore("endParam", element.getEndParamElement(), false);
46205        composeUriExtras("endParam", element.getEndParamElement(), false);
46206      }
46207  }
46208
46209  protected void composeComposition(String name, Composition element) throws IOException {
46210    if (element != null) {
46211      prop("resourceType", name);
46212      composeCompositionProperties(element);
46213    }
46214  }
46215
46216  protected void composeCompositionProperties(Composition element) throws IOException {
46217    composeDomainResourceProperties(element);
46218      if (element.hasUrlElement()) {
46219        composeUriCore("url", element.getUrlElement(), false);
46220        composeUriExtras("url", element.getUrlElement(), false);
46221      }
46222      if (element.hasIdentifier()) {
46223        openArray("identifier");
46224        for (Identifier e : element.getIdentifier()) 
46225          composeIdentifier(null, e);
46226        closeArray();
46227      };
46228      if (element.hasVersionElement()) {
46229        composeStringCore("version", element.getVersionElement(), false);
46230        composeStringExtras("version", element.getVersionElement(), false);
46231      }
46232      if (element.hasStatusElement()) {
46233        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
46234        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
46235      }
46236      if (element.hasType()) {
46237        composeCodeableConcept("type", element.getType());
46238      }
46239      if (element.hasCategory()) {
46240        openArray("category");
46241        for (CodeableConcept e : element.getCategory()) 
46242          composeCodeableConcept(null, e);
46243        closeArray();
46244      };
46245      if (element.hasSubject()) {
46246        openArray("subject");
46247        for (Reference e : element.getSubject()) 
46248          composeReference(null, e);
46249        closeArray();
46250      };
46251      if (element.hasEncounter()) {
46252        composeReference("encounter", element.getEncounter());
46253      }
46254      if (element.hasDateElement()) {
46255        composeDateTimeCore("date", element.getDateElement(), false);
46256        composeDateTimeExtras("date", element.getDateElement(), false);
46257      }
46258      if (element.hasUseContext()) {
46259        openArray("useContext");
46260        for (UsageContext e : element.getUseContext()) 
46261          composeUsageContext(null, e);
46262        closeArray();
46263      };
46264      if (element.hasAuthor()) {
46265        openArray("author");
46266        for (Reference e : element.getAuthor()) 
46267          composeReference(null, e);
46268        closeArray();
46269      };
46270      if (element.hasNameElement()) {
46271        composeStringCore("name", element.getNameElement(), false);
46272        composeStringExtras("name", element.getNameElement(), false);
46273      }
46274      if (element.hasTitleElement()) {
46275        composeStringCore("title", element.getTitleElement(), false);
46276        composeStringExtras("title", element.getTitleElement(), false);
46277      }
46278      if (element.hasNote()) {
46279        openArray("note");
46280        for (Annotation e : element.getNote()) 
46281          composeAnnotation(null, e);
46282        closeArray();
46283      };
46284      if (element.hasAttester()) {
46285        openArray("attester");
46286        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
46287          composeCompositionAttesterComponent(null, e);
46288        closeArray();
46289      };
46290      if (element.hasCustodian()) {
46291        composeReference("custodian", element.getCustodian());
46292      }
46293      if (element.hasRelatesTo()) {
46294        openArray("relatesTo");
46295        for (RelatedArtifact e : element.getRelatesTo()) 
46296          composeRelatedArtifact(null, e);
46297        closeArray();
46298      };
46299      if (element.hasEvent()) {
46300        openArray("event");
46301        for (Composition.CompositionEventComponent e : element.getEvent()) 
46302          composeCompositionEventComponent(null, e);
46303        closeArray();
46304      };
46305      if (element.hasSection()) {
46306        openArray("section");
46307        for (Composition.SectionComponent e : element.getSection()) 
46308          composeSectionComponent(null, e);
46309        closeArray();
46310      };
46311  }
46312
46313  protected void composeCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
46314    if (element != null) {
46315      open(name);
46316      composeCompositionAttesterComponentProperties(element);
46317      close();
46318    }
46319  }
46320
46321  protected void composeCompositionAttesterComponentProperties(Composition.CompositionAttesterComponent element) throws IOException {
46322    composeBackboneElementProperties(element);
46323      if (element.hasMode()) {
46324        composeCodeableConcept("mode", element.getMode());
46325      }
46326      if (element.hasTimeElement()) {
46327        composeDateTimeCore("time", element.getTimeElement(), false);
46328        composeDateTimeExtras("time", element.getTimeElement(), false);
46329      }
46330      if (element.hasParty()) {
46331        composeReference("party", element.getParty());
46332      }
46333  }
46334
46335  protected void composeCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
46336    if (element != null) {
46337      open(name);
46338      composeCompositionEventComponentProperties(element);
46339      close();
46340    }
46341  }
46342
46343  protected void composeCompositionEventComponentProperties(Composition.CompositionEventComponent element) throws IOException {
46344    composeBackboneElementProperties(element);
46345      if (element.hasPeriod()) {
46346        composePeriod("period", element.getPeriod());
46347      }
46348      if (element.hasDetail()) {
46349        openArray("detail");
46350        for (CodeableReference e : element.getDetail()) 
46351          composeCodeableReference(null, e);
46352        closeArray();
46353      };
46354  }
46355
46356  protected void composeSectionComponent(String name, Composition.SectionComponent element) throws IOException {
46357    if (element != null) {
46358      open(name);
46359      composeSectionComponentProperties(element);
46360      close();
46361    }
46362  }
46363
46364  protected void composeSectionComponentProperties(Composition.SectionComponent element) throws IOException {
46365    composeBackboneElementProperties(element);
46366      if (element.hasTitleElement()) {
46367        composeStringCore("title", element.getTitleElement(), false);
46368        composeStringExtras("title", element.getTitleElement(), false);
46369      }
46370      if (element.hasCode()) {
46371        composeCodeableConcept("code", element.getCode());
46372      }
46373      if (element.hasAuthor()) {
46374        openArray("author");
46375        for (Reference e : element.getAuthor()) 
46376          composeReference(null, e);
46377        closeArray();
46378      };
46379      if (element.hasFocus()) {
46380        composeReference("focus", element.getFocus());
46381      }
46382      if (element.hasText()) {
46383        composeNarrative("text", element.getText());
46384      }
46385      if (element.hasOrderedBy()) {
46386        composeCodeableConcept("orderedBy", element.getOrderedBy());
46387      }
46388      if (element.hasEntry()) {
46389        openArray("entry");
46390        for (Reference e : element.getEntry()) 
46391          composeReference(null, e);
46392        closeArray();
46393      };
46394      if (element.hasEmptyReason()) {
46395        composeCodeableConcept("emptyReason", element.getEmptyReason());
46396      }
46397      if (element.hasSection()) {
46398        openArray("section");
46399        for (Composition.SectionComponent e : element.getSection()) 
46400          composeSectionComponent(null, e);
46401        closeArray();
46402      };
46403  }
46404
46405  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
46406    if (element != null) {
46407      prop("resourceType", name);
46408      composeConceptMapProperties(element);
46409    }
46410  }
46411
46412  protected void composeConceptMapProperties(ConceptMap element) throws IOException {
46413    composeMetadataResourceProperties(element);
46414      if (element.hasUrlElement()) {
46415        composeUriCore("url", element.getUrlElement(), false);
46416        composeUriExtras("url", element.getUrlElement(), false);
46417      }
46418      if (element.hasIdentifier()) {
46419        openArray("identifier");
46420        for (Identifier e : element.getIdentifier()) 
46421          composeIdentifier(null, e);
46422        closeArray();
46423      };
46424      if (element.hasVersionElement()) {
46425        composeStringCore("version", element.getVersionElement(), false);
46426        composeStringExtras("version", element.getVersionElement(), false);
46427      }
46428      if (element.hasVersionAlgorithm()) {
46429        composeType("versionAlgorithm", element.getVersionAlgorithm());
46430      }
46431      if (element.hasNameElement()) {
46432        composeStringCore("name", element.getNameElement(), false);
46433        composeStringExtras("name", element.getNameElement(), false);
46434      }
46435      if (element.hasTitleElement()) {
46436        composeStringCore("title", element.getTitleElement(), false);
46437        composeStringExtras("title", element.getTitleElement(), false);
46438      }
46439      if (element.hasStatusElement()) {
46440        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46441        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46442      }
46443      if (element.hasExperimentalElement()) {
46444        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46445        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46446      }
46447      if (element.hasDateElement()) {
46448        composeDateTimeCore("date", element.getDateElement(), false);
46449        composeDateTimeExtras("date", element.getDateElement(), false);
46450      }
46451      if (element.hasPublisherElement()) {
46452        composeStringCore("publisher", element.getPublisherElement(), false);
46453        composeStringExtras("publisher", element.getPublisherElement(), false);
46454      }
46455      if (element.hasContact()) {
46456        openArray("contact");
46457        for (ContactDetail e : element.getContact()) 
46458          composeContactDetail(null, e);
46459        closeArray();
46460      };
46461      if (element.hasDescriptionElement()) {
46462        composeMarkdownCore("description", element.getDescriptionElement(), false);
46463        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46464      }
46465      if (element.hasUseContext()) {
46466        openArray("useContext");
46467        for (UsageContext e : element.getUseContext()) 
46468          composeUsageContext(null, e);
46469        closeArray();
46470      };
46471      if (element.hasJurisdiction()) {
46472        openArray("jurisdiction");
46473        for (CodeableConcept e : element.getJurisdiction()) 
46474          composeCodeableConcept(null, e);
46475        closeArray();
46476      };
46477      if (element.hasPurposeElement()) {
46478        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46479        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46480      }
46481      if (element.hasCopyrightElement()) {
46482        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46483        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46484      }
46485      if (element.hasCopyrightLabelElement()) {
46486        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
46487        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
46488      }
46489      if (element.hasApprovalDateElement()) {
46490        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
46491        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
46492      }
46493      if (element.hasLastReviewDateElement()) {
46494        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
46495        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
46496      }
46497      if (element.hasEffectivePeriod()) {
46498        composePeriod("effectivePeriod", element.getEffectivePeriod());
46499      }
46500      if (element.hasTopic()) {
46501        openArray("topic");
46502        for (CodeableConcept e : element.getTopic()) 
46503          composeCodeableConcept(null, e);
46504        closeArray();
46505      };
46506      if (element.hasAuthor()) {
46507        openArray("author");
46508        for (ContactDetail e : element.getAuthor()) 
46509          composeContactDetail(null, e);
46510        closeArray();
46511      };
46512      if (element.hasEditor()) {
46513        openArray("editor");
46514        for (ContactDetail e : element.getEditor()) 
46515          composeContactDetail(null, e);
46516        closeArray();
46517      };
46518      if (element.hasReviewer()) {
46519        openArray("reviewer");
46520        for (ContactDetail e : element.getReviewer()) 
46521          composeContactDetail(null, e);
46522        closeArray();
46523      };
46524      if (element.hasEndorser()) {
46525        openArray("endorser");
46526        for (ContactDetail e : element.getEndorser()) 
46527          composeContactDetail(null, e);
46528        closeArray();
46529      };
46530      if (element.hasRelatedArtifact()) {
46531        openArray("relatedArtifact");
46532        for (RelatedArtifact e : element.getRelatedArtifact()) 
46533          composeRelatedArtifact(null, e);
46534        closeArray();
46535      };
46536      if (element.hasProperty()) {
46537        openArray("property");
46538        for (ConceptMap.PropertyComponent e : element.getProperty()) 
46539          composePropertyComponent(null, e);
46540        closeArray();
46541      };
46542      if (element.hasAdditionalAttribute()) {
46543        openArray("additionalAttribute");
46544        for (ConceptMap.AdditionalAttributeComponent e : element.getAdditionalAttribute()) 
46545          composeAdditionalAttributeComponent(null, e);
46546        closeArray();
46547      };
46548      if (element.hasSourceScope()) {
46549        composeType("sourceScope", element.getSourceScope());
46550      }
46551      if (element.hasTargetScope()) {
46552        composeType("targetScope", element.getTargetScope());
46553      }
46554      if (element.hasGroup()) {
46555        openArray("group");
46556        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
46557          composeConceptMapGroupComponent(null, e);
46558        closeArray();
46559      };
46560  }
46561
46562  protected void composePropertyComponent(String name, ConceptMap.PropertyComponent element) throws IOException {
46563    if (element != null) {
46564      open(name);
46565      composePropertyComponentProperties(element);
46566      close();
46567    }
46568  }
46569
46570  protected void composePropertyComponentProperties(ConceptMap.PropertyComponent element) throws IOException {
46571    composeBackboneElementProperties(element);
46572      if (element.hasCodeElement()) {
46573        composeCodeCore("code", element.getCodeElement(), false);
46574        composeCodeExtras("code", element.getCodeElement(), false);
46575      }
46576      if (element.hasUriElement()) {
46577        composeUriCore("uri", element.getUriElement(), false);
46578        composeUriExtras("uri", element.getUriElement(), false);
46579      }
46580      if (element.hasDescriptionElement()) {
46581        composeStringCore("description", element.getDescriptionElement(), false);
46582        composeStringExtras("description", element.getDescriptionElement(), false);
46583      }
46584      if (element.hasTypeElement()) {
46585        composeEnumerationCore("type", element.getTypeElement(), new ConceptMap.ConceptMapPropertyTypeEnumFactory(), false);
46586        composeEnumerationExtras("type", element.getTypeElement(), new ConceptMap.ConceptMapPropertyTypeEnumFactory(), false);
46587      }
46588      if (element.hasSystemElement()) {
46589        composeCanonicalCore("system", element.getSystemElement(), false);
46590        composeCanonicalExtras("system", element.getSystemElement(), false);
46591      }
46592  }
46593
46594  protected void composeAdditionalAttributeComponent(String name, ConceptMap.AdditionalAttributeComponent element) throws IOException {
46595    if (element != null) {
46596      open(name);
46597      composeAdditionalAttributeComponentProperties(element);
46598      close();
46599    }
46600  }
46601
46602  protected void composeAdditionalAttributeComponentProperties(ConceptMap.AdditionalAttributeComponent element) throws IOException {
46603    composeBackboneElementProperties(element);
46604      if (element.hasCodeElement()) {
46605        composeCodeCore("code", element.getCodeElement(), false);
46606        composeCodeExtras("code", element.getCodeElement(), false);
46607      }
46608      if (element.hasUriElement()) {
46609        composeUriCore("uri", element.getUriElement(), false);
46610        composeUriExtras("uri", element.getUriElement(), false);
46611      }
46612      if (element.hasDescriptionElement()) {
46613        composeStringCore("description", element.getDescriptionElement(), false);
46614        composeStringExtras("description", element.getDescriptionElement(), false);
46615      }
46616      if (element.hasTypeElement()) {
46617        composeEnumerationCore("type", element.getTypeElement(), new ConceptMap.ConceptMapAttributeTypeEnumFactory(), false);
46618        composeEnumerationExtras("type", element.getTypeElement(), new ConceptMap.ConceptMapAttributeTypeEnumFactory(), false);
46619      }
46620  }
46621
46622  protected void composeConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
46623    if (element != null) {
46624      open(name);
46625      composeConceptMapGroupComponentProperties(element);
46626      close();
46627    }
46628  }
46629
46630  protected void composeConceptMapGroupComponentProperties(ConceptMap.ConceptMapGroupComponent element) throws IOException {
46631    composeBackboneElementProperties(element);
46632      if (element.hasSourceElement()) {
46633        composeCanonicalCore("source", element.getSourceElement(), false);
46634        composeCanonicalExtras("source", element.getSourceElement(), false);
46635      }
46636      if (element.hasTargetElement()) {
46637        composeCanonicalCore("target", element.getTargetElement(), false);
46638        composeCanonicalExtras("target", element.getTargetElement(), false);
46639      }
46640      if (element.hasElement()) {
46641        openArray("element");
46642        for (ConceptMap.SourceElementComponent e : element.getElement()) 
46643          composeSourceElementComponent(null, e);
46644        closeArray();
46645      };
46646      if (element.hasUnmapped()) {
46647        composeConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
46648      }
46649  }
46650
46651  protected void composeSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
46652    if (element != null) {
46653      open(name);
46654      composeSourceElementComponentProperties(element);
46655      close();
46656    }
46657  }
46658
46659  protected void composeSourceElementComponentProperties(ConceptMap.SourceElementComponent element) throws IOException {
46660    composeBackboneElementProperties(element);
46661      if (element.hasCodeElement()) {
46662        composeCodeCore("code", element.getCodeElement(), false);
46663        composeCodeExtras("code", element.getCodeElement(), false);
46664      }
46665      if (element.hasDisplayElement()) {
46666        composeStringCore("display", element.getDisplayElement(), false);
46667        composeStringExtras("display", element.getDisplayElement(), false);
46668      }
46669      if (element.hasValueSetElement()) {
46670        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46671        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46672      }
46673      if (element.hasNoMapElement()) {
46674        composeBooleanCore("noMap", element.getNoMapElement(), false);
46675        composeBooleanExtras("noMap", element.getNoMapElement(), false);
46676      }
46677      if (element.hasTarget()) {
46678        openArray("target");
46679        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
46680          composeTargetElementComponent(null, e);
46681        closeArray();
46682      };
46683  }
46684
46685  protected void composeTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
46686    if (element != null) {
46687      open(name);
46688      composeTargetElementComponentProperties(element);
46689      close();
46690    }
46691  }
46692
46693  protected void composeTargetElementComponentProperties(ConceptMap.TargetElementComponent element) throws IOException {
46694    composeBackboneElementProperties(element);
46695      if (element.hasCodeElement()) {
46696        composeCodeCore("code", element.getCodeElement(), false);
46697        composeCodeExtras("code", element.getCodeElement(), false);
46698      }
46699      if (element.hasDisplayElement()) {
46700        composeStringCore("display", element.getDisplayElement(), false);
46701        composeStringExtras("display", element.getDisplayElement(), false);
46702      }
46703      if (element.hasValueSetElement()) {
46704        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46705        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46706      }
46707      if (element.hasRelationshipElement()) {
46708        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46709        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46710      }
46711      if (element.hasCommentElement()) {
46712        composeStringCore("comment", element.getCommentElement(), false);
46713        composeStringExtras("comment", element.getCommentElement(), false);
46714      }
46715      if (element.hasProperty()) {
46716        openArray("property");
46717        for (ConceptMap.MappingPropertyComponent e : element.getProperty()) 
46718          composeMappingPropertyComponent(null, e);
46719        closeArray();
46720      };
46721      if (element.hasDependsOn()) {
46722        openArray("dependsOn");
46723        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
46724          composeOtherElementComponent(null, e);
46725        closeArray();
46726      };
46727      if (element.hasProduct()) {
46728        openArray("product");
46729        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
46730          composeOtherElementComponent(null, e);
46731        closeArray();
46732      };
46733  }
46734
46735  protected void composeMappingPropertyComponent(String name, ConceptMap.MappingPropertyComponent element) throws IOException {
46736    if (element != null) {
46737      open(name);
46738      composeMappingPropertyComponentProperties(element);
46739      close();
46740    }
46741  }
46742
46743  protected void composeMappingPropertyComponentProperties(ConceptMap.MappingPropertyComponent element) throws IOException {
46744    composeBackboneElementProperties(element);
46745      if (element.hasCodeElement()) {
46746        composeCodeCore("code", element.getCodeElement(), false);
46747        composeCodeExtras("code", element.getCodeElement(), false);
46748      }
46749      if (element.hasValue()) {
46750        composeType("value", element.getValue());
46751      }
46752  }
46753
46754  protected void composeOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
46755    if (element != null) {
46756      open(name);
46757      composeOtherElementComponentProperties(element);
46758      close();
46759    }
46760  }
46761
46762  protected void composeOtherElementComponentProperties(ConceptMap.OtherElementComponent element) throws IOException {
46763    composeBackboneElementProperties(element);
46764      if (element.hasAttributeElement()) {
46765        composeCodeCore("attribute", element.getAttributeElement(), false);
46766        composeCodeExtras("attribute", element.getAttributeElement(), false);
46767      }
46768      if (element.hasValue()) {
46769        composeType("value", element.getValue());
46770      }
46771      if (element.hasValueSetElement()) {
46772        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46773        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46774      }
46775  }
46776
46777  protected void composeConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
46778    if (element != null) {
46779      open(name);
46780      composeConceptMapGroupUnmappedComponentProperties(element);
46781      close();
46782    }
46783  }
46784
46785  protected void composeConceptMapGroupUnmappedComponentProperties(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
46786    composeBackboneElementProperties(element);
46787      if (element.hasModeElement()) {
46788        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
46789        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
46790      }
46791      if (element.hasCodeElement()) {
46792        composeCodeCore("code", element.getCodeElement(), false);
46793        composeCodeExtras("code", element.getCodeElement(), false);
46794      }
46795      if (element.hasDisplayElement()) {
46796        composeStringCore("display", element.getDisplayElement(), false);
46797        composeStringExtras("display", element.getDisplayElement(), false);
46798      }
46799      if (element.hasValueSetElement()) {
46800        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
46801        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
46802      }
46803      if (element.hasRelationshipElement()) {
46804        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46805        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
46806      }
46807      if (element.hasOtherMapElement()) {
46808        composeCanonicalCore("otherMap", element.getOtherMapElement(), false);
46809        composeCanonicalExtras("otherMap", element.getOtherMapElement(), false);
46810      }
46811  }
46812
46813  protected void composeCondition(String name, Condition element) throws IOException {
46814    if (element != null) {
46815      prop("resourceType", name);
46816      composeConditionProperties(element);
46817    }
46818  }
46819
46820  protected void composeConditionProperties(Condition element) throws IOException {
46821    composeDomainResourceProperties(element);
46822      if (element.hasIdentifier()) {
46823        openArray("identifier");
46824        for (Identifier e : element.getIdentifier()) 
46825          composeIdentifier(null, e);
46826        closeArray();
46827      };
46828      if (element.hasClinicalStatus()) {
46829        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
46830      }
46831      if (element.hasVerificationStatus()) {
46832        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
46833      }
46834      if (element.hasCategory()) {
46835        openArray("category");
46836        for (CodeableConcept e : element.getCategory()) 
46837          composeCodeableConcept(null, e);
46838        closeArray();
46839      };
46840      if (element.hasSeverity()) {
46841        composeCodeableConcept("severity", element.getSeverity());
46842      }
46843      if (element.hasCode()) {
46844        composeCodeableConcept("code", element.getCode());
46845      }
46846      if (element.hasBodySite()) {
46847        openArray("bodySite");
46848        for (CodeableConcept e : element.getBodySite()) 
46849          composeCodeableConcept(null, e);
46850        closeArray();
46851      };
46852      if (element.hasSubject()) {
46853        composeReference("subject", element.getSubject());
46854      }
46855      if (element.hasEncounter()) {
46856        composeReference("encounter", element.getEncounter());
46857      }
46858      if (element.hasOnset()) {
46859        composeType("onset", element.getOnset());
46860      }
46861      if (element.hasAbatement()) {
46862        composeType("abatement", element.getAbatement());
46863      }
46864      if (element.hasRecordedDateElement()) {
46865        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
46866        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
46867      }
46868      if (element.hasParticipant()) {
46869        openArray("participant");
46870        for (Condition.ConditionParticipantComponent e : element.getParticipant()) 
46871          composeConditionParticipantComponent(null, e);
46872        closeArray();
46873      };
46874      if (element.hasStage()) {
46875        openArray("stage");
46876        for (Condition.ConditionStageComponent e : element.getStage()) 
46877          composeConditionStageComponent(null, e);
46878        closeArray();
46879      };
46880      if (element.hasEvidence()) {
46881        openArray("evidence");
46882        for (CodeableReference e : element.getEvidence()) 
46883          composeCodeableReference(null, e);
46884        closeArray();
46885      };
46886      if (element.hasNote()) {
46887        openArray("note");
46888        for (Annotation e : element.getNote()) 
46889          composeAnnotation(null, e);
46890        closeArray();
46891      };
46892  }
46893
46894  protected void composeConditionParticipantComponent(String name, Condition.ConditionParticipantComponent element) throws IOException {
46895    if (element != null) {
46896      open(name);
46897      composeConditionParticipantComponentProperties(element);
46898      close();
46899    }
46900  }
46901
46902  protected void composeConditionParticipantComponentProperties(Condition.ConditionParticipantComponent element) throws IOException {
46903    composeBackboneElementProperties(element);
46904      if (element.hasFunction()) {
46905        composeCodeableConcept("function", element.getFunction());
46906      }
46907      if (element.hasActor()) {
46908        composeReference("actor", element.getActor());
46909      }
46910  }
46911
46912  protected void composeConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
46913    if (element != null) {
46914      open(name);
46915      composeConditionStageComponentProperties(element);
46916      close();
46917    }
46918  }
46919
46920  protected void composeConditionStageComponentProperties(Condition.ConditionStageComponent element) throws IOException {
46921    composeBackboneElementProperties(element);
46922      if (element.hasSummary()) {
46923        composeCodeableConcept("summary", element.getSummary());
46924      }
46925      if (element.hasAssessment()) {
46926        openArray("assessment");
46927        for (Reference e : element.getAssessment()) 
46928          composeReference(null, e);
46929        closeArray();
46930      };
46931      if (element.hasType()) {
46932        composeCodeableConcept("type", element.getType());
46933      }
46934  }
46935
46936  protected void composeConditionDefinition(String name, ConditionDefinition element) throws IOException {
46937    if (element != null) {
46938      prop("resourceType", name);
46939      composeConditionDefinitionProperties(element);
46940    }
46941  }
46942
46943  protected void composeConditionDefinitionProperties(ConditionDefinition element) throws IOException {
46944    composeMetadataResourceProperties(element);
46945      if (element.hasUrlElement()) {
46946        composeUriCore("url", element.getUrlElement(), false);
46947        composeUriExtras("url", element.getUrlElement(), false);
46948      }
46949      if (element.hasIdentifier()) {
46950        openArray("identifier");
46951        for (Identifier e : element.getIdentifier()) 
46952          composeIdentifier(null, e);
46953        closeArray();
46954      };
46955      if (element.hasVersionElement()) {
46956        composeStringCore("version", element.getVersionElement(), false);
46957        composeStringExtras("version", element.getVersionElement(), false);
46958      }
46959      if (element.hasVersionAlgorithm()) {
46960        composeType("versionAlgorithm", element.getVersionAlgorithm());
46961      }
46962      if (element.hasNameElement()) {
46963        composeStringCore("name", element.getNameElement(), false);
46964        composeStringExtras("name", element.getNameElement(), false);
46965      }
46966      if (element.hasTitleElement()) {
46967        composeStringCore("title", element.getTitleElement(), false);
46968        composeStringExtras("title", element.getTitleElement(), false);
46969      }
46970      if (element.hasSubtitleElement()) {
46971        composeStringCore("subtitle", element.getSubtitleElement(), false);
46972        composeStringExtras("subtitle", element.getSubtitleElement(), false);
46973      }
46974      if (element.hasStatusElement()) {
46975        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46976        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46977      }
46978      if (element.hasExperimentalElement()) {
46979        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46980        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46981      }
46982      if (element.hasDateElement()) {
46983        composeDateTimeCore("date", element.getDateElement(), false);
46984        composeDateTimeExtras("date", element.getDateElement(), false);
46985      }
46986      if (element.hasPublisherElement()) {
46987        composeStringCore("publisher", element.getPublisherElement(), false);
46988        composeStringExtras("publisher", element.getPublisherElement(), false);
46989      }
46990      if (element.hasContact()) {
46991        openArray("contact");
46992        for (ContactDetail e : element.getContact()) 
46993          composeContactDetail(null, e);
46994        closeArray();
46995      };
46996      if (element.hasDescriptionElement()) {
46997        composeMarkdownCore("description", element.getDescriptionElement(), false);
46998        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46999      }
47000      if (element.hasUseContext()) {
47001        openArray("useContext");
47002        for (UsageContext e : element.getUseContext()) 
47003          composeUsageContext(null, e);
47004        closeArray();
47005      };
47006      if (element.hasJurisdiction()) {
47007        openArray("jurisdiction");
47008        for (CodeableConcept e : element.getJurisdiction()) 
47009          composeCodeableConcept(null, e);
47010        closeArray();
47011      };
47012      if (element.hasCode()) {
47013        composeCodeableConcept("code", element.getCode());
47014      }
47015      if (element.hasSeverity()) {
47016        composeCodeableConcept("severity", element.getSeverity());
47017      }
47018      if (element.hasBodySite()) {
47019        composeCodeableConcept("bodySite", element.getBodySite());
47020      }
47021      if (element.hasStage()) {
47022        composeCodeableConcept("stage", element.getStage());
47023      }
47024      if (element.hasHasSeverityElement()) {
47025        composeBooleanCore("hasSeverity", element.getHasSeverityElement(), false);
47026        composeBooleanExtras("hasSeverity", element.getHasSeverityElement(), false);
47027      }
47028      if (element.hasHasBodySiteElement()) {
47029        composeBooleanCore("hasBodySite", element.getHasBodySiteElement(), false);
47030        composeBooleanExtras("hasBodySite", element.getHasBodySiteElement(), false);
47031      }
47032      if (element.hasHasStageElement()) {
47033        composeBooleanCore("hasStage", element.getHasStageElement(), false);
47034        composeBooleanExtras("hasStage", element.getHasStageElement(), false);
47035      }
47036      if (element.hasDefinition()) {
47037        if (anyHasValue(element.getDefinition())) {
47038          openArray("definition");
47039          for (UriType e : element.getDefinition()) 
47040            composeUriCore(null, e, e != element.getDefinition().get(element.getDefinition().size()-1));
47041          closeArray();
47042        }
47043        if (anyHasExtras(element.getDefinition())) {
47044          openArray("_definition");
47045          for (UriType e : element.getDefinition()) 
47046            composeUriExtras(null, e, true);
47047          closeArray();
47048        }
47049      };
47050      if (element.hasObservation()) {
47051        openArray("observation");
47052        for (ConditionDefinition.ConditionDefinitionObservationComponent e : element.getObservation()) 
47053          composeConditionDefinitionObservationComponent(null, e);
47054        closeArray();
47055      };
47056      if (element.hasMedication()) {
47057        openArray("medication");
47058        for (ConditionDefinition.ConditionDefinitionMedicationComponent e : element.getMedication()) 
47059          composeConditionDefinitionMedicationComponent(null, e);
47060        closeArray();
47061      };
47062      if (element.hasPrecondition()) {
47063        openArray("precondition");
47064        for (ConditionDefinition.ConditionDefinitionPreconditionComponent e : element.getPrecondition()) 
47065          composeConditionDefinitionPreconditionComponent(null, e);
47066        closeArray();
47067      };
47068      if (element.hasTeam()) {
47069        openArray("team");
47070        for (Reference e : element.getTeam()) 
47071          composeReference(null, e);
47072        closeArray();
47073      };
47074      if (element.hasQuestionnaire()) {
47075        openArray("questionnaire");
47076        for (ConditionDefinition.ConditionDefinitionQuestionnaireComponent e : element.getQuestionnaire()) 
47077          composeConditionDefinitionQuestionnaireComponent(null, e);
47078        closeArray();
47079      };
47080      if (element.hasPlan()) {
47081        openArray("plan");
47082        for (ConditionDefinition.ConditionDefinitionPlanComponent e : element.getPlan()) 
47083          composeConditionDefinitionPlanComponent(null, e);
47084        closeArray();
47085      };
47086  }
47087
47088  protected void composeConditionDefinitionObservationComponent(String name, ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
47089    if (element != null) {
47090      open(name);
47091      composeConditionDefinitionObservationComponentProperties(element);
47092      close();
47093    }
47094  }
47095
47096  protected void composeConditionDefinitionObservationComponentProperties(ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
47097    composeBackboneElementProperties(element);
47098      if (element.hasCategory()) {
47099        composeCodeableConcept("category", element.getCategory());
47100      }
47101      if (element.hasCode()) {
47102        composeCodeableConcept("code", element.getCode());
47103      }
47104  }
47105
47106  protected void composeConditionDefinitionMedicationComponent(String name, ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
47107    if (element != null) {
47108      open(name);
47109      composeConditionDefinitionMedicationComponentProperties(element);
47110      close();
47111    }
47112  }
47113
47114  protected void composeConditionDefinitionMedicationComponentProperties(ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
47115    composeBackboneElementProperties(element);
47116      if (element.hasCategory()) {
47117        composeCodeableConcept("category", element.getCategory());
47118      }
47119      if (element.hasCode()) {
47120        composeCodeableConcept("code", element.getCode());
47121      }
47122  }
47123
47124  protected void composeConditionDefinitionPreconditionComponent(String name, ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
47125    if (element != null) {
47126      open(name);
47127      composeConditionDefinitionPreconditionComponentProperties(element);
47128      close();
47129    }
47130  }
47131
47132  protected void composeConditionDefinitionPreconditionComponentProperties(ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
47133    composeBackboneElementProperties(element);
47134      if (element.hasTypeElement()) {
47135        composeEnumerationCore("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
47136        composeEnumerationExtras("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
47137      }
47138      if (element.hasCode()) {
47139        composeCodeableConcept("code", element.getCode());
47140      }
47141      if (element.hasValue()) {
47142        composeType("value", element.getValue());
47143      }
47144  }
47145
47146  protected void composeConditionDefinitionQuestionnaireComponent(String name, ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
47147    if (element != null) {
47148      open(name);
47149      composeConditionDefinitionQuestionnaireComponentProperties(element);
47150      close();
47151    }
47152  }
47153
47154  protected void composeConditionDefinitionQuestionnaireComponentProperties(ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
47155    composeBackboneElementProperties(element);
47156      if (element.hasPurposeElement()) {
47157        composeEnumerationCore("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
47158        composeEnumerationExtras("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
47159      }
47160      if (element.hasReference()) {
47161        composeReference("reference", element.getReference());
47162      }
47163  }
47164
47165  protected void composeConditionDefinitionPlanComponent(String name, ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
47166    if (element != null) {
47167      open(name);
47168      composeConditionDefinitionPlanComponentProperties(element);
47169      close();
47170    }
47171  }
47172
47173  protected void composeConditionDefinitionPlanComponentProperties(ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
47174    composeBackboneElementProperties(element);
47175      if (element.hasRole()) {
47176        composeCodeableConcept("role", element.getRole());
47177      }
47178      if (element.hasReference()) {
47179        composeReference("reference", element.getReference());
47180      }
47181  }
47182
47183  protected void composeConsent(String name, Consent element) throws IOException {
47184    if (element != null) {
47185      prop("resourceType", name);
47186      composeConsentProperties(element);
47187    }
47188  }
47189
47190  protected void composeConsentProperties(Consent element) throws IOException {
47191    composeDomainResourceProperties(element);
47192      if (element.hasIdentifier()) {
47193        openArray("identifier");
47194        for (Identifier e : element.getIdentifier()) 
47195          composeIdentifier(null, e);
47196        closeArray();
47197      };
47198      if (element.hasStatusElement()) {
47199        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
47200        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
47201      }
47202      if (element.hasCategory()) {
47203        openArray("category");
47204        for (CodeableConcept e : element.getCategory()) 
47205          composeCodeableConcept(null, e);
47206        closeArray();
47207      };
47208      if (element.hasSubject()) {
47209        composeReference("subject", element.getSubject());
47210      }
47211      if (element.hasDateElement()) {
47212        composeDateCore("date", element.getDateElement(), false);
47213        composeDateExtras("date", element.getDateElement(), false);
47214      }
47215      if (element.hasPeriod()) {
47216        composePeriod("period", element.getPeriod());
47217      }
47218      if (element.hasGrantor()) {
47219        openArray("grantor");
47220        for (Reference e : element.getGrantor()) 
47221          composeReference(null, e);
47222        closeArray();
47223      };
47224      if (element.hasGrantee()) {
47225        openArray("grantee");
47226        for (Reference e : element.getGrantee()) 
47227          composeReference(null, e);
47228        closeArray();
47229      };
47230      if (element.hasManager()) {
47231        openArray("manager");
47232        for (Reference e : element.getManager()) 
47233          composeReference(null, e);
47234        closeArray();
47235      };
47236      if (element.hasController()) {
47237        openArray("controller");
47238        for (Reference e : element.getController()) 
47239          composeReference(null, e);
47240        closeArray();
47241      };
47242      if (element.hasSourceAttachment()) {
47243        openArray("sourceAttachment");
47244        for (Attachment e : element.getSourceAttachment()) 
47245          composeAttachment(null, e);
47246        closeArray();
47247      };
47248      if (element.hasSourceReference()) {
47249        openArray("sourceReference");
47250        for (Reference e : element.getSourceReference()) 
47251          composeReference(null, e);
47252        closeArray();
47253      };
47254      if (element.hasRegulatoryBasis()) {
47255        openArray("regulatoryBasis");
47256        for (CodeableConcept e : element.getRegulatoryBasis()) 
47257          composeCodeableConcept(null, e);
47258        closeArray();
47259      };
47260      if (element.hasPolicyBasis()) {
47261        composeConsentPolicyBasisComponent("policyBasis", element.getPolicyBasis());
47262      }
47263      if (element.hasPolicyText()) {
47264        openArray("policyText");
47265        for (Reference e : element.getPolicyText()) 
47266          composeReference(null, e);
47267        closeArray();
47268      };
47269      if (element.hasVerification()) {
47270        openArray("verification");
47271        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
47272          composeConsentVerificationComponent(null, e);
47273        closeArray();
47274      };
47275      if (element.hasDecisionElement()) {
47276        composeEnumerationCore("decision", element.getDecisionElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
47277        composeEnumerationExtras("decision", element.getDecisionElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
47278      }
47279      if (element.hasProvision()) {
47280        openArray("provision");
47281        for (Consent.ProvisionComponent e : element.getProvision()) 
47282          composeProvisionComponent(null, e);
47283        closeArray();
47284      };
47285  }
47286
47287  protected void composeConsentPolicyBasisComponent(String name, Consent.ConsentPolicyBasisComponent element) throws IOException {
47288    if (element != null) {
47289      open(name);
47290      composeConsentPolicyBasisComponentProperties(element);
47291      close();
47292    }
47293  }
47294
47295  protected void composeConsentPolicyBasisComponentProperties(Consent.ConsentPolicyBasisComponent element) throws IOException {
47296    composeBackboneElementProperties(element);
47297      if (element.hasReference()) {
47298        composeReference("reference", element.getReference());
47299      }
47300      if (element.hasUrlElement()) {
47301        composeUrlCore("url", element.getUrlElement(), false);
47302        composeUrlExtras("url", element.getUrlElement(), false);
47303      }
47304  }
47305
47306  protected void composeConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
47307    if (element != null) {
47308      open(name);
47309      composeConsentVerificationComponentProperties(element);
47310      close();
47311    }
47312  }
47313
47314  protected void composeConsentVerificationComponentProperties(Consent.ConsentVerificationComponent element) throws IOException {
47315    composeBackboneElementProperties(element);
47316      if (element.hasVerifiedElement()) {
47317        composeBooleanCore("verified", element.getVerifiedElement(), false);
47318        composeBooleanExtras("verified", element.getVerifiedElement(), false);
47319      }
47320      if (element.hasVerificationType()) {
47321        composeCodeableConcept("verificationType", element.getVerificationType());
47322      }
47323      if (element.hasVerifiedBy()) {
47324        composeReference("verifiedBy", element.getVerifiedBy());
47325      }
47326      if (element.hasVerifiedWith()) {
47327        composeReference("verifiedWith", element.getVerifiedWith());
47328      }
47329      if (element.hasVerificationDate()) {
47330        if (anyHasValue(element.getVerificationDate())) {
47331          openArray("verificationDate");
47332          for (DateTimeType e : element.getVerificationDate()) 
47333            composeDateTimeCore(null, e, e != element.getVerificationDate().get(element.getVerificationDate().size()-1));
47334          closeArray();
47335        }
47336        if (anyHasExtras(element.getVerificationDate())) {
47337          openArray("_verificationDate");
47338          for (DateTimeType e : element.getVerificationDate()) 
47339            composeDateTimeExtras(null, e, true);
47340          closeArray();
47341        }
47342      };
47343  }
47344
47345  protected void composeProvisionComponent(String name, Consent.ProvisionComponent element) throws IOException {
47346    if (element != null) {
47347      open(name);
47348      composeProvisionComponentProperties(element);
47349      close();
47350    }
47351  }
47352
47353  protected void composeProvisionComponentProperties(Consent.ProvisionComponent element) throws IOException {
47354    composeBackboneElementProperties(element);
47355      if (element.hasPeriod()) {
47356        composePeriod("period", element.getPeriod());
47357      }
47358      if (element.hasActor()) {
47359        openArray("actor");
47360        for (Consent.ProvisionActorComponent e : element.getActor()) 
47361          composeProvisionActorComponent(null, e);
47362        closeArray();
47363      };
47364      if (element.hasAction()) {
47365        openArray("action");
47366        for (CodeableConcept e : element.getAction()) 
47367          composeCodeableConcept(null, e);
47368        closeArray();
47369      };
47370      if (element.hasSecurityLabel()) {
47371        openArray("securityLabel");
47372        for (Coding e : element.getSecurityLabel()) 
47373          composeCoding(null, e);
47374        closeArray();
47375      };
47376      if (element.hasPurpose()) {
47377        openArray("purpose");
47378        for (Coding e : element.getPurpose()) 
47379          composeCoding(null, e);
47380        closeArray();
47381      };
47382      if (element.hasDocumentType()) {
47383        openArray("documentType");
47384        for (Coding e : element.getDocumentType()) 
47385          composeCoding(null, e);
47386        closeArray();
47387      };
47388      if (element.hasResourceType()) {
47389        openArray("resourceType");
47390        for (Coding e : element.getResourceType()) 
47391          composeCoding(null, e);
47392        closeArray();
47393      };
47394      if (element.hasCode()) {
47395        openArray("code");
47396        for (CodeableConcept e : element.getCode()) 
47397          composeCodeableConcept(null, e);
47398        closeArray();
47399      };
47400      if (element.hasDataPeriod()) {
47401        composePeriod("dataPeriod", element.getDataPeriod());
47402      }
47403      if (element.hasData()) {
47404        openArray("data");
47405        for (Consent.ProvisionDataComponent e : element.getData()) 
47406          composeProvisionDataComponent(null, e);
47407        closeArray();
47408      };
47409      if (element.hasExpression()) {
47410        composeExpression("expression", element.getExpression());
47411      }
47412      if (element.hasProvision()) {
47413        openArray("provision");
47414        for (Consent.ProvisionComponent e : element.getProvision()) 
47415          composeProvisionComponent(null, e);
47416        closeArray();
47417      };
47418  }
47419
47420  protected void composeProvisionActorComponent(String name, Consent.ProvisionActorComponent element) throws IOException {
47421    if (element != null) {
47422      open(name);
47423      composeProvisionActorComponentProperties(element);
47424      close();
47425    }
47426  }
47427
47428  protected void composeProvisionActorComponentProperties(Consent.ProvisionActorComponent element) throws IOException {
47429    composeBackboneElementProperties(element);
47430      if (element.hasRole()) {
47431        composeCodeableConcept("role", element.getRole());
47432      }
47433      if (element.hasReference()) {
47434        composeReference("reference", element.getReference());
47435      }
47436  }
47437
47438  protected void composeProvisionDataComponent(String name, Consent.ProvisionDataComponent element) throws IOException {
47439    if (element != null) {
47440      open(name);
47441      composeProvisionDataComponentProperties(element);
47442      close();
47443    }
47444  }
47445
47446  protected void composeProvisionDataComponentProperties(Consent.ProvisionDataComponent element) throws IOException {
47447    composeBackboneElementProperties(element);
47448      if (element.hasMeaningElement()) {
47449        composeEnumerationCore("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
47450        composeEnumerationExtras("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
47451      }
47452      if (element.hasReference()) {
47453        composeReference("reference", element.getReference());
47454      }
47455  }
47456
47457  protected void composeContract(String name, Contract element) throws IOException {
47458    if (element != null) {
47459      prop("resourceType", name);
47460      composeContractProperties(element);
47461    }
47462  }
47463
47464  protected void composeContractProperties(Contract element) throws IOException {
47465    composeDomainResourceProperties(element);
47466      if (element.hasIdentifier()) {
47467        openArray("identifier");
47468        for (Identifier e : element.getIdentifier()) 
47469          composeIdentifier(null, e);
47470        closeArray();
47471      };
47472      if (element.hasUrlElement()) {
47473        composeUriCore("url", element.getUrlElement(), false);
47474        composeUriExtras("url", element.getUrlElement(), false);
47475      }
47476      if (element.hasVersionElement()) {
47477        composeStringCore("version", element.getVersionElement(), false);
47478        composeStringExtras("version", element.getVersionElement(), false);
47479      }
47480      if (element.hasStatusElement()) {
47481        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
47482        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
47483      }
47484      if (element.hasLegalState()) {
47485        composeCodeableConcept("legalState", element.getLegalState());
47486      }
47487      if (element.hasInstantiatesCanonical()) {
47488        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
47489      }
47490      if (element.hasInstantiatesUriElement()) {
47491        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
47492        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
47493      }
47494      if (element.hasContentDerivative()) {
47495        composeCodeableConcept("contentDerivative", element.getContentDerivative());
47496      }
47497      if (element.hasIssuedElement()) {
47498        composeDateTimeCore("issued", element.getIssuedElement(), false);
47499        composeDateTimeExtras("issued", element.getIssuedElement(), false);
47500      }
47501      if (element.hasApplies()) {
47502        composePeriod("applies", element.getApplies());
47503      }
47504      if (element.hasExpirationType()) {
47505        composeCodeableConcept("expirationType", element.getExpirationType());
47506      }
47507      if (element.hasSubject()) {
47508        openArray("subject");
47509        for (Reference e : element.getSubject()) 
47510          composeReference(null, e);
47511        closeArray();
47512      };
47513      if (element.hasAuthority()) {
47514        openArray("authority");
47515        for (Reference e : element.getAuthority()) 
47516          composeReference(null, e);
47517        closeArray();
47518      };
47519      if (element.hasDomain()) {
47520        openArray("domain");
47521        for (Reference e : element.getDomain()) 
47522          composeReference(null, e);
47523        closeArray();
47524      };
47525      if (element.hasSite()) {
47526        openArray("site");
47527        for (Reference e : element.getSite()) 
47528          composeReference(null, e);
47529        closeArray();
47530      };
47531      if (element.hasNameElement()) {
47532        composeStringCore("name", element.getNameElement(), false);
47533        composeStringExtras("name", element.getNameElement(), false);
47534      }
47535      if (element.hasTitleElement()) {
47536        composeStringCore("title", element.getTitleElement(), false);
47537        composeStringExtras("title", element.getTitleElement(), false);
47538      }
47539      if (element.hasSubtitleElement()) {
47540        composeStringCore("subtitle", element.getSubtitleElement(), false);
47541        composeStringExtras("subtitle", element.getSubtitleElement(), false);
47542      }
47543      if (element.hasAlias()) {
47544        if (anyHasValue(element.getAlias())) {
47545          openArray("alias");
47546          for (StringType e : element.getAlias()) 
47547            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
47548          closeArray();
47549        }
47550        if (anyHasExtras(element.getAlias())) {
47551          openArray("_alias");
47552          for (StringType e : element.getAlias()) 
47553            composeStringExtras(null, e, true);
47554          closeArray();
47555        }
47556      };
47557      if (element.hasAuthor()) {
47558        composeReference("author", element.getAuthor());
47559      }
47560      if (element.hasScope()) {
47561        composeCodeableConcept("scope", element.getScope());
47562      }
47563      if (element.hasTopic()) {
47564        composeType("topic", element.getTopic());
47565      }
47566      if (element.hasType()) {
47567        composeCodeableConcept("type", element.getType());
47568      }
47569      if (element.hasSubType()) {
47570        openArray("subType");
47571        for (CodeableConcept e : element.getSubType()) 
47572          composeCodeableConcept(null, e);
47573        closeArray();
47574      };
47575      if (element.hasContentDefinition()) {
47576        composeContentDefinitionComponent("contentDefinition", element.getContentDefinition());
47577      }
47578      if (element.hasTerm()) {
47579        openArray("term");
47580        for (Contract.TermComponent e : element.getTerm()) 
47581          composeTermComponent(null, e);
47582        closeArray();
47583      };
47584      if (element.hasSupportingInfo()) {
47585        openArray("supportingInfo");
47586        for (Reference e : element.getSupportingInfo()) 
47587          composeReference(null, e);
47588        closeArray();
47589      };
47590      if (element.hasRelevantHistory()) {
47591        openArray("relevantHistory");
47592        for (Reference e : element.getRelevantHistory()) 
47593          composeReference(null, e);
47594        closeArray();
47595      };
47596      if (element.hasSigner()) {
47597        openArray("signer");
47598        for (Contract.SignatoryComponent e : element.getSigner()) 
47599          composeSignatoryComponent(null, e);
47600        closeArray();
47601      };
47602      if (element.hasFriendly()) {
47603        openArray("friendly");
47604        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
47605          composeFriendlyLanguageComponent(null, e);
47606        closeArray();
47607      };
47608      if (element.hasLegal()) {
47609        openArray("legal");
47610        for (Contract.LegalLanguageComponent e : element.getLegal()) 
47611          composeLegalLanguageComponent(null, e);
47612        closeArray();
47613      };
47614      if (element.hasRule()) {
47615        openArray("rule");
47616        for (Contract.ComputableLanguageComponent e : element.getRule()) 
47617          composeComputableLanguageComponent(null, e);
47618        closeArray();
47619      };
47620      if (element.hasLegallyBinding()) {
47621        composeType("legallyBinding", element.getLegallyBinding());
47622      }
47623  }
47624
47625  protected void composeContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
47626    if (element != null) {
47627      open(name);
47628      composeContentDefinitionComponentProperties(element);
47629      close();
47630    }
47631  }
47632
47633  protected void composeContentDefinitionComponentProperties(Contract.ContentDefinitionComponent element) throws IOException {
47634    composeBackboneElementProperties(element);
47635      if (element.hasType()) {
47636        composeCodeableConcept("type", element.getType());
47637      }
47638      if (element.hasSubType()) {
47639        composeCodeableConcept("subType", element.getSubType());
47640      }
47641      if (element.hasPublisher()) {
47642        composeReference("publisher", element.getPublisher());
47643      }
47644      if (element.hasPublicationDateElement()) {
47645        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
47646        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
47647      }
47648      if (element.hasPublicationStatusElement()) {
47649        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
47650        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
47651      }
47652      if (element.hasCopyrightElement()) {
47653        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47654        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47655      }
47656  }
47657
47658  protected void composeTermComponent(String name, Contract.TermComponent element) throws IOException {
47659    if (element != null) {
47660      open(name);
47661      composeTermComponentProperties(element);
47662      close();
47663    }
47664  }
47665
47666  protected void composeTermComponentProperties(Contract.TermComponent element) throws IOException {
47667    composeBackboneElementProperties(element);
47668      if (element.hasIdentifier()) {
47669        composeIdentifier("identifier", element.getIdentifier());
47670      }
47671      if (element.hasIssuedElement()) {
47672        composeDateTimeCore("issued", element.getIssuedElement(), false);
47673        composeDateTimeExtras("issued", element.getIssuedElement(), false);
47674      }
47675      if (element.hasApplies()) {
47676        composePeriod("applies", element.getApplies());
47677      }
47678      if (element.hasTopic()) {
47679        composeType("topic", element.getTopic());
47680      }
47681      if (element.hasType()) {
47682        composeCodeableConcept("type", element.getType());
47683      }
47684      if (element.hasSubType()) {
47685        composeCodeableConcept("subType", element.getSubType());
47686      }
47687      if (element.hasTextElement()) {
47688        composeStringCore("text", element.getTextElement(), false);
47689        composeStringExtras("text", element.getTextElement(), false);
47690      }
47691      if (element.hasSecurityLabel()) {
47692        openArray("securityLabel");
47693        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
47694          composeSecurityLabelComponent(null, e);
47695        closeArray();
47696      };
47697      if (element.hasOffer()) {
47698        composeContractOfferComponent("offer", element.getOffer());
47699      }
47700      if (element.hasAsset()) {
47701        openArray("asset");
47702        for (Contract.ContractAssetComponent e : element.getAsset()) 
47703          composeContractAssetComponent(null, e);
47704        closeArray();
47705      };
47706      if (element.hasAction()) {
47707        openArray("action");
47708        for (Contract.ActionComponent e : element.getAction()) 
47709          composeActionComponent(null, e);
47710        closeArray();
47711      };
47712      if (element.hasGroup()) {
47713        openArray("group");
47714        for (Contract.TermComponent e : element.getGroup()) 
47715          composeTermComponent(null, e);
47716        closeArray();
47717      };
47718  }
47719
47720  protected void composeSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
47721    if (element != null) {
47722      open(name);
47723      composeSecurityLabelComponentProperties(element);
47724      close();
47725    }
47726  }
47727
47728  protected void composeSecurityLabelComponentProperties(Contract.SecurityLabelComponent element) throws IOException {
47729    composeBackboneElementProperties(element);
47730      if (element.hasNumber()) {
47731        if (anyHasValue(element.getNumber())) {
47732          openArray("number");
47733          for (UnsignedIntType e : element.getNumber()) 
47734            composeUnsignedIntCore(null, e, e != element.getNumber().get(element.getNumber().size()-1));
47735          closeArray();
47736        }
47737        if (anyHasExtras(element.getNumber())) {
47738          openArray("_number");
47739          for (UnsignedIntType e : element.getNumber()) 
47740            composeUnsignedIntExtras(null, e, true);
47741          closeArray();
47742        }
47743      };
47744      if (element.hasClassification()) {
47745        composeCoding("classification", element.getClassification());
47746      }
47747      if (element.hasCategory()) {
47748        openArray("category");
47749        for (Coding e : element.getCategory()) 
47750          composeCoding(null, e);
47751        closeArray();
47752      };
47753      if (element.hasControl()) {
47754        openArray("control");
47755        for (Coding e : element.getControl()) 
47756          composeCoding(null, e);
47757        closeArray();
47758      };
47759  }
47760
47761  protected void composeContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
47762    if (element != null) {
47763      open(name);
47764      composeContractOfferComponentProperties(element);
47765      close();
47766    }
47767  }
47768
47769  protected void composeContractOfferComponentProperties(Contract.ContractOfferComponent element) throws IOException {
47770    composeBackboneElementProperties(element);
47771      if (element.hasIdentifier()) {
47772        openArray("identifier");
47773        for (Identifier e : element.getIdentifier()) 
47774          composeIdentifier(null, e);
47775        closeArray();
47776      };
47777      if (element.hasParty()) {
47778        openArray("party");
47779        for (Contract.ContractPartyComponent e : element.getParty()) 
47780          composeContractPartyComponent(null, e);
47781        closeArray();
47782      };
47783      if (element.hasTopic()) {
47784        composeReference("topic", element.getTopic());
47785      }
47786      if (element.hasType()) {
47787        composeCodeableConcept("type", element.getType());
47788      }
47789      if (element.hasDecision()) {
47790        composeCodeableConcept("decision", element.getDecision());
47791      }
47792      if (element.hasDecisionMode()) {
47793        openArray("decisionMode");
47794        for (CodeableConcept e : element.getDecisionMode()) 
47795          composeCodeableConcept(null, e);
47796        closeArray();
47797      };
47798      if (element.hasAnswer()) {
47799        openArray("answer");
47800        for (Contract.AnswerComponent e : element.getAnswer()) 
47801          composeAnswerComponent(null, e);
47802        closeArray();
47803      };
47804      if (element.hasTextElement()) {
47805        composeStringCore("text", element.getTextElement(), false);
47806        composeStringExtras("text", element.getTextElement(), false);
47807      }
47808      if (element.hasLinkId()) {
47809        if (anyHasValue(element.getLinkId())) {
47810          openArray("linkId");
47811          for (StringType e : element.getLinkId()) 
47812            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
47813          closeArray();
47814        }
47815        if (anyHasExtras(element.getLinkId())) {
47816          openArray("_linkId");
47817          for (StringType e : element.getLinkId()) 
47818            composeStringExtras(null, e, true);
47819          closeArray();
47820        }
47821      };
47822      if (element.hasSecurityLabelNumber()) {
47823        if (anyHasValue(element.getSecurityLabelNumber())) {
47824          openArray("securityLabelNumber");
47825          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47826            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
47827          closeArray();
47828        }
47829        if (anyHasExtras(element.getSecurityLabelNumber())) {
47830          openArray("_securityLabelNumber");
47831          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47832            composeUnsignedIntExtras(null, e, true);
47833          closeArray();
47834        }
47835      };
47836  }
47837
47838  protected void composeContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
47839    if (element != null) {
47840      open(name);
47841      composeContractPartyComponentProperties(element);
47842      close();
47843    }
47844  }
47845
47846  protected void composeContractPartyComponentProperties(Contract.ContractPartyComponent element) throws IOException {
47847    composeBackboneElementProperties(element);
47848      if (element.hasReference()) {
47849        openArray("reference");
47850        for (Reference e : element.getReference()) 
47851          composeReference(null, e);
47852        closeArray();
47853      };
47854      if (element.hasRole()) {
47855        composeCodeableConcept("role", element.getRole());
47856      }
47857  }
47858
47859  protected void composeAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
47860    if (element != null) {
47861      open(name);
47862      composeAnswerComponentProperties(element);
47863      close();
47864    }
47865  }
47866
47867  protected void composeAnswerComponentProperties(Contract.AnswerComponent element) throws IOException {
47868    composeBackboneElementProperties(element);
47869      if (element.hasValue()) {
47870        composeType("value", element.getValue());
47871      }
47872  }
47873
47874  protected void composeContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
47875    if (element != null) {
47876      open(name);
47877      composeContractAssetComponentProperties(element);
47878      close();
47879    }
47880  }
47881
47882  protected void composeContractAssetComponentProperties(Contract.ContractAssetComponent element) throws IOException {
47883    composeBackboneElementProperties(element);
47884      if (element.hasScope()) {
47885        composeCodeableConcept("scope", element.getScope());
47886      }
47887      if (element.hasType()) {
47888        openArray("type");
47889        for (CodeableConcept e : element.getType()) 
47890          composeCodeableConcept(null, e);
47891        closeArray();
47892      };
47893      if (element.hasTypeReference()) {
47894        openArray("typeReference");
47895        for (Reference e : element.getTypeReference()) 
47896          composeReference(null, e);
47897        closeArray();
47898      };
47899      if (element.hasSubtype()) {
47900        openArray("subtype");
47901        for (CodeableConcept e : element.getSubtype()) 
47902          composeCodeableConcept(null, e);
47903        closeArray();
47904      };
47905      if (element.hasRelationship()) {
47906        composeCoding("relationship", element.getRelationship());
47907      }
47908      if (element.hasContext()) {
47909        openArray("context");
47910        for (Contract.AssetContextComponent e : element.getContext()) 
47911          composeAssetContextComponent(null, e);
47912        closeArray();
47913      };
47914      if (element.hasConditionElement()) {
47915        composeStringCore("condition", element.getConditionElement(), false);
47916        composeStringExtras("condition", element.getConditionElement(), false);
47917      }
47918      if (element.hasPeriodType()) {
47919        openArray("periodType");
47920        for (CodeableConcept e : element.getPeriodType()) 
47921          composeCodeableConcept(null, e);
47922        closeArray();
47923      };
47924      if (element.hasPeriod()) {
47925        openArray("period");
47926        for (Period e : element.getPeriod()) 
47927          composePeriod(null, e);
47928        closeArray();
47929      };
47930      if (element.hasUsePeriod()) {
47931        openArray("usePeriod");
47932        for (Period e : element.getUsePeriod()) 
47933          composePeriod(null, e);
47934        closeArray();
47935      };
47936      if (element.hasTextElement()) {
47937        composeStringCore("text", element.getTextElement(), false);
47938        composeStringExtras("text", element.getTextElement(), false);
47939      }
47940      if (element.hasLinkId()) {
47941        if (anyHasValue(element.getLinkId())) {
47942          openArray("linkId");
47943          for (StringType e : element.getLinkId()) 
47944            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
47945          closeArray();
47946        }
47947        if (anyHasExtras(element.getLinkId())) {
47948          openArray("_linkId");
47949          for (StringType e : element.getLinkId()) 
47950            composeStringExtras(null, e, true);
47951          closeArray();
47952        }
47953      };
47954      if (element.hasAnswer()) {
47955        openArray("answer");
47956        for (Contract.AnswerComponent e : element.getAnswer()) 
47957          composeAnswerComponent(null, e);
47958        closeArray();
47959      };
47960      if (element.hasSecurityLabelNumber()) {
47961        if (anyHasValue(element.getSecurityLabelNumber())) {
47962          openArray("securityLabelNumber");
47963          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47964            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
47965          closeArray();
47966        }
47967        if (anyHasExtras(element.getSecurityLabelNumber())) {
47968          openArray("_securityLabelNumber");
47969          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
47970            composeUnsignedIntExtras(null, e, true);
47971          closeArray();
47972        }
47973      };
47974      if (element.hasValuedItem()) {
47975        openArray("valuedItem");
47976        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
47977          composeValuedItemComponent(null, e);
47978        closeArray();
47979      };
47980  }
47981
47982  protected void composeAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
47983    if (element != null) {
47984      open(name);
47985      composeAssetContextComponentProperties(element);
47986      close();
47987    }
47988  }
47989
47990  protected void composeAssetContextComponentProperties(Contract.AssetContextComponent element) throws IOException {
47991    composeBackboneElementProperties(element);
47992      if (element.hasReference()) {
47993        composeReference("reference", element.getReference());
47994      }
47995      if (element.hasCode()) {
47996        openArray("code");
47997        for (CodeableConcept e : element.getCode()) 
47998          composeCodeableConcept(null, e);
47999        closeArray();
48000      };
48001      if (element.hasTextElement()) {
48002        composeStringCore("text", element.getTextElement(), false);
48003        composeStringExtras("text", element.getTextElement(), false);
48004      }
48005  }
48006
48007  protected void composeValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
48008    if (element != null) {
48009      open(name);
48010      composeValuedItemComponentProperties(element);
48011      close();
48012    }
48013  }
48014
48015  protected void composeValuedItemComponentProperties(Contract.ValuedItemComponent element) throws IOException {
48016    composeBackboneElementProperties(element);
48017      if (element.hasEntity()) {
48018        composeType("entity", element.getEntity());
48019      }
48020      if (element.hasIdentifier()) {
48021        composeIdentifier("identifier", element.getIdentifier());
48022      }
48023      if (element.hasEffectiveTimeElement()) {
48024        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
48025        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
48026      }
48027      if (element.hasQuantity()) {
48028        composeQuantity("quantity", element.getQuantity());
48029      }
48030      if (element.hasUnitPrice()) {
48031        composeMoney("unitPrice", element.getUnitPrice());
48032      }
48033      if (element.hasFactorElement()) {
48034        composeDecimalCore("factor", element.getFactorElement(), false);
48035        composeDecimalExtras("factor", element.getFactorElement(), false);
48036      }
48037      if (element.hasPointsElement()) {
48038        composeDecimalCore("points", element.getPointsElement(), false);
48039        composeDecimalExtras("points", element.getPointsElement(), false);
48040      }
48041      if (element.hasNet()) {
48042        composeMoney("net", element.getNet());
48043      }
48044      if (element.hasPaymentElement()) {
48045        composeStringCore("payment", element.getPaymentElement(), false);
48046        composeStringExtras("payment", element.getPaymentElement(), false);
48047      }
48048      if (element.hasPaymentDateElement()) {
48049        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
48050        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
48051      }
48052      if (element.hasResponsible()) {
48053        composeReference("responsible", element.getResponsible());
48054      }
48055      if (element.hasRecipient()) {
48056        composeReference("recipient", element.getRecipient());
48057      }
48058      if (element.hasLinkId()) {
48059        if (anyHasValue(element.getLinkId())) {
48060          openArray("linkId");
48061          for (StringType e : element.getLinkId()) 
48062            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
48063          closeArray();
48064        }
48065        if (anyHasExtras(element.getLinkId())) {
48066          openArray("_linkId");
48067          for (StringType e : element.getLinkId()) 
48068            composeStringExtras(null, e, true);
48069          closeArray();
48070        }
48071      };
48072      if (element.hasSecurityLabelNumber()) {
48073        if (anyHasValue(element.getSecurityLabelNumber())) {
48074          openArray("securityLabelNumber");
48075          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48076            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
48077          closeArray();
48078        }
48079        if (anyHasExtras(element.getSecurityLabelNumber())) {
48080          openArray("_securityLabelNumber");
48081          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48082            composeUnsignedIntExtras(null, e, true);
48083          closeArray();
48084        }
48085      };
48086  }
48087
48088  protected void composeActionComponent(String name, Contract.ActionComponent element) throws IOException {
48089    if (element != null) {
48090      open(name);
48091      composeActionComponentProperties(element);
48092      close();
48093    }
48094  }
48095
48096  protected void composeActionComponentProperties(Contract.ActionComponent element) throws IOException {
48097    composeBackboneElementProperties(element);
48098      if (element.hasDoNotPerformElement()) {
48099        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
48100        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
48101      }
48102      if (element.hasType()) {
48103        composeCodeableConcept("type", element.getType());
48104      }
48105      if (element.hasSubject()) {
48106        openArray("subject");
48107        for (Contract.ActionSubjectComponent e : element.getSubject()) 
48108          composeActionSubjectComponent(null, e);
48109        closeArray();
48110      };
48111      if (element.hasIntent()) {
48112        composeCodeableConcept("intent", element.getIntent());
48113      }
48114      if (element.hasLinkId()) {
48115        if (anyHasValue(element.getLinkId())) {
48116          openArray("linkId");
48117          for (StringType e : element.getLinkId()) 
48118            composeStringCore(null, e, e != element.getLinkId().get(element.getLinkId().size()-1));
48119          closeArray();
48120        }
48121        if (anyHasExtras(element.getLinkId())) {
48122          openArray("_linkId");
48123          for (StringType e : element.getLinkId()) 
48124            composeStringExtras(null, e, true);
48125          closeArray();
48126        }
48127      };
48128      if (element.hasStatus()) {
48129        composeCodeableConcept("status", element.getStatus());
48130      }
48131      if (element.hasContext()) {
48132        composeReference("context", element.getContext());
48133      }
48134      if (element.hasContextLinkId()) {
48135        if (anyHasValue(element.getContextLinkId())) {
48136          openArray("contextLinkId");
48137          for (StringType e : element.getContextLinkId()) 
48138            composeStringCore(null, e, e != element.getContextLinkId().get(element.getContextLinkId().size()-1));
48139          closeArray();
48140        }
48141        if (anyHasExtras(element.getContextLinkId())) {
48142          openArray("_contextLinkId");
48143          for (StringType e : element.getContextLinkId()) 
48144            composeStringExtras(null, e, true);
48145          closeArray();
48146        }
48147      };
48148      if (element.hasOccurrence()) {
48149        composeType("occurrence", element.getOccurrence());
48150      }
48151      if (element.hasRequester()) {
48152        openArray("requester");
48153        for (Reference e : element.getRequester()) 
48154          composeReference(null, e);
48155        closeArray();
48156      };
48157      if (element.hasRequesterLinkId()) {
48158        if (anyHasValue(element.getRequesterLinkId())) {
48159          openArray("requesterLinkId");
48160          for (StringType e : element.getRequesterLinkId()) 
48161            composeStringCore(null, e, e != element.getRequesterLinkId().get(element.getRequesterLinkId().size()-1));
48162          closeArray();
48163        }
48164        if (anyHasExtras(element.getRequesterLinkId())) {
48165          openArray("_requesterLinkId");
48166          for (StringType e : element.getRequesterLinkId()) 
48167            composeStringExtras(null, e, true);
48168          closeArray();
48169        }
48170      };
48171      if (element.hasPerformerType()) {
48172        openArray("performerType");
48173        for (CodeableConcept e : element.getPerformerType()) 
48174          composeCodeableConcept(null, e);
48175        closeArray();
48176      };
48177      if (element.hasPerformerRole()) {
48178        composeCodeableConcept("performerRole", element.getPerformerRole());
48179      }
48180      if (element.hasPerformer()) {
48181        composeReference("performer", element.getPerformer());
48182      }
48183      if (element.hasPerformerLinkId()) {
48184        if (anyHasValue(element.getPerformerLinkId())) {
48185          openArray("performerLinkId");
48186          for (StringType e : element.getPerformerLinkId()) 
48187            composeStringCore(null, e, e != element.getPerformerLinkId().get(element.getPerformerLinkId().size()-1));
48188          closeArray();
48189        }
48190        if (anyHasExtras(element.getPerformerLinkId())) {
48191          openArray("_performerLinkId");
48192          for (StringType e : element.getPerformerLinkId()) 
48193            composeStringExtras(null, e, true);
48194          closeArray();
48195        }
48196      };
48197      if (element.hasReason()) {
48198        openArray("reason");
48199        for (CodeableReference e : element.getReason()) 
48200          composeCodeableReference(null, e);
48201        closeArray();
48202      };
48203      if (element.hasReasonLinkId()) {
48204        if (anyHasValue(element.getReasonLinkId())) {
48205          openArray("reasonLinkId");
48206          for (StringType e : element.getReasonLinkId()) 
48207            composeStringCore(null, e, e != element.getReasonLinkId().get(element.getReasonLinkId().size()-1));
48208          closeArray();
48209        }
48210        if (anyHasExtras(element.getReasonLinkId())) {
48211          openArray("_reasonLinkId");
48212          for (StringType e : element.getReasonLinkId()) 
48213            composeStringExtras(null, e, true);
48214          closeArray();
48215        }
48216      };
48217      if (element.hasNote()) {
48218        openArray("note");
48219        for (Annotation e : element.getNote()) 
48220          composeAnnotation(null, e);
48221        closeArray();
48222      };
48223      if (element.hasSecurityLabelNumber()) {
48224        if (anyHasValue(element.getSecurityLabelNumber())) {
48225          openArray("securityLabelNumber");
48226          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48227            composeUnsignedIntCore(null, e, e != element.getSecurityLabelNumber().get(element.getSecurityLabelNumber().size()-1));
48228          closeArray();
48229        }
48230        if (anyHasExtras(element.getSecurityLabelNumber())) {
48231          openArray("_securityLabelNumber");
48232          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
48233            composeUnsignedIntExtras(null, e, true);
48234          closeArray();
48235        }
48236      };
48237  }
48238
48239  protected void composeActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
48240    if (element != null) {
48241      open(name);
48242      composeActionSubjectComponentProperties(element);
48243      close();
48244    }
48245  }
48246
48247  protected void composeActionSubjectComponentProperties(Contract.ActionSubjectComponent element) throws IOException {
48248    composeBackboneElementProperties(element);
48249      if (element.hasReference()) {
48250        openArray("reference");
48251        for (Reference e : element.getReference()) 
48252          composeReference(null, e);
48253        closeArray();
48254      };
48255      if (element.hasRole()) {
48256        composeCodeableConcept("role", element.getRole());
48257      }
48258  }
48259
48260  protected void composeSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
48261    if (element != null) {
48262      open(name);
48263      composeSignatoryComponentProperties(element);
48264      close();
48265    }
48266  }
48267
48268  protected void composeSignatoryComponentProperties(Contract.SignatoryComponent element) throws IOException {
48269    composeBackboneElementProperties(element);
48270      if (element.hasType()) {
48271        composeCoding("type", element.getType());
48272      }
48273      if (element.hasParty()) {
48274        composeReference("party", element.getParty());
48275      }
48276      if (element.hasSignature()) {
48277        openArray("signature");
48278        for (Signature e : element.getSignature()) 
48279          composeSignature(null, e);
48280        closeArray();
48281      };
48282  }
48283
48284  protected void composeFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
48285    if (element != null) {
48286      open(name);
48287      composeFriendlyLanguageComponentProperties(element);
48288      close();
48289    }
48290  }
48291
48292  protected void composeFriendlyLanguageComponentProperties(Contract.FriendlyLanguageComponent element) throws IOException {
48293    composeBackboneElementProperties(element);
48294      if (element.hasContent()) {
48295        composeType("content", element.getContent());
48296      }
48297  }
48298
48299  protected void composeLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
48300    if (element != null) {
48301      open(name);
48302      composeLegalLanguageComponentProperties(element);
48303      close();
48304    }
48305  }
48306
48307  protected void composeLegalLanguageComponentProperties(Contract.LegalLanguageComponent element) throws IOException {
48308    composeBackboneElementProperties(element);
48309      if (element.hasContent()) {
48310        composeType("content", element.getContent());
48311      }
48312  }
48313
48314  protected void composeComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
48315    if (element != null) {
48316      open(name);
48317      composeComputableLanguageComponentProperties(element);
48318      close();
48319    }
48320  }
48321
48322  protected void composeComputableLanguageComponentProperties(Contract.ComputableLanguageComponent element) throws IOException {
48323    composeBackboneElementProperties(element);
48324      if (element.hasContent()) {
48325        composeType("content", element.getContent());
48326      }
48327  }
48328
48329  protected void composeCoverage(String name, Coverage element) throws IOException {
48330    if (element != null) {
48331      prop("resourceType", name);
48332      composeCoverageProperties(element);
48333    }
48334  }
48335
48336  protected void composeCoverageProperties(Coverage element) throws IOException {
48337    composeDomainResourceProperties(element);
48338      if (element.hasIdentifier()) {
48339        openArray("identifier");
48340        for (Identifier e : element.getIdentifier()) 
48341          composeIdentifier(null, e);
48342        closeArray();
48343      };
48344      if (element.hasStatusElement()) {
48345        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48346        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48347      }
48348      if (element.hasKindElement()) {
48349        composeEnumerationCore("kind", element.getKindElement(), new Coverage.KindEnumFactory(), false);
48350        composeEnumerationExtras("kind", element.getKindElement(), new Coverage.KindEnumFactory(), false);
48351      }
48352      if (element.hasPaymentBy()) {
48353        openArray("paymentBy");
48354        for (Coverage.CoveragePaymentByComponent e : element.getPaymentBy()) 
48355          composeCoveragePaymentByComponent(null, e);
48356        closeArray();
48357      };
48358      if (element.hasType()) {
48359        composeCodeableConcept("type", element.getType());
48360      }
48361      if (element.hasPolicyHolder()) {
48362        composeReference("policyHolder", element.getPolicyHolder());
48363      }
48364      if (element.hasSubscriber()) {
48365        composeReference("subscriber", element.getSubscriber());
48366      }
48367      if (element.hasSubscriberId()) {
48368        openArray("subscriberId");
48369        for (Identifier e : element.getSubscriberId()) 
48370          composeIdentifier(null, e);
48371        closeArray();
48372      };
48373      if (element.hasBeneficiary()) {
48374        composeReference("beneficiary", element.getBeneficiary());
48375      }
48376      if (element.hasDependentElement()) {
48377        composeStringCore("dependent", element.getDependentElement(), false);
48378        composeStringExtras("dependent", element.getDependentElement(), false);
48379      }
48380      if (element.hasRelationship()) {
48381        composeCodeableConcept("relationship", element.getRelationship());
48382      }
48383      if (element.hasPeriod()) {
48384        composePeriod("period", element.getPeriod());
48385      }
48386      if (element.hasInsurer()) {
48387        composeReference("insurer", element.getInsurer());
48388      }
48389      if (element.hasClass_()) {
48390        openArray("class");
48391        for (Coverage.ClassComponent e : element.getClass_()) 
48392          composeClassComponent(null, e);
48393        closeArray();
48394      };
48395      if (element.hasOrderElement()) {
48396        composePositiveIntCore("order", element.getOrderElement(), false);
48397        composePositiveIntExtras("order", element.getOrderElement(), false);
48398      }
48399      if (element.hasNetworkElement()) {
48400        composeStringCore("network", element.getNetworkElement(), false);
48401        composeStringExtras("network", element.getNetworkElement(), false);
48402      }
48403      if (element.hasCostToBeneficiary()) {
48404        openArray("costToBeneficiary");
48405        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
48406          composeCostToBeneficiaryComponent(null, e);
48407        closeArray();
48408      };
48409      if (element.hasSubrogationElement()) {
48410        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
48411        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
48412      }
48413      if (element.hasContract()) {
48414        openArray("contract");
48415        for (Reference e : element.getContract()) 
48416          composeReference(null, e);
48417        closeArray();
48418      };
48419      if (element.hasInsurancePlan()) {
48420        composeReference("insurancePlan", element.getInsurancePlan());
48421      }
48422  }
48423
48424  protected void composeCoveragePaymentByComponent(String name, Coverage.CoveragePaymentByComponent element) throws IOException {
48425    if (element != null) {
48426      open(name);
48427      composeCoveragePaymentByComponentProperties(element);
48428      close();
48429    }
48430  }
48431
48432  protected void composeCoveragePaymentByComponentProperties(Coverage.CoveragePaymentByComponent element) throws IOException {
48433    composeBackboneElementProperties(element);
48434      if (element.hasParty()) {
48435        composeReference("party", element.getParty());
48436      }
48437      if (element.hasResponsibilityElement()) {
48438        composeStringCore("responsibility", element.getResponsibilityElement(), false);
48439        composeStringExtras("responsibility", element.getResponsibilityElement(), false);
48440      }
48441  }
48442
48443  protected void composeClassComponent(String name, Coverage.ClassComponent element) throws IOException {
48444    if (element != null) {
48445      open(name);
48446      composeClassComponentProperties(element);
48447      close();
48448    }
48449  }
48450
48451  protected void composeClassComponentProperties(Coverage.ClassComponent element) throws IOException {
48452    composeBackboneElementProperties(element);
48453      if (element.hasType()) {
48454        composeCodeableConcept("type", element.getType());
48455      }
48456      if (element.hasValue()) {
48457        composeIdentifier("value", element.getValue());
48458      }
48459      if (element.hasNameElement()) {
48460        composeStringCore("name", element.getNameElement(), false);
48461        composeStringExtras("name", element.getNameElement(), false);
48462      }
48463  }
48464
48465  protected void composeCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
48466    if (element != null) {
48467      open(name);
48468      composeCostToBeneficiaryComponentProperties(element);
48469      close();
48470    }
48471  }
48472
48473  protected void composeCostToBeneficiaryComponentProperties(Coverage.CostToBeneficiaryComponent element) throws IOException {
48474    composeBackboneElementProperties(element);
48475      if (element.hasType()) {
48476        composeCodeableConcept("type", element.getType());
48477      }
48478      if (element.hasCategory()) {
48479        composeCodeableConcept("category", element.getCategory());
48480      }
48481      if (element.hasNetwork()) {
48482        composeCodeableConcept("network", element.getNetwork());
48483      }
48484      if (element.hasUnit()) {
48485        composeCodeableConcept("unit", element.getUnit());
48486      }
48487      if (element.hasTerm()) {
48488        composeCodeableConcept("term", element.getTerm());
48489      }
48490      if (element.hasValue()) {
48491        composeType("value", element.getValue());
48492      }
48493      if (element.hasException()) {
48494        openArray("exception");
48495        for (Coverage.ExemptionComponent e : element.getException()) 
48496          composeExemptionComponent(null, e);
48497        closeArray();
48498      };
48499  }
48500
48501  protected void composeExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
48502    if (element != null) {
48503      open(name);
48504      composeExemptionComponentProperties(element);
48505      close();
48506    }
48507  }
48508
48509  protected void composeExemptionComponentProperties(Coverage.ExemptionComponent element) throws IOException {
48510    composeBackboneElementProperties(element);
48511      if (element.hasType()) {
48512        composeCodeableConcept("type", element.getType());
48513      }
48514      if (element.hasPeriod()) {
48515        composePeriod("period", element.getPeriod());
48516      }
48517  }
48518
48519  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
48520    if (element != null) {
48521      prop("resourceType", name);
48522      composeCoverageEligibilityRequestProperties(element);
48523    }
48524  }
48525
48526  protected void composeCoverageEligibilityRequestProperties(CoverageEligibilityRequest element) throws IOException {
48527    composeDomainResourceProperties(element);
48528      if (element.hasIdentifier()) {
48529        openArray("identifier");
48530        for (Identifier e : element.getIdentifier()) 
48531          composeIdentifier(null, e);
48532        closeArray();
48533      };
48534      if (element.hasStatusElement()) {
48535        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48536        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48537      }
48538      if (element.hasPriority()) {
48539        composeCodeableConcept("priority", element.getPriority());
48540      }
48541      if (element.hasPurpose()) {
48542        openArray("purpose");
48543        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
48544          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
48545        closeArray();
48546        if (anyHasExtras(element.getPurpose())) {
48547          openArray("_purpose");
48548          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
48549            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
48550          closeArray();
48551        }
48552      };
48553      if (element.hasPatient()) {
48554        composeReference("patient", element.getPatient());
48555      }
48556      if (element.hasEvent()) {
48557        openArray("event");
48558        for (CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent e : element.getEvent()) 
48559          composeCoverageEligibilityRequestEventComponent(null, e);
48560        closeArray();
48561      };
48562      if (element.hasServiced()) {
48563        composeType("serviced", element.getServiced());
48564      }
48565      if (element.hasCreatedElement()) {
48566        composeDateTimeCore("created", element.getCreatedElement(), false);
48567        composeDateTimeExtras("created", element.getCreatedElement(), false);
48568      }
48569      if (element.hasEnterer()) {
48570        composeReference("enterer", element.getEnterer());
48571      }
48572      if (element.hasProvider()) {
48573        composeReference("provider", element.getProvider());
48574      }
48575      if (element.hasInsurer()) {
48576        composeReference("insurer", element.getInsurer());
48577      }
48578      if (element.hasFacility()) {
48579        composeReference("facility", element.getFacility());
48580      }
48581      if (element.hasSupportingInfo()) {
48582        openArray("supportingInfo");
48583        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
48584          composeSupportingInformationComponent(null, e);
48585        closeArray();
48586      };
48587      if (element.hasInsurance()) {
48588        openArray("insurance");
48589        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
48590          composeInsuranceComponent(null, e);
48591        closeArray();
48592      };
48593      if (element.hasItem()) {
48594        openArray("item");
48595        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
48596          composeDetailsComponent(null, e);
48597        closeArray();
48598      };
48599  }
48600
48601  protected void composeCoverageEligibilityRequestEventComponent(String name, CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent element) throws IOException {
48602    if (element != null) {
48603      open(name);
48604      composeCoverageEligibilityRequestEventComponentProperties(element);
48605      close();
48606    }
48607  }
48608
48609  protected void composeCoverageEligibilityRequestEventComponentProperties(CoverageEligibilityRequest.CoverageEligibilityRequestEventComponent element) throws IOException {
48610    composeBackboneElementProperties(element);
48611      if (element.hasType()) {
48612        composeCodeableConcept("type", element.getType());
48613      }
48614      if (element.hasWhen()) {
48615        composeType("when", element.getWhen());
48616      }
48617  }
48618
48619  protected void composeSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
48620    if (element != null) {
48621      open(name);
48622      composeSupportingInformationComponentProperties(element);
48623      close();
48624    }
48625  }
48626
48627  protected void composeSupportingInformationComponentProperties(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
48628    composeBackboneElementProperties(element);
48629      if (element.hasSequenceElement()) {
48630        composePositiveIntCore("sequence", element.getSequenceElement(), false);
48631        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
48632      }
48633      if (element.hasInformation()) {
48634        composeReference("information", element.getInformation());
48635      }
48636      if (element.hasAppliesToAllElement()) {
48637        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
48638        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
48639      }
48640  }
48641
48642  protected void composeInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
48643    if (element != null) {
48644      open(name);
48645      composeInsuranceComponentProperties(element);
48646      close();
48647    }
48648  }
48649
48650  protected void composeInsuranceComponentProperties(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
48651    composeBackboneElementProperties(element);
48652      if (element.hasFocalElement()) {
48653        composeBooleanCore("focal", element.getFocalElement(), false);
48654        composeBooleanExtras("focal", element.getFocalElement(), false);
48655      }
48656      if (element.hasCoverage()) {
48657        composeReference("coverage", element.getCoverage());
48658      }
48659      if (element.hasBusinessArrangementElement()) {
48660        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
48661        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
48662      }
48663  }
48664
48665  protected void composeDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
48666    if (element != null) {
48667      open(name);
48668      composeDetailsComponentProperties(element);
48669      close();
48670    }
48671  }
48672
48673  protected void composeDetailsComponentProperties(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
48674    composeBackboneElementProperties(element);
48675      if (element.hasSupportingInfoSequence()) {
48676        if (anyHasValue(element.getSupportingInfoSequence())) {
48677          openArray("supportingInfoSequence");
48678          for (PositiveIntType e : element.getSupportingInfoSequence()) 
48679            composePositiveIntCore(null, e, e != element.getSupportingInfoSequence().get(element.getSupportingInfoSequence().size()-1));
48680          closeArray();
48681        }
48682        if (anyHasExtras(element.getSupportingInfoSequence())) {
48683          openArray("_supportingInfoSequence");
48684          for (PositiveIntType e : element.getSupportingInfoSequence()) 
48685            composePositiveIntExtras(null, e, true);
48686          closeArray();
48687        }
48688      };
48689      if (element.hasCategory()) {
48690        composeCodeableConcept("category", element.getCategory());
48691      }
48692      if (element.hasProductOrService()) {
48693        composeCodeableConcept("productOrService", element.getProductOrService());
48694      }
48695      if (element.hasModifier()) {
48696        openArray("modifier");
48697        for (CodeableConcept e : element.getModifier()) 
48698          composeCodeableConcept(null, e);
48699        closeArray();
48700      };
48701      if (element.hasProvider()) {
48702        composeReference("provider", element.getProvider());
48703      }
48704      if (element.hasQuantity()) {
48705        composeQuantity("quantity", element.getQuantity());
48706      }
48707      if (element.hasUnitPrice()) {
48708        composeMoney("unitPrice", element.getUnitPrice());
48709      }
48710      if (element.hasFacility()) {
48711        composeReference("facility", element.getFacility());
48712      }
48713      if (element.hasDiagnosis()) {
48714        openArray("diagnosis");
48715        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
48716          composeDiagnosisComponent(null, e);
48717        closeArray();
48718      };
48719      if (element.hasDetail()) {
48720        openArray("detail");
48721        for (Reference e : element.getDetail()) 
48722          composeReference(null, e);
48723        closeArray();
48724      };
48725  }
48726
48727  protected void composeDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
48728    if (element != null) {
48729      open(name);
48730      composeDiagnosisComponentProperties(element);
48731      close();
48732    }
48733  }
48734
48735  protected void composeDiagnosisComponentProperties(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
48736    composeBackboneElementProperties(element);
48737      if (element.hasDiagnosis()) {
48738        composeType("diagnosis", element.getDiagnosis());
48739      }
48740  }
48741
48742  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
48743    if (element != null) {
48744      prop("resourceType", name);
48745      composeCoverageEligibilityResponseProperties(element);
48746    }
48747  }
48748
48749  protected void composeCoverageEligibilityResponseProperties(CoverageEligibilityResponse element) throws IOException {
48750    composeDomainResourceProperties(element);
48751      if (element.hasIdentifier()) {
48752        openArray("identifier");
48753        for (Identifier e : element.getIdentifier()) 
48754          composeIdentifier(null, e);
48755        closeArray();
48756      };
48757      if (element.hasStatusElement()) {
48758        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48759        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
48760      }
48761      if (element.hasPurpose()) {
48762        openArray("purpose");
48763        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
48764          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
48765        closeArray();
48766        if (anyHasExtras(element.getPurpose())) {
48767          openArray("_purpose");
48768          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
48769            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
48770          closeArray();
48771        }
48772      };
48773      if (element.hasPatient()) {
48774        composeReference("patient", element.getPatient());
48775      }
48776      if (element.hasEvent()) {
48777        openArray("event");
48778        for (CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent e : element.getEvent()) 
48779          composeCoverageEligibilityResponseEventComponent(null, e);
48780        closeArray();
48781      };
48782      if (element.hasServiced()) {
48783        composeType("serviced", element.getServiced());
48784      }
48785      if (element.hasCreatedElement()) {
48786        composeDateTimeCore("created", element.getCreatedElement(), false);
48787        composeDateTimeExtras("created", element.getCreatedElement(), false);
48788      }
48789      if (element.hasRequestor()) {
48790        composeReference("requestor", element.getRequestor());
48791      }
48792      if (element.hasRequest()) {
48793        composeReference("request", element.getRequest());
48794      }
48795      if (element.hasOutcomeElement()) {
48796        composeEnumerationCore("outcome", element.getOutcomeElement(), new CoverageEligibilityResponse.EligibilityOutcomeEnumFactory(), false);
48797        composeEnumerationExtras("outcome", element.getOutcomeElement(), new CoverageEligibilityResponse.EligibilityOutcomeEnumFactory(), false);
48798      }
48799      if (element.hasDispositionElement()) {
48800        composeStringCore("disposition", element.getDispositionElement(), false);
48801        composeStringExtras("disposition", element.getDispositionElement(), false);
48802      }
48803      if (element.hasInsurer()) {
48804        composeReference("insurer", element.getInsurer());
48805      }
48806      if (element.hasInsurance()) {
48807        openArray("insurance");
48808        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
48809          composeInsuranceComponent(null, e);
48810        closeArray();
48811      };
48812      if (element.hasPreAuthRefElement()) {
48813        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
48814        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
48815      }
48816      if (element.hasForm()) {
48817        composeCodeableConcept("form", element.getForm());
48818      }
48819      if (element.hasError()) {
48820        openArray("error");
48821        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
48822          composeErrorsComponent(null, e);
48823        closeArray();
48824      };
48825  }
48826
48827  protected void composeCoverageEligibilityResponseEventComponent(String name, CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent element) throws IOException {
48828    if (element != null) {
48829      open(name);
48830      composeCoverageEligibilityResponseEventComponentProperties(element);
48831      close();
48832    }
48833  }
48834
48835  protected void composeCoverageEligibilityResponseEventComponentProperties(CoverageEligibilityResponse.CoverageEligibilityResponseEventComponent element) throws IOException {
48836    composeBackboneElementProperties(element);
48837      if (element.hasType()) {
48838        composeCodeableConcept("type", element.getType());
48839      }
48840      if (element.hasWhen()) {
48841        composeType("when", element.getWhen());
48842      }
48843  }
48844
48845  protected void composeInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
48846    if (element != null) {
48847      open(name);
48848      composeInsuranceComponentProperties(element);
48849      close();
48850    }
48851  }
48852
48853  protected void composeInsuranceComponentProperties(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
48854    composeBackboneElementProperties(element);
48855      if (element.hasCoverage()) {
48856        composeReference("coverage", element.getCoverage());
48857      }
48858      if (element.hasInforceElement()) {
48859        composeBooleanCore("inforce", element.getInforceElement(), false);
48860        composeBooleanExtras("inforce", element.getInforceElement(), false);
48861      }
48862      if (element.hasBenefitPeriod()) {
48863        composePeriod("benefitPeriod", element.getBenefitPeriod());
48864      }
48865      if (element.hasItem()) {
48866        openArray("item");
48867        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
48868          composeItemsComponent(null, e);
48869        closeArray();
48870      };
48871  }
48872
48873  protected void composeItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
48874    if (element != null) {
48875      open(name);
48876      composeItemsComponentProperties(element);
48877      close();
48878    }
48879  }
48880
48881  protected void composeItemsComponentProperties(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
48882    composeBackboneElementProperties(element);
48883      if (element.hasCategory()) {
48884        composeCodeableConcept("category", element.getCategory());
48885      }
48886      if (element.hasProductOrService()) {
48887        composeCodeableConcept("productOrService", element.getProductOrService());
48888      }
48889      if (element.hasModifier()) {
48890        openArray("modifier");
48891        for (CodeableConcept e : element.getModifier()) 
48892          composeCodeableConcept(null, e);
48893        closeArray();
48894      };
48895      if (element.hasProvider()) {
48896        composeReference("provider", element.getProvider());
48897      }
48898      if (element.hasExcludedElement()) {
48899        composeBooleanCore("excluded", element.getExcludedElement(), false);
48900        composeBooleanExtras("excluded", element.getExcludedElement(), false);
48901      }
48902      if (element.hasNameElement()) {
48903        composeStringCore("name", element.getNameElement(), false);
48904        composeStringExtras("name", element.getNameElement(), false);
48905      }
48906      if (element.hasDescriptionElement()) {
48907        composeStringCore("description", element.getDescriptionElement(), false);
48908        composeStringExtras("description", element.getDescriptionElement(), false);
48909      }
48910      if (element.hasNetwork()) {
48911        composeCodeableConcept("network", element.getNetwork());
48912      }
48913      if (element.hasUnit()) {
48914        composeCodeableConcept("unit", element.getUnit());
48915      }
48916      if (element.hasTerm()) {
48917        composeCodeableConcept("term", element.getTerm());
48918      }
48919      if (element.hasBenefit()) {
48920        openArray("benefit");
48921        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
48922          composeBenefitComponent(null, e);
48923        closeArray();
48924      };
48925      if (element.hasAuthorizationRequiredElement()) {
48926        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
48927        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
48928      }
48929      if (element.hasAuthorizationSupporting()) {
48930        openArray("authorizationSupporting");
48931        for (CodeableConcept e : element.getAuthorizationSupporting()) 
48932          composeCodeableConcept(null, e);
48933        closeArray();
48934      };
48935      if (element.hasAuthorizationUrlElement()) {
48936        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
48937        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
48938      }
48939  }
48940
48941  protected void composeBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
48942    if (element != null) {
48943      open(name);
48944      composeBenefitComponentProperties(element);
48945      close();
48946    }
48947  }
48948
48949  protected void composeBenefitComponentProperties(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
48950    composeBackboneElementProperties(element);
48951      if (element.hasType()) {
48952        composeCodeableConcept("type", element.getType());
48953      }
48954      if (element.hasAllowed()) {
48955        composeType("allowed", element.getAllowed());
48956      }
48957      if (element.hasUsed()) {
48958        composeType("used", element.getUsed());
48959      }
48960  }
48961
48962  protected void composeErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
48963    if (element != null) {
48964      open(name);
48965      composeErrorsComponentProperties(element);
48966      close();
48967    }
48968  }
48969
48970  protected void composeErrorsComponentProperties(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
48971    composeBackboneElementProperties(element);
48972      if (element.hasCode()) {
48973        composeCodeableConcept("code", element.getCode());
48974      }
48975      if (element.hasExpression()) {
48976        if (anyHasValue(element.getExpression())) {
48977          openArray("expression");
48978          for (StringType e : element.getExpression()) 
48979            composeStringCore(null, e, e != element.getExpression().get(element.getExpression().size()-1));
48980          closeArray();
48981        }
48982        if (anyHasExtras(element.getExpression())) {
48983          openArray("_expression");
48984          for (StringType e : element.getExpression()) 
48985            composeStringExtras(null, e, true);
48986          closeArray();
48987        }
48988      };
48989  }
48990
48991  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
48992    if (element != null) {
48993      prop("resourceType", name);
48994      composeDetectedIssueProperties(element);
48995    }
48996  }
48997
48998  protected void composeDetectedIssueProperties(DetectedIssue element) throws IOException {
48999    composeDomainResourceProperties(element);
49000      if (element.hasIdentifier()) {
49001        openArray("identifier");
49002        for (Identifier e : element.getIdentifier()) 
49003          composeIdentifier(null, e);
49004        closeArray();
49005      };
49006      if (element.hasStatusElement()) {
49007        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
49008        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
49009      }
49010      if (element.hasCategory()) {
49011        openArray("category");
49012        for (CodeableConcept e : element.getCategory()) 
49013          composeCodeableConcept(null, e);
49014        closeArray();
49015      };
49016      if (element.hasCode()) {
49017        composeCodeableConcept("code", element.getCode());
49018      }
49019      if (element.hasSeverityElement()) {
49020        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
49021        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
49022      }
49023      if (element.hasSubject()) {
49024        composeReference("subject", element.getSubject());
49025      }
49026      if (element.hasEncounter()) {
49027        composeReference("encounter", element.getEncounter());
49028      }
49029      if (element.hasIdentified()) {
49030        composeType("identified", element.getIdentified());
49031      }
49032      if (element.hasAuthor()) {
49033        composeReference("author", element.getAuthor());
49034      }
49035      if (element.hasImplicated()) {
49036        openArray("implicated");
49037        for (Reference e : element.getImplicated()) 
49038          composeReference(null, e);
49039        closeArray();
49040      };
49041      if (element.hasEvidence()) {
49042        openArray("evidence");
49043        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
49044          composeDetectedIssueEvidenceComponent(null, e);
49045        closeArray();
49046      };
49047      if (element.hasDetailElement()) {
49048        composeMarkdownCore("detail", element.getDetailElement(), false);
49049        composeMarkdownExtras("detail", element.getDetailElement(), false);
49050      }
49051      if (element.hasReferenceElement()) {
49052        composeUriCore("reference", element.getReferenceElement(), false);
49053        composeUriExtras("reference", element.getReferenceElement(), false);
49054      }
49055      if (element.hasMitigation()) {
49056        openArray("mitigation");
49057        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
49058          composeDetectedIssueMitigationComponent(null, e);
49059        closeArray();
49060      };
49061  }
49062
49063  protected void composeDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
49064    if (element != null) {
49065      open(name);
49066      composeDetectedIssueEvidenceComponentProperties(element);
49067      close();
49068    }
49069  }
49070
49071  protected void composeDetectedIssueEvidenceComponentProperties(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
49072    composeBackboneElementProperties(element);
49073      if (element.hasCode()) {
49074        openArray("code");
49075        for (CodeableConcept e : element.getCode()) 
49076          composeCodeableConcept(null, e);
49077        closeArray();
49078      };
49079      if (element.hasDetail()) {
49080        openArray("detail");
49081        for (Reference e : element.getDetail()) 
49082          composeReference(null, e);
49083        closeArray();
49084      };
49085  }
49086
49087  protected void composeDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
49088    if (element != null) {
49089      open(name);
49090      composeDetectedIssueMitigationComponentProperties(element);
49091      close();
49092    }
49093  }
49094
49095  protected void composeDetectedIssueMitigationComponentProperties(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
49096    composeBackboneElementProperties(element);
49097      if (element.hasAction()) {
49098        composeCodeableConcept("action", element.getAction());
49099      }
49100      if (element.hasDateElement()) {
49101        composeDateTimeCore("date", element.getDateElement(), false);
49102        composeDateTimeExtras("date", element.getDateElement(), false);
49103      }
49104      if (element.hasAuthor()) {
49105        composeReference("author", element.getAuthor());
49106      }
49107      if (element.hasNote()) {
49108        openArray("note");
49109        for (Annotation e : element.getNote()) 
49110          composeAnnotation(null, e);
49111        closeArray();
49112      };
49113  }
49114
49115  protected void composeDevice(String name, Device element) throws IOException {
49116    if (element != null) {
49117      prop("resourceType", name);
49118      composeDeviceProperties(element);
49119    }
49120  }
49121
49122  protected void composeDeviceProperties(Device element) throws IOException {
49123    composeDomainResourceProperties(element);
49124      if (element.hasIdentifier()) {
49125        openArray("identifier");
49126        for (Identifier e : element.getIdentifier()) 
49127          composeIdentifier(null, e);
49128        closeArray();
49129      };
49130      if (element.hasDisplayNameElement()) {
49131        composeStringCore("displayName", element.getDisplayNameElement(), false);
49132        composeStringExtras("displayName", element.getDisplayNameElement(), false);
49133      }
49134      if (element.hasDefinition()) {
49135        composeCodeableReference("definition", element.getDefinition());
49136      }
49137      if (element.hasUdiCarrier()) {
49138        openArray("udiCarrier");
49139        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
49140          composeDeviceUdiCarrierComponent(null, e);
49141        closeArray();
49142      };
49143      if (element.hasStatusElement()) {
49144        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
49145        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
49146      }
49147      if (element.hasAvailabilityStatus()) {
49148        composeCodeableConcept("availabilityStatus", element.getAvailabilityStatus());
49149      }
49150      if (element.hasBiologicalSourceEvent()) {
49151        composeIdentifier("biologicalSourceEvent", element.getBiologicalSourceEvent());
49152      }
49153      if (element.hasManufacturerElement()) {
49154        composeStringCore("manufacturer", element.getManufacturerElement(), false);
49155        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
49156      }
49157      if (element.hasManufactureDateElement()) {
49158        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
49159        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
49160      }
49161      if (element.hasExpirationDateElement()) {
49162        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
49163        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
49164      }
49165      if (element.hasLotNumberElement()) {
49166        composeStringCore("lotNumber", element.getLotNumberElement(), false);
49167        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
49168      }
49169      if (element.hasSerialNumberElement()) {
49170        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
49171        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
49172      }
49173      if (element.hasName()) {
49174        openArray("name");
49175        for (Device.DeviceNameComponent e : element.getName()) 
49176          composeDeviceNameComponent(null, e);
49177        closeArray();
49178      };
49179      if (element.hasModelNumberElement()) {
49180        composeStringCore("modelNumber", element.getModelNumberElement(), false);
49181        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
49182      }
49183      if (element.hasPartNumberElement()) {
49184        composeStringCore("partNumber", element.getPartNumberElement(), false);
49185        composeStringExtras("partNumber", element.getPartNumberElement(), false);
49186      }
49187      if (element.hasCategory()) {
49188        openArray("category");
49189        for (CodeableConcept e : element.getCategory()) 
49190          composeCodeableConcept(null, e);
49191        closeArray();
49192      };
49193      if (element.hasType()) {
49194        openArray("type");
49195        for (CodeableConcept e : element.getType()) 
49196          composeCodeableConcept(null, e);
49197        closeArray();
49198      };
49199      if (element.hasVersion()) {
49200        openArray("version");
49201        for (Device.DeviceVersionComponent e : element.getVersion()) 
49202          composeDeviceVersionComponent(null, e);
49203        closeArray();
49204      };
49205      if (element.hasConformsTo()) {
49206        openArray("conformsTo");
49207        for (Device.DeviceConformsToComponent e : element.getConformsTo()) 
49208          composeDeviceConformsToComponent(null, e);
49209        closeArray();
49210      };
49211      if (element.hasProperty()) {
49212        openArray("property");
49213        for (Device.DevicePropertyComponent e : element.getProperty()) 
49214          composeDevicePropertyComponent(null, e);
49215        closeArray();
49216      };
49217      if (element.hasMode()) {
49218        composeCodeableConcept("mode", element.getMode());
49219      }
49220      if (element.hasCycle()) {
49221        composeCount("cycle", element.getCycle());
49222      }
49223      if (element.hasDuration()) {
49224        composeDuration("duration", element.getDuration());
49225      }
49226      if (element.hasOwner()) {
49227        composeReference("owner", element.getOwner());
49228      }
49229      if (element.hasContact()) {
49230        openArray("contact");
49231        for (ContactPoint e : element.getContact()) 
49232          composeContactPoint(null, e);
49233        closeArray();
49234      };
49235      if (element.hasLocation()) {
49236        composeReference("location", element.getLocation());
49237      }
49238      if (element.hasUrlElement()) {
49239        composeUriCore("url", element.getUrlElement(), false);
49240        composeUriExtras("url", element.getUrlElement(), false);
49241      }
49242      if (element.hasEndpoint()) {
49243        openArray("endpoint");
49244        for (Reference e : element.getEndpoint()) 
49245          composeReference(null, e);
49246        closeArray();
49247      };
49248      if (element.hasGateway()) {
49249        openArray("gateway");
49250        for (CodeableReference e : element.getGateway()) 
49251          composeCodeableReference(null, e);
49252        closeArray();
49253      };
49254      if (element.hasNote()) {
49255        openArray("note");
49256        for (Annotation e : element.getNote()) 
49257          composeAnnotation(null, e);
49258        closeArray();
49259      };
49260      if (element.hasSafety()) {
49261        openArray("safety");
49262        for (CodeableConcept e : element.getSafety()) 
49263          composeCodeableConcept(null, e);
49264        closeArray();
49265      };
49266      if (element.hasParent()) {
49267        composeReference("parent", element.getParent());
49268      }
49269  }
49270
49271  protected void composeDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
49272    if (element != null) {
49273      open(name);
49274      composeDeviceUdiCarrierComponentProperties(element);
49275      close();
49276    }
49277  }
49278
49279  protected void composeDeviceUdiCarrierComponentProperties(Device.DeviceUdiCarrierComponent element) throws IOException {
49280    composeBackboneElementProperties(element);
49281      if (element.hasDeviceIdentifierElement()) {
49282        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49283        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49284      }
49285      if (element.hasIssuerElement()) {
49286        composeUriCore("issuer", element.getIssuerElement(), false);
49287        composeUriExtras("issuer", element.getIssuerElement(), false);
49288      }
49289      if (element.hasJurisdictionElement()) {
49290        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
49291        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
49292      }
49293      if (element.hasCarrierAIDCElement()) {
49294        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
49295        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
49296      }
49297      if (element.hasCarrierHRFElement()) {
49298        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
49299        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
49300      }
49301      if (element.hasEntryTypeElement()) {
49302        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
49303        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
49304      }
49305  }
49306
49307  protected void composeDeviceNameComponent(String name, Device.DeviceNameComponent element) throws IOException {
49308    if (element != null) {
49309      open(name);
49310      composeDeviceNameComponentProperties(element);
49311      close();
49312    }
49313  }
49314
49315  protected void composeDeviceNameComponentProperties(Device.DeviceNameComponent element) throws IOException {
49316    composeBackboneElementProperties(element);
49317      if (element.hasValueElement()) {
49318        composeStringCore("value", element.getValueElement(), false);
49319        composeStringExtras("value", element.getValueElement(), false);
49320      }
49321      if (element.hasTypeElement()) {
49322        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49323        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49324      }
49325      if (element.hasDisplayElement()) {
49326        composeBooleanCore("display", element.getDisplayElement(), false);
49327        composeBooleanExtras("display", element.getDisplayElement(), false);
49328      }
49329  }
49330
49331  protected void composeDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
49332    if (element != null) {
49333      open(name);
49334      composeDeviceVersionComponentProperties(element);
49335      close();
49336    }
49337  }
49338
49339  protected void composeDeviceVersionComponentProperties(Device.DeviceVersionComponent element) throws IOException {
49340    composeBackboneElementProperties(element);
49341      if (element.hasType()) {
49342        composeCodeableConcept("type", element.getType());
49343      }
49344      if (element.hasComponent()) {
49345        composeIdentifier("component", element.getComponent());
49346      }
49347      if (element.hasInstallDateElement()) {
49348        composeDateTimeCore("installDate", element.getInstallDateElement(), false);
49349        composeDateTimeExtras("installDate", element.getInstallDateElement(), false);
49350      }
49351      if (element.hasValueElement()) {
49352        composeStringCore("value", element.getValueElement(), false);
49353        composeStringExtras("value", element.getValueElement(), false);
49354      }
49355  }
49356
49357  protected void composeDeviceConformsToComponent(String name, Device.DeviceConformsToComponent element) throws IOException {
49358    if (element != null) {
49359      open(name);
49360      composeDeviceConformsToComponentProperties(element);
49361      close();
49362    }
49363  }
49364
49365  protected void composeDeviceConformsToComponentProperties(Device.DeviceConformsToComponent element) throws IOException {
49366    composeBackboneElementProperties(element);
49367      if (element.hasCategory()) {
49368        composeCodeableConcept("category", element.getCategory());
49369      }
49370      if (element.hasSpecification()) {
49371        composeCodeableConcept("specification", element.getSpecification());
49372      }
49373      if (element.hasVersionElement()) {
49374        composeStringCore("version", element.getVersionElement(), false);
49375        composeStringExtras("version", element.getVersionElement(), false);
49376      }
49377  }
49378
49379  protected void composeDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
49380    if (element != null) {
49381      open(name);
49382      composeDevicePropertyComponentProperties(element);
49383      close();
49384    }
49385  }
49386
49387  protected void composeDevicePropertyComponentProperties(Device.DevicePropertyComponent element) throws IOException {
49388    composeBackboneElementProperties(element);
49389      if (element.hasType()) {
49390        composeCodeableConcept("type", element.getType());
49391      }
49392      if (element.hasValue()) {
49393        composeType("value", element.getValue());
49394      }
49395  }
49396
49397  protected void composeDeviceAssociation(String name, DeviceAssociation element) throws IOException {
49398    if (element != null) {
49399      prop("resourceType", name);
49400      composeDeviceAssociationProperties(element);
49401    }
49402  }
49403
49404  protected void composeDeviceAssociationProperties(DeviceAssociation element) throws IOException {
49405    composeDomainResourceProperties(element);
49406      if (element.hasIdentifier()) {
49407        openArray("identifier");
49408        for (Identifier e : element.getIdentifier()) 
49409          composeIdentifier(null, e);
49410        closeArray();
49411      };
49412      if (element.hasDevice()) {
49413        composeReference("device", element.getDevice());
49414      }
49415      if (element.hasCategory()) {
49416        openArray("category");
49417        for (CodeableConcept e : element.getCategory()) 
49418          composeCodeableConcept(null, e);
49419        closeArray();
49420      };
49421      if (element.hasStatus()) {
49422        composeCodeableConcept("status", element.getStatus());
49423      }
49424      if (element.hasStatusReason()) {
49425        openArray("statusReason");
49426        for (CodeableConcept e : element.getStatusReason()) 
49427          composeCodeableConcept(null, e);
49428        closeArray();
49429      };
49430      if (element.hasSubject()) {
49431        composeReference("subject", element.getSubject());
49432      }
49433      if (element.hasBodyStructure()) {
49434        composeReference("bodyStructure", element.getBodyStructure());
49435      }
49436      if (element.hasPeriod()) {
49437        composePeriod("period", element.getPeriod());
49438      }
49439      if (element.hasOperation()) {
49440        openArray("operation");
49441        for (DeviceAssociation.DeviceAssociationOperationComponent e : element.getOperation()) 
49442          composeDeviceAssociationOperationComponent(null, e);
49443        closeArray();
49444      };
49445  }
49446
49447  protected void composeDeviceAssociationOperationComponent(String name, DeviceAssociation.DeviceAssociationOperationComponent element) throws IOException {
49448    if (element != null) {
49449      open(name);
49450      composeDeviceAssociationOperationComponentProperties(element);
49451      close();
49452    }
49453  }
49454
49455  protected void composeDeviceAssociationOperationComponentProperties(DeviceAssociation.DeviceAssociationOperationComponent element) throws IOException {
49456    composeBackboneElementProperties(element);
49457      if (element.hasStatus()) {
49458        composeCodeableConcept("status", element.getStatus());
49459      }
49460      if (element.hasOperator()) {
49461        openArray("operator");
49462        for (Reference e : element.getOperator()) 
49463          composeReference(null, e);
49464        closeArray();
49465      };
49466      if (element.hasPeriod()) {
49467        composePeriod("period", element.getPeriod());
49468      }
49469  }
49470
49471  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
49472    if (element != null) {
49473      prop("resourceType", name);
49474      composeDeviceDefinitionProperties(element);
49475    }
49476  }
49477
49478  protected void composeDeviceDefinitionProperties(DeviceDefinition element) throws IOException {
49479    composeDomainResourceProperties(element);
49480      if (element.hasDescriptionElement()) {
49481        composeMarkdownCore("description", element.getDescriptionElement(), false);
49482        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49483      }
49484      if (element.hasIdentifier()) {
49485        openArray("identifier");
49486        for (Identifier e : element.getIdentifier()) 
49487          composeIdentifier(null, e);
49488        closeArray();
49489      };
49490      if (element.hasUdiDeviceIdentifier()) {
49491        openArray("udiDeviceIdentifier");
49492        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
49493          composeDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
49494        closeArray();
49495      };
49496      if (element.hasRegulatoryIdentifier()) {
49497        openArray("regulatoryIdentifier");
49498        for (DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent e : element.getRegulatoryIdentifier()) 
49499          composeDeviceDefinitionRegulatoryIdentifierComponent(null, e);
49500        closeArray();
49501      };
49502      if (element.hasPartNumberElement()) {
49503        composeStringCore("partNumber", element.getPartNumberElement(), false);
49504        composeStringExtras("partNumber", element.getPartNumberElement(), false);
49505      }
49506      if (element.hasManufacturer()) {
49507        composeReference("manufacturer", element.getManufacturer());
49508      }
49509      if (element.hasDeviceName()) {
49510        openArray("deviceName");
49511        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
49512          composeDeviceDefinitionDeviceNameComponent(null, e);
49513        closeArray();
49514      };
49515      if (element.hasModelNumberElement()) {
49516        composeStringCore("modelNumber", element.getModelNumberElement(), false);
49517        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
49518      }
49519      if (element.hasClassification()) {
49520        openArray("classification");
49521        for (DeviceDefinition.DeviceDefinitionClassificationComponent e : element.getClassification()) 
49522          composeDeviceDefinitionClassificationComponent(null, e);
49523        closeArray();
49524      };
49525      if (element.hasConformsTo()) {
49526        openArray("conformsTo");
49527        for (DeviceDefinition.DeviceDefinitionConformsToComponent e : element.getConformsTo()) 
49528          composeDeviceDefinitionConformsToComponent(null, e);
49529        closeArray();
49530      };
49531      if (element.hasHasPart()) {
49532        openArray("hasPart");
49533        for (DeviceDefinition.DeviceDefinitionHasPartComponent e : element.getHasPart()) 
49534          composeDeviceDefinitionHasPartComponent(null, e);
49535        closeArray();
49536      };
49537      if (element.hasPackaging()) {
49538        openArray("packaging");
49539        for (DeviceDefinition.DeviceDefinitionPackagingComponent e : element.getPackaging()) 
49540          composeDeviceDefinitionPackagingComponent(null, e);
49541        closeArray();
49542      };
49543      if (element.hasVersion()) {
49544        openArray("version");
49545        for (DeviceDefinition.DeviceDefinitionVersionComponent e : element.getVersion()) 
49546          composeDeviceDefinitionVersionComponent(null, e);
49547        closeArray();
49548      };
49549      if (element.hasSafety()) {
49550        openArray("safety");
49551        for (CodeableConcept e : element.getSafety()) 
49552          composeCodeableConcept(null, e);
49553        closeArray();
49554      };
49555      if (element.hasShelfLifeStorage()) {
49556        openArray("shelfLifeStorage");
49557        for (ProductShelfLife e : element.getShelfLifeStorage()) 
49558          composeProductShelfLife(null, e);
49559        closeArray();
49560      };
49561      if (element.hasLanguageCode()) {
49562        openArray("languageCode");
49563        for (CodeableConcept e : element.getLanguageCode()) 
49564          composeCodeableConcept(null, e);
49565        closeArray();
49566      };
49567      if (element.hasProperty()) {
49568        openArray("property");
49569        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
49570          composeDeviceDefinitionPropertyComponent(null, e);
49571        closeArray();
49572      };
49573      if (element.hasOwner()) {
49574        composeReference("owner", element.getOwner());
49575      }
49576      if (element.hasContact()) {
49577        openArray("contact");
49578        for (ContactPoint e : element.getContact()) 
49579          composeContactPoint(null, e);
49580        closeArray();
49581      };
49582      if (element.hasLink()) {
49583        openArray("link");
49584        for (DeviceDefinition.DeviceDefinitionLinkComponent e : element.getLink()) 
49585          composeDeviceDefinitionLinkComponent(null, e);
49586        closeArray();
49587      };
49588      if (element.hasNote()) {
49589        openArray("note");
49590        for (Annotation e : element.getNote()) 
49591          composeAnnotation(null, e);
49592        closeArray();
49593      };
49594      if (element.hasMaterial()) {
49595        openArray("material");
49596        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
49597          composeDeviceDefinitionMaterialComponent(null, e);
49598        closeArray();
49599      };
49600      if (element.hasProductionIdentifierInUDI()) {
49601        openArray("productionIdentifierInUDI");
49602        for (Enumeration<DeviceDefinition.DeviceProductionIdentifierInUDI> e : element.getProductionIdentifierInUDI()) 
49603          composeEnumerationCore(null, e, new DeviceDefinition.DeviceProductionIdentifierInUDIEnumFactory(), true);
49604        closeArray();
49605        if (anyHasExtras(element.getProductionIdentifierInUDI())) {
49606          openArray("_productionIdentifierInUDI");
49607          for (Enumeration<DeviceDefinition.DeviceProductionIdentifierInUDI> e : element.getProductionIdentifierInUDI()) 
49608            composeEnumerationExtras(null, e, new DeviceDefinition.DeviceProductionIdentifierInUDIEnumFactory(), true);
49609          closeArray();
49610        }
49611      };
49612      if (element.hasGuideline()) {
49613        composeDeviceDefinitionGuidelineComponent("guideline", element.getGuideline());
49614      }
49615      if (element.hasCorrectiveAction()) {
49616        composeDeviceDefinitionCorrectiveActionComponent("correctiveAction", element.getCorrectiveAction());
49617      }
49618      if (element.hasChargeItem()) {
49619        openArray("chargeItem");
49620        for (DeviceDefinition.DeviceDefinitionChargeItemComponent e : element.getChargeItem()) 
49621          composeDeviceDefinitionChargeItemComponent(null, e);
49622        closeArray();
49623      };
49624  }
49625
49626  protected void composeDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
49627    if (element != null) {
49628      open(name);
49629      composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(element);
49630      close();
49631    }
49632  }
49633
49634  protected void composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
49635    composeBackboneElementProperties(element);
49636      if (element.hasDeviceIdentifierElement()) {
49637        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49638        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49639      }
49640      if (element.hasIssuerElement()) {
49641        composeUriCore("issuer", element.getIssuerElement(), false);
49642        composeUriExtras("issuer", element.getIssuerElement(), false);
49643      }
49644      if (element.hasJurisdictionElement()) {
49645        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
49646        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
49647      }
49648      if (element.hasMarketDistribution()) {
49649        openArray("marketDistribution");
49650        for (DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent e : element.getMarketDistribution()) 
49651          composeUdiDeviceIdentifierMarketDistributionComponent(null, e);
49652        closeArray();
49653      };
49654  }
49655
49656  protected void composeUdiDeviceIdentifierMarketDistributionComponent(String name, DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent element) throws IOException {
49657    if (element != null) {
49658      open(name);
49659      composeUdiDeviceIdentifierMarketDistributionComponentProperties(element);
49660      close();
49661    }
49662  }
49663
49664  protected void composeUdiDeviceIdentifierMarketDistributionComponentProperties(DeviceDefinition.UdiDeviceIdentifierMarketDistributionComponent element) throws IOException {
49665    composeBackboneElementProperties(element);
49666      if (element.hasMarketPeriod()) {
49667        composePeriod("marketPeriod", element.getMarketPeriod());
49668      }
49669      if (element.hasSubJurisdictionElement()) {
49670        composeUriCore("subJurisdiction", element.getSubJurisdictionElement(), false);
49671        composeUriExtras("subJurisdiction", element.getSubJurisdictionElement(), false);
49672      }
49673  }
49674
49675  protected void composeDeviceDefinitionRegulatoryIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent element) throws IOException {
49676    if (element != null) {
49677      open(name);
49678      composeDeviceDefinitionRegulatoryIdentifierComponentProperties(element);
49679      close();
49680    }
49681  }
49682
49683  protected void composeDeviceDefinitionRegulatoryIdentifierComponentProperties(DeviceDefinition.DeviceDefinitionRegulatoryIdentifierComponent element) throws IOException {
49684    composeBackboneElementProperties(element);
49685      if (element.hasTypeElement()) {
49686        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceDefinitionRegulatoryIdentifierTypeEnumFactory(), false);
49687        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceDefinitionRegulatoryIdentifierTypeEnumFactory(), false);
49688      }
49689      if (element.hasDeviceIdentifierElement()) {
49690        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49691        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
49692      }
49693      if (element.hasIssuerElement()) {
49694        composeUriCore("issuer", element.getIssuerElement(), false);
49695        composeUriExtras("issuer", element.getIssuerElement(), false);
49696      }
49697      if (element.hasJurisdictionElement()) {
49698        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
49699        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
49700      }
49701  }
49702
49703  protected void composeDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
49704    if (element != null) {
49705      open(name);
49706      composeDeviceDefinitionDeviceNameComponentProperties(element);
49707      close();
49708    }
49709  }
49710
49711  protected void composeDeviceDefinitionDeviceNameComponentProperties(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
49712    composeBackboneElementProperties(element);
49713      if (element.hasNameElement()) {
49714        composeStringCore("name", element.getNameElement(), false);
49715        composeStringExtras("name", element.getNameElement(), false);
49716      }
49717      if (element.hasTypeElement()) {
49718        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49719        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
49720      }
49721  }
49722
49723  protected void composeDeviceDefinitionClassificationComponent(String name, DeviceDefinition.DeviceDefinitionClassificationComponent element) throws IOException {
49724    if (element != null) {
49725      open(name);
49726      composeDeviceDefinitionClassificationComponentProperties(element);
49727      close();
49728    }
49729  }
49730
49731  protected void composeDeviceDefinitionClassificationComponentProperties(DeviceDefinition.DeviceDefinitionClassificationComponent element) throws IOException {
49732    composeBackboneElementProperties(element);
49733      if (element.hasType()) {
49734        composeCodeableConcept("type", element.getType());
49735      }
49736      if (element.hasJustification()) {
49737        openArray("justification");
49738        for (RelatedArtifact e : element.getJustification()) 
49739          composeRelatedArtifact(null, e);
49740        closeArray();
49741      };
49742  }
49743
49744  protected void composeDeviceDefinitionConformsToComponent(String name, DeviceDefinition.DeviceDefinitionConformsToComponent element) throws IOException {
49745    if (element != null) {
49746      open(name);
49747      composeDeviceDefinitionConformsToComponentProperties(element);
49748      close();
49749    }
49750  }
49751
49752  protected void composeDeviceDefinitionConformsToComponentProperties(DeviceDefinition.DeviceDefinitionConformsToComponent element) throws IOException {
49753    composeBackboneElementProperties(element);
49754      if (element.hasCategory()) {
49755        composeCodeableConcept("category", element.getCategory());
49756      }
49757      if (element.hasSpecification()) {
49758        composeCodeableConcept("specification", element.getSpecification());
49759      }
49760      if (element.hasVersion()) {
49761        if (anyHasValue(element.getVersion())) {
49762          openArray("version");
49763          for (StringType e : element.getVersion()) 
49764            composeStringCore(null, e, e != element.getVersion().get(element.getVersion().size()-1));
49765          closeArray();
49766        }
49767        if (anyHasExtras(element.getVersion())) {
49768          openArray("_version");
49769          for (StringType e : element.getVersion()) 
49770            composeStringExtras(null, e, true);
49771          closeArray();
49772        }
49773      };
49774      if (element.hasSource()) {
49775        openArray("source");
49776        for (RelatedArtifact e : element.getSource()) 
49777          composeRelatedArtifact(null, e);
49778        closeArray();
49779      };
49780  }
49781
49782  protected void composeDeviceDefinitionHasPartComponent(String name, DeviceDefinition.DeviceDefinitionHasPartComponent element) throws IOException {
49783    if (element != null) {
49784      open(name);
49785      composeDeviceDefinitionHasPartComponentProperties(element);
49786      close();
49787    }
49788  }
49789
49790  protected void composeDeviceDefinitionHasPartComponentProperties(DeviceDefinition.DeviceDefinitionHasPartComponent element) throws IOException {
49791    composeBackboneElementProperties(element);
49792      if (element.hasReference()) {
49793        composeReference("reference", element.getReference());
49794      }
49795      if (element.hasCountElement()) {
49796        composeIntegerCore("count", element.getCountElement(), false);
49797        composeIntegerExtras("count", element.getCountElement(), false);
49798      }
49799  }
49800
49801  protected void composeDeviceDefinitionPackagingComponent(String name, DeviceDefinition.DeviceDefinitionPackagingComponent element) throws IOException {
49802    if (element != null) {
49803      open(name);
49804      composeDeviceDefinitionPackagingComponentProperties(element);
49805      close();
49806    }
49807  }
49808
49809  protected void composeDeviceDefinitionPackagingComponentProperties(DeviceDefinition.DeviceDefinitionPackagingComponent element) throws IOException {
49810    composeBackboneElementProperties(element);
49811      if (element.hasIdentifier()) {
49812        composeIdentifier("identifier", element.getIdentifier());
49813      }
49814      if (element.hasType()) {
49815        composeCodeableConcept("type", element.getType());
49816      }
49817      if (element.hasCountElement()) {
49818        composeIntegerCore("count", element.getCountElement(), false);
49819        composeIntegerExtras("count", element.getCountElement(), false);
49820      }
49821      if (element.hasDistributor()) {
49822        openArray("distributor");
49823        for (DeviceDefinition.PackagingDistributorComponent e : element.getDistributor()) 
49824          composePackagingDistributorComponent(null, e);
49825        closeArray();
49826      };
49827      if (element.hasUdiDeviceIdentifier()) {
49828        openArray("udiDeviceIdentifier");
49829        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
49830          composeDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
49831        closeArray();
49832      };
49833      if (element.hasPackaging()) {
49834        openArray("packaging");
49835        for (DeviceDefinition.DeviceDefinitionPackagingComponent e : element.getPackaging()) 
49836          composeDeviceDefinitionPackagingComponent(null, e);
49837        closeArray();
49838      };
49839  }
49840
49841  protected void composePackagingDistributorComponent(String name, DeviceDefinition.PackagingDistributorComponent element) throws IOException {
49842    if (element != null) {
49843      open(name);
49844      composePackagingDistributorComponentProperties(element);
49845      close();
49846    }
49847  }
49848
49849  protected void composePackagingDistributorComponentProperties(DeviceDefinition.PackagingDistributorComponent element) throws IOException {
49850    composeBackboneElementProperties(element);
49851      if (element.hasNameElement()) {
49852        composeStringCore("name", element.getNameElement(), false);
49853        composeStringExtras("name", element.getNameElement(), false);
49854      }
49855      if (element.hasOrganizationReference()) {
49856        openArray("organizationReference");
49857        for (Reference e : element.getOrganizationReference()) 
49858          composeReference(null, e);
49859        closeArray();
49860      };
49861  }
49862
49863  protected void composeDeviceDefinitionVersionComponent(String name, DeviceDefinition.DeviceDefinitionVersionComponent element) throws IOException {
49864    if (element != null) {
49865      open(name);
49866      composeDeviceDefinitionVersionComponentProperties(element);
49867      close();
49868    }
49869  }
49870
49871  protected void composeDeviceDefinitionVersionComponentProperties(DeviceDefinition.DeviceDefinitionVersionComponent element) throws IOException {
49872    composeBackboneElementProperties(element);
49873      if (element.hasType()) {
49874        composeCodeableConcept("type", element.getType());
49875      }
49876      if (element.hasComponent()) {
49877        composeIdentifier("component", element.getComponent());
49878      }
49879      if (element.hasValueElement()) {
49880        composeStringCore("value", element.getValueElement(), false);
49881        composeStringExtras("value", element.getValueElement(), false);
49882      }
49883  }
49884
49885  protected void composeDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
49886    if (element != null) {
49887      open(name);
49888      composeDeviceDefinitionPropertyComponentProperties(element);
49889      close();
49890    }
49891  }
49892
49893  protected void composeDeviceDefinitionPropertyComponentProperties(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
49894    composeBackboneElementProperties(element);
49895      if (element.hasType()) {
49896        composeCodeableConcept("type", element.getType());
49897      }
49898      if (element.hasValue()) {
49899        composeType("value", element.getValue());
49900      }
49901  }
49902
49903  protected void composeDeviceDefinitionLinkComponent(String name, DeviceDefinition.DeviceDefinitionLinkComponent element) throws IOException {
49904    if (element != null) {
49905      open(name);
49906      composeDeviceDefinitionLinkComponentProperties(element);
49907      close();
49908    }
49909  }
49910
49911  protected void composeDeviceDefinitionLinkComponentProperties(DeviceDefinition.DeviceDefinitionLinkComponent element) throws IOException {
49912    composeBackboneElementProperties(element);
49913      if (element.hasRelation()) {
49914        composeCoding("relation", element.getRelation());
49915      }
49916      if (element.hasRelatedDevice()) {
49917        composeCodeableReference("relatedDevice", element.getRelatedDevice());
49918      }
49919  }
49920
49921  protected void composeDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
49922    if (element != null) {
49923      open(name);
49924      composeDeviceDefinitionMaterialComponentProperties(element);
49925      close();
49926    }
49927  }
49928
49929  protected void composeDeviceDefinitionMaterialComponentProperties(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
49930    composeBackboneElementProperties(element);
49931      if (element.hasSubstance()) {
49932        composeCodeableConcept("substance", element.getSubstance());
49933      }
49934      if (element.hasAlternateElement()) {
49935        composeBooleanCore("alternate", element.getAlternateElement(), false);
49936        composeBooleanExtras("alternate", element.getAlternateElement(), false);
49937      }
49938      if (element.hasAllergenicIndicatorElement()) {
49939        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
49940        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
49941      }
49942  }
49943
49944  protected void composeDeviceDefinitionGuidelineComponent(String name, DeviceDefinition.DeviceDefinitionGuidelineComponent element) throws IOException {
49945    if (element != null) {
49946      open(name);
49947      composeDeviceDefinitionGuidelineComponentProperties(element);
49948      close();
49949    }
49950  }
49951
49952  protected void composeDeviceDefinitionGuidelineComponentProperties(DeviceDefinition.DeviceDefinitionGuidelineComponent element) throws IOException {
49953    composeBackboneElementProperties(element);
49954      if (element.hasUseContext()) {
49955        openArray("useContext");
49956        for (UsageContext e : element.getUseContext()) 
49957          composeUsageContext(null, e);
49958        closeArray();
49959      };
49960      if (element.hasUsageInstructionElement()) {
49961        composeMarkdownCore("usageInstruction", element.getUsageInstructionElement(), false);
49962        composeMarkdownExtras("usageInstruction", element.getUsageInstructionElement(), false);
49963      }
49964      if (element.hasRelatedArtifact()) {
49965        openArray("relatedArtifact");
49966        for (RelatedArtifact e : element.getRelatedArtifact()) 
49967          composeRelatedArtifact(null, e);
49968        closeArray();
49969      };
49970      if (element.hasIndication()) {
49971        openArray("indication");
49972        for (CodeableConcept e : element.getIndication()) 
49973          composeCodeableConcept(null, e);
49974        closeArray();
49975      };
49976      if (element.hasContraindication()) {
49977        openArray("contraindication");
49978        for (CodeableConcept e : element.getContraindication()) 
49979          composeCodeableConcept(null, e);
49980        closeArray();
49981      };
49982      if (element.hasWarning()) {
49983        openArray("warning");
49984        for (CodeableConcept e : element.getWarning()) 
49985          composeCodeableConcept(null, e);
49986        closeArray();
49987      };
49988      if (element.hasIntendedUseElement()) {
49989        composeStringCore("intendedUse", element.getIntendedUseElement(), false);
49990        composeStringExtras("intendedUse", element.getIntendedUseElement(), false);
49991      }
49992  }
49993
49994  protected void composeDeviceDefinitionCorrectiveActionComponent(String name, DeviceDefinition.DeviceDefinitionCorrectiveActionComponent element) throws IOException {
49995    if (element != null) {
49996      open(name);
49997      composeDeviceDefinitionCorrectiveActionComponentProperties(element);
49998      close();
49999    }
50000  }
50001
50002  protected void composeDeviceDefinitionCorrectiveActionComponentProperties(DeviceDefinition.DeviceDefinitionCorrectiveActionComponent element) throws IOException {
50003    composeBackboneElementProperties(element);
50004      if (element.hasRecallElement()) {
50005        composeBooleanCore("recall", element.getRecallElement(), false);
50006        composeBooleanExtras("recall", element.getRecallElement(), false);
50007      }
50008      if (element.hasScopeElement()) {
50009        composeEnumerationCore("scope", element.getScopeElement(), new DeviceDefinition.DeviceCorrectiveActionScopeEnumFactory(), false);
50010        composeEnumerationExtras("scope", element.getScopeElement(), new DeviceDefinition.DeviceCorrectiveActionScopeEnumFactory(), false);
50011      }
50012      if (element.hasPeriod()) {
50013        composePeriod("period", element.getPeriod());
50014      }
50015  }
50016
50017  protected void composeDeviceDefinitionChargeItemComponent(String name, DeviceDefinition.DeviceDefinitionChargeItemComponent element) throws IOException {
50018    if (element != null) {
50019      open(name);
50020      composeDeviceDefinitionChargeItemComponentProperties(element);
50021      close();
50022    }
50023  }
50024
50025  protected void composeDeviceDefinitionChargeItemComponentProperties(DeviceDefinition.DeviceDefinitionChargeItemComponent element) throws IOException {
50026    composeBackboneElementProperties(element);
50027      if (element.hasChargeItemCode()) {
50028        composeCodeableReference("chargeItemCode", element.getChargeItemCode());
50029      }
50030      if (element.hasCount()) {
50031        composeQuantity("count", element.getCount());
50032      }
50033      if (element.hasEffectivePeriod()) {
50034        composePeriod("effectivePeriod", element.getEffectivePeriod());
50035      }
50036      if (element.hasUseContext()) {
50037        openArray("useContext");
50038        for (UsageContext e : element.getUseContext()) 
50039          composeUsageContext(null, e);
50040        closeArray();
50041      };
50042  }
50043
50044  protected void composeDeviceDispense(String name, DeviceDispense element) throws IOException {
50045    if (element != null) {
50046      prop("resourceType", name);
50047      composeDeviceDispenseProperties(element);
50048    }
50049  }
50050
50051  protected void composeDeviceDispenseProperties(DeviceDispense element) throws IOException {
50052    composeDomainResourceProperties(element);
50053      if (element.hasIdentifier()) {
50054        openArray("identifier");
50055        for (Identifier e : element.getIdentifier()) 
50056          composeIdentifier(null, e);
50057        closeArray();
50058      };
50059      if (element.hasBasedOn()) {
50060        openArray("basedOn");
50061        for (Reference e : element.getBasedOn()) 
50062          composeReference(null, e);
50063        closeArray();
50064      };
50065      if (element.hasPartOf()) {
50066        openArray("partOf");
50067        for (Reference e : element.getPartOf()) 
50068          composeReference(null, e);
50069        closeArray();
50070      };
50071      if (element.hasStatusElement()) {
50072        composeEnumerationCore("status", element.getStatusElement(), new DeviceDispense.DeviceDispenseStatusCodesEnumFactory(), false);
50073        composeEnumerationExtras("status", element.getStatusElement(), new DeviceDispense.DeviceDispenseStatusCodesEnumFactory(), false);
50074      }
50075      if (element.hasStatusReason()) {
50076        composeCodeableReference("statusReason", element.getStatusReason());
50077      }
50078      if (element.hasCategory()) {
50079        openArray("category");
50080        for (CodeableConcept e : element.getCategory()) 
50081          composeCodeableConcept(null, e);
50082        closeArray();
50083      };
50084      if (element.hasDevice()) {
50085        composeCodeableReference("device", element.getDevice());
50086      }
50087      if (element.hasSubject()) {
50088        composeReference("subject", element.getSubject());
50089      }
50090      if (element.hasReceiver()) {
50091        composeReference("receiver", element.getReceiver());
50092      }
50093      if (element.hasEncounter()) {
50094        composeReference("encounter", element.getEncounter());
50095      }
50096      if (element.hasSupportingInformation()) {
50097        openArray("supportingInformation");
50098        for (Reference e : element.getSupportingInformation()) 
50099          composeReference(null, e);
50100        closeArray();
50101      };
50102      if (element.hasPerformer()) {
50103        openArray("performer");
50104        for (DeviceDispense.DeviceDispensePerformerComponent e : element.getPerformer()) 
50105          composeDeviceDispensePerformerComponent(null, e);
50106        closeArray();
50107      };
50108      if (element.hasLocation()) {
50109        composeReference("location", element.getLocation());
50110      }
50111      if (element.hasType()) {
50112        composeCodeableConcept("type", element.getType());
50113      }
50114      if (element.hasQuantity()) {
50115        composeQuantity("quantity", element.getQuantity());
50116      }
50117      if (element.hasPreparedDateElement()) {
50118        composeDateTimeCore("preparedDate", element.getPreparedDateElement(), false);
50119        composeDateTimeExtras("preparedDate", element.getPreparedDateElement(), false);
50120      }
50121      if (element.hasWhenHandedOverElement()) {
50122        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
50123        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
50124      }
50125      if (element.hasDestination()) {
50126        composeReference("destination", element.getDestination());
50127      }
50128      if (element.hasNote()) {
50129        openArray("note");
50130        for (Annotation e : element.getNote()) 
50131          composeAnnotation(null, e);
50132        closeArray();
50133      };
50134      if (element.hasUsageInstructionElement()) {
50135        composeMarkdownCore("usageInstruction", element.getUsageInstructionElement(), false);
50136        composeMarkdownExtras("usageInstruction", element.getUsageInstructionElement(), false);
50137      }
50138      if (element.hasEventHistory()) {
50139        openArray("eventHistory");
50140        for (Reference e : element.getEventHistory()) 
50141          composeReference(null, e);
50142        closeArray();
50143      };
50144  }
50145
50146  protected void composeDeviceDispensePerformerComponent(String name, DeviceDispense.DeviceDispensePerformerComponent element) throws IOException {
50147    if (element != null) {
50148      open(name);
50149      composeDeviceDispensePerformerComponentProperties(element);
50150      close();
50151    }
50152  }
50153
50154  protected void composeDeviceDispensePerformerComponentProperties(DeviceDispense.DeviceDispensePerformerComponent element) throws IOException {
50155    composeBackboneElementProperties(element);
50156      if (element.hasFunction()) {
50157        composeCodeableConcept("function", element.getFunction());
50158      }
50159      if (element.hasActor()) {
50160        composeReference("actor", element.getActor());
50161      }
50162  }
50163
50164  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
50165    if (element != null) {
50166      prop("resourceType", name);
50167      composeDeviceMetricProperties(element);
50168    }
50169  }
50170
50171  protected void composeDeviceMetricProperties(DeviceMetric element) throws IOException {
50172    composeDomainResourceProperties(element);
50173      if (element.hasIdentifier()) {
50174        openArray("identifier");
50175        for (Identifier e : element.getIdentifier()) 
50176          composeIdentifier(null, e);
50177        closeArray();
50178      };
50179      if (element.hasType()) {
50180        composeCodeableConcept("type", element.getType());
50181      }
50182      if (element.hasUnit()) {
50183        composeCodeableConcept("unit", element.getUnit());
50184      }
50185      if (element.hasDevice()) {
50186        composeReference("device", element.getDevice());
50187      }
50188      if (element.hasOperationalStatusElement()) {
50189        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
50190        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
50191      }
50192      if (element.hasColorElement()) {
50193        composeCodeCore("color", element.getColorElement(), false);
50194        composeCodeExtras("color", element.getColorElement(), false);
50195      }
50196      if (element.hasCategoryElement()) {
50197        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
50198        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
50199      }
50200      if (element.hasMeasurementFrequency()) {
50201        composeQuantity("measurementFrequency", element.getMeasurementFrequency());
50202      }
50203      if (element.hasCalibration()) {
50204        openArray("calibration");
50205        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
50206          composeDeviceMetricCalibrationComponent(null, e);
50207        closeArray();
50208      };
50209  }
50210
50211  protected void composeDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
50212    if (element != null) {
50213      open(name);
50214      composeDeviceMetricCalibrationComponentProperties(element);
50215      close();
50216    }
50217  }
50218
50219  protected void composeDeviceMetricCalibrationComponentProperties(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
50220    composeBackboneElementProperties(element);
50221      if (element.hasTypeElement()) {
50222        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
50223        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
50224      }
50225      if (element.hasStateElement()) {
50226        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
50227        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
50228      }
50229      if (element.hasTimeElement()) {
50230        composeInstantCore("time", element.getTimeElement(), false);
50231        composeInstantExtras("time", element.getTimeElement(), false);
50232      }
50233  }
50234
50235  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
50236    if (element != null) {
50237      prop("resourceType", name);
50238      composeDeviceRequestProperties(element);
50239    }
50240  }
50241
50242  protected void composeDeviceRequestProperties(DeviceRequest element) throws IOException {
50243    composeDomainResourceProperties(element);
50244      if (element.hasIdentifier()) {
50245        openArray("identifier");
50246        for (Identifier e : element.getIdentifier()) 
50247          composeIdentifier(null, e);
50248        closeArray();
50249      };
50250      if (element.hasInstantiatesCanonical()) {
50251        if (anyHasValue(element.getInstantiatesCanonical())) {
50252          openArray("instantiatesCanonical");
50253          for (CanonicalType e : element.getInstantiatesCanonical()) 
50254            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
50255          closeArray();
50256        }
50257        if (anyHasExtras(element.getInstantiatesCanonical())) {
50258          openArray("_instantiatesCanonical");
50259          for (CanonicalType e : element.getInstantiatesCanonical()) 
50260            composeCanonicalExtras(null, e, true);
50261          closeArray();
50262        }
50263      };
50264      if (element.hasInstantiatesUri()) {
50265        if (anyHasValue(element.getInstantiatesUri())) {
50266          openArray("instantiatesUri");
50267          for (UriType e : element.getInstantiatesUri()) 
50268            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
50269          closeArray();
50270        }
50271        if (anyHasExtras(element.getInstantiatesUri())) {
50272          openArray("_instantiatesUri");
50273          for (UriType e : element.getInstantiatesUri()) 
50274            composeUriExtras(null, e, true);
50275          closeArray();
50276        }
50277      };
50278      if (element.hasBasedOn()) {
50279        openArray("basedOn");
50280        for (Reference e : element.getBasedOn()) 
50281          composeReference(null, e);
50282        closeArray();
50283      };
50284      if (element.hasReplaces()) {
50285        openArray("replaces");
50286        for (Reference e : element.getReplaces()) 
50287          composeReference(null, e);
50288        closeArray();
50289      };
50290      if (element.hasGroupIdentifier()) {
50291        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
50292      }
50293      if (element.hasStatusElement()) {
50294        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
50295        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
50296      }
50297      if (element.hasIntentElement()) {
50298        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
50299        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
50300      }
50301      if (element.hasPriorityElement()) {
50302        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
50303        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
50304      }
50305      if (element.hasDoNotPerformElement()) {
50306        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
50307        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
50308      }
50309      if (element.hasCode()) {
50310        composeCodeableReference("code", element.getCode());
50311      }
50312      if (element.hasQuantityElement()) {
50313        composeIntegerCore("quantity", element.getQuantityElement(), false);
50314        composeIntegerExtras("quantity", element.getQuantityElement(), false);
50315      }
50316      if (element.hasParameter()) {
50317        openArray("parameter");
50318        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
50319          composeDeviceRequestParameterComponent(null, e);
50320        closeArray();
50321      };
50322      if (element.hasSubject()) {
50323        composeReference("subject", element.getSubject());
50324      }
50325      if (element.hasEncounter()) {
50326        composeReference("encounter", element.getEncounter());
50327      }
50328      if (element.hasOccurrence()) {
50329        composeType("occurrence", element.getOccurrence());
50330      }
50331      if (element.hasAuthoredOnElement()) {
50332        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
50333        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
50334      }
50335      if (element.hasRequester()) {
50336        composeReference("requester", element.getRequester());
50337      }
50338      if (element.hasPerformer()) {
50339        composeCodeableReference("performer", element.getPerformer());
50340      }
50341      if (element.hasReason()) {
50342        openArray("reason");
50343        for (CodeableReference e : element.getReason()) 
50344          composeCodeableReference(null, e);
50345        closeArray();
50346      };
50347      if (element.hasAsNeededElement()) {
50348        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
50349        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
50350      }
50351      if (element.hasAsNeededFor()) {
50352        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
50353      }
50354      if (element.hasInsurance()) {
50355        openArray("insurance");
50356        for (Reference e : element.getInsurance()) 
50357          composeReference(null, e);
50358        closeArray();
50359      };
50360      if (element.hasSupportingInfo()) {
50361        openArray("supportingInfo");
50362        for (Reference e : element.getSupportingInfo()) 
50363          composeReference(null, e);
50364        closeArray();
50365      };
50366      if (element.hasNote()) {
50367        openArray("note");
50368        for (Annotation e : element.getNote()) 
50369          composeAnnotation(null, e);
50370        closeArray();
50371      };
50372      if (element.hasRelevantHistory()) {
50373        openArray("relevantHistory");
50374        for (Reference e : element.getRelevantHistory()) 
50375          composeReference(null, e);
50376        closeArray();
50377      };
50378  }
50379
50380  protected void composeDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
50381    if (element != null) {
50382      open(name);
50383      composeDeviceRequestParameterComponentProperties(element);
50384      close();
50385    }
50386  }
50387
50388  protected void composeDeviceRequestParameterComponentProperties(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
50389    composeBackboneElementProperties(element);
50390      if (element.hasCode()) {
50391        composeCodeableConcept("code", element.getCode());
50392      }
50393      if (element.hasValue()) {
50394        composeType("value", element.getValue());
50395      }
50396  }
50397
50398  protected void composeDeviceUsage(String name, DeviceUsage element) throws IOException {
50399    if (element != null) {
50400      prop("resourceType", name);
50401      composeDeviceUsageProperties(element);
50402    }
50403  }
50404
50405  protected void composeDeviceUsageProperties(DeviceUsage element) throws IOException {
50406    composeDomainResourceProperties(element);
50407      if (element.hasIdentifier()) {
50408        openArray("identifier");
50409        for (Identifier e : element.getIdentifier()) 
50410          composeIdentifier(null, e);
50411        closeArray();
50412      };
50413      if (element.hasBasedOn()) {
50414        openArray("basedOn");
50415        for (Reference e : element.getBasedOn()) 
50416          composeReference(null, e);
50417        closeArray();
50418      };
50419      if (element.hasStatusElement()) {
50420        composeEnumerationCore("status", element.getStatusElement(), new DeviceUsage.DeviceUsageStatusEnumFactory(), false);
50421        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUsage.DeviceUsageStatusEnumFactory(), false);
50422      }
50423      if (element.hasCategory()) {
50424        openArray("category");
50425        for (CodeableConcept e : element.getCategory()) 
50426          composeCodeableConcept(null, e);
50427        closeArray();
50428      };
50429      if (element.hasPatient()) {
50430        composeReference("patient", element.getPatient());
50431      }
50432      if (element.hasDerivedFrom()) {
50433        openArray("derivedFrom");
50434        for (Reference e : element.getDerivedFrom()) 
50435          composeReference(null, e);
50436        closeArray();
50437      };
50438      if (element.hasContext()) {
50439        composeReference("context", element.getContext());
50440      }
50441      if (element.hasTiming()) {
50442        composeType("timing", element.getTiming());
50443      }
50444      if (element.hasDateAssertedElement()) {
50445        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
50446        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
50447      }
50448      if (element.hasUsageStatus()) {
50449        composeCodeableConcept("usageStatus", element.getUsageStatus());
50450      }
50451      if (element.hasUsageReason()) {
50452        openArray("usageReason");
50453        for (CodeableConcept e : element.getUsageReason()) 
50454          composeCodeableConcept(null, e);
50455        closeArray();
50456      };
50457      if (element.hasAdherence()) {
50458        composeDeviceUsageAdherenceComponent("adherence", element.getAdherence());
50459      }
50460      if (element.hasInformationSource()) {
50461        composeReference("informationSource", element.getInformationSource());
50462      }
50463      if (element.hasDevice()) {
50464        composeCodeableReference("device", element.getDevice());
50465      }
50466      if (element.hasReason()) {
50467        openArray("reason");
50468        for (CodeableReference e : element.getReason()) 
50469          composeCodeableReference(null, e);
50470        closeArray();
50471      };
50472      if (element.hasBodySite()) {
50473        composeCodeableReference("bodySite", element.getBodySite());
50474      }
50475      if (element.hasNote()) {
50476        openArray("note");
50477        for (Annotation e : element.getNote()) 
50478          composeAnnotation(null, e);
50479        closeArray();
50480      };
50481  }
50482
50483  protected void composeDeviceUsageAdherenceComponent(String name, DeviceUsage.DeviceUsageAdherenceComponent element) throws IOException {
50484    if (element != null) {
50485      open(name);
50486      composeDeviceUsageAdherenceComponentProperties(element);
50487      close();
50488    }
50489  }
50490
50491  protected void composeDeviceUsageAdherenceComponentProperties(DeviceUsage.DeviceUsageAdherenceComponent element) throws IOException {
50492    composeBackboneElementProperties(element);
50493      if (element.hasCode()) {
50494        composeCodeableConcept("code", element.getCode());
50495      }
50496      if (element.hasReason()) {
50497        openArray("reason");
50498        for (CodeableConcept e : element.getReason()) 
50499          composeCodeableConcept(null, e);
50500        closeArray();
50501      };
50502  }
50503
50504  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
50505    if (element != null) {
50506      prop("resourceType", name);
50507      composeDiagnosticReportProperties(element);
50508    }
50509  }
50510
50511  protected void composeDiagnosticReportProperties(DiagnosticReport element) throws IOException {
50512    composeDomainResourceProperties(element);
50513      if (element.hasIdentifier()) {
50514        openArray("identifier");
50515        for (Identifier e : element.getIdentifier()) 
50516          composeIdentifier(null, e);
50517        closeArray();
50518      };
50519      if (element.hasBasedOn()) {
50520        openArray("basedOn");
50521        for (Reference e : element.getBasedOn()) 
50522          composeReference(null, e);
50523        closeArray();
50524      };
50525      if (element.hasStatusElement()) {
50526        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
50527        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
50528      }
50529      if (element.hasCategory()) {
50530        openArray("category");
50531        for (CodeableConcept e : element.getCategory()) 
50532          composeCodeableConcept(null, e);
50533        closeArray();
50534      };
50535      if (element.hasCode()) {
50536        composeCodeableConcept("code", element.getCode());
50537      }
50538      if (element.hasSubject()) {
50539        composeReference("subject", element.getSubject());
50540      }
50541      if (element.hasEncounter()) {
50542        composeReference("encounter", element.getEncounter());
50543      }
50544      if (element.hasEffective()) {
50545        composeType("effective", element.getEffective());
50546      }
50547      if (element.hasIssuedElement()) {
50548        composeInstantCore("issued", element.getIssuedElement(), false);
50549        composeInstantExtras("issued", element.getIssuedElement(), false);
50550      }
50551      if (element.hasPerformer()) {
50552        openArray("performer");
50553        for (Reference e : element.getPerformer()) 
50554          composeReference(null, e);
50555        closeArray();
50556      };
50557      if (element.hasResultsInterpreter()) {
50558        openArray("resultsInterpreter");
50559        for (Reference e : element.getResultsInterpreter()) 
50560          composeReference(null, e);
50561        closeArray();
50562      };
50563      if (element.hasSpecimen()) {
50564        openArray("specimen");
50565        for (Reference e : element.getSpecimen()) 
50566          composeReference(null, e);
50567        closeArray();
50568      };
50569      if (element.hasResult()) {
50570        openArray("result");
50571        for (Reference e : element.getResult()) 
50572          composeReference(null, e);
50573        closeArray();
50574      };
50575      if (element.hasNote()) {
50576        openArray("note");
50577        for (Annotation e : element.getNote()) 
50578          composeAnnotation(null, e);
50579        closeArray();
50580      };
50581      if (element.hasStudy()) {
50582        openArray("study");
50583        for (Reference e : element.getStudy()) 
50584          composeReference(null, e);
50585        closeArray();
50586      };
50587      if (element.hasSupportingInfo()) {
50588        openArray("supportingInfo");
50589        for (DiagnosticReport.DiagnosticReportSupportingInfoComponent e : element.getSupportingInfo()) 
50590          composeDiagnosticReportSupportingInfoComponent(null, e);
50591        closeArray();
50592      };
50593      if (element.hasMedia()) {
50594        openArray("media");
50595        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
50596          composeDiagnosticReportMediaComponent(null, e);
50597        closeArray();
50598      };
50599      if (element.hasComposition()) {
50600        composeReference("composition", element.getComposition());
50601      }
50602      if (element.hasConclusionElement()) {
50603        composeMarkdownCore("conclusion", element.getConclusionElement(), false);
50604        composeMarkdownExtras("conclusion", element.getConclusionElement(), false);
50605      }
50606      if (element.hasConclusionCode()) {
50607        openArray("conclusionCode");
50608        for (CodeableConcept e : element.getConclusionCode()) 
50609          composeCodeableConcept(null, e);
50610        closeArray();
50611      };
50612      if (element.hasPresentedForm()) {
50613        openArray("presentedForm");
50614        for (Attachment e : element.getPresentedForm()) 
50615          composeAttachment(null, e);
50616        closeArray();
50617      };
50618  }
50619
50620  protected void composeDiagnosticReportSupportingInfoComponent(String name, DiagnosticReport.DiagnosticReportSupportingInfoComponent element) throws IOException {
50621    if (element != null) {
50622      open(name);
50623      composeDiagnosticReportSupportingInfoComponentProperties(element);
50624      close();
50625    }
50626  }
50627
50628  protected void composeDiagnosticReportSupportingInfoComponentProperties(DiagnosticReport.DiagnosticReportSupportingInfoComponent element) throws IOException {
50629    composeBackboneElementProperties(element);
50630      if (element.hasType()) {
50631        composeCodeableConcept("type", element.getType());
50632      }
50633      if (element.hasReference()) {
50634        composeReference("reference", element.getReference());
50635      }
50636  }
50637
50638  protected void composeDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
50639    if (element != null) {
50640      open(name);
50641      composeDiagnosticReportMediaComponentProperties(element);
50642      close();
50643    }
50644  }
50645
50646  protected void composeDiagnosticReportMediaComponentProperties(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
50647    composeBackboneElementProperties(element);
50648      if (element.hasCommentElement()) {
50649        composeStringCore("comment", element.getCommentElement(), false);
50650        composeStringExtras("comment", element.getCommentElement(), false);
50651      }
50652      if (element.hasLink()) {
50653        composeReference("link", element.getLink());
50654      }
50655  }
50656
50657  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
50658    if (element != null) {
50659      prop("resourceType", name);
50660      composeDocumentReferenceProperties(element);
50661    }
50662  }
50663
50664  protected void composeDocumentReferenceProperties(DocumentReference element) throws IOException {
50665    composeDomainResourceProperties(element);
50666      if (element.hasIdentifier()) {
50667        openArray("identifier");
50668        for (Identifier e : element.getIdentifier()) 
50669          composeIdentifier(null, e);
50670        closeArray();
50671      };
50672      if (element.hasVersionElement()) {
50673        composeStringCore("version", element.getVersionElement(), false);
50674        composeStringExtras("version", element.getVersionElement(), false);
50675      }
50676      if (element.hasBasedOn()) {
50677        openArray("basedOn");
50678        for (Reference e : element.getBasedOn()) 
50679          composeReference(null, e);
50680        closeArray();
50681      };
50682      if (element.hasStatusElement()) {
50683        composeEnumerationCore("status", element.getStatusElement(), new DocumentReference.DocumentReferenceStatusEnumFactory(), false);
50684        composeEnumerationExtras("status", element.getStatusElement(), new DocumentReference.DocumentReferenceStatusEnumFactory(), false);
50685      }
50686      if (element.hasDocStatusElement()) {
50687        composeEnumerationCore("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
50688        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
50689      }
50690      if (element.hasModality()) {
50691        openArray("modality");
50692        for (CodeableConcept e : element.getModality()) 
50693          composeCodeableConcept(null, e);
50694        closeArray();
50695      };
50696      if (element.hasType()) {
50697        composeCodeableConcept("type", element.getType());
50698      }
50699      if (element.hasCategory()) {
50700        openArray("category");
50701        for (CodeableConcept e : element.getCategory()) 
50702          composeCodeableConcept(null, e);
50703        closeArray();
50704      };
50705      if (element.hasSubject()) {
50706        composeReference("subject", element.getSubject());
50707      }
50708      if (element.hasContext()) {
50709        openArray("context");
50710        for (Reference e : element.getContext()) 
50711          composeReference(null, e);
50712        closeArray();
50713      };
50714      if (element.hasEvent()) {
50715        openArray("event");
50716        for (CodeableReference e : element.getEvent()) 
50717          composeCodeableReference(null, e);
50718        closeArray();
50719      };
50720      if (element.hasBodySite()) {
50721        openArray("bodySite");
50722        for (CodeableReference e : element.getBodySite()) 
50723          composeCodeableReference(null, e);
50724        closeArray();
50725      };
50726      if (element.hasFacilityType()) {
50727        composeCodeableConcept("facilityType", element.getFacilityType());
50728      }
50729      if (element.hasPracticeSetting()) {
50730        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
50731      }
50732      if (element.hasPeriod()) {
50733        composePeriod("period", element.getPeriod());
50734      }
50735      if (element.hasDateElement()) {
50736        composeInstantCore("date", element.getDateElement(), false);
50737        composeInstantExtras("date", element.getDateElement(), false);
50738      }
50739      if (element.hasAuthor()) {
50740        openArray("author");
50741        for (Reference e : element.getAuthor()) 
50742          composeReference(null, e);
50743        closeArray();
50744      };
50745      if (element.hasAttester()) {
50746        openArray("attester");
50747        for (DocumentReference.DocumentReferenceAttesterComponent e : element.getAttester()) 
50748          composeDocumentReferenceAttesterComponent(null, e);
50749        closeArray();
50750      };
50751      if (element.hasCustodian()) {
50752        composeReference("custodian", element.getCustodian());
50753      }
50754      if (element.hasRelatesTo()) {
50755        openArray("relatesTo");
50756        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
50757          composeDocumentReferenceRelatesToComponent(null, e);
50758        closeArray();
50759      };
50760      if (element.hasDescriptionElement()) {
50761        composeMarkdownCore("description", element.getDescriptionElement(), false);
50762        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50763      }
50764      if (element.hasSecurityLabel()) {
50765        openArray("securityLabel");
50766        for (CodeableConcept e : element.getSecurityLabel()) 
50767          composeCodeableConcept(null, e);
50768        closeArray();
50769      };
50770      if (element.hasContent()) {
50771        openArray("content");
50772        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
50773          composeDocumentReferenceContentComponent(null, e);
50774        closeArray();
50775      };
50776  }
50777
50778  protected void composeDocumentReferenceAttesterComponent(String name, DocumentReference.DocumentReferenceAttesterComponent element) throws IOException {
50779    if (element != null) {
50780      open(name);
50781      composeDocumentReferenceAttesterComponentProperties(element);
50782      close();
50783    }
50784  }
50785
50786  protected void composeDocumentReferenceAttesterComponentProperties(DocumentReference.DocumentReferenceAttesterComponent element) throws IOException {
50787    composeBackboneElementProperties(element);
50788      if (element.hasMode()) {
50789        composeCodeableConcept("mode", element.getMode());
50790      }
50791      if (element.hasTimeElement()) {
50792        composeDateTimeCore("time", element.getTimeElement(), false);
50793        composeDateTimeExtras("time", element.getTimeElement(), false);
50794      }
50795      if (element.hasParty()) {
50796        composeReference("party", element.getParty());
50797      }
50798  }
50799
50800  protected void composeDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
50801    if (element != null) {
50802      open(name);
50803      composeDocumentReferenceRelatesToComponentProperties(element);
50804      close();
50805    }
50806  }
50807
50808  protected void composeDocumentReferenceRelatesToComponentProperties(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
50809    composeBackboneElementProperties(element);
50810      if (element.hasCode()) {
50811        composeCodeableConcept("code", element.getCode());
50812      }
50813      if (element.hasTarget()) {
50814        composeReference("target", element.getTarget());
50815      }
50816  }
50817
50818  protected void composeDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
50819    if (element != null) {
50820      open(name);
50821      composeDocumentReferenceContentComponentProperties(element);
50822      close();
50823    }
50824  }
50825
50826  protected void composeDocumentReferenceContentComponentProperties(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
50827    composeBackboneElementProperties(element);
50828      if (element.hasAttachment()) {
50829        composeAttachment("attachment", element.getAttachment());
50830      }
50831      if (element.hasProfile()) {
50832        openArray("profile");
50833        for (DocumentReference.DocumentReferenceContentProfileComponent e : element.getProfile()) 
50834          composeDocumentReferenceContentProfileComponent(null, e);
50835        closeArray();
50836      };
50837  }
50838
50839  protected void composeDocumentReferenceContentProfileComponent(String name, DocumentReference.DocumentReferenceContentProfileComponent element) throws IOException {
50840    if (element != null) {
50841      open(name);
50842      composeDocumentReferenceContentProfileComponentProperties(element);
50843      close();
50844    }
50845  }
50846
50847  protected void composeDocumentReferenceContentProfileComponentProperties(DocumentReference.DocumentReferenceContentProfileComponent element) throws IOException {
50848    composeBackboneElementProperties(element);
50849      if (element.hasValue()) {
50850        composeType("value", element.getValue());
50851      }
50852  }
50853
50854  protected void composeEncounter(String name, Encounter element) throws IOException {
50855    if (element != null) {
50856      prop("resourceType", name);
50857      composeEncounterProperties(element);
50858    }
50859  }
50860
50861  protected void composeEncounterProperties(Encounter element) throws IOException {
50862    composeDomainResourceProperties(element);
50863      if (element.hasIdentifier()) {
50864        openArray("identifier");
50865        for (Identifier e : element.getIdentifier()) 
50866          composeIdentifier(null, e);
50867        closeArray();
50868      };
50869      if (element.hasStatusElement()) {
50870        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
50871        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
50872      }
50873      if (element.hasClass_()) {
50874        openArray("class");
50875        for (CodeableConcept e : element.getClass_()) 
50876          composeCodeableConcept(null, e);
50877        closeArray();
50878      };
50879      if (element.hasPriority()) {
50880        composeCodeableConcept("priority", element.getPriority());
50881      }
50882      if (element.hasType()) {
50883        openArray("type");
50884        for (CodeableConcept e : element.getType()) 
50885          composeCodeableConcept(null, e);
50886        closeArray();
50887      };
50888      if (element.hasServiceType()) {
50889        openArray("serviceType");
50890        for (CodeableReference e : element.getServiceType()) 
50891          composeCodeableReference(null, e);
50892        closeArray();
50893      };
50894      if (element.hasSubject()) {
50895        composeReference("subject", element.getSubject());
50896      }
50897      if (element.hasSubjectStatus()) {
50898        composeCodeableConcept("subjectStatus", element.getSubjectStatus());
50899      }
50900      if (element.hasEpisodeOfCare()) {
50901        openArray("episodeOfCare");
50902        for (Reference e : element.getEpisodeOfCare()) 
50903          composeReference(null, e);
50904        closeArray();
50905      };
50906      if (element.hasBasedOn()) {
50907        openArray("basedOn");
50908        for (Reference e : element.getBasedOn()) 
50909          composeReference(null, e);
50910        closeArray();
50911      };
50912      if (element.hasCareTeam()) {
50913        openArray("careTeam");
50914        for (Reference e : element.getCareTeam()) 
50915          composeReference(null, e);
50916        closeArray();
50917      };
50918      if (element.hasPartOf()) {
50919        composeReference("partOf", element.getPartOf());
50920      }
50921      if (element.hasServiceProvider()) {
50922        composeReference("serviceProvider", element.getServiceProvider());
50923      }
50924      if (element.hasParticipant()) {
50925        openArray("participant");
50926        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
50927          composeEncounterParticipantComponent(null, e);
50928        closeArray();
50929      };
50930      if (element.hasAppointment()) {
50931        openArray("appointment");
50932        for (Reference e : element.getAppointment()) 
50933          composeReference(null, e);
50934        closeArray();
50935      };
50936      if (element.hasVirtualService()) {
50937        openArray("virtualService");
50938        for (VirtualServiceDetail e : element.getVirtualService()) 
50939          composeVirtualServiceDetail(null, e);
50940        closeArray();
50941      };
50942      if (element.hasActualPeriod()) {
50943        composePeriod("actualPeriod", element.getActualPeriod());
50944      }
50945      if (element.hasPlannedStartDateElement()) {
50946        composeDateTimeCore("plannedStartDate", element.getPlannedStartDateElement(), false);
50947        composeDateTimeExtras("plannedStartDate", element.getPlannedStartDateElement(), false);
50948      }
50949      if (element.hasPlannedEndDateElement()) {
50950        composeDateTimeCore("plannedEndDate", element.getPlannedEndDateElement(), false);
50951        composeDateTimeExtras("plannedEndDate", element.getPlannedEndDateElement(), false);
50952      }
50953      if (element.hasLength()) {
50954        composeDuration("length", element.getLength());
50955      }
50956      if (element.hasReason()) {
50957        openArray("reason");
50958        for (Encounter.ReasonComponent e : element.getReason()) 
50959          composeReasonComponent(null, e);
50960        closeArray();
50961      };
50962      if (element.hasDiagnosis()) {
50963        openArray("diagnosis");
50964        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
50965          composeDiagnosisComponent(null, e);
50966        closeArray();
50967      };
50968      if (element.hasAccount()) {
50969        openArray("account");
50970        for (Reference e : element.getAccount()) 
50971          composeReference(null, e);
50972        closeArray();
50973      };
50974      if (element.hasDietPreference()) {
50975        openArray("dietPreference");
50976        for (CodeableConcept e : element.getDietPreference()) 
50977          composeCodeableConcept(null, e);
50978        closeArray();
50979      };
50980      if (element.hasSpecialArrangement()) {
50981        openArray("specialArrangement");
50982        for (CodeableConcept e : element.getSpecialArrangement()) 
50983          composeCodeableConcept(null, e);
50984        closeArray();
50985      };
50986      if (element.hasSpecialCourtesy()) {
50987        openArray("specialCourtesy");
50988        for (CodeableConcept e : element.getSpecialCourtesy()) 
50989          composeCodeableConcept(null, e);
50990        closeArray();
50991      };
50992      if (element.hasAdmission()) {
50993        composeEncounterAdmissionComponent("admission", element.getAdmission());
50994      }
50995      if (element.hasLocation()) {
50996        openArray("location");
50997        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
50998          composeEncounterLocationComponent(null, e);
50999        closeArray();
51000      };
51001  }
51002
51003  protected void composeEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
51004    if (element != null) {
51005      open(name);
51006      composeEncounterParticipantComponentProperties(element);
51007      close();
51008    }
51009  }
51010
51011  protected void composeEncounterParticipantComponentProperties(Encounter.EncounterParticipantComponent element) throws IOException {
51012    composeBackboneElementProperties(element);
51013      if (element.hasType()) {
51014        openArray("type");
51015        for (CodeableConcept e : element.getType()) 
51016          composeCodeableConcept(null, e);
51017        closeArray();
51018      };
51019      if (element.hasPeriod()) {
51020        composePeriod("period", element.getPeriod());
51021      }
51022      if (element.hasActor()) {
51023        composeReference("actor", element.getActor());
51024      }
51025  }
51026
51027  protected void composeReasonComponent(String name, Encounter.ReasonComponent element) throws IOException {
51028    if (element != null) {
51029      open(name);
51030      composeReasonComponentProperties(element);
51031      close();
51032    }
51033  }
51034
51035  protected void composeReasonComponentProperties(Encounter.ReasonComponent element) throws IOException {
51036    composeBackboneElementProperties(element);
51037      if (element.hasUse()) {
51038        openArray("use");
51039        for (CodeableConcept e : element.getUse()) 
51040          composeCodeableConcept(null, e);
51041        closeArray();
51042      };
51043      if (element.hasValue()) {
51044        openArray("value");
51045        for (CodeableReference e : element.getValue()) 
51046          composeCodeableReference(null, e);
51047        closeArray();
51048      };
51049  }
51050
51051  protected void composeDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
51052    if (element != null) {
51053      open(name);
51054      composeDiagnosisComponentProperties(element);
51055      close();
51056    }
51057  }
51058
51059  protected void composeDiagnosisComponentProperties(Encounter.DiagnosisComponent element) throws IOException {
51060    composeBackboneElementProperties(element);
51061      if (element.hasCondition()) {
51062        openArray("condition");
51063        for (CodeableReference e : element.getCondition()) 
51064          composeCodeableReference(null, e);
51065        closeArray();
51066      };
51067      if (element.hasUse()) {
51068        openArray("use");
51069        for (CodeableConcept e : element.getUse()) 
51070          composeCodeableConcept(null, e);
51071        closeArray();
51072      };
51073  }
51074
51075  protected void composeEncounterAdmissionComponent(String name, Encounter.EncounterAdmissionComponent element) throws IOException {
51076    if (element != null) {
51077      open(name);
51078      composeEncounterAdmissionComponentProperties(element);
51079      close();
51080    }
51081  }
51082
51083  protected void composeEncounterAdmissionComponentProperties(Encounter.EncounterAdmissionComponent element) throws IOException {
51084    composeBackboneElementProperties(element);
51085      if (element.hasPreAdmissionIdentifier()) {
51086        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
51087      }
51088      if (element.hasOrigin()) {
51089        composeReference("origin", element.getOrigin());
51090      }
51091      if (element.hasAdmitSource()) {
51092        composeCodeableConcept("admitSource", element.getAdmitSource());
51093      }
51094      if (element.hasReAdmission()) {
51095        composeCodeableConcept("reAdmission", element.getReAdmission());
51096      }
51097      if (element.hasDestination()) {
51098        composeReference("destination", element.getDestination());
51099      }
51100      if (element.hasDischargeDisposition()) {
51101        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
51102      }
51103  }
51104
51105  protected void composeEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
51106    if (element != null) {
51107      open(name);
51108      composeEncounterLocationComponentProperties(element);
51109      close();
51110    }
51111  }
51112
51113  protected void composeEncounterLocationComponentProperties(Encounter.EncounterLocationComponent element) throws IOException {
51114    composeBackboneElementProperties(element);
51115      if (element.hasLocation()) {
51116        composeReference("location", element.getLocation());
51117      }
51118      if (element.hasStatusElement()) {
51119        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
51120        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
51121      }
51122      if (element.hasForm()) {
51123        composeCodeableConcept("form", element.getForm());
51124      }
51125      if (element.hasPeriod()) {
51126        composePeriod("period", element.getPeriod());
51127      }
51128  }
51129
51130  protected void composeEncounterHistory(String name, EncounterHistory element) throws IOException {
51131    if (element != null) {
51132      prop("resourceType", name);
51133      composeEncounterHistoryProperties(element);
51134    }
51135  }
51136
51137  protected void composeEncounterHistoryProperties(EncounterHistory element) throws IOException {
51138    composeDomainResourceProperties(element);
51139      if (element.hasEncounter()) {
51140        composeReference("encounter", element.getEncounter());
51141      }
51142      if (element.hasIdentifier()) {
51143        openArray("identifier");
51144        for (Identifier e : element.getIdentifier()) 
51145          composeIdentifier(null, e);
51146        closeArray();
51147      };
51148      if (element.hasStatusElement()) {
51149        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
51150        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EncounterStatusEnumFactory(), false);
51151      }
51152      if (element.hasClass_()) {
51153        composeCodeableConcept("class", element.getClass_());
51154      }
51155      if (element.hasType()) {
51156        openArray("type");
51157        for (CodeableConcept e : element.getType()) 
51158          composeCodeableConcept(null, e);
51159        closeArray();
51160      };
51161      if (element.hasServiceType()) {
51162        openArray("serviceType");
51163        for (CodeableReference e : element.getServiceType()) 
51164          composeCodeableReference(null, e);
51165        closeArray();
51166      };
51167      if (element.hasSubject()) {
51168        composeReference("subject", element.getSubject());
51169      }
51170      if (element.hasSubjectStatus()) {
51171        composeCodeableConcept("subjectStatus", element.getSubjectStatus());
51172      }
51173      if (element.hasActualPeriod()) {
51174        composePeriod("actualPeriod", element.getActualPeriod());
51175      }
51176      if (element.hasPlannedStartDateElement()) {
51177        composeDateTimeCore("plannedStartDate", element.getPlannedStartDateElement(), false);
51178        composeDateTimeExtras("plannedStartDate", element.getPlannedStartDateElement(), false);
51179      }
51180      if (element.hasPlannedEndDateElement()) {
51181        composeDateTimeCore("plannedEndDate", element.getPlannedEndDateElement(), false);
51182        composeDateTimeExtras("plannedEndDate", element.getPlannedEndDateElement(), false);
51183      }
51184      if (element.hasLength()) {
51185        composeDuration("length", element.getLength());
51186      }
51187      if (element.hasLocation()) {
51188        openArray("location");
51189        for (EncounterHistory.EncounterHistoryLocationComponent e : element.getLocation()) 
51190          composeEncounterHistoryLocationComponent(null, e);
51191        closeArray();
51192      };
51193  }
51194
51195  protected void composeEncounterHistoryLocationComponent(String name, EncounterHistory.EncounterHistoryLocationComponent element) throws IOException {
51196    if (element != null) {
51197      open(name);
51198      composeEncounterHistoryLocationComponentProperties(element);
51199      close();
51200    }
51201  }
51202
51203  protected void composeEncounterHistoryLocationComponentProperties(EncounterHistory.EncounterHistoryLocationComponent element) throws IOException {
51204    composeBackboneElementProperties(element);
51205      if (element.hasLocation()) {
51206        composeReference("location", element.getLocation());
51207      }
51208      if (element.hasForm()) {
51209        composeCodeableConcept("form", element.getForm());
51210      }
51211  }
51212
51213  protected void composeEndpoint(String name, Endpoint element) throws IOException {
51214    if (element != null) {
51215      prop("resourceType", name);
51216      composeEndpointProperties(element);
51217    }
51218  }
51219
51220  protected void composeEndpointProperties(Endpoint element) throws IOException {
51221    composeDomainResourceProperties(element);
51222      if (element.hasIdentifier()) {
51223        openArray("identifier");
51224        for (Identifier e : element.getIdentifier()) 
51225          composeIdentifier(null, e);
51226        closeArray();
51227      };
51228      if (element.hasStatusElement()) {
51229        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
51230        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
51231      }
51232      if (element.hasConnectionType()) {
51233        openArray("connectionType");
51234        for (CodeableConcept e : element.getConnectionType()) 
51235          composeCodeableConcept(null, e);
51236        closeArray();
51237      };
51238      if (element.hasNameElement()) {
51239        composeStringCore("name", element.getNameElement(), false);
51240        composeStringExtras("name", element.getNameElement(), false);
51241      }
51242      if (element.hasDescriptionElement()) {
51243        composeStringCore("description", element.getDescriptionElement(), false);
51244        composeStringExtras("description", element.getDescriptionElement(), false);
51245      }
51246      if (element.hasEnvironmentType()) {
51247        openArray("environmentType");
51248        for (CodeableConcept e : element.getEnvironmentType()) 
51249          composeCodeableConcept(null, e);
51250        closeArray();
51251      };
51252      if (element.hasManagingOrganization()) {
51253        composeReference("managingOrganization", element.getManagingOrganization());
51254      }
51255      if (element.hasContact()) {
51256        openArray("contact");
51257        for (ContactPoint e : element.getContact()) 
51258          composeContactPoint(null, e);
51259        closeArray();
51260      };
51261      if (element.hasPeriod()) {
51262        composePeriod("period", element.getPeriod());
51263      }
51264      if (element.hasPayload()) {
51265        openArray("payload");
51266        for (Endpoint.EndpointPayloadComponent e : element.getPayload()) 
51267          composeEndpointPayloadComponent(null, e);
51268        closeArray();
51269      };
51270      if (element.hasAddressElement()) {
51271        composeUrlCore("address", element.getAddressElement(), false);
51272        composeUrlExtras("address", element.getAddressElement(), false);
51273      }
51274      if (element.hasHeader()) {
51275        if (anyHasValue(element.getHeader())) {
51276          openArray("header");
51277          for (StringType e : element.getHeader()) 
51278            composeStringCore(null, e, e != element.getHeader().get(element.getHeader().size()-1));
51279          closeArray();
51280        }
51281        if (anyHasExtras(element.getHeader())) {
51282          openArray("_header");
51283          for (StringType e : element.getHeader()) 
51284            composeStringExtras(null, e, true);
51285          closeArray();
51286        }
51287      };
51288  }
51289
51290  protected void composeEndpointPayloadComponent(String name, Endpoint.EndpointPayloadComponent element) throws IOException {
51291    if (element != null) {
51292      open(name);
51293      composeEndpointPayloadComponentProperties(element);
51294      close();
51295    }
51296  }
51297
51298  protected void composeEndpointPayloadComponentProperties(Endpoint.EndpointPayloadComponent element) throws IOException {
51299    composeBackboneElementProperties(element);
51300      if (element.hasType()) {
51301        openArray("type");
51302        for (CodeableConcept e : element.getType()) 
51303          composeCodeableConcept(null, e);
51304        closeArray();
51305      };
51306      if (element.hasMimeType()) {
51307        if (anyHasValue(element.getMimeType())) {
51308          openArray("mimeType");
51309          for (CodeType e : element.getMimeType()) 
51310            composeCodeCore(null, e, e != element.getMimeType().get(element.getMimeType().size()-1));
51311          closeArray();
51312        }
51313        if (anyHasExtras(element.getMimeType())) {
51314          openArray("_mimeType");
51315          for (CodeType e : element.getMimeType()) 
51316            composeCodeExtras(null, e, true);
51317          closeArray();
51318        }
51319      };
51320  }
51321
51322  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
51323    if (element != null) {
51324      prop("resourceType", name);
51325      composeEnrollmentRequestProperties(element);
51326    }
51327  }
51328
51329  protected void composeEnrollmentRequestProperties(EnrollmentRequest element) throws IOException {
51330    composeDomainResourceProperties(element);
51331      if (element.hasIdentifier()) {
51332        openArray("identifier");
51333        for (Identifier e : element.getIdentifier()) 
51334          composeIdentifier(null, e);
51335        closeArray();
51336      };
51337      if (element.hasStatusElement()) {
51338        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51339        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51340      }
51341      if (element.hasCreatedElement()) {
51342        composeDateTimeCore("created", element.getCreatedElement(), false);
51343        composeDateTimeExtras("created", element.getCreatedElement(), false);
51344      }
51345      if (element.hasInsurer()) {
51346        composeReference("insurer", element.getInsurer());
51347      }
51348      if (element.hasProvider()) {
51349        composeReference("provider", element.getProvider());
51350      }
51351      if (element.hasCandidate()) {
51352        composeReference("candidate", element.getCandidate());
51353      }
51354      if (element.hasCoverage()) {
51355        composeReference("coverage", element.getCoverage());
51356      }
51357  }
51358
51359  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
51360    if (element != null) {
51361      prop("resourceType", name);
51362      composeEnrollmentResponseProperties(element);
51363    }
51364  }
51365
51366  protected void composeEnrollmentResponseProperties(EnrollmentResponse element) throws IOException {
51367    composeDomainResourceProperties(element);
51368      if (element.hasIdentifier()) {
51369        openArray("identifier");
51370        for (Identifier e : element.getIdentifier()) 
51371          composeIdentifier(null, e);
51372        closeArray();
51373      };
51374      if (element.hasStatusElement()) {
51375        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51376        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
51377      }
51378      if (element.hasRequest()) {
51379        composeReference("request", element.getRequest());
51380      }
51381      if (element.hasOutcomeElement()) {
51382        composeEnumerationCore("outcome", element.getOutcomeElement(), new EnrollmentResponse.EnrollmentOutcomeEnumFactory(), false);
51383        composeEnumerationExtras("outcome", element.getOutcomeElement(), new EnrollmentResponse.EnrollmentOutcomeEnumFactory(), false);
51384      }
51385      if (element.hasDispositionElement()) {
51386        composeStringCore("disposition", element.getDispositionElement(), false);
51387        composeStringExtras("disposition", element.getDispositionElement(), false);
51388      }
51389      if (element.hasCreatedElement()) {
51390        composeDateTimeCore("created", element.getCreatedElement(), false);
51391        composeDateTimeExtras("created", element.getCreatedElement(), false);
51392      }
51393      if (element.hasOrganization()) {
51394        composeReference("organization", element.getOrganization());
51395      }
51396      if (element.hasRequestProvider()) {
51397        composeReference("requestProvider", element.getRequestProvider());
51398      }
51399  }
51400
51401  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
51402    if (element != null) {
51403      prop("resourceType", name);
51404      composeEpisodeOfCareProperties(element);
51405    }
51406  }
51407
51408  protected void composeEpisodeOfCareProperties(EpisodeOfCare element) throws IOException {
51409    composeDomainResourceProperties(element);
51410      if (element.hasIdentifier()) {
51411        openArray("identifier");
51412        for (Identifier e : element.getIdentifier()) 
51413          composeIdentifier(null, e);
51414        closeArray();
51415      };
51416      if (element.hasStatusElement()) {
51417        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51418        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51419      }
51420      if (element.hasStatusHistory()) {
51421        openArray("statusHistory");
51422        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
51423          composeEpisodeOfCareStatusHistoryComponent(null, e);
51424        closeArray();
51425      };
51426      if (element.hasType()) {
51427        openArray("type");
51428        for (CodeableConcept e : element.getType()) 
51429          composeCodeableConcept(null, e);
51430        closeArray();
51431      };
51432      if (element.hasReason()) {
51433        openArray("reason");
51434        for (EpisodeOfCare.ReasonComponent e : element.getReason()) 
51435          composeReasonComponent(null, e);
51436        closeArray();
51437      };
51438      if (element.hasDiagnosis()) {
51439        openArray("diagnosis");
51440        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
51441          composeDiagnosisComponent(null, e);
51442        closeArray();
51443      };
51444      if (element.hasPatient()) {
51445        composeReference("patient", element.getPatient());
51446      }
51447      if (element.hasManagingOrganization()) {
51448        composeReference("managingOrganization", element.getManagingOrganization());
51449      }
51450      if (element.hasPeriod()) {
51451        composePeriod("period", element.getPeriod());
51452      }
51453      if (element.hasReferralRequest()) {
51454        openArray("referralRequest");
51455        for (Reference e : element.getReferralRequest()) 
51456          composeReference(null, e);
51457        closeArray();
51458      };
51459      if (element.hasCareManager()) {
51460        composeReference("careManager", element.getCareManager());
51461      }
51462      if (element.hasCareTeam()) {
51463        openArray("careTeam");
51464        for (Reference e : element.getCareTeam()) 
51465          composeReference(null, e);
51466        closeArray();
51467      };
51468      if (element.hasAccount()) {
51469        openArray("account");
51470        for (Reference e : element.getAccount()) 
51471          composeReference(null, e);
51472        closeArray();
51473      };
51474  }
51475
51476  protected void composeEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
51477    if (element != null) {
51478      open(name);
51479      composeEpisodeOfCareStatusHistoryComponentProperties(element);
51480      close();
51481    }
51482  }
51483
51484  protected void composeEpisodeOfCareStatusHistoryComponentProperties(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
51485    composeBackboneElementProperties(element);
51486      if (element.hasStatusElement()) {
51487        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51488        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
51489      }
51490      if (element.hasPeriod()) {
51491        composePeriod("period", element.getPeriod());
51492      }
51493  }
51494
51495  protected void composeReasonComponent(String name, EpisodeOfCare.ReasonComponent element) throws IOException {
51496    if (element != null) {
51497      open(name);
51498      composeReasonComponentProperties(element);
51499      close();
51500    }
51501  }
51502
51503  protected void composeReasonComponentProperties(EpisodeOfCare.ReasonComponent element) throws IOException {
51504    composeBackboneElementProperties(element);
51505      if (element.hasUse()) {
51506        composeCodeableConcept("use", element.getUse());
51507      }
51508      if (element.hasValue()) {
51509        openArray("value");
51510        for (CodeableReference e : element.getValue()) 
51511          composeCodeableReference(null, e);
51512        closeArray();
51513      };
51514  }
51515
51516  protected void composeDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
51517    if (element != null) {
51518      open(name);
51519      composeDiagnosisComponentProperties(element);
51520      close();
51521    }
51522  }
51523
51524  protected void composeDiagnosisComponentProperties(EpisodeOfCare.DiagnosisComponent element) throws IOException {
51525    composeBackboneElementProperties(element);
51526      if (element.hasCondition()) {
51527        openArray("condition");
51528        for (CodeableReference e : element.getCondition()) 
51529          composeCodeableReference(null, e);
51530        closeArray();
51531      };
51532      if (element.hasUse()) {
51533        composeCodeableConcept("use", element.getUse());
51534      }
51535  }
51536
51537  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
51538    if (element != null) {
51539      prop("resourceType", name);
51540      composeEventDefinitionProperties(element);
51541    }
51542  }
51543
51544  protected void composeEventDefinitionProperties(EventDefinition element) throws IOException {
51545    composeMetadataResourceProperties(element);
51546      if (element.hasUrlElement()) {
51547        composeUriCore("url", element.getUrlElement(), false);
51548        composeUriExtras("url", element.getUrlElement(), false);
51549      }
51550      if (element.hasIdentifier()) {
51551        openArray("identifier");
51552        for (Identifier e : element.getIdentifier()) 
51553          composeIdentifier(null, e);
51554        closeArray();
51555      };
51556      if (element.hasVersionElement()) {
51557        composeStringCore("version", element.getVersionElement(), false);
51558        composeStringExtras("version", element.getVersionElement(), false);
51559      }
51560      if (element.hasVersionAlgorithm()) {
51561        composeType("versionAlgorithm", element.getVersionAlgorithm());
51562      }
51563      if (element.hasNameElement()) {
51564        composeStringCore("name", element.getNameElement(), false);
51565        composeStringExtras("name", element.getNameElement(), false);
51566      }
51567      if (element.hasTitleElement()) {
51568        composeStringCore("title", element.getTitleElement(), false);
51569        composeStringExtras("title", element.getTitleElement(), false);
51570      }
51571      if (element.hasSubtitleElement()) {
51572        composeStringCore("subtitle", element.getSubtitleElement(), false);
51573        composeStringExtras("subtitle", element.getSubtitleElement(), false);
51574      }
51575      if (element.hasStatusElement()) {
51576        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51577        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51578      }
51579      if (element.hasExperimentalElement()) {
51580        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51581        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51582      }
51583      if (element.hasSubject()) {
51584        composeType("subject", element.getSubject());
51585      }
51586      if (element.hasDateElement()) {
51587        composeDateTimeCore("date", element.getDateElement(), false);
51588        composeDateTimeExtras("date", element.getDateElement(), false);
51589      }
51590      if (element.hasPublisherElement()) {
51591        composeStringCore("publisher", element.getPublisherElement(), false);
51592        composeStringExtras("publisher", element.getPublisherElement(), false);
51593      }
51594      if (element.hasContact()) {
51595        openArray("contact");
51596        for (ContactDetail e : element.getContact()) 
51597          composeContactDetail(null, e);
51598        closeArray();
51599      };
51600      if (element.hasDescriptionElement()) {
51601        composeMarkdownCore("description", element.getDescriptionElement(), false);
51602        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51603      }
51604      if (element.hasUseContext()) {
51605        openArray("useContext");
51606        for (UsageContext e : element.getUseContext()) 
51607          composeUsageContext(null, e);
51608        closeArray();
51609      };
51610      if (element.hasJurisdiction()) {
51611        openArray("jurisdiction");
51612        for (CodeableConcept e : element.getJurisdiction()) 
51613          composeCodeableConcept(null, e);
51614        closeArray();
51615      };
51616      if (element.hasPurposeElement()) {
51617        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51618        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51619      }
51620      if (element.hasUsageElement()) {
51621        composeMarkdownCore("usage", element.getUsageElement(), false);
51622        composeMarkdownExtras("usage", element.getUsageElement(), false);
51623      }
51624      if (element.hasCopyrightElement()) {
51625        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51626        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51627      }
51628      if (element.hasCopyrightLabelElement()) {
51629        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
51630        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
51631      }
51632      if (element.hasApprovalDateElement()) {
51633        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51634        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51635      }
51636      if (element.hasLastReviewDateElement()) {
51637        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51638        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51639      }
51640      if (element.hasEffectivePeriod()) {
51641        composePeriod("effectivePeriod", element.getEffectivePeriod());
51642      }
51643      if (element.hasTopic()) {
51644        openArray("topic");
51645        for (CodeableConcept e : element.getTopic()) 
51646          composeCodeableConcept(null, e);
51647        closeArray();
51648      };
51649      if (element.hasAuthor()) {
51650        openArray("author");
51651        for (ContactDetail e : element.getAuthor()) 
51652          composeContactDetail(null, e);
51653        closeArray();
51654      };
51655      if (element.hasEditor()) {
51656        openArray("editor");
51657        for (ContactDetail e : element.getEditor()) 
51658          composeContactDetail(null, e);
51659        closeArray();
51660      };
51661      if (element.hasReviewer()) {
51662        openArray("reviewer");
51663        for (ContactDetail e : element.getReviewer()) 
51664          composeContactDetail(null, e);
51665        closeArray();
51666      };
51667      if (element.hasEndorser()) {
51668        openArray("endorser");
51669        for (ContactDetail e : element.getEndorser()) 
51670          composeContactDetail(null, e);
51671        closeArray();
51672      };
51673      if (element.hasRelatedArtifact()) {
51674        openArray("relatedArtifact");
51675        for (RelatedArtifact e : element.getRelatedArtifact()) 
51676          composeRelatedArtifact(null, e);
51677        closeArray();
51678      };
51679      if (element.hasTrigger()) {
51680        openArray("trigger");
51681        for (TriggerDefinition e : element.getTrigger()) 
51682          composeTriggerDefinition(null, e);
51683        closeArray();
51684      };
51685  }
51686
51687  protected void composeEvidence(String name, Evidence element) throws IOException {
51688    if (element != null) {
51689      prop("resourceType", name);
51690      composeEvidenceProperties(element);
51691    }
51692  }
51693
51694  protected void composeEvidenceProperties(Evidence element) throws IOException {
51695    composeMetadataResourceProperties(element);
51696      if (element.hasUrlElement()) {
51697        composeUriCore("url", element.getUrlElement(), false);
51698        composeUriExtras("url", element.getUrlElement(), false);
51699      }
51700      if (element.hasIdentifier()) {
51701        openArray("identifier");
51702        for (Identifier e : element.getIdentifier()) 
51703          composeIdentifier(null, e);
51704        closeArray();
51705      };
51706      if (element.hasVersionElement()) {
51707        composeStringCore("version", element.getVersionElement(), false);
51708        composeStringExtras("version", element.getVersionElement(), false);
51709      }
51710      if (element.hasVersionAlgorithm()) {
51711        composeType("versionAlgorithm", element.getVersionAlgorithm());
51712      }
51713      if (element.hasNameElement()) {
51714        composeStringCore("name", element.getNameElement(), false);
51715        composeStringExtras("name", element.getNameElement(), false);
51716      }
51717      if (element.hasTitleElement()) {
51718        composeStringCore("title", element.getTitleElement(), false);
51719        composeStringExtras("title", element.getTitleElement(), false);
51720      }
51721      if (element.hasCiteAs()) {
51722        composeType("citeAs", element.getCiteAs());
51723      }
51724      if (element.hasStatusElement()) {
51725        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51726        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51727      }
51728      if (element.hasExperimentalElement()) {
51729        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51730        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51731      }
51732      if (element.hasDateElement()) {
51733        composeDateTimeCore("date", element.getDateElement(), false);
51734        composeDateTimeExtras("date", element.getDateElement(), false);
51735      }
51736      if (element.hasApprovalDateElement()) {
51737        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51738        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51739      }
51740      if (element.hasLastReviewDateElement()) {
51741        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51742        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51743      }
51744      if (element.hasPublisherElement()) {
51745        composeStringCore("publisher", element.getPublisherElement(), false);
51746        composeStringExtras("publisher", element.getPublisherElement(), false);
51747      }
51748      if (element.hasContact()) {
51749        openArray("contact");
51750        for (ContactDetail e : element.getContact()) 
51751          composeContactDetail(null, e);
51752        closeArray();
51753      };
51754      if (element.hasAuthor()) {
51755        openArray("author");
51756        for (ContactDetail e : element.getAuthor()) 
51757          composeContactDetail(null, e);
51758        closeArray();
51759      };
51760      if (element.hasEditor()) {
51761        openArray("editor");
51762        for (ContactDetail e : element.getEditor()) 
51763          composeContactDetail(null, e);
51764        closeArray();
51765      };
51766      if (element.hasReviewer()) {
51767        openArray("reviewer");
51768        for (ContactDetail e : element.getReviewer()) 
51769          composeContactDetail(null, e);
51770        closeArray();
51771      };
51772      if (element.hasEndorser()) {
51773        openArray("endorser");
51774        for (ContactDetail e : element.getEndorser()) 
51775          composeContactDetail(null, e);
51776        closeArray();
51777      };
51778      if (element.hasUseContext()) {
51779        openArray("useContext");
51780        for (UsageContext e : element.getUseContext()) 
51781          composeUsageContext(null, e);
51782        closeArray();
51783      };
51784      if (element.hasPurposeElement()) {
51785        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51786        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51787      }
51788      if (element.hasCopyrightElement()) {
51789        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51790        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51791      }
51792      if (element.hasCopyrightLabelElement()) {
51793        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
51794        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
51795      }
51796      if (element.hasRelatedArtifact()) {
51797        openArray("relatedArtifact");
51798        for (RelatedArtifact e : element.getRelatedArtifact()) 
51799          composeRelatedArtifact(null, e);
51800        closeArray();
51801      };
51802      if (element.hasDescriptionElement()) {
51803        composeMarkdownCore("description", element.getDescriptionElement(), false);
51804        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51805      }
51806      if (element.hasAssertionElement()) {
51807        composeMarkdownCore("assertion", element.getAssertionElement(), false);
51808        composeMarkdownExtras("assertion", element.getAssertionElement(), false);
51809      }
51810      if (element.hasNote()) {
51811        openArray("note");
51812        for (Annotation e : element.getNote()) 
51813          composeAnnotation(null, e);
51814        closeArray();
51815      };
51816      if (element.hasVariableDefinition()) {
51817        openArray("variableDefinition");
51818        for (Evidence.EvidenceVariableDefinitionComponent e : element.getVariableDefinition()) 
51819          composeEvidenceVariableDefinitionComponent(null, e);
51820        closeArray();
51821      };
51822      if (element.hasSynthesisType()) {
51823        composeCodeableConcept("synthesisType", element.getSynthesisType());
51824      }
51825      if (element.hasStudyDesign()) {
51826        openArray("studyDesign");
51827        for (CodeableConcept e : element.getStudyDesign()) 
51828          composeCodeableConcept(null, e);
51829        closeArray();
51830      };
51831      if (element.hasStatistic()) {
51832        openArray("statistic");
51833        for (Evidence.EvidenceStatisticComponent e : element.getStatistic()) 
51834          composeEvidenceStatisticComponent(null, e);
51835        closeArray();
51836      };
51837      if (element.hasCertainty()) {
51838        openArray("certainty");
51839        for (Evidence.EvidenceCertaintyComponent e : element.getCertainty()) 
51840          composeEvidenceCertaintyComponent(null, e);
51841        closeArray();
51842      };
51843  }
51844
51845  protected void composeEvidenceVariableDefinitionComponent(String name, Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
51846    if (element != null) {
51847      open(name);
51848      composeEvidenceVariableDefinitionComponentProperties(element);
51849      close();
51850    }
51851  }
51852
51853  protected void composeEvidenceVariableDefinitionComponentProperties(Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
51854    composeBackboneElementProperties(element);
51855      if (element.hasDescriptionElement()) {
51856        composeMarkdownCore("description", element.getDescriptionElement(), false);
51857        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51858      }
51859      if (element.hasNote()) {
51860        openArray("note");
51861        for (Annotation e : element.getNote()) 
51862          composeAnnotation(null, e);
51863        closeArray();
51864      };
51865      if (element.hasVariableRole()) {
51866        composeCodeableConcept("variableRole", element.getVariableRole());
51867      }
51868      if (element.hasObserved()) {
51869        composeReference("observed", element.getObserved());
51870      }
51871      if (element.hasIntended()) {
51872        composeReference("intended", element.getIntended());
51873      }
51874      if (element.hasDirectnessMatch()) {
51875        composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
51876      }
51877  }
51878
51879  protected void composeEvidenceStatisticComponent(String name, Evidence.EvidenceStatisticComponent element) throws IOException {
51880    if (element != null) {
51881      open(name);
51882      composeEvidenceStatisticComponentProperties(element);
51883      close();
51884    }
51885  }
51886
51887  protected void composeEvidenceStatisticComponentProperties(Evidence.EvidenceStatisticComponent element) throws IOException {
51888    composeBackboneElementProperties(element);
51889      if (element.hasDescriptionElement()) {
51890        composeMarkdownCore("description", element.getDescriptionElement(), false);
51891        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51892      }
51893      if (element.hasNote()) {
51894        openArray("note");
51895        for (Annotation e : element.getNote()) 
51896          composeAnnotation(null, e);
51897        closeArray();
51898      };
51899      if (element.hasStatisticType()) {
51900        composeCodeableConcept("statisticType", element.getStatisticType());
51901      }
51902      if (element.hasCategory()) {
51903        composeCodeableConcept("category", element.getCategory());
51904      }
51905      if (element.hasQuantity()) {
51906        composeQuantity("quantity", element.getQuantity());
51907      }
51908      if (element.hasNumberOfEventsElement()) {
51909        composeUnsignedIntCore("numberOfEvents", element.getNumberOfEventsElement(), false);
51910        composeUnsignedIntExtras("numberOfEvents", element.getNumberOfEventsElement(), false);
51911      }
51912      if (element.hasNumberAffectedElement()) {
51913        composeUnsignedIntCore("numberAffected", element.getNumberAffectedElement(), false);
51914        composeUnsignedIntExtras("numberAffected", element.getNumberAffectedElement(), false);
51915      }
51916      if (element.hasSampleSize()) {
51917        composeEvidenceStatisticSampleSizeComponent("sampleSize", element.getSampleSize());
51918      }
51919      if (element.hasAttributeEstimate()) {
51920        openArray("attributeEstimate");
51921        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
51922          composeEvidenceStatisticAttributeEstimateComponent(null, e);
51923        closeArray();
51924      };
51925      if (element.hasModelCharacteristic()) {
51926        openArray("modelCharacteristic");
51927        for (Evidence.EvidenceStatisticModelCharacteristicComponent e : element.getModelCharacteristic()) 
51928          composeEvidenceStatisticModelCharacteristicComponent(null, e);
51929        closeArray();
51930      };
51931  }
51932
51933  protected void composeEvidenceStatisticSampleSizeComponent(String name, Evidence.EvidenceStatisticSampleSizeComponent element) throws IOException {
51934    if (element != null) {
51935      open(name);
51936      composeEvidenceStatisticSampleSizeComponentProperties(element);
51937      close();
51938    }
51939  }
51940
51941  protected void composeEvidenceStatisticSampleSizeComponentProperties(Evidence.EvidenceStatisticSampleSizeComponent element) throws IOException {
51942    composeBackboneElementProperties(element);
51943      if (element.hasDescriptionElement()) {
51944        composeMarkdownCore("description", element.getDescriptionElement(), false);
51945        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51946      }
51947      if (element.hasNote()) {
51948        openArray("note");
51949        for (Annotation e : element.getNote()) 
51950          composeAnnotation(null, e);
51951        closeArray();
51952      };
51953      if (element.hasNumberOfStudiesElement()) {
51954        composeUnsignedIntCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
51955        composeUnsignedIntExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
51956      }
51957      if (element.hasNumberOfParticipantsElement()) {
51958        composeUnsignedIntCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
51959        composeUnsignedIntExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
51960      }
51961      if (element.hasKnownDataCountElement()) {
51962        composeUnsignedIntCore("knownDataCount", element.getKnownDataCountElement(), false);
51963        composeUnsignedIntExtras("knownDataCount", element.getKnownDataCountElement(), false);
51964      }
51965  }
51966
51967  protected void composeEvidenceStatisticAttributeEstimateComponent(String name, Evidence.EvidenceStatisticAttributeEstimateComponent element) throws IOException {
51968    if (element != null) {
51969      open(name);
51970      composeEvidenceStatisticAttributeEstimateComponentProperties(element);
51971      close();
51972    }
51973  }
51974
51975  protected void composeEvidenceStatisticAttributeEstimateComponentProperties(Evidence.EvidenceStatisticAttributeEstimateComponent element) throws IOException {
51976    composeBackboneElementProperties(element);
51977      if (element.hasDescriptionElement()) {
51978        composeMarkdownCore("description", element.getDescriptionElement(), false);
51979        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51980      }
51981      if (element.hasNote()) {
51982        openArray("note");
51983        for (Annotation e : element.getNote()) 
51984          composeAnnotation(null, e);
51985        closeArray();
51986      };
51987      if (element.hasType()) {
51988        composeCodeableConcept("type", element.getType());
51989      }
51990      if (element.hasQuantity()) {
51991        composeQuantity("quantity", element.getQuantity());
51992      }
51993      if (element.hasLevelElement()) {
51994        composeDecimalCore("level", element.getLevelElement(), false);
51995        composeDecimalExtras("level", element.getLevelElement(), false);
51996      }
51997      if (element.hasRange()) {
51998        composeRange("range", element.getRange());
51999      }
52000      if (element.hasAttributeEstimate()) {
52001        openArray("attributeEstimate");
52002        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
52003          composeEvidenceStatisticAttributeEstimateComponent(null, e);
52004        closeArray();
52005      };
52006  }
52007
52008  protected void composeEvidenceStatisticModelCharacteristicComponent(String name, Evidence.EvidenceStatisticModelCharacteristicComponent element) throws IOException {
52009    if (element != null) {
52010      open(name);
52011      composeEvidenceStatisticModelCharacteristicComponentProperties(element);
52012      close();
52013    }
52014  }
52015
52016  protected void composeEvidenceStatisticModelCharacteristicComponentProperties(Evidence.EvidenceStatisticModelCharacteristicComponent element) throws IOException {
52017    composeBackboneElementProperties(element);
52018      if (element.hasCode()) {
52019        composeCodeableConcept("code", element.getCode());
52020      }
52021      if (element.hasValue()) {
52022        composeQuantity("value", element.getValue());
52023      }
52024      if (element.hasVariable()) {
52025        openArray("variable");
52026        for (Evidence.EvidenceStatisticModelCharacteristicVariableComponent e : element.getVariable()) 
52027          composeEvidenceStatisticModelCharacteristicVariableComponent(null, e);
52028        closeArray();
52029      };
52030      if (element.hasAttributeEstimate()) {
52031        openArray("attributeEstimate");
52032        for (Evidence.EvidenceStatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
52033          composeEvidenceStatisticAttributeEstimateComponent(null, e);
52034        closeArray();
52035      };
52036  }
52037
52038  protected void composeEvidenceStatisticModelCharacteristicVariableComponent(String name, Evidence.EvidenceStatisticModelCharacteristicVariableComponent element) throws IOException {
52039    if (element != null) {
52040      open(name);
52041      composeEvidenceStatisticModelCharacteristicVariableComponentProperties(element);
52042      close();
52043    }
52044  }
52045
52046  protected void composeEvidenceStatisticModelCharacteristicVariableComponentProperties(Evidence.EvidenceStatisticModelCharacteristicVariableComponent element) throws IOException {
52047    composeBackboneElementProperties(element);
52048      if (element.hasVariableDefinition()) {
52049        composeReference("variableDefinition", element.getVariableDefinition());
52050      }
52051      if (element.hasHandlingElement()) {
52052        composeEnumerationCore("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52053        composeEnumerationExtras("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52054      }
52055      if (element.hasValueCategory()) {
52056        openArray("valueCategory");
52057        for (CodeableConcept e : element.getValueCategory()) 
52058          composeCodeableConcept(null, e);
52059        closeArray();
52060      };
52061      if (element.hasValueQuantity()) {
52062        openArray("valueQuantity");
52063        for (Quantity e : element.getValueQuantity()) 
52064          composeQuantity(null, e);
52065        closeArray();
52066      };
52067      if (element.hasValueRange()) {
52068        openArray("valueRange");
52069        for (Range e : element.getValueRange()) 
52070          composeRange(null, e);
52071        closeArray();
52072      };
52073  }
52074
52075  protected void composeEvidenceCertaintyComponent(String name, Evidence.EvidenceCertaintyComponent element) throws IOException {
52076    if (element != null) {
52077      open(name);
52078      composeEvidenceCertaintyComponentProperties(element);
52079      close();
52080    }
52081  }
52082
52083  protected void composeEvidenceCertaintyComponentProperties(Evidence.EvidenceCertaintyComponent element) throws IOException {
52084    composeBackboneElementProperties(element);
52085      if (element.hasDescriptionElement()) {
52086        composeMarkdownCore("description", element.getDescriptionElement(), false);
52087        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52088      }
52089      if (element.hasNote()) {
52090        openArray("note");
52091        for (Annotation e : element.getNote()) 
52092          composeAnnotation(null, e);
52093        closeArray();
52094      };
52095      if (element.hasType()) {
52096        composeCodeableConcept("type", element.getType());
52097      }
52098      if (element.hasRating()) {
52099        composeCodeableConcept("rating", element.getRating());
52100      }
52101      if (element.hasRaterElement()) {
52102        composeStringCore("rater", element.getRaterElement(), false);
52103        composeStringExtras("rater", element.getRaterElement(), false);
52104      }
52105      if (element.hasSubcomponent()) {
52106        openArray("subcomponent");
52107        for (Evidence.EvidenceCertaintyComponent e : element.getSubcomponent()) 
52108          composeEvidenceCertaintyComponent(null, e);
52109        closeArray();
52110      };
52111  }
52112
52113  protected void composeEvidenceReport(String name, EvidenceReport element) throws IOException {
52114    if (element != null) {
52115      prop("resourceType", name);
52116      composeEvidenceReportProperties(element);
52117    }
52118  }
52119
52120  protected void composeEvidenceReportProperties(EvidenceReport element) throws IOException {
52121    composeMetadataResourceProperties(element);
52122      if (element.hasUrlElement()) {
52123        composeUriCore("url", element.getUrlElement(), false);
52124        composeUriExtras("url", element.getUrlElement(), false);
52125      }
52126      if (element.hasStatusElement()) {
52127        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52128        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52129      }
52130      if (element.hasUseContext()) {
52131        openArray("useContext");
52132        for (UsageContext e : element.getUseContext()) 
52133          composeUsageContext(null, e);
52134        closeArray();
52135      };
52136      if (element.hasIdentifier()) {
52137        openArray("identifier");
52138        for (Identifier e : element.getIdentifier()) 
52139          composeIdentifier(null, e);
52140        closeArray();
52141      };
52142      if (element.hasRelatedIdentifier()) {
52143        openArray("relatedIdentifier");
52144        for (Identifier e : element.getRelatedIdentifier()) 
52145          composeIdentifier(null, e);
52146        closeArray();
52147      };
52148      if (element.hasCiteAs()) {
52149        composeType("citeAs", element.getCiteAs());
52150      }
52151      if (element.hasType()) {
52152        composeCodeableConcept("type", element.getType());
52153      }
52154      if (element.hasNote()) {
52155        openArray("note");
52156        for (Annotation e : element.getNote()) 
52157          composeAnnotation(null, e);
52158        closeArray();
52159      };
52160      if (element.hasRelatedArtifact()) {
52161        openArray("relatedArtifact");
52162        for (RelatedArtifact e : element.getRelatedArtifact()) 
52163          composeRelatedArtifact(null, e);
52164        closeArray();
52165      };
52166      if (element.hasSubject()) {
52167        composeEvidenceReportSubjectComponent("subject", element.getSubject());
52168      }
52169      if (element.hasPublisherElement()) {
52170        composeStringCore("publisher", element.getPublisherElement(), false);
52171        composeStringExtras("publisher", element.getPublisherElement(), false);
52172      }
52173      if (element.hasContact()) {
52174        openArray("contact");
52175        for (ContactDetail e : element.getContact()) 
52176          composeContactDetail(null, e);
52177        closeArray();
52178      };
52179      if (element.hasAuthor()) {
52180        openArray("author");
52181        for (ContactDetail e : element.getAuthor()) 
52182          composeContactDetail(null, e);
52183        closeArray();
52184      };
52185      if (element.hasEditor()) {
52186        openArray("editor");
52187        for (ContactDetail e : element.getEditor()) 
52188          composeContactDetail(null, e);
52189        closeArray();
52190      };
52191      if (element.hasReviewer()) {
52192        openArray("reviewer");
52193        for (ContactDetail e : element.getReviewer()) 
52194          composeContactDetail(null, e);
52195        closeArray();
52196      };
52197      if (element.hasEndorser()) {
52198        openArray("endorser");
52199        for (ContactDetail e : element.getEndorser()) 
52200          composeContactDetail(null, e);
52201        closeArray();
52202      };
52203      if (element.hasRelatesTo()) {
52204        openArray("relatesTo");
52205        for (EvidenceReport.EvidenceReportRelatesToComponent e : element.getRelatesTo()) 
52206          composeEvidenceReportRelatesToComponent(null, e);
52207        closeArray();
52208      };
52209      if (element.hasSection()) {
52210        openArray("section");
52211        for (EvidenceReport.SectionComponent e : element.getSection()) 
52212          composeSectionComponent(null, e);
52213        closeArray();
52214      };
52215  }
52216
52217  protected void composeEvidenceReportSubjectComponent(String name, EvidenceReport.EvidenceReportSubjectComponent element) throws IOException {
52218    if (element != null) {
52219      open(name);
52220      composeEvidenceReportSubjectComponentProperties(element);
52221      close();
52222    }
52223  }
52224
52225  protected void composeEvidenceReportSubjectComponentProperties(EvidenceReport.EvidenceReportSubjectComponent element) throws IOException {
52226    composeBackboneElementProperties(element);
52227      if (element.hasCharacteristic()) {
52228        openArray("characteristic");
52229        for (EvidenceReport.EvidenceReportSubjectCharacteristicComponent e : element.getCharacteristic()) 
52230          composeEvidenceReportSubjectCharacteristicComponent(null, e);
52231        closeArray();
52232      };
52233      if (element.hasNote()) {
52234        openArray("note");
52235        for (Annotation e : element.getNote()) 
52236          composeAnnotation(null, e);
52237        closeArray();
52238      };
52239  }
52240
52241  protected void composeEvidenceReportSubjectCharacteristicComponent(String name, EvidenceReport.EvidenceReportSubjectCharacteristicComponent element) throws IOException {
52242    if (element != null) {
52243      open(name);
52244      composeEvidenceReportSubjectCharacteristicComponentProperties(element);
52245      close();
52246    }
52247  }
52248
52249  protected void composeEvidenceReportSubjectCharacteristicComponentProperties(EvidenceReport.EvidenceReportSubjectCharacteristicComponent element) throws IOException {
52250    composeBackboneElementProperties(element);
52251      if (element.hasCode()) {
52252        composeCodeableConcept("code", element.getCode());
52253      }
52254      if (element.hasValue()) {
52255        composeType("value", element.getValue());
52256      }
52257      if (element.hasExcludeElement()) {
52258        composeBooleanCore("exclude", element.getExcludeElement(), false);
52259        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52260      }
52261      if (element.hasPeriod()) {
52262        composePeriod("period", element.getPeriod());
52263      }
52264  }
52265
52266  protected void composeEvidenceReportRelatesToComponent(String name, EvidenceReport.EvidenceReportRelatesToComponent element) throws IOException {
52267    if (element != null) {
52268      open(name);
52269      composeEvidenceReportRelatesToComponentProperties(element);
52270      close();
52271    }
52272  }
52273
52274  protected void composeEvidenceReportRelatesToComponentProperties(EvidenceReport.EvidenceReportRelatesToComponent element) throws IOException {
52275    composeBackboneElementProperties(element);
52276      if (element.hasCodeElement()) {
52277        composeEnumerationCore("code", element.getCodeElement(), new EvidenceReport.ReportRelationshipTypeEnumFactory(), false);
52278        composeEnumerationExtras("code", element.getCodeElement(), new EvidenceReport.ReportRelationshipTypeEnumFactory(), false);
52279      }
52280      if (element.hasTarget()) {
52281        composeEvidenceReportRelatesToTargetComponent("target", element.getTarget());
52282      }
52283  }
52284
52285  protected void composeEvidenceReportRelatesToTargetComponent(String name, EvidenceReport.EvidenceReportRelatesToTargetComponent element) throws IOException {
52286    if (element != null) {
52287      open(name);
52288      composeEvidenceReportRelatesToTargetComponentProperties(element);
52289      close();
52290    }
52291  }
52292
52293  protected void composeEvidenceReportRelatesToTargetComponentProperties(EvidenceReport.EvidenceReportRelatesToTargetComponent element) throws IOException {
52294    composeBackboneElementProperties(element);
52295      if (element.hasUrlElement()) {
52296        composeUriCore("url", element.getUrlElement(), false);
52297        composeUriExtras("url", element.getUrlElement(), false);
52298      }
52299      if (element.hasIdentifier()) {
52300        composeIdentifier("identifier", element.getIdentifier());
52301      }
52302      if (element.hasDisplayElement()) {
52303        composeMarkdownCore("display", element.getDisplayElement(), false);
52304        composeMarkdownExtras("display", element.getDisplayElement(), false);
52305      }
52306      if (element.hasResource()) {
52307        composeReference("resource", element.getResource());
52308      }
52309  }
52310
52311  protected void composeSectionComponent(String name, EvidenceReport.SectionComponent element) throws IOException {
52312    if (element != null) {
52313      open(name);
52314      composeSectionComponentProperties(element);
52315      close();
52316    }
52317  }
52318
52319  protected void composeSectionComponentProperties(EvidenceReport.SectionComponent element) throws IOException {
52320    composeBackboneElementProperties(element);
52321      if (element.hasTitleElement()) {
52322        composeStringCore("title", element.getTitleElement(), false);
52323        composeStringExtras("title", element.getTitleElement(), false);
52324      }
52325      if (element.hasFocus()) {
52326        composeCodeableConcept("focus", element.getFocus());
52327      }
52328      if (element.hasFocusReference()) {
52329        composeReference("focusReference", element.getFocusReference());
52330      }
52331      if (element.hasAuthor()) {
52332        openArray("author");
52333        for (Reference e : element.getAuthor()) 
52334          composeReference(null, e);
52335        closeArray();
52336      };
52337      if (element.hasText()) {
52338        composeNarrative("text", element.getText());
52339      }
52340      if (element.hasModeElement()) {
52341        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
52342        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
52343      }
52344      if (element.hasOrderedBy()) {
52345        composeCodeableConcept("orderedBy", element.getOrderedBy());
52346      }
52347      if (element.hasEntryClassifier()) {
52348        openArray("entryClassifier");
52349        for (CodeableConcept e : element.getEntryClassifier()) 
52350          composeCodeableConcept(null, e);
52351        closeArray();
52352      };
52353      if (element.hasEntryReference()) {
52354        openArray("entryReference");
52355        for (Reference e : element.getEntryReference()) 
52356          composeReference(null, e);
52357        closeArray();
52358      };
52359      if (element.hasEntryQuantity()) {
52360        openArray("entryQuantity");
52361        for (Quantity e : element.getEntryQuantity()) 
52362          composeQuantity(null, e);
52363        closeArray();
52364      };
52365      if (element.hasEmptyReason()) {
52366        composeCodeableConcept("emptyReason", element.getEmptyReason());
52367      }
52368      if (element.hasSection()) {
52369        openArray("section");
52370        for (EvidenceReport.SectionComponent e : element.getSection()) 
52371          composeSectionComponent(null, e);
52372        closeArray();
52373      };
52374  }
52375
52376  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
52377    if (element != null) {
52378      prop("resourceType", name);
52379      composeEvidenceVariableProperties(element);
52380    }
52381  }
52382
52383  protected void composeEvidenceVariableProperties(EvidenceVariable element) throws IOException {
52384    composeMetadataResourceProperties(element);
52385      if (element.hasUrlElement()) {
52386        composeUriCore("url", element.getUrlElement(), false);
52387        composeUriExtras("url", element.getUrlElement(), false);
52388      }
52389      if (element.hasIdentifier()) {
52390        openArray("identifier");
52391        for (Identifier e : element.getIdentifier()) 
52392          composeIdentifier(null, e);
52393        closeArray();
52394      };
52395      if (element.hasVersionElement()) {
52396        composeStringCore("version", element.getVersionElement(), false);
52397        composeStringExtras("version", element.getVersionElement(), false);
52398      }
52399      if (element.hasVersionAlgorithm()) {
52400        composeType("versionAlgorithm", element.getVersionAlgorithm());
52401      }
52402      if (element.hasNameElement()) {
52403        composeStringCore("name", element.getNameElement(), false);
52404        composeStringExtras("name", element.getNameElement(), false);
52405      }
52406      if (element.hasTitleElement()) {
52407        composeStringCore("title", element.getTitleElement(), false);
52408        composeStringExtras("title", element.getTitleElement(), false);
52409      }
52410      if (element.hasShortTitleElement()) {
52411        composeStringCore("shortTitle", element.getShortTitleElement(), false);
52412        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
52413      }
52414      if (element.hasStatusElement()) {
52415        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52416        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52417      }
52418      if (element.hasExperimentalElement()) {
52419        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52420        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52421      }
52422      if (element.hasDateElement()) {
52423        composeDateTimeCore("date", element.getDateElement(), false);
52424        composeDateTimeExtras("date", element.getDateElement(), false);
52425      }
52426      if (element.hasPublisherElement()) {
52427        composeStringCore("publisher", element.getPublisherElement(), false);
52428        composeStringExtras("publisher", element.getPublisherElement(), false);
52429      }
52430      if (element.hasContact()) {
52431        openArray("contact");
52432        for (ContactDetail e : element.getContact()) 
52433          composeContactDetail(null, e);
52434        closeArray();
52435      };
52436      if (element.hasDescriptionElement()) {
52437        composeMarkdownCore("description", element.getDescriptionElement(), false);
52438        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52439      }
52440      if (element.hasNote()) {
52441        openArray("note");
52442        for (Annotation e : element.getNote()) 
52443          composeAnnotation(null, e);
52444        closeArray();
52445      };
52446      if (element.hasUseContext()) {
52447        openArray("useContext");
52448        for (UsageContext e : element.getUseContext()) 
52449          composeUsageContext(null, e);
52450        closeArray();
52451      };
52452      if (element.hasPurposeElement()) {
52453        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52454        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52455      }
52456      if (element.hasCopyrightElement()) {
52457        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52458        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52459      }
52460      if (element.hasCopyrightLabelElement()) {
52461        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
52462        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
52463      }
52464      if (element.hasApprovalDateElement()) {
52465        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52466        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52467      }
52468      if (element.hasLastReviewDateElement()) {
52469        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52470        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52471      }
52472      if (element.hasEffectivePeriod()) {
52473        composePeriod("effectivePeriod", element.getEffectivePeriod());
52474      }
52475      if (element.hasAuthor()) {
52476        openArray("author");
52477        for (ContactDetail e : element.getAuthor()) 
52478          composeContactDetail(null, e);
52479        closeArray();
52480      };
52481      if (element.hasEditor()) {
52482        openArray("editor");
52483        for (ContactDetail e : element.getEditor()) 
52484          composeContactDetail(null, e);
52485        closeArray();
52486      };
52487      if (element.hasReviewer()) {
52488        openArray("reviewer");
52489        for (ContactDetail e : element.getReviewer()) 
52490          composeContactDetail(null, e);
52491        closeArray();
52492      };
52493      if (element.hasEndorser()) {
52494        openArray("endorser");
52495        for (ContactDetail e : element.getEndorser()) 
52496          composeContactDetail(null, e);
52497        closeArray();
52498      };
52499      if (element.hasRelatedArtifact()) {
52500        openArray("relatedArtifact");
52501        for (RelatedArtifact e : element.getRelatedArtifact()) 
52502          composeRelatedArtifact(null, e);
52503        closeArray();
52504      };
52505      if (element.hasActualElement()) {
52506        composeBooleanCore("actual", element.getActualElement(), false);
52507        composeBooleanExtras("actual", element.getActualElement(), false);
52508      }
52509      if (element.hasCharacteristic()) {
52510        openArray("characteristic");
52511        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
52512          composeEvidenceVariableCharacteristicComponent(null, e);
52513        closeArray();
52514      };
52515      if (element.hasHandlingElement()) {
52516        composeEnumerationCore("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52517        composeEnumerationExtras("handling", element.getHandlingElement(), new Enumerations.EvidenceVariableHandlingEnumFactory(), false);
52518      }
52519      if (element.hasCategory()) {
52520        openArray("category");
52521        for (EvidenceVariable.EvidenceVariableCategoryComponent e : element.getCategory()) 
52522          composeEvidenceVariableCategoryComponent(null, e);
52523        closeArray();
52524      };
52525  }
52526
52527  protected void composeEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
52528    if (element != null) {
52529      open(name);
52530      composeEvidenceVariableCharacteristicComponentProperties(element);
52531      close();
52532    }
52533  }
52534
52535  protected void composeEvidenceVariableCharacteristicComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
52536    composeBackboneElementProperties(element);
52537      if (element.hasLinkIdElement()) {
52538        composeIdCore("linkId", element.getLinkIdElement(), false);
52539        composeIdExtras("linkId", element.getLinkIdElement(), false);
52540      }
52541      if (element.hasDescriptionElement()) {
52542        composeMarkdownCore("description", element.getDescriptionElement(), false);
52543        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52544      }
52545      if (element.hasNote()) {
52546        openArray("note");
52547        for (Annotation e : element.getNote()) 
52548          composeAnnotation(null, e);
52549        closeArray();
52550      };
52551      if (element.hasExcludeElement()) {
52552        composeBooleanCore("exclude", element.getExcludeElement(), false);
52553        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52554      }
52555      if (element.hasDefinitionReference()) {
52556        composeReference("definitionReference", element.getDefinitionReference());
52557      }
52558      if (element.hasDefinitionCanonicalElement()) {
52559        composeCanonicalCore("definitionCanonical", element.getDefinitionCanonicalElement(), false);
52560        composeCanonicalExtras("definitionCanonical", element.getDefinitionCanonicalElement(), false);
52561      }
52562      if (element.hasDefinitionCodeableConcept()) {
52563        composeCodeableConcept("definitionCodeableConcept", element.getDefinitionCodeableConcept());
52564      }
52565      if (element.hasDefinitionExpression()) {
52566        composeExpression("definitionExpression", element.getDefinitionExpression());
52567      }
52568      if (element.hasDefinitionIdElement()) {
52569        composeIdCore("definitionId", element.getDefinitionIdElement(), false);
52570        composeIdExtras("definitionId", element.getDefinitionIdElement(), false);
52571      }
52572      if (element.hasDefinitionByTypeAndValue()) {
52573        composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponent("definitionByTypeAndValue", element.getDefinitionByTypeAndValue());
52574      }
52575      if (element.hasDefinitionByCombination()) {
52576        composeEvidenceVariableCharacteristicDefinitionByCombinationComponent("definitionByCombination", element.getDefinitionByCombination());
52577      }
52578      if (element.hasInstances()) {
52579        composeType("instances", element.getInstances());
52580      }
52581      if (element.hasDuration()) {
52582        composeType("duration", element.getDuration());
52583      }
52584      if (element.hasTimeFromEvent()) {
52585        openArray("timeFromEvent");
52586        for (EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent e : element.getTimeFromEvent()) 
52587          composeEvidenceVariableCharacteristicTimeFromEventComponent(null, e);
52588        closeArray();
52589      };
52590  }
52591
52592  protected void composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent element) throws IOException {
52593    if (element != null) {
52594      open(name);
52595      composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponentProperties(element);
52596      close();
52597    }
52598  }
52599
52600  protected void composeEvidenceVariableCharacteristicDefinitionByTypeAndValueComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicDefinitionByTypeAndValueComponent element) throws IOException {
52601    composeBackboneElementProperties(element);
52602      if (element.hasType()) {
52603        composeCodeableConcept("type", element.getType());
52604      }
52605      if (element.hasMethod()) {
52606        openArray("method");
52607        for (CodeableConcept e : element.getMethod()) 
52608          composeCodeableConcept(null, e);
52609        closeArray();
52610      };
52611      if (element.hasDevice()) {
52612        composeReference("device", element.getDevice());
52613      }
52614      if (element.hasValue()) {
52615        composeType("value", element.getValue());
52616      }
52617      if (element.hasOffset()) {
52618        composeCodeableConcept("offset", element.getOffset());
52619      }
52620  }
52621
52622  protected void composeEvidenceVariableCharacteristicDefinitionByCombinationComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent element) throws IOException {
52623    if (element != null) {
52624      open(name);
52625      composeEvidenceVariableCharacteristicDefinitionByCombinationComponentProperties(element);
52626      close();
52627    }
52628  }
52629
52630  protected void composeEvidenceVariableCharacteristicDefinitionByCombinationComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicDefinitionByCombinationComponent element) throws IOException {
52631    composeBackboneElementProperties(element);
52632      if (element.hasCodeElement()) {
52633        composeEnumerationCore("code", element.getCodeElement(), new EvidenceVariable.CharacteristicCombinationEnumFactory(), false);
52634        composeEnumerationExtras("code", element.getCodeElement(), new EvidenceVariable.CharacteristicCombinationEnumFactory(), false);
52635      }
52636      if (element.hasThresholdElement()) {
52637        composePositiveIntCore("threshold", element.getThresholdElement(), false);
52638        composePositiveIntExtras("threshold", element.getThresholdElement(), false);
52639      }
52640      if (element.hasCharacteristic()) {
52641        openArray("characteristic");
52642        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
52643          composeEvidenceVariableCharacteristicComponent(null, e);
52644        closeArray();
52645      };
52646  }
52647
52648  protected void composeEvidenceVariableCharacteristicTimeFromEventComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent element) throws IOException {
52649    if (element != null) {
52650      open(name);
52651      composeEvidenceVariableCharacteristicTimeFromEventComponentProperties(element);
52652      close();
52653    }
52654  }
52655
52656  protected void composeEvidenceVariableCharacteristicTimeFromEventComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicTimeFromEventComponent element) throws IOException {
52657    composeBackboneElementProperties(element);
52658      if (element.hasDescriptionElement()) {
52659        composeMarkdownCore("description", element.getDescriptionElement(), false);
52660        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52661      }
52662      if (element.hasNote()) {
52663        openArray("note");
52664        for (Annotation e : element.getNote()) 
52665          composeAnnotation(null, e);
52666        closeArray();
52667      };
52668      if (element.hasEvent()) {
52669        composeType("event", element.getEvent());
52670      }
52671      if (element.hasQuantity()) {
52672        composeQuantity("quantity", element.getQuantity());
52673      }
52674      if (element.hasRange()) {
52675        composeRange("range", element.getRange());
52676      }
52677  }
52678
52679  protected void composeEvidenceVariableCategoryComponent(String name, EvidenceVariable.EvidenceVariableCategoryComponent element) throws IOException {
52680    if (element != null) {
52681      open(name);
52682      composeEvidenceVariableCategoryComponentProperties(element);
52683      close();
52684    }
52685  }
52686
52687  protected void composeEvidenceVariableCategoryComponentProperties(EvidenceVariable.EvidenceVariableCategoryComponent element) throws IOException {
52688    composeBackboneElementProperties(element);
52689      if (element.hasNameElement()) {
52690        composeStringCore("name", element.getNameElement(), false);
52691        composeStringExtras("name", element.getNameElement(), false);
52692      }
52693      if (element.hasValue()) {
52694        composeType("value", element.getValue());
52695      }
52696  }
52697
52698  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
52699    if (element != null) {
52700      prop("resourceType", name);
52701      composeExampleScenarioProperties(element);
52702    }
52703  }
52704
52705  protected void composeExampleScenarioProperties(ExampleScenario element) throws IOException {
52706    composeCanonicalResourceProperties(element);
52707      if (element.hasUrlElement()) {
52708        composeUriCore("url", element.getUrlElement(), false);
52709        composeUriExtras("url", element.getUrlElement(), false);
52710      }
52711      if (element.hasIdentifier()) {
52712        openArray("identifier");
52713        for (Identifier e : element.getIdentifier()) 
52714          composeIdentifier(null, e);
52715        closeArray();
52716      };
52717      if (element.hasVersionElement()) {
52718        composeStringCore("version", element.getVersionElement(), false);
52719        composeStringExtras("version", element.getVersionElement(), false);
52720      }
52721      if (element.hasVersionAlgorithm()) {
52722        composeType("versionAlgorithm", element.getVersionAlgorithm());
52723      }
52724      if (element.hasNameElement()) {
52725        composeStringCore("name", element.getNameElement(), false);
52726        composeStringExtras("name", element.getNameElement(), false);
52727      }
52728      if (element.hasTitleElement()) {
52729        composeStringCore("title", element.getTitleElement(), false);
52730        composeStringExtras("title", element.getTitleElement(), false);
52731      }
52732      if (element.hasStatusElement()) {
52733        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52734        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52735      }
52736      if (element.hasExperimentalElement()) {
52737        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52738        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52739      }
52740      if (element.hasDateElement()) {
52741        composeDateTimeCore("date", element.getDateElement(), false);
52742        composeDateTimeExtras("date", element.getDateElement(), false);
52743      }
52744      if (element.hasPublisherElement()) {
52745        composeStringCore("publisher", element.getPublisherElement(), false);
52746        composeStringExtras("publisher", element.getPublisherElement(), false);
52747      }
52748      if (element.hasContact()) {
52749        openArray("contact");
52750        for (ContactDetail e : element.getContact()) 
52751          composeContactDetail(null, e);
52752        closeArray();
52753      };
52754      if (element.hasDescriptionElement()) {
52755        composeMarkdownCore("description", element.getDescriptionElement(), false);
52756        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52757      }
52758      if (element.hasUseContext()) {
52759        openArray("useContext");
52760        for (UsageContext e : element.getUseContext()) 
52761          composeUsageContext(null, e);
52762        closeArray();
52763      };
52764      if (element.hasJurisdiction()) {
52765        openArray("jurisdiction");
52766        for (CodeableConcept e : element.getJurisdiction()) 
52767          composeCodeableConcept(null, e);
52768        closeArray();
52769      };
52770      if (element.hasPurposeElement()) {
52771        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52772        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52773      }
52774      if (element.hasCopyrightElement()) {
52775        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52776        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52777      }
52778      if (element.hasCopyrightLabelElement()) {
52779        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
52780        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
52781      }
52782      if (element.hasActor()) {
52783        openArray("actor");
52784        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
52785          composeExampleScenarioActorComponent(null, e);
52786        closeArray();
52787      };
52788      if (element.hasInstance()) {
52789        openArray("instance");
52790        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
52791          composeExampleScenarioInstanceComponent(null, e);
52792        closeArray();
52793      };
52794      if (element.hasProcess()) {
52795        openArray("process");
52796        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
52797          composeExampleScenarioProcessComponent(null, e);
52798        closeArray();
52799      };
52800  }
52801
52802  protected void composeExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
52803    if (element != null) {
52804      open(name);
52805      composeExampleScenarioActorComponentProperties(element);
52806      close();
52807    }
52808  }
52809
52810  protected void composeExampleScenarioActorComponentProperties(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
52811    composeBackboneElementProperties(element);
52812      if (element.hasKeyElement()) {
52813        composeStringCore("key", element.getKeyElement(), false);
52814        composeStringExtras("key", element.getKeyElement(), false);
52815      }
52816      if (element.hasTypeElement()) {
52817        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
52818        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ExampleScenarioActorTypeEnumFactory(), false);
52819      }
52820      if (element.hasTitleElement()) {
52821        composeStringCore("title", element.getTitleElement(), false);
52822        composeStringExtras("title", element.getTitleElement(), false);
52823      }
52824      if (element.hasDescriptionElement()) {
52825        composeMarkdownCore("description", element.getDescriptionElement(), false);
52826        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52827      }
52828  }
52829
52830  protected void composeExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
52831    if (element != null) {
52832      open(name);
52833      composeExampleScenarioInstanceComponentProperties(element);
52834      close();
52835    }
52836  }
52837
52838  protected void composeExampleScenarioInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
52839    composeBackboneElementProperties(element);
52840      if (element.hasKeyElement()) {
52841        composeStringCore("key", element.getKeyElement(), false);
52842        composeStringExtras("key", element.getKeyElement(), false);
52843      }
52844      if (element.hasStructureType()) {
52845        composeCoding("structureType", element.getStructureType());
52846      }
52847      if (element.hasStructureVersionElement()) {
52848        composeStringCore("structureVersion", element.getStructureVersionElement(), false);
52849        composeStringExtras("structureVersion", element.getStructureVersionElement(), false);
52850      }
52851      if (element.hasStructureProfile()) {
52852        composeType("structureProfile", element.getStructureProfile());
52853      }
52854      if (element.hasTitleElement()) {
52855        composeStringCore("title", element.getTitleElement(), false);
52856        composeStringExtras("title", element.getTitleElement(), false);
52857      }
52858      if (element.hasDescriptionElement()) {
52859        composeMarkdownCore("description", element.getDescriptionElement(), false);
52860        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52861      }
52862      if (element.hasContent()) {
52863        composeReference("content", element.getContent());
52864      }
52865      if (element.hasVersion()) {
52866        openArray("version");
52867        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
52868          composeExampleScenarioInstanceVersionComponent(null, e);
52869        closeArray();
52870      };
52871      if (element.hasContainedInstance()) {
52872        openArray("containedInstance");
52873        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
52874          composeExampleScenarioInstanceContainedInstanceComponent(null, e);
52875        closeArray();
52876      };
52877  }
52878
52879  protected void composeExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
52880    if (element != null) {
52881      open(name);
52882      composeExampleScenarioInstanceVersionComponentProperties(element);
52883      close();
52884    }
52885  }
52886
52887  protected void composeExampleScenarioInstanceVersionComponentProperties(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
52888    composeBackboneElementProperties(element);
52889      if (element.hasKeyElement()) {
52890        composeStringCore("key", element.getKeyElement(), false);
52891        composeStringExtras("key", element.getKeyElement(), false);
52892      }
52893      if (element.hasTitleElement()) {
52894        composeStringCore("title", element.getTitleElement(), false);
52895        composeStringExtras("title", element.getTitleElement(), false);
52896      }
52897      if (element.hasDescriptionElement()) {
52898        composeMarkdownCore("description", element.getDescriptionElement(), false);
52899        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52900      }
52901      if (element.hasContent()) {
52902        composeReference("content", element.getContent());
52903      }
52904  }
52905
52906  protected void composeExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
52907    if (element != null) {
52908      open(name);
52909      composeExampleScenarioInstanceContainedInstanceComponentProperties(element);
52910      close();
52911    }
52912  }
52913
52914  protected void composeExampleScenarioInstanceContainedInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
52915    composeBackboneElementProperties(element);
52916      if (element.hasInstanceReferenceElement()) {
52917        composeStringCore("instanceReference", element.getInstanceReferenceElement(), false);
52918        composeStringExtras("instanceReference", element.getInstanceReferenceElement(), false);
52919      }
52920      if (element.hasVersionReferenceElement()) {
52921        composeStringCore("versionReference", element.getVersionReferenceElement(), false);
52922        composeStringExtras("versionReference", element.getVersionReferenceElement(), false);
52923      }
52924  }
52925
52926  protected void composeExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
52927    if (element != null) {
52928      open(name);
52929      composeExampleScenarioProcessComponentProperties(element);
52930      close();
52931    }
52932  }
52933
52934  protected void composeExampleScenarioProcessComponentProperties(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
52935    composeBackboneElementProperties(element);
52936      if (element.hasTitleElement()) {
52937        composeStringCore("title", element.getTitleElement(), false);
52938        composeStringExtras("title", element.getTitleElement(), false);
52939      }
52940      if (element.hasDescriptionElement()) {
52941        composeMarkdownCore("description", element.getDescriptionElement(), false);
52942        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52943      }
52944      if (element.hasPreConditionsElement()) {
52945        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
52946        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
52947      }
52948      if (element.hasPostConditionsElement()) {
52949        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
52950        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
52951      }
52952      if (element.hasStep()) {
52953        openArray("step");
52954        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
52955          composeExampleScenarioProcessStepComponent(null, e);
52956        closeArray();
52957      };
52958  }
52959
52960  protected void composeExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
52961    if (element != null) {
52962      open(name);
52963      composeExampleScenarioProcessStepComponentProperties(element);
52964      close();
52965    }
52966  }
52967
52968  protected void composeExampleScenarioProcessStepComponentProperties(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
52969    composeBackboneElementProperties(element);
52970      if (element.hasNumberElement()) {
52971        composeStringCore("number", element.getNumberElement(), false);
52972        composeStringExtras("number", element.getNumberElement(), false);
52973      }
52974      if (element.hasProcess()) {
52975        composeExampleScenarioProcessComponent("process", element.getProcess());
52976      }
52977      if (element.hasWorkflowElement()) {
52978        composeCanonicalCore("workflow", element.getWorkflowElement(), false);
52979        composeCanonicalExtras("workflow", element.getWorkflowElement(), false);
52980      }
52981      if (element.hasOperation()) {
52982        composeExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
52983      }
52984      if (element.hasAlternative()) {
52985        openArray("alternative");
52986        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
52987          composeExampleScenarioProcessStepAlternativeComponent(null, e);
52988        closeArray();
52989      };
52990      if (element.hasPauseElement()) {
52991        composeBooleanCore("pause", element.getPauseElement(), false);
52992        composeBooleanExtras("pause", element.getPauseElement(), false);
52993      }
52994  }
52995
52996  protected void composeExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
52997    if (element != null) {
52998      open(name);
52999      composeExampleScenarioProcessStepOperationComponentProperties(element);
53000      close();
53001    }
53002  }
53003
53004  protected void composeExampleScenarioProcessStepOperationComponentProperties(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
53005    composeBackboneElementProperties(element);
53006      if (element.hasType()) {
53007        composeCoding("type", element.getType());
53008      }
53009      if (element.hasTitleElement()) {
53010        composeStringCore("title", element.getTitleElement(), false);
53011        composeStringExtras("title", element.getTitleElement(), false);
53012      }
53013      if (element.hasInitiatorElement()) {
53014        composeStringCore("initiator", element.getInitiatorElement(), false);
53015        composeStringExtras("initiator", element.getInitiatorElement(), false);
53016      }
53017      if (element.hasReceiverElement()) {
53018        composeStringCore("receiver", element.getReceiverElement(), false);
53019        composeStringExtras("receiver", element.getReceiverElement(), false);
53020      }
53021      if (element.hasDescriptionElement()) {
53022        composeMarkdownCore("description", element.getDescriptionElement(), false);
53023        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53024      }
53025      if (element.hasInitiatorActiveElement()) {
53026        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
53027        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
53028      }
53029      if (element.hasReceiverActiveElement()) {
53030        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
53031        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
53032      }
53033      if (element.hasRequest()) {
53034        composeExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
53035      }
53036      if (element.hasResponse()) {
53037        composeExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
53038      }
53039  }
53040
53041  protected void composeExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
53042    if (element != null) {
53043      open(name);
53044      composeExampleScenarioProcessStepAlternativeComponentProperties(element);
53045      close();
53046    }
53047  }
53048
53049  protected void composeExampleScenarioProcessStepAlternativeComponentProperties(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
53050    composeBackboneElementProperties(element);
53051      if (element.hasTitleElement()) {
53052        composeStringCore("title", element.getTitleElement(), false);
53053        composeStringExtras("title", element.getTitleElement(), false);
53054      }
53055      if (element.hasDescriptionElement()) {
53056        composeMarkdownCore("description", element.getDescriptionElement(), false);
53057        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53058      }
53059      if (element.hasStep()) {
53060        openArray("step");
53061        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
53062          composeExampleScenarioProcessStepComponent(null, e);
53063        closeArray();
53064      };
53065  }
53066
53067  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
53068    if (element != null) {
53069      prop("resourceType", name);
53070      composeExplanationOfBenefitProperties(element);
53071    }
53072  }
53073
53074  protected void composeExplanationOfBenefitProperties(ExplanationOfBenefit element) throws IOException {
53075    composeDomainResourceProperties(element);
53076      if (element.hasIdentifier()) {
53077        openArray("identifier");
53078        for (Identifier e : element.getIdentifier()) 
53079          composeIdentifier(null, e);
53080        closeArray();
53081      };
53082      if (element.hasTraceNumber()) {
53083        openArray("traceNumber");
53084        for (Identifier e : element.getTraceNumber()) 
53085          composeIdentifier(null, e);
53086        closeArray();
53087      };
53088      if (element.hasStatusElement()) {
53089        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
53090        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
53091      }
53092      if (element.hasType()) {
53093        composeCodeableConcept("type", element.getType());
53094      }
53095      if (element.hasSubType()) {
53096        composeCodeableConcept("subType", element.getSubType());
53097      }
53098      if (element.hasUseElement()) {
53099        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
53100        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
53101      }
53102      if (element.hasPatient()) {
53103        composeReference("patient", element.getPatient());
53104      }
53105      if (element.hasBillablePeriod()) {
53106        composePeriod("billablePeriod", element.getBillablePeriod());
53107      }
53108      if (element.hasCreatedElement()) {
53109        composeDateTimeCore("created", element.getCreatedElement(), false);
53110        composeDateTimeExtras("created", element.getCreatedElement(), false);
53111      }
53112      if (element.hasEnterer()) {
53113        composeReference("enterer", element.getEnterer());
53114      }
53115      if (element.hasInsurer()) {
53116        composeReference("insurer", element.getInsurer());
53117      }
53118      if (element.hasProvider()) {
53119        composeReference("provider", element.getProvider());
53120      }
53121      if (element.hasPriority()) {
53122        composeCodeableConcept("priority", element.getPriority());
53123      }
53124      if (element.hasFundsReserveRequested()) {
53125        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
53126      }
53127      if (element.hasFundsReserve()) {
53128        composeCodeableConcept("fundsReserve", element.getFundsReserve());
53129      }
53130      if (element.hasRelated()) {
53131        openArray("related");
53132        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
53133          composeRelatedClaimComponent(null, e);
53134        closeArray();
53135      };
53136      if (element.hasPrescription()) {
53137        composeReference("prescription", element.getPrescription());
53138      }
53139      if (element.hasOriginalPrescription()) {
53140        composeReference("originalPrescription", element.getOriginalPrescription());
53141      }
53142      if (element.hasEvent()) {
53143        openArray("event");
53144        for (ExplanationOfBenefit.ExplanationOfBenefitEventComponent e : element.getEvent()) 
53145          composeExplanationOfBenefitEventComponent(null, e);
53146        closeArray();
53147      };
53148      if (element.hasPayee()) {
53149        composePayeeComponent("payee", element.getPayee());
53150      }
53151      if (element.hasReferral()) {
53152        composeReference("referral", element.getReferral());
53153      }
53154      if (element.hasEncounter()) {
53155        openArray("encounter");
53156        for (Reference e : element.getEncounter()) 
53157          composeReference(null, e);
53158        closeArray();
53159      };
53160      if (element.hasFacility()) {
53161        composeReference("facility", element.getFacility());
53162      }
53163      if (element.hasClaim()) {
53164        composeReference("claim", element.getClaim());
53165      }
53166      if (element.hasClaimResponse()) {
53167        composeReference("claimResponse", element.getClaimResponse());
53168      }
53169      if (element.hasOutcomeElement()) {
53170        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
53171        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
53172      }
53173      if (element.hasDecision()) {
53174        composeCodeableConcept("decision", element.getDecision());
53175      }
53176      if (element.hasDispositionElement()) {
53177        composeStringCore("disposition", element.getDispositionElement(), false);
53178        composeStringExtras("disposition", element.getDispositionElement(), false);
53179      }
53180      if (element.hasPreAuthRef()) {
53181        if (anyHasValue(element.getPreAuthRef())) {
53182          openArray("preAuthRef");
53183          for (StringType e : element.getPreAuthRef()) 
53184            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
53185          closeArray();
53186        }
53187        if (anyHasExtras(element.getPreAuthRef())) {
53188          openArray("_preAuthRef");
53189          for (StringType e : element.getPreAuthRef()) 
53190            composeStringExtras(null, e, true);
53191          closeArray();
53192        }
53193      };
53194      if (element.hasPreAuthRefPeriod()) {
53195        openArray("preAuthRefPeriod");
53196        for (Period e : element.getPreAuthRefPeriod()) 
53197          composePeriod(null, e);
53198        closeArray();
53199      };
53200      if (element.hasDiagnosisRelatedGroup()) {
53201        composeCodeableConcept("diagnosisRelatedGroup", element.getDiagnosisRelatedGroup());
53202      }
53203      if (element.hasCareTeam()) {
53204        openArray("careTeam");
53205        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
53206          composeCareTeamComponent(null, e);
53207        closeArray();
53208      };
53209      if (element.hasSupportingInfo()) {
53210        openArray("supportingInfo");
53211        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
53212          composeSupportingInformationComponent(null, e);
53213        closeArray();
53214      };
53215      if (element.hasDiagnosis()) {
53216        openArray("diagnosis");
53217        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
53218          composeDiagnosisComponent(null, e);
53219        closeArray();
53220      };
53221      if (element.hasProcedure()) {
53222        openArray("procedure");
53223        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
53224          composeProcedureComponent(null, e);
53225        closeArray();
53226      };
53227      if (element.hasPrecedenceElement()) {
53228        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
53229        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
53230      }
53231      if (element.hasInsurance()) {
53232        openArray("insurance");
53233        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
53234          composeInsuranceComponent(null, e);
53235        closeArray();
53236      };
53237      if (element.hasAccident()) {
53238        composeAccidentComponent("accident", element.getAccident());
53239      }
53240      if (element.hasPatientPaid()) {
53241        composeMoney("patientPaid", element.getPatientPaid());
53242      }
53243      if (element.hasItem()) {
53244        openArray("item");
53245        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
53246          composeItemComponent(null, e);
53247        closeArray();
53248      };
53249      if (element.hasAddItem()) {
53250        openArray("addItem");
53251        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
53252          composeAddedItemComponent(null, e);
53253        closeArray();
53254      };
53255      if (element.hasAdjudication()) {
53256        openArray("adjudication");
53257        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53258          composeAdjudicationComponent(null, e);
53259        closeArray();
53260      };
53261      if (element.hasTotal()) {
53262        openArray("total");
53263        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
53264          composeTotalComponent(null, e);
53265        closeArray();
53266      };
53267      if (element.hasPayment()) {
53268        composePaymentComponent("payment", element.getPayment());
53269      }
53270      if (element.hasFormCode()) {
53271        composeCodeableConcept("formCode", element.getFormCode());
53272      }
53273      if (element.hasForm()) {
53274        composeAttachment("form", element.getForm());
53275      }
53276      if (element.hasProcessNote()) {
53277        openArray("processNote");
53278        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
53279          composeNoteComponent(null, e);
53280        closeArray();
53281      };
53282      if (element.hasBenefitPeriod()) {
53283        composePeriod("benefitPeriod", element.getBenefitPeriod());
53284      }
53285      if (element.hasBenefitBalance()) {
53286        openArray("benefitBalance");
53287        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
53288          composeBenefitBalanceComponent(null, e);
53289        closeArray();
53290      };
53291  }
53292
53293  protected void composeRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
53294    if (element != null) {
53295      open(name);
53296      composeRelatedClaimComponentProperties(element);
53297      close();
53298    }
53299  }
53300
53301  protected void composeRelatedClaimComponentProperties(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
53302    composeBackboneElementProperties(element);
53303      if (element.hasClaim()) {
53304        composeReference("claim", element.getClaim());
53305      }
53306      if (element.hasRelationship()) {
53307        composeCodeableConcept("relationship", element.getRelationship());
53308      }
53309      if (element.hasReference()) {
53310        composeIdentifier("reference", element.getReference());
53311      }
53312  }
53313
53314  protected void composeExplanationOfBenefitEventComponent(String name, ExplanationOfBenefit.ExplanationOfBenefitEventComponent element) throws IOException {
53315    if (element != null) {
53316      open(name);
53317      composeExplanationOfBenefitEventComponentProperties(element);
53318      close();
53319    }
53320  }
53321
53322  protected void composeExplanationOfBenefitEventComponentProperties(ExplanationOfBenefit.ExplanationOfBenefitEventComponent element) throws IOException {
53323    composeBackboneElementProperties(element);
53324      if (element.hasType()) {
53325        composeCodeableConcept("type", element.getType());
53326      }
53327      if (element.hasWhen()) {
53328        composeType("when", element.getWhen());
53329      }
53330  }
53331
53332  protected void composePayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
53333    if (element != null) {
53334      open(name);
53335      composePayeeComponentProperties(element);
53336      close();
53337    }
53338  }
53339
53340  protected void composePayeeComponentProperties(ExplanationOfBenefit.PayeeComponent element) throws IOException {
53341    composeBackboneElementProperties(element);
53342      if (element.hasType()) {
53343        composeCodeableConcept("type", element.getType());
53344      }
53345      if (element.hasParty()) {
53346        composeReference("party", element.getParty());
53347      }
53348  }
53349
53350  protected void composeCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
53351    if (element != null) {
53352      open(name);
53353      composeCareTeamComponentProperties(element);
53354      close();
53355    }
53356  }
53357
53358  protected void composeCareTeamComponentProperties(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
53359    composeBackboneElementProperties(element);
53360      if (element.hasSequenceElement()) {
53361        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53362        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53363      }
53364      if (element.hasProvider()) {
53365        composeReference("provider", element.getProvider());
53366      }
53367      if (element.hasResponsibleElement()) {
53368        composeBooleanCore("responsible", element.getResponsibleElement(), false);
53369        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
53370      }
53371      if (element.hasRole()) {
53372        composeCodeableConcept("role", element.getRole());
53373      }
53374      if (element.hasSpecialty()) {
53375        composeCodeableConcept("specialty", element.getSpecialty());
53376      }
53377  }
53378
53379  protected void composeSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
53380    if (element != null) {
53381      open(name);
53382      composeSupportingInformationComponentProperties(element);
53383      close();
53384    }
53385  }
53386
53387  protected void composeSupportingInformationComponentProperties(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
53388    composeBackboneElementProperties(element);
53389      if (element.hasSequenceElement()) {
53390        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53391        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53392      }
53393      if (element.hasCategory()) {
53394        composeCodeableConcept("category", element.getCategory());
53395      }
53396      if (element.hasCode()) {
53397        composeCodeableConcept("code", element.getCode());
53398      }
53399      if (element.hasTiming()) {
53400        composeType("timing", element.getTiming());
53401      }
53402      if (element.hasValue()) {
53403        composeType("value", element.getValue());
53404      }
53405      if (element.hasReason()) {
53406        composeCoding("reason", element.getReason());
53407      }
53408  }
53409
53410  protected void composeDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
53411    if (element != null) {
53412      open(name);
53413      composeDiagnosisComponentProperties(element);
53414      close();
53415    }
53416  }
53417
53418  protected void composeDiagnosisComponentProperties(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
53419    composeBackboneElementProperties(element);
53420      if (element.hasSequenceElement()) {
53421        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53422        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53423      }
53424      if (element.hasDiagnosis()) {
53425        composeType("diagnosis", element.getDiagnosis());
53426      }
53427      if (element.hasType()) {
53428        openArray("type");
53429        for (CodeableConcept e : element.getType()) 
53430          composeCodeableConcept(null, e);
53431        closeArray();
53432      };
53433      if (element.hasOnAdmission()) {
53434        composeCodeableConcept("onAdmission", element.getOnAdmission());
53435      }
53436  }
53437
53438  protected void composeProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
53439    if (element != null) {
53440      open(name);
53441      composeProcedureComponentProperties(element);
53442      close();
53443    }
53444  }
53445
53446  protected void composeProcedureComponentProperties(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
53447    composeBackboneElementProperties(element);
53448      if (element.hasSequenceElement()) {
53449        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53450        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53451      }
53452      if (element.hasType()) {
53453        openArray("type");
53454        for (CodeableConcept e : element.getType()) 
53455          composeCodeableConcept(null, e);
53456        closeArray();
53457      };
53458      if (element.hasDateElement()) {
53459        composeDateTimeCore("date", element.getDateElement(), false);
53460        composeDateTimeExtras("date", element.getDateElement(), false);
53461      }
53462      if (element.hasProcedure()) {
53463        composeType("procedure", element.getProcedure());
53464      }
53465      if (element.hasUdi()) {
53466        openArray("udi");
53467        for (Reference e : element.getUdi()) 
53468          composeReference(null, e);
53469        closeArray();
53470      };
53471  }
53472
53473  protected void composeInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
53474    if (element != null) {
53475      open(name);
53476      composeInsuranceComponentProperties(element);
53477      close();
53478    }
53479  }
53480
53481  protected void composeInsuranceComponentProperties(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
53482    composeBackboneElementProperties(element);
53483      if (element.hasFocalElement()) {
53484        composeBooleanCore("focal", element.getFocalElement(), false);
53485        composeBooleanExtras("focal", element.getFocalElement(), false);
53486      }
53487      if (element.hasCoverage()) {
53488        composeReference("coverage", element.getCoverage());
53489      }
53490      if (element.hasPreAuthRef()) {
53491        if (anyHasValue(element.getPreAuthRef())) {
53492          openArray("preAuthRef");
53493          for (StringType e : element.getPreAuthRef()) 
53494            composeStringCore(null, e, e != element.getPreAuthRef().get(element.getPreAuthRef().size()-1));
53495          closeArray();
53496        }
53497        if (anyHasExtras(element.getPreAuthRef())) {
53498          openArray("_preAuthRef");
53499          for (StringType e : element.getPreAuthRef()) 
53500            composeStringExtras(null, e, true);
53501          closeArray();
53502        }
53503      };
53504  }
53505
53506  protected void composeAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
53507    if (element != null) {
53508      open(name);
53509      composeAccidentComponentProperties(element);
53510      close();
53511    }
53512  }
53513
53514  protected void composeAccidentComponentProperties(ExplanationOfBenefit.AccidentComponent element) throws IOException {
53515    composeBackboneElementProperties(element);
53516      if (element.hasDateElement()) {
53517        composeDateCore("date", element.getDateElement(), false);
53518        composeDateExtras("date", element.getDateElement(), false);
53519      }
53520      if (element.hasType()) {
53521        composeCodeableConcept("type", element.getType());
53522      }
53523      if (element.hasLocation()) {
53524        composeType("location", element.getLocation());
53525      }
53526  }
53527
53528  protected void composeItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
53529    if (element != null) {
53530      open(name);
53531      composeItemComponentProperties(element);
53532      close();
53533    }
53534  }
53535
53536  protected void composeItemComponentProperties(ExplanationOfBenefit.ItemComponent element) throws IOException {
53537    composeBackboneElementProperties(element);
53538      if (element.hasSequenceElement()) {
53539        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53540        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53541      }
53542      if (element.hasCareTeamSequence()) {
53543        if (anyHasValue(element.getCareTeamSequence())) {
53544          openArray("careTeamSequence");
53545          for (PositiveIntType e : element.getCareTeamSequence()) 
53546            composePositiveIntCore(null, e, e != element.getCareTeamSequence().get(element.getCareTeamSequence().size()-1));
53547          closeArray();
53548        }
53549        if (anyHasExtras(element.getCareTeamSequence())) {
53550          openArray("_careTeamSequence");
53551          for (PositiveIntType e : element.getCareTeamSequence()) 
53552            composePositiveIntExtras(null, e, true);
53553          closeArray();
53554        }
53555      };
53556      if (element.hasDiagnosisSequence()) {
53557        if (anyHasValue(element.getDiagnosisSequence())) {
53558          openArray("diagnosisSequence");
53559          for (PositiveIntType e : element.getDiagnosisSequence()) 
53560            composePositiveIntCore(null, e, e != element.getDiagnosisSequence().get(element.getDiagnosisSequence().size()-1));
53561          closeArray();
53562        }
53563        if (anyHasExtras(element.getDiagnosisSequence())) {
53564          openArray("_diagnosisSequence");
53565          for (PositiveIntType e : element.getDiagnosisSequence()) 
53566            composePositiveIntExtras(null, e, true);
53567          closeArray();
53568        }
53569      };
53570      if (element.hasProcedureSequence()) {
53571        if (anyHasValue(element.getProcedureSequence())) {
53572          openArray("procedureSequence");
53573          for (PositiveIntType e : element.getProcedureSequence()) 
53574            composePositiveIntCore(null, e, e != element.getProcedureSequence().get(element.getProcedureSequence().size()-1));
53575          closeArray();
53576        }
53577        if (anyHasExtras(element.getProcedureSequence())) {
53578          openArray("_procedureSequence");
53579          for (PositiveIntType e : element.getProcedureSequence()) 
53580            composePositiveIntExtras(null, e, true);
53581          closeArray();
53582        }
53583      };
53584      if (element.hasInformationSequence()) {
53585        if (anyHasValue(element.getInformationSequence())) {
53586          openArray("informationSequence");
53587          for (PositiveIntType e : element.getInformationSequence()) 
53588            composePositiveIntCore(null, e, e != element.getInformationSequence().get(element.getInformationSequence().size()-1));
53589          closeArray();
53590        }
53591        if (anyHasExtras(element.getInformationSequence())) {
53592          openArray("_informationSequence");
53593          for (PositiveIntType e : element.getInformationSequence()) 
53594            composePositiveIntExtras(null, e, true);
53595          closeArray();
53596        }
53597      };
53598      if (element.hasTraceNumber()) {
53599        openArray("traceNumber");
53600        for (Identifier e : element.getTraceNumber()) 
53601          composeIdentifier(null, e);
53602        closeArray();
53603      };
53604      if (element.hasRevenue()) {
53605        composeCodeableConcept("revenue", element.getRevenue());
53606      }
53607      if (element.hasCategory()) {
53608        composeCodeableConcept("category", element.getCategory());
53609      }
53610      if (element.hasProductOrService()) {
53611        composeCodeableConcept("productOrService", element.getProductOrService());
53612      }
53613      if (element.hasProductOrServiceEnd()) {
53614        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
53615      }
53616      if (element.hasRequest()) {
53617        openArray("request");
53618        for (Reference e : element.getRequest()) 
53619          composeReference(null, e);
53620        closeArray();
53621      };
53622      if (element.hasModifier()) {
53623        openArray("modifier");
53624        for (CodeableConcept e : element.getModifier()) 
53625          composeCodeableConcept(null, e);
53626        closeArray();
53627      };
53628      if (element.hasProgramCode()) {
53629        openArray("programCode");
53630        for (CodeableConcept e : element.getProgramCode()) 
53631          composeCodeableConcept(null, e);
53632        closeArray();
53633      };
53634      if (element.hasServiced()) {
53635        composeType("serviced", element.getServiced());
53636      }
53637      if (element.hasLocation()) {
53638        composeType("location", element.getLocation());
53639      }
53640      if (element.hasPatientPaid()) {
53641        composeMoney("patientPaid", element.getPatientPaid());
53642      }
53643      if (element.hasQuantity()) {
53644        composeQuantity("quantity", element.getQuantity());
53645      }
53646      if (element.hasUnitPrice()) {
53647        composeMoney("unitPrice", element.getUnitPrice());
53648      }
53649      if (element.hasFactorElement()) {
53650        composeDecimalCore("factor", element.getFactorElement(), false);
53651        composeDecimalExtras("factor", element.getFactorElement(), false);
53652      }
53653      if (element.hasTax()) {
53654        composeMoney("tax", element.getTax());
53655      }
53656      if (element.hasNet()) {
53657        composeMoney("net", element.getNet());
53658      }
53659      if (element.hasUdi()) {
53660        openArray("udi");
53661        for (Reference e : element.getUdi()) 
53662          composeReference(null, e);
53663        closeArray();
53664      };
53665      if (element.hasBodySite()) {
53666        openArray("bodySite");
53667        for (ExplanationOfBenefit.ItemBodySiteComponent e : element.getBodySite()) 
53668          composeItemBodySiteComponent(null, e);
53669        closeArray();
53670      };
53671      if (element.hasEncounter()) {
53672        openArray("encounter");
53673        for (Reference e : element.getEncounter()) 
53674          composeReference(null, e);
53675        closeArray();
53676      };
53677      if (element.hasNoteNumber()) {
53678        if (anyHasValue(element.getNoteNumber())) {
53679          openArray("noteNumber");
53680          for (PositiveIntType e : element.getNoteNumber()) 
53681            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
53682          closeArray();
53683        }
53684        if (anyHasExtras(element.getNoteNumber())) {
53685          openArray("_noteNumber");
53686          for (PositiveIntType e : element.getNoteNumber()) 
53687            composePositiveIntExtras(null, e, true);
53688          closeArray();
53689        }
53690      };
53691      if (element.hasReviewOutcome()) {
53692        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
53693      }
53694      if (element.hasAdjudication()) {
53695        openArray("adjudication");
53696        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53697          composeAdjudicationComponent(null, e);
53698        closeArray();
53699      };
53700      if (element.hasDetail()) {
53701        openArray("detail");
53702        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
53703          composeDetailComponent(null, e);
53704        closeArray();
53705      };
53706  }
53707
53708  protected void composeItemBodySiteComponent(String name, ExplanationOfBenefit.ItemBodySiteComponent element) throws IOException {
53709    if (element != null) {
53710      open(name);
53711      composeItemBodySiteComponentProperties(element);
53712      close();
53713    }
53714  }
53715
53716  protected void composeItemBodySiteComponentProperties(ExplanationOfBenefit.ItemBodySiteComponent element) throws IOException {
53717    composeBackboneElementProperties(element);
53718      if (element.hasSite()) {
53719        openArray("site");
53720        for (CodeableReference e : element.getSite()) 
53721          composeCodeableReference(null, e);
53722        closeArray();
53723      };
53724      if (element.hasSubSite()) {
53725        openArray("subSite");
53726        for (CodeableConcept e : element.getSubSite()) 
53727          composeCodeableConcept(null, e);
53728        closeArray();
53729      };
53730  }
53731
53732  protected void composeItemReviewOutcomeComponent(String name, ExplanationOfBenefit.ItemReviewOutcomeComponent element) throws IOException {
53733    if (element != null) {
53734      open(name);
53735      composeItemReviewOutcomeComponentProperties(element);
53736      close();
53737    }
53738  }
53739
53740  protected void composeItemReviewOutcomeComponentProperties(ExplanationOfBenefit.ItemReviewOutcomeComponent element) throws IOException {
53741    composeBackboneElementProperties(element);
53742      if (element.hasDecision()) {
53743        composeCodeableConcept("decision", element.getDecision());
53744      }
53745      if (element.hasReason()) {
53746        openArray("reason");
53747        for (CodeableConcept e : element.getReason()) 
53748          composeCodeableConcept(null, e);
53749        closeArray();
53750      };
53751      if (element.hasPreAuthRefElement()) {
53752        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
53753        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
53754      }
53755      if (element.hasPreAuthPeriod()) {
53756        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
53757      }
53758  }
53759
53760  protected void composeAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
53761    if (element != null) {
53762      open(name);
53763      composeAdjudicationComponentProperties(element);
53764      close();
53765    }
53766  }
53767
53768  protected void composeAdjudicationComponentProperties(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
53769    composeBackboneElementProperties(element);
53770      if (element.hasCategory()) {
53771        composeCodeableConcept("category", element.getCategory());
53772      }
53773      if (element.hasReason()) {
53774        composeCodeableConcept("reason", element.getReason());
53775      }
53776      if (element.hasAmount()) {
53777        composeMoney("amount", element.getAmount());
53778      }
53779      if (element.hasQuantity()) {
53780        composeQuantity("quantity", element.getQuantity());
53781      }
53782  }
53783
53784  protected void composeDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
53785    if (element != null) {
53786      open(name);
53787      composeDetailComponentProperties(element);
53788      close();
53789    }
53790  }
53791
53792  protected void composeDetailComponentProperties(ExplanationOfBenefit.DetailComponent element) throws IOException {
53793    composeBackboneElementProperties(element);
53794      if (element.hasSequenceElement()) {
53795        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53796        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53797      }
53798      if (element.hasTraceNumber()) {
53799        openArray("traceNumber");
53800        for (Identifier e : element.getTraceNumber()) 
53801          composeIdentifier(null, e);
53802        closeArray();
53803      };
53804      if (element.hasRevenue()) {
53805        composeCodeableConcept("revenue", element.getRevenue());
53806      }
53807      if (element.hasCategory()) {
53808        composeCodeableConcept("category", element.getCategory());
53809      }
53810      if (element.hasProductOrService()) {
53811        composeCodeableConcept("productOrService", element.getProductOrService());
53812      }
53813      if (element.hasProductOrServiceEnd()) {
53814        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
53815      }
53816      if (element.hasModifier()) {
53817        openArray("modifier");
53818        for (CodeableConcept e : element.getModifier()) 
53819          composeCodeableConcept(null, e);
53820        closeArray();
53821      };
53822      if (element.hasProgramCode()) {
53823        openArray("programCode");
53824        for (CodeableConcept e : element.getProgramCode()) 
53825          composeCodeableConcept(null, e);
53826        closeArray();
53827      };
53828      if (element.hasPatientPaid()) {
53829        composeMoney("patientPaid", element.getPatientPaid());
53830      }
53831      if (element.hasQuantity()) {
53832        composeQuantity("quantity", element.getQuantity());
53833      }
53834      if (element.hasUnitPrice()) {
53835        composeMoney("unitPrice", element.getUnitPrice());
53836      }
53837      if (element.hasFactorElement()) {
53838        composeDecimalCore("factor", element.getFactorElement(), false);
53839        composeDecimalExtras("factor", element.getFactorElement(), false);
53840      }
53841      if (element.hasTax()) {
53842        composeMoney("tax", element.getTax());
53843      }
53844      if (element.hasNet()) {
53845        composeMoney("net", element.getNet());
53846      }
53847      if (element.hasUdi()) {
53848        openArray("udi");
53849        for (Reference e : element.getUdi()) 
53850          composeReference(null, e);
53851        closeArray();
53852      };
53853      if (element.hasNoteNumber()) {
53854        if (anyHasValue(element.getNoteNumber())) {
53855          openArray("noteNumber");
53856          for (PositiveIntType e : element.getNoteNumber()) 
53857            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
53858          closeArray();
53859        }
53860        if (anyHasExtras(element.getNoteNumber())) {
53861          openArray("_noteNumber");
53862          for (PositiveIntType e : element.getNoteNumber()) 
53863            composePositiveIntExtras(null, e, true);
53864          closeArray();
53865        }
53866      };
53867      if (element.hasReviewOutcome()) {
53868        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
53869      }
53870      if (element.hasAdjudication()) {
53871        openArray("adjudication");
53872        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53873          composeAdjudicationComponent(null, e);
53874        closeArray();
53875      };
53876      if (element.hasSubDetail()) {
53877        openArray("subDetail");
53878        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
53879          composeSubDetailComponent(null, e);
53880        closeArray();
53881      };
53882  }
53883
53884  protected void composeSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
53885    if (element != null) {
53886      open(name);
53887      composeSubDetailComponentProperties(element);
53888      close();
53889    }
53890  }
53891
53892  protected void composeSubDetailComponentProperties(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
53893    composeBackboneElementProperties(element);
53894      if (element.hasSequenceElement()) {
53895        composePositiveIntCore("sequence", element.getSequenceElement(), false);
53896        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
53897      }
53898      if (element.hasTraceNumber()) {
53899        openArray("traceNumber");
53900        for (Identifier e : element.getTraceNumber()) 
53901          composeIdentifier(null, e);
53902        closeArray();
53903      };
53904      if (element.hasRevenue()) {
53905        composeCodeableConcept("revenue", element.getRevenue());
53906      }
53907      if (element.hasCategory()) {
53908        composeCodeableConcept("category", element.getCategory());
53909      }
53910      if (element.hasProductOrService()) {
53911        composeCodeableConcept("productOrService", element.getProductOrService());
53912      }
53913      if (element.hasProductOrServiceEnd()) {
53914        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
53915      }
53916      if (element.hasModifier()) {
53917        openArray("modifier");
53918        for (CodeableConcept e : element.getModifier()) 
53919          composeCodeableConcept(null, e);
53920        closeArray();
53921      };
53922      if (element.hasProgramCode()) {
53923        openArray("programCode");
53924        for (CodeableConcept e : element.getProgramCode()) 
53925          composeCodeableConcept(null, e);
53926        closeArray();
53927      };
53928      if (element.hasPatientPaid()) {
53929        composeMoney("patientPaid", element.getPatientPaid());
53930      }
53931      if (element.hasQuantity()) {
53932        composeQuantity("quantity", element.getQuantity());
53933      }
53934      if (element.hasUnitPrice()) {
53935        composeMoney("unitPrice", element.getUnitPrice());
53936      }
53937      if (element.hasFactorElement()) {
53938        composeDecimalCore("factor", element.getFactorElement(), false);
53939        composeDecimalExtras("factor", element.getFactorElement(), false);
53940      }
53941      if (element.hasTax()) {
53942        composeMoney("tax", element.getTax());
53943      }
53944      if (element.hasNet()) {
53945        composeMoney("net", element.getNet());
53946      }
53947      if (element.hasUdi()) {
53948        openArray("udi");
53949        for (Reference e : element.getUdi()) 
53950          composeReference(null, e);
53951        closeArray();
53952      };
53953      if (element.hasNoteNumber()) {
53954        if (anyHasValue(element.getNoteNumber())) {
53955          openArray("noteNumber");
53956          for (PositiveIntType e : element.getNoteNumber()) 
53957            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
53958          closeArray();
53959        }
53960        if (anyHasExtras(element.getNoteNumber())) {
53961          openArray("_noteNumber");
53962          for (PositiveIntType e : element.getNoteNumber()) 
53963            composePositiveIntExtras(null, e, true);
53964          closeArray();
53965        }
53966      };
53967      if (element.hasReviewOutcome()) {
53968        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
53969      }
53970      if (element.hasAdjudication()) {
53971        openArray("adjudication");
53972        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
53973          composeAdjudicationComponent(null, e);
53974        closeArray();
53975      };
53976  }
53977
53978  protected void composeAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
53979    if (element != null) {
53980      open(name);
53981      composeAddedItemComponentProperties(element);
53982      close();
53983    }
53984  }
53985
53986  protected void composeAddedItemComponentProperties(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
53987    composeBackboneElementProperties(element);
53988      if (element.hasItemSequence()) {
53989        if (anyHasValue(element.getItemSequence())) {
53990          openArray("itemSequence");
53991          for (PositiveIntType e : element.getItemSequence()) 
53992            composePositiveIntCore(null, e, e != element.getItemSequence().get(element.getItemSequence().size()-1));
53993          closeArray();
53994        }
53995        if (anyHasExtras(element.getItemSequence())) {
53996          openArray("_itemSequence");
53997          for (PositiveIntType e : element.getItemSequence()) 
53998            composePositiveIntExtras(null, e, true);
53999          closeArray();
54000        }
54001      };
54002      if (element.hasDetailSequence()) {
54003        if (anyHasValue(element.getDetailSequence())) {
54004          openArray("detailSequence");
54005          for (PositiveIntType e : element.getDetailSequence()) 
54006            composePositiveIntCore(null, e, e != element.getDetailSequence().get(element.getDetailSequence().size()-1));
54007          closeArray();
54008        }
54009        if (anyHasExtras(element.getDetailSequence())) {
54010          openArray("_detailSequence");
54011          for (PositiveIntType e : element.getDetailSequence()) 
54012            composePositiveIntExtras(null, e, true);
54013          closeArray();
54014        }
54015      };
54016      if (element.hasSubDetailSequence()) {
54017        if (anyHasValue(element.getSubDetailSequence())) {
54018          openArray("subDetailSequence");
54019          for (PositiveIntType e : element.getSubDetailSequence()) 
54020            composePositiveIntCore(null, e, e != element.getSubDetailSequence().get(element.getSubDetailSequence().size()-1));
54021          closeArray();
54022        }
54023        if (anyHasExtras(element.getSubDetailSequence())) {
54024          openArray("_subDetailSequence");
54025          for (PositiveIntType e : element.getSubDetailSequence()) 
54026            composePositiveIntExtras(null, e, true);
54027          closeArray();
54028        }
54029      };
54030      if (element.hasTraceNumber()) {
54031        openArray("traceNumber");
54032        for (Identifier e : element.getTraceNumber()) 
54033          composeIdentifier(null, e);
54034        closeArray();
54035      };
54036      if (element.hasProvider()) {
54037        openArray("provider");
54038        for (Reference e : element.getProvider()) 
54039          composeReference(null, e);
54040        closeArray();
54041      };
54042      if (element.hasRevenue()) {
54043        composeCodeableConcept("revenue", element.getRevenue());
54044      }
54045      if (element.hasProductOrService()) {
54046        composeCodeableConcept("productOrService", element.getProductOrService());
54047      }
54048      if (element.hasProductOrServiceEnd()) {
54049        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
54050      }
54051      if (element.hasRequest()) {
54052        openArray("request");
54053        for (Reference e : element.getRequest()) 
54054          composeReference(null, e);
54055        closeArray();
54056      };
54057      if (element.hasModifier()) {
54058        openArray("modifier");
54059        for (CodeableConcept e : element.getModifier()) 
54060          composeCodeableConcept(null, e);
54061        closeArray();
54062      };
54063      if (element.hasProgramCode()) {
54064        openArray("programCode");
54065        for (CodeableConcept e : element.getProgramCode()) 
54066          composeCodeableConcept(null, e);
54067        closeArray();
54068      };
54069      if (element.hasServiced()) {
54070        composeType("serviced", element.getServiced());
54071      }
54072      if (element.hasLocation()) {
54073        composeType("location", element.getLocation());
54074      }
54075      if (element.hasPatientPaid()) {
54076        composeMoney("patientPaid", element.getPatientPaid());
54077      }
54078      if (element.hasQuantity()) {
54079        composeQuantity("quantity", element.getQuantity());
54080      }
54081      if (element.hasUnitPrice()) {
54082        composeMoney("unitPrice", element.getUnitPrice());
54083      }
54084      if (element.hasFactorElement()) {
54085        composeDecimalCore("factor", element.getFactorElement(), false);
54086        composeDecimalExtras("factor", element.getFactorElement(), false);
54087      }
54088      if (element.hasTax()) {
54089        composeMoney("tax", element.getTax());
54090      }
54091      if (element.hasNet()) {
54092        composeMoney("net", element.getNet());
54093      }
54094      if (element.hasBodySite()) {
54095        openArray("bodySite");
54096        for (ExplanationOfBenefit.AddedItemBodySiteComponent e : element.getBodySite()) 
54097          composeAddedItemBodySiteComponent(null, e);
54098        closeArray();
54099      };
54100      if (element.hasNoteNumber()) {
54101        if (anyHasValue(element.getNoteNumber())) {
54102          openArray("noteNumber");
54103          for (PositiveIntType e : element.getNoteNumber()) 
54104            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
54105          closeArray();
54106        }
54107        if (anyHasExtras(element.getNoteNumber())) {
54108          openArray("_noteNumber");
54109          for (PositiveIntType e : element.getNoteNumber()) 
54110            composePositiveIntExtras(null, e, true);
54111          closeArray();
54112        }
54113      };
54114      if (element.hasReviewOutcome()) {
54115        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
54116      }
54117      if (element.hasAdjudication()) {
54118        openArray("adjudication");
54119        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
54120          composeAdjudicationComponent(null, e);
54121        closeArray();
54122      };
54123      if (element.hasDetail()) {
54124        openArray("detail");
54125        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
54126          composeAddedItemDetailComponent(null, e);
54127        closeArray();
54128      };
54129  }
54130
54131  protected void composeAddedItemBodySiteComponent(String name, ExplanationOfBenefit.AddedItemBodySiteComponent element) throws IOException {
54132    if (element != null) {
54133      open(name);
54134      composeAddedItemBodySiteComponentProperties(element);
54135      close();
54136    }
54137  }
54138
54139  protected void composeAddedItemBodySiteComponentProperties(ExplanationOfBenefit.AddedItemBodySiteComponent element) throws IOException {
54140    composeBackboneElementProperties(element);
54141      if (element.hasSite()) {
54142        openArray("site");
54143        for (CodeableReference e : element.getSite()) 
54144          composeCodeableReference(null, e);
54145        closeArray();
54146      };
54147      if (element.hasSubSite()) {
54148        openArray("subSite");
54149        for (CodeableConcept e : element.getSubSite()) 
54150          composeCodeableConcept(null, e);
54151        closeArray();
54152      };
54153  }
54154
54155  protected void composeAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
54156    if (element != null) {
54157      open(name);
54158      composeAddedItemDetailComponentProperties(element);
54159      close();
54160    }
54161  }
54162
54163  protected void composeAddedItemDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
54164    composeBackboneElementProperties(element);
54165      if (element.hasTraceNumber()) {
54166        openArray("traceNumber");
54167        for (Identifier e : element.getTraceNumber()) 
54168          composeIdentifier(null, e);
54169        closeArray();
54170      };
54171      if (element.hasRevenue()) {
54172        composeCodeableConcept("revenue", element.getRevenue());
54173      }
54174      if (element.hasProductOrService()) {
54175        composeCodeableConcept("productOrService", element.getProductOrService());
54176      }
54177      if (element.hasProductOrServiceEnd()) {
54178        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
54179      }
54180      if (element.hasModifier()) {
54181        openArray("modifier");
54182        for (CodeableConcept e : element.getModifier()) 
54183          composeCodeableConcept(null, e);
54184        closeArray();
54185      };
54186      if (element.hasPatientPaid()) {
54187        composeMoney("patientPaid", element.getPatientPaid());
54188      }
54189      if (element.hasQuantity()) {
54190        composeQuantity("quantity", element.getQuantity());
54191      }
54192      if (element.hasUnitPrice()) {
54193        composeMoney("unitPrice", element.getUnitPrice());
54194      }
54195      if (element.hasFactorElement()) {
54196        composeDecimalCore("factor", element.getFactorElement(), false);
54197        composeDecimalExtras("factor", element.getFactorElement(), false);
54198      }
54199      if (element.hasTax()) {
54200        composeMoney("tax", element.getTax());
54201      }
54202      if (element.hasNet()) {
54203        composeMoney("net", element.getNet());
54204      }
54205      if (element.hasNoteNumber()) {
54206        if (anyHasValue(element.getNoteNumber())) {
54207          openArray("noteNumber");
54208          for (PositiveIntType e : element.getNoteNumber()) 
54209            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
54210          closeArray();
54211        }
54212        if (anyHasExtras(element.getNoteNumber())) {
54213          openArray("_noteNumber");
54214          for (PositiveIntType e : element.getNoteNumber()) 
54215            composePositiveIntExtras(null, e, true);
54216          closeArray();
54217        }
54218      };
54219      if (element.hasReviewOutcome()) {
54220        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
54221      }
54222      if (element.hasAdjudication()) {
54223        openArray("adjudication");
54224        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
54225          composeAdjudicationComponent(null, e);
54226        closeArray();
54227      };
54228      if (element.hasSubDetail()) {
54229        openArray("subDetail");
54230        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
54231          composeAddedItemDetailSubDetailComponent(null, e);
54232        closeArray();
54233      };
54234  }
54235
54236  protected void composeAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
54237    if (element != null) {
54238      open(name);
54239      composeAddedItemDetailSubDetailComponentProperties(element);
54240      close();
54241    }
54242  }
54243
54244  protected void composeAddedItemDetailSubDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
54245    composeBackboneElementProperties(element);
54246      if (element.hasTraceNumber()) {
54247        openArray("traceNumber");
54248        for (Identifier e : element.getTraceNumber()) 
54249          composeIdentifier(null, e);
54250        closeArray();
54251      };
54252      if (element.hasRevenue()) {
54253        composeCodeableConcept("revenue", element.getRevenue());
54254      }
54255      if (element.hasProductOrService()) {
54256        composeCodeableConcept("productOrService", element.getProductOrService());
54257      }
54258      if (element.hasProductOrServiceEnd()) {
54259        composeCodeableConcept("productOrServiceEnd", element.getProductOrServiceEnd());
54260      }
54261      if (element.hasModifier()) {
54262        openArray("modifier");
54263        for (CodeableConcept e : element.getModifier()) 
54264          composeCodeableConcept(null, e);
54265        closeArray();
54266      };
54267      if (element.hasPatientPaid()) {
54268        composeMoney("patientPaid", element.getPatientPaid());
54269      }
54270      if (element.hasQuantity()) {
54271        composeQuantity("quantity", element.getQuantity());
54272      }
54273      if (element.hasUnitPrice()) {
54274        composeMoney("unitPrice", element.getUnitPrice());
54275      }
54276      if (element.hasFactorElement()) {
54277        composeDecimalCore("factor", element.getFactorElement(), false);
54278        composeDecimalExtras("factor", element.getFactorElement(), false);
54279      }
54280      if (element.hasTax()) {
54281        composeMoney("tax", element.getTax());
54282      }
54283      if (element.hasNet()) {
54284        composeMoney("net", element.getNet());
54285      }
54286      if (element.hasNoteNumber()) {
54287        if (anyHasValue(element.getNoteNumber())) {
54288          openArray("noteNumber");
54289          for (PositiveIntType e : element.getNoteNumber()) 
54290            composePositiveIntCore(null, e, e != element.getNoteNumber().get(element.getNoteNumber().size()-1));
54291          closeArray();
54292        }
54293        if (anyHasExtras(element.getNoteNumber())) {
54294          openArray("_noteNumber");
54295          for (PositiveIntType e : element.getNoteNumber()) 
54296            composePositiveIntExtras(null, e, true);
54297          closeArray();
54298        }
54299      };
54300      if (element.hasReviewOutcome()) {
54301        composeItemReviewOutcomeComponent("reviewOutcome", element.getReviewOutcome());
54302      }
54303      if (element.hasAdjudication()) {
54304        openArray("adjudication");
54305        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
54306          composeAdjudicationComponent(null, e);
54307        closeArray();
54308      };
54309  }
54310
54311  protected void composeTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
54312    if (element != null) {
54313      open(name);
54314      composeTotalComponentProperties(element);
54315      close();
54316    }
54317  }
54318
54319  protected void composeTotalComponentProperties(ExplanationOfBenefit.TotalComponent element) throws IOException {
54320    composeBackboneElementProperties(element);
54321      if (element.hasCategory()) {
54322        composeCodeableConcept("category", element.getCategory());
54323      }
54324      if (element.hasAmount()) {
54325        composeMoney("amount", element.getAmount());
54326      }
54327  }
54328
54329  protected void composePaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
54330    if (element != null) {
54331      open(name);
54332      composePaymentComponentProperties(element);
54333      close();
54334    }
54335  }
54336
54337  protected void composePaymentComponentProperties(ExplanationOfBenefit.PaymentComponent element) throws IOException {
54338    composeBackboneElementProperties(element);
54339      if (element.hasType()) {
54340        composeCodeableConcept("type", element.getType());
54341      }
54342      if (element.hasAdjustment()) {
54343        composeMoney("adjustment", element.getAdjustment());
54344      }
54345      if (element.hasAdjustmentReason()) {
54346        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
54347      }
54348      if (element.hasDateElement()) {
54349        composeDateCore("date", element.getDateElement(), false);
54350        composeDateExtras("date", element.getDateElement(), false);
54351      }
54352      if (element.hasAmount()) {
54353        composeMoney("amount", element.getAmount());
54354      }
54355      if (element.hasIdentifier()) {
54356        composeIdentifier("identifier", element.getIdentifier());
54357      }
54358  }
54359
54360  protected void composeNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
54361    if (element != null) {
54362      open(name);
54363      composeNoteComponentProperties(element);
54364      close();
54365    }
54366  }
54367
54368  protected void composeNoteComponentProperties(ExplanationOfBenefit.NoteComponent element) throws IOException {
54369    composeBackboneElementProperties(element);
54370      if (element.hasNumberElement()) {
54371        composePositiveIntCore("number", element.getNumberElement(), false);
54372        composePositiveIntExtras("number", element.getNumberElement(), false);
54373      }
54374      if (element.hasType()) {
54375        composeCodeableConcept("type", element.getType());
54376      }
54377      if (element.hasTextElement()) {
54378        composeStringCore("text", element.getTextElement(), false);
54379        composeStringExtras("text", element.getTextElement(), false);
54380      }
54381      if (element.hasLanguage()) {
54382        composeCodeableConcept("language", element.getLanguage());
54383      }
54384  }
54385
54386  protected void composeBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
54387    if (element != null) {
54388      open(name);
54389      composeBenefitBalanceComponentProperties(element);
54390      close();
54391    }
54392  }
54393
54394  protected void composeBenefitBalanceComponentProperties(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
54395    composeBackboneElementProperties(element);
54396      if (element.hasCategory()) {
54397        composeCodeableConcept("category", element.getCategory());
54398      }
54399      if (element.hasExcludedElement()) {
54400        composeBooleanCore("excluded", element.getExcludedElement(), false);
54401        composeBooleanExtras("excluded", element.getExcludedElement(), false);
54402      }
54403      if (element.hasNameElement()) {
54404        composeStringCore("name", element.getNameElement(), false);
54405        composeStringExtras("name", element.getNameElement(), false);
54406      }
54407      if (element.hasDescriptionElement()) {
54408        composeStringCore("description", element.getDescriptionElement(), false);
54409        composeStringExtras("description", element.getDescriptionElement(), false);
54410      }
54411      if (element.hasNetwork()) {
54412        composeCodeableConcept("network", element.getNetwork());
54413      }
54414      if (element.hasUnit()) {
54415        composeCodeableConcept("unit", element.getUnit());
54416      }
54417      if (element.hasTerm()) {
54418        composeCodeableConcept("term", element.getTerm());
54419      }
54420      if (element.hasFinancial()) {
54421        openArray("financial");
54422        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
54423          composeBenefitComponent(null, e);
54424        closeArray();
54425      };
54426  }
54427
54428  protected void composeBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
54429    if (element != null) {
54430      open(name);
54431      composeBenefitComponentProperties(element);
54432      close();
54433    }
54434  }
54435
54436  protected void composeBenefitComponentProperties(ExplanationOfBenefit.BenefitComponent element) throws IOException {
54437    composeBackboneElementProperties(element);
54438      if (element.hasType()) {
54439        composeCodeableConcept("type", element.getType());
54440      }
54441      if (element.hasAllowed()) {
54442        composeType("allowed", element.getAllowed());
54443      }
54444      if (element.hasUsed()) {
54445        composeType("used", element.getUsed());
54446      }
54447  }
54448
54449  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
54450    if (element != null) {
54451      prop("resourceType", name);
54452      composeFamilyMemberHistoryProperties(element);
54453    }
54454  }
54455
54456  protected void composeFamilyMemberHistoryProperties(FamilyMemberHistory element) throws IOException {
54457    composeDomainResourceProperties(element);
54458      if (element.hasIdentifier()) {
54459        openArray("identifier");
54460        for (Identifier e : element.getIdentifier()) 
54461          composeIdentifier(null, e);
54462        closeArray();
54463      };
54464      if (element.hasInstantiatesCanonical()) {
54465        if (anyHasValue(element.getInstantiatesCanonical())) {
54466          openArray("instantiatesCanonical");
54467          for (CanonicalType e : element.getInstantiatesCanonical()) 
54468            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
54469          closeArray();
54470        }
54471        if (anyHasExtras(element.getInstantiatesCanonical())) {
54472          openArray("_instantiatesCanonical");
54473          for (CanonicalType e : element.getInstantiatesCanonical()) 
54474            composeCanonicalExtras(null, e, true);
54475          closeArray();
54476        }
54477      };
54478      if (element.hasInstantiatesUri()) {
54479        if (anyHasValue(element.getInstantiatesUri())) {
54480          openArray("instantiatesUri");
54481          for (UriType e : element.getInstantiatesUri()) 
54482            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
54483          closeArray();
54484        }
54485        if (anyHasExtras(element.getInstantiatesUri())) {
54486          openArray("_instantiatesUri");
54487          for (UriType e : element.getInstantiatesUri()) 
54488            composeUriExtras(null, e, true);
54489          closeArray();
54490        }
54491      };
54492      if (element.hasStatusElement()) {
54493        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
54494        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
54495      }
54496      if (element.hasDataAbsentReason()) {
54497        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
54498      }
54499      if (element.hasPatient()) {
54500        composeReference("patient", element.getPatient());
54501      }
54502      if (element.hasDateElement()) {
54503        composeDateTimeCore("date", element.getDateElement(), false);
54504        composeDateTimeExtras("date", element.getDateElement(), false);
54505      }
54506      if (element.hasParticipant()) {
54507        openArray("participant");
54508        for (FamilyMemberHistory.FamilyMemberHistoryParticipantComponent e : element.getParticipant()) 
54509          composeFamilyMemberHistoryParticipantComponent(null, e);
54510        closeArray();
54511      };
54512      if (element.hasNameElement()) {
54513        composeStringCore("name", element.getNameElement(), false);
54514        composeStringExtras("name", element.getNameElement(), false);
54515      }
54516      if (element.hasRelationship()) {
54517        composeCodeableConcept("relationship", element.getRelationship());
54518      }
54519      if (element.hasSex()) {
54520        composeCodeableConcept("sex", element.getSex());
54521      }
54522      if (element.hasBorn()) {
54523        composeType("born", element.getBorn());
54524      }
54525      if (element.hasAge()) {
54526        composeType("age", element.getAge());
54527      }
54528      if (element.hasEstimatedAgeElement()) {
54529        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
54530        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
54531      }
54532      if (element.hasDeceased()) {
54533        composeType("deceased", element.getDeceased());
54534      }
54535      if (element.hasReason()) {
54536        openArray("reason");
54537        for (CodeableReference e : element.getReason()) 
54538          composeCodeableReference(null, e);
54539        closeArray();
54540      };
54541      if (element.hasNote()) {
54542        openArray("note");
54543        for (Annotation e : element.getNote()) 
54544          composeAnnotation(null, e);
54545        closeArray();
54546      };
54547      if (element.hasCondition()) {
54548        openArray("condition");
54549        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
54550          composeFamilyMemberHistoryConditionComponent(null, e);
54551        closeArray();
54552      };
54553      if (element.hasProcedure()) {
54554        openArray("procedure");
54555        for (FamilyMemberHistory.FamilyMemberHistoryProcedureComponent e : element.getProcedure()) 
54556          composeFamilyMemberHistoryProcedureComponent(null, e);
54557        closeArray();
54558      };
54559  }
54560
54561  protected void composeFamilyMemberHistoryParticipantComponent(String name, FamilyMemberHistory.FamilyMemberHistoryParticipantComponent element) throws IOException {
54562    if (element != null) {
54563      open(name);
54564      composeFamilyMemberHistoryParticipantComponentProperties(element);
54565      close();
54566    }
54567  }
54568
54569  protected void composeFamilyMemberHistoryParticipantComponentProperties(FamilyMemberHistory.FamilyMemberHistoryParticipantComponent element) throws IOException {
54570    composeBackboneElementProperties(element);
54571      if (element.hasFunction()) {
54572        composeCodeableConcept("function", element.getFunction());
54573      }
54574      if (element.hasActor()) {
54575        composeReference("actor", element.getActor());
54576      }
54577  }
54578
54579  protected void composeFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
54580    if (element != null) {
54581      open(name);
54582      composeFamilyMemberHistoryConditionComponentProperties(element);
54583      close();
54584    }
54585  }
54586
54587  protected void composeFamilyMemberHistoryConditionComponentProperties(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
54588    composeBackboneElementProperties(element);
54589      if (element.hasCode()) {
54590        composeCodeableConcept("code", element.getCode());
54591      }
54592      if (element.hasOutcome()) {
54593        composeCodeableConcept("outcome", element.getOutcome());
54594      }
54595      if (element.hasContributedToDeathElement()) {
54596        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
54597        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
54598      }
54599      if (element.hasOnset()) {
54600        composeType("onset", element.getOnset());
54601      }
54602      if (element.hasNote()) {
54603        openArray("note");
54604        for (Annotation e : element.getNote()) 
54605          composeAnnotation(null, e);
54606        closeArray();
54607      };
54608  }
54609
54610  protected void composeFamilyMemberHistoryProcedureComponent(String name, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
54611    if (element != null) {
54612      open(name);
54613      composeFamilyMemberHistoryProcedureComponentProperties(element);
54614      close();
54615    }
54616  }
54617
54618  protected void composeFamilyMemberHistoryProcedureComponentProperties(FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
54619    composeBackboneElementProperties(element);
54620      if (element.hasCode()) {
54621        composeCodeableConcept("code", element.getCode());
54622      }
54623      if (element.hasOutcome()) {
54624        composeCodeableConcept("outcome", element.getOutcome());
54625      }
54626      if (element.hasContributedToDeathElement()) {
54627        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
54628        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
54629      }
54630      if (element.hasPerformed()) {
54631        composeType("performed", element.getPerformed());
54632      }
54633      if (element.hasNote()) {
54634        openArray("note");
54635        for (Annotation e : element.getNote()) 
54636          composeAnnotation(null, e);
54637        closeArray();
54638      };
54639  }
54640
54641  protected void composeFlag(String name, Flag element) throws IOException {
54642    if (element != null) {
54643      prop("resourceType", name);
54644      composeFlagProperties(element);
54645    }
54646  }
54647
54648  protected void composeFlagProperties(Flag element) throws IOException {
54649    composeDomainResourceProperties(element);
54650      if (element.hasIdentifier()) {
54651        openArray("identifier");
54652        for (Identifier e : element.getIdentifier()) 
54653          composeIdentifier(null, e);
54654        closeArray();
54655      };
54656      if (element.hasStatusElement()) {
54657        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
54658        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
54659      }
54660      if (element.hasCategory()) {
54661        openArray("category");
54662        for (CodeableConcept e : element.getCategory()) 
54663          composeCodeableConcept(null, e);
54664        closeArray();
54665      };
54666      if (element.hasCode()) {
54667        composeCodeableConcept("code", element.getCode());
54668      }
54669      if (element.hasSubject()) {
54670        composeReference("subject", element.getSubject());
54671      }
54672      if (element.hasPeriod()) {
54673        composePeriod("period", element.getPeriod());
54674      }
54675      if (element.hasEncounter()) {
54676        composeReference("encounter", element.getEncounter());
54677      }
54678      if (element.hasAuthor()) {
54679        composeReference("author", element.getAuthor());
54680      }
54681  }
54682
54683  protected void composeFormularyItem(String name, FormularyItem element) throws IOException {
54684    if (element != null) {
54685      prop("resourceType", name);
54686      composeFormularyItemProperties(element);
54687    }
54688  }
54689
54690  protected void composeFormularyItemProperties(FormularyItem element) throws IOException {
54691    composeDomainResourceProperties(element);
54692      if (element.hasIdentifier()) {
54693        openArray("identifier");
54694        for (Identifier e : element.getIdentifier()) 
54695          composeIdentifier(null, e);
54696        closeArray();
54697      };
54698      if (element.hasCode()) {
54699        composeCodeableConcept("code", element.getCode());
54700      }
54701      if (element.hasStatusElement()) {
54702        composeEnumerationCore("status", element.getStatusElement(), new FormularyItem.FormularyItemStatusCodesEnumFactory(), false);
54703        composeEnumerationExtras("status", element.getStatusElement(), new FormularyItem.FormularyItemStatusCodesEnumFactory(), false);
54704      }
54705  }
54706
54707  protected void composeGenomicStudy(String name, GenomicStudy element) throws IOException {
54708    if (element != null) {
54709      prop("resourceType", name);
54710      composeGenomicStudyProperties(element);
54711    }
54712  }
54713
54714  protected void composeGenomicStudyProperties(GenomicStudy element) throws IOException {
54715    composeDomainResourceProperties(element);
54716      if (element.hasIdentifier()) {
54717        openArray("identifier");
54718        for (Identifier e : element.getIdentifier()) 
54719          composeIdentifier(null, e);
54720        closeArray();
54721      };
54722      if (element.hasStatusElement()) {
54723        composeEnumerationCore("status", element.getStatusElement(), new GenomicStudy.GenomicStudyStatusEnumFactory(), false);
54724        composeEnumerationExtras("status", element.getStatusElement(), new GenomicStudy.GenomicStudyStatusEnumFactory(), false);
54725      }
54726      if (element.hasType()) {
54727        openArray("type");
54728        for (CodeableConcept e : element.getType()) 
54729          composeCodeableConcept(null, e);
54730        closeArray();
54731      };
54732      if (element.hasSubject()) {
54733        composeReference("subject", element.getSubject());
54734      }
54735      if (element.hasEncounter()) {
54736        composeReference("encounter", element.getEncounter());
54737      }
54738      if (element.hasStartDateElement()) {
54739        composeDateTimeCore("startDate", element.getStartDateElement(), false);
54740        composeDateTimeExtras("startDate", element.getStartDateElement(), false);
54741      }
54742      if (element.hasBasedOn()) {
54743        openArray("basedOn");
54744        for (Reference e : element.getBasedOn()) 
54745          composeReference(null, e);
54746        closeArray();
54747      };
54748      if (element.hasReferrer()) {
54749        composeReference("referrer", element.getReferrer());
54750      }
54751      if (element.hasInterpreter()) {
54752        openArray("interpreter");
54753        for (Reference e : element.getInterpreter()) 
54754          composeReference(null, e);
54755        closeArray();
54756      };
54757      if (element.hasReason()) {
54758        openArray("reason");
54759        for (CodeableReference e : element.getReason()) 
54760          composeCodeableReference(null, e);
54761        closeArray();
54762      };
54763      if (element.hasInstantiatesCanonicalElement()) {
54764        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54765        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54766      }
54767      if (element.hasInstantiatesUriElement()) {
54768        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
54769        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
54770      }
54771      if (element.hasNote()) {
54772        openArray("note");
54773        for (Annotation e : element.getNote()) 
54774          composeAnnotation(null, e);
54775        closeArray();
54776      };
54777      if (element.hasDescriptionElement()) {
54778        composeMarkdownCore("description", element.getDescriptionElement(), false);
54779        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54780      }
54781      if (element.hasAnalysis()) {
54782        openArray("analysis");
54783        for (GenomicStudy.GenomicStudyAnalysisComponent e : element.getAnalysis()) 
54784          composeGenomicStudyAnalysisComponent(null, e);
54785        closeArray();
54786      };
54787  }
54788
54789  protected void composeGenomicStudyAnalysisComponent(String name, GenomicStudy.GenomicStudyAnalysisComponent element) throws IOException {
54790    if (element != null) {
54791      open(name);
54792      composeGenomicStudyAnalysisComponentProperties(element);
54793      close();
54794    }
54795  }
54796
54797  protected void composeGenomicStudyAnalysisComponentProperties(GenomicStudy.GenomicStudyAnalysisComponent element) throws IOException {
54798    composeBackboneElementProperties(element);
54799      if (element.hasIdentifier()) {
54800        openArray("identifier");
54801        for (Identifier e : element.getIdentifier()) 
54802          composeIdentifier(null, e);
54803        closeArray();
54804      };
54805      if (element.hasMethodType()) {
54806        openArray("methodType");
54807        for (CodeableConcept e : element.getMethodType()) 
54808          composeCodeableConcept(null, e);
54809        closeArray();
54810      };
54811      if (element.hasChangeType()) {
54812        openArray("changeType");
54813        for (CodeableConcept e : element.getChangeType()) 
54814          composeCodeableConcept(null, e);
54815        closeArray();
54816      };
54817      if (element.hasGenomeBuild()) {
54818        composeCodeableConcept("genomeBuild", element.getGenomeBuild());
54819      }
54820      if (element.hasInstantiatesCanonicalElement()) {
54821        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54822        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
54823      }
54824      if (element.hasInstantiatesUriElement()) {
54825        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
54826        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
54827      }
54828      if (element.hasTitleElement()) {
54829        composeStringCore("title", element.getTitleElement(), false);
54830        composeStringExtras("title", element.getTitleElement(), false);
54831      }
54832      if (element.hasFocus()) {
54833        openArray("focus");
54834        for (Reference e : element.getFocus()) 
54835          composeReference(null, e);
54836        closeArray();
54837      };
54838      if (element.hasSpecimen()) {
54839        openArray("specimen");
54840        for (Reference e : element.getSpecimen()) 
54841          composeReference(null, e);
54842        closeArray();
54843      };
54844      if (element.hasDateElement()) {
54845        composeDateTimeCore("date", element.getDateElement(), false);
54846        composeDateTimeExtras("date", element.getDateElement(), false);
54847      }
54848      if (element.hasNote()) {
54849        openArray("note");
54850        for (Annotation e : element.getNote()) 
54851          composeAnnotation(null, e);
54852        closeArray();
54853      };
54854      if (element.hasProtocolPerformed()) {
54855        composeReference("protocolPerformed", element.getProtocolPerformed());
54856      }
54857      if (element.hasRegionsStudied()) {
54858        openArray("regionsStudied");
54859        for (Reference e : element.getRegionsStudied()) 
54860          composeReference(null, e);
54861        closeArray();
54862      };
54863      if (element.hasRegionsCalled()) {
54864        openArray("regionsCalled");
54865        for (Reference e : element.getRegionsCalled()) 
54866          composeReference(null, e);
54867        closeArray();
54868      };
54869      if (element.hasInput()) {
54870        openArray("input");
54871        for (GenomicStudy.GenomicStudyAnalysisInputComponent e : element.getInput()) 
54872          composeGenomicStudyAnalysisInputComponent(null, e);
54873        closeArray();
54874      };
54875      if (element.hasOutput()) {
54876        openArray("output");
54877        for (GenomicStudy.GenomicStudyAnalysisOutputComponent e : element.getOutput()) 
54878          composeGenomicStudyAnalysisOutputComponent(null, e);
54879        closeArray();
54880      };
54881      if (element.hasPerformer()) {
54882        openArray("performer");
54883        for (GenomicStudy.GenomicStudyAnalysisPerformerComponent e : element.getPerformer()) 
54884          composeGenomicStudyAnalysisPerformerComponent(null, e);
54885        closeArray();
54886      };
54887      if (element.hasDevice()) {
54888        openArray("device");
54889        for (GenomicStudy.GenomicStudyAnalysisDeviceComponent e : element.getDevice()) 
54890          composeGenomicStudyAnalysisDeviceComponent(null, e);
54891        closeArray();
54892      };
54893  }
54894
54895  protected void composeGenomicStudyAnalysisInputComponent(String name, GenomicStudy.GenomicStudyAnalysisInputComponent element) throws IOException {
54896    if (element != null) {
54897      open(name);
54898      composeGenomicStudyAnalysisInputComponentProperties(element);
54899      close();
54900    }
54901  }
54902
54903  protected void composeGenomicStudyAnalysisInputComponentProperties(GenomicStudy.GenomicStudyAnalysisInputComponent element) throws IOException {
54904    composeBackboneElementProperties(element);
54905      if (element.hasFile()) {
54906        composeReference("file", element.getFile());
54907      }
54908      if (element.hasType()) {
54909        composeCodeableConcept("type", element.getType());
54910      }
54911      if (element.hasGeneratedBy()) {
54912        composeType("generatedBy", element.getGeneratedBy());
54913      }
54914  }
54915
54916  protected void composeGenomicStudyAnalysisOutputComponent(String name, GenomicStudy.GenomicStudyAnalysisOutputComponent element) throws IOException {
54917    if (element != null) {
54918      open(name);
54919      composeGenomicStudyAnalysisOutputComponentProperties(element);
54920      close();
54921    }
54922  }
54923
54924  protected void composeGenomicStudyAnalysisOutputComponentProperties(GenomicStudy.GenomicStudyAnalysisOutputComponent element) throws IOException {
54925    composeBackboneElementProperties(element);
54926      if (element.hasFile()) {
54927        composeReference("file", element.getFile());
54928      }
54929      if (element.hasType()) {
54930        composeCodeableConcept("type", element.getType());
54931      }
54932  }
54933
54934  protected void composeGenomicStudyAnalysisPerformerComponent(String name, GenomicStudy.GenomicStudyAnalysisPerformerComponent element) throws IOException {
54935    if (element != null) {
54936      open(name);
54937      composeGenomicStudyAnalysisPerformerComponentProperties(element);
54938      close();
54939    }
54940  }
54941
54942  protected void composeGenomicStudyAnalysisPerformerComponentProperties(GenomicStudy.GenomicStudyAnalysisPerformerComponent element) throws IOException {
54943    composeBackboneElementProperties(element);
54944      if (element.hasActor()) {
54945        composeReference("actor", element.getActor());
54946      }
54947      if (element.hasRole()) {
54948        composeCodeableConcept("role", element.getRole());
54949      }
54950  }
54951
54952  protected void composeGenomicStudyAnalysisDeviceComponent(String name, GenomicStudy.GenomicStudyAnalysisDeviceComponent element) throws IOException {
54953    if (element != null) {
54954      open(name);
54955      composeGenomicStudyAnalysisDeviceComponentProperties(element);
54956      close();
54957    }
54958  }
54959
54960  protected void composeGenomicStudyAnalysisDeviceComponentProperties(GenomicStudy.GenomicStudyAnalysisDeviceComponent element) throws IOException {
54961    composeBackboneElementProperties(element);
54962      if (element.hasDevice()) {
54963        composeReference("device", element.getDevice());
54964      }
54965      if (element.hasFunction()) {
54966        composeCodeableConcept("function", element.getFunction());
54967      }
54968  }
54969
54970  protected void composeGoal(String name, Goal element) throws IOException {
54971    if (element != null) {
54972      prop("resourceType", name);
54973      composeGoalProperties(element);
54974    }
54975  }
54976
54977  protected void composeGoalProperties(Goal element) throws IOException {
54978    composeDomainResourceProperties(element);
54979      if (element.hasIdentifier()) {
54980        openArray("identifier");
54981        for (Identifier e : element.getIdentifier()) 
54982          composeIdentifier(null, e);
54983        closeArray();
54984      };
54985      if (element.hasLifecycleStatusElement()) {
54986        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
54987        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
54988      }
54989      if (element.hasAchievementStatus()) {
54990        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
54991      }
54992      if (element.hasCategory()) {
54993        openArray("category");
54994        for (CodeableConcept e : element.getCategory()) 
54995          composeCodeableConcept(null, e);
54996        closeArray();
54997      };
54998      if (element.hasContinuousElement()) {
54999        composeBooleanCore("continuous", element.getContinuousElement(), false);
55000        composeBooleanExtras("continuous", element.getContinuousElement(), false);
55001      }
55002      if (element.hasPriority()) {
55003        composeCodeableConcept("priority", element.getPriority());
55004      }
55005      if (element.hasDescription()) {
55006        composeCodeableConcept("description", element.getDescription());
55007      }
55008      if (element.hasSubject()) {
55009        composeReference("subject", element.getSubject());
55010      }
55011      if (element.hasStart()) {
55012        composeType("start", element.getStart());
55013      }
55014      if (element.hasTarget()) {
55015        openArray("target");
55016        for (Goal.GoalTargetComponent e : element.getTarget()) 
55017          composeGoalTargetComponent(null, e);
55018        closeArray();
55019      };
55020      if (element.hasStatusDateElement()) {
55021        composeDateCore("statusDate", element.getStatusDateElement(), false);
55022        composeDateExtras("statusDate", element.getStatusDateElement(), false);
55023      }
55024      if (element.hasStatusReasonElement()) {
55025        composeStringCore("statusReason", element.getStatusReasonElement(), false);
55026        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
55027      }
55028      if (element.hasSource()) {
55029        composeReference("source", element.getSource());
55030      }
55031      if (element.hasAddresses()) {
55032        openArray("addresses");
55033        for (Reference e : element.getAddresses()) 
55034          composeReference(null, e);
55035        closeArray();
55036      };
55037      if (element.hasNote()) {
55038        openArray("note");
55039        for (Annotation e : element.getNote()) 
55040          composeAnnotation(null, e);
55041        closeArray();
55042      };
55043      if (element.hasOutcome()) {
55044        openArray("outcome");
55045        for (CodeableReference e : element.getOutcome()) 
55046          composeCodeableReference(null, e);
55047        closeArray();
55048      };
55049  }
55050
55051  protected void composeGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
55052    if (element != null) {
55053      open(name);
55054      composeGoalTargetComponentProperties(element);
55055      close();
55056    }
55057  }
55058
55059  protected void composeGoalTargetComponentProperties(Goal.GoalTargetComponent element) throws IOException {
55060    composeBackboneElementProperties(element);
55061      if (element.hasMeasure()) {
55062        composeCodeableConcept("measure", element.getMeasure());
55063      }
55064      if (element.hasDetail()) {
55065        composeType("detail", element.getDetail());
55066      }
55067      if (element.hasDue()) {
55068        composeType("due", element.getDue());
55069      }
55070  }
55071
55072  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
55073    if (element != null) {
55074      prop("resourceType", name);
55075      composeGraphDefinitionProperties(element);
55076    }
55077  }
55078
55079  protected void composeGraphDefinitionProperties(GraphDefinition element) throws IOException {
55080    composeCanonicalResourceProperties(element);
55081      if (element.hasUrlElement()) {
55082        composeUriCore("url", element.getUrlElement(), false);
55083        composeUriExtras("url", element.getUrlElement(), false);
55084      }
55085      if (element.hasIdentifier()) {
55086        openArray("identifier");
55087        for (Identifier e : element.getIdentifier()) 
55088          composeIdentifier(null, e);
55089        closeArray();
55090      };
55091      if (element.hasVersionElement()) {
55092        composeStringCore("version", element.getVersionElement(), false);
55093        composeStringExtras("version", element.getVersionElement(), false);
55094      }
55095      if (element.hasVersionAlgorithm()) {
55096        composeType("versionAlgorithm", element.getVersionAlgorithm());
55097      }
55098      if (element.hasNameElement()) {
55099        composeStringCore("name", element.getNameElement(), false);
55100        composeStringExtras("name", element.getNameElement(), false);
55101      }
55102      if (element.hasTitleElement()) {
55103        composeStringCore("title", element.getTitleElement(), false);
55104        composeStringExtras("title", element.getTitleElement(), false);
55105      }
55106      if (element.hasStatusElement()) {
55107        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55108        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55109      }
55110      if (element.hasExperimentalElement()) {
55111        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55112        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55113      }
55114      if (element.hasDateElement()) {
55115        composeDateTimeCore("date", element.getDateElement(), false);
55116        composeDateTimeExtras("date", element.getDateElement(), false);
55117      }
55118      if (element.hasPublisherElement()) {
55119        composeStringCore("publisher", element.getPublisherElement(), false);
55120        composeStringExtras("publisher", element.getPublisherElement(), false);
55121      }
55122      if (element.hasContact()) {
55123        openArray("contact");
55124        for (ContactDetail e : element.getContact()) 
55125          composeContactDetail(null, e);
55126        closeArray();
55127      };
55128      if (element.hasDescriptionElement()) {
55129        composeMarkdownCore("description", element.getDescriptionElement(), false);
55130        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55131      }
55132      if (element.hasUseContext()) {
55133        openArray("useContext");
55134        for (UsageContext e : element.getUseContext()) 
55135          composeUsageContext(null, e);
55136        closeArray();
55137      };
55138      if (element.hasJurisdiction()) {
55139        openArray("jurisdiction");
55140        for (CodeableConcept e : element.getJurisdiction()) 
55141          composeCodeableConcept(null, e);
55142        closeArray();
55143      };
55144      if (element.hasPurposeElement()) {
55145        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55146        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55147      }
55148      if (element.hasCopyrightElement()) {
55149        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55150        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55151      }
55152      if (element.hasCopyrightLabelElement()) {
55153        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
55154        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
55155      }
55156      if (element.hasStartElement()) {
55157        composeIdCore("start", element.getStartElement(), false);
55158        composeIdExtras("start", element.getStartElement(), false);
55159      }
55160      if (element.hasNode()) {
55161        openArray("node");
55162        for (GraphDefinition.GraphDefinitionNodeComponent e : element.getNode()) 
55163          composeGraphDefinitionNodeComponent(null, e);
55164        closeArray();
55165      };
55166      if (element.hasLink()) {
55167        openArray("link");
55168        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
55169          composeGraphDefinitionLinkComponent(null, e);
55170        closeArray();
55171      };
55172  }
55173
55174  protected void composeGraphDefinitionNodeComponent(String name, GraphDefinition.GraphDefinitionNodeComponent element) throws IOException {
55175    if (element != null) {
55176      open(name);
55177      composeGraphDefinitionNodeComponentProperties(element);
55178      close();
55179    }
55180  }
55181
55182  protected void composeGraphDefinitionNodeComponentProperties(GraphDefinition.GraphDefinitionNodeComponent element) throws IOException {
55183    composeBackboneElementProperties(element);
55184      if (element.hasNodeIdElement()) {
55185        composeIdCore("nodeId", element.getNodeIdElement(), false);
55186        composeIdExtras("nodeId", element.getNodeIdElement(), false);
55187      }
55188      if (element.hasDescriptionElement()) {
55189        composeStringCore("description", element.getDescriptionElement(), false);
55190        composeStringExtras("description", element.getDescriptionElement(), false);
55191      }
55192      if (element.hasTypeElement()) {
55193        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), false);
55194        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), false);
55195      }
55196      if (element.hasProfileElement()) {
55197        composeCanonicalCore("profile", element.getProfileElement(), false);
55198        composeCanonicalExtras("profile", element.getProfileElement(), false);
55199      }
55200  }
55201
55202  protected void composeGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
55203    if (element != null) {
55204      open(name);
55205      composeGraphDefinitionLinkComponentProperties(element);
55206      close();
55207    }
55208  }
55209
55210  protected void composeGraphDefinitionLinkComponentProperties(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
55211    composeBackboneElementProperties(element);
55212      if (element.hasDescriptionElement()) {
55213        composeStringCore("description", element.getDescriptionElement(), false);
55214        composeStringExtras("description", element.getDescriptionElement(), false);
55215      }
55216      if (element.hasMinElement()) {
55217        composeIntegerCore("min", element.getMinElement(), false);
55218        composeIntegerExtras("min", element.getMinElement(), false);
55219      }
55220      if (element.hasMaxElement()) {
55221        composeStringCore("max", element.getMaxElement(), false);
55222        composeStringExtras("max", element.getMaxElement(), false);
55223      }
55224      if (element.hasSourceIdElement()) {
55225        composeIdCore("sourceId", element.getSourceIdElement(), false);
55226        composeIdExtras("sourceId", element.getSourceIdElement(), false);
55227      }
55228      if (element.hasPathElement()) {
55229        composeStringCore("path", element.getPathElement(), false);
55230        composeStringExtras("path", element.getPathElement(), false);
55231      }
55232      if (element.hasSliceNameElement()) {
55233        composeStringCore("sliceName", element.getSliceNameElement(), false);
55234        composeStringExtras("sliceName", element.getSliceNameElement(), false);
55235      }
55236      if (element.hasTargetIdElement()) {
55237        composeIdCore("targetId", element.getTargetIdElement(), false);
55238        composeIdExtras("targetId", element.getTargetIdElement(), false);
55239      }
55240      if (element.hasParamsElement()) {
55241        composeStringCore("params", element.getParamsElement(), false);
55242        composeStringExtras("params", element.getParamsElement(), false);
55243      }
55244      if (element.hasCompartment()) {
55245        openArray("compartment");
55246        for (GraphDefinition.GraphDefinitionLinkCompartmentComponent e : element.getCompartment()) 
55247          composeGraphDefinitionLinkCompartmentComponent(null, e);
55248        closeArray();
55249      };
55250  }
55251
55252  protected void composeGraphDefinitionLinkCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkCompartmentComponent element) throws IOException {
55253    if (element != null) {
55254      open(name);
55255      composeGraphDefinitionLinkCompartmentComponentProperties(element);
55256      close();
55257    }
55258  }
55259
55260  protected void composeGraphDefinitionLinkCompartmentComponentProperties(GraphDefinition.GraphDefinitionLinkCompartmentComponent element) throws IOException {
55261    composeBackboneElementProperties(element);
55262      if (element.hasUseElement()) {
55263        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
55264        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
55265      }
55266      if (element.hasRuleElement()) {
55267        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
55268        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
55269      }
55270      if (element.hasCodeElement()) {
55271        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
55272        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
55273      }
55274      if (element.hasExpressionElement()) {
55275        composeStringCore("expression", element.getExpressionElement(), false);
55276        composeStringExtras("expression", element.getExpressionElement(), false);
55277      }
55278      if (element.hasDescriptionElement()) {
55279        composeStringCore("description", element.getDescriptionElement(), false);
55280        composeStringExtras("description", element.getDescriptionElement(), false);
55281      }
55282  }
55283
55284  protected void composeGroup(String name, Group element) throws IOException {
55285    if (element != null) {
55286      prop("resourceType", name);
55287      composeGroupProperties(element);
55288    }
55289  }
55290
55291  protected void composeGroupProperties(Group element) throws IOException {
55292    composeDomainResourceProperties(element);
55293      if (element.hasIdentifier()) {
55294        openArray("identifier");
55295        for (Identifier e : element.getIdentifier()) 
55296          composeIdentifier(null, e);
55297        closeArray();
55298      };
55299      if (element.hasActiveElement()) {
55300        composeBooleanCore("active", element.getActiveElement(), false);
55301        composeBooleanExtras("active", element.getActiveElement(), false);
55302      }
55303      if (element.hasTypeElement()) {
55304        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
55305        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
55306      }
55307      if (element.hasMembershipElement()) {
55308        composeEnumerationCore("membership", element.getMembershipElement(), new Group.GroupMembershipBasisEnumFactory(), false);
55309        composeEnumerationExtras("membership", element.getMembershipElement(), new Group.GroupMembershipBasisEnumFactory(), false);
55310      }
55311      if (element.hasCode()) {
55312        composeCodeableConcept("code", element.getCode());
55313      }
55314      if (element.hasNameElement()) {
55315        composeStringCore("name", element.getNameElement(), false);
55316        composeStringExtras("name", element.getNameElement(), false);
55317      }
55318      if (element.hasDescriptionElement()) {
55319        composeMarkdownCore("description", element.getDescriptionElement(), false);
55320        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55321      }
55322      if (element.hasQuantityElement()) {
55323        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
55324        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
55325      }
55326      if (element.hasManagingEntity()) {
55327        composeReference("managingEntity", element.getManagingEntity());
55328      }
55329      if (element.hasCharacteristic()) {
55330        openArray("characteristic");
55331        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
55332          composeGroupCharacteristicComponent(null, e);
55333        closeArray();
55334      };
55335      if (element.hasMember()) {
55336        openArray("member");
55337        for (Group.GroupMemberComponent e : element.getMember()) 
55338          composeGroupMemberComponent(null, e);
55339        closeArray();
55340      };
55341  }
55342
55343  protected void composeGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
55344    if (element != null) {
55345      open(name);
55346      composeGroupCharacteristicComponentProperties(element);
55347      close();
55348    }
55349  }
55350
55351  protected void composeGroupCharacteristicComponentProperties(Group.GroupCharacteristicComponent element) throws IOException {
55352    composeBackboneElementProperties(element);
55353      if (element.hasCode()) {
55354        composeCodeableConcept("code", element.getCode());
55355      }
55356      if (element.hasValue()) {
55357        composeType("value", element.getValue());
55358      }
55359      if (element.hasExcludeElement()) {
55360        composeBooleanCore("exclude", element.getExcludeElement(), false);
55361        composeBooleanExtras("exclude", element.getExcludeElement(), false);
55362      }
55363      if (element.hasPeriod()) {
55364        composePeriod("period", element.getPeriod());
55365      }
55366  }
55367
55368  protected void composeGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
55369    if (element != null) {
55370      open(name);
55371      composeGroupMemberComponentProperties(element);
55372      close();
55373    }
55374  }
55375
55376  protected void composeGroupMemberComponentProperties(Group.GroupMemberComponent element) throws IOException {
55377    composeBackboneElementProperties(element);
55378      if (element.hasEntity()) {
55379        composeReference("entity", element.getEntity());
55380      }
55381      if (element.hasPeriod()) {
55382        composePeriod("period", element.getPeriod());
55383      }
55384      if (element.hasInactiveElement()) {
55385        composeBooleanCore("inactive", element.getInactiveElement(), false);
55386        composeBooleanExtras("inactive", element.getInactiveElement(), false);
55387      }
55388  }
55389
55390  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
55391    if (element != null) {
55392      prop("resourceType", name);
55393      composeGuidanceResponseProperties(element);
55394    }
55395  }
55396
55397  protected void composeGuidanceResponseProperties(GuidanceResponse element) throws IOException {
55398    composeDomainResourceProperties(element);
55399      if (element.hasRequestIdentifier()) {
55400        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
55401      }
55402      if (element.hasIdentifier()) {
55403        openArray("identifier");
55404        for (Identifier e : element.getIdentifier()) 
55405          composeIdentifier(null, e);
55406        closeArray();
55407      };
55408      if (element.hasModule()) {
55409        composeType("module", element.getModule());
55410      }
55411      if (element.hasStatusElement()) {
55412        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
55413        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
55414      }
55415      if (element.hasSubject()) {
55416        composeReference("subject", element.getSubject());
55417      }
55418      if (element.hasEncounter()) {
55419        composeReference("encounter", element.getEncounter());
55420      }
55421      if (element.hasOccurrenceDateTimeElement()) {
55422        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
55423        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
55424      }
55425      if (element.hasPerformer()) {
55426        composeReference("performer", element.getPerformer());
55427      }
55428      if (element.hasReason()) {
55429        openArray("reason");
55430        for (CodeableReference e : element.getReason()) 
55431          composeCodeableReference(null, e);
55432        closeArray();
55433      };
55434      if (element.hasNote()) {
55435        openArray("note");
55436        for (Annotation e : element.getNote()) 
55437          composeAnnotation(null, e);
55438        closeArray();
55439      };
55440      if (element.hasEvaluationMessage()) {
55441        composeReference("evaluationMessage", element.getEvaluationMessage());
55442      }
55443      if (element.hasOutputParameters()) {
55444        composeReference("outputParameters", element.getOutputParameters());
55445      }
55446      if (element.hasResult()) {
55447        openArray("result");
55448        for (Reference e : element.getResult()) 
55449          composeReference(null, e);
55450        closeArray();
55451      };
55452      if (element.hasDataRequirement()) {
55453        openArray("dataRequirement");
55454        for (DataRequirement e : element.getDataRequirement()) 
55455          composeDataRequirement(null, e);
55456        closeArray();
55457      };
55458  }
55459
55460  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
55461    if (element != null) {
55462      prop("resourceType", name);
55463      composeHealthcareServiceProperties(element);
55464    }
55465  }
55466
55467  protected void composeHealthcareServiceProperties(HealthcareService element) throws IOException {
55468    composeDomainResourceProperties(element);
55469      if (element.hasIdentifier()) {
55470        openArray("identifier");
55471        for (Identifier e : element.getIdentifier()) 
55472          composeIdentifier(null, e);
55473        closeArray();
55474      };
55475      if (element.hasActiveElement()) {
55476        composeBooleanCore("active", element.getActiveElement(), false);
55477        composeBooleanExtras("active", element.getActiveElement(), false);
55478      }
55479      if (element.hasProvidedBy()) {
55480        composeReference("providedBy", element.getProvidedBy());
55481      }
55482      if (element.hasOfferedIn()) {
55483        openArray("offeredIn");
55484        for (Reference e : element.getOfferedIn()) 
55485          composeReference(null, e);
55486        closeArray();
55487      };
55488      if (element.hasCategory()) {
55489        openArray("category");
55490        for (CodeableConcept e : element.getCategory()) 
55491          composeCodeableConcept(null, e);
55492        closeArray();
55493      };
55494      if (element.hasType()) {
55495        openArray("type");
55496        for (CodeableConcept e : element.getType()) 
55497          composeCodeableConcept(null, e);
55498        closeArray();
55499      };
55500      if (element.hasSpecialty()) {
55501        openArray("specialty");
55502        for (CodeableConcept e : element.getSpecialty()) 
55503          composeCodeableConcept(null, e);
55504        closeArray();
55505      };
55506      if (element.hasLocation()) {
55507        openArray("location");
55508        for (Reference e : element.getLocation()) 
55509          composeReference(null, e);
55510        closeArray();
55511      };
55512      if (element.hasNameElement()) {
55513        composeStringCore("name", element.getNameElement(), false);
55514        composeStringExtras("name", element.getNameElement(), false);
55515      }
55516      if (element.hasCommentElement()) {
55517        composeMarkdownCore("comment", element.getCommentElement(), false);
55518        composeMarkdownExtras("comment", element.getCommentElement(), false);
55519      }
55520      if (element.hasExtraDetailsElement()) {
55521        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
55522        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
55523      }
55524      if (element.hasPhoto()) {
55525        composeAttachment("photo", element.getPhoto());
55526      }
55527      if (element.hasContact()) {
55528        openArray("contact");
55529        for (ExtendedContactDetail e : element.getContact()) 
55530          composeExtendedContactDetail(null, e);
55531        closeArray();
55532      };
55533      if (element.hasCoverageArea()) {
55534        openArray("coverageArea");
55535        for (Reference e : element.getCoverageArea()) 
55536          composeReference(null, e);
55537        closeArray();
55538      };
55539      if (element.hasServiceProvisionCode()) {
55540        openArray("serviceProvisionCode");
55541        for (CodeableConcept e : element.getServiceProvisionCode()) 
55542          composeCodeableConcept(null, e);
55543        closeArray();
55544      };
55545      if (element.hasEligibility()) {
55546        openArray("eligibility");
55547        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
55548          composeHealthcareServiceEligibilityComponent(null, e);
55549        closeArray();
55550      };
55551      if (element.hasProgram()) {
55552        openArray("program");
55553        for (CodeableConcept e : element.getProgram()) 
55554          composeCodeableConcept(null, e);
55555        closeArray();
55556      };
55557      if (element.hasCharacteristic()) {
55558        openArray("characteristic");
55559        for (CodeableConcept e : element.getCharacteristic()) 
55560          composeCodeableConcept(null, e);
55561        closeArray();
55562      };
55563      if (element.hasCommunication()) {
55564        openArray("communication");
55565        for (CodeableConcept e : element.getCommunication()) 
55566          composeCodeableConcept(null, e);
55567        closeArray();
55568      };
55569      if (element.hasReferralMethod()) {
55570        openArray("referralMethod");
55571        for (CodeableConcept e : element.getReferralMethod()) 
55572          composeCodeableConcept(null, e);
55573        closeArray();
55574      };
55575      if (element.hasAppointmentRequiredElement()) {
55576        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
55577        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
55578      }
55579      if (element.hasAvailability()) {
55580        openArray("availability");
55581        for (Availability e : element.getAvailability()) 
55582          composeAvailability(null, e);
55583        closeArray();
55584      };
55585      if (element.hasEndpoint()) {
55586        openArray("endpoint");
55587        for (Reference e : element.getEndpoint()) 
55588          composeReference(null, e);
55589        closeArray();
55590      };
55591  }
55592
55593  protected void composeHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
55594    if (element != null) {
55595      open(name);
55596      composeHealthcareServiceEligibilityComponentProperties(element);
55597      close();
55598    }
55599  }
55600
55601  protected void composeHealthcareServiceEligibilityComponentProperties(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
55602    composeBackboneElementProperties(element);
55603      if (element.hasCode()) {
55604        composeCodeableConcept("code", element.getCode());
55605      }
55606      if (element.hasCommentElement()) {
55607        composeMarkdownCore("comment", element.getCommentElement(), false);
55608        composeMarkdownExtras("comment", element.getCommentElement(), false);
55609      }
55610  }
55611
55612  protected void composeImagingSelection(String name, ImagingSelection element) throws IOException {
55613    if (element != null) {
55614      prop("resourceType", name);
55615      composeImagingSelectionProperties(element);
55616    }
55617  }
55618
55619  protected void composeImagingSelectionProperties(ImagingSelection element) throws IOException {
55620    composeDomainResourceProperties(element);
55621      if (element.hasIdentifier()) {
55622        openArray("identifier");
55623        for (Identifier e : element.getIdentifier()) 
55624          composeIdentifier(null, e);
55625        closeArray();
55626      };
55627      if (element.hasStatusElement()) {
55628        composeEnumerationCore("status", element.getStatusElement(), new ImagingSelection.ImagingSelectionStatusEnumFactory(), false);
55629        composeEnumerationExtras("status", element.getStatusElement(), new ImagingSelection.ImagingSelectionStatusEnumFactory(), false);
55630      }
55631      if (element.hasSubject()) {
55632        composeReference("subject", element.getSubject());
55633      }
55634      if (element.hasIssuedElement()) {
55635        composeInstantCore("issued", element.getIssuedElement(), false);
55636        composeInstantExtras("issued", element.getIssuedElement(), false);
55637      }
55638      if (element.hasPerformer()) {
55639        openArray("performer");
55640        for (ImagingSelection.ImagingSelectionPerformerComponent e : element.getPerformer()) 
55641          composeImagingSelectionPerformerComponent(null, e);
55642        closeArray();
55643      };
55644      if (element.hasBasedOn()) {
55645        openArray("basedOn");
55646        for (Reference e : element.getBasedOn()) 
55647          composeReference(null, e);
55648        closeArray();
55649      };
55650      if (element.hasCategory()) {
55651        openArray("category");
55652        for (CodeableConcept e : element.getCategory()) 
55653          composeCodeableConcept(null, e);
55654        closeArray();
55655      };
55656      if (element.hasCode()) {
55657        composeCodeableConcept("code", element.getCode());
55658      }
55659      if (element.hasStudyUidElement()) {
55660        composeIdCore("studyUid", element.getStudyUidElement(), false);
55661        composeIdExtras("studyUid", element.getStudyUidElement(), false);
55662      }
55663      if (element.hasDerivedFrom()) {
55664        openArray("derivedFrom");
55665        for (Reference e : element.getDerivedFrom()) 
55666          composeReference(null, e);
55667        closeArray();
55668      };
55669      if (element.hasEndpoint()) {
55670        openArray("endpoint");
55671        for (Reference e : element.getEndpoint()) 
55672          composeReference(null, e);
55673        closeArray();
55674      };
55675      if (element.hasSeriesUidElement()) {
55676        composeIdCore("seriesUid", element.getSeriesUidElement(), false);
55677        composeIdExtras("seriesUid", element.getSeriesUidElement(), false);
55678      }
55679      if (element.hasSeriesNumberElement()) {
55680        composeUnsignedIntCore("seriesNumber", element.getSeriesNumberElement(), false);
55681        composeUnsignedIntExtras("seriesNumber", element.getSeriesNumberElement(), false);
55682      }
55683      if (element.hasFrameOfReferenceUidElement()) {
55684        composeIdCore("frameOfReferenceUid", element.getFrameOfReferenceUidElement(), false);
55685        composeIdExtras("frameOfReferenceUid", element.getFrameOfReferenceUidElement(), false);
55686      }
55687      if (element.hasBodySite()) {
55688        composeCodeableReference("bodySite", element.getBodySite());
55689      }
55690      if (element.hasFocus()) {
55691        openArray("focus");
55692        for (Reference e : element.getFocus()) 
55693          composeReference(null, e);
55694        closeArray();
55695      };
55696      if (element.hasInstance()) {
55697        openArray("instance");
55698        for (ImagingSelection.ImagingSelectionInstanceComponent e : element.getInstance()) 
55699          composeImagingSelectionInstanceComponent(null, e);
55700        closeArray();
55701      };
55702  }
55703
55704  protected void composeImagingSelectionPerformerComponent(String name, ImagingSelection.ImagingSelectionPerformerComponent element) throws IOException {
55705    if (element != null) {
55706      open(name);
55707      composeImagingSelectionPerformerComponentProperties(element);
55708      close();
55709    }
55710  }
55711
55712  protected void composeImagingSelectionPerformerComponentProperties(ImagingSelection.ImagingSelectionPerformerComponent element) throws IOException {
55713    composeBackboneElementProperties(element);
55714      if (element.hasFunction()) {
55715        composeCodeableConcept("function", element.getFunction());
55716      }
55717      if (element.hasActor()) {
55718        composeReference("actor", element.getActor());
55719      }
55720  }
55721
55722  protected void composeImagingSelectionInstanceComponent(String name, ImagingSelection.ImagingSelectionInstanceComponent element) throws IOException {
55723    if (element != null) {
55724      open(name);
55725      composeImagingSelectionInstanceComponentProperties(element);
55726      close();
55727    }
55728  }
55729
55730  protected void composeImagingSelectionInstanceComponentProperties(ImagingSelection.ImagingSelectionInstanceComponent element) throws IOException {
55731    composeBackboneElementProperties(element);
55732      if (element.hasUidElement()) {
55733        composeIdCore("uid", element.getUidElement(), false);
55734        composeIdExtras("uid", element.getUidElement(), false);
55735      }
55736      if (element.hasNumberElement()) {
55737        composeUnsignedIntCore("number", element.getNumberElement(), false);
55738        composeUnsignedIntExtras("number", element.getNumberElement(), false);
55739      }
55740      if (element.hasSopClass()) {
55741        composeCoding("sopClass", element.getSopClass());
55742      }
55743      if (element.hasSubset()) {
55744        if (anyHasValue(element.getSubset())) {
55745          openArray("subset");
55746          for (StringType e : element.getSubset()) 
55747            composeStringCore(null, e, e != element.getSubset().get(element.getSubset().size()-1));
55748          closeArray();
55749        }
55750        if (anyHasExtras(element.getSubset())) {
55751          openArray("_subset");
55752          for (StringType e : element.getSubset()) 
55753            composeStringExtras(null, e, true);
55754          closeArray();
55755        }
55756      };
55757      if (element.hasImageRegion2D()) {
55758        openArray("imageRegion2D");
55759        for (ImagingSelection.ImageRegion2DComponent e : element.getImageRegion2D()) 
55760          composeImageRegion2DComponent(null, e);
55761        closeArray();
55762      };
55763      if (element.hasImageRegion3D()) {
55764        openArray("imageRegion3D");
55765        for (ImagingSelection.ImageRegion3DComponent e : element.getImageRegion3D()) 
55766          composeImageRegion3DComponent(null, e);
55767        closeArray();
55768      };
55769  }
55770
55771  protected void composeImageRegion2DComponent(String name, ImagingSelection.ImageRegion2DComponent element) throws IOException {
55772    if (element != null) {
55773      open(name);
55774      composeImageRegion2DComponentProperties(element);
55775      close();
55776    }
55777  }
55778
55779  protected void composeImageRegion2DComponentProperties(ImagingSelection.ImageRegion2DComponent element) throws IOException {
55780    composeBackboneElementProperties(element);
55781      if (element.hasRegionTypeElement()) {
55782        composeEnumerationCore("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection2DGraphicTypeEnumFactory(), false);
55783        composeEnumerationExtras("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection2DGraphicTypeEnumFactory(), false);
55784      }
55785      if (element.hasCoordinate()) {
55786        if (anyHasValue(element.getCoordinate())) {
55787          openArray("coordinate");
55788          for (DecimalType e : element.getCoordinate()) 
55789            composeDecimalCore(null, e, e != element.getCoordinate().get(element.getCoordinate().size()-1));
55790          closeArray();
55791        }
55792        if (anyHasExtras(element.getCoordinate())) {
55793          openArray("_coordinate");
55794          for (DecimalType e : element.getCoordinate()) 
55795            composeDecimalExtras(null, e, true);
55796          closeArray();
55797        }
55798      };
55799  }
55800
55801  protected void composeImageRegion3DComponent(String name, ImagingSelection.ImageRegion3DComponent element) throws IOException {
55802    if (element != null) {
55803      open(name);
55804      composeImageRegion3DComponentProperties(element);
55805      close();
55806    }
55807  }
55808
55809  protected void composeImageRegion3DComponentProperties(ImagingSelection.ImageRegion3DComponent element) throws IOException {
55810    composeBackboneElementProperties(element);
55811      if (element.hasRegionTypeElement()) {
55812        composeEnumerationCore("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection3DGraphicTypeEnumFactory(), false);
55813        composeEnumerationExtras("regionType", element.getRegionTypeElement(), new ImagingSelection.ImagingSelection3DGraphicTypeEnumFactory(), false);
55814      }
55815      if (element.hasCoordinate()) {
55816        if (anyHasValue(element.getCoordinate())) {
55817          openArray("coordinate");
55818          for (DecimalType e : element.getCoordinate()) 
55819            composeDecimalCore(null, e, e != element.getCoordinate().get(element.getCoordinate().size()-1));
55820          closeArray();
55821        }
55822        if (anyHasExtras(element.getCoordinate())) {
55823          openArray("_coordinate");
55824          for (DecimalType e : element.getCoordinate()) 
55825            composeDecimalExtras(null, e, true);
55826          closeArray();
55827        }
55828      };
55829  }
55830
55831  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
55832    if (element != null) {
55833      prop("resourceType", name);
55834      composeImagingStudyProperties(element);
55835    }
55836  }
55837
55838  protected void composeImagingStudyProperties(ImagingStudy element) throws IOException {
55839    composeDomainResourceProperties(element);
55840      if (element.hasIdentifier()) {
55841        openArray("identifier");
55842        for (Identifier e : element.getIdentifier()) 
55843          composeIdentifier(null, e);
55844        closeArray();
55845      };
55846      if (element.hasStatusElement()) {
55847        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
55848        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
55849      }
55850      if (element.hasModality()) {
55851        openArray("modality");
55852        for (CodeableConcept e : element.getModality()) 
55853          composeCodeableConcept(null, e);
55854        closeArray();
55855      };
55856      if (element.hasSubject()) {
55857        composeReference("subject", element.getSubject());
55858      }
55859      if (element.hasEncounter()) {
55860        composeReference("encounter", element.getEncounter());
55861      }
55862      if (element.hasStartedElement()) {
55863        composeDateTimeCore("started", element.getStartedElement(), false);
55864        composeDateTimeExtras("started", element.getStartedElement(), false);
55865      }
55866      if (element.hasBasedOn()) {
55867        openArray("basedOn");
55868        for (Reference e : element.getBasedOn()) 
55869          composeReference(null, e);
55870        closeArray();
55871      };
55872      if (element.hasPartOf()) {
55873        openArray("partOf");
55874        for (Reference e : element.getPartOf()) 
55875          composeReference(null, e);
55876        closeArray();
55877      };
55878      if (element.hasReferrer()) {
55879        composeReference("referrer", element.getReferrer());
55880      }
55881      if (element.hasEndpoint()) {
55882        openArray("endpoint");
55883        for (Reference e : element.getEndpoint()) 
55884          composeReference(null, e);
55885        closeArray();
55886      };
55887      if (element.hasNumberOfSeriesElement()) {
55888        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
55889        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
55890      }
55891      if (element.hasNumberOfInstancesElement()) {
55892        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
55893        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
55894      }
55895      if (element.hasProcedure()) {
55896        openArray("procedure");
55897        for (CodeableReference e : element.getProcedure()) 
55898          composeCodeableReference(null, e);
55899        closeArray();
55900      };
55901      if (element.hasLocation()) {
55902        composeReference("location", element.getLocation());
55903      }
55904      if (element.hasReason()) {
55905        openArray("reason");
55906        for (CodeableReference e : element.getReason()) 
55907          composeCodeableReference(null, e);
55908        closeArray();
55909      };
55910      if (element.hasNote()) {
55911        openArray("note");
55912        for (Annotation e : element.getNote()) 
55913          composeAnnotation(null, e);
55914        closeArray();
55915      };
55916      if (element.hasDescriptionElement()) {
55917        composeStringCore("description", element.getDescriptionElement(), false);
55918        composeStringExtras("description", element.getDescriptionElement(), false);
55919      }
55920      if (element.hasSeries()) {
55921        openArray("series");
55922        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
55923          composeImagingStudySeriesComponent(null, e);
55924        closeArray();
55925      };
55926  }
55927
55928  protected void composeImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
55929    if (element != null) {
55930      open(name);
55931      composeImagingStudySeriesComponentProperties(element);
55932      close();
55933    }
55934  }
55935
55936  protected void composeImagingStudySeriesComponentProperties(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
55937    composeBackboneElementProperties(element);
55938      if (element.hasUidElement()) {
55939        composeIdCore("uid", element.getUidElement(), false);
55940        composeIdExtras("uid", element.getUidElement(), false);
55941      }
55942      if (element.hasNumberElement()) {
55943        composeUnsignedIntCore("number", element.getNumberElement(), false);
55944        composeUnsignedIntExtras("number", element.getNumberElement(), false);
55945      }
55946      if (element.hasModality()) {
55947        composeCodeableConcept("modality", element.getModality());
55948      }
55949      if (element.hasDescriptionElement()) {
55950        composeStringCore("description", element.getDescriptionElement(), false);
55951        composeStringExtras("description", element.getDescriptionElement(), false);
55952      }
55953      if (element.hasNumberOfInstancesElement()) {
55954        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
55955        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
55956      }
55957      if (element.hasEndpoint()) {
55958        openArray("endpoint");
55959        for (Reference e : element.getEndpoint()) 
55960          composeReference(null, e);
55961        closeArray();
55962      };
55963      if (element.hasBodySite()) {
55964        composeCodeableReference("bodySite", element.getBodySite());
55965      }
55966      if (element.hasLaterality()) {
55967        composeCodeableConcept("laterality", element.getLaterality());
55968      }
55969      if (element.hasSpecimen()) {
55970        openArray("specimen");
55971        for (Reference e : element.getSpecimen()) 
55972          composeReference(null, e);
55973        closeArray();
55974      };
55975      if (element.hasStartedElement()) {
55976        composeDateTimeCore("started", element.getStartedElement(), false);
55977        composeDateTimeExtras("started", element.getStartedElement(), false);
55978      }
55979      if (element.hasPerformer()) {
55980        openArray("performer");
55981        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
55982          composeImagingStudySeriesPerformerComponent(null, e);
55983        closeArray();
55984      };
55985      if (element.hasInstance()) {
55986        openArray("instance");
55987        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
55988          composeImagingStudySeriesInstanceComponent(null, e);
55989        closeArray();
55990      };
55991  }
55992
55993  protected void composeImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
55994    if (element != null) {
55995      open(name);
55996      composeImagingStudySeriesPerformerComponentProperties(element);
55997      close();
55998    }
55999  }
56000
56001  protected void composeImagingStudySeriesPerformerComponentProperties(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
56002    composeBackboneElementProperties(element);
56003      if (element.hasFunction()) {
56004        composeCodeableConcept("function", element.getFunction());
56005      }
56006      if (element.hasActor()) {
56007        composeReference("actor", element.getActor());
56008      }
56009  }
56010
56011  protected void composeImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
56012    if (element != null) {
56013      open(name);
56014      composeImagingStudySeriesInstanceComponentProperties(element);
56015      close();
56016    }
56017  }
56018
56019  protected void composeImagingStudySeriesInstanceComponentProperties(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
56020    composeBackboneElementProperties(element);
56021      if (element.hasUidElement()) {
56022        composeIdCore("uid", element.getUidElement(), false);
56023        composeIdExtras("uid", element.getUidElement(), false);
56024      }
56025      if (element.hasSopClass()) {
56026        composeCoding("sopClass", element.getSopClass());
56027      }
56028      if (element.hasNumberElement()) {
56029        composeUnsignedIntCore("number", element.getNumberElement(), false);
56030        composeUnsignedIntExtras("number", element.getNumberElement(), false);
56031      }
56032      if (element.hasTitleElement()) {
56033        composeStringCore("title", element.getTitleElement(), false);
56034        composeStringExtras("title", element.getTitleElement(), false);
56035      }
56036  }
56037
56038  protected void composeImmunization(String name, Immunization element) throws IOException {
56039    if (element != null) {
56040      prop("resourceType", name);
56041      composeImmunizationProperties(element);
56042    }
56043  }
56044
56045  protected void composeImmunizationProperties(Immunization element) throws IOException {
56046    composeDomainResourceProperties(element);
56047      if (element.hasIdentifier()) {
56048        openArray("identifier");
56049        for (Identifier e : element.getIdentifier()) 
56050          composeIdentifier(null, e);
56051        closeArray();
56052      };
56053      if (element.hasBasedOn()) {
56054        openArray("basedOn");
56055        for (Reference e : element.getBasedOn()) 
56056          composeReference(null, e);
56057        closeArray();
56058      };
56059      if (element.hasStatusElement()) {
56060        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
56061        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
56062      }
56063      if (element.hasStatusReason()) {
56064        composeCodeableConcept("statusReason", element.getStatusReason());
56065      }
56066      if (element.hasVaccineCode()) {
56067        composeCodeableConcept("vaccineCode", element.getVaccineCode());
56068      }
56069      if (element.hasAdministeredProduct()) {
56070        composeCodeableReference("administeredProduct", element.getAdministeredProduct());
56071      }
56072      if (element.hasManufacturer()) {
56073        composeCodeableReference("manufacturer", element.getManufacturer());
56074      }
56075      if (element.hasLotNumberElement()) {
56076        composeStringCore("lotNumber", element.getLotNumberElement(), false);
56077        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
56078      }
56079      if (element.hasExpirationDateElement()) {
56080        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
56081        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
56082      }
56083      if (element.hasPatient()) {
56084        composeReference("patient", element.getPatient());
56085      }
56086      if (element.hasEncounter()) {
56087        composeReference("encounter", element.getEncounter());
56088      }
56089      if (element.hasSupportingInformation()) {
56090        openArray("supportingInformation");
56091        for (Reference e : element.getSupportingInformation()) 
56092          composeReference(null, e);
56093        closeArray();
56094      };
56095      if (element.hasOccurrence()) {
56096        composeType("occurrence", element.getOccurrence());
56097      }
56098      if (element.hasPrimarySourceElement()) {
56099        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
56100        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
56101      }
56102      if (element.hasInformationSource()) {
56103        composeCodeableReference("informationSource", element.getInformationSource());
56104      }
56105      if (element.hasLocation()) {
56106        composeReference("location", element.getLocation());
56107      }
56108      if (element.hasSite()) {
56109        composeCodeableConcept("site", element.getSite());
56110      }
56111      if (element.hasRoute()) {
56112        composeCodeableConcept("route", element.getRoute());
56113      }
56114      if (element.hasDoseQuantity()) {
56115        composeQuantity("doseQuantity", element.getDoseQuantity());
56116      }
56117      if (element.hasPerformer()) {
56118        openArray("performer");
56119        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
56120          composeImmunizationPerformerComponent(null, e);
56121        closeArray();
56122      };
56123      if (element.hasNote()) {
56124        openArray("note");
56125        for (Annotation e : element.getNote()) 
56126          composeAnnotation(null, e);
56127        closeArray();
56128      };
56129      if (element.hasReason()) {
56130        openArray("reason");
56131        for (CodeableReference e : element.getReason()) 
56132          composeCodeableReference(null, e);
56133        closeArray();
56134      };
56135      if (element.hasIsSubpotentElement()) {
56136        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
56137        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
56138      }
56139      if (element.hasSubpotentReason()) {
56140        openArray("subpotentReason");
56141        for (CodeableConcept e : element.getSubpotentReason()) 
56142          composeCodeableConcept(null, e);
56143        closeArray();
56144      };
56145      if (element.hasProgramEligibility()) {
56146        openArray("programEligibility");
56147        for (Immunization.ImmunizationProgramEligibilityComponent e : element.getProgramEligibility()) 
56148          composeImmunizationProgramEligibilityComponent(null, e);
56149        closeArray();
56150      };
56151      if (element.hasFundingSource()) {
56152        composeCodeableConcept("fundingSource", element.getFundingSource());
56153      }
56154      if (element.hasReaction()) {
56155        openArray("reaction");
56156        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
56157          composeImmunizationReactionComponent(null, e);
56158        closeArray();
56159      };
56160      if (element.hasProtocolApplied()) {
56161        openArray("protocolApplied");
56162        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
56163          composeImmunizationProtocolAppliedComponent(null, e);
56164        closeArray();
56165      };
56166  }
56167
56168  protected void composeImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
56169    if (element != null) {
56170      open(name);
56171      composeImmunizationPerformerComponentProperties(element);
56172      close();
56173    }
56174  }
56175
56176  protected void composeImmunizationPerformerComponentProperties(Immunization.ImmunizationPerformerComponent element) throws IOException {
56177    composeBackboneElementProperties(element);
56178      if (element.hasFunction()) {
56179        composeCodeableConcept("function", element.getFunction());
56180      }
56181      if (element.hasActor()) {
56182        composeReference("actor", element.getActor());
56183      }
56184  }
56185
56186  protected void composeImmunizationProgramEligibilityComponent(String name, Immunization.ImmunizationProgramEligibilityComponent element) throws IOException {
56187    if (element != null) {
56188      open(name);
56189      composeImmunizationProgramEligibilityComponentProperties(element);
56190      close();
56191    }
56192  }
56193
56194  protected void composeImmunizationProgramEligibilityComponentProperties(Immunization.ImmunizationProgramEligibilityComponent element) throws IOException {
56195    composeBackboneElementProperties(element);
56196      if (element.hasProgram()) {
56197        composeCodeableConcept("program", element.getProgram());
56198      }
56199      if (element.hasProgramStatus()) {
56200        composeCodeableConcept("programStatus", element.getProgramStatus());
56201      }
56202  }
56203
56204  protected void composeImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
56205    if (element != null) {
56206      open(name);
56207      composeImmunizationReactionComponentProperties(element);
56208      close();
56209    }
56210  }
56211
56212  protected void composeImmunizationReactionComponentProperties(Immunization.ImmunizationReactionComponent element) throws IOException {
56213    composeBackboneElementProperties(element);
56214      if (element.hasDateElement()) {
56215        composeDateTimeCore("date", element.getDateElement(), false);
56216        composeDateTimeExtras("date", element.getDateElement(), false);
56217      }
56218      if (element.hasManifestation()) {
56219        composeCodeableReference("manifestation", element.getManifestation());
56220      }
56221      if (element.hasReportedElement()) {
56222        composeBooleanCore("reported", element.getReportedElement(), false);
56223        composeBooleanExtras("reported", element.getReportedElement(), false);
56224      }
56225  }
56226
56227  protected void composeImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
56228    if (element != null) {
56229      open(name);
56230      composeImmunizationProtocolAppliedComponentProperties(element);
56231      close();
56232    }
56233  }
56234
56235  protected void composeImmunizationProtocolAppliedComponentProperties(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
56236    composeBackboneElementProperties(element);
56237      if (element.hasSeriesElement()) {
56238        composeStringCore("series", element.getSeriesElement(), false);
56239        composeStringExtras("series", element.getSeriesElement(), false);
56240      }
56241      if (element.hasAuthority()) {
56242        composeReference("authority", element.getAuthority());
56243      }
56244      if (element.hasTargetDisease()) {
56245        openArray("targetDisease");
56246        for (CodeableConcept e : element.getTargetDisease()) 
56247          composeCodeableConcept(null, e);
56248        closeArray();
56249      };
56250      if (element.hasDoseNumberElement()) {
56251        composeStringCore("doseNumber", element.getDoseNumberElement(), false);
56252        composeStringExtras("doseNumber", element.getDoseNumberElement(), false);
56253      }
56254      if (element.hasSeriesDosesElement()) {
56255        composeStringCore("seriesDoses", element.getSeriesDosesElement(), false);
56256        composeStringExtras("seriesDoses", element.getSeriesDosesElement(), false);
56257      }
56258  }
56259
56260  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
56261    if (element != null) {
56262      prop("resourceType", name);
56263      composeImmunizationEvaluationProperties(element);
56264    }
56265  }
56266
56267  protected void composeImmunizationEvaluationProperties(ImmunizationEvaluation element) throws IOException {
56268    composeDomainResourceProperties(element);
56269      if (element.hasIdentifier()) {
56270        openArray("identifier");
56271        for (Identifier e : element.getIdentifier()) 
56272          composeIdentifier(null, e);
56273        closeArray();
56274      };
56275      if (element.hasStatusElement()) {
56276        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
56277        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
56278      }
56279      if (element.hasPatient()) {
56280        composeReference("patient", element.getPatient());
56281      }
56282      if (element.hasDateElement()) {
56283        composeDateTimeCore("date", element.getDateElement(), false);
56284        composeDateTimeExtras("date", element.getDateElement(), false);
56285      }
56286      if (element.hasAuthority()) {
56287        composeReference("authority", element.getAuthority());
56288      }
56289      if (element.hasTargetDisease()) {
56290        composeCodeableConcept("targetDisease", element.getTargetDisease());
56291      }
56292      if (element.hasImmunizationEvent()) {
56293        composeReference("immunizationEvent", element.getImmunizationEvent());
56294      }
56295      if (element.hasDoseStatus()) {
56296        composeCodeableConcept("doseStatus", element.getDoseStatus());
56297      }
56298      if (element.hasDoseStatusReason()) {
56299        openArray("doseStatusReason");
56300        for (CodeableConcept e : element.getDoseStatusReason()) 
56301          composeCodeableConcept(null, e);
56302        closeArray();
56303      };
56304      if (element.hasDescriptionElement()) {
56305        composeMarkdownCore("description", element.getDescriptionElement(), false);
56306        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56307      }
56308      if (element.hasSeriesElement()) {
56309        composeStringCore("series", element.getSeriesElement(), false);
56310        composeStringExtras("series", element.getSeriesElement(), false);
56311      }
56312      if (element.hasDoseNumberElement()) {
56313        composeStringCore("doseNumber", element.getDoseNumberElement(), false);
56314        composeStringExtras("doseNumber", element.getDoseNumberElement(), false);
56315      }
56316      if (element.hasSeriesDosesElement()) {
56317        composeStringCore("seriesDoses", element.getSeriesDosesElement(), false);
56318        composeStringExtras("seriesDoses", element.getSeriesDosesElement(), false);
56319      }
56320  }
56321
56322  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
56323    if (element != null) {
56324      prop("resourceType", name);
56325      composeImmunizationRecommendationProperties(element);
56326    }
56327  }
56328
56329  protected void composeImmunizationRecommendationProperties(ImmunizationRecommendation element) throws IOException {
56330    composeDomainResourceProperties(element);
56331      if (element.hasIdentifier()) {
56332        openArray("identifier");
56333        for (Identifier e : element.getIdentifier()) 
56334          composeIdentifier(null, e);
56335        closeArray();
56336      };
56337      if (element.hasPatient()) {
56338        composeReference("patient", element.getPatient());
56339      }
56340      if (element.hasDateElement()) {
56341        composeDateTimeCore("date", element.getDateElement(), false);
56342        composeDateTimeExtras("date", element.getDateElement(), false);
56343      }
56344      if (element.hasAuthority()) {
56345        composeReference("authority", element.getAuthority());
56346      }
56347      if (element.hasRecommendation()) {
56348        openArray("recommendation");
56349        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
56350          composeImmunizationRecommendationRecommendationComponent(null, e);
56351        closeArray();
56352      };
56353  }
56354
56355  protected void composeImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
56356    if (element != null) {
56357      open(name);
56358      composeImmunizationRecommendationRecommendationComponentProperties(element);
56359      close();
56360    }
56361  }
56362
56363  protected void composeImmunizationRecommendationRecommendationComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
56364    composeBackboneElementProperties(element);
56365      if (element.hasVaccineCode()) {
56366        openArray("vaccineCode");
56367        for (CodeableConcept e : element.getVaccineCode()) 
56368          composeCodeableConcept(null, e);
56369        closeArray();
56370      };
56371      if (element.hasTargetDisease()) {
56372        openArray("targetDisease");
56373        for (CodeableConcept e : element.getTargetDisease()) 
56374          composeCodeableConcept(null, e);
56375        closeArray();
56376      };
56377      if (element.hasContraindicatedVaccineCode()) {
56378        openArray("contraindicatedVaccineCode");
56379        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
56380          composeCodeableConcept(null, e);
56381        closeArray();
56382      };
56383      if (element.hasForecastStatus()) {
56384        composeCodeableConcept("forecastStatus", element.getForecastStatus());
56385      }
56386      if (element.hasForecastReason()) {
56387        openArray("forecastReason");
56388        for (CodeableConcept e : element.getForecastReason()) 
56389          composeCodeableConcept(null, e);
56390        closeArray();
56391      };
56392      if (element.hasDateCriterion()) {
56393        openArray("dateCriterion");
56394        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
56395          composeImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
56396        closeArray();
56397      };
56398      if (element.hasDescriptionElement()) {
56399        composeMarkdownCore("description", element.getDescriptionElement(), false);
56400        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56401      }
56402      if (element.hasSeriesElement()) {
56403        composeStringCore("series", element.getSeriesElement(), false);
56404        composeStringExtras("series", element.getSeriesElement(), false);
56405      }
56406      if (element.hasDoseNumberElement()) {
56407        composeStringCore("doseNumber", element.getDoseNumberElement(), false);
56408        composeStringExtras("doseNumber", element.getDoseNumberElement(), false);
56409      }
56410      if (element.hasSeriesDosesElement()) {
56411        composeStringCore("seriesDoses", element.getSeriesDosesElement(), false);
56412        composeStringExtras("seriesDoses", element.getSeriesDosesElement(), false);
56413      }
56414      if (element.hasSupportingImmunization()) {
56415        openArray("supportingImmunization");
56416        for (Reference e : element.getSupportingImmunization()) 
56417          composeReference(null, e);
56418        closeArray();
56419      };
56420      if (element.hasSupportingPatientInformation()) {
56421        openArray("supportingPatientInformation");
56422        for (Reference e : element.getSupportingPatientInformation()) 
56423          composeReference(null, e);
56424        closeArray();
56425      };
56426  }
56427
56428  protected void composeImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
56429    if (element != null) {
56430      open(name);
56431      composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(element);
56432      close();
56433    }
56434  }
56435
56436  protected void composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
56437    composeBackboneElementProperties(element);
56438      if (element.hasCode()) {
56439        composeCodeableConcept("code", element.getCode());
56440      }
56441      if (element.hasValueElement()) {
56442        composeDateTimeCore("value", element.getValueElement(), false);
56443        composeDateTimeExtras("value", element.getValueElement(), false);
56444      }
56445  }
56446
56447  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
56448    if (element != null) {
56449      prop("resourceType", name);
56450      composeImplementationGuideProperties(element);
56451    }
56452  }
56453
56454  protected void composeImplementationGuideProperties(ImplementationGuide element) throws IOException {
56455    composeCanonicalResourceProperties(element);
56456      if (element.hasUrlElement()) {
56457        composeUriCore("url", element.getUrlElement(), false);
56458        composeUriExtras("url", element.getUrlElement(), false);
56459      }
56460      if (element.hasIdentifier()) {
56461        openArray("identifier");
56462        for (Identifier e : element.getIdentifier()) 
56463          composeIdentifier(null, e);
56464        closeArray();
56465      };
56466      if (element.hasVersionElement()) {
56467        composeStringCore("version", element.getVersionElement(), false);
56468        composeStringExtras("version", element.getVersionElement(), false);
56469      }
56470      if (element.hasVersionAlgorithm()) {
56471        composeType("versionAlgorithm", element.getVersionAlgorithm());
56472      }
56473      if (element.hasNameElement()) {
56474        composeStringCore("name", element.getNameElement(), false);
56475        composeStringExtras("name", element.getNameElement(), false);
56476      }
56477      if (element.hasTitleElement()) {
56478        composeStringCore("title", element.getTitleElement(), false);
56479        composeStringExtras("title", element.getTitleElement(), false);
56480      }
56481      if (element.hasStatusElement()) {
56482        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56483        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56484      }
56485      if (element.hasExperimentalElement()) {
56486        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56487        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56488      }
56489      if (element.hasDateElement()) {
56490        composeDateTimeCore("date", element.getDateElement(), false);
56491        composeDateTimeExtras("date", element.getDateElement(), false);
56492      }
56493      if (element.hasPublisherElement()) {
56494        composeStringCore("publisher", element.getPublisherElement(), false);
56495        composeStringExtras("publisher", element.getPublisherElement(), false);
56496      }
56497      if (element.hasContact()) {
56498        openArray("contact");
56499        for (ContactDetail e : element.getContact()) 
56500          composeContactDetail(null, e);
56501        closeArray();
56502      };
56503      if (element.hasDescriptionElement()) {
56504        composeMarkdownCore("description", element.getDescriptionElement(), false);
56505        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56506      }
56507      if (element.hasUseContext()) {
56508        openArray("useContext");
56509        for (UsageContext e : element.getUseContext()) 
56510          composeUsageContext(null, e);
56511        closeArray();
56512      };
56513      if (element.hasJurisdiction()) {
56514        openArray("jurisdiction");
56515        for (CodeableConcept e : element.getJurisdiction()) 
56516          composeCodeableConcept(null, e);
56517        closeArray();
56518      };
56519      if (element.hasPurposeElement()) {
56520        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56521        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56522      }
56523      if (element.hasCopyrightElement()) {
56524        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56525        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56526      }
56527      if (element.hasCopyrightLabelElement()) {
56528        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
56529        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
56530      }
56531      if (element.hasPackageIdElement()) {
56532        composeIdCore("packageId", element.getPackageIdElement(), false);
56533        composeIdExtras("packageId", element.getPackageIdElement(), false);
56534      }
56535      if (element.hasLicenseElement()) {
56536        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
56537        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
56538      }
56539      if (element.hasFhirVersion()) {
56540        openArray("fhirVersion");
56541        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56542          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56543        closeArray();
56544        if (anyHasExtras(element.getFhirVersion())) {
56545          openArray("_fhirVersion");
56546          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56547            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56548          closeArray();
56549        }
56550      };
56551      if (element.hasDependsOn()) {
56552        openArray("dependsOn");
56553        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
56554          composeImplementationGuideDependsOnComponent(null, e);
56555        closeArray();
56556      };
56557      if (element.hasGlobal()) {
56558        openArray("global");
56559        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
56560          composeImplementationGuideGlobalComponent(null, e);
56561        closeArray();
56562      };
56563      if (element.hasDefinition()) {
56564        composeImplementationGuideDefinitionComponent("definition", element.getDefinition());
56565      }
56566      if (element.hasManifest()) {
56567        composeImplementationGuideManifestComponent("manifest", element.getManifest());
56568      }
56569  }
56570
56571  protected void composeImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
56572    if (element != null) {
56573      open(name);
56574      composeImplementationGuideDependsOnComponentProperties(element);
56575      close();
56576    }
56577  }
56578
56579  protected void composeImplementationGuideDependsOnComponentProperties(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
56580    composeBackboneElementProperties(element);
56581      if (element.hasUriElement()) {
56582        composeCanonicalCore("uri", element.getUriElement(), false);
56583        composeCanonicalExtras("uri", element.getUriElement(), false);
56584      }
56585      if (element.hasPackageIdElement()) {
56586        composeIdCore("packageId", element.getPackageIdElement(), false);
56587        composeIdExtras("packageId", element.getPackageIdElement(), false);
56588      }
56589      if (element.hasVersionElement()) {
56590        composeStringCore("version", element.getVersionElement(), false);
56591        composeStringExtras("version", element.getVersionElement(), false);
56592      }
56593      if (element.hasReasonElement()) {
56594        composeMarkdownCore("reason", element.getReasonElement(), false);
56595        composeMarkdownExtras("reason", element.getReasonElement(), false);
56596      }
56597  }
56598
56599  protected void composeImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
56600    if (element != null) {
56601      open(name);
56602      composeImplementationGuideGlobalComponentProperties(element);
56603      close();
56604    }
56605  }
56606
56607  protected void composeImplementationGuideGlobalComponentProperties(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
56608    composeBackboneElementProperties(element);
56609      if (element.hasTypeElement()) {
56610        composeCodeCore("type", element.getTypeElement(), false);
56611        composeCodeExtras("type", element.getTypeElement(), false);
56612      }
56613      if (element.hasProfileElement()) {
56614        composeCanonicalCore("profile", element.getProfileElement(), false);
56615        composeCanonicalExtras("profile", element.getProfileElement(), false);
56616      }
56617  }
56618
56619  protected void composeImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
56620    if (element != null) {
56621      open(name);
56622      composeImplementationGuideDefinitionComponentProperties(element);
56623      close();
56624    }
56625  }
56626
56627  protected void composeImplementationGuideDefinitionComponentProperties(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
56628    composeBackboneElementProperties(element);
56629      if (element.hasGrouping()) {
56630        openArray("grouping");
56631        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
56632          composeImplementationGuideDefinitionGroupingComponent(null, e);
56633        closeArray();
56634      };
56635      if (element.hasResource()) {
56636        openArray("resource");
56637        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
56638          composeImplementationGuideDefinitionResourceComponent(null, e);
56639        closeArray();
56640      };
56641      if (element.hasPage()) {
56642        composeImplementationGuideDefinitionPageComponent("page", element.getPage());
56643      }
56644      if (element.hasParameter()) {
56645        openArray("parameter");
56646        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
56647          composeImplementationGuideDefinitionParameterComponent(null, e);
56648        closeArray();
56649      };
56650      if (element.hasTemplate()) {
56651        openArray("template");
56652        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
56653          composeImplementationGuideDefinitionTemplateComponent(null, e);
56654        closeArray();
56655      };
56656  }
56657
56658  protected void composeImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
56659    if (element != null) {
56660      open(name);
56661      composeImplementationGuideDefinitionGroupingComponentProperties(element);
56662      close();
56663    }
56664  }
56665
56666  protected void composeImplementationGuideDefinitionGroupingComponentProperties(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
56667    composeBackboneElementProperties(element);
56668      if (element.hasNameElement()) {
56669        composeStringCore("name", element.getNameElement(), false);
56670        composeStringExtras("name", element.getNameElement(), false);
56671      }
56672      if (element.hasDescriptionElement()) {
56673        composeMarkdownCore("description", element.getDescriptionElement(), false);
56674        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56675      }
56676  }
56677
56678  protected void composeImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
56679    if (element != null) {
56680      open(name);
56681      composeImplementationGuideDefinitionResourceComponentProperties(element);
56682      close();
56683    }
56684  }
56685
56686  protected void composeImplementationGuideDefinitionResourceComponentProperties(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
56687    composeBackboneElementProperties(element);
56688      if (element.hasReference()) {
56689        composeReference("reference", element.getReference());
56690      }
56691      if (element.hasFhirVersion()) {
56692        openArray("fhirVersion");
56693        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56694          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56695        closeArray();
56696        if (anyHasExtras(element.getFhirVersion())) {
56697          openArray("_fhirVersion");
56698          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
56699            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
56700          closeArray();
56701        }
56702      };
56703      if (element.hasNameElement()) {
56704        composeStringCore("name", element.getNameElement(), false);
56705        composeStringExtras("name", element.getNameElement(), false);
56706      }
56707      if (element.hasDescriptionElement()) {
56708        composeMarkdownCore("description", element.getDescriptionElement(), false);
56709        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56710      }
56711      if (element.hasIsExampleElement()) {
56712        composeBooleanCore("isExample", element.getIsExampleElement(), false);
56713        composeBooleanExtras("isExample", element.getIsExampleElement(), false);
56714      }
56715      if (element.hasProfile()) {
56716        if (anyHasValue(element.getProfile())) {
56717          openArray("profile");
56718          for (CanonicalType e : element.getProfile()) 
56719            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
56720          closeArray();
56721        }
56722        if (anyHasExtras(element.getProfile())) {
56723          openArray("_profile");
56724          for (CanonicalType e : element.getProfile()) 
56725            composeCanonicalExtras(null, e, true);
56726          closeArray();
56727        }
56728      };
56729      if (element.hasGroupingIdElement()) {
56730        composeIdCore("groupingId", element.getGroupingIdElement(), false);
56731        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
56732      }
56733  }
56734
56735  protected void composeImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
56736    if (element != null) {
56737      open(name);
56738      composeImplementationGuideDefinitionPageComponentProperties(element);
56739      close();
56740    }
56741  }
56742
56743  protected void composeImplementationGuideDefinitionPageComponentProperties(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
56744    composeBackboneElementProperties(element);
56745      if (element.hasSource()) {
56746        composeType("source", element.getSource());
56747      }
56748      if (element.hasNameElement()) {
56749        composeUrlCore("name", element.getNameElement(), false);
56750        composeUrlExtras("name", element.getNameElement(), false);
56751      }
56752      if (element.hasTitleElement()) {
56753        composeStringCore("title", element.getTitleElement(), false);
56754        composeStringExtras("title", element.getTitleElement(), false);
56755      }
56756      if (element.hasGenerationElement()) {
56757        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
56758        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
56759      }
56760      if (element.hasPage()) {
56761        openArray("page");
56762        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
56763          composeImplementationGuideDefinitionPageComponent(null, e);
56764        closeArray();
56765      };
56766  }
56767
56768  protected void composeImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
56769    if (element != null) {
56770      open(name);
56771      composeImplementationGuideDefinitionParameterComponentProperties(element);
56772      close();
56773    }
56774  }
56775
56776  protected void composeImplementationGuideDefinitionParameterComponentProperties(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
56777    composeBackboneElementProperties(element);
56778      if (element.hasCode()) {
56779        composeCoding("code", element.getCode());
56780      }
56781      if (element.hasValueElement()) {
56782        composeStringCore("value", element.getValueElement(), false);
56783        composeStringExtras("value", element.getValueElement(), false);
56784      }
56785  }
56786
56787  protected void composeImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
56788    if (element != null) {
56789      open(name);
56790      composeImplementationGuideDefinitionTemplateComponentProperties(element);
56791      close();
56792    }
56793  }
56794
56795  protected void composeImplementationGuideDefinitionTemplateComponentProperties(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
56796    composeBackboneElementProperties(element);
56797      if (element.hasCodeElement()) {
56798        composeCodeCore("code", element.getCodeElement(), false);
56799        composeCodeExtras("code", element.getCodeElement(), false);
56800      }
56801      if (element.hasSourceElement()) {
56802        composeStringCore("source", element.getSourceElement(), false);
56803        composeStringExtras("source", element.getSourceElement(), false);
56804      }
56805      if (element.hasScopeElement()) {
56806        composeStringCore("scope", element.getScopeElement(), false);
56807        composeStringExtras("scope", element.getScopeElement(), false);
56808      }
56809  }
56810
56811  protected void composeImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
56812    if (element != null) {
56813      open(name);
56814      composeImplementationGuideManifestComponentProperties(element);
56815      close();
56816    }
56817  }
56818
56819  protected void composeImplementationGuideManifestComponentProperties(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
56820    composeBackboneElementProperties(element);
56821      if (element.hasRenderingElement()) {
56822        composeUrlCore("rendering", element.getRenderingElement(), false);
56823        composeUrlExtras("rendering", element.getRenderingElement(), false);
56824      }
56825      if (element.hasResource()) {
56826        openArray("resource");
56827        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
56828          composeManifestResourceComponent(null, e);
56829        closeArray();
56830      };
56831      if (element.hasPage()) {
56832        openArray("page");
56833        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
56834          composeManifestPageComponent(null, e);
56835        closeArray();
56836      };
56837      if (element.hasImage()) {
56838        if (anyHasValue(element.getImage())) {
56839          openArray("image");
56840          for (StringType e : element.getImage()) 
56841            composeStringCore(null, e, e != element.getImage().get(element.getImage().size()-1));
56842          closeArray();
56843        }
56844        if (anyHasExtras(element.getImage())) {
56845          openArray("_image");
56846          for (StringType e : element.getImage()) 
56847            composeStringExtras(null, e, true);
56848          closeArray();
56849        }
56850      };
56851      if (element.hasOther()) {
56852        if (anyHasValue(element.getOther())) {
56853          openArray("other");
56854          for (StringType e : element.getOther()) 
56855            composeStringCore(null, e, e != element.getOther().get(element.getOther().size()-1));
56856          closeArray();
56857        }
56858        if (anyHasExtras(element.getOther())) {
56859          openArray("_other");
56860          for (StringType e : element.getOther()) 
56861            composeStringExtras(null, e, true);
56862          closeArray();
56863        }
56864      };
56865  }
56866
56867  protected void composeManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
56868    if (element != null) {
56869      open(name);
56870      composeManifestResourceComponentProperties(element);
56871      close();
56872    }
56873  }
56874
56875  protected void composeManifestResourceComponentProperties(ImplementationGuide.ManifestResourceComponent element) throws IOException {
56876    composeBackboneElementProperties(element);
56877      if (element.hasReference()) {
56878        composeReference("reference", element.getReference());
56879      }
56880      if (element.hasIsExampleElement()) {
56881        composeBooleanCore("isExample", element.getIsExampleElement(), false);
56882        composeBooleanExtras("isExample", element.getIsExampleElement(), false);
56883      }
56884      if (element.hasProfile()) {
56885        if (anyHasValue(element.getProfile())) {
56886          openArray("profile");
56887          for (CanonicalType e : element.getProfile()) 
56888            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
56889          closeArray();
56890        }
56891        if (anyHasExtras(element.getProfile())) {
56892          openArray("_profile");
56893          for (CanonicalType e : element.getProfile()) 
56894            composeCanonicalExtras(null, e, true);
56895          closeArray();
56896        }
56897      };
56898      if (element.hasRelativePathElement()) {
56899        composeUrlCore("relativePath", element.getRelativePathElement(), false);
56900        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
56901      }
56902  }
56903
56904  protected void composeManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
56905    if (element != null) {
56906      open(name);
56907      composeManifestPageComponentProperties(element);
56908      close();
56909    }
56910  }
56911
56912  protected void composeManifestPageComponentProperties(ImplementationGuide.ManifestPageComponent element) throws IOException {
56913    composeBackboneElementProperties(element);
56914      if (element.hasNameElement()) {
56915        composeStringCore("name", element.getNameElement(), false);
56916        composeStringExtras("name", element.getNameElement(), false);
56917      }
56918      if (element.hasTitleElement()) {
56919        composeStringCore("title", element.getTitleElement(), false);
56920        composeStringExtras("title", element.getTitleElement(), false);
56921      }
56922      if (element.hasAnchor()) {
56923        if (anyHasValue(element.getAnchor())) {
56924          openArray("anchor");
56925          for (StringType e : element.getAnchor()) 
56926            composeStringCore(null, e, e != element.getAnchor().get(element.getAnchor().size()-1));
56927          closeArray();
56928        }
56929        if (anyHasExtras(element.getAnchor())) {
56930          openArray("_anchor");
56931          for (StringType e : element.getAnchor()) 
56932            composeStringExtras(null, e, true);
56933          closeArray();
56934        }
56935      };
56936  }
56937
56938  protected void composeIngredient(String name, Ingredient element) throws IOException {
56939    if (element != null) {
56940      prop("resourceType", name);
56941      composeIngredientProperties(element);
56942    }
56943  }
56944
56945  protected void composeIngredientProperties(Ingredient element) throws IOException {
56946    composeDomainResourceProperties(element);
56947      if (element.hasIdentifier()) {
56948        composeIdentifier("identifier", element.getIdentifier());
56949      }
56950      if (element.hasStatusElement()) {
56951        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56952        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56953      }
56954      if (element.hasFor()) {
56955        openArray("for");
56956        for (Reference e : element.getFor()) 
56957          composeReference(null, e);
56958        closeArray();
56959      };
56960      if (element.hasRole()) {
56961        composeCodeableConcept("role", element.getRole());
56962      }
56963      if (element.hasFunction()) {
56964        openArray("function");
56965        for (CodeableConcept e : element.getFunction()) 
56966          composeCodeableConcept(null, e);
56967        closeArray();
56968      };
56969      if (element.hasGroup()) {
56970        composeCodeableConcept("group", element.getGroup());
56971      }
56972      if (element.hasAllergenicIndicatorElement()) {
56973        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
56974        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
56975      }
56976      if (element.hasCommentElement()) {
56977        composeMarkdownCore("comment", element.getCommentElement(), false);
56978        composeMarkdownExtras("comment", element.getCommentElement(), false);
56979      }
56980      if (element.hasManufacturer()) {
56981        openArray("manufacturer");
56982        for (Ingredient.IngredientManufacturerComponent e : element.getManufacturer()) 
56983          composeIngredientManufacturerComponent(null, e);
56984        closeArray();
56985      };
56986      if (element.hasSubstance()) {
56987        composeIngredientSubstanceComponent("substance", element.getSubstance());
56988      }
56989  }
56990
56991  protected void composeIngredientManufacturerComponent(String name, Ingredient.IngredientManufacturerComponent element) throws IOException {
56992    if (element != null) {
56993      open(name);
56994      composeIngredientManufacturerComponentProperties(element);
56995      close();
56996    }
56997  }
56998
56999  protected void composeIngredientManufacturerComponentProperties(Ingredient.IngredientManufacturerComponent element) throws IOException {
57000    composeBackboneElementProperties(element);
57001      if (element.hasRoleElement()) {
57002        composeEnumerationCore("role", element.getRoleElement(), new Ingredient.IngredientManufacturerRoleEnumFactory(), false);
57003        composeEnumerationExtras("role", element.getRoleElement(), new Ingredient.IngredientManufacturerRoleEnumFactory(), false);
57004      }
57005      if (element.hasManufacturer()) {
57006        composeReference("manufacturer", element.getManufacturer());
57007      }
57008  }
57009
57010  protected void composeIngredientSubstanceComponent(String name, Ingredient.IngredientSubstanceComponent element) throws IOException {
57011    if (element != null) {
57012      open(name);
57013      composeIngredientSubstanceComponentProperties(element);
57014      close();
57015    }
57016  }
57017
57018  protected void composeIngredientSubstanceComponentProperties(Ingredient.IngredientSubstanceComponent element) throws IOException {
57019    composeBackboneElementProperties(element);
57020      if (element.hasCode()) {
57021        composeCodeableReference("code", element.getCode());
57022      }
57023      if (element.hasStrength()) {
57024        openArray("strength");
57025        for (Ingredient.IngredientSubstanceStrengthComponent e : element.getStrength()) 
57026          composeIngredientSubstanceStrengthComponent(null, e);
57027        closeArray();
57028      };
57029  }
57030
57031  protected void composeIngredientSubstanceStrengthComponent(String name, Ingredient.IngredientSubstanceStrengthComponent element) throws IOException {
57032    if (element != null) {
57033      open(name);
57034      composeIngredientSubstanceStrengthComponentProperties(element);
57035      close();
57036    }
57037  }
57038
57039  protected void composeIngredientSubstanceStrengthComponentProperties(Ingredient.IngredientSubstanceStrengthComponent element) throws IOException {
57040    composeBackboneElementProperties(element);
57041      if (element.hasPresentation()) {
57042        composeType("presentation", element.getPresentation());
57043      }
57044      if (element.hasTextPresentationElement()) {
57045        composeStringCore("textPresentation", element.getTextPresentationElement(), false);
57046        composeStringExtras("textPresentation", element.getTextPresentationElement(), false);
57047      }
57048      if (element.hasConcentration()) {
57049        composeType("concentration", element.getConcentration());
57050      }
57051      if (element.hasTextConcentrationElement()) {
57052        composeStringCore("textConcentration", element.getTextConcentrationElement(), false);
57053        composeStringExtras("textConcentration", element.getTextConcentrationElement(), false);
57054      }
57055      if (element.hasBasis()) {
57056        composeCodeableConcept("basis", element.getBasis());
57057      }
57058      if (element.hasMeasurementPointElement()) {
57059        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
57060        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
57061      }
57062      if (element.hasCountry()) {
57063        openArray("country");
57064        for (CodeableConcept e : element.getCountry()) 
57065          composeCodeableConcept(null, e);
57066        closeArray();
57067      };
57068      if (element.hasReferenceStrength()) {
57069        openArray("referenceStrength");
57070        for (Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
57071          composeIngredientSubstanceStrengthReferenceStrengthComponent(null, e);
57072        closeArray();
57073      };
57074  }
57075
57076  protected void composeIngredientSubstanceStrengthReferenceStrengthComponent(String name, Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent element) throws IOException {
57077    if (element != null) {
57078      open(name);
57079      composeIngredientSubstanceStrengthReferenceStrengthComponentProperties(element);
57080      close();
57081    }
57082  }
57083
57084  protected void composeIngredientSubstanceStrengthReferenceStrengthComponentProperties(Ingredient.IngredientSubstanceStrengthReferenceStrengthComponent element) throws IOException {
57085    composeBackboneElementProperties(element);
57086      if (element.hasSubstance()) {
57087        composeCodeableReference("substance", element.getSubstance());
57088      }
57089      if (element.hasStrength()) {
57090        composeType("strength", element.getStrength());
57091      }
57092      if (element.hasMeasurementPointElement()) {
57093        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
57094        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
57095      }
57096      if (element.hasCountry()) {
57097        openArray("country");
57098        for (CodeableConcept e : element.getCountry()) 
57099          composeCodeableConcept(null, e);
57100        closeArray();
57101      };
57102  }
57103
57104  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
57105    if (element != null) {
57106      prop("resourceType", name);
57107      composeInsurancePlanProperties(element);
57108    }
57109  }
57110
57111  protected void composeInsurancePlanProperties(InsurancePlan element) throws IOException {
57112    composeDomainResourceProperties(element);
57113      if (element.hasIdentifier()) {
57114        openArray("identifier");
57115        for (Identifier e : element.getIdentifier()) 
57116          composeIdentifier(null, e);
57117        closeArray();
57118      };
57119      if (element.hasStatusElement()) {
57120        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57121        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57122      }
57123      if (element.hasType()) {
57124        openArray("type");
57125        for (CodeableConcept e : element.getType()) 
57126          composeCodeableConcept(null, e);
57127        closeArray();
57128      };
57129      if (element.hasNameElement()) {
57130        composeStringCore("name", element.getNameElement(), false);
57131        composeStringExtras("name", element.getNameElement(), false);
57132      }
57133      if (element.hasAlias()) {
57134        if (anyHasValue(element.getAlias())) {
57135          openArray("alias");
57136          for (StringType e : element.getAlias()) 
57137            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
57138          closeArray();
57139        }
57140        if (anyHasExtras(element.getAlias())) {
57141          openArray("_alias");
57142          for (StringType e : element.getAlias()) 
57143            composeStringExtras(null, e, true);
57144          closeArray();
57145        }
57146      };
57147      if (element.hasPeriod()) {
57148        composePeriod("period", element.getPeriod());
57149      }
57150      if (element.hasOwnedBy()) {
57151        composeReference("ownedBy", element.getOwnedBy());
57152      }
57153      if (element.hasAdministeredBy()) {
57154        composeReference("administeredBy", element.getAdministeredBy());
57155      }
57156      if (element.hasCoverageArea()) {
57157        openArray("coverageArea");
57158        for (Reference e : element.getCoverageArea()) 
57159          composeReference(null, e);
57160        closeArray();
57161      };
57162      if (element.hasContact()) {
57163        openArray("contact");
57164        for (ExtendedContactDetail e : element.getContact()) 
57165          composeExtendedContactDetail(null, e);
57166        closeArray();
57167      };
57168      if (element.hasEndpoint()) {
57169        openArray("endpoint");
57170        for (Reference e : element.getEndpoint()) 
57171          composeReference(null, e);
57172        closeArray();
57173      };
57174      if (element.hasNetwork()) {
57175        openArray("network");
57176        for (Reference e : element.getNetwork()) 
57177          composeReference(null, e);
57178        closeArray();
57179      };
57180      if (element.hasCoverage()) {
57181        openArray("coverage");
57182        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
57183          composeInsurancePlanCoverageComponent(null, e);
57184        closeArray();
57185      };
57186      if (element.hasPlan()) {
57187        openArray("plan");
57188        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
57189          composeInsurancePlanPlanComponent(null, e);
57190        closeArray();
57191      };
57192  }
57193
57194  protected void composeInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
57195    if (element != null) {
57196      open(name);
57197      composeInsurancePlanCoverageComponentProperties(element);
57198      close();
57199    }
57200  }
57201
57202  protected void composeInsurancePlanCoverageComponentProperties(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
57203    composeBackboneElementProperties(element);
57204      if (element.hasType()) {
57205        composeCodeableConcept("type", element.getType());
57206      }
57207      if (element.hasNetwork()) {
57208        openArray("network");
57209        for (Reference e : element.getNetwork()) 
57210          composeReference(null, e);
57211        closeArray();
57212      };
57213      if (element.hasBenefit()) {
57214        openArray("benefit");
57215        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
57216          composeCoverageBenefitComponent(null, e);
57217        closeArray();
57218      };
57219  }
57220
57221  protected void composeCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
57222    if (element != null) {
57223      open(name);
57224      composeCoverageBenefitComponentProperties(element);
57225      close();
57226    }
57227  }
57228
57229  protected void composeCoverageBenefitComponentProperties(InsurancePlan.CoverageBenefitComponent element) throws IOException {
57230    composeBackboneElementProperties(element);
57231      if (element.hasType()) {
57232        composeCodeableConcept("type", element.getType());
57233      }
57234      if (element.hasRequirementElement()) {
57235        composeStringCore("requirement", element.getRequirementElement(), false);
57236        composeStringExtras("requirement", element.getRequirementElement(), false);
57237      }
57238      if (element.hasLimit()) {
57239        openArray("limit");
57240        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
57241          composeCoverageBenefitLimitComponent(null, e);
57242        closeArray();
57243      };
57244  }
57245
57246  protected void composeCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
57247    if (element != null) {
57248      open(name);
57249      composeCoverageBenefitLimitComponentProperties(element);
57250      close();
57251    }
57252  }
57253
57254  protected void composeCoverageBenefitLimitComponentProperties(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
57255    composeBackboneElementProperties(element);
57256      if (element.hasValue()) {
57257        composeQuantity("value", element.getValue());
57258      }
57259      if (element.hasCode()) {
57260        composeCodeableConcept("code", element.getCode());
57261      }
57262  }
57263
57264  protected void composeInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
57265    if (element != null) {
57266      open(name);
57267      composeInsurancePlanPlanComponentProperties(element);
57268      close();
57269    }
57270  }
57271
57272  protected void composeInsurancePlanPlanComponentProperties(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
57273    composeBackboneElementProperties(element);
57274      if (element.hasIdentifier()) {
57275        openArray("identifier");
57276        for (Identifier e : element.getIdentifier()) 
57277          composeIdentifier(null, e);
57278        closeArray();
57279      };
57280      if (element.hasType()) {
57281        composeCodeableConcept("type", element.getType());
57282      }
57283      if (element.hasCoverageArea()) {
57284        openArray("coverageArea");
57285        for (Reference e : element.getCoverageArea()) 
57286          composeReference(null, e);
57287        closeArray();
57288      };
57289      if (element.hasNetwork()) {
57290        openArray("network");
57291        for (Reference e : element.getNetwork()) 
57292          composeReference(null, e);
57293        closeArray();
57294      };
57295      if (element.hasGeneralCost()) {
57296        openArray("generalCost");
57297        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
57298          composeInsurancePlanPlanGeneralCostComponent(null, e);
57299        closeArray();
57300      };
57301      if (element.hasSpecificCost()) {
57302        openArray("specificCost");
57303        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
57304          composeInsurancePlanPlanSpecificCostComponent(null, e);
57305        closeArray();
57306      };
57307  }
57308
57309  protected void composeInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
57310    if (element != null) {
57311      open(name);
57312      composeInsurancePlanPlanGeneralCostComponentProperties(element);
57313      close();
57314    }
57315  }
57316
57317  protected void composeInsurancePlanPlanGeneralCostComponentProperties(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
57318    composeBackboneElementProperties(element);
57319      if (element.hasType()) {
57320        composeCodeableConcept("type", element.getType());
57321      }
57322      if (element.hasGroupSizeElement()) {
57323        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
57324        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
57325      }
57326      if (element.hasCost()) {
57327        composeMoney("cost", element.getCost());
57328      }
57329      if (element.hasCommentElement()) {
57330        composeStringCore("comment", element.getCommentElement(), false);
57331        composeStringExtras("comment", element.getCommentElement(), false);
57332      }
57333  }
57334
57335  protected void composeInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
57336    if (element != null) {
57337      open(name);
57338      composeInsurancePlanPlanSpecificCostComponentProperties(element);
57339      close();
57340    }
57341  }
57342
57343  protected void composeInsurancePlanPlanSpecificCostComponentProperties(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
57344    composeBackboneElementProperties(element);
57345      if (element.hasCategory()) {
57346        composeCodeableConcept("category", element.getCategory());
57347      }
57348      if (element.hasBenefit()) {
57349        openArray("benefit");
57350        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
57351          composePlanBenefitComponent(null, e);
57352        closeArray();
57353      };
57354  }
57355
57356  protected void composePlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
57357    if (element != null) {
57358      open(name);
57359      composePlanBenefitComponentProperties(element);
57360      close();
57361    }
57362  }
57363
57364  protected void composePlanBenefitComponentProperties(InsurancePlan.PlanBenefitComponent element) throws IOException {
57365    composeBackboneElementProperties(element);
57366      if (element.hasType()) {
57367        composeCodeableConcept("type", element.getType());
57368      }
57369      if (element.hasCost()) {
57370        openArray("cost");
57371        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
57372          composePlanBenefitCostComponent(null, e);
57373        closeArray();
57374      };
57375  }
57376
57377  protected void composePlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
57378    if (element != null) {
57379      open(name);
57380      composePlanBenefitCostComponentProperties(element);
57381      close();
57382    }
57383  }
57384
57385  protected void composePlanBenefitCostComponentProperties(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
57386    composeBackboneElementProperties(element);
57387      if (element.hasType()) {
57388        composeCodeableConcept("type", element.getType());
57389      }
57390      if (element.hasApplicability()) {
57391        composeCodeableConcept("applicability", element.getApplicability());
57392      }
57393      if (element.hasQualifiers()) {
57394        openArray("qualifiers");
57395        for (CodeableConcept e : element.getQualifiers()) 
57396          composeCodeableConcept(null, e);
57397        closeArray();
57398      };
57399      if (element.hasValue()) {
57400        composeQuantity("value", element.getValue());
57401      }
57402  }
57403
57404  protected void composeInventoryItem(String name, InventoryItem element) throws IOException {
57405    if (element != null) {
57406      prop("resourceType", name);
57407      composeInventoryItemProperties(element);
57408    }
57409  }
57410
57411  protected void composeInventoryItemProperties(InventoryItem element) throws IOException {
57412    composeDomainResourceProperties(element);
57413      if (element.hasIdentifier()) {
57414        openArray("identifier");
57415        for (Identifier e : element.getIdentifier()) 
57416          composeIdentifier(null, e);
57417        closeArray();
57418      };
57419      if (element.hasStatusElement()) {
57420        composeEnumerationCore("status", element.getStatusElement(), new InventoryItem.InventoryItemStatusCodesEnumFactory(), false);
57421        composeEnumerationExtras("status", element.getStatusElement(), new InventoryItem.InventoryItemStatusCodesEnumFactory(), false);
57422      }
57423      if (element.hasCategory()) {
57424        openArray("category");
57425        for (CodeableConcept e : element.getCategory()) 
57426          composeCodeableConcept(null, e);
57427        closeArray();
57428      };
57429      if (element.hasCode()) {
57430        openArray("code");
57431        for (CodeableConcept e : element.getCode()) 
57432          composeCodeableConcept(null, e);
57433        closeArray();
57434      };
57435      if (element.hasName()) {
57436        openArray("name");
57437        for (InventoryItem.InventoryItemNameComponent e : element.getName()) 
57438          composeInventoryItemNameComponent(null, e);
57439        closeArray();
57440      };
57441      if (element.hasResponsibleOrganization()) {
57442        openArray("responsibleOrganization");
57443        for (InventoryItem.InventoryItemResponsibleOrganizationComponent e : element.getResponsibleOrganization()) 
57444          composeInventoryItemResponsibleOrganizationComponent(null, e);
57445        closeArray();
57446      };
57447      if (element.hasDescription()) {
57448        composeInventoryItemDescriptionComponent("description", element.getDescription());
57449      }
57450      if (element.hasInventoryStatus()) {
57451        openArray("inventoryStatus");
57452        for (CodeableConcept e : element.getInventoryStatus()) 
57453          composeCodeableConcept(null, e);
57454        closeArray();
57455      };
57456      if (element.hasBaseUnit()) {
57457        composeCodeableConcept("baseUnit", element.getBaseUnit());
57458      }
57459      if (element.hasNetContent()) {
57460        composeQuantity("netContent", element.getNetContent());
57461      }
57462      if (element.hasAssociation()) {
57463        openArray("association");
57464        for (InventoryItem.InventoryItemAssociationComponent e : element.getAssociation()) 
57465          composeInventoryItemAssociationComponent(null, e);
57466        closeArray();
57467      };
57468      if (element.hasCharacteristic()) {
57469        openArray("characteristic");
57470        for (InventoryItem.InventoryItemCharacteristicComponent e : element.getCharacteristic()) 
57471          composeInventoryItemCharacteristicComponent(null, e);
57472        closeArray();
57473      };
57474      if (element.hasInstance()) {
57475        composeInventoryItemInstanceComponent("instance", element.getInstance());
57476      }
57477      if (element.hasProductReference()) {
57478        composeReference("productReference", element.getProductReference());
57479      }
57480  }
57481
57482  protected void composeInventoryItemNameComponent(String name, InventoryItem.InventoryItemNameComponent element) throws IOException {
57483    if (element != null) {
57484      open(name);
57485      composeInventoryItemNameComponentProperties(element);
57486      close();
57487    }
57488  }
57489
57490  protected void composeInventoryItemNameComponentProperties(InventoryItem.InventoryItemNameComponent element) throws IOException {
57491    composeBackboneElementProperties(element);
57492      if (element.hasNameType()) {
57493        composeCoding("nameType", element.getNameType());
57494      }
57495      if (element.hasLanguageElement()) {
57496        composeEnumerationCore("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57497        composeEnumerationExtras("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57498      }
57499      if (element.hasNameElement()) {
57500        composeStringCore("name", element.getNameElement(), false);
57501        composeStringExtras("name", element.getNameElement(), false);
57502      }
57503  }
57504
57505  protected void composeInventoryItemResponsibleOrganizationComponent(String name, InventoryItem.InventoryItemResponsibleOrganizationComponent element) throws IOException {
57506    if (element != null) {
57507      open(name);
57508      composeInventoryItemResponsibleOrganizationComponentProperties(element);
57509      close();
57510    }
57511  }
57512
57513  protected void composeInventoryItemResponsibleOrganizationComponentProperties(InventoryItem.InventoryItemResponsibleOrganizationComponent element) throws IOException {
57514    composeBackboneElementProperties(element);
57515      if (element.hasRole()) {
57516        composeCodeableConcept("role", element.getRole());
57517      }
57518      if (element.hasOrganization()) {
57519        composeReference("organization", element.getOrganization());
57520      }
57521  }
57522
57523  protected void composeInventoryItemDescriptionComponent(String name, InventoryItem.InventoryItemDescriptionComponent element) throws IOException {
57524    if (element != null) {
57525      open(name);
57526      composeInventoryItemDescriptionComponentProperties(element);
57527      close();
57528    }
57529  }
57530
57531  protected void composeInventoryItemDescriptionComponentProperties(InventoryItem.InventoryItemDescriptionComponent element) throws IOException {
57532    composeBackboneElementProperties(element);
57533      if (element.hasLanguageElement()) {
57534        composeEnumerationCore("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57535        composeEnumerationExtras("language", element.getLanguageElement(), new Enumerations.CommonLanguagesEnumFactory(), false);
57536      }
57537      if (element.hasDescriptionElement()) {
57538        composeStringCore("description", element.getDescriptionElement(), false);
57539        composeStringExtras("description", element.getDescriptionElement(), false);
57540      }
57541  }
57542
57543  protected void composeInventoryItemAssociationComponent(String name, InventoryItem.InventoryItemAssociationComponent element) throws IOException {
57544    if (element != null) {
57545      open(name);
57546      composeInventoryItemAssociationComponentProperties(element);
57547      close();
57548    }
57549  }
57550
57551  protected void composeInventoryItemAssociationComponentProperties(InventoryItem.InventoryItemAssociationComponent element) throws IOException {
57552    composeBackboneElementProperties(element);
57553      if (element.hasAssociationType()) {
57554        composeCodeableConcept("associationType", element.getAssociationType());
57555      }
57556      if (element.hasRelatedItem()) {
57557        composeReference("relatedItem", element.getRelatedItem());
57558      }
57559      if (element.hasQuantity()) {
57560        composeRatio("quantity", element.getQuantity());
57561      }
57562  }
57563
57564  protected void composeInventoryItemCharacteristicComponent(String name, InventoryItem.InventoryItemCharacteristicComponent element) throws IOException {
57565    if (element != null) {
57566      open(name);
57567      composeInventoryItemCharacteristicComponentProperties(element);
57568      close();
57569    }
57570  }
57571
57572  protected void composeInventoryItemCharacteristicComponentProperties(InventoryItem.InventoryItemCharacteristicComponent element) throws IOException {
57573    composeBackboneElementProperties(element);
57574      if (element.hasCharacteristicType()) {
57575        composeCodeableConcept("characteristicType", element.getCharacteristicType());
57576      }
57577      if (element.hasValue()) {
57578        composeType("value", element.getValue());
57579      }
57580  }
57581
57582  protected void composeInventoryItemInstanceComponent(String name, InventoryItem.InventoryItemInstanceComponent element) throws IOException {
57583    if (element != null) {
57584      open(name);
57585      composeInventoryItemInstanceComponentProperties(element);
57586      close();
57587    }
57588  }
57589
57590  protected void composeInventoryItemInstanceComponentProperties(InventoryItem.InventoryItemInstanceComponent element) throws IOException {
57591    composeBackboneElementProperties(element);
57592      if (element.hasIdentifier()) {
57593        openArray("identifier");
57594        for (Identifier e : element.getIdentifier()) 
57595          composeIdentifier(null, e);
57596        closeArray();
57597      };
57598      if (element.hasLotNumberElement()) {
57599        composeStringCore("lotNumber", element.getLotNumberElement(), false);
57600        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
57601      }
57602      if (element.hasExpiryElement()) {
57603        composeDateTimeCore("expiry", element.getExpiryElement(), false);
57604        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
57605      }
57606      if (element.hasSubject()) {
57607        composeReference("subject", element.getSubject());
57608      }
57609      if (element.hasLocation()) {
57610        composeReference("location", element.getLocation());
57611      }
57612  }
57613
57614  protected void composeInventoryReport(String name, InventoryReport element) throws IOException {
57615    if (element != null) {
57616      prop("resourceType", name);
57617      composeInventoryReportProperties(element);
57618    }
57619  }
57620
57621  protected void composeInventoryReportProperties(InventoryReport element) throws IOException {
57622    composeDomainResourceProperties(element);
57623      if (element.hasIdentifier()) {
57624        openArray("identifier");
57625        for (Identifier e : element.getIdentifier()) 
57626          composeIdentifier(null, e);
57627        closeArray();
57628      };
57629      if (element.hasStatusElement()) {
57630        composeEnumerationCore("status", element.getStatusElement(), new InventoryReport.InventoryReportStatusEnumFactory(), false);
57631        composeEnumerationExtras("status", element.getStatusElement(), new InventoryReport.InventoryReportStatusEnumFactory(), false);
57632      }
57633      if (element.hasCountTypeElement()) {
57634        composeEnumerationCore("countType", element.getCountTypeElement(), new InventoryReport.InventoryCountTypeEnumFactory(), false);
57635        composeEnumerationExtras("countType", element.getCountTypeElement(), new InventoryReport.InventoryCountTypeEnumFactory(), false);
57636      }
57637      if (element.hasOperationType()) {
57638        composeCodeableConcept("operationType", element.getOperationType());
57639      }
57640      if (element.hasOperationTypeReason()) {
57641        composeCodeableConcept("operationTypeReason", element.getOperationTypeReason());
57642      }
57643      if (element.hasReportedDateTimeElement()) {
57644        composeDateTimeCore("reportedDateTime", element.getReportedDateTimeElement(), false);
57645        composeDateTimeExtras("reportedDateTime", element.getReportedDateTimeElement(), false);
57646      }
57647      if (element.hasReporter()) {
57648        composeReference("reporter", element.getReporter());
57649      }
57650      if (element.hasReportingPeriod()) {
57651        composePeriod("reportingPeriod", element.getReportingPeriod());
57652      }
57653      if (element.hasInventoryListing()) {
57654        openArray("inventoryListing");
57655        for (InventoryReport.InventoryReportInventoryListingComponent e : element.getInventoryListing()) 
57656          composeInventoryReportInventoryListingComponent(null, e);
57657        closeArray();
57658      };
57659      if (element.hasNote()) {
57660        openArray("note");
57661        for (Annotation e : element.getNote()) 
57662          composeAnnotation(null, e);
57663        closeArray();
57664      };
57665  }
57666
57667  protected void composeInventoryReportInventoryListingComponent(String name, InventoryReport.InventoryReportInventoryListingComponent element) throws IOException {
57668    if (element != null) {
57669      open(name);
57670      composeInventoryReportInventoryListingComponentProperties(element);
57671      close();
57672    }
57673  }
57674
57675  protected void composeInventoryReportInventoryListingComponentProperties(InventoryReport.InventoryReportInventoryListingComponent element) throws IOException {
57676    composeBackboneElementProperties(element);
57677      if (element.hasLocation()) {
57678        composeReference("location", element.getLocation());
57679      }
57680      if (element.hasItemStatus()) {
57681        composeCodeableConcept("itemStatus", element.getItemStatus());
57682      }
57683      if (element.hasCountingDateTimeElement()) {
57684        composeDateTimeCore("countingDateTime", element.getCountingDateTimeElement(), false);
57685        composeDateTimeExtras("countingDateTime", element.getCountingDateTimeElement(), false);
57686      }
57687      if (element.hasItem()) {
57688        openArray("item");
57689        for (InventoryReport.InventoryReportInventoryListingItemComponent e : element.getItem()) 
57690          composeInventoryReportInventoryListingItemComponent(null, e);
57691        closeArray();
57692      };
57693  }
57694
57695  protected void composeInventoryReportInventoryListingItemComponent(String name, InventoryReport.InventoryReportInventoryListingItemComponent element) throws IOException {
57696    if (element != null) {
57697      open(name);
57698      composeInventoryReportInventoryListingItemComponentProperties(element);
57699      close();
57700    }
57701  }
57702
57703  protected void composeInventoryReportInventoryListingItemComponentProperties(InventoryReport.InventoryReportInventoryListingItemComponent element) throws IOException {
57704    composeBackboneElementProperties(element);
57705      if (element.hasCategory()) {
57706        composeCodeableConcept("category", element.getCategory());
57707      }
57708      if (element.hasQuantity()) {
57709        composeQuantity("quantity", element.getQuantity());
57710      }
57711      if (element.hasItem()) {
57712        composeCodeableReference("item", element.getItem());
57713      }
57714  }
57715
57716  protected void composeInvoice(String name, Invoice element) throws IOException {
57717    if (element != null) {
57718      prop("resourceType", name);
57719      composeInvoiceProperties(element);
57720    }
57721  }
57722
57723  protected void composeInvoiceProperties(Invoice element) throws IOException {
57724    composeDomainResourceProperties(element);
57725      if (element.hasIdentifier()) {
57726        openArray("identifier");
57727        for (Identifier e : element.getIdentifier()) 
57728          composeIdentifier(null, e);
57729        closeArray();
57730      };
57731      if (element.hasStatusElement()) {
57732        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
57733        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
57734      }
57735      if (element.hasCancelledReasonElement()) {
57736        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
57737        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
57738      }
57739      if (element.hasType()) {
57740        composeCodeableConcept("type", element.getType());
57741      }
57742      if (element.hasSubject()) {
57743        composeReference("subject", element.getSubject());
57744      }
57745      if (element.hasRecipient()) {
57746        composeReference("recipient", element.getRecipient());
57747      }
57748      if (element.hasDateElement()) {
57749        composeDateTimeCore("date", element.getDateElement(), false);
57750        composeDateTimeExtras("date", element.getDateElement(), false);
57751      }
57752      if (element.hasCreationElement()) {
57753        composeDateTimeCore("creation", element.getCreationElement(), false);
57754        composeDateTimeExtras("creation", element.getCreationElement(), false);
57755      }
57756      if (element.hasPeriod()) {
57757        composeType("period", element.getPeriod());
57758      }
57759      if (element.hasParticipant()) {
57760        openArray("participant");
57761        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
57762          composeInvoiceParticipantComponent(null, e);
57763        closeArray();
57764      };
57765      if (element.hasIssuer()) {
57766        composeReference("issuer", element.getIssuer());
57767      }
57768      if (element.hasAccount()) {
57769        composeReference("account", element.getAccount());
57770      }
57771      if (element.hasLineItem()) {
57772        openArray("lineItem");
57773        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
57774          composeInvoiceLineItemComponent(null, e);
57775        closeArray();
57776      };
57777      if (element.hasTotalPriceComponent()) {
57778        openArray("totalPriceComponent");
57779        for (MonetaryComponent e : element.getTotalPriceComponent()) 
57780          composeMonetaryComponent(null, e);
57781        closeArray();
57782      };
57783      if (element.hasTotalNet()) {
57784        composeMoney("totalNet", element.getTotalNet());
57785      }
57786      if (element.hasTotalGross()) {
57787        composeMoney("totalGross", element.getTotalGross());
57788      }
57789      if (element.hasPaymentTermsElement()) {
57790        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
57791        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
57792      }
57793      if (element.hasNote()) {
57794        openArray("note");
57795        for (Annotation e : element.getNote()) 
57796          composeAnnotation(null, e);
57797        closeArray();
57798      };
57799  }
57800
57801  protected void composeInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
57802    if (element != null) {
57803      open(name);
57804      composeInvoiceParticipantComponentProperties(element);
57805      close();
57806    }
57807  }
57808
57809  protected void composeInvoiceParticipantComponentProperties(Invoice.InvoiceParticipantComponent element) throws IOException {
57810    composeBackboneElementProperties(element);
57811      if (element.hasRole()) {
57812        composeCodeableConcept("role", element.getRole());
57813      }
57814      if (element.hasActor()) {
57815        composeReference("actor", element.getActor());
57816      }
57817  }
57818
57819  protected void composeInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
57820    if (element != null) {
57821      open(name);
57822      composeInvoiceLineItemComponentProperties(element);
57823      close();
57824    }
57825  }
57826
57827  protected void composeInvoiceLineItemComponentProperties(Invoice.InvoiceLineItemComponent element) throws IOException {
57828    composeBackboneElementProperties(element);
57829      if (element.hasSequenceElement()) {
57830        composePositiveIntCore("sequence", element.getSequenceElement(), false);
57831        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
57832      }
57833      if (element.hasServiced()) {
57834        composeType("serviced", element.getServiced());
57835      }
57836      if (element.hasChargeItem()) {
57837        composeType("chargeItem", element.getChargeItem());
57838      }
57839      if (element.hasPriceComponent()) {
57840        openArray("priceComponent");
57841        for (MonetaryComponent e : element.getPriceComponent()) 
57842          composeMonetaryComponent(null, e);
57843        closeArray();
57844      };
57845  }
57846
57847  protected void composeLibrary(String name, Library element) throws IOException {
57848    if (element != null) {
57849      prop("resourceType", name);
57850      composeLibraryProperties(element);
57851    }
57852  }
57853
57854  protected void composeLibraryProperties(Library element) throws IOException {
57855    composeMetadataResourceProperties(element);
57856      if (element.hasUrlElement()) {
57857        composeUriCore("url", element.getUrlElement(), false);
57858        composeUriExtras("url", element.getUrlElement(), false);
57859      }
57860      if (element.hasIdentifier()) {
57861        openArray("identifier");
57862        for (Identifier e : element.getIdentifier()) 
57863          composeIdentifier(null, e);
57864        closeArray();
57865      };
57866      if (element.hasVersionElement()) {
57867        composeStringCore("version", element.getVersionElement(), false);
57868        composeStringExtras("version", element.getVersionElement(), false);
57869      }
57870      if (element.hasVersionAlgorithm()) {
57871        composeType("versionAlgorithm", element.getVersionAlgorithm());
57872      }
57873      if (element.hasNameElement()) {
57874        composeStringCore("name", element.getNameElement(), false);
57875        composeStringExtras("name", element.getNameElement(), false);
57876      }
57877      if (element.hasTitleElement()) {
57878        composeStringCore("title", element.getTitleElement(), false);
57879        composeStringExtras("title", element.getTitleElement(), false);
57880      }
57881      if (element.hasSubtitleElement()) {
57882        composeStringCore("subtitle", element.getSubtitleElement(), false);
57883        composeStringExtras("subtitle", element.getSubtitleElement(), false);
57884      }
57885      if (element.hasStatusElement()) {
57886        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57887        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57888      }
57889      if (element.hasExperimentalElement()) {
57890        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57891        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57892      }
57893      if (element.hasType()) {
57894        composeCodeableConcept("type", element.getType());
57895      }
57896      if (element.hasSubject()) {
57897        composeType("subject", element.getSubject());
57898      }
57899      if (element.hasDateElement()) {
57900        composeDateTimeCore("date", element.getDateElement(), false);
57901        composeDateTimeExtras("date", element.getDateElement(), false);
57902      }
57903      if (element.hasPublisherElement()) {
57904        composeStringCore("publisher", element.getPublisherElement(), false);
57905        composeStringExtras("publisher", element.getPublisherElement(), false);
57906      }
57907      if (element.hasContact()) {
57908        openArray("contact");
57909        for (ContactDetail e : element.getContact()) 
57910          composeContactDetail(null, e);
57911        closeArray();
57912      };
57913      if (element.hasDescriptionElement()) {
57914        composeMarkdownCore("description", element.getDescriptionElement(), false);
57915        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57916      }
57917      if (element.hasUseContext()) {
57918        openArray("useContext");
57919        for (UsageContext e : element.getUseContext()) 
57920          composeUsageContext(null, e);
57921        closeArray();
57922      };
57923      if (element.hasJurisdiction()) {
57924        openArray("jurisdiction");
57925        for (CodeableConcept e : element.getJurisdiction()) 
57926          composeCodeableConcept(null, e);
57927        closeArray();
57928      };
57929      if (element.hasPurposeElement()) {
57930        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57931        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57932      }
57933      if (element.hasUsageElement()) {
57934        composeMarkdownCore("usage", element.getUsageElement(), false);
57935        composeMarkdownExtras("usage", element.getUsageElement(), false);
57936      }
57937      if (element.hasCopyrightElement()) {
57938        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57939        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57940      }
57941      if (element.hasCopyrightLabelElement()) {
57942        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
57943        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
57944      }
57945      if (element.hasApprovalDateElement()) {
57946        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
57947        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
57948      }
57949      if (element.hasLastReviewDateElement()) {
57950        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
57951        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
57952      }
57953      if (element.hasEffectivePeriod()) {
57954        composePeriod("effectivePeriod", element.getEffectivePeriod());
57955      }
57956      if (element.hasTopic()) {
57957        openArray("topic");
57958        for (CodeableConcept e : element.getTopic()) 
57959          composeCodeableConcept(null, e);
57960        closeArray();
57961      };
57962      if (element.hasAuthor()) {
57963        openArray("author");
57964        for (ContactDetail e : element.getAuthor()) 
57965          composeContactDetail(null, e);
57966        closeArray();
57967      };
57968      if (element.hasEditor()) {
57969        openArray("editor");
57970        for (ContactDetail e : element.getEditor()) 
57971          composeContactDetail(null, e);
57972        closeArray();
57973      };
57974      if (element.hasReviewer()) {
57975        openArray("reviewer");
57976        for (ContactDetail e : element.getReviewer()) 
57977          composeContactDetail(null, e);
57978        closeArray();
57979      };
57980      if (element.hasEndorser()) {
57981        openArray("endorser");
57982        for (ContactDetail e : element.getEndorser()) 
57983          composeContactDetail(null, e);
57984        closeArray();
57985      };
57986      if (element.hasRelatedArtifact()) {
57987        openArray("relatedArtifact");
57988        for (RelatedArtifact e : element.getRelatedArtifact()) 
57989          composeRelatedArtifact(null, e);
57990        closeArray();
57991      };
57992      if (element.hasParameter()) {
57993        openArray("parameter");
57994        for (ParameterDefinition e : element.getParameter()) 
57995          composeParameterDefinition(null, e);
57996        closeArray();
57997      };
57998      if (element.hasDataRequirement()) {
57999        openArray("dataRequirement");
58000        for (DataRequirement e : element.getDataRequirement()) 
58001          composeDataRequirement(null, e);
58002        closeArray();
58003      };
58004      if (element.hasContent()) {
58005        openArray("content");
58006        for (Attachment e : element.getContent()) 
58007          composeAttachment(null, e);
58008        closeArray();
58009      };
58010  }
58011
58012  protected void composeLinkage(String name, Linkage element) throws IOException {
58013    if (element != null) {
58014      prop("resourceType", name);
58015      composeLinkageProperties(element);
58016    }
58017  }
58018
58019  protected void composeLinkageProperties(Linkage element) throws IOException {
58020    composeDomainResourceProperties(element);
58021      if (element.hasActiveElement()) {
58022        composeBooleanCore("active", element.getActiveElement(), false);
58023        composeBooleanExtras("active", element.getActiveElement(), false);
58024      }
58025      if (element.hasAuthor()) {
58026        composeReference("author", element.getAuthor());
58027      }
58028      if (element.hasItem()) {
58029        openArray("item");
58030        for (Linkage.LinkageItemComponent e : element.getItem()) 
58031          composeLinkageItemComponent(null, e);
58032        closeArray();
58033      };
58034  }
58035
58036  protected void composeLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
58037    if (element != null) {
58038      open(name);
58039      composeLinkageItemComponentProperties(element);
58040      close();
58041    }
58042  }
58043
58044  protected void composeLinkageItemComponentProperties(Linkage.LinkageItemComponent element) throws IOException {
58045    composeBackboneElementProperties(element);
58046      if (element.hasTypeElement()) {
58047        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
58048        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
58049      }
58050      if (element.hasResource()) {
58051        composeReference("resource", element.getResource());
58052      }
58053  }
58054
58055  protected void composeListResource(String name, ListResource element) throws IOException {
58056    if (element != null) {
58057      prop("resourceType", name);
58058      composeListResourceProperties(element);
58059    }
58060  }
58061
58062  protected void composeListResourceProperties(ListResource element) throws IOException {
58063    composeDomainResourceProperties(element);
58064      if (element.hasIdentifier()) {
58065        openArray("identifier");
58066        for (Identifier e : element.getIdentifier()) 
58067          composeIdentifier(null, e);
58068        closeArray();
58069      };
58070      if (element.hasStatusElement()) {
58071        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
58072        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
58073      }
58074      if (element.hasModeElement()) {
58075        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
58076        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
58077      }
58078      if (element.hasTitleElement()) {
58079        composeStringCore("title", element.getTitleElement(), false);
58080        composeStringExtras("title", element.getTitleElement(), false);
58081      }
58082      if (element.hasCode()) {
58083        composeCodeableConcept("code", element.getCode());
58084      }
58085      if (element.hasSubject()) {
58086        openArray("subject");
58087        for (Reference e : element.getSubject()) 
58088          composeReference(null, e);
58089        closeArray();
58090      };
58091      if (element.hasEncounter()) {
58092        composeReference("encounter", element.getEncounter());
58093      }
58094      if (element.hasDateElement()) {
58095        composeDateTimeCore("date", element.getDateElement(), false);
58096        composeDateTimeExtras("date", element.getDateElement(), false);
58097      }
58098      if (element.hasSource()) {
58099        composeReference("source", element.getSource());
58100      }
58101      if (element.hasOrderedBy()) {
58102        composeCodeableConcept("orderedBy", element.getOrderedBy());
58103      }
58104      if (element.hasNote()) {
58105        openArray("note");
58106        for (Annotation e : element.getNote()) 
58107          composeAnnotation(null, e);
58108        closeArray();
58109      };
58110      if (element.hasEntry()) {
58111        openArray("entry");
58112        for (ListResource.ListResourceEntryComponent e : element.getEntry()) 
58113          composeListResourceEntryComponent(null, e);
58114        closeArray();
58115      };
58116      if (element.hasEmptyReason()) {
58117        composeCodeableConcept("emptyReason", element.getEmptyReason());
58118      }
58119  }
58120
58121  protected void composeListResourceEntryComponent(String name, ListResource.ListResourceEntryComponent element) throws IOException {
58122    if (element != null) {
58123      open(name);
58124      composeListResourceEntryComponentProperties(element);
58125      close();
58126    }
58127  }
58128
58129  protected void composeListResourceEntryComponentProperties(ListResource.ListResourceEntryComponent element) throws IOException {
58130    composeBackboneElementProperties(element);
58131      if (element.hasFlag()) {
58132        composeCodeableConcept("flag", element.getFlag());
58133      }
58134      if (element.hasDeletedElement()) {
58135        composeBooleanCore("deleted", element.getDeletedElement(), false);
58136        composeBooleanExtras("deleted", element.getDeletedElement(), false);
58137      }
58138      if (element.hasDateElement()) {
58139        composeDateTimeCore("date", element.getDateElement(), false);
58140        composeDateTimeExtras("date", element.getDateElement(), false);
58141      }
58142      if (element.hasItem()) {
58143        composeReference("item", element.getItem());
58144      }
58145  }
58146
58147  protected void composeLocation(String name, Location element) throws IOException {
58148    if (element != null) {
58149      prop("resourceType", name);
58150      composeLocationProperties(element);
58151    }
58152  }
58153
58154  protected void composeLocationProperties(Location element) throws IOException {
58155    composeDomainResourceProperties(element);
58156      if (element.hasIdentifier()) {
58157        openArray("identifier");
58158        for (Identifier e : element.getIdentifier()) 
58159          composeIdentifier(null, e);
58160        closeArray();
58161      };
58162      if (element.hasStatusElement()) {
58163        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
58164        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
58165      }
58166      if (element.hasOperationalStatus()) {
58167        composeCoding("operationalStatus", element.getOperationalStatus());
58168      }
58169      if (element.hasNameElement()) {
58170        composeStringCore("name", element.getNameElement(), false);
58171        composeStringExtras("name", element.getNameElement(), false);
58172      }
58173      if (element.hasAlias()) {
58174        if (anyHasValue(element.getAlias())) {
58175          openArray("alias");
58176          for (StringType e : element.getAlias()) 
58177            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
58178          closeArray();
58179        }
58180        if (anyHasExtras(element.getAlias())) {
58181          openArray("_alias");
58182          for (StringType e : element.getAlias()) 
58183            composeStringExtras(null, e, true);
58184          closeArray();
58185        }
58186      };
58187      if (element.hasDescriptionElement()) {
58188        composeMarkdownCore("description", element.getDescriptionElement(), false);
58189        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58190      }
58191      if (element.hasModeElement()) {
58192        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
58193        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
58194      }
58195      if (element.hasType()) {
58196        openArray("type");
58197        for (CodeableConcept e : element.getType()) 
58198          composeCodeableConcept(null, e);
58199        closeArray();
58200      };
58201      if (element.hasContact()) {
58202        openArray("contact");
58203        for (ExtendedContactDetail e : element.getContact()) 
58204          composeExtendedContactDetail(null, e);
58205        closeArray();
58206      };
58207      if (element.hasAddress()) {
58208        composeAddress("address", element.getAddress());
58209      }
58210      if (element.hasForm()) {
58211        composeCodeableConcept("form", element.getForm());
58212      }
58213      if (element.hasPosition()) {
58214        composeLocationPositionComponent("position", element.getPosition());
58215      }
58216      if (element.hasManagingOrganization()) {
58217        composeReference("managingOrganization", element.getManagingOrganization());
58218      }
58219      if (element.hasPartOf()) {
58220        composeReference("partOf", element.getPartOf());
58221      }
58222      if (element.hasCharacteristic()) {
58223        openArray("characteristic");
58224        for (CodeableConcept e : element.getCharacteristic()) 
58225          composeCodeableConcept(null, e);
58226        closeArray();
58227      };
58228      if (element.hasHoursOfOperation()) {
58229        openArray("hoursOfOperation");
58230        for (Availability e : element.getHoursOfOperation()) 
58231          composeAvailability(null, e);
58232        closeArray();
58233      };
58234      if (element.hasVirtualService()) {
58235        openArray("virtualService");
58236        for (VirtualServiceDetail e : element.getVirtualService()) 
58237          composeVirtualServiceDetail(null, e);
58238        closeArray();
58239      };
58240      if (element.hasEndpoint()) {
58241        openArray("endpoint");
58242        for (Reference e : element.getEndpoint()) 
58243          composeReference(null, e);
58244        closeArray();
58245      };
58246  }
58247
58248  protected void composeLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
58249    if (element != null) {
58250      open(name);
58251      composeLocationPositionComponentProperties(element);
58252      close();
58253    }
58254  }
58255
58256  protected void composeLocationPositionComponentProperties(Location.LocationPositionComponent element) throws IOException {
58257    composeBackboneElementProperties(element);
58258      if (element.hasLongitudeElement()) {
58259        composeDecimalCore("longitude", element.getLongitudeElement(), false);
58260        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
58261      }
58262      if (element.hasLatitudeElement()) {
58263        composeDecimalCore("latitude", element.getLatitudeElement(), false);
58264        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
58265      }
58266      if (element.hasAltitudeElement()) {
58267        composeDecimalCore("altitude", element.getAltitudeElement(), false);
58268        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
58269      }
58270  }
58271
58272  protected void composeManufacturedItemDefinition(String name, ManufacturedItemDefinition element) throws IOException {
58273    if (element != null) {
58274      prop("resourceType", name);
58275      composeManufacturedItemDefinitionProperties(element);
58276    }
58277  }
58278
58279  protected void composeManufacturedItemDefinitionProperties(ManufacturedItemDefinition element) throws IOException {
58280    composeDomainResourceProperties(element);
58281      if (element.hasIdentifier()) {
58282        openArray("identifier");
58283        for (Identifier e : element.getIdentifier()) 
58284          composeIdentifier(null, e);
58285        closeArray();
58286      };
58287      if (element.hasStatusElement()) {
58288        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58289        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58290      }
58291      if (element.hasNameElement()) {
58292        composeStringCore("name", element.getNameElement(), false);
58293        composeStringExtras("name", element.getNameElement(), false);
58294      }
58295      if (element.hasManufacturedDoseForm()) {
58296        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
58297      }
58298      if (element.hasUnitOfPresentation()) {
58299        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
58300      }
58301      if (element.hasManufacturer()) {
58302        openArray("manufacturer");
58303        for (Reference e : element.getManufacturer()) 
58304          composeReference(null, e);
58305        closeArray();
58306      };
58307      if (element.hasMarketingStatus()) {
58308        openArray("marketingStatus");
58309        for (MarketingStatus e : element.getMarketingStatus()) 
58310          composeMarketingStatus(null, e);
58311        closeArray();
58312      };
58313      if (element.hasIngredient()) {
58314        openArray("ingredient");
58315        for (CodeableConcept e : element.getIngredient()) 
58316          composeCodeableConcept(null, e);
58317        closeArray();
58318      };
58319      if (element.hasProperty()) {
58320        openArray("property");
58321        for (ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent e : element.getProperty()) 
58322          composeManufacturedItemDefinitionPropertyComponent(null, e);
58323        closeArray();
58324      };
58325      if (element.hasComponent()) {
58326        openArray("component");
58327        for (ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent e : element.getComponent()) 
58328          composeManufacturedItemDefinitionComponentComponent(null, e);
58329        closeArray();
58330      };
58331  }
58332
58333  protected void composeManufacturedItemDefinitionPropertyComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
58334    if (element != null) {
58335      open(name);
58336      composeManufacturedItemDefinitionPropertyComponentProperties(element);
58337      close();
58338    }
58339  }
58340
58341  protected void composeManufacturedItemDefinitionPropertyComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
58342    composeBackboneElementProperties(element);
58343      if (element.hasType()) {
58344        composeCodeableConcept("type", element.getType());
58345      }
58346      if (element.hasValue()) {
58347        composeType("value", element.getValue());
58348      }
58349  }
58350
58351  protected void composeManufacturedItemDefinitionComponentComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent element) throws IOException {
58352    if (element != null) {
58353      open(name);
58354      composeManufacturedItemDefinitionComponentComponentProperties(element);
58355      close();
58356    }
58357  }
58358
58359  protected void composeManufacturedItemDefinitionComponentComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent element) throws IOException {
58360    composeBackboneElementProperties(element);
58361      if (element.hasType()) {
58362        composeCodeableConcept("type", element.getType());
58363      }
58364      if (element.hasFunction()) {
58365        openArray("function");
58366        for (CodeableConcept e : element.getFunction()) 
58367          composeCodeableConcept(null, e);
58368        closeArray();
58369      };
58370      if (element.hasAmount()) {
58371        openArray("amount");
58372        for (Quantity e : element.getAmount()) 
58373          composeQuantity(null, e);
58374        closeArray();
58375      };
58376      if (element.hasConstituent()) {
58377        openArray("constituent");
58378        for (ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent e : element.getConstituent()) 
58379          composeManufacturedItemDefinitionComponentConstituentComponent(null, e);
58380        closeArray();
58381      };
58382      if (element.hasProperty()) {
58383        openArray("property");
58384        for (ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent e : element.getProperty()) 
58385          composeManufacturedItemDefinitionPropertyComponent(null, e);
58386        closeArray();
58387      };
58388      if (element.hasComponent()) {
58389        openArray("component");
58390        for (ManufacturedItemDefinition.ManufacturedItemDefinitionComponentComponent e : element.getComponent()) 
58391          composeManufacturedItemDefinitionComponentComponent(null, e);
58392        closeArray();
58393      };
58394  }
58395
58396  protected void composeManufacturedItemDefinitionComponentConstituentComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent element) throws IOException {
58397    if (element != null) {
58398      open(name);
58399      composeManufacturedItemDefinitionComponentConstituentComponentProperties(element);
58400      close();
58401    }
58402  }
58403
58404  protected void composeManufacturedItemDefinitionComponentConstituentComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionComponentConstituentComponent element) throws IOException {
58405    composeBackboneElementProperties(element);
58406      if (element.hasAmount()) {
58407        openArray("amount");
58408        for (Quantity e : element.getAmount()) 
58409          composeQuantity(null, e);
58410        closeArray();
58411      };
58412      if (element.hasLocation()) {
58413        openArray("location");
58414        for (CodeableConcept e : element.getLocation()) 
58415          composeCodeableConcept(null, e);
58416        closeArray();
58417      };
58418      if (element.hasFunction()) {
58419        openArray("function");
58420        for (CodeableConcept e : element.getFunction()) 
58421          composeCodeableConcept(null, e);
58422        closeArray();
58423      };
58424      if (element.hasHasIngredient()) {
58425        openArray("hasIngredient");
58426        for (CodeableReference e : element.getHasIngredient()) 
58427          composeCodeableReference(null, e);
58428        closeArray();
58429      };
58430  }
58431
58432  protected void composeMeasure(String name, Measure element) throws IOException {
58433    if (element != null) {
58434      prop("resourceType", name);
58435      composeMeasureProperties(element);
58436    }
58437  }
58438
58439  protected void composeMeasureProperties(Measure element) throws IOException {
58440    composeMetadataResourceProperties(element);
58441      if (element.hasUrlElement()) {
58442        composeUriCore("url", element.getUrlElement(), false);
58443        composeUriExtras("url", element.getUrlElement(), false);
58444      }
58445      if (element.hasIdentifier()) {
58446        openArray("identifier");
58447        for (Identifier e : element.getIdentifier()) 
58448          composeIdentifier(null, e);
58449        closeArray();
58450      };
58451      if (element.hasVersionElement()) {
58452        composeStringCore("version", element.getVersionElement(), false);
58453        composeStringExtras("version", element.getVersionElement(), false);
58454      }
58455      if (element.hasVersionAlgorithm()) {
58456        composeType("versionAlgorithm", element.getVersionAlgorithm());
58457      }
58458      if (element.hasNameElement()) {
58459        composeStringCore("name", element.getNameElement(), false);
58460        composeStringExtras("name", element.getNameElement(), false);
58461      }
58462      if (element.hasTitleElement()) {
58463        composeStringCore("title", element.getTitleElement(), false);
58464        composeStringExtras("title", element.getTitleElement(), false);
58465      }
58466      if (element.hasSubtitleElement()) {
58467        composeStringCore("subtitle", element.getSubtitleElement(), false);
58468        composeStringExtras("subtitle", element.getSubtitleElement(), false);
58469      }
58470      if (element.hasStatusElement()) {
58471        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58472        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58473      }
58474      if (element.hasExperimentalElement()) {
58475        composeBooleanCore("experimental", element.getExperimentalElement(), false);
58476        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58477      }
58478      if (element.hasSubject()) {
58479        composeType("subject", element.getSubject());
58480      }
58481      if (element.hasBasisElement()) {
58482        composeEnumerationCore("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58483        composeEnumerationExtras("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58484      }
58485      if (element.hasDateElement()) {
58486        composeDateTimeCore("date", element.getDateElement(), false);
58487        composeDateTimeExtras("date", element.getDateElement(), false);
58488      }
58489      if (element.hasPublisherElement()) {
58490        composeStringCore("publisher", element.getPublisherElement(), false);
58491        composeStringExtras("publisher", element.getPublisherElement(), false);
58492      }
58493      if (element.hasContact()) {
58494        openArray("contact");
58495        for (ContactDetail e : element.getContact()) 
58496          composeContactDetail(null, e);
58497        closeArray();
58498      };
58499      if (element.hasDescriptionElement()) {
58500        composeMarkdownCore("description", element.getDescriptionElement(), false);
58501        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58502      }
58503      if (element.hasUseContext()) {
58504        openArray("useContext");
58505        for (UsageContext e : element.getUseContext()) 
58506          composeUsageContext(null, e);
58507        closeArray();
58508      };
58509      if (element.hasJurisdiction()) {
58510        openArray("jurisdiction");
58511        for (CodeableConcept e : element.getJurisdiction()) 
58512          composeCodeableConcept(null, e);
58513        closeArray();
58514      };
58515      if (element.hasPurposeElement()) {
58516        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58517        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58518      }
58519      if (element.hasUsageElement()) {
58520        composeMarkdownCore("usage", element.getUsageElement(), false);
58521        composeMarkdownExtras("usage", element.getUsageElement(), false);
58522      }
58523      if (element.hasCopyrightElement()) {
58524        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58525        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58526      }
58527      if (element.hasCopyrightLabelElement()) {
58528        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
58529        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
58530      }
58531      if (element.hasApprovalDateElement()) {
58532        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
58533        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
58534      }
58535      if (element.hasLastReviewDateElement()) {
58536        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
58537        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
58538      }
58539      if (element.hasEffectivePeriod()) {
58540        composePeriod("effectivePeriod", element.getEffectivePeriod());
58541      }
58542      if (element.hasTopic()) {
58543        openArray("topic");
58544        for (CodeableConcept e : element.getTopic()) 
58545          composeCodeableConcept(null, e);
58546        closeArray();
58547      };
58548      if (element.hasAuthor()) {
58549        openArray("author");
58550        for (ContactDetail e : element.getAuthor()) 
58551          composeContactDetail(null, e);
58552        closeArray();
58553      };
58554      if (element.hasEditor()) {
58555        openArray("editor");
58556        for (ContactDetail e : element.getEditor()) 
58557          composeContactDetail(null, e);
58558        closeArray();
58559      };
58560      if (element.hasReviewer()) {
58561        openArray("reviewer");
58562        for (ContactDetail e : element.getReviewer()) 
58563          composeContactDetail(null, e);
58564        closeArray();
58565      };
58566      if (element.hasEndorser()) {
58567        openArray("endorser");
58568        for (ContactDetail e : element.getEndorser()) 
58569          composeContactDetail(null, e);
58570        closeArray();
58571      };
58572      if (element.hasRelatedArtifact()) {
58573        openArray("relatedArtifact");
58574        for (RelatedArtifact e : element.getRelatedArtifact()) 
58575          composeRelatedArtifact(null, e);
58576        closeArray();
58577      };
58578      if (element.hasLibrary()) {
58579        if (anyHasValue(element.getLibrary())) {
58580          openArray("library");
58581          for (CanonicalType e : element.getLibrary()) 
58582            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
58583          closeArray();
58584        }
58585        if (anyHasExtras(element.getLibrary())) {
58586          openArray("_library");
58587          for (CanonicalType e : element.getLibrary()) 
58588            composeCanonicalExtras(null, e, true);
58589          closeArray();
58590        }
58591      };
58592      if (element.hasDisclaimerElement()) {
58593        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
58594        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
58595      }
58596      if (element.hasScoring()) {
58597        composeCodeableConcept("scoring", element.getScoring());
58598      }
58599      if (element.hasScoringUnit()) {
58600        composeCodeableConcept("scoringUnit", element.getScoringUnit());
58601      }
58602      if (element.hasCompositeScoring()) {
58603        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
58604      }
58605      if (element.hasType()) {
58606        openArray("type");
58607        for (CodeableConcept e : element.getType()) 
58608          composeCodeableConcept(null, e);
58609        closeArray();
58610      };
58611      if (element.hasRiskAdjustmentElement()) {
58612        composeMarkdownCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
58613        composeMarkdownExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
58614      }
58615      if (element.hasRateAggregationElement()) {
58616        composeMarkdownCore("rateAggregation", element.getRateAggregationElement(), false);
58617        composeMarkdownExtras("rateAggregation", element.getRateAggregationElement(), false);
58618      }
58619      if (element.hasRationaleElement()) {
58620        composeMarkdownCore("rationale", element.getRationaleElement(), false);
58621        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
58622      }
58623      if (element.hasClinicalRecommendationStatementElement()) {
58624        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
58625        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
58626      }
58627      if (element.hasImprovementNotation()) {
58628        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
58629      }
58630      if (element.hasTerm()) {
58631        openArray("term");
58632        for (Measure.MeasureTermComponent e : element.getTerm()) 
58633          composeMeasureTermComponent(null, e);
58634        closeArray();
58635      };
58636      if (element.hasGuidanceElement()) {
58637        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
58638        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
58639      }
58640      if (element.hasGroup()) {
58641        openArray("group");
58642        for (Measure.MeasureGroupComponent e : element.getGroup()) 
58643          composeMeasureGroupComponent(null, e);
58644        closeArray();
58645      };
58646      if (element.hasSupplementalData()) {
58647        openArray("supplementalData");
58648        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
58649          composeMeasureSupplementalDataComponent(null, e);
58650        closeArray();
58651      };
58652  }
58653
58654  protected void composeMeasureTermComponent(String name, Measure.MeasureTermComponent element) throws IOException {
58655    if (element != null) {
58656      open(name);
58657      composeMeasureTermComponentProperties(element);
58658      close();
58659    }
58660  }
58661
58662  protected void composeMeasureTermComponentProperties(Measure.MeasureTermComponent element) throws IOException {
58663    composeBackboneElementProperties(element);
58664      if (element.hasCode()) {
58665        composeCodeableConcept("code", element.getCode());
58666      }
58667      if (element.hasDefinitionElement()) {
58668        composeMarkdownCore("definition", element.getDefinitionElement(), false);
58669        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
58670      }
58671  }
58672
58673  protected void composeMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
58674    if (element != null) {
58675      open(name);
58676      composeMeasureGroupComponentProperties(element);
58677      close();
58678    }
58679  }
58680
58681  protected void composeMeasureGroupComponentProperties(Measure.MeasureGroupComponent element) throws IOException {
58682    composeBackboneElementProperties(element);
58683      if (element.hasLinkIdElement()) {
58684        composeStringCore("linkId", element.getLinkIdElement(), false);
58685        composeStringExtras("linkId", element.getLinkIdElement(), false);
58686      }
58687      if (element.hasCode()) {
58688        composeCodeableConcept("code", element.getCode());
58689      }
58690      if (element.hasDescriptionElement()) {
58691        composeMarkdownCore("description", element.getDescriptionElement(), false);
58692        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58693      }
58694      if (element.hasType()) {
58695        openArray("type");
58696        for (CodeableConcept e : element.getType()) 
58697          composeCodeableConcept(null, e);
58698        closeArray();
58699      };
58700      if (element.hasSubject()) {
58701        composeType("subject", element.getSubject());
58702      }
58703      if (element.hasBasisElement()) {
58704        composeEnumerationCore("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58705        composeEnumerationExtras("basis", element.getBasisElement(), new Enumerations.FHIRTypesEnumFactory(), false);
58706      }
58707      if (element.hasScoring()) {
58708        composeCodeableConcept("scoring", element.getScoring());
58709      }
58710      if (element.hasScoringUnit()) {
58711        composeCodeableConcept("scoringUnit", element.getScoringUnit());
58712      }
58713      if (element.hasRateAggregationElement()) {
58714        composeMarkdownCore("rateAggregation", element.getRateAggregationElement(), false);
58715        composeMarkdownExtras("rateAggregation", element.getRateAggregationElement(), false);
58716      }
58717      if (element.hasImprovementNotation()) {
58718        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
58719      }
58720      if (element.hasLibrary()) {
58721        if (anyHasValue(element.getLibrary())) {
58722          openArray("library");
58723          for (CanonicalType e : element.getLibrary()) 
58724            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
58725          closeArray();
58726        }
58727        if (anyHasExtras(element.getLibrary())) {
58728          openArray("_library");
58729          for (CanonicalType e : element.getLibrary()) 
58730            composeCanonicalExtras(null, e, true);
58731          closeArray();
58732        }
58733      };
58734      if (element.hasPopulation()) {
58735        openArray("population");
58736        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
58737          composeMeasureGroupPopulationComponent(null, e);
58738        closeArray();
58739      };
58740      if (element.hasStratifier()) {
58741        openArray("stratifier");
58742        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
58743          composeMeasureGroupStratifierComponent(null, e);
58744        closeArray();
58745      };
58746  }
58747
58748  protected void composeMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
58749    if (element != null) {
58750      open(name);
58751      composeMeasureGroupPopulationComponentProperties(element);
58752      close();
58753    }
58754  }
58755
58756  protected void composeMeasureGroupPopulationComponentProperties(Measure.MeasureGroupPopulationComponent element) throws IOException {
58757    composeBackboneElementProperties(element);
58758      if (element.hasLinkIdElement()) {
58759        composeStringCore("linkId", element.getLinkIdElement(), false);
58760        composeStringExtras("linkId", element.getLinkIdElement(), false);
58761      }
58762      if (element.hasCode()) {
58763        composeCodeableConcept("code", element.getCode());
58764      }
58765      if (element.hasDescriptionElement()) {
58766        composeMarkdownCore("description", element.getDescriptionElement(), false);
58767        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58768      }
58769      if (element.hasCriteria()) {
58770        composeExpression("criteria", element.getCriteria());
58771      }
58772      if (element.hasGroupDefinition()) {
58773        composeReference("groupDefinition", element.getGroupDefinition());
58774      }
58775      if (element.hasInputPopulationIdElement()) {
58776        composeStringCore("inputPopulationId", element.getInputPopulationIdElement(), false);
58777        composeStringExtras("inputPopulationId", element.getInputPopulationIdElement(), false);
58778      }
58779      if (element.hasAggregateMethod()) {
58780        composeCodeableConcept("aggregateMethod", element.getAggregateMethod());
58781      }
58782  }
58783
58784  protected void composeMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
58785    if (element != null) {
58786      open(name);
58787      composeMeasureGroupStratifierComponentProperties(element);
58788      close();
58789    }
58790  }
58791
58792  protected void composeMeasureGroupStratifierComponentProperties(Measure.MeasureGroupStratifierComponent element) throws IOException {
58793    composeBackboneElementProperties(element);
58794      if (element.hasLinkIdElement()) {
58795        composeStringCore("linkId", element.getLinkIdElement(), false);
58796        composeStringExtras("linkId", element.getLinkIdElement(), false);
58797      }
58798      if (element.hasCode()) {
58799        composeCodeableConcept("code", element.getCode());
58800      }
58801      if (element.hasDescriptionElement()) {
58802        composeMarkdownCore("description", element.getDescriptionElement(), false);
58803        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58804      }
58805      if (element.hasCriteria()) {
58806        composeExpression("criteria", element.getCriteria());
58807      }
58808      if (element.hasGroupDefinition()) {
58809        composeReference("groupDefinition", element.getGroupDefinition());
58810      }
58811      if (element.hasComponent()) {
58812        openArray("component");
58813        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
58814          composeMeasureGroupStratifierComponentComponent(null, e);
58815        closeArray();
58816      };
58817  }
58818
58819  protected void composeMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
58820    if (element != null) {
58821      open(name);
58822      composeMeasureGroupStratifierComponentComponentProperties(element);
58823      close();
58824    }
58825  }
58826
58827  protected void composeMeasureGroupStratifierComponentComponentProperties(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
58828    composeBackboneElementProperties(element);
58829      if (element.hasLinkIdElement()) {
58830        composeStringCore("linkId", element.getLinkIdElement(), false);
58831        composeStringExtras("linkId", element.getLinkIdElement(), false);
58832      }
58833      if (element.hasCode()) {
58834        composeCodeableConcept("code", element.getCode());
58835      }
58836      if (element.hasDescriptionElement()) {
58837        composeMarkdownCore("description", element.getDescriptionElement(), false);
58838        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58839      }
58840      if (element.hasCriteria()) {
58841        composeExpression("criteria", element.getCriteria());
58842      }
58843      if (element.hasGroupDefinition()) {
58844        composeReference("groupDefinition", element.getGroupDefinition());
58845      }
58846  }
58847
58848  protected void composeMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
58849    if (element != null) {
58850      open(name);
58851      composeMeasureSupplementalDataComponentProperties(element);
58852      close();
58853    }
58854  }
58855
58856  protected void composeMeasureSupplementalDataComponentProperties(Measure.MeasureSupplementalDataComponent element) throws IOException {
58857    composeBackboneElementProperties(element);
58858      if (element.hasLinkIdElement()) {
58859        composeStringCore("linkId", element.getLinkIdElement(), false);
58860        composeStringExtras("linkId", element.getLinkIdElement(), false);
58861      }
58862      if (element.hasCode()) {
58863        composeCodeableConcept("code", element.getCode());
58864      }
58865      if (element.hasUsage()) {
58866        openArray("usage");
58867        for (CodeableConcept e : element.getUsage()) 
58868          composeCodeableConcept(null, e);
58869        closeArray();
58870      };
58871      if (element.hasDescriptionElement()) {
58872        composeMarkdownCore("description", element.getDescriptionElement(), false);
58873        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58874      }
58875      if (element.hasCriteria()) {
58876        composeExpression("criteria", element.getCriteria());
58877      }
58878  }
58879
58880  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
58881    if (element != null) {
58882      prop("resourceType", name);
58883      composeMeasureReportProperties(element);
58884    }
58885  }
58886
58887  protected void composeMeasureReportProperties(MeasureReport element) throws IOException {
58888    composeDomainResourceProperties(element);
58889      if (element.hasIdentifier()) {
58890        openArray("identifier");
58891        for (Identifier e : element.getIdentifier()) 
58892          composeIdentifier(null, e);
58893        closeArray();
58894      };
58895      if (element.hasStatusElement()) {
58896        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
58897        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
58898      }
58899      if (element.hasTypeElement()) {
58900        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
58901        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
58902      }
58903      if (element.hasDataUpdateTypeElement()) {
58904        composeEnumerationCore("dataUpdateType", element.getDataUpdateTypeElement(), new MeasureReport.SubmitDataUpdateTypeEnumFactory(), false);
58905        composeEnumerationExtras("dataUpdateType", element.getDataUpdateTypeElement(), new MeasureReport.SubmitDataUpdateTypeEnumFactory(), false);
58906      }
58907      if (element.hasMeasureElement()) {
58908        composeCanonicalCore("measure", element.getMeasureElement(), false);
58909        composeCanonicalExtras("measure", element.getMeasureElement(), false);
58910      }
58911      if (element.hasSubject()) {
58912        composeReference("subject", element.getSubject());
58913      }
58914      if (element.hasDateElement()) {
58915        composeDateTimeCore("date", element.getDateElement(), false);
58916        composeDateTimeExtras("date", element.getDateElement(), false);
58917      }
58918      if (element.hasReporter()) {
58919        composeReference("reporter", element.getReporter());
58920      }
58921      if (element.hasReportingVendor()) {
58922        composeReference("reportingVendor", element.getReportingVendor());
58923      }
58924      if (element.hasLocation()) {
58925        composeReference("location", element.getLocation());
58926      }
58927      if (element.hasPeriod()) {
58928        composePeriod("period", element.getPeriod());
58929      }
58930      if (element.hasInputParameters()) {
58931        composeReference("inputParameters", element.getInputParameters());
58932      }
58933      if (element.hasScoring()) {
58934        composeCodeableConcept("scoring", element.getScoring());
58935      }
58936      if (element.hasImprovementNotation()) {
58937        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
58938      }
58939      if (element.hasGroup()) {
58940        openArray("group");
58941        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
58942          composeMeasureReportGroupComponent(null, e);
58943        closeArray();
58944      };
58945      if (element.hasSupplementalData()) {
58946        openArray("supplementalData");
58947        for (Reference e : element.getSupplementalData()) 
58948          composeReference(null, e);
58949        closeArray();
58950      };
58951      if (element.hasEvaluatedResource()) {
58952        openArray("evaluatedResource");
58953        for (Reference e : element.getEvaluatedResource()) 
58954          composeReference(null, e);
58955        closeArray();
58956      };
58957  }
58958
58959  protected void composeMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
58960    if (element != null) {
58961      open(name);
58962      composeMeasureReportGroupComponentProperties(element);
58963      close();
58964    }
58965  }
58966
58967  protected void composeMeasureReportGroupComponentProperties(MeasureReport.MeasureReportGroupComponent element) throws IOException {
58968    composeBackboneElementProperties(element);
58969      if (element.hasLinkIdElement()) {
58970        composeStringCore("linkId", element.getLinkIdElement(), false);
58971        composeStringExtras("linkId", element.getLinkIdElement(), false);
58972      }
58973      if (element.hasCode()) {
58974        composeCodeableConcept("code", element.getCode());
58975      }
58976      if (element.hasSubject()) {
58977        composeReference("subject", element.getSubject());
58978      }
58979      if (element.hasPopulation()) {
58980        openArray("population");
58981        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
58982          composeMeasureReportGroupPopulationComponent(null, e);
58983        closeArray();
58984      };
58985      if (element.hasMeasureScore()) {
58986        composeType("measureScore", element.getMeasureScore());
58987      }
58988      if (element.hasStratifier()) {
58989        openArray("stratifier");
58990        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
58991          composeMeasureReportGroupStratifierComponent(null, e);
58992        closeArray();
58993      };
58994  }
58995
58996  protected void composeMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
58997    if (element != null) {
58998      open(name);
58999      composeMeasureReportGroupPopulationComponentProperties(element);
59000      close();
59001    }
59002  }
59003
59004  protected void composeMeasureReportGroupPopulationComponentProperties(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
59005    composeBackboneElementProperties(element);
59006      if (element.hasLinkIdElement()) {
59007        composeStringCore("linkId", element.getLinkIdElement(), false);
59008        composeStringExtras("linkId", element.getLinkIdElement(), false);
59009      }
59010      if (element.hasCode()) {
59011        composeCodeableConcept("code", element.getCode());
59012      }
59013      if (element.hasCountElement()) {
59014        composeIntegerCore("count", element.getCountElement(), false);
59015        composeIntegerExtras("count", element.getCountElement(), false);
59016      }
59017      if (element.hasSubjectResults()) {
59018        composeReference("subjectResults", element.getSubjectResults());
59019      }
59020      if (element.hasSubjectReport()) {
59021        openArray("subjectReport");
59022        for (Reference e : element.getSubjectReport()) 
59023          composeReference(null, e);
59024        closeArray();
59025      };
59026      if (element.hasSubjects()) {
59027        composeReference("subjects", element.getSubjects());
59028      }
59029  }
59030
59031  protected void composeMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
59032    if (element != null) {
59033      open(name);
59034      composeMeasureReportGroupStratifierComponentProperties(element);
59035      close();
59036    }
59037  }
59038
59039  protected void composeMeasureReportGroupStratifierComponentProperties(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
59040    composeBackboneElementProperties(element);
59041      if (element.hasLinkIdElement()) {
59042        composeStringCore("linkId", element.getLinkIdElement(), false);
59043        composeStringExtras("linkId", element.getLinkIdElement(), false);
59044      }
59045      if (element.hasCode()) {
59046        composeCodeableConcept("code", element.getCode());
59047      }
59048      if (element.hasStratum()) {
59049        openArray("stratum");
59050        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
59051          composeStratifierGroupComponent(null, e);
59052        closeArray();
59053      };
59054  }
59055
59056  protected void composeStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
59057    if (element != null) {
59058      open(name);
59059      composeStratifierGroupComponentProperties(element);
59060      close();
59061    }
59062  }
59063
59064  protected void composeStratifierGroupComponentProperties(MeasureReport.StratifierGroupComponent element) throws IOException {
59065    composeBackboneElementProperties(element);
59066      if (element.hasValue()) {
59067        composeType("value", element.getValue());
59068      }
59069      if (element.hasComponent()) {
59070        openArray("component");
59071        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
59072          composeStratifierGroupComponentComponent(null, e);
59073        closeArray();
59074      };
59075      if (element.hasPopulation()) {
59076        openArray("population");
59077        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
59078          composeStratifierGroupPopulationComponent(null, e);
59079        closeArray();
59080      };
59081      if (element.hasMeasureScore()) {
59082        composeType("measureScore", element.getMeasureScore());
59083      }
59084  }
59085
59086  protected void composeStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
59087    if (element != null) {
59088      open(name);
59089      composeStratifierGroupComponentComponentProperties(element);
59090      close();
59091    }
59092  }
59093
59094  protected void composeStratifierGroupComponentComponentProperties(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
59095    composeBackboneElementProperties(element);
59096      if (element.hasLinkIdElement()) {
59097        composeStringCore("linkId", element.getLinkIdElement(), false);
59098        composeStringExtras("linkId", element.getLinkIdElement(), false);
59099      }
59100      if (element.hasCode()) {
59101        composeCodeableConcept("code", element.getCode());
59102      }
59103      if (element.hasValue()) {
59104        composeType("value", element.getValue());
59105      }
59106  }
59107
59108  protected void composeStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
59109    if (element != null) {
59110      open(name);
59111      composeStratifierGroupPopulationComponentProperties(element);
59112      close();
59113    }
59114  }
59115
59116  protected void composeStratifierGroupPopulationComponentProperties(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
59117    composeBackboneElementProperties(element);
59118      if (element.hasLinkIdElement()) {
59119        composeStringCore("linkId", element.getLinkIdElement(), false);
59120        composeStringExtras("linkId", element.getLinkIdElement(), false);
59121      }
59122      if (element.hasCode()) {
59123        composeCodeableConcept("code", element.getCode());
59124      }
59125      if (element.hasCountElement()) {
59126        composeIntegerCore("count", element.getCountElement(), false);
59127        composeIntegerExtras("count", element.getCountElement(), false);
59128      }
59129      if (element.hasSubjectResults()) {
59130        composeReference("subjectResults", element.getSubjectResults());
59131      }
59132      if (element.hasSubjectReport()) {
59133        openArray("subjectReport");
59134        for (Reference e : element.getSubjectReport()) 
59135          composeReference(null, e);
59136        closeArray();
59137      };
59138      if (element.hasSubjects()) {
59139        composeReference("subjects", element.getSubjects());
59140      }
59141  }
59142
59143  protected void composeMedication(String name, Medication element) throws IOException {
59144    if (element != null) {
59145      prop("resourceType", name);
59146      composeMedicationProperties(element);
59147    }
59148  }
59149
59150  protected void composeMedicationProperties(Medication element) throws IOException {
59151    composeDomainResourceProperties(element);
59152      if (element.hasIdentifier()) {
59153        openArray("identifier");
59154        for (Identifier e : element.getIdentifier()) 
59155          composeIdentifier(null, e);
59156        closeArray();
59157      };
59158      if (element.hasCode()) {
59159        composeCodeableConcept("code", element.getCode());
59160      }
59161      if (element.hasStatusElement()) {
59162        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
59163        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
59164      }
59165      if (element.hasMarketingAuthorizationHolder()) {
59166        composeReference("marketingAuthorizationHolder", element.getMarketingAuthorizationHolder());
59167      }
59168      if (element.hasDoseForm()) {
59169        composeCodeableConcept("doseForm", element.getDoseForm());
59170      }
59171      if (element.hasTotalVolume()) {
59172        composeQuantity("totalVolume", element.getTotalVolume());
59173      }
59174      if (element.hasIngredient()) {
59175        openArray("ingredient");
59176        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
59177          composeMedicationIngredientComponent(null, e);
59178        closeArray();
59179      };
59180      if (element.hasBatch()) {
59181        composeMedicationBatchComponent("batch", element.getBatch());
59182      }
59183      if (element.hasDefinition()) {
59184        composeReference("definition", element.getDefinition());
59185      }
59186  }
59187
59188  protected void composeMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
59189    if (element != null) {
59190      open(name);
59191      composeMedicationIngredientComponentProperties(element);
59192      close();
59193    }
59194  }
59195
59196  protected void composeMedicationIngredientComponentProperties(Medication.MedicationIngredientComponent element) throws IOException {
59197    composeBackboneElementProperties(element);
59198      if (element.hasItem()) {
59199        composeCodeableReference("item", element.getItem());
59200      }
59201      if (element.hasIsActiveElement()) {
59202        composeBooleanCore("isActive", element.getIsActiveElement(), false);
59203        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
59204      }
59205      if (element.hasStrength()) {
59206        composeType("strength", element.getStrength());
59207      }
59208  }
59209
59210  protected void composeMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
59211    if (element != null) {
59212      open(name);
59213      composeMedicationBatchComponentProperties(element);
59214      close();
59215    }
59216  }
59217
59218  protected void composeMedicationBatchComponentProperties(Medication.MedicationBatchComponent element) throws IOException {
59219    composeBackboneElementProperties(element);
59220      if (element.hasLotNumberElement()) {
59221        composeStringCore("lotNumber", element.getLotNumberElement(), false);
59222        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
59223      }
59224      if (element.hasExpirationDateElement()) {
59225        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
59226        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
59227      }
59228  }
59229
59230  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
59231    if (element != null) {
59232      prop("resourceType", name);
59233      composeMedicationAdministrationProperties(element);
59234    }
59235  }
59236
59237  protected void composeMedicationAdministrationProperties(MedicationAdministration element) throws IOException {
59238    composeDomainResourceProperties(element);
59239      if (element.hasIdentifier()) {
59240        openArray("identifier");
59241        for (Identifier e : element.getIdentifier()) 
59242          composeIdentifier(null, e);
59243        closeArray();
59244      };
59245      if (element.hasBasedOn()) {
59246        openArray("basedOn");
59247        for (Reference e : element.getBasedOn()) 
59248          composeReference(null, e);
59249        closeArray();
59250      };
59251      if (element.hasPartOf()) {
59252        openArray("partOf");
59253        for (Reference e : element.getPartOf()) 
59254          composeReference(null, e);
59255        closeArray();
59256      };
59257      if (element.hasStatusElement()) {
59258        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
59259        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
59260      }
59261      if (element.hasStatusReason()) {
59262        openArray("statusReason");
59263        for (CodeableConcept e : element.getStatusReason()) 
59264          composeCodeableConcept(null, e);
59265        closeArray();
59266      };
59267      if (element.hasCategory()) {
59268        openArray("category");
59269        for (CodeableConcept e : element.getCategory()) 
59270          composeCodeableConcept(null, e);
59271        closeArray();
59272      };
59273      if (element.hasMedication()) {
59274        composeCodeableReference("medication", element.getMedication());
59275      }
59276      if (element.hasSubject()) {
59277        composeReference("subject", element.getSubject());
59278      }
59279      if (element.hasEncounter()) {
59280        composeReference("encounter", element.getEncounter());
59281      }
59282      if (element.hasSupportingInformation()) {
59283        openArray("supportingInformation");
59284        for (Reference e : element.getSupportingInformation()) 
59285          composeReference(null, e);
59286        closeArray();
59287      };
59288      if (element.hasOccurence()) {
59289        composeType("occurence", element.getOccurence());
59290      }
59291      if (element.hasRecordedElement()) {
59292        composeDateTimeCore("recorded", element.getRecordedElement(), false);
59293        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
59294      }
59295      if (element.hasIsSubPotentElement()) {
59296        composeBooleanCore("isSubPotent", element.getIsSubPotentElement(), false);
59297        composeBooleanExtras("isSubPotent", element.getIsSubPotentElement(), false);
59298      }
59299      if (element.hasSubPotentReason()) {
59300        openArray("subPotentReason");
59301        for (CodeableConcept e : element.getSubPotentReason()) 
59302          composeCodeableConcept(null, e);
59303        closeArray();
59304      };
59305      if (element.hasPerformer()) {
59306        openArray("performer");
59307        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
59308          composeMedicationAdministrationPerformerComponent(null, e);
59309        closeArray();
59310      };
59311      if (element.hasReason()) {
59312        openArray("reason");
59313        for (CodeableReference e : element.getReason()) 
59314          composeCodeableReference(null, e);
59315        closeArray();
59316      };
59317      if (element.hasRequest()) {
59318        composeReference("request", element.getRequest());
59319      }
59320      if (element.hasDevice()) {
59321        openArray("device");
59322        for (CodeableReference e : element.getDevice()) 
59323          composeCodeableReference(null, e);
59324        closeArray();
59325      };
59326      if (element.hasNote()) {
59327        openArray("note");
59328        for (Annotation e : element.getNote()) 
59329          composeAnnotation(null, e);
59330        closeArray();
59331      };
59332      if (element.hasDosage()) {
59333        composeMedicationAdministrationDosageComponent("dosage", element.getDosage());
59334      }
59335      if (element.hasEventHistory()) {
59336        openArray("eventHistory");
59337        for (Reference e : element.getEventHistory()) 
59338          composeReference(null, e);
59339        closeArray();
59340      };
59341  }
59342
59343  protected void composeMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
59344    if (element != null) {
59345      open(name);
59346      composeMedicationAdministrationPerformerComponentProperties(element);
59347      close();
59348    }
59349  }
59350
59351  protected void composeMedicationAdministrationPerformerComponentProperties(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
59352    composeBackboneElementProperties(element);
59353      if (element.hasFunction()) {
59354        composeCodeableConcept("function", element.getFunction());
59355      }
59356      if (element.hasActor()) {
59357        composeCodeableReference("actor", element.getActor());
59358      }
59359  }
59360
59361  protected void composeMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
59362    if (element != null) {
59363      open(name);
59364      composeMedicationAdministrationDosageComponentProperties(element);
59365      close();
59366    }
59367  }
59368
59369  protected void composeMedicationAdministrationDosageComponentProperties(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
59370    composeBackboneElementProperties(element);
59371      if (element.hasTextElement()) {
59372        composeStringCore("text", element.getTextElement(), false);
59373        composeStringExtras("text", element.getTextElement(), false);
59374      }
59375      if (element.hasSite()) {
59376        composeCodeableConcept("site", element.getSite());
59377      }
59378      if (element.hasRoute()) {
59379        composeCodeableConcept("route", element.getRoute());
59380      }
59381      if (element.hasMethod()) {
59382        composeCodeableConcept("method", element.getMethod());
59383      }
59384      if (element.hasDose()) {
59385        composeQuantity("dose", element.getDose());
59386      }
59387      if (element.hasRate()) {
59388        composeType("rate", element.getRate());
59389      }
59390  }
59391
59392  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
59393    if (element != null) {
59394      prop("resourceType", name);
59395      composeMedicationDispenseProperties(element);
59396    }
59397  }
59398
59399  protected void composeMedicationDispenseProperties(MedicationDispense element) throws IOException {
59400    composeDomainResourceProperties(element);
59401      if (element.hasIdentifier()) {
59402        openArray("identifier");
59403        for (Identifier e : element.getIdentifier()) 
59404          composeIdentifier(null, e);
59405        closeArray();
59406      };
59407      if (element.hasBasedOn()) {
59408        openArray("basedOn");
59409        for (Reference e : element.getBasedOn()) 
59410          composeReference(null, e);
59411        closeArray();
59412      };
59413      if (element.hasPartOf()) {
59414        openArray("partOf");
59415        for (Reference e : element.getPartOf()) 
59416          composeReference(null, e);
59417        closeArray();
59418      };
59419      if (element.hasStatusElement()) {
59420        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
59421        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
59422      }
59423      if (element.hasNotPerformedReason()) {
59424        composeCodeableReference("notPerformedReason", element.getNotPerformedReason());
59425      }
59426      if (element.hasStatusChangedElement()) {
59427        composeDateTimeCore("statusChanged", element.getStatusChangedElement(), false);
59428        composeDateTimeExtras("statusChanged", element.getStatusChangedElement(), false);
59429      }
59430      if (element.hasCategory()) {
59431        openArray("category");
59432        for (CodeableConcept e : element.getCategory()) 
59433          composeCodeableConcept(null, e);
59434        closeArray();
59435      };
59436      if (element.hasMedication()) {
59437        composeCodeableReference("medication", element.getMedication());
59438      }
59439      if (element.hasSubject()) {
59440        composeReference("subject", element.getSubject());
59441      }
59442      if (element.hasEncounter()) {
59443        composeReference("encounter", element.getEncounter());
59444      }
59445      if (element.hasSupportingInformation()) {
59446        openArray("supportingInformation");
59447        for (Reference e : element.getSupportingInformation()) 
59448          composeReference(null, e);
59449        closeArray();
59450      };
59451      if (element.hasPerformer()) {
59452        openArray("performer");
59453        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
59454          composeMedicationDispensePerformerComponent(null, e);
59455        closeArray();
59456      };
59457      if (element.hasLocation()) {
59458        composeReference("location", element.getLocation());
59459      }
59460      if (element.hasAuthorizingPrescription()) {
59461        openArray("authorizingPrescription");
59462        for (Reference e : element.getAuthorizingPrescription()) 
59463          composeReference(null, e);
59464        closeArray();
59465      };
59466      if (element.hasType()) {
59467        composeCodeableConcept("type", element.getType());
59468      }
59469      if (element.hasQuantity()) {
59470        composeQuantity("quantity", element.getQuantity());
59471      }
59472      if (element.hasDaysSupply()) {
59473        composeQuantity("daysSupply", element.getDaysSupply());
59474      }
59475      if (element.hasRecordedElement()) {
59476        composeDateTimeCore("recorded", element.getRecordedElement(), false);
59477        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
59478      }
59479      if (element.hasWhenPreparedElement()) {
59480        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
59481        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
59482      }
59483      if (element.hasWhenHandedOverElement()) {
59484        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
59485        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
59486      }
59487      if (element.hasDestination()) {
59488        composeReference("destination", element.getDestination());
59489      }
59490      if (element.hasReceiver()) {
59491        openArray("receiver");
59492        for (Reference e : element.getReceiver()) 
59493          composeReference(null, e);
59494        closeArray();
59495      };
59496      if (element.hasNote()) {
59497        openArray("note");
59498        for (Annotation e : element.getNote()) 
59499          composeAnnotation(null, e);
59500        closeArray();
59501      };
59502      if (element.hasRenderedDosageInstructionElement()) {
59503        composeMarkdownCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
59504        composeMarkdownExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
59505      }
59506      if (element.hasDosageInstruction()) {
59507        openArray("dosageInstruction");
59508        for (Dosage e : element.getDosageInstruction()) 
59509          composeDosage(null, e);
59510        closeArray();
59511      };
59512      if (element.hasSubstitution()) {
59513        composeMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
59514      }
59515      if (element.hasEventHistory()) {
59516        openArray("eventHistory");
59517        for (Reference e : element.getEventHistory()) 
59518          composeReference(null, e);
59519        closeArray();
59520      };
59521  }
59522
59523  protected void composeMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
59524    if (element != null) {
59525      open(name);
59526      composeMedicationDispensePerformerComponentProperties(element);
59527      close();
59528    }
59529  }
59530
59531  protected void composeMedicationDispensePerformerComponentProperties(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
59532    composeBackboneElementProperties(element);
59533      if (element.hasFunction()) {
59534        composeCodeableConcept("function", element.getFunction());
59535      }
59536      if (element.hasActor()) {
59537        composeReference("actor", element.getActor());
59538      }
59539  }
59540
59541  protected void composeMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
59542    if (element != null) {
59543      open(name);
59544      composeMedicationDispenseSubstitutionComponentProperties(element);
59545      close();
59546    }
59547  }
59548
59549  protected void composeMedicationDispenseSubstitutionComponentProperties(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
59550    composeBackboneElementProperties(element);
59551      if (element.hasWasSubstitutedElement()) {
59552        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
59553        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
59554      }
59555      if (element.hasType()) {
59556        composeCodeableConcept("type", element.getType());
59557      }
59558      if (element.hasReason()) {
59559        openArray("reason");
59560        for (CodeableConcept e : element.getReason()) 
59561          composeCodeableConcept(null, e);
59562        closeArray();
59563      };
59564      if (element.hasResponsibleParty()) {
59565        composeReference("responsibleParty", element.getResponsibleParty());
59566      }
59567  }
59568
59569  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
59570    if (element != null) {
59571      prop("resourceType", name);
59572      composeMedicationKnowledgeProperties(element);
59573    }
59574  }
59575
59576  protected void composeMedicationKnowledgeProperties(MedicationKnowledge element) throws IOException {
59577    composeDomainResourceProperties(element);
59578      if (element.hasIdentifier()) {
59579        openArray("identifier");
59580        for (Identifier e : element.getIdentifier()) 
59581          composeIdentifier(null, e);
59582        closeArray();
59583      };
59584      if (element.hasCode()) {
59585        composeCodeableConcept("code", element.getCode());
59586      }
59587      if (element.hasStatusElement()) {
59588        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
59589        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
59590      }
59591      if (element.hasAuthor()) {
59592        composeReference("author", element.getAuthor());
59593      }
59594      if (element.hasIntendedJurisdiction()) {
59595        openArray("intendedJurisdiction");
59596        for (CodeableConcept e : element.getIntendedJurisdiction()) 
59597          composeCodeableConcept(null, e);
59598        closeArray();
59599      };
59600      if (element.hasName()) {
59601        if (anyHasValue(element.getName())) {
59602          openArray("name");
59603          for (StringType e : element.getName()) 
59604            composeStringCore(null, e, e != element.getName().get(element.getName().size()-1));
59605          closeArray();
59606        }
59607        if (anyHasExtras(element.getName())) {
59608          openArray("_name");
59609          for (StringType e : element.getName()) 
59610            composeStringExtras(null, e, true);
59611          closeArray();
59612        }
59613      };
59614      if (element.hasRelatedMedicationKnowledge()) {
59615        openArray("relatedMedicationKnowledge");
59616        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
59617          composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
59618        closeArray();
59619      };
59620      if (element.hasAssociatedMedication()) {
59621        openArray("associatedMedication");
59622        for (Reference e : element.getAssociatedMedication()) 
59623          composeReference(null, e);
59624        closeArray();
59625      };
59626      if (element.hasProductType()) {
59627        openArray("productType");
59628        for (CodeableConcept e : element.getProductType()) 
59629          composeCodeableConcept(null, e);
59630        closeArray();
59631      };
59632      if (element.hasMonograph()) {
59633        openArray("monograph");
59634        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
59635          composeMedicationKnowledgeMonographComponent(null, e);
59636        closeArray();
59637      };
59638      if (element.hasPreparationInstructionElement()) {
59639        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
59640        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
59641      }
59642      if (element.hasCost()) {
59643        openArray("cost");
59644        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
59645          composeMedicationKnowledgeCostComponent(null, e);
59646        closeArray();
59647      };
59648      if (element.hasMonitoringProgram()) {
59649        openArray("monitoringProgram");
59650        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
59651          composeMedicationKnowledgeMonitoringProgramComponent(null, e);
59652        closeArray();
59653      };
59654      if (element.hasIndicationGuideline()) {
59655        openArray("indicationGuideline");
59656        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent e : element.getIndicationGuideline()) 
59657          composeMedicationKnowledgeIndicationGuidelineComponent(null, e);
59658        closeArray();
59659      };
59660      if (element.hasMedicineClassification()) {
59661        openArray("medicineClassification");
59662        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
59663          composeMedicationKnowledgeMedicineClassificationComponent(null, e);
59664        closeArray();
59665      };
59666      if (element.hasPackaging()) {
59667        openArray("packaging");
59668        for (MedicationKnowledge.MedicationKnowledgePackagingComponent e : element.getPackaging()) 
59669          composeMedicationKnowledgePackagingComponent(null, e);
59670        closeArray();
59671      };
59672      if (element.hasClinicalUseIssue()) {
59673        openArray("clinicalUseIssue");
59674        for (Reference e : element.getClinicalUseIssue()) 
59675          composeReference(null, e);
59676        closeArray();
59677      };
59678      if (element.hasStorageGuideline()) {
59679        openArray("storageGuideline");
59680        for (MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent e : element.getStorageGuideline()) 
59681          composeMedicationKnowledgeStorageGuidelineComponent(null, e);
59682        closeArray();
59683      };
59684      if (element.hasRegulatory()) {
59685        openArray("regulatory");
59686        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
59687          composeMedicationKnowledgeRegulatoryComponent(null, e);
59688        closeArray();
59689      };
59690      if (element.hasDefinitional()) {
59691        composeMedicationKnowledgeDefinitionalComponent("definitional", element.getDefinitional());
59692      }
59693  }
59694
59695  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
59696    if (element != null) {
59697      open(name);
59698      composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(element);
59699      close();
59700    }
59701  }
59702
59703  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
59704    composeBackboneElementProperties(element);
59705      if (element.hasType()) {
59706        composeCodeableConcept("type", element.getType());
59707      }
59708      if (element.hasReference()) {
59709        openArray("reference");
59710        for (Reference e : element.getReference()) 
59711          composeReference(null, e);
59712        closeArray();
59713      };
59714  }
59715
59716  protected void composeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
59717    if (element != null) {
59718      open(name);
59719      composeMedicationKnowledgeMonographComponentProperties(element);
59720      close();
59721    }
59722  }
59723
59724  protected void composeMedicationKnowledgeMonographComponentProperties(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
59725    composeBackboneElementProperties(element);
59726      if (element.hasType()) {
59727        composeCodeableConcept("type", element.getType());
59728      }
59729      if (element.hasSource()) {
59730        composeReference("source", element.getSource());
59731      }
59732  }
59733
59734  protected void composeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
59735    if (element != null) {
59736      open(name);
59737      composeMedicationKnowledgeCostComponentProperties(element);
59738      close();
59739    }
59740  }
59741
59742  protected void composeMedicationKnowledgeCostComponentProperties(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
59743    composeBackboneElementProperties(element);
59744      if (element.hasEffectiveDate()) {
59745        openArray("effectiveDate");
59746        for (Period e : element.getEffectiveDate()) 
59747          composePeriod(null, e);
59748        closeArray();
59749      };
59750      if (element.hasType()) {
59751        composeCodeableConcept("type", element.getType());
59752      }
59753      if (element.hasSourceElement()) {
59754        composeStringCore("source", element.getSourceElement(), false);
59755        composeStringExtras("source", element.getSourceElement(), false);
59756      }
59757      if (element.hasCost()) {
59758        composeType("cost", element.getCost());
59759      }
59760  }
59761
59762  protected void composeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
59763    if (element != null) {
59764      open(name);
59765      composeMedicationKnowledgeMonitoringProgramComponentProperties(element);
59766      close();
59767    }
59768  }
59769
59770  protected void composeMedicationKnowledgeMonitoringProgramComponentProperties(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
59771    composeBackboneElementProperties(element);
59772      if (element.hasType()) {
59773        composeCodeableConcept("type", element.getType());
59774      }
59775      if (element.hasNameElement()) {
59776        composeStringCore("name", element.getNameElement(), false);
59777        composeStringExtras("name", element.getNameElement(), false);
59778      }
59779  }
59780
59781  protected void composeMedicationKnowledgeIndicationGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent element) throws IOException {
59782    if (element != null) {
59783      open(name);
59784      composeMedicationKnowledgeIndicationGuidelineComponentProperties(element);
59785      close();
59786    }
59787  }
59788
59789  protected void composeMedicationKnowledgeIndicationGuidelineComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineComponent element) throws IOException {
59790    composeBackboneElementProperties(element);
59791      if (element.hasIndication()) {
59792        openArray("indication");
59793        for (CodeableReference e : element.getIndication()) 
59794          composeCodeableReference(null, e);
59795        closeArray();
59796      };
59797      if (element.hasDosingGuideline()) {
59798        openArray("dosingGuideline");
59799        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent e : element.getDosingGuideline()) 
59800          composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponent(null, e);
59801        closeArray();
59802      };
59803  }
59804
59805  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent element) throws IOException {
59806    if (element != null) {
59807      open(name);
59808      composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponentProperties(element);
59809      close();
59810    }
59811  }
59812
59813  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineComponent element) throws IOException {
59814    composeBackboneElementProperties(element);
59815      if (element.hasTreatmentIntent()) {
59816        composeCodeableConcept("treatmentIntent", element.getTreatmentIntent());
59817      }
59818      if (element.hasDosage()) {
59819        openArray("dosage");
59820        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent e : element.getDosage()) 
59821          composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent(null, e);
59822        closeArray();
59823      };
59824      if (element.hasAdministrationTreatment()) {
59825        composeCodeableConcept("administrationTreatment", element.getAdministrationTreatment());
59826      }
59827      if (element.hasPatientCharacteristic()) {
59828        openArray("patientCharacteristic");
59829        for (MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent e : element.getPatientCharacteristic()) 
59830          composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent(null, e);
59831        closeArray();
59832      };
59833  }
59834
59835  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent element) throws IOException {
59836    if (element != null) {
59837      open(name);
59838      composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponentProperties(element);
59839      close();
59840    }
59841  }
59842
59843  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelineDosageComponent element) throws IOException {
59844    composeBackboneElementProperties(element);
59845      if (element.hasType()) {
59846        composeCodeableConcept("type", element.getType());
59847      }
59848      if (element.hasDosage()) {
59849        openArray("dosage");
59850        for (Dosage e : element.getDosage()) 
59851          composeDosage(null, e);
59852        closeArray();
59853      };
59854  }
59855
59856  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent element) throws IOException {
59857    if (element != null) {
59858      open(name);
59859      composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponentProperties(element);
59860      close();
59861    }
59862  }
59863
59864  protected void composeMedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeIndicationGuidelineDosingGuidelinePatientCharacteristicComponent element) throws IOException {
59865    composeBackboneElementProperties(element);
59866      if (element.hasType()) {
59867        composeCodeableConcept("type", element.getType());
59868      }
59869      if (element.hasValue()) {
59870        composeType("value", element.getValue());
59871      }
59872  }
59873
59874  protected void composeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
59875    if (element != null) {
59876      open(name);
59877      composeMedicationKnowledgeMedicineClassificationComponentProperties(element);
59878      close();
59879    }
59880  }
59881
59882  protected void composeMedicationKnowledgeMedicineClassificationComponentProperties(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
59883    composeBackboneElementProperties(element);
59884      if (element.hasType()) {
59885        composeCodeableConcept("type", element.getType());
59886      }
59887      if (element.hasSource()) {
59888        composeType("source", element.getSource());
59889      }
59890      if (element.hasClassification()) {
59891        openArray("classification");
59892        for (CodeableConcept e : element.getClassification()) 
59893          composeCodeableConcept(null, e);
59894        closeArray();
59895      };
59896  }
59897
59898  protected void composeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
59899    if (element != null) {
59900      open(name);
59901      composeMedicationKnowledgePackagingComponentProperties(element);
59902      close();
59903    }
59904  }
59905
59906  protected void composeMedicationKnowledgePackagingComponentProperties(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
59907    composeBackboneElementProperties(element);
59908      if (element.hasCost()) {
59909        openArray("cost");
59910        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
59911          composeMedicationKnowledgeCostComponent(null, e);
59912        closeArray();
59913      };
59914      if (element.hasPackagedProduct()) {
59915        composeReference("packagedProduct", element.getPackagedProduct());
59916      }
59917  }
59918
59919  protected void composeMedicationKnowledgeStorageGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent element) throws IOException {
59920    if (element != null) {
59921      open(name);
59922      composeMedicationKnowledgeStorageGuidelineComponentProperties(element);
59923      close();
59924    }
59925  }
59926
59927  protected void composeMedicationKnowledgeStorageGuidelineComponentProperties(MedicationKnowledge.MedicationKnowledgeStorageGuidelineComponent element) throws IOException {
59928    composeBackboneElementProperties(element);
59929      if (element.hasReferenceElement()) {
59930        composeUriCore("reference", element.getReferenceElement(), false);
59931        composeUriExtras("reference", element.getReferenceElement(), false);
59932      }
59933      if (element.hasNote()) {
59934        openArray("note");
59935        for (Annotation e : element.getNote()) 
59936          composeAnnotation(null, e);
59937        closeArray();
59938      };
59939      if (element.hasStabilityDuration()) {
59940        composeDuration("stabilityDuration", element.getStabilityDuration());
59941      }
59942      if (element.hasEnvironmentalSetting()) {
59943        openArray("environmentalSetting");
59944        for (MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent e : element.getEnvironmentalSetting()) 
59945          composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent(null, e);
59946        closeArray();
59947      };
59948  }
59949
59950  protected void composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent(String name, MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent element) throws IOException {
59951    if (element != null) {
59952      open(name);
59953      composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponentProperties(element);
59954      close();
59955    }
59956  }
59957
59958  protected void composeMedicationKnowledgeStorageGuidelineEnvironmentalSettingComponentProperties(MedicationKnowledge.MedicationKnowledgeStorageGuidelineEnvironmentalSettingComponent element) throws IOException {
59959    composeBackboneElementProperties(element);
59960      if (element.hasType()) {
59961        composeCodeableConcept("type", element.getType());
59962      }
59963      if (element.hasValue()) {
59964        composeType("value", element.getValue());
59965      }
59966  }
59967
59968  protected void composeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
59969    if (element != null) {
59970      open(name);
59971      composeMedicationKnowledgeRegulatoryComponentProperties(element);
59972      close();
59973    }
59974  }
59975
59976  protected void composeMedicationKnowledgeRegulatoryComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
59977    composeBackboneElementProperties(element);
59978      if (element.hasRegulatoryAuthority()) {
59979        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
59980      }
59981      if (element.hasSubstitution()) {
59982        openArray("substitution");
59983        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
59984          composeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
59985        closeArray();
59986      };
59987      if (element.hasSchedule()) {
59988        openArray("schedule");
59989        for (CodeableConcept e : element.getSchedule()) 
59990          composeCodeableConcept(null, e);
59991        closeArray();
59992      };
59993      if (element.hasMaxDispense()) {
59994        composeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
59995      }
59996  }
59997
59998  protected void composeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
59999    if (element != null) {
60000      open(name);
60001      composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(element);
60002      close();
60003    }
60004  }
60005
60006  protected void composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
60007    composeBackboneElementProperties(element);
60008      if (element.hasType()) {
60009        composeCodeableConcept("type", element.getType());
60010      }
60011      if (element.hasAllowedElement()) {
60012        composeBooleanCore("allowed", element.getAllowedElement(), false);
60013        composeBooleanExtras("allowed", element.getAllowedElement(), false);
60014      }
60015  }
60016
60017  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
60018    if (element != null) {
60019      open(name);
60020      composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(element);
60021      close();
60022    }
60023  }
60024
60025  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
60026    composeBackboneElementProperties(element);
60027      if (element.hasQuantity()) {
60028        composeQuantity("quantity", element.getQuantity());
60029      }
60030      if (element.hasPeriod()) {
60031        composeDuration("period", element.getPeriod());
60032      }
60033  }
60034
60035  protected void composeMedicationKnowledgeDefinitionalComponent(String name, MedicationKnowledge.MedicationKnowledgeDefinitionalComponent element) throws IOException {
60036    if (element != null) {
60037      open(name);
60038      composeMedicationKnowledgeDefinitionalComponentProperties(element);
60039      close();
60040    }
60041  }
60042
60043  protected void composeMedicationKnowledgeDefinitionalComponentProperties(MedicationKnowledge.MedicationKnowledgeDefinitionalComponent element) throws IOException {
60044    composeBackboneElementProperties(element);
60045      if (element.hasDefinition()) {
60046        openArray("definition");
60047        for (Reference e : element.getDefinition()) 
60048          composeReference(null, e);
60049        closeArray();
60050      };
60051      if (element.hasDoseForm()) {
60052        composeCodeableConcept("doseForm", element.getDoseForm());
60053      }
60054      if (element.hasIntendedRoute()) {
60055        openArray("intendedRoute");
60056        for (CodeableConcept e : element.getIntendedRoute()) 
60057          composeCodeableConcept(null, e);
60058        closeArray();
60059      };
60060      if (element.hasIngredient()) {
60061        openArray("ingredient");
60062        for (MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent e : element.getIngredient()) 
60063          composeMedicationKnowledgeDefinitionalIngredientComponent(null, e);
60064        closeArray();
60065      };
60066      if (element.hasDrugCharacteristic()) {
60067        openArray("drugCharacteristic");
60068        for (MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
60069          composeMedicationKnowledgeDefinitionalDrugCharacteristicComponent(null, e);
60070        closeArray();
60071      };
60072  }
60073
60074  protected void composeMedicationKnowledgeDefinitionalIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent element) throws IOException {
60075    if (element != null) {
60076      open(name);
60077      composeMedicationKnowledgeDefinitionalIngredientComponentProperties(element);
60078      close();
60079    }
60080  }
60081
60082  protected void composeMedicationKnowledgeDefinitionalIngredientComponentProperties(MedicationKnowledge.MedicationKnowledgeDefinitionalIngredientComponent element) throws IOException {
60083    composeBackboneElementProperties(element);
60084      if (element.hasItem()) {
60085        composeCodeableReference("item", element.getItem());
60086      }
60087      if (element.hasType()) {
60088        composeCodeableConcept("type", element.getType());
60089      }
60090      if (element.hasStrength()) {
60091        composeType("strength", element.getStrength());
60092      }
60093  }
60094
60095  protected void composeMedicationKnowledgeDefinitionalDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent element) throws IOException {
60096    if (element != null) {
60097      open(name);
60098      composeMedicationKnowledgeDefinitionalDrugCharacteristicComponentProperties(element);
60099      close();
60100    }
60101  }
60102
60103  protected void composeMedicationKnowledgeDefinitionalDrugCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeDefinitionalDrugCharacteristicComponent element) throws IOException {
60104    composeBackboneElementProperties(element);
60105      if (element.hasType()) {
60106        composeCodeableConcept("type", element.getType());
60107      }
60108      if (element.hasValue()) {
60109        composeType("value", element.getValue());
60110      }
60111  }
60112
60113  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
60114    if (element != null) {
60115      prop("resourceType", name);
60116      composeMedicationRequestProperties(element);
60117    }
60118  }
60119
60120  protected void composeMedicationRequestProperties(MedicationRequest element) throws IOException {
60121    composeDomainResourceProperties(element);
60122      if (element.hasIdentifier()) {
60123        openArray("identifier");
60124        for (Identifier e : element.getIdentifier()) 
60125          composeIdentifier(null, e);
60126        closeArray();
60127      };
60128      if (element.hasBasedOn()) {
60129        openArray("basedOn");
60130        for (Reference e : element.getBasedOn()) 
60131          composeReference(null, e);
60132        closeArray();
60133      };
60134      if (element.hasPriorPrescription()) {
60135        composeReference("priorPrescription", element.getPriorPrescription());
60136      }
60137      if (element.hasGroupIdentifier()) {
60138        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
60139      }
60140      if (element.hasStatusElement()) {
60141        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
60142        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
60143      }
60144      if (element.hasStatusReason()) {
60145        composeCodeableConcept("statusReason", element.getStatusReason());
60146      }
60147      if (element.hasStatusChangedElement()) {
60148        composeDateTimeCore("statusChanged", element.getStatusChangedElement(), false);
60149        composeDateTimeExtras("statusChanged", element.getStatusChangedElement(), false);
60150      }
60151      if (element.hasIntentElement()) {
60152        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
60153        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
60154      }
60155      if (element.hasCategory()) {
60156        openArray("category");
60157        for (CodeableConcept e : element.getCategory()) 
60158          composeCodeableConcept(null, e);
60159        closeArray();
60160      };
60161      if (element.hasPriorityElement()) {
60162        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
60163        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
60164      }
60165      if (element.hasDoNotPerformElement()) {
60166        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
60167        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
60168      }
60169      if (element.hasMedication()) {
60170        composeCodeableReference("medication", element.getMedication());
60171      }
60172      if (element.hasSubject()) {
60173        composeReference("subject", element.getSubject());
60174      }
60175      if (element.hasInformationSource()) {
60176        openArray("informationSource");
60177        for (Reference e : element.getInformationSource()) 
60178          composeReference(null, e);
60179        closeArray();
60180      };
60181      if (element.hasEncounter()) {
60182        composeReference("encounter", element.getEncounter());
60183      }
60184      if (element.hasSupportingInformation()) {
60185        openArray("supportingInformation");
60186        for (Reference e : element.getSupportingInformation()) 
60187          composeReference(null, e);
60188        closeArray();
60189      };
60190      if (element.hasAuthoredOnElement()) {
60191        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
60192        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
60193      }
60194      if (element.hasRequester()) {
60195        composeReference("requester", element.getRequester());
60196      }
60197      if (element.hasReportedElement()) {
60198        composeBooleanCore("reported", element.getReportedElement(), false);
60199        composeBooleanExtras("reported", element.getReportedElement(), false);
60200      }
60201      if (element.hasPerformerType()) {
60202        composeCodeableConcept("performerType", element.getPerformerType());
60203      }
60204      if (element.hasPerformer()) {
60205        openArray("performer");
60206        for (Reference e : element.getPerformer()) 
60207          composeReference(null, e);
60208        closeArray();
60209      };
60210      if (element.hasDevice()) {
60211        openArray("device");
60212        for (CodeableReference e : element.getDevice()) 
60213          composeCodeableReference(null, e);
60214        closeArray();
60215      };
60216      if (element.hasRecorder()) {
60217        composeReference("recorder", element.getRecorder());
60218      }
60219      if (element.hasReason()) {
60220        openArray("reason");
60221        for (CodeableReference e : element.getReason()) 
60222          composeCodeableReference(null, e);
60223        closeArray();
60224      };
60225      if (element.hasCourseOfTherapyType()) {
60226        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
60227      }
60228      if (element.hasInsurance()) {
60229        openArray("insurance");
60230        for (Reference e : element.getInsurance()) 
60231          composeReference(null, e);
60232        closeArray();
60233      };
60234      if (element.hasNote()) {
60235        openArray("note");
60236        for (Annotation e : element.getNote()) 
60237          composeAnnotation(null, e);
60238        closeArray();
60239      };
60240      if (element.hasRenderedDosageInstructionElement()) {
60241        composeMarkdownCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60242        composeMarkdownExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60243      }
60244      if (element.hasEffectiveDosePeriod()) {
60245        composePeriod("effectiveDosePeriod", element.getEffectiveDosePeriod());
60246      }
60247      if (element.hasDosageInstruction()) {
60248        openArray("dosageInstruction");
60249        for (Dosage e : element.getDosageInstruction()) 
60250          composeDosage(null, e);
60251        closeArray();
60252      };
60253      if (element.hasDispenseRequest()) {
60254        composeMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
60255      }
60256      if (element.hasSubstitution()) {
60257        composeMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
60258      }
60259      if (element.hasEventHistory()) {
60260        openArray("eventHistory");
60261        for (Reference e : element.getEventHistory()) 
60262          composeReference(null, e);
60263        closeArray();
60264      };
60265  }
60266
60267  protected void composeMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
60268    if (element != null) {
60269      open(name);
60270      composeMedicationRequestDispenseRequestComponentProperties(element);
60271      close();
60272    }
60273  }
60274
60275  protected void composeMedicationRequestDispenseRequestComponentProperties(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
60276    composeBackboneElementProperties(element);
60277      if (element.hasInitialFill()) {
60278        composeMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
60279      }
60280      if (element.hasDispenseInterval()) {
60281        composeDuration("dispenseInterval", element.getDispenseInterval());
60282      }
60283      if (element.hasValidityPeriod()) {
60284        composePeriod("validityPeriod", element.getValidityPeriod());
60285      }
60286      if (element.hasNumberOfRepeatsAllowedElement()) {
60287        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
60288        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
60289      }
60290      if (element.hasQuantity()) {
60291        composeQuantity("quantity", element.getQuantity());
60292      }
60293      if (element.hasExpectedSupplyDuration()) {
60294        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
60295      }
60296      if (element.hasDispenser()) {
60297        composeReference("dispenser", element.getDispenser());
60298      }
60299      if (element.hasDispenserInstruction()) {
60300        openArray("dispenserInstruction");
60301        for (Annotation e : element.getDispenserInstruction()) 
60302          composeAnnotation(null, e);
60303        closeArray();
60304      };
60305      if (element.hasDoseAdministrationAid()) {
60306        composeCodeableConcept("doseAdministrationAid", element.getDoseAdministrationAid());
60307      }
60308  }
60309
60310  protected void composeMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
60311    if (element != null) {
60312      open(name);
60313      composeMedicationRequestDispenseRequestInitialFillComponentProperties(element);
60314      close();
60315    }
60316  }
60317
60318  protected void composeMedicationRequestDispenseRequestInitialFillComponentProperties(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
60319    composeBackboneElementProperties(element);
60320      if (element.hasQuantity()) {
60321        composeQuantity("quantity", element.getQuantity());
60322      }
60323      if (element.hasDuration()) {
60324        composeDuration("duration", element.getDuration());
60325      }
60326  }
60327
60328  protected void composeMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
60329    if (element != null) {
60330      open(name);
60331      composeMedicationRequestSubstitutionComponentProperties(element);
60332      close();
60333    }
60334  }
60335
60336  protected void composeMedicationRequestSubstitutionComponentProperties(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
60337    composeBackboneElementProperties(element);
60338      if (element.hasAllowed()) {
60339        composeType("allowed", element.getAllowed());
60340      }
60341      if (element.hasReason()) {
60342        composeCodeableConcept("reason", element.getReason());
60343      }
60344  }
60345
60346  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
60347    if (element != null) {
60348      prop("resourceType", name);
60349      composeMedicationStatementProperties(element);
60350    }
60351  }
60352
60353  protected void composeMedicationStatementProperties(MedicationStatement element) throws IOException {
60354    composeDomainResourceProperties(element);
60355      if (element.hasIdentifier()) {
60356        openArray("identifier");
60357        for (Identifier e : element.getIdentifier()) 
60358          composeIdentifier(null, e);
60359        closeArray();
60360      };
60361      if (element.hasPartOf()) {
60362        openArray("partOf");
60363        for (Reference e : element.getPartOf()) 
60364          composeReference(null, e);
60365        closeArray();
60366      };
60367      if (element.hasStatusElement()) {
60368        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusCodesEnumFactory(), false);
60369        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusCodesEnumFactory(), false);
60370      }
60371      if (element.hasCategory()) {
60372        openArray("category");
60373        for (CodeableConcept e : element.getCategory()) 
60374          composeCodeableConcept(null, e);
60375        closeArray();
60376      };
60377      if (element.hasMedication()) {
60378        composeCodeableReference("medication", element.getMedication());
60379      }
60380      if (element.hasSubject()) {
60381        composeReference("subject", element.getSubject());
60382      }
60383      if (element.hasEncounter()) {
60384        composeReference("encounter", element.getEncounter());
60385      }
60386      if (element.hasEffective()) {
60387        composeType("effective", element.getEffective());
60388      }
60389      if (element.hasDateAssertedElement()) {
60390        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
60391        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
60392      }
60393      if (element.hasInformationSource()) {
60394        openArray("informationSource");
60395        for (Reference e : element.getInformationSource()) 
60396          composeReference(null, e);
60397        closeArray();
60398      };
60399      if (element.hasDerivedFrom()) {
60400        openArray("derivedFrom");
60401        for (Reference e : element.getDerivedFrom()) 
60402          composeReference(null, e);
60403        closeArray();
60404      };
60405      if (element.hasReason()) {
60406        openArray("reason");
60407        for (CodeableReference e : element.getReason()) 
60408          composeCodeableReference(null, e);
60409        closeArray();
60410      };
60411      if (element.hasNote()) {
60412        openArray("note");
60413        for (Annotation e : element.getNote()) 
60414          composeAnnotation(null, e);
60415        closeArray();
60416      };
60417      if (element.hasRelatedClinicalInformation()) {
60418        openArray("relatedClinicalInformation");
60419        for (Reference e : element.getRelatedClinicalInformation()) 
60420          composeReference(null, e);
60421        closeArray();
60422      };
60423      if (element.hasRenderedDosageInstructionElement()) {
60424        composeMarkdownCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60425        composeMarkdownExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
60426      }
60427      if (element.hasDosage()) {
60428        openArray("dosage");
60429        for (Dosage e : element.getDosage()) 
60430          composeDosage(null, e);
60431        closeArray();
60432      };
60433      if (element.hasAdherence()) {
60434        composeMedicationStatementAdherenceComponent("adherence", element.getAdherence());
60435      }
60436  }
60437
60438  protected void composeMedicationStatementAdherenceComponent(String name, MedicationStatement.MedicationStatementAdherenceComponent element) throws IOException {
60439    if (element != null) {
60440      open(name);
60441      composeMedicationStatementAdherenceComponentProperties(element);
60442      close();
60443    }
60444  }
60445
60446  protected void composeMedicationStatementAdherenceComponentProperties(MedicationStatement.MedicationStatementAdherenceComponent element) throws IOException {
60447    composeBackboneElementProperties(element);
60448      if (element.hasCode()) {
60449        composeCodeableConcept("code", element.getCode());
60450      }
60451      if (element.hasReason()) {
60452        composeCodeableConcept("reason", element.getReason());
60453      }
60454  }
60455
60456  protected void composeMedicinalProductDefinition(String name, MedicinalProductDefinition element) throws IOException {
60457    if (element != null) {
60458      prop("resourceType", name);
60459      composeMedicinalProductDefinitionProperties(element);
60460    }
60461  }
60462
60463  protected void composeMedicinalProductDefinitionProperties(MedicinalProductDefinition element) throws IOException {
60464    composeDomainResourceProperties(element);
60465      if (element.hasIdentifier()) {
60466        openArray("identifier");
60467        for (Identifier e : element.getIdentifier()) 
60468          composeIdentifier(null, e);
60469        closeArray();
60470      };
60471      if (element.hasType()) {
60472        composeCodeableConcept("type", element.getType());
60473      }
60474      if (element.hasDomain()) {
60475        composeCodeableConcept("domain", element.getDomain());
60476      }
60477      if (element.hasVersionElement()) {
60478        composeStringCore("version", element.getVersionElement(), false);
60479        composeStringExtras("version", element.getVersionElement(), false);
60480      }
60481      if (element.hasStatus()) {
60482        composeCodeableConcept("status", element.getStatus());
60483      }
60484      if (element.hasStatusDateElement()) {
60485        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
60486        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
60487      }
60488      if (element.hasDescriptionElement()) {
60489        composeMarkdownCore("description", element.getDescriptionElement(), false);
60490        composeMarkdownExtras("description", element.getDescriptionElement(), false);
60491      }
60492      if (element.hasCombinedPharmaceuticalDoseForm()) {
60493        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
60494      }
60495      if (element.hasRoute()) {
60496        openArray("route");
60497        for (CodeableConcept e : element.getRoute()) 
60498          composeCodeableConcept(null, e);
60499        closeArray();
60500      };
60501      if (element.hasIndicationElement()) {
60502        composeMarkdownCore("indication", element.getIndicationElement(), false);
60503        composeMarkdownExtras("indication", element.getIndicationElement(), false);
60504      }
60505      if (element.hasLegalStatusOfSupply()) {
60506        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
60507      }
60508      if (element.hasAdditionalMonitoringIndicator()) {
60509        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
60510      }
60511      if (element.hasSpecialMeasures()) {
60512        openArray("specialMeasures");
60513        for (CodeableConcept e : element.getSpecialMeasures()) 
60514          composeCodeableConcept(null, e);
60515        closeArray();
60516      };
60517      if (element.hasPediatricUseIndicator()) {
60518        composeCodeableConcept("pediatricUseIndicator", element.getPediatricUseIndicator());
60519      }
60520      if (element.hasClassification()) {
60521        openArray("classification");
60522        for (CodeableConcept e : element.getClassification()) 
60523          composeCodeableConcept(null, e);
60524        closeArray();
60525      };
60526      if (element.hasMarketingStatus()) {
60527        openArray("marketingStatus");
60528        for (MarketingStatus e : element.getMarketingStatus()) 
60529          composeMarketingStatus(null, e);
60530        closeArray();
60531      };
60532      if (element.hasPackagedMedicinalProduct()) {
60533        openArray("packagedMedicinalProduct");
60534        for (CodeableConcept e : element.getPackagedMedicinalProduct()) 
60535          composeCodeableConcept(null, e);
60536        closeArray();
60537      };
60538      if (element.hasComprisedOf()) {
60539        openArray("comprisedOf");
60540        for (Reference e : element.getComprisedOf()) 
60541          composeReference(null, e);
60542        closeArray();
60543      };
60544      if (element.hasIngredient()) {
60545        openArray("ingredient");
60546        for (CodeableConcept e : element.getIngredient()) 
60547          composeCodeableConcept(null, e);
60548        closeArray();
60549      };
60550      if (element.hasImpurity()) {
60551        openArray("impurity");
60552        for (CodeableReference e : element.getImpurity()) 
60553          composeCodeableReference(null, e);
60554        closeArray();
60555      };
60556      if (element.hasAttachedDocument()) {
60557        openArray("attachedDocument");
60558        for (Reference e : element.getAttachedDocument()) 
60559          composeReference(null, e);
60560        closeArray();
60561      };
60562      if (element.hasMasterFile()) {
60563        openArray("masterFile");
60564        for (Reference e : element.getMasterFile()) 
60565          composeReference(null, e);
60566        closeArray();
60567      };
60568      if (element.hasContact()) {
60569        openArray("contact");
60570        for (MedicinalProductDefinition.MedicinalProductDefinitionContactComponent e : element.getContact()) 
60571          composeMedicinalProductDefinitionContactComponent(null, e);
60572        closeArray();
60573      };
60574      if (element.hasClinicalTrial()) {
60575        openArray("clinicalTrial");
60576        for (Reference e : element.getClinicalTrial()) 
60577          composeReference(null, e);
60578        closeArray();
60579      };
60580      if (element.hasCode()) {
60581        openArray("code");
60582        for (Coding e : element.getCode()) 
60583          composeCoding(null, e);
60584        closeArray();
60585      };
60586      if (element.hasName()) {
60587        openArray("name");
60588        for (MedicinalProductDefinition.MedicinalProductDefinitionNameComponent e : element.getName()) 
60589          composeMedicinalProductDefinitionNameComponent(null, e);
60590        closeArray();
60591      };
60592      if (element.hasCrossReference()) {
60593        openArray("crossReference");
60594        for (MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent e : element.getCrossReference()) 
60595          composeMedicinalProductDefinitionCrossReferenceComponent(null, e);
60596        closeArray();
60597      };
60598      if (element.hasOperation()) {
60599        openArray("operation");
60600        for (MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent e : element.getOperation()) 
60601          composeMedicinalProductDefinitionOperationComponent(null, e);
60602        closeArray();
60603      };
60604      if (element.hasCharacteristic()) {
60605        openArray("characteristic");
60606        for (MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent e : element.getCharacteristic()) 
60607          composeMedicinalProductDefinitionCharacteristicComponent(null, e);
60608        closeArray();
60609      };
60610  }
60611
60612  protected void composeMedicinalProductDefinitionContactComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
60613    if (element != null) {
60614      open(name);
60615      composeMedicinalProductDefinitionContactComponentProperties(element);
60616      close();
60617    }
60618  }
60619
60620  protected void composeMedicinalProductDefinitionContactComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
60621    composeBackboneElementProperties(element);
60622      if (element.hasType()) {
60623        composeCodeableConcept("type", element.getType());
60624      }
60625      if (element.hasContact()) {
60626        composeReference("contact", element.getContact());
60627      }
60628  }
60629
60630  protected void composeMedicinalProductDefinitionNameComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
60631    if (element != null) {
60632      open(name);
60633      composeMedicinalProductDefinitionNameComponentProperties(element);
60634      close();
60635    }
60636  }
60637
60638  protected void composeMedicinalProductDefinitionNameComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
60639    composeBackboneElementProperties(element);
60640      if (element.hasProductNameElement()) {
60641        composeStringCore("productName", element.getProductNameElement(), false);
60642        composeStringExtras("productName", element.getProductNameElement(), false);
60643      }
60644      if (element.hasType()) {
60645        composeCodeableConcept("type", element.getType());
60646      }
60647      if (element.hasPart()) {
60648        openArray("part");
60649        for (MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent e : element.getPart()) 
60650          composeMedicinalProductDefinitionNamePartComponent(null, e);
60651        closeArray();
60652      };
60653      if (element.hasUsage()) {
60654        openArray("usage");
60655        for (MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent e : element.getUsage()) 
60656          composeMedicinalProductDefinitionNameUsageComponent(null, e);
60657        closeArray();
60658      };
60659  }
60660
60661  protected void composeMedicinalProductDefinitionNamePartComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent element) throws IOException {
60662    if (element != null) {
60663      open(name);
60664      composeMedicinalProductDefinitionNamePartComponentProperties(element);
60665      close();
60666    }
60667  }
60668
60669  protected void composeMedicinalProductDefinitionNamePartComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNamePartComponent element) throws IOException {
60670    composeBackboneElementProperties(element);
60671      if (element.hasPartElement()) {
60672        composeStringCore("part", element.getPartElement(), false);
60673        composeStringExtras("part", element.getPartElement(), false);
60674      }
60675      if (element.hasType()) {
60676        composeCodeableConcept("type", element.getType());
60677      }
60678  }
60679
60680  protected void composeMedicinalProductDefinitionNameUsageComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent element) throws IOException {
60681    if (element != null) {
60682      open(name);
60683      composeMedicinalProductDefinitionNameUsageComponentProperties(element);
60684      close();
60685    }
60686  }
60687
60688  protected void composeMedicinalProductDefinitionNameUsageComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameUsageComponent element) throws IOException {
60689    composeBackboneElementProperties(element);
60690      if (element.hasCountry()) {
60691        composeCodeableConcept("country", element.getCountry());
60692      }
60693      if (element.hasJurisdiction()) {
60694        composeCodeableConcept("jurisdiction", element.getJurisdiction());
60695      }
60696      if (element.hasLanguage()) {
60697        composeCodeableConcept("language", element.getLanguage());
60698      }
60699  }
60700
60701  protected void composeMedicinalProductDefinitionCrossReferenceComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
60702    if (element != null) {
60703      open(name);
60704      composeMedicinalProductDefinitionCrossReferenceComponentProperties(element);
60705      close();
60706    }
60707  }
60708
60709  protected void composeMedicinalProductDefinitionCrossReferenceComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
60710    composeBackboneElementProperties(element);
60711      if (element.hasProduct()) {
60712        composeCodeableReference("product", element.getProduct());
60713      }
60714      if (element.hasType()) {
60715        composeCodeableConcept("type", element.getType());
60716      }
60717  }
60718
60719  protected void composeMedicinalProductDefinitionOperationComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent element) throws IOException {
60720    if (element != null) {
60721      open(name);
60722      composeMedicinalProductDefinitionOperationComponentProperties(element);
60723      close();
60724    }
60725  }
60726
60727  protected void composeMedicinalProductDefinitionOperationComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionOperationComponent element) throws IOException {
60728    composeBackboneElementProperties(element);
60729      if (element.hasType()) {
60730        composeCodeableReference("type", element.getType());
60731      }
60732      if (element.hasEffectiveDate()) {
60733        composePeriod("effectiveDate", element.getEffectiveDate());
60734      }
60735      if (element.hasOrganization()) {
60736        openArray("organization");
60737        for (Reference e : element.getOrganization()) 
60738          composeReference(null, e);
60739        closeArray();
60740      };
60741      if (element.hasConfidentialityIndicator()) {
60742        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
60743      }
60744  }
60745
60746  protected void composeMedicinalProductDefinitionCharacteristicComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent element) throws IOException {
60747    if (element != null) {
60748      open(name);
60749      composeMedicinalProductDefinitionCharacteristicComponentProperties(element);
60750      close();
60751    }
60752  }
60753
60754  protected void composeMedicinalProductDefinitionCharacteristicComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionCharacteristicComponent element) throws IOException {
60755    composeBackboneElementProperties(element);
60756      if (element.hasType()) {
60757        composeCodeableConcept("type", element.getType());
60758      }
60759      if (element.hasValue()) {
60760        composeType("value", element.getValue());
60761      }
60762  }
60763
60764  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
60765    if (element != null) {
60766      prop("resourceType", name);
60767      composeMessageDefinitionProperties(element);
60768    }
60769  }
60770
60771  protected void composeMessageDefinitionProperties(MessageDefinition element) throws IOException {
60772    composeCanonicalResourceProperties(element);
60773      if (element.hasUrlElement()) {
60774        composeUriCore("url", element.getUrlElement(), false);
60775        composeUriExtras("url", element.getUrlElement(), false);
60776      }
60777      if (element.hasIdentifier()) {
60778        openArray("identifier");
60779        for (Identifier e : element.getIdentifier()) 
60780          composeIdentifier(null, e);
60781        closeArray();
60782      };
60783      if (element.hasVersionElement()) {
60784        composeStringCore("version", element.getVersionElement(), false);
60785        composeStringExtras("version", element.getVersionElement(), false);
60786      }
60787      if (element.hasVersionAlgorithm()) {
60788        composeType("versionAlgorithm", element.getVersionAlgorithm());
60789      }
60790      if (element.hasNameElement()) {
60791        composeStringCore("name", element.getNameElement(), false);
60792        composeStringExtras("name", element.getNameElement(), false);
60793      }
60794      if (element.hasTitleElement()) {
60795        composeStringCore("title", element.getTitleElement(), false);
60796        composeStringExtras("title", element.getTitleElement(), false);
60797      }
60798      if (element.hasReplaces()) {
60799        if (anyHasValue(element.getReplaces())) {
60800          openArray("replaces");
60801          for (CanonicalType e : element.getReplaces()) 
60802            composeCanonicalCore(null, e, e != element.getReplaces().get(element.getReplaces().size()-1));
60803          closeArray();
60804        }
60805        if (anyHasExtras(element.getReplaces())) {
60806          openArray("_replaces");
60807          for (CanonicalType e : element.getReplaces()) 
60808            composeCanonicalExtras(null, e, true);
60809          closeArray();
60810        }
60811      };
60812      if (element.hasStatusElement()) {
60813        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
60814        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
60815      }
60816      if (element.hasExperimentalElement()) {
60817        composeBooleanCore("experimental", element.getExperimentalElement(), false);
60818        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
60819      }
60820      if (element.hasDateElement()) {
60821        composeDateTimeCore("date", element.getDateElement(), false);
60822        composeDateTimeExtras("date", element.getDateElement(), false);
60823      }
60824      if (element.hasPublisherElement()) {
60825        composeStringCore("publisher", element.getPublisherElement(), false);
60826        composeStringExtras("publisher", element.getPublisherElement(), false);
60827      }
60828      if (element.hasContact()) {
60829        openArray("contact");
60830        for (ContactDetail e : element.getContact()) 
60831          composeContactDetail(null, e);
60832        closeArray();
60833      };
60834      if (element.hasDescriptionElement()) {
60835        composeMarkdownCore("description", element.getDescriptionElement(), false);
60836        composeMarkdownExtras("description", element.getDescriptionElement(), false);
60837      }
60838      if (element.hasUseContext()) {
60839        openArray("useContext");
60840        for (UsageContext e : element.getUseContext()) 
60841          composeUsageContext(null, e);
60842        closeArray();
60843      };
60844      if (element.hasJurisdiction()) {
60845        openArray("jurisdiction");
60846        for (CodeableConcept e : element.getJurisdiction()) 
60847          composeCodeableConcept(null, e);
60848        closeArray();
60849      };
60850      if (element.hasPurposeElement()) {
60851        composeMarkdownCore("purpose", element.getPurposeElement(), false);
60852        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
60853      }
60854      if (element.hasCopyrightElement()) {
60855        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
60856        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
60857      }
60858      if (element.hasCopyrightLabelElement()) {
60859        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
60860        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
60861      }
60862      if (element.hasBaseElement()) {
60863        composeCanonicalCore("base", element.getBaseElement(), false);
60864        composeCanonicalExtras("base", element.getBaseElement(), false);
60865      }
60866      if (element.hasParent()) {
60867        if (anyHasValue(element.getParent())) {
60868          openArray("parent");
60869          for (CanonicalType e : element.getParent()) 
60870            composeCanonicalCore(null, e, e != element.getParent().get(element.getParent().size()-1));
60871          closeArray();
60872        }
60873        if (anyHasExtras(element.getParent())) {
60874          openArray("_parent");
60875          for (CanonicalType e : element.getParent()) 
60876            composeCanonicalExtras(null, e, true);
60877          closeArray();
60878        }
60879      };
60880      if (element.hasEvent()) {
60881        composeType("event", element.getEvent());
60882      }
60883      if (element.hasCategoryElement()) {
60884        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
60885        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
60886      }
60887      if (element.hasFocus()) {
60888        openArray("focus");
60889        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
60890          composeMessageDefinitionFocusComponent(null, e);
60891        closeArray();
60892      };
60893      if (element.hasResponseRequiredElement()) {
60894        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
60895        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
60896      }
60897      if (element.hasAllowedResponse()) {
60898        openArray("allowedResponse");
60899        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
60900          composeMessageDefinitionAllowedResponseComponent(null, e);
60901        closeArray();
60902      };
60903      if (element.hasGraphElement()) {
60904        composeCanonicalCore("graph", element.getGraphElement(), false);
60905        composeCanonicalExtras("graph", element.getGraphElement(), false);
60906      }
60907  }
60908
60909  protected void composeMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
60910    if (element != null) {
60911      open(name);
60912      composeMessageDefinitionFocusComponentProperties(element);
60913      close();
60914    }
60915  }
60916
60917  protected void composeMessageDefinitionFocusComponentProperties(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
60918    composeBackboneElementProperties(element);
60919      if (element.hasCodeElement()) {
60920        composeCodeCore("code", element.getCodeElement(), false);
60921        composeCodeExtras("code", element.getCodeElement(), false);
60922      }
60923      if (element.hasProfileElement()) {
60924        composeCanonicalCore("profile", element.getProfileElement(), false);
60925        composeCanonicalExtras("profile", element.getProfileElement(), false);
60926      }
60927      if (element.hasMinElement()) {
60928        composeUnsignedIntCore("min", element.getMinElement(), false);
60929        composeUnsignedIntExtras("min", element.getMinElement(), false);
60930      }
60931      if (element.hasMaxElement()) {
60932        composeStringCore("max", element.getMaxElement(), false);
60933        composeStringExtras("max", element.getMaxElement(), false);
60934      }
60935  }
60936
60937  protected void composeMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
60938    if (element != null) {
60939      open(name);
60940      composeMessageDefinitionAllowedResponseComponentProperties(element);
60941      close();
60942    }
60943  }
60944
60945  protected void composeMessageDefinitionAllowedResponseComponentProperties(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
60946    composeBackboneElementProperties(element);
60947      if (element.hasMessageElement()) {
60948        composeCanonicalCore("message", element.getMessageElement(), false);
60949        composeCanonicalExtras("message", element.getMessageElement(), false);
60950      }
60951      if (element.hasSituationElement()) {
60952        composeMarkdownCore("situation", element.getSituationElement(), false);
60953        composeMarkdownExtras("situation", element.getSituationElement(), false);
60954      }
60955  }
60956
60957  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
60958    if (element != null) {
60959      prop("resourceType", name);
60960      composeMessageHeaderProperties(element);
60961    }
60962  }
60963
60964  protected void composeMessageHeaderProperties(MessageHeader element) throws IOException {
60965    composeDomainResourceProperties(element);
60966      if (element.hasEvent()) {
60967        composeType("event", element.getEvent());
60968      }
60969      if (element.hasDestination()) {
60970        openArray("destination");
60971        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
60972          composeMessageDestinationComponent(null, e);
60973        closeArray();
60974      };
60975      if (element.hasSender()) {
60976        composeReference("sender", element.getSender());
60977      }
60978      if (element.hasAuthor()) {
60979        composeReference("author", element.getAuthor());
60980      }
60981      if (element.hasSource()) {
60982        composeMessageSourceComponent("source", element.getSource());
60983      }
60984      if (element.hasResponsible()) {
60985        composeReference("responsible", element.getResponsible());
60986      }
60987      if (element.hasReason()) {
60988        composeCodeableConcept("reason", element.getReason());
60989      }
60990      if (element.hasResponse()) {
60991        composeMessageHeaderResponseComponent("response", element.getResponse());
60992      }
60993      if (element.hasFocus()) {
60994        openArray("focus");
60995        for (Reference e : element.getFocus()) 
60996          composeReference(null, e);
60997        closeArray();
60998      };
60999      if (element.hasDefinitionElement()) {
61000        composeCanonicalCore("definition", element.getDefinitionElement(), false);
61001        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
61002      }
61003  }
61004
61005  protected void composeMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
61006    if (element != null) {
61007      open(name);
61008      composeMessageDestinationComponentProperties(element);
61009      close();
61010    }
61011  }
61012
61013  protected void composeMessageDestinationComponentProperties(MessageHeader.MessageDestinationComponent element) throws IOException {
61014    composeBackboneElementProperties(element);
61015      if (element.hasEndpoint()) {
61016        composeType("endpoint", element.getEndpoint());
61017      }
61018      if (element.hasNameElement()) {
61019        composeStringCore("name", element.getNameElement(), false);
61020        composeStringExtras("name", element.getNameElement(), false);
61021      }
61022      if (element.hasTarget()) {
61023        composeReference("target", element.getTarget());
61024      }
61025      if (element.hasReceiver()) {
61026        composeReference("receiver", element.getReceiver());
61027      }
61028  }
61029
61030  protected void composeMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
61031    if (element != null) {
61032      open(name);
61033      composeMessageSourceComponentProperties(element);
61034      close();
61035    }
61036  }
61037
61038  protected void composeMessageSourceComponentProperties(MessageHeader.MessageSourceComponent element) throws IOException {
61039    composeBackboneElementProperties(element);
61040      if (element.hasEndpoint()) {
61041        composeType("endpoint", element.getEndpoint());
61042      }
61043      if (element.hasNameElement()) {
61044        composeStringCore("name", element.getNameElement(), false);
61045        composeStringExtras("name", element.getNameElement(), false);
61046      }
61047      if (element.hasSoftwareElement()) {
61048        composeStringCore("software", element.getSoftwareElement(), false);
61049        composeStringExtras("software", element.getSoftwareElement(), false);
61050      }
61051      if (element.hasVersionElement()) {
61052        composeStringCore("version", element.getVersionElement(), false);
61053        composeStringExtras("version", element.getVersionElement(), false);
61054      }
61055      if (element.hasContact()) {
61056        composeContactPoint("contact", element.getContact());
61057      }
61058  }
61059
61060  protected void composeMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
61061    if (element != null) {
61062      open(name);
61063      composeMessageHeaderResponseComponentProperties(element);
61064      close();
61065    }
61066  }
61067
61068  protected void composeMessageHeaderResponseComponentProperties(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
61069    composeBackboneElementProperties(element);
61070      if (element.hasIdentifier()) {
61071        composeIdentifier("identifier", element.getIdentifier());
61072      }
61073      if (element.hasCodeElement()) {
61074        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
61075        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
61076      }
61077      if (element.hasDetails()) {
61078        composeReference("details", element.getDetails());
61079      }
61080  }
61081
61082  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
61083    if (element != null) {
61084      prop("resourceType", name);
61085      composeMolecularSequenceProperties(element);
61086    }
61087  }
61088
61089  protected void composeMolecularSequenceProperties(MolecularSequence element) throws IOException {
61090    composeDomainResourceProperties(element);
61091      if (element.hasIdentifier()) {
61092        openArray("identifier");
61093        for (Identifier e : element.getIdentifier()) 
61094          composeIdentifier(null, e);
61095        closeArray();
61096      };
61097      if (element.hasTypeElement()) {
61098        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
61099        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
61100      }
61101      if (element.hasSubject()) {
61102        composeReference("subject", element.getSubject());
61103      }
61104      if (element.hasFocus()) {
61105        openArray("focus");
61106        for (Reference e : element.getFocus()) 
61107          composeReference(null, e);
61108        closeArray();
61109      };
61110      if (element.hasSpecimen()) {
61111        composeReference("specimen", element.getSpecimen());
61112      }
61113      if (element.hasDevice()) {
61114        composeReference("device", element.getDevice());
61115      }
61116      if (element.hasPerformer()) {
61117        composeReference("performer", element.getPerformer());
61118      }
61119      if (element.hasLiteralElement()) {
61120        composeStringCore("literal", element.getLiteralElement(), false);
61121        composeStringExtras("literal", element.getLiteralElement(), false);
61122      }
61123      if (element.hasFormatted()) {
61124        openArray("formatted");
61125        for (Attachment e : element.getFormatted()) 
61126          composeAttachment(null, e);
61127        closeArray();
61128      };
61129      if (element.hasRelative()) {
61130        openArray("relative");
61131        for (MolecularSequence.MolecularSequenceRelativeComponent e : element.getRelative()) 
61132          composeMolecularSequenceRelativeComponent(null, e);
61133        closeArray();
61134      };
61135  }
61136
61137  protected void composeMolecularSequenceRelativeComponent(String name, MolecularSequence.MolecularSequenceRelativeComponent element) throws IOException {
61138    if (element != null) {
61139      open(name);
61140      composeMolecularSequenceRelativeComponentProperties(element);
61141      close();
61142    }
61143  }
61144
61145  protected void composeMolecularSequenceRelativeComponentProperties(MolecularSequence.MolecularSequenceRelativeComponent element) throws IOException {
61146    composeBackboneElementProperties(element);
61147      if (element.hasCoordinateSystem()) {
61148        composeCodeableConcept("coordinateSystem", element.getCoordinateSystem());
61149      }
61150      if (element.hasOrdinalPositionElement()) {
61151        composeIntegerCore("ordinalPosition", element.getOrdinalPositionElement(), false);
61152        composeIntegerExtras("ordinalPosition", element.getOrdinalPositionElement(), false);
61153      }
61154      if (element.hasSequenceRange()) {
61155        composeRange("sequenceRange", element.getSequenceRange());
61156      }
61157      if (element.hasStartingSequence()) {
61158        composeMolecularSequenceRelativeStartingSequenceComponent("startingSequence", element.getStartingSequence());
61159      }
61160      if (element.hasEdit()) {
61161        openArray("edit");
61162        for (MolecularSequence.MolecularSequenceRelativeEditComponent e : element.getEdit()) 
61163          composeMolecularSequenceRelativeEditComponent(null, e);
61164        closeArray();
61165      };
61166  }
61167
61168  protected void composeMolecularSequenceRelativeStartingSequenceComponent(String name, MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent element) throws IOException {
61169    if (element != null) {
61170      open(name);
61171      composeMolecularSequenceRelativeStartingSequenceComponentProperties(element);
61172      close();
61173    }
61174  }
61175
61176  protected void composeMolecularSequenceRelativeStartingSequenceComponentProperties(MolecularSequence.MolecularSequenceRelativeStartingSequenceComponent element) throws IOException {
61177    composeBackboneElementProperties(element);
61178      if (element.hasGenomeAssembly()) {
61179        composeCodeableConcept("genomeAssembly", element.getGenomeAssembly());
61180      }
61181      if (element.hasChromosome()) {
61182        composeCodeableConcept("chromosome", element.getChromosome());
61183      }
61184      if (element.hasSequence()) {
61185        composeType("sequence", element.getSequence());
61186      }
61187      if (element.hasWindowStartElement()) {
61188        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
61189        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
61190      }
61191      if (element.hasWindowEndElement()) {
61192        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
61193        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
61194      }
61195      if (element.hasOrientationElement()) {
61196        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
61197        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
61198      }
61199      if (element.hasStrandElement()) {
61200        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
61201        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
61202      }
61203  }
61204
61205  protected void composeMolecularSequenceRelativeEditComponent(String name, MolecularSequence.MolecularSequenceRelativeEditComponent element) throws IOException {
61206    if (element != null) {
61207      open(name);
61208      composeMolecularSequenceRelativeEditComponentProperties(element);
61209      close();
61210    }
61211  }
61212
61213  protected void composeMolecularSequenceRelativeEditComponentProperties(MolecularSequence.MolecularSequenceRelativeEditComponent element) throws IOException {
61214    composeBackboneElementProperties(element);
61215      if (element.hasStartElement()) {
61216        composeIntegerCore("start", element.getStartElement(), false);
61217        composeIntegerExtras("start", element.getStartElement(), false);
61218      }
61219      if (element.hasEndElement()) {
61220        composeIntegerCore("end", element.getEndElement(), false);
61221        composeIntegerExtras("end", element.getEndElement(), false);
61222      }
61223      if (element.hasReplacementSequenceElement()) {
61224        composeStringCore("replacementSequence", element.getReplacementSequenceElement(), false);
61225        composeStringExtras("replacementSequence", element.getReplacementSequenceElement(), false);
61226      }
61227      if (element.hasReplacedSequenceElement()) {
61228        composeStringCore("replacedSequence", element.getReplacedSequenceElement(), false);
61229        composeStringExtras("replacedSequence", element.getReplacedSequenceElement(), false);
61230      }
61231  }
61232
61233  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
61234    if (element != null) {
61235      prop("resourceType", name);
61236      composeNamingSystemProperties(element);
61237    }
61238  }
61239
61240  protected void composeNamingSystemProperties(NamingSystem element) throws IOException {
61241    composeMetadataResourceProperties(element);
61242      if (element.hasUrlElement()) {
61243        composeUriCore("url", element.getUrlElement(), false);
61244        composeUriExtras("url", element.getUrlElement(), false);
61245      }
61246      if (element.hasIdentifier()) {
61247        openArray("identifier");
61248        for (Identifier e : element.getIdentifier()) 
61249          composeIdentifier(null, e);
61250        closeArray();
61251      };
61252      if (element.hasVersionElement()) {
61253        composeStringCore("version", element.getVersionElement(), false);
61254        composeStringExtras("version", element.getVersionElement(), false);
61255      }
61256      if (element.hasVersionAlgorithm()) {
61257        composeType("versionAlgorithm", element.getVersionAlgorithm());
61258      }
61259      if (element.hasNameElement()) {
61260        composeStringCore("name", element.getNameElement(), false);
61261        composeStringExtras("name", element.getNameElement(), false);
61262      }
61263      if (element.hasTitleElement()) {
61264        composeStringCore("title", element.getTitleElement(), false);
61265        composeStringExtras("title", element.getTitleElement(), false);
61266      }
61267      if (element.hasStatusElement()) {
61268        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
61269        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
61270      }
61271      if (element.hasKindElement()) {
61272        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
61273        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
61274      }
61275      if (element.hasExperimentalElement()) {
61276        composeBooleanCore("experimental", element.getExperimentalElement(), false);
61277        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
61278      }
61279      if (element.hasDateElement()) {
61280        composeDateTimeCore("date", element.getDateElement(), false);
61281        composeDateTimeExtras("date", element.getDateElement(), false);
61282      }
61283      if (element.hasPublisherElement()) {
61284        composeStringCore("publisher", element.getPublisherElement(), false);
61285        composeStringExtras("publisher", element.getPublisherElement(), false);
61286      }
61287      if (element.hasContact()) {
61288        openArray("contact");
61289        for (ContactDetail e : element.getContact()) 
61290          composeContactDetail(null, e);
61291        closeArray();
61292      };
61293      if (element.hasResponsibleElement()) {
61294        composeStringCore("responsible", element.getResponsibleElement(), false);
61295        composeStringExtras("responsible", element.getResponsibleElement(), false);
61296      }
61297      if (element.hasType()) {
61298        composeCodeableConcept("type", element.getType());
61299      }
61300      if (element.hasDescriptionElement()) {
61301        composeMarkdownCore("description", element.getDescriptionElement(), false);
61302        composeMarkdownExtras("description", element.getDescriptionElement(), false);
61303      }
61304      if (element.hasUseContext()) {
61305        openArray("useContext");
61306        for (UsageContext e : element.getUseContext()) 
61307          composeUsageContext(null, e);
61308        closeArray();
61309      };
61310      if (element.hasJurisdiction()) {
61311        openArray("jurisdiction");
61312        for (CodeableConcept e : element.getJurisdiction()) 
61313          composeCodeableConcept(null, e);
61314        closeArray();
61315      };
61316      if (element.hasPurposeElement()) {
61317        composeMarkdownCore("purpose", element.getPurposeElement(), false);
61318        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
61319      }
61320      if (element.hasCopyrightElement()) {
61321        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
61322        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
61323      }
61324      if (element.hasCopyrightLabelElement()) {
61325        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
61326        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
61327      }
61328      if (element.hasApprovalDateElement()) {
61329        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
61330        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
61331      }
61332      if (element.hasLastReviewDateElement()) {
61333        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
61334        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
61335      }
61336      if (element.hasEffectivePeriod()) {
61337        composePeriod("effectivePeriod", element.getEffectivePeriod());
61338      }
61339      if (element.hasTopic()) {
61340        openArray("topic");
61341        for (CodeableConcept e : element.getTopic()) 
61342          composeCodeableConcept(null, e);
61343        closeArray();
61344      };
61345      if (element.hasAuthor()) {
61346        openArray("author");
61347        for (ContactDetail e : element.getAuthor()) 
61348          composeContactDetail(null, e);
61349        closeArray();
61350      };
61351      if (element.hasEditor()) {
61352        openArray("editor");
61353        for (ContactDetail e : element.getEditor()) 
61354          composeContactDetail(null, e);
61355        closeArray();
61356      };
61357      if (element.hasReviewer()) {
61358        openArray("reviewer");
61359        for (ContactDetail e : element.getReviewer()) 
61360          composeContactDetail(null, e);
61361        closeArray();
61362      };
61363      if (element.hasEndorser()) {
61364        openArray("endorser");
61365        for (ContactDetail e : element.getEndorser()) 
61366          composeContactDetail(null, e);
61367        closeArray();
61368      };
61369      if (element.hasRelatedArtifact()) {
61370        openArray("relatedArtifact");
61371        for (RelatedArtifact e : element.getRelatedArtifact()) 
61372          composeRelatedArtifact(null, e);
61373        closeArray();
61374      };
61375      if (element.hasUsageElement()) {
61376        composeStringCore("usage", element.getUsageElement(), false);
61377        composeStringExtras("usage", element.getUsageElement(), false);
61378      }
61379      if (element.hasUniqueId()) {
61380        openArray("uniqueId");
61381        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
61382          composeNamingSystemUniqueIdComponent(null, e);
61383        closeArray();
61384      };
61385  }
61386
61387  protected void composeNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
61388    if (element != null) {
61389      open(name);
61390      composeNamingSystemUniqueIdComponentProperties(element);
61391      close();
61392    }
61393  }
61394
61395  protected void composeNamingSystemUniqueIdComponentProperties(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
61396    composeBackboneElementProperties(element);
61397      if (element.hasTypeElement()) {
61398        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
61399        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
61400      }
61401      if (element.hasValueElement()) {
61402        composeStringCore("value", element.getValueElement(), false);
61403        composeStringExtras("value", element.getValueElement(), false);
61404      }
61405      if (element.hasPreferredElement()) {
61406        composeBooleanCore("preferred", element.getPreferredElement(), false);
61407        composeBooleanExtras("preferred", element.getPreferredElement(), false);
61408      }
61409      if (element.hasCommentElement()) {
61410        composeStringCore("comment", element.getCommentElement(), false);
61411        composeStringExtras("comment", element.getCommentElement(), false);
61412      }
61413      if (element.hasPeriod()) {
61414        composePeriod("period", element.getPeriod());
61415      }
61416      if (element.hasAuthoritativeElement()) {
61417        composeBooleanCore("authoritative", element.getAuthoritativeElement(), false);
61418        composeBooleanExtras("authoritative", element.getAuthoritativeElement(), false);
61419      }
61420  }
61421
61422  protected void composeNutritionIntake(String name, NutritionIntake element) throws IOException {
61423    if (element != null) {
61424      prop("resourceType", name);
61425      composeNutritionIntakeProperties(element);
61426    }
61427  }
61428
61429  protected void composeNutritionIntakeProperties(NutritionIntake element) throws IOException {
61430    composeDomainResourceProperties(element);
61431      if (element.hasIdentifier()) {
61432        openArray("identifier");
61433        for (Identifier e : element.getIdentifier()) 
61434          composeIdentifier(null, e);
61435        closeArray();
61436      };
61437      if (element.hasInstantiatesCanonical()) {
61438        if (anyHasValue(element.getInstantiatesCanonical())) {
61439          openArray("instantiatesCanonical");
61440          for (CanonicalType e : element.getInstantiatesCanonical()) 
61441            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
61442          closeArray();
61443        }
61444        if (anyHasExtras(element.getInstantiatesCanonical())) {
61445          openArray("_instantiatesCanonical");
61446          for (CanonicalType e : element.getInstantiatesCanonical()) 
61447            composeCanonicalExtras(null, e, true);
61448          closeArray();
61449        }
61450      };
61451      if (element.hasInstantiatesUri()) {
61452        if (anyHasValue(element.getInstantiatesUri())) {
61453          openArray("instantiatesUri");
61454          for (UriType e : element.getInstantiatesUri()) 
61455            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
61456          closeArray();
61457        }
61458        if (anyHasExtras(element.getInstantiatesUri())) {
61459          openArray("_instantiatesUri");
61460          for (UriType e : element.getInstantiatesUri()) 
61461            composeUriExtras(null, e, true);
61462          closeArray();
61463        }
61464      };
61465      if (element.hasBasedOn()) {
61466        openArray("basedOn");
61467        for (Reference e : element.getBasedOn()) 
61468          composeReference(null, e);
61469        closeArray();
61470      };
61471      if (element.hasPartOf()) {
61472        openArray("partOf");
61473        for (Reference e : element.getPartOf()) 
61474          composeReference(null, e);
61475        closeArray();
61476      };
61477      if (element.hasStatusElement()) {
61478        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
61479        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
61480      }
61481      if (element.hasStatusReason()) {
61482        openArray("statusReason");
61483        for (CodeableConcept e : element.getStatusReason()) 
61484          composeCodeableConcept(null, e);
61485        closeArray();
61486      };
61487      if (element.hasCode()) {
61488        composeCodeableConcept("code", element.getCode());
61489      }
61490      if (element.hasSubject()) {
61491        composeReference("subject", element.getSubject());
61492      }
61493      if (element.hasEncounter()) {
61494        composeReference("encounter", element.getEncounter());
61495      }
61496      if (element.hasOccurrence()) {
61497        composeType("occurrence", element.getOccurrence());
61498      }
61499      if (element.hasRecordedElement()) {
61500        composeDateTimeCore("recorded", element.getRecordedElement(), false);
61501        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
61502      }
61503      if (element.hasReported()) {
61504        composeType("reported", element.getReported());
61505      }
61506      if (element.hasConsumedItem()) {
61507        openArray("consumedItem");
61508        for (NutritionIntake.NutritionIntakeConsumedItemComponent e : element.getConsumedItem()) 
61509          composeNutritionIntakeConsumedItemComponent(null, e);
61510        closeArray();
61511      };
61512      if (element.hasIngredientLabel()) {
61513        openArray("ingredientLabel");
61514        for (NutritionIntake.NutritionIntakeIngredientLabelComponent e : element.getIngredientLabel()) 
61515          composeNutritionIntakeIngredientLabelComponent(null, e);
61516        closeArray();
61517      };
61518      if (element.hasPerformer()) {
61519        openArray("performer");
61520        for (NutritionIntake.NutritionIntakePerformerComponent e : element.getPerformer()) 
61521          composeNutritionIntakePerformerComponent(null, e);
61522        closeArray();
61523      };
61524      if (element.hasLocation()) {
61525        composeReference("location", element.getLocation());
61526      }
61527      if (element.hasDerivedFrom()) {
61528        openArray("derivedFrom");
61529        for (Reference e : element.getDerivedFrom()) 
61530          composeReference(null, e);
61531        closeArray();
61532      };
61533      if (element.hasReason()) {
61534        openArray("reason");
61535        for (CodeableReference e : element.getReason()) 
61536          composeCodeableReference(null, e);
61537        closeArray();
61538      };
61539      if (element.hasNote()) {
61540        openArray("note");
61541        for (Annotation e : element.getNote()) 
61542          composeAnnotation(null, e);
61543        closeArray();
61544      };
61545  }
61546
61547  protected void composeNutritionIntakeConsumedItemComponent(String name, NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
61548    if (element != null) {
61549      open(name);
61550      composeNutritionIntakeConsumedItemComponentProperties(element);
61551      close();
61552    }
61553  }
61554
61555  protected void composeNutritionIntakeConsumedItemComponentProperties(NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
61556    composeBackboneElementProperties(element);
61557      if (element.hasType()) {
61558        composeCodeableConcept("type", element.getType());
61559      }
61560      if (element.hasNutritionProduct()) {
61561        composeCodeableReference("nutritionProduct", element.getNutritionProduct());
61562      }
61563      if (element.hasSchedule()) {
61564        composeTiming("schedule", element.getSchedule());
61565      }
61566      if (element.hasAmount()) {
61567        composeQuantity("amount", element.getAmount());
61568      }
61569      if (element.hasRate()) {
61570        composeQuantity("rate", element.getRate());
61571      }
61572      if (element.hasNotConsumedElement()) {
61573        composeBooleanCore("notConsumed", element.getNotConsumedElement(), false);
61574        composeBooleanExtras("notConsumed", element.getNotConsumedElement(), false);
61575      }
61576      if (element.hasNotConsumedReason()) {
61577        composeCodeableConcept("notConsumedReason", element.getNotConsumedReason());
61578      }
61579  }
61580
61581  protected void composeNutritionIntakeIngredientLabelComponent(String name, NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
61582    if (element != null) {
61583      open(name);
61584      composeNutritionIntakeIngredientLabelComponentProperties(element);
61585      close();
61586    }
61587  }
61588
61589  protected void composeNutritionIntakeIngredientLabelComponentProperties(NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
61590    composeBackboneElementProperties(element);
61591      if (element.hasNutrient()) {
61592        composeCodeableReference("nutrient", element.getNutrient());
61593      }
61594      if (element.hasAmount()) {
61595        composeQuantity("amount", element.getAmount());
61596      }
61597  }
61598
61599  protected void composeNutritionIntakePerformerComponent(String name, NutritionIntake.NutritionIntakePerformerComponent element) throws IOException {
61600    if (element != null) {
61601      open(name);
61602      composeNutritionIntakePerformerComponentProperties(element);
61603      close();
61604    }
61605  }
61606
61607  protected void composeNutritionIntakePerformerComponentProperties(NutritionIntake.NutritionIntakePerformerComponent element) throws IOException {
61608    composeBackboneElementProperties(element);
61609      if (element.hasFunction()) {
61610        composeCodeableConcept("function", element.getFunction());
61611      }
61612      if (element.hasActor()) {
61613        composeReference("actor", element.getActor());
61614      }
61615  }
61616
61617  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
61618    if (element != null) {
61619      prop("resourceType", name);
61620      composeNutritionOrderProperties(element);
61621    }
61622  }
61623
61624  protected void composeNutritionOrderProperties(NutritionOrder element) throws IOException {
61625    composeDomainResourceProperties(element);
61626      if (element.hasIdentifier()) {
61627        openArray("identifier");
61628        for (Identifier e : element.getIdentifier()) 
61629          composeIdentifier(null, e);
61630        closeArray();
61631      };
61632      if (element.hasInstantiatesCanonical()) {
61633        if (anyHasValue(element.getInstantiatesCanonical())) {
61634          openArray("instantiatesCanonical");
61635          for (CanonicalType e : element.getInstantiatesCanonical()) 
61636            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
61637          closeArray();
61638        }
61639        if (anyHasExtras(element.getInstantiatesCanonical())) {
61640          openArray("_instantiatesCanonical");
61641          for (CanonicalType e : element.getInstantiatesCanonical()) 
61642            composeCanonicalExtras(null, e, true);
61643          closeArray();
61644        }
61645      };
61646      if (element.hasInstantiatesUri()) {
61647        if (anyHasValue(element.getInstantiatesUri())) {
61648          openArray("instantiatesUri");
61649          for (UriType e : element.getInstantiatesUri()) 
61650            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
61651          closeArray();
61652        }
61653        if (anyHasExtras(element.getInstantiatesUri())) {
61654          openArray("_instantiatesUri");
61655          for (UriType e : element.getInstantiatesUri()) 
61656            composeUriExtras(null, e, true);
61657          closeArray();
61658        }
61659      };
61660      if (element.hasInstantiates()) {
61661        if (anyHasValue(element.getInstantiates())) {
61662          openArray("instantiates");
61663          for (UriType e : element.getInstantiates()) 
61664            composeUriCore(null, e, e != element.getInstantiates().get(element.getInstantiates().size()-1));
61665          closeArray();
61666        }
61667        if (anyHasExtras(element.getInstantiates())) {
61668          openArray("_instantiates");
61669          for (UriType e : element.getInstantiates()) 
61670            composeUriExtras(null, e, true);
61671          closeArray();
61672        }
61673      };
61674      if (element.hasBasedOn()) {
61675        openArray("basedOn");
61676        for (Reference e : element.getBasedOn()) 
61677          composeReference(null, e);
61678        closeArray();
61679      };
61680      if (element.hasGroupIdentifier()) {
61681        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
61682      }
61683      if (element.hasStatusElement()) {
61684        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
61685        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
61686      }
61687      if (element.hasIntentElement()) {
61688        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
61689        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
61690      }
61691      if (element.hasPriorityElement()) {
61692        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
61693        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
61694      }
61695      if (element.hasSubject()) {
61696        composeReference("subject", element.getSubject());
61697      }
61698      if (element.hasEncounter()) {
61699        composeReference("encounter", element.getEncounter());
61700      }
61701      if (element.hasSupportingInformation()) {
61702        openArray("supportingInformation");
61703        for (Reference e : element.getSupportingInformation()) 
61704          composeReference(null, e);
61705        closeArray();
61706      };
61707      if (element.hasDateTimeElement()) {
61708        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
61709        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
61710      }
61711      if (element.hasOrderer()) {
61712        composeReference("orderer", element.getOrderer());
61713      }
61714      if (element.hasPerformer()) {
61715        openArray("performer");
61716        for (CodeableReference e : element.getPerformer()) 
61717          composeCodeableReference(null, e);
61718        closeArray();
61719      };
61720      if (element.hasAllergyIntolerance()) {
61721        openArray("allergyIntolerance");
61722        for (Reference e : element.getAllergyIntolerance()) 
61723          composeReference(null, e);
61724        closeArray();
61725      };
61726      if (element.hasFoodPreferenceModifier()) {
61727        openArray("foodPreferenceModifier");
61728        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
61729          composeCodeableConcept(null, e);
61730        closeArray();
61731      };
61732      if (element.hasExcludeFoodModifier()) {
61733        openArray("excludeFoodModifier");
61734        for (CodeableConcept e : element.getExcludeFoodModifier()) 
61735          composeCodeableConcept(null, e);
61736        closeArray();
61737      };
61738      if (element.hasOutsideFoodAllowedElement()) {
61739        composeBooleanCore("outsideFoodAllowed", element.getOutsideFoodAllowedElement(), false);
61740        composeBooleanExtras("outsideFoodAllowed", element.getOutsideFoodAllowedElement(), false);
61741      }
61742      if (element.hasOralDiet()) {
61743        composeNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
61744      }
61745      if (element.hasSupplement()) {
61746        openArray("supplement");
61747        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
61748          composeNutritionOrderSupplementComponent(null, e);
61749        closeArray();
61750      };
61751      if (element.hasEnteralFormula()) {
61752        composeNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
61753      }
61754      if (element.hasNote()) {
61755        openArray("note");
61756        for (Annotation e : element.getNote()) 
61757          composeAnnotation(null, e);
61758        closeArray();
61759      };
61760  }
61761
61762  protected void composeNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
61763    if (element != null) {
61764      open(name);
61765      composeNutritionOrderOralDietComponentProperties(element);
61766      close();
61767    }
61768  }
61769
61770  protected void composeNutritionOrderOralDietComponentProperties(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
61771    composeBackboneElementProperties(element);
61772      if (element.hasType()) {
61773        openArray("type");
61774        for (CodeableConcept e : element.getType()) 
61775          composeCodeableConcept(null, e);
61776        closeArray();
61777      };
61778      if (element.hasSchedule()) {
61779        composeOralDietScheduleComponent("schedule", element.getSchedule());
61780      }
61781      if (element.hasNutrient()) {
61782        openArray("nutrient");
61783        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
61784          composeNutritionOrderOralDietNutrientComponent(null, e);
61785        closeArray();
61786      };
61787      if (element.hasTexture()) {
61788        openArray("texture");
61789        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
61790          composeNutritionOrderOralDietTextureComponent(null, e);
61791        closeArray();
61792      };
61793      if (element.hasFluidConsistencyType()) {
61794        openArray("fluidConsistencyType");
61795        for (CodeableConcept e : element.getFluidConsistencyType()) 
61796          composeCodeableConcept(null, e);
61797        closeArray();
61798      };
61799      if (element.hasInstructionElement()) {
61800        composeStringCore("instruction", element.getInstructionElement(), false);
61801        composeStringExtras("instruction", element.getInstructionElement(), false);
61802      }
61803  }
61804
61805  protected void composeOralDietScheduleComponent(String name, NutritionOrder.OralDietScheduleComponent element) throws IOException {
61806    if (element != null) {
61807      open(name);
61808      composeOralDietScheduleComponentProperties(element);
61809      close();
61810    }
61811  }
61812
61813  protected void composeOralDietScheduleComponentProperties(NutritionOrder.OralDietScheduleComponent element) throws IOException {
61814    composeBackboneElementProperties(element);
61815      if (element.hasTiming()) {
61816        openArray("timing");
61817        for (Timing e : element.getTiming()) 
61818          composeTiming(null, e);
61819        closeArray();
61820      };
61821      if (element.hasAsNeededElement()) {
61822        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
61823        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
61824      }
61825      if (element.hasAsNeededFor()) {
61826        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
61827      }
61828  }
61829
61830  protected void composeNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
61831    if (element != null) {
61832      open(name);
61833      composeNutritionOrderOralDietNutrientComponentProperties(element);
61834      close();
61835    }
61836  }
61837
61838  protected void composeNutritionOrderOralDietNutrientComponentProperties(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
61839    composeBackboneElementProperties(element);
61840      if (element.hasModifier()) {
61841        composeCodeableConcept("modifier", element.getModifier());
61842      }
61843      if (element.hasAmount()) {
61844        composeQuantity("amount", element.getAmount());
61845      }
61846  }
61847
61848  protected void composeNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
61849    if (element != null) {
61850      open(name);
61851      composeNutritionOrderOralDietTextureComponentProperties(element);
61852      close();
61853    }
61854  }
61855
61856  protected void composeNutritionOrderOralDietTextureComponentProperties(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
61857    composeBackboneElementProperties(element);
61858      if (element.hasModifier()) {
61859        composeCodeableConcept("modifier", element.getModifier());
61860      }
61861      if (element.hasFoodType()) {
61862        composeCodeableConcept("foodType", element.getFoodType());
61863      }
61864  }
61865
61866  protected void composeNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
61867    if (element != null) {
61868      open(name);
61869      composeNutritionOrderSupplementComponentProperties(element);
61870      close();
61871    }
61872  }
61873
61874  protected void composeNutritionOrderSupplementComponentProperties(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
61875    composeBackboneElementProperties(element);
61876      if (element.hasType()) {
61877        composeCodeableReference("type", element.getType());
61878      }
61879      if (element.hasProductNameElement()) {
61880        composeStringCore("productName", element.getProductNameElement(), false);
61881        composeStringExtras("productName", element.getProductNameElement(), false);
61882      }
61883      if (element.hasSchedule()) {
61884        composeSupplementScheduleComponent("schedule", element.getSchedule());
61885      }
61886      if (element.hasQuantity()) {
61887        composeQuantity("quantity", element.getQuantity());
61888      }
61889      if (element.hasInstructionElement()) {
61890        composeStringCore("instruction", element.getInstructionElement(), false);
61891        composeStringExtras("instruction", element.getInstructionElement(), false);
61892      }
61893  }
61894
61895  protected void composeSupplementScheduleComponent(String name, NutritionOrder.SupplementScheduleComponent element) throws IOException {
61896    if (element != null) {
61897      open(name);
61898      composeSupplementScheduleComponentProperties(element);
61899      close();
61900    }
61901  }
61902
61903  protected void composeSupplementScheduleComponentProperties(NutritionOrder.SupplementScheduleComponent element) throws IOException {
61904    composeBackboneElementProperties(element);
61905      if (element.hasTiming()) {
61906        openArray("timing");
61907        for (Timing e : element.getTiming()) 
61908          composeTiming(null, e);
61909        closeArray();
61910      };
61911      if (element.hasAsNeededElement()) {
61912        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
61913        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
61914      }
61915      if (element.hasAsNeededFor()) {
61916        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
61917      }
61918  }
61919
61920  protected void composeNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
61921    if (element != null) {
61922      open(name);
61923      composeNutritionOrderEnteralFormulaComponentProperties(element);
61924      close();
61925    }
61926  }
61927
61928  protected void composeNutritionOrderEnteralFormulaComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
61929    composeBackboneElementProperties(element);
61930      if (element.hasBaseFormulaType()) {
61931        composeCodeableReference("baseFormulaType", element.getBaseFormulaType());
61932      }
61933      if (element.hasBaseFormulaProductNameElement()) {
61934        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
61935        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
61936      }
61937      if (element.hasDeliveryDevice()) {
61938        openArray("deliveryDevice");
61939        for (CodeableReference e : element.getDeliveryDevice()) 
61940          composeCodeableReference(null, e);
61941        closeArray();
61942      };
61943      if (element.hasAdditive()) {
61944        openArray("additive");
61945        for (NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent e : element.getAdditive()) 
61946          composeNutritionOrderEnteralFormulaAdditiveComponent(null, e);
61947        closeArray();
61948      };
61949      if (element.hasCaloricDensity()) {
61950        composeQuantity("caloricDensity", element.getCaloricDensity());
61951      }
61952      if (element.hasRouteOfAdministration()) {
61953        composeCodeableConcept("routeOfAdministration", element.getRouteOfAdministration());
61954      }
61955      if (element.hasAdministration()) {
61956        openArray("administration");
61957        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
61958          composeNutritionOrderEnteralFormulaAdministrationComponent(null, e);
61959        closeArray();
61960      };
61961      if (element.hasMaxVolumeToDeliver()) {
61962        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
61963      }
61964      if (element.hasAdministrationInstructionElement()) {
61965        composeMarkdownCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
61966        composeMarkdownExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
61967      }
61968  }
61969
61970  protected void composeNutritionOrderEnteralFormulaAdditiveComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent element) throws IOException {
61971    if (element != null) {
61972      open(name);
61973      composeNutritionOrderEnteralFormulaAdditiveComponentProperties(element);
61974      close();
61975    }
61976  }
61977
61978  protected void composeNutritionOrderEnteralFormulaAdditiveComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaAdditiveComponent element) throws IOException {
61979    composeBackboneElementProperties(element);
61980      if (element.hasType()) {
61981        composeCodeableReference("type", element.getType());
61982      }
61983      if (element.hasProductNameElement()) {
61984        composeStringCore("productName", element.getProductNameElement(), false);
61985        composeStringExtras("productName", element.getProductNameElement(), false);
61986      }
61987      if (element.hasQuantity()) {
61988        composeQuantity("quantity", element.getQuantity());
61989      }
61990  }
61991
61992  protected void composeNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
61993    if (element != null) {
61994      open(name);
61995      composeNutritionOrderEnteralFormulaAdministrationComponentProperties(element);
61996      close();
61997    }
61998  }
61999
62000  protected void composeNutritionOrderEnteralFormulaAdministrationComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
62001    composeBackboneElementProperties(element);
62002      if (element.hasSchedule()) {
62003        composeEnteralFormulaScheduleComponent("schedule", element.getSchedule());
62004      }
62005      if (element.hasQuantity()) {
62006        composeQuantity("quantity", element.getQuantity());
62007      }
62008      if (element.hasRate()) {
62009        composeType("rate", element.getRate());
62010      }
62011  }
62012
62013  protected void composeEnteralFormulaScheduleComponent(String name, NutritionOrder.EnteralFormulaScheduleComponent element) throws IOException {
62014    if (element != null) {
62015      open(name);
62016      composeEnteralFormulaScheduleComponentProperties(element);
62017      close();
62018    }
62019  }
62020
62021  protected void composeEnteralFormulaScheduleComponentProperties(NutritionOrder.EnteralFormulaScheduleComponent element) throws IOException {
62022    composeBackboneElementProperties(element);
62023      if (element.hasTiming()) {
62024        openArray("timing");
62025        for (Timing e : element.getTiming()) 
62026          composeTiming(null, e);
62027        closeArray();
62028      };
62029      if (element.hasAsNeededElement()) {
62030        composeBooleanCore("asNeeded", element.getAsNeededElement(), false);
62031        composeBooleanExtras("asNeeded", element.getAsNeededElement(), false);
62032      }
62033      if (element.hasAsNeededFor()) {
62034        composeCodeableConcept("asNeededFor", element.getAsNeededFor());
62035      }
62036  }
62037
62038  protected void composeNutritionProduct(String name, NutritionProduct element) throws IOException {
62039    if (element != null) {
62040      prop("resourceType", name);
62041      composeNutritionProductProperties(element);
62042    }
62043  }
62044
62045  protected void composeNutritionProductProperties(NutritionProduct element) throws IOException {
62046    composeDomainResourceProperties(element);
62047      if (element.hasCode()) {
62048        composeCodeableConcept("code", element.getCode());
62049      }
62050      if (element.hasStatusElement()) {
62051        composeEnumerationCore("status", element.getStatusElement(), new NutritionProduct.NutritionProductStatusEnumFactory(), false);
62052        composeEnumerationExtras("status", element.getStatusElement(), new NutritionProduct.NutritionProductStatusEnumFactory(), false);
62053      }
62054      if (element.hasCategory()) {
62055        openArray("category");
62056        for (CodeableConcept e : element.getCategory()) 
62057          composeCodeableConcept(null, e);
62058        closeArray();
62059      };
62060      if (element.hasManufacturer()) {
62061        openArray("manufacturer");
62062        for (Reference e : element.getManufacturer()) 
62063          composeReference(null, e);
62064        closeArray();
62065      };
62066      if (element.hasNutrient()) {
62067        openArray("nutrient");
62068        for (NutritionProduct.NutritionProductNutrientComponent e : element.getNutrient()) 
62069          composeNutritionProductNutrientComponent(null, e);
62070        closeArray();
62071      };
62072      if (element.hasIngredient()) {
62073        openArray("ingredient");
62074        for (NutritionProduct.NutritionProductIngredientComponent e : element.getIngredient()) 
62075          composeNutritionProductIngredientComponent(null, e);
62076        closeArray();
62077      };
62078      if (element.hasKnownAllergen()) {
62079        openArray("knownAllergen");
62080        for (CodeableReference e : element.getKnownAllergen()) 
62081          composeCodeableReference(null, e);
62082        closeArray();
62083      };
62084      if (element.hasCharacteristic()) {
62085        openArray("characteristic");
62086        for (NutritionProduct.NutritionProductCharacteristicComponent e : element.getCharacteristic()) 
62087          composeNutritionProductCharacteristicComponent(null, e);
62088        closeArray();
62089      };
62090      if (element.hasInstance()) {
62091        openArray("instance");
62092        for (NutritionProduct.NutritionProductInstanceComponent e : element.getInstance()) 
62093          composeNutritionProductInstanceComponent(null, e);
62094        closeArray();
62095      };
62096      if (element.hasNote()) {
62097        openArray("note");
62098        for (Annotation e : element.getNote()) 
62099          composeAnnotation(null, e);
62100        closeArray();
62101      };
62102  }
62103
62104  protected void composeNutritionProductNutrientComponent(String name, NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
62105    if (element != null) {
62106      open(name);
62107      composeNutritionProductNutrientComponentProperties(element);
62108      close();
62109    }
62110  }
62111
62112  protected void composeNutritionProductNutrientComponentProperties(NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
62113    composeBackboneElementProperties(element);
62114      if (element.hasItem()) {
62115        composeCodeableReference("item", element.getItem());
62116      }
62117      if (element.hasAmount()) {
62118        openArray("amount");
62119        for (Ratio e : element.getAmount()) 
62120          composeRatio(null, e);
62121        closeArray();
62122      };
62123  }
62124
62125  protected void composeNutritionProductIngredientComponent(String name, NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
62126    if (element != null) {
62127      open(name);
62128      composeNutritionProductIngredientComponentProperties(element);
62129      close();
62130    }
62131  }
62132
62133  protected void composeNutritionProductIngredientComponentProperties(NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
62134    composeBackboneElementProperties(element);
62135      if (element.hasItem()) {
62136        composeCodeableReference("item", element.getItem());
62137      }
62138      if (element.hasAmount()) {
62139        openArray("amount");
62140        for (Ratio e : element.getAmount()) 
62141          composeRatio(null, e);
62142        closeArray();
62143      };
62144  }
62145
62146  protected void composeNutritionProductCharacteristicComponent(String name, NutritionProduct.NutritionProductCharacteristicComponent element) throws IOException {
62147    if (element != null) {
62148      open(name);
62149      composeNutritionProductCharacteristicComponentProperties(element);
62150      close();
62151    }
62152  }
62153
62154  protected void composeNutritionProductCharacteristicComponentProperties(NutritionProduct.NutritionProductCharacteristicComponent element) throws IOException {
62155    composeBackboneElementProperties(element);
62156      if (element.hasType()) {
62157        composeCodeableConcept("type", element.getType());
62158      }
62159      if (element.hasValue()) {
62160        composeType("value", element.getValue());
62161      }
62162  }
62163
62164  protected void composeNutritionProductInstanceComponent(String name, NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
62165    if (element != null) {
62166      open(name);
62167      composeNutritionProductInstanceComponentProperties(element);
62168      close();
62169    }
62170  }
62171
62172  protected void composeNutritionProductInstanceComponentProperties(NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
62173    composeBackboneElementProperties(element);
62174      if (element.hasQuantity()) {
62175        composeQuantity("quantity", element.getQuantity());
62176      }
62177      if (element.hasIdentifier()) {
62178        openArray("identifier");
62179        for (Identifier e : element.getIdentifier()) 
62180          composeIdentifier(null, e);
62181        closeArray();
62182      };
62183      if (element.hasNameElement()) {
62184        composeStringCore("name", element.getNameElement(), false);
62185        composeStringExtras("name", element.getNameElement(), false);
62186      }
62187      if (element.hasLotNumberElement()) {
62188        composeStringCore("lotNumber", element.getLotNumberElement(), false);
62189        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
62190      }
62191      if (element.hasExpiryElement()) {
62192        composeDateTimeCore("expiry", element.getExpiryElement(), false);
62193        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
62194      }
62195      if (element.hasUseByElement()) {
62196        composeDateTimeCore("useBy", element.getUseByElement(), false);
62197        composeDateTimeExtras("useBy", element.getUseByElement(), false);
62198      }
62199      if (element.hasBiologicalSourceEvent()) {
62200        composeIdentifier("biologicalSourceEvent", element.getBiologicalSourceEvent());
62201      }
62202  }
62203
62204  protected void composeObservation(String name, Observation element) throws IOException {
62205    if (element != null) {
62206      prop("resourceType", name);
62207      composeObservationProperties(element);
62208    }
62209  }
62210
62211  protected void composeObservationProperties(Observation element) throws IOException {
62212    composeDomainResourceProperties(element);
62213      if (element.hasIdentifier()) {
62214        openArray("identifier");
62215        for (Identifier e : element.getIdentifier()) 
62216          composeIdentifier(null, e);
62217        closeArray();
62218      };
62219      if (element.hasInstantiates()) {
62220        composeType("instantiates", element.getInstantiates());
62221      }
62222      if (element.hasBasedOn()) {
62223        openArray("basedOn");
62224        for (Reference e : element.getBasedOn()) 
62225          composeReference(null, e);
62226        closeArray();
62227      };
62228      if (element.hasTriggeredBy()) {
62229        openArray("triggeredBy");
62230        for (Observation.ObservationTriggeredByComponent e : element.getTriggeredBy()) 
62231          composeObservationTriggeredByComponent(null, e);
62232        closeArray();
62233      };
62234      if (element.hasPartOf()) {
62235        openArray("partOf");
62236        for (Reference e : element.getPartOf()) 
62237          composeReference(null, e);
62238        closeArray();
62239      };
62240      if (element.hasStatusElement()) {
62241        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
62242        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
62243      }
62244      if (element.hasCategory()) {
62245        openArray("category");
62246        for (CodeableConcept e : element.getCategory()) 
62247          composeCodeableConcept(null, e);
62248        closeArray();
62249      };
62250      if (element.hasCode()) {
62251        composeCodeableConcept("code", element.getCode());
62252      }
62253      if (element.hasSubject()) {
62254        composeReference("subject", element.getSubject());
62255      }
62256      if (element.hasFocus()) {
62257        openArray("focus");
62258        for (Reference e : element.getFocus()) 
62259          composeReference(null, e);
62260        closeArray();
62261      };
62262      if (element.hasEncounter()) {
62263        composeReference("encounter", element.getEncounter());
62264      }
62265      if (element.hasEffective()) {
62266        composeType("effective", element.getEffective());
62267      }
62268      if (element.hasIssuedElement()) {
62269        composeInstantCore("issued", element.getIssuedElement(), false);
62270        composeInstantExtras("issued", element.getIssuedElement(), false);
62271      }
62272      if (element.hasPerformer()) {
62273        openArray("performer");
62274        for (Reference e : element.getPerformer()) 
62275          composeReference(null, e);
62276        closeArray();
62277      };
62278      if (element.hasValue()) {
62279        composeType("value", element.getValue());
62280      }
62281      if (element.hasDataAbsentReason()) {
62282        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
62283      }
62284      if (element.hasInterpretation()) {
62285        openArray("interpretation");
62286        for (CodeableConcept e : element.getInterpretation()) 
62287          composeCodeableConcept(null, e);
62288        closeArray();
62289      };
62290      if (element.hasNote()) {
62291        openArray("note");
62292        for (Annotation e : element.getNote()) 
62293          composeAnnotation(null, e);
62294        closeArray();
62295      };
62296      if (element.hasBodySite()) {
62297        composeCodeableConcept("bodySite", element.getBodySite());
62298      }
62299      if (element.hasBodyStructure()) {
62300        composeReference("bodyStructure", element.getBodyStructure());
62301      }
62302      if (element.hasMethod()) {
62303        composeCodeableConcept("method", element.getMethod());
62304      }
62305      if (element.hasSpecimen()) {
62306        composeReference("specimen", element.getSpecimen());
62307      }
62308      if (element.hasDevice()) {
62309        composeReference("device", element.getDevice());
62310      }
62311      if (element.hasReferenceRange()) {
62312        openArray("referenceRange");
62313        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
62314          composeObservationReferenceRangeComponent(null, e);
62315        closeArray();
62316      };
62317      if (element.hasHasMember()) {
62318        openArray("hasMember");
62319        for (Reference e : element.getHasMember()) 
62320          composeReference(null, e);
62321        closeArray();
62322      };
62323      if (element.hasDerivedFrom()) {
62324        openArray("derivedFrom");
62325        for (Reference e : element.getDerivedFrom()) 
62326          composeReference(null, e);
62327        closeArray();
62328      };
62329      if (element.hasComponent()) {
62330        openArray("component");
62331        for (Observation.ObservationComponentComponent e : element.getComponent()) 
62332          composeObservationComponentComponent(null, e);
62333        closeArray();
62334      };
62335  }
62336
62337  protected void composeObservationTriggeredByComponent(String name, Observation.ObservationTriggeredByComponent element) throws IOException {
62338    if (element != null) {
62339      open(name);
62340      composeObservationTriggeredByComponentProperties(element);
62341      close();
62342    }
62343  }
62344
62345  protected void composeObservationTriggeredByComponentProperties(Observation.ObservationTriggeredByComponent element) throws IOException {
62346    composeBackboneElementProperties(element);
62347      if (element.hasObservation()) {
62348        composeReference("observation", element.getObservation());
62349      }
62350      if (element.hasTypeElement()) {
62351        composeEnumerationCore("type", element.getTypeElement(), new Observation.TriggeredBytypeEnumFactory(), false);
62352        composeEnumerationExtras("type", element.getTypeElement(), new Observation.TriggeredBytypeEnumFactory(), false);
62353      }
62354      if (element.hasReasonElement()) {
62355        composeStringCore("reason", element.getReasonElement(), false);
62356        composeStringExtras("reason", element.getReasonElement(), false);
62357      }
62358  }
62359
62360  protected void composeObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
62361    if (element != null) {
62362      open(name);
62363      composeObservationReferenceRangeComponentProperties(element);
62364      close();
62365    }
62366  }
62367
62368  protected void composeObservationReferenceRangeComponentProperties(Observation.ObservationReferenceRangeComponent element) throws IOException {
62369    composeBackboneElementProperties(element);
62370      if (element.hasLow()) {
62371        composeQuantity("low", element.getLow());
62372      }
62373      if (element.hasHigh()) {
62374        composeQuantity("high", element.getHigh());
62375      }
62376      if (element.hasNormalValue()) {
62377        composeCodeableConcept("normalValue", element.getNormalValue());
62378      }
62379      if (element.hasType()) {
62380        composeCodeableConcept("type", element.getType());
62381      }
62382      if (element.hasAppliesTo()) {
62383        openArray("appliesTo");
62384        for (CodeableConcept e : element.getAppliesTo()) 
62385          composeCodeableConcept(null, e);
62386        closeArray();
62387      };
62388      if (element.hasAge()) {
62389        composeRange("age", element.getAge());
62390      }
62391      if (element.hasTextElement()) {
62392        composeMarkdownCore("text", element.getTextElement(), false);
62393        composeMarkdownExtras("text", element.getTextElement(), false);
62394      }
62395  }
62396
62397  protected void composeObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
62398    if (element != null) {
62399      open(name);
62400      composeObservationComponentComponentProperties(element);
62401      close();
62402    }
62403  }
62404
62405  protected void composeObservationComponentComponentProperties(Observation.ObservationComponentComponent element) throws IOException {
62406    composeBackboneElementProperties(element);
62407      if (element.hasCode()) {
62408        composeCodeableConcept("code", element.getCode());
62409      }
62410      if (element.hasValue()) {
62411        composeType("value", element.getValue());
62412      }
62413      if (element.hasDataAbsentReason()) {
62414        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
62415      }
62416      if (element.hasInterpretation()) {
62417        openArray("interpretation");
62418        for (CodeableConcept e : element.getInterpretation()) 
62419          composeCodeableConcept(null, e);
62420        closeArray();
62421      };
62422      if (element.hasReferenceRange()) {
62423        openArray("referenceRange");
62424        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
62425          composeObservationReferenceRangeComponent(null, e);
62426        closeArray();
62427      };
62428  }
62429
62430  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
62431    if (element != null) {
62432      prop("resourceType", name);
62433      composeObservationDefinitionProperties(element);
62434    }
62435  }
62436
62437  protected void composeObservationDefinitionProperties(ObservationDefinition element) throws IOException {
62438    composeDomainResourceProperties(element);
62439      if (element.hasUrlElement()) {
62440        composeUriCore("url", element.getUrlElement(), false);
62441        composeUriExtras("url", element.getUrlElement(), false);
62442      }
62443      if (element.hasIdentifier()) {
62444        composeIdentifier("identifier", element.getIdentifier());
62445      }
62446      if (element.hasVersionElement()) {
62447        composeStringCore("version", element.getVersionElement(), false);
62448        composeStringExtras("version", element.getVersionElement(), false);
62449      }
62450      if (element.hasVersionAlgorithm()) {
62451        composeType("versionAlgorithm", element.getVersionAlgorithm());
62452      }
62453      if (element.hasNameElement()) {
62454        composeStringCore("name", element.getNameElement(), false);
62455        composeStringExtras("name", element.getNameElement(), false);
62456      }
62457      if (element.hasTitleElement()) {
62458        composeStringCore("title", element.getTitleElement(), false);
62459        composeStringExtras("title", element.getTitleElement(), false);
62460      }
62461      if (element.hasStatusElement()) {
62462        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62463        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62464      }
62465      if (element.hasExperimentalElement()) {
62466        composeBooleanCore("experimental", element.getExperimentalElement(), false);
62467        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
62468      }
62469      if (element.hasDateElement()) {
62470        composeDateTimeCore("date", element.getDateElement(), false);
62471        composeDateTimeExtras("date", element.getDateElement(), false);
62472      }
62473      if (element.hasPublisherElement()) {
62474        composeStringCore("publisher", element.getPublisherElement(), false);
62475        composeStringExtras("publisher", element.getPublisherElement(), false);
62476      }
62477      if (element.hasContact()) {
62478        openArray("contact");
62479        for (ContactDetail e : element.getContact()) 
62480          composeContactDetail(null, e);
62481        closeArray();
62482      };
62483      if (element.hasDescriptionElement()) {
62484        composeMarkdownCore("description", element.getDescriptionElement(), false);
62485        composeMarkdownExtras("description", element.getDescriptionElement(), false);
62486      }
62487      if (element.hasUseContext()) {
62488        openArray("useContext");
62489        for (UsageContext e : element.getUseContext()) 
62490          composeUsageContext(null, e);
62491        closeArray();
62492      };
62493      if (element.hasJurisdiction()) {
62494        openArray("jurisdiction");
62495        for (CodeableConcept e : element.getJurisdiction()) 
62496          composeCodeableConcept(null, e);
62497        closeArray();
62498      };
62499      if (element.hasPurposeElement()) {
62500        composeMarkdownCore("purpose", element.getPurposeElement(), false);
62501        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
62502      }
62503      if (element.hasCopyrightElement()) {
62504        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
62505        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
62506      }
62507      if (element.hasCopyrightLabelElement()) {
62508        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
62509        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
62510      }
62511      if (element.hasApprovalDateElement()) {
62512        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
62513        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
62514      }
62515      if (element.hasLastReviewDateElement()) {
62516        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
62517        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
62518      }
62519      if (element.hasEffectivePeriod()) {
62520        composePeriod("effectivePeriod", element.getEffectivePeriod());
62521      }
62522      if (element.hasDerivedFromCanonical()) {
62523        if (anyHasValue(element.getDerivedFromCanonical())) {
62524          openArray("derivedFromCanonical");
62525          for (CanonicalType e : element.getDerivedFromCanonical()) 
62526            composeCanonicalCore(null, e, e != element.getDerivedFromCanonical().get(element.getDerivedFromCanonical().size()-1));
62527          closeArray();
62528        }
62529        if (anyHasExtras(element.getDerivedFromCanonical())) {
62530          openArray("_derivedFromCanonical");
62531          for (CanonicalType e : element.getDerivedFromCanonical()) 
62532            composeCanonicalExtras(null, e, true);
62533          closeArray();
62534        }
62535      };
62536      if (element.hasDerivedFromUri()) {
62537        if (anyHasValue(element.getDerivedFromUri())) {
62538          openArray("derivedFromUri");
62539          for (UriType e : element.getDerivedFromUri()) 
62540            composeUriCore(null, e, e != element.getDerivedFromUri().get(element.getDerivedFromUri().size()-1));
62541          closeArray();
62542        }
62543        if (anyHasExtras(element.getDerivedFromUri())) {
62544          openArray("_derivedFromUri");
62545          for (UriType e : element.getDerivedFromUri()) 
62546            composeUriExtras(null, e, true);
62547          closeArray();
62548        }
62549      };
62550      if (element.hasSubject()) {
62551        openArray("subject");
62552        for (CodeableConcept e : element.getSubject()) 
62553          composeCodeableConcept(null, e);
62554        closeArray();
62555      };
62556      if (element.hasPerformerType()) {
62557        composeCodeableConcept("performerType", element.getPerformerType());
62558      }
62559      if (element.hasCategory()) {
62560        openArray("category");
62561        for (CodeableConcept e : element.getCategory()) 
62562          composeCodeableConcept(null, e);
62563        closeArray();
62564      };
62565      if (element.hasCode()) {
62566        composeCodeableConcept("code", element.getCode());
62567      }
62568      if (element.hasPermittedDataType()) {
62569        openArray("permittedDataType");
62570        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62571          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62572        closeArray();
62573        if (anyHasExtras(element.getPermittedDataType())) {
62574          openArray("_permittedDataType");
62575          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62576            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62577          closeArray();
62578        }
62579      };
62580      if (element.hasMultipleResultsAllowedElement()) {
62581        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
62582        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
62583      }
62584      if (element.hasBodySite()) {
62585        composeCodeableConcept("bodySite", element.getBodySite());
62586      }
62587      if (element.hasMethod()) {
62588        composeCodeableConcept("method", element.getMethod());
62589      }
62590      if (element.hasSpecimen()) {
62591        openArray("specimen");
62592        for (Reference e : element.getSpecimen()) 
62593          composeReference(null, e);
62594        closeArray();
62595      };
62596      if (element.hasDevice()) {
62597        openArray("device");
62598        for (Reference e : element.getDevice()) 
62599          composeReference(null, e);
62600        closeArray();
62601      };
62602      if (element.hasPreferredReportNameElement()) {
62603        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
62604        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
62605      }
62606      if (element.hasPermittedUnit()) {
62607        openArray("permittedUnit");
62608        for (Coding e : element.getPermittedUnit()) 
62609          composeCoding(null, e);
62610        closeArray();
62611      };
62612      if (element.hasQualifiedValue()) {
62613        openArray("qualifiedValue");
62614        for (ObservationDefinition.ObservationDefinitionQualifiedValueComponent e : element.getQualifiedValue()) 
62615          composeObservationDefinitionQualifiedValueComponent(null, e);
62616        closeArray();
62617      };
62618      if (element.hasHasMember()) {
62619        openArray("hasMember");
62620        for (Reference e : element.getHasMember()) 
62621          composeReference(null, e);
62622        closeArray();
62623      };
62624      if (element.hasComponent()) {
62625        openArray("component");
62626        for (ObservationDefinition.ObservationDefinitionComponentComponent e : element.getComponent()) 
62627          composeObservationDefinitionComponentComponent(null, e);
62628        closeArray();
62629      };
62630  }
62631
62632  protected void composeObservationDefinitionQualifiedValueComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedValueComponent element) throws IOException {
62633    if (element != null) {
62634      open(name);
62635      composeObservationDefinitionQualifiedValueComponentProperties(element);
62636      close();
62637    }
62638  }
62639
62640  protected void composeObservationDefinitionQualifiedValueComponentProperties(ObservationDefinition.ObservationDefinitionQualifiedValueComponent element) throws IOException {
62641    composeBackboneElementProperties(element);
62642      if (element.hasContext()) {
62643        composeCodeableConcept("context", element.getContext());
62644      }
62645      if (element.hasAppliesTo()) {
62646        openArray("appliesTo");
62647        for (CodeableConcept e : element.getAppliesTo()) 
62648          composeCodeableConcept(null, e);
62649        closeArray();
62650      };
62651      if (element.hasGenderElement()) {
62652        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
62653        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
62654      }
62655      if (element.hasAge()) {
62656        composeRange("age", element.getAge());
62657      }
62658      if (element.hasGestationalAge()) {
62659        composeRange("gestationalAge", element.getGestationalAge());
62660      }
62661      if (element.hasConditionElement()) {
62662        composeStringCore("condition", element.getConditionElement(), false);
62663        composeStringExtras("condition", element.getConditionElement(), false);
62664      }
62665      if (element.hasRangeCategoryElement()) {
62666        composeEnumerationCore("rangeCategory", element.getRangeCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
62667        composeEnumerationExtras("rangeCategory", element.getRangeCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
62668      }
62669      if (element.hasRange()) {
62670        composeRange("range", element.getRange());
62671      }
62672      if (element.hasValidCodedValueSetElement()) {
62673        composeCanonicalCore("validCodedValueSet", element.getValidCodedValueSetElement(), false);
62674        composeCanonicalExtras("validCodedValueSet", element.getValidCodedValueSetElement(), false);
62675      }
62676      if (element.hasNormalCodedValueSetElement()) {
62677        composeCanonicalCore("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
62678        composeCanonicalExtras("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
62679      }
62680      if (element.hasAbnormalCodedValueSetElement()) {
62681        composeCanonicalCore("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
62682        composeCanonicalExtras("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
62683      }
62684      if (element.hasCriticalCodedValueSetElement()) {
62685        composeCanonicalCore("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
62686        composeCanonicalExtras("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
62687      }
62688  }
62689
62690  protected void composeObservationDefinitionComponentComponent(String name, ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
62691    if (element != null) {
62692      open(name);
62693      composeObservationDefinitionComponentComponentProperties(element);
62694      close();
62695    }
62696  }
62697
62698  protected void composeObservationDefinitionComponentComponentProperties(ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
62699    composeBackboneElementProperties(element);
62700      if (element.hasCode()) {
62701        composeCodeableConcept("code", element.getCode());
62702      }
62703      if (element.hasPermittedDataType()) {
62704        openArray("permittedDataType");
62705        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62706          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62707        closeArray();
62708        if (anyHasExtras(element.getPermittedDataType())) {
62709          openArray("_permittedDataType");
62710          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
62711            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
62712          closeArray();
62713        }
62714      };
62715      if (element.hasPermittedUnit()) {
62716        openArray("permittedUnit");
62717        for (Coding e : element.getPermittedUnit()) 
62718          composeCoding(null, e);
62719        closeArray();
62720      };
62721      if (element.hasQualifiedValue()) {
62722        openArray("qualifiedValue");
62723        for (ObservationDefinition.ObservationDefinitionQualifiedValueComponent e : element.getQualifiedValue()) 
62724          composeObservationDefinitionQualifiedValueComponent(null, e);
62725        closeArray();
62726      };
62727  }
62728
62729  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
62730    if (element != null) {
62731      prop("resourceType", name);
62732      composeOperationDefinitionProperties(element);
62733    }
62734  }
62735
62736  protected void composeOperationDefinitionProperties(OperationDefinition element) throws IOException {
62737    composeCanonicalResourceProperties(element);
62738      if (element.hasUrlElement()) {
62739        composeUriCore("url", element.getUrlElement(), false);
62740        composeUriExtras("url", element.getUrlElement(), false);
62741      }
62742      if (element.hasIdentifier()) {
62743        openArray("identifier");
62744        for (Identifier e : element.getIdentifier()) 
62745          composeIdentifier(null, e);
62746        closeArray();
62747      };
62748      if (element.hasVersionElement()) {
62749        composeStringCore("version", element.getVersionElement(), false);
62750        composeStringExtras("version", element.getVersionElement(), false);
62751      }
62752      if (element.hasVersionAlgorithm()) {
62753        composeType("versionAlgorithm", element.getVersionAlgorithm());
62754      }
62755      if (element.hasNameElement()) {
62756        composeStringCore("name", element.getNameElement(), false);
62757        composeStringExtras("name", element.getNameElement(), false);
62758      }
62759      if (element.hasTitleElement()) {
62760        composeStringCore("title", element.getTitleElement(), false);
62761        composeStringExtras("title", element.getTitleElement(), false);
62762      }
62763      if (element.hasStatusElement()) {
62764        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62765        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
62766      }
62767      if (element.hasKindElement()) {
62768        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
62769        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
62770      }
62771      if (element.hasExperimentalElement()) {
62772        composeBooleanCore("experimental", element.getExperimentalElement(), false);
62773        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
62774      }
62775      if (element.hasDateElement()) {
62776        composeDateTimeCore("date", element.getDateElement(), false);
62777        composeDateTimeExtras("date", element.getDateElement(), false);
62778      }
62779      if (element.hasPublisherElement()) {
62780        composeStringCore("publisher", element.getPublisherElement(), false);
62781        composeStringExtras("publisher", element.getPublisherElement(), false);
62782      }
62783      if (element.hasContact()) {
62784        openArray("contact");
62785        for (ContactDetail e : element.getContact()) 
62786          composeContactDetail(null, e);
62787        closeArray();
62788      };
62789      if (element.hasDescriptionElement()) {
62790        composeMarkdownCore("description", element.getDescriptionElement(), false);
62791        composeMarkdownExtras("description", element.getDescriptionElement(), false);
62792      }
62793      if (element.hasUseContext()) {
62794        openArray("useContext");
62795        for (UsageContext e : element.getUseContext()) 
62796          composeUsageContext(null, e);
62797        closeArray();
62798      };
62799      if (element.hasJurisdiction()) {
62800        openArray("jurisdiction");
62801        for (CodeableConcept e : element.getJurisdiction()) 
62802          composeCodeableConcept(null, e);
62803        closeArray();
62804      };
62805      if (element.hasPurposeElement()) {
62806        composeMarkdownCore("purpose", element.getPurposeElement(), false);
62807        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
62808      }
62809      if (element.hasCopyrightElement()) {
62810        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
62811        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
62812      }
62813      if (element.hasCopyrightLabelElement()) {
62814        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
62815        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
62816      }
62817      if (element.hasAffectsStateElement()) {
62818        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
62819        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
62820      }
62821      if (element.hasCodeElement()) {
62822        composeCodeCore("code", element.getCodeElement(), false);
62823        composeCodeExtras("code", element.getCodeElement(), false);
62824      }
62825      if (element.hasCommentElement()) {
62826        composeMarkdownCore("comment", element.getCommentElement(), false);
62827        composeMarkdownExtras("comment", element.getCommentElement(), false);
62828      }
62829      if (element.hasBaseElement()) {
62830        composeCanonicalCore("base", element.getBaseElement(), false);
62831        composeCanonicalExtras("base", element.getBaseElement(), false);
62832      }
62833      if (element.hasResource()) {
62834        openArray("resource");
62835        for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getResource()) 
62836          composeEnumerationCore(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
62837        closeArray();
62838        if (anyHasExtras(element.getResource())) {
62839          openArray("_resource");
62840          for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getResource()) 
62841            composeEnumerationExtras(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
62842          closeArray();
62843        }
62844      };
62845      if (element.hasSystemElement()) {
62846        composeBooleanCore("system", element.getSystemElement(), false);
62847        composeBooleanExtras("system", element.getSystemElement(), false);
62848      }
62849      if (element.hasTypeElement()) {
62850        composeBooleanCore("type", element.getTypeElement(), false);
62851        composeBooleanExtras("type", element.getTypeElement(), false);
62852      }
62853      if (element.hasInstanceElement()) {
62854        composeBooleanCore("instance", element.getInstanceElement(), false);
62855        composeBooleanExtras("instance", element.getInstanceElement(), false);
62856      }
62857      if (element.hasInputProfileElement()) {
62858        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
62859        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
62860      }
62861      if (element.hasOutputProfileElement()) {
62862        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
62863        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
62864      }
62865      if (element.hasParameter()) {
62866        openArray("parameter");
62867        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
62868          composeOperationDefinitionParameterComponent(null, e);
62869        closeArray();
62870      };
62871      if (element.hasOverload()) {
62872        openArray("overload");
62873        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
62874          composeOperationDefinitionOverloadComponent(null, e);
62875        closeArray();
62876      };
62877  }
62878
62879  protected void composeOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
62880    if (element != null) {
62881      open(name);
62882      composeOperationDefinitionParameterComponentProperties(element);
62883      close();
62884    }
62885  }
62886
62887  protected void composeOperationDefinitionParameterComponentProperties(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
62888    composeBackboneElementProperties(element);
62889      if (element.hasNameElement()) {
62890        composeCodeCore("name", element.getNameElement(), false);
62891        composeCodeExtras("name", element.getNameElement(), false);
62892      }
62893      if (element.hasUseElement()) {
62894        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
62895        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
62896      }
62897      if (element.hasScope()) {
62898        openArray("scope");
62899        for (Enumeration<OperationDefinition.OperationParameterScope> e : element.getScope()) 
62900          composeEnumerationCore(null, e, new OperationDefinition.OperationParameterScopeEnumFactory(), true);
62901        closeArray();
62902        if (anyHasExtras(element.getScope())) {
62903          openArray("_scope");
62904          for (Enumeration<OperationDefinition.OperationParameterScope> e : element.getScope()) 
62905            composeEnumerationExtras(null, e, new OperationDefinition.OperationParameterScopeEnumFactory(), true);
62906          closeArray();
62907        }
62908      };
62909      if (element.hasMinElement()) {
62910        composeIntegerCore("min", element.getMinElement(), false);
62911        composeIntegerExtras("min", element.getMinElement(), false);
62912      }
62913      if (element.hasMaxElement()) {
62914        composeStringCore("max", element.getMaxElement(), false);
62915        composeStringExtras("max", element.getMaxElement(), false);
62916      }
62917      if (element.hasDocumentationElement()) {
62918        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
62919        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
62920      }
62921      if (element.hasTypeElement()) {
62922        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
62923        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRTypesEnumFactory(), false);
62924      }
62925      if (element.hasAllowedType()) {
62926        openArray("allowedType");
62927        for (Enumeration<Enumerations.FHIRTypes> e : element.getAllowedType()) 
62928          composeEnumerationCore(null, e, new Enumerations.FHIRTypesEnumFactory(), true);
62929        closeArray();
62930        if (anyHasExtras(element.getAllowedType())) {
62931          openArray("_allowedType");
62932          for (Enumeration<Enumerations.FHIRTypes> e : element.getAllowedType()) 
62933            composeEnumerationExtras(null, e, new Enumerations.FHIRTypesEnumFactory(), true);
62934          closeArray();
62935        }
62936      };
62937      if (element.hasTargetProfile()) {
62938        if (anyHasValue(element.getTargetProfile())) {
62939          openArray("targetProfile");
62940          for (CanonicalType e : element.getTargetProfile()) 
62941            composeCanonicalCore(null, e, e != element.getTargetProfile().get(element.getTargetProfile().size()-1));
62942          closeArray();
62943        }
62944        if (anyHasExtras(element.getTargetProfile())) {
62945          openArray("_targetProfile");
62946          for (CanonicalType e : element.getTargetProfile()) 
62947            composeCanonicalExtras(null, e, true);
62948          closeArray();
62949        }
62950      };
62951      if (element.hasSearchTypeElement()) {
62952        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
62953        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
62954      }
62955      if (element.hasBinding()) {
62956        composeOperationDefinitionParameterBindingComponent("binding", element.getBinding());
62957      }
62958      if (element.hasReferencedFrom()) {
62959        openArray("referencedFrom");
62960        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
62961          composeOperationDefinitionParameterReferencedFromComponent(null, e);
62962        closeArray();
62963      };
62964      if (element.hasPart()) {
62965        openArray("part");
62966        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
62967          composeOperationDefinitionParameterComponent(null, e);
62968        closeArray();
62969      };
62970  }
62971
62972  protected void composeOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
62973    if (element != null) {
62974      open(name);
62975      composeOperationDefinitionParameterBindingComponentProperties(element);
62976      close();
62977    }
62978  }
62979
62980  protected void composeOperationDefinitionParameterBindingComponentProperties(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
62981    composeBackboneElementProperties(element);
62982      if (element.hasStrengthElement()) {
62983        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
62984        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
62985      }
62986      if (element.hasValueSetElement()) {
62987        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
62988        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
62989      }
62990  }
62991
62992  protected void composeOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
62993    if (element != null) {
62994      open(name);
62995      composeOperationDefinitionParameterReferencedFromComponentProperties(element);
62996      close();
62997    }
62998  }
62999
63000  protected void composeOperationDefinitionParameterReferencedFromComponentProperties(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
63001    composeBackboneElementProperties(element);
63002      if (element.hasSourceElement()) {
63003        composeStringCore("source", element.getSourceElement(), false);
63004        composeStringExtras("source", element.getSourceElement(), false);
63005      }
63006      if (element.hasSourceIdElement()) {
63007        composeStringCore("sourceId", element.getSourceIdElement(), false);
63008        composeStringExtras("sourceId", element.getSourceIdElement(), false);
63009      }
63010  }
63011
63012  protected void composeOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
63013    if (element != null) {
63014      open(name);
63015      composeOperationDefinitionOverloadComponentProperties(element);
63016      close();
63017    }
63018  }
63019
63020  protected void composeOperationDefinitionOverloadComponentProperties(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
63021    composeBackboneElementProperties(element);
63022      if (element.hasParameterName()) {
63023        if (anyHasValue(element.getParameterName())) {
63024          openArray("parameterName");
63025          for (StringType e : element.getParameterName()) 
63026            composeStringCore(null, e, e != element.getParameterName().get(element.getParameterName().size()-1));
63027          closeArray();
63028        }
63029        if (anyHasExtras(element.getParameterName())) {
63030          openArray("_parameterName");
63031          for (StringType e : element.getParameterName()) 
63032            composeStringExtras(null, e, true);
63033          closeArray();
63034        }
63035      };
63036      if (element.hasCommentElement()) {
63037        composeStringCore("comment", element.getCommentElement(), false);
63038        composeStringExtras("comment", element.getCommentElement(), false);
63039      }
63040  }
63041
63042  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
63043    if (element != null) {
63044      prop("resourceType", name);
63045      composeOperationOutcomeProperties(element);
63046    }
63047  }
63048
63049  protected void composeOperationOutcomeProperties(OperationOutcome element) throws IOException {
63050    composeDomainResourceProperties(element);
63051      if (element.hasIssue()) {
63052        openArray("issue");
63053        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
63054          composeOperationOutcomeIssueComponent(null, e);
63055        closeArray();
63056      };
63057  }
63058
63059  protected void composeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
63060    if (element != null) {
63061      open(name);
63062      composeOperationOutcomeIssueComponentProperties(element);
63063      close();
63064    }
63065  }
63066
63067  protected void composeOperationOutcomeIssueComponentProperties(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
63068    composeBackboneElementProperties(element);
63069      if (element.hasSeverityElement()) {
63070        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
63071        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
63072      }
63073      if (element.hasCodeElement()) {
63074        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
63075        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
63076      }
63077      if (element.hasDetails()) {
63078        composeCodeableConcept("details", element.getDetails());
63079      }
63080      if (element.hasDiagnosticsElement()) {
63081        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
63082        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
63083      }
63084      if (element.hasLocation()) {
63085        if (anyHasValue(element.getLocation())) {
63086          openArray("location");
63087          for (StringType e : element.getLocation()) 
63088            composeStringCore(null, e, e != element.getLocation().get(element.getLocation().size()-1));
63089          closeArray();
63090        }
63091        if (anyHasExtras(element.getLocation())) {
63092          openArray("_location");
63093          for (StringType e : element.getLocation()) 
63094            composeStringExtras(null, e, true);
63095          closeArray();
63096        }
63097      };
63098      if (element.hasExpression()) {
63099        if (anyHasValue(element.getExpression())) {
63100          openArray("expression");
63101          for (StringType e : element.getExpression()) 
63102            composeStringCore(null, e, e != element.getExpression().get(element.getExpression().size()-1));
63103          closeArray();
63104        }
63105        if (anyHasExtras(element.getExpression())) {
63106          openArray("_expression");
63107          for (StringType e : element.getExpression()) 
63108            composeStringExtras(null, e, true);
63109          closeArray();
63110        }
63111      };
63112  }
63113
63114  protected void composeOrganization(String name, Organization element) throws IOException {
63115    if (element != null) {
63116      prop("resourceType", name);
63117      composeOrganizationProperties(element);
63118    }
63119  }
63120
63121  protected void composeOrganizationProperties(Organization element) throws IOException {
63122    composeDomainResourceProperties(element);
63123      if (element.hasIdentifier()) {
63124        openArray("identifier");
63125        for (Identifier e : element.getIdentifier()) 
63126          composeIdentifier(null, e);
63127        closeArray();
63128      };
63129      if (element.hasActiveElement()) {
63130        composeBooleanCore("active", element.getActiveElement(), false);
63131        composeBooleanExtras("active", element.getActiveElement(), false);
63132      }
63133      if (element.hasType()) {
63134        openArray("type");
63135        for (CodeableConcept e : element.getType()) 
63136          composeCodeableConcept(null, e);
63137        closeArray();
63138      };
63139      if (element.hasNameElement()) {
63140        composeStringCore("name", element.getNameElement(), false);
63141        composeStringExtras("name", element.getNameElement(), false);
63142      }
63143      if (element.hasAlias()) {
63144        if (anyHasValue(element.getAlias())) {
63145          openArray("alias");
63146          for (StringType e : element.getAlias()) 
63147            composeStringCore(null, e, e != element.getAlias().get(element.getAlias().size()-1));
63148          closeArray();
63149        }
63150        if (anyHasExtras(element.getAlias())) {
63151          openArray("_alias");
63152          for (StringType e : element.getAlias()) 
63153            composeStringExtras(null, e, true);
63154          closeArray();
63155        }
63156      };
63157      if (element.hasDescriptionElement()) {
63158        composeMarkdownCore("description", element.getDescriptionElement(), false);
63159        composeMarkdownExtras("description", element.getDescriptionElement(), false);
63160      }
63161      if (element.hasContact()) {
63162        openArray("contact");
63163        for (ExtendedContactDetail e : element.getContact()) 
63164          composeExtendedContactDetail(null, e);
63165        closeArray();
63166      };
63167      if (element.hasPartOf()) {
63168        composeReference("partOf", element.getPartOf());
63169      }
63170      if (element.hasEndpoint()) {
63171        openArray("endpoint");
63172        for (Reference e : element.getEndpoint()) 
63173          composeReference(null, e);
63174        closeArray();
63175      };
63176      if (element.hasQualification()) {
63177        openArray("qualification");
63178        for (Organization.OrganizationQualificationComponent e : element.getQualification()) 
63179          composeOrganizationQualificationComponent(null, e);
63180        closeArray();
63181      };
63182  }
63183
63184  protected void composeOrganizationQualificationComponent(String name, Organization.OrganizationQualificationComponent element) throws IOException {
63185    if (element != null) {
63186      open(name);
63187      composeOrganizationQualificationComponentProperties(element);
63188      close();
63189    }
63190  }
63191
63192  protected void composeOrganizationQualificationComponentProperties(Organization.OrganizationQualificationComponent element) throws IOException {
63193    composeBackboneElementProperties(element);
63194      if (element.hasIdentifier()) {
63195        openArray("identifier");
63196        for (Identifier e : element.getIdentifier()) 
63197          composeIdentifier(null, e);
63198        closeArray();
63199      };
63200      if (element.hasCode()) {
63201        composeCodeableConcept("code", element.getCode());
63202      }
63203      if (element.hasPeriod()) {
63204        composePeriod("period", element.getPeriod());
63205      }
63206      if (element.hasIssuer()) {
63207        composeReference("issuer", element.getIssuer());
63208      }
63209  }
63210
63211  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
63212    if (element != null) {
63213      prop("resourceType", name);
63214      composeOrganizationAffiliationProperties(element);
63215    }
63216  }
63217
63218  protected void composeOrganizationAffiliationProperties(OrganizationAffiliation element) throws IOException {
63219    composeDomainResourceProperties(element);
63220      if (element.hasIdentifier()) {
63221        openArray("identifier");
63222        for (Identifier e : element.getIdentifier()) 
63223          composeIdentifier(null, e);
63224        closeArray();
63225      };
63226      if (element.hasActiveElement()) {
63227        composeBooleanCore("active", element.getActiveElement(), false);
63228        composeBooleanExtras("active", element.getActiveElement(), false);
63229      }
63230      if (element.hasPeriod()) {
63231        composePeriod("period", element.getPeriod());
63232      }
63233      if (element.hasOrganization()) {
63234        composeReference("organization", element.getOrganization());
63235      }
63236      if (element.hasParticipatingOrganization()) {
63237        composeReference("participatingOrganization", element.getParticipatingOrganization());
63238      }
63239      if (element.hasNetwork()) {
63240        openArray("network");
63241        for (Reference e : element.getNetwork()) 
63242          composeReference(null, e);
63243        closeArray();
63244      };
63245      if (element.hasCode()) {
63246        openArray("code");
63247        for (CodeableConcept e : element.getCode()) 
63248          composeCodeableConcept(null, e);
63249        closeArray();
63250      };
63251      if (element.hasSpecialty()) {
63252        openArray("specialty");
63253        for (CodeableConcept e : element.getSpecialty()) 
63254          composeCodeableConcept(null, e);
63255        closeArray();
63256      };
63257      if (element.hasLocation()) {
63258        openArray("location");
63259        for (Reference e : element.getLocation()) 
63260          composeReference(null, e);
63261        closeArray();
63262      };
63263      if (element.hasHealthcareService()) {
63264        openArray("healthcareService");
63265        for (Reference e : element.getHealthcareService()) 
63266          composeReference(null, e);
63267        closeArray();
63268      };
63269      if (element.hasContact()) {
63270        openArray("contact");
63271        for (ExtendedContactDetail e : element.getContact()) 
63272          composeExtendedContactDetail(null, e);
63273        closeArray();
63274      };
63275      if (element.hasEndpoint()) {
63276        openArray("endpoint");
63277        for (Reference e : element.getEndpoint()) 
63278          composeReference(null, e);
63279        closeArray();
63280      };
63281  }
63282
63283  protected void composePackagedProductDefinition(String name, PackagedProductDefinition element) throws IOException {
63284    if (element != null) {
63285      prop("resourceType", name);
63286      composePackagedProductDefinitionProperties(element);
63287    }
63288  }
63289
63290  protected void composePackagedProductDefinitionProperties(PackagedProductDefinition element) throws IOException {
63291    composeDomainResourceProperties(element);
63292      if (element.hasIdentifier()) {
63293        openArray("identifier");
63294        for (Identifier e : element.getIdentifier()) 
63295          composeIdentifier(null, e);
63296        closeArray();
63297      };
63298      if (element.hasNameElement()) {
63299        composeStringCore("name", element.getNameElement(), false);
63300        composeStringExtras("name", element.getNameElement(), false);
63301      }
63302      if (element.hasType()) {
63303        composeCodeableConcept("type", element.getType());
63304      }
63305      if (element.hasPackageFor()) {
63306        openArray("packageFor");
63307        for (Reference e : element.getPackageFor()) 
63308          composeReference(null, e);
63309        closeArray();
63310      };
63311      if (element.hasStatus()) {
63312        composeCodeableConcept("status", element.getStatus());
63313      }
63314      if (element.hasStatusDateElement()) {
63315        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
63316        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
63317      }
63318      if (element.hasContainedItemQuantity()) {
63319        openArray("containedItemQuantity");
63320        for (Quantity e : element.getContainedItemQuantity()) 
63321          composeQuantity(null, e);
63322        closeArray();
63323      };
63324      if (element.hasDescriptionElement()) {
63325        composeMarkdownCore("description", element.getDescriptionElement(), false);
63326        composeMarkdownExtras("description", element.getDescriptionElement(), false);
63327      }
63328      if (element.hasLegalStatusOfSupply()) {
63329        openArray("legalStatusOfSupply");
63330        for (PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent e : element.getLegalStatusOfSupply()) 
63331          composePackagedProductDefinitionLegalStatusOfSupplyComponent(null, e);
63332        closeArray();
63333      };
63334      if (element.hasMarketingStatus()) {
63335        openArray("marketingStatus");
63336        for (MarketingStatus e : element.getMarketingStatus()) 
63337          composeMarketingStatus(null, e);
63338        closeArray();
63339      };
63340      if (element.hasCopackagedIndicatorElement()) {
63341        composeBooleanCore("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
63342        composeBooleanExtras("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
63343      }
63344      if (element.hasManufacturer()) {
63345        openArray("manufacturer");
63346        for (Reference e : element.getManufacturer()) 
63347          composeReference(null, e);
63348        closeArray();
63349      };
63350      if (element.hasAttachedDocument()) {
63351        openArray("attachedDocument");
63352        for (Reference e : element.getAttachedDocument()) 
63353          composeReference(null, e);
63354        closeArray();
63355      };
63356      if (element.hasPackaging()) {
63357        composePackagedProductDefinitionPackagingComponent("packaging", element.getPackaging());
63358      }
63359      if (element.hasCharacteristic()) {
63360        openArray("characteristic");
63361        for (PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent e : element.getCharacteristic()) 
63362          composePackagedProductDefinitionPackagingPropertyComponent(null, e);
63363        closeArray();
63364      };
63365  }
63366
63367  protected void composePackagedProductDefinitionLegalStatusOfSupplyComponent(String name, PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent element) throws IOException {
63368    if (element != null) {
63369      open(name);
63370      composePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(element);
63371      close();
63372    }
63373  }
63374
63375  protected void composePackagedProductDefinitionLegalStatusOfSupplyComponentProperties(PackagedProductDefinition.PackagedProductDefinitionLegalStatusOfSupplyComponent element) throws IOException {
63376    composeBackboneElementProperties(element);
63377      if (element.hasCode()) {
63378        composeCodeableConcept("code", element.getCode());
63379      }
63380      if (element.hasJurisdiction()) {
63381        composeCodeableConcept("jurisdiction", element.getJurisdiction());
63382      }
63383  }
63384
63385  protected void composePackagedProductDefinitionPackagingComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagingComponent element) throws IOException {
63386    if (element != null) {
63387      open(name);
63388      composePackagedProductDefinitionPackagingComponentProperties(element);
63389      close();
63390    }
63391  }
63392
63393  protected void composePackagedProductDefinitionPackagingComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackagingComponent element) throws IOException {
63394    composeBackboneElementProperties(element);
63395      if (element.hasIdentifier()) {
63396        openArray("identifier");
63397        for (Identifier e : element.getIdentifier()) 
63398          composeIdentifier(null, e);
63399        closeArray();
63400      };
63401      if (element.hasType()) {
63402        composeCodeableConcept("type", element.getType());
63403      }
63404      if (element.hasComponentPartElement()) {
63405        composeBooleanCore("componentPart", element.getComponentPartElement(), false);
63406        composeBooleanExtras("componentPart", element.getComponentPartElement(), false);
63407      }
63408      if (element.hasQuantityElement()) {
63409        composeIntegerCore("quantity", element.getQuantityElement(), false);
63410        composeIntegerExtras("quantity", element.getQuantityElement(), false);
63411      }
63412      if (element.hasMaterial()) {
63413        openArray("material");
63414        for (CodeableConcept e : element.getMaterial()) 
63415          composeCodeableConcept(null, e);
63416        closeArray();
63417      };
63418      if (element.hasAlternateMaterial()) {
63419        openArray("alternateMaterial");
63420        for (CodeableConcept e : element.getAlternateMaterial()) 
63421          composeCodeableConcept(null, e);
63422        closeArray();
63423      };
63424      if (element.hasShelfLifeStorage()) {
63425        openArray("shelfLifeStorage");
63426        for (ProductShelfLife e : element.getShelfLifeStorage()) 
63427          composeProductShelfLife(null, e);
63428        closeArray();
63429      };
63430      if (element.hasManufacturer()) {
63431        openArray("manufacturer");
63432        for (Reference e : element.getManufacturer()) 
63433          composeReference(null, e);
63434        closeArray();
63435      };
63436      if (element.hasProperty()) {
63437        openArray("property");
63438        for (PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent e : element.getProperty()) 
63439          composePackagedProductDefinitionPackagingPropertyComponent(null, e);
63440        closeArray();
63441      };
63442      if (element.hasContainedItem()) {
63443        openArray("containedItem");
63444        for (PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent e : element.getContainedItem()) 
63445          composePackagedProductDefinitionPackagingContainedItemComponent(null, e);
63446        closeArray();
63447      };
63448      if (element.hasPackaging()) {
63449        openArray("packaging");
63450        for (PackagedProductDefinition.PackagedProductDefinitionPackagingComponent e : element.getPackaging()) 
63451          composePackagedProductDefinitionPackagingComponent(null, e);
63452        closeArray();
63453      };
63454  }
63455
63456  protected void composePackagedProductDefinitionPackagingPropertyComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent element) throws IOException {
63457    if (element != null) {
63458      open(name);
63459      composePackagedProductDefinitionPackagingPropertyComponentProperties(element);
63460      close();
63461    }
63462  }
63463
63464  protected void composePackagedProductDefinitionPackagingPropertyComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackagingPropertyComponent element) throws IOException {
63465    composeBackboneElementProperties(element);
63466      if (element.hasType()) {
63467        composeCodeableConcept("type", element.getType());
63468      }
63469      if (element.hasValue()) {
63470        composeType("value", element.getValue());
63471      }
63472  }
63473
63474  protected void composePackagedProductDefinitionPackagingContainedItemComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent element) throws IOException {
63475    if (element != null) {
63476      open(name);
63477      composePackagedProductDefinitionPackagingContainedItemComponentProperties(element);
63478      close();
63479    }
63480  }
63481
63482  protected void composePackagedProductDefinitionPackagingContainedItemComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackagingContainedItemComponent element) throws IOException {
63483    composeBackboneElementProperties(element);
63484      if (element.hasItem()) {
63485        composeCodeableReference("item", element.getItem());
63486      }
63487      if (element.hasAmount()) {
63488        composeQuantity("amount", element.getAmount());
63489      }
63490  }
63491
63492  protected void composeParameters(String name, Parameters element) throws IOException {
63493    if (element != null) {
63494      prop("resourceType", name);
63495      composeParametersProperties(element);
63496    }
63497  }
63498
63499  protected void composeParametersProperties(Parameters element) throws IOException {
63500    composeResourceProperties(element);
63501      if (element.hasParameter()) {
63502        openArray("parameter");
63503        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
63504          composeParametersParameterComponent(null, e);
63505        closeArray();
63506      };
63507  }
63508
63509  protected void composeParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
63510    if (element != null) {
63511      open(name);
63512      composeParametersParameterComponentProperties(element);
63513      close();
63514    }
63515  }
63516
63517  protected void composeParametersParameterComponentProperties(Parameters.ParametersParameterComponent element) throws IOException {
63518    composeBackboneElementProperties(element);
63519      if (element.hasNameElement()) {
63520        composeStringCore("name", element.getNameElement(), false);
63521        composeStringExtras("name", element.getNameElement(), false);
63522      }
63523      if (element.hasValue()) {
63524        composeType("value", element.getValue());
63525      }
63526        if (element.hasResource()) {
63527          open("resource");
63528          composeResource(element.getResource());
63529          close();
63530        }
63531      if (element.hasPart()) {
63532        openArray("part");
63533        for (Parameters.ParametersParameterComponent e : element.getPart()) 
63534          composeParametersParameterComponent(null, e);
63535        closeArray();
63536      };
63537  }
63538
63539  protected void composePatient(String name, Patient element) throws IOException {
63540    if (element != null) {
63541      prop("resourceType", name);
63542      composePatientProperties(element);
63543    }
63544  }
63545
63546  protected void composePatientProperties(Patient element) throws IOException {
63547    composeDomainResourceProperties(element);
63548      if (element.hasIdentifier()) {
63549        openArray("identifier");
63550        for (Identifier e : element.getIdentifier()) 
63551          composeIdentifier(null, e);
63552        closeArray();
63553      };
63554      if (element.hasActiveElement()) {
63555        composeBooleanCore("active", element.getActiveElement(), false);
63556        composeBooleanExtras("active", element.getActiveElement(), false);
63557      }
63558      if (element.hasName()) {
63559        openArray("name");
63560        for (HumanName e : element.getName()) 
63561          composeHumanName(null, e);
63562        closeArray();
63563      };
63564      if (element.hasTelecom()) {
63565        openArray("telecom");
63566        for (ContactPoint e : element.getTelecom()) 
63567          composeContactPoint(null, e);
63568        closeArray();
63569      };
63570      if (element.hasGenderElement()) {
63571        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63572        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63573      }
63574      if (element.hasBirthDateElement()) {
63575        composeDateCore("birthDate", element.getBirthDateElement(), false);
63576        composeDateExtras("birthDate", element.getBirthDateElement(), false);
63577      }
63578      if (element.hasDeceased()) {
63579        composeType("deceased", element.getDeceased());
63580      }
63581      if (element.hasAddress()) {
63582        openArray("address");
63583        for (Address e : element.getAddress()) 
63584          composeAddress(null, e);
63585        closeArray();
63586      };
63587      if (element.hasMaritalStatus()) {
63588        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
63589      }
63590      if (element.hasMultipleBirth()) {
63591        composeType("multipleBirth", element.getMultipleBirth());
63592      }
63593      if (element.hasPhoto()) {
63594        openArray("photo");
63595        for (Attachment e : element.getPhoto()) 
63596          composeAttachment(null, e);
63597        closeArray();
63598      };
63599      if (element.hasContact()) {
63600        openArray("contact");
63601        for (Patient.ContactComponent e : element.getContact()) 
63602          composeContactComponent(null, e);
63603        closeArray();
63604      };
63605      if (element.hasCommunication()) {
63606        openArray("communication");
63607        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
63608          composePatientCommunicationComponent(null, e);
63609        closeArray();
63610      };
63611      if (element.hasGeneralPractitioner()) {
63612        openArray("generalPractitioner");
63613        for (Reference e : element.getGeneralPractitioner()) 
63614          composeReference(null, e);
63615        closeArray();
63616      };
63617      if (element.hasManagingOrganization()) {
63618        composeReference("managingOrganization", element.getManagingOrganization());
63619      }
63620      if (element.hasLink()) {
63621        openArray("link");
63622        for (Patient.PatientLinkComponent e : element.getLink()) 
63623          composePatientLinkComponent(null, e);
63624        closeArray();
63625      };
63626  }
63627
63628  protected void composeContactComponent(String name, Patient.ContactComponent element) throws IOException {
63629    if (element != null) {
63630      open(name);
63631      composeContactComponentProperties(element);
63632      close();
63633    }
63634  }
63635
63636  protected void composeContactComponentProperties(Patient.ContactComponent element) throws IOException {
63637    composeBackboneElementProperties(element);
63638      if (element.hasRelationship()) {
63639        openArray("relationship");
63640        for (CodeableConcept e : element.getRelationship()) 
63641          composeCodeableConcept(null, e);
63642        closeArray();
63643      };
63644      if (element.hasName()) {
63645        composeHumanName("name", element.getName());
63646      }
63647      if (element.hasTelecom()) {
63648        openArray("telecom");
63649        for (ContactPoint e : element.getTelecom()) 
63650          composeContactPoint(null, e);
63651        closeArray();
63652      };
63653      if (element.hasAddress()) {
63654        composeAddress("address", element.getAddress());
63655      }
63656      if (element.hasGenderElement()) {
63657        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63658        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
63659      }
63660      if (element.hasOrganization()) {
63661        composeReference("organization", element.getOrganization());
63662      }
63663      if (element.hasPeriod()) {
63664        composePeriod("period", element.getPeriod());
63665      }
63666  }
63667
63668  protected void composePatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
63669    if (element != null) {
63670      open(name);
63671      composePatientCommunicationComponentProperties(element);
63672      close();
63673    }
63674  }
63675
63676  protected void composePatientCommunicationComponentProperties(Patient.PatientCommunicationComponent element) throws IOException {
63677    composeBackboneElementProperties(element);
63678      if (element.hasLanguage()) {
63679        composeCodeableConcept("language", element.getLanguage());
63680      }
63681      if (element.hasPreferredElement()) {
63682        composeBooleanCore("preferred", element.getPreferredElement(), false);
63683        composeBooleanExtras("preferred", element.getPreferredElement(), false);
63684      }
63685  }
63686
63687  protected void composePatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
63688    if (element != null) {
63689      open(name);
63690      composePatientLinkComponentProperties(element);
63691      close();
63692    }
63693  }
63694
63695  protected void composePatientLinkComponentProperties(Patient.PatientLinkComponent element) throws IOException {
63696    composeBackboneElementProperties(element);
63697      if (element.hasOther()) {
63698        composeReference("other", element.getOther());
63699      }
63700      if (element.hasTypeElement()) {
63701        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
63702        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
63703      }
63704  }
63705
63706  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
63707    if (element != null) {
63708      prop("resourceType", name);
63709      composePaymentNoticeProperties(element);
63710    }
63711  }
63712
63713  protected void composePaymentNoticeProperties(PaymentNotice element) throws IOException {
63714    composeDomainResourceProperties(element);
63715      if (element.hasIdentifier()) {
63716        openArray("identifier");
63717        for (Identifier e : element.getIdentifier()) 
63718          composeIdentifier(null, e);
63719        closeArray();
63720      };
63721      if (element.hasStatusElement()) {
63722        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63723        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63724      }
63725      if (element.hasRequest()) {
63726        composeReference("request", element.getRequest());
63727      }
63728      if (element.hasResponse()) {
63729        composeReference("response", element.getResponse());
63730      }
63731      if (element.hasCreatedElement()) {
63732        composeDateTimeCore("created", element.getCreatedElement(), false);
63733        composeDateTimeExtras("created", element.getCreatedElement(), false);
63734      }
63735      if (element.hasReporter()) {
63736        composeReference("reporter", element.getReporter());
63737      }
63738      if (element.hasPayment()) {
63739        composeReference("payment", element.getPayment());
63740      }
63741      if (element.hasPaymentDateElement()) {
63742        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
63743        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
63744      }
63745      if (element.hasPayee()) {
63746        composeReference("payee", element.getPayee());
63747      }
63748      if (element.hasRecipient()) {
63749        composeReference("recipient", element.getRecipient());
63750      }
63751      if (element.hasAmount()) {
63752        composeMoney("amount", element.getAmount());
63753      }
63754      if (element.hasPaymentStatus()) {
63755        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
63756      }
63757  }
63758
63759  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
63760    if (element != null) {
63761      prop("resourceType", name);
63762      composePaymentReconciliationProperties(element);
63763    }
63764  }
63765
63766  protected void composePaymentReconciliationProperties(PaymentReconciliation element) throws IOException {
63767    composeDomainResourceProperties(element);
63768      if (element.hasIdentifier()) {
63769        openArray("identifier");
63770        for (Identifier e : element.getIdentifier()) 
63771          composeIdentifier(null, e);
63772        closeArray();
63773      };
63774      if (element.hasType()) {
63775        composeCodeableConcept("type", element.getType());
63776      }
63777      if (element.hasStatusElement()) {
63778        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63779        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
63780      }
63781      if (element.hasKind()) {
63782        composeCodeableConcept("kind", element.getKind());
63783      }
63784      if (element.hasPeriod()) {
63785        composePeriod("period", element.getPeriod());
63786      }
63787      if (element.hasCreatedElement()) {
63788        composeDateTimeCore("created", element.getCreatedElement(), false);
63789        composeDateTimeExtras("created", element.getCreatedElement(), false);
63790      }
63791      if (element.hasEnterer()) {
63792        composeReference("enterer", element.getEnterer());
63793      }
63794      if (element.hasIssuerType()) {
63795        composeCodeableConcept("issuerType", element.getIssuerType());
63796      }
63797      if (element.hasPaymentIssuer()) {
63798        composeReference("paymentIssuer", element.getPaymentIssuer());
63799      }
63800      if (element.hasRequest()) {
63801        composeReference("request", element.getRequest());
63802      }
63803      if (element.hasRequestor()) {
63804        composeReference("requestor", element.getRequestor());
63805      }
63806      if (element.hasOutcomeElement()) {
63807        composeEnumerationCore("outcome", element.getOutcomeElement(), new PaymentReconciliation.PaymentOutcomeEnumFactory(), false);
63808        composeEnumerationExtras("outcome", element.getOutcomeElement(), new PaymentReconciliation.PaymentOutcomeEnumFactory(), false);
63809      }
63810      if (element.hasDispositionElement()) {
63811        composeStringCore("disposition", element.getDispositionElement(), false);
63812        composeStringExtras("disposition", element.getDispositionElement(), false);
63813      }
63814      if (element.hasDateElement()) {
63815        composeDateCore("date", element.getDateElement(), false);
63816        composeDateExtras("date", element.getDateElement(), false);
63817      }
63818      if (element.hasLocation()) {
63819        composeReference("location", element.getLocation());
63820      }
63821      if (element.hasMethod()) {
63822        composeCodeableConcept("method", element.getMethod());
63823      }
63824      if (element.hasCardBrandElement()) {
63825        composeStringCore("cardBrand", element.getCardBrandElement(), false);
63826        composeStringExtras("cardBrand", element.getCardBrandElement(), false);
63827      }
63828      if (element.hasAccountNumberElement()) {
63829        composeStringCore("accountNumber", element.getAccountNumberElement(), false);
63830        composeStringExtras("accountNumber", element.getAccountNumberElement(), false);
63831      }
63832      if (element.hasExpirationDateElement()) {
63833        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
63834        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
63835      }
63836      if (element.hasProcessorElement()) {
63837        composeStringCore("processor", element.getProcessorElement(), false);
63838        composeStringExtras("processor", element.getProcessorElement(), false);
63839      }
63840      if (element.hasReferenceNumberElement()) {
63841        composeStringCore("referenceNumber", element.getReferenceNumberElement(), false);
63842        composeStringExtras("referenceNumber", element.getReferenceNumberElement(), false);
63843      }
63844      if (element.hasAuthorizationElement()) {
63845        composeStringCore("authorization", element.getAuthorizationElement(), false);
63846        composeStringExtras("authorization", element.getAuthorizationElement(), false);
63847      }
63848      if (element.hasTenderedAmount()) {
63849        composeMoney("tenderedAmount", element.getTenderedAmount());
63850      }
63851      if (element.hasReturnedAmount()) {
63852        composeMoney("returnedAmount", element.getReturnedAmount());
63853      }
63854      if (element.hasAmount()) {
63855        composeMoney("amount", element.getAmount());
63856      }
63857      if (element.hasPaymentIdentifier()) {
63858        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
63859      }
63860      if (element.hasAllocation()) {
63861        openArray("allocation");
63862        for (PaymentReconciliation.PaymentReconciliationAllocationComponent e : element.getAllocation()) 
63863          composePaymentReconciliationAllocationComponent(null, e);
63864        closeArray();
63865      };
63866      if (element.hasFormCode()) {
63867        composeCodeableConcept("formCode", element.getFormCode());
63868      }
63869      if (element.hasProcessNote()) {
63870        openArray("processNote");
63871        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
63872          composeNotesComponent(null, e);
63873        closeArray();
63874      };
63875  }
63876
63877  protected void composePaymentReconciliationAllocationComponent(String name, PaymentReconciliation.PaymentReconciliationAllocationComponent element) throws IOException {
63878    if (element != null) {
63879      open(name);
63880      composePaymentReconciliationAllocationComponentProperties(element);
63881      close();
63882    }
63883  }
63884
63885  protected void composePaymentReconciliationAllocationComponentProperties(PaymentReconciliation.PaymentReconciliationAllocationComponent element) throws IOException {
63886    composeBackboneElementProperties(element);
63887      if (element.hasIdentifier()) {
63888        composeIdentifier("identifier", element.getIdentifier());
63889      }
63890      if (element.hasPredecessor()) {
63891        composeIdentifier("predecessor", element.getPredecessor());
63892      }
63893      if (element.hasTarget()) {
63894        composeReference("target", element.getTarget());
63895      }
63896      if (element.hasTargetItem()) {
63897        composeType("targetItem", element.getTargetItem());
63898      }
63899      if (element.hasEncounter()) {
63900        composeReference("encounter", element.getEncounter());
63901      }
63902      if (element.hasAccount()) {
63903        composeReference("account", element.getAccount());
63904      }
63905      if (element.hasType()) {
63906        composeCodeableConcept("type", element.getType());
63907      }
63908      if (element.hasSubmitter()) {
63909        composeReference("submitter", element.getSubmitter());
63910      }
63911      if (element.hasResponse()) {
63912        composeReference("response", element.getResponse());
63913      }
63914      if (element.hasDateElement()) {
63915        composeDateCore("date", element.getDateElement(), false);
63916        composeDateExtras("date", element.getDateElement(), false);
63917      }
63918      if (element.hasResponsible()) {
63919        composeReference("responsible", element.getResponsible());
63920      }
63921      if (element.hasPayee()) {
63922        composeReference("payee", element.getPayee());
63923      }
63924      if (element.hasAmount()) {
63925        composeMoney("amount", element.getAmount());
63926      }
63927  }
63928
63929  protected void composeNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
63930    if (element != null) {
63931      open(name);
63932      composeNotesComponentProperties(element);
63933      close();
63934    }
63935  }
63936
63937  protected void composeNotesComponentProperties(PaymentReconciliation.NotesComponent element) throws IOException {
63938    composeBackboneElementProperties(element);
63939      if (element.hasTypeElement()) {
63940        composeEnumerationCore("type", element.getTypeElement(), new PaymentReconciliation.NoteTypeEnumFactory(), false);
63941        composeEnumerationExtras("type", element.getTypeElement(), new PaymentReconciliation.NoteTypeEnumFactory(), false);
63942      }
63943      if (element.hasTextElement()) {
63944        composeStringCore("text", element.getTextElement(), false);
63945        composeStringExtras("text", element.getTextElement(), false);
63946      }
63947  }
63948
63949  protected void composePermission(String name, Permission element) throws IOException {
63950    if (element != null) {
63951      prop("resourceType", name);
63952      composePermissionProperties(element);
63953    }
63954  }
63955
63956  protected void composePermissionProperties(Permission element) throws IOException {
63957    composeDomainResourceProperties(element);
63958      if (element.hasStatusElement()) {
63959        composeEnumerationCore("status", element.getStatusElement(), new Permission.PermissionStatusEnumFactory(), false);
63960        composeEnumerationExtras("status", element.getStatusElement(), new Permission.PermissionStatusEnumFactory(), false);
63961      }
63962      if (element.hasAsserter()) {
63963        composeReference("asserter", element.getAsserter());
63964      }
63965      if (element.hasDate()) {
63966        if (anyHasValue(element.getDate())) {
63967          openArray("date");
63968          for (DateTimeType e : element.getDate()) 
63969            composeDateTimeCore(null, e, e != element.getDate().get(element.getDate().size()-1));
63970          closeArray();
63971        }
63972        if (anyHasExtras(element.getDate())) {
63973          openArray("_date");
63974          for (DateTimeType e : element.getDate()) 
63975            composeDateTimeExtras(null, e, true);
63976          closeArray();
63977        }
63978      };
63979      if (element.hasValidity()) {
63980        composePeriod("validity", element.getValidity());
63981      }
63982      if (element.hasJustification()) {
63983        composePermissionJustificationComponent("justification", element.getJustification());
63984      }
63985      if (element.hasCombiningElement()) {
63986        composeEnumerationCore("combining", element.getCombiningElement(), new Permission.PermissionRuleCombiningEnumFactory(), false);
63987        composeEnumerationExtras("combining", element.getCombiningElement(), new Permission.PermissionRuleCombiningEnumFactory(), false);
63988      }
63989      if (element.hasRule()) {
63990        openArray("rule");
63991        for (Permission.RuleComponent e : element.getRule()) 
63992          composeRuleComponent(null, e);
63993        closeArray();
63994      };
63995  }
63996
63997  protected void composePermissionJustificationComponent(String name, Permission.PermissionJustificationComponent element) throws IOException {
63998    if (element != null) {
63999      open(name);
64000      composePermissionJustificationComponentProperties(element);
64001      close();
64002    }
64003  }
64004
64005  protected void composePermissionJustificationComponentProperties(Permission.PermissionJustificationComponent element) throws IOException {
64006    composeBackboneElementProperties(element);
64007      if (element.hasBasis()) {
64008        openArray("basis");
64009        for (CodeableConcept e : element.getBasis()) 
64010          composeCodeableConcept(null, e);
64011        closeArray();
64012      };
64013      if (element.hasEvidence()) {
64014        openArray("evidence");
64015        for (Reference e : element.getEvidence()) 
64016          composeReference(null, e);
64017        closeArray();
64018      };
64019  }
64020
64021  protected void composeRuleComponent(String name, Permission.RuleComponent element) throws IOException {
64022    if (element != null) {
64023      open(name);
64024      composeRuleComponentProperties(element);
64025      close();
64026    }
64027  }
64028
64029  protected void composeRuleComponentProperties(Permission.RuleComponent element) throws IOException {
64030    composeBackboneElementProperties(element);
64031      if (element.hasTypeElement()) {
64032        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
64033        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ConsentProvisionTypeEnumFactory(), false);
64034      }
64035      if (element.hasData()) {
64036        openArray("data");
64037        for (Permission.RuleDataComponent e : element.getData()) 
64038          composeRuleDataComponent(null, e);
64039        closeArray();
64040      };
64041      if (element.hasActivity()) {
64042        openArray("activity");
64043        for (Permission.RuleActivityComponent e : element.getActivity()) 
64044          composeRuleActivityComponent(null, e);
64045        closeArray();
64046      };
64047      if (element.hasLimit()) {
64048        openArray("limit");
64049        for (CodeableConcept e : element.getLimit()) 
64050          composeCodeableConcept(null, e);
64051        closeArray();
64052      };
64053  }
64054
64055  protected void composeRuleDataComponent(String name, Permission.RuleDataComponent element) throws IOException {
64056    if (element != null) {
64057      open(name);
64058      composeRuleDataComponentProperties(element);
64059      close();
64060    }
64061  }
64062
64063  protected void composeRuleDataComponentProperties(Permission.RuleDataComponent element) throws IOException {
64064    composeBackboneElementProperties(element);
64065      if (element.hasResource()) {
64066        openArray("resource");
64067        for (Permission.RuleDataResourceComponent e : element.getResource()) 
64068          composeRuleDataResourceComponent(null, e);
64069        closeArray();
64070      };
64071      if (element.hasSecurity()) {
64072        openArray("security");
64073        for (Coding e : element.getSecurity()) 
64074          composeCoding(null, e);
64075        closeArray();
64076      };
64077      if (element.hasPeriod()) {
64078        openArray("period");
64079        for (Period e : element.getPeriod()) 
64080          composePeriod(null, e);
64081        closeArray();
64082      };
64083      if (element.hasExpression()) {
64084        composeExpression("expression", element.getExpression());
64085      }
64086  }
64087
64088  protected void composeRuleDataResourceComponent(String name, Permission.RuleDataResourceComponent element) throws IOException {
64089    if (element != null) {
64090      open(name);
64091      composeRuleDataResourceComponentProperties(element);
64092      close();
64093    }
64094  }
64095
64096  protected void composeRuleDataResourceComponentProperties(Permission.RuleDataResourceComponent element) throws IOException {
64097    composeBackboneElementProperties(element);
64098      if (element.hasMeaningElement()) {
64099        composeEnumerationCore("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
64100        composeEnumerationExtras("meaning", element.getMeaningElement(), new Enumerations.ConsentDataMeaningEnumFactory(), false);
64101      }
64102      if (element.hasReference()) {
64103        composeReference("reference", element.getReference());
64104      }
64105  }
64106
64107  protected void composeRuleActivityComponent(String name, Permission.RuleActivityComponent element) throws IOException {
64108    if (element != null) {
64109      open(name);
64110      composeRuleActivityComponentProperties(element);
64111      close();
64112    }
64113  }
64114
64115  protected void composeRuleActivityComponentProperties(Permission.RuleActivityComponent element) throws IOException {
64116    composeBackboneElementProperties(element);
64117      if (element.hasActor()) {
64118        openArray("actor");
64119        for (Reference e : element.getActor()) 
64120          composeReference(null, e);
64121        closeArray();
64122      };
64123      if (element.hasAction()) {
64124        openArray("action");
64125        for (CodeableConcept e : element.getAction()) 
64126          composeCodeableConcept(null, e);
64127        closeArray();
64128      };
64129      if (element.hasPurpose()) {
64130        openArray("purpose");
64131        for (CodeableConcept e : element.getPurpose()) 
64132          composeCodeableConcept(null, e);
64133        closeArray();
64134      };
64135  }
64136
64137  protected void composePerson(String name, Person element) throws IOException {
64138    if (element != null) {
64139      prop("resourceType", name);
64140      composePersonProperties(element);
64141    }
64142  }
64143
64144  protected void composePersonProperties(Person element) throws IOException {
64145    composeDomainResourceProperties(element);
64146      if (element.hasIdentifier()) {
64147        openArray("identifier");
64148        for (Identifier e : element.getIdentifier()) 
64149          composeIdentifier(null, e);
64150        closeArray();
64151      };
64152      if (element.hasActiveElement()) {
64153        composeBooleanCore("active", element.getActiveElement(), false);
64154        composeBooleanExtras("active", element.getActiveElement(), false);
64155      }
64156      if (element.hasName()) {
64157        openArray("name");
64158        for (HumanName e : element.getName()) 
64159          composeHumanName(null, e);
64160        closeArray();
64161      };
64162      if (element.hasTelecom()) {
64163        openArray("telecom");
64164        for (ContactPoint e : element.getTelecom()) 
64165          composeContactPoint(null, e);
64166        closeArray();
64167      };
64168      if (element.hasGenderElement()) {
64169        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64170        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64171      }
64172      if (element.hasBirthDateElement()) {
64173        composeDateCore("birthDate", element.getBirthDateElement(), false);
64174        composeDateExtras("birthDate", element.getBirthDateElement(), false);
64175      }
64176      if (element.hasDeceased()) {
64177        composeType("deceased", element.getDeceased());
64178      }
64179      if (element.hasAddress()) {
64180        openArray("address");
64181        for (Address e : element.getAddress()) 
64182          composeAddress(null, e);
64183        closeArray();
64184      };
64185      if (element.hasMaritalStatus()) {
64186        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
64187      }
64188      if (element.hasPhoto()) {
64189        openArray("photo");
64190        for (Attachment e : element.getPhoto()) 
64191          composeAttachment(null, e);
64192        closeArray();
64193      };
64194      if (element.hasCommunication()) {
64195        openArray("communication");
64196        for (Person.PersonCommunicationComponent e : element.getCommunication()) 
64197          composePersonCommunicationComponent(null, e);
64198        closeArray();
64199      };
64200      if (element.hasManagingOrganization()) {
64201        composeReference("managingOrganization", element.getManagingOrganization());
64202      }
64203      if (element.hasLink()) {
64204        openArray("link");
64205        for (Person.PersonLinkComponent e : element.getLink()) 
64206          composePersonLinkComponent(null, e);
64207        closeArray();
64208      };
64209  }
64210
64211  protected void composePersonCommunicationComponent(String name, Person.PersonCommunicationComponent element) throws IOException {
64212    if (element != null) {
64213      open(name);
64214      composePersonCommunicationComponentProperties(element);
64215      close();
64216    }
64217  }
64218
64219  protected void composePersonCommunicationComponentProperties(Person.PersonCommunicationComponent element) throws IOException {
64220    composeBackboneElementProperties(element);
64221      if (element.hasLanguage()) {
64222        composeCodeableConcept("language", element.getLanguage());
64223      }
64224      if (element.hasPreferredElement()) {
64225        composeBooleanCore("preferred", element.getPreferredElement(), false);
64226        composeBooleanExtras("preferred", element.getPreferredElement(), false);
64227      }
64228  }
64229
64230  protected void composePersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
64231    if (element != null) {
64232      open(name);
64233      composePersonLinkComponentProperties(element);
64234      close();
64235    }
64236  }
64237
64238  protected void composePersonLinkComponentProperties(Person.PersonLinkComponent element) throws IOException {
64239    composeBackboneElementProperties(element);
64240      if (element.hasTarget()) {
64241        composeReference("target", element.getTarget());
64242      }
64243      if (element.hasAssuranceElement()) {
64244        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
64245        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
64246      }
64247  }
64248
64249  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
64250    if (element != null) {
64251      prop("resourceType", name);
64252      composePlanDefinitionProperties(element);
64253    }
64254  }
64255
64256  protected void composePlanDefinitionProperties(PlanDefinition element) throws IOException {
64257    composeMetadataResourceProperties(element);
64258      if (element.hasUrlElement()) {
64259        composeUriCore("url", element.getUrlElement(), false);
64260        composeUriExtras("url", element.getUrlElement(), false);
64261      }
64262      if (element.hasIdentifier()) {
64263        openArray("identifier");
64264        for (Identifier e : element.getIdentifier()) 
64265          composeIdentifier(null, e);
64266        closeArray();
64267      };
64268      if (element.hasVersionElement()) {
64269        composeStringCore("version", element.getVersionElement(), false);
64270        composeStringExtras("version", element.getVersionElement(), false);
64271      }
64272      if (element.hasVersionAlgorithm()) {
64273        composeType("versionAlgorithm", element.getVersionAlgorithm());
64274      }
64275      if (element.hasNameElement()) {
64276        composeStringCore("name", element.getNameElement(), false);
64277        composeStringExtras("name", element.getNameElement(), false);
64278      }
64279      if (element.hasTitleElement()) {
64280        composeStringCore("title", element.getTitleElement(), false);
64281        composeStringExtras("title", element.getTitleElement(), false);
64282      }
64283      if (element.hasSubtitleElement()) {
64284        composeStringCore("subtitle", element.getSubtitleElement(), false);
64285        composeStringExtras("subtitle", element.getSubtitleElement(), false);
64286      }
64287      if (element.hasType()) {
64288        composeCodeableConcept("type", element.getType());
64289      }
64290      if (element.hasStatusElement()) {
64291        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
64292        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
64293      }
64294      if (element.hasExperimentalElement()) {
64295        composeBooleanCore("experimental", element.getExperimentalElement(), false);
64296        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
64297      }
64298      if (element.hasSubject()) {
64299        composeType("subject", element.getSubject());
64300      }
64301      if (element.hasDateElement()) {
64302        composeDateTimeCore("date", element.getDateElement(), false);
64303        composeDateTimeExtras("date", element.getDateElement(), false);
64304      }
64305      if (element.hasPublisherElement()) {
64306        composeStringCore("publisher", element.getPublisherElement(), false);
64307        composeStringExtras("publisher", element.getPublisherElement(), false);
64308      }
64309      if (element.hasContact()) {
64310        openArray("contact");
64311        for (ContactDetail e : element.getContact()) 
64312          composeContactDetail(null, e);
64313        closeArray();
64314      };
64315      if (element.hasDescriptionElement()) {
64316        composeMarkdownCore("description", element.getDescriptionElement(), false);
64317        composeMarkdownExtras("description", element.getDescriptionElement(), false);
64318      }
64319      if (element.hasUseContext()) {
64320        openArray("useContext");
64321        for (UsageContext e : element.getUseContext()) 
64322          composeUsageContext(null, e);
64323        closeArray();
64324      };
64325      if (element.hasJurisdiction()) {
64326        openArray("jurisdiction");
64327        for (CodeableConcept e : element.getJurisdiction()) 
64328          composeCodeableConcept(null, e);
64329        closeArray();
64330      };
64331      if (element.hasPurposeElement()) {
64332        composeMarkdownCore("purpose", element.getPurposeElement(), false);
64333        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
64334      }
64335      if (element.hasUsageElement()) {
64336        composeMarkdownCore("usage", element.getUsageElement(), false);
64337        composeMarkdownExtras("usage", element.getUsageElement(), false);
64338      }
64339      if (element.hasCopyrightElement()) {
64340        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
64341        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
64342      }
64343      if (element.hasCopyrightLabelElement()) {
64344        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
64345        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
64346      }
64347      if (element.hasApprovalDateElement()) {
64348        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
64349        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
64350      }
64351      if (element.hasLastReviewDateElement()) {
64352        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
64353        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
64354      }
64355      if (element.hasEffectivePeriod()) {
64356        composePeriod("effectivePeriod", element.getEffectivePeriod());
64357      }
64358      if (element.hasTopic()) {
64359        openArray("topic");
64360        for (CodeableConcept e : element.getTopic()) 
64361          composeCodeableConcept(null, e);
64362        closeArray();
64363      };
64364      if (element.hasAuthor()) {
64365        openArray("author");
64366        for (ContactDetail e : element.getAuthor()) 
64367          composeContactDetail(null, e);
64368        closeArray();
64369      };
64370      if (element.hasEditor()) {
64371        openArray("editor");
64372        for (ContactDetail e : element.getEditor()) 
64373          composeContactDetail(null, e);
64374        closeArray();
64375      };
64376      if (element.hasReviewer()) {
64377        openArray("reviewer");
64378        for (ContactDetail e : element.getReviewer()) 
64379          composeContactDetail(null, e);
64380        closeArray();
64381      };
64382      if (element.hasEndorser()) {
64383        openArray("endorser");
64384        for (ContactDetail e : element.getEndorser()) 
64385          composeContactDetail(null, e);
64386        closeArray();
64387      };
64388      if (element.hasRelatedArtifact()) {
64389        openArray("relatedArtifact");
64390        for (RelatedArtifact e : element.getRelatedArtifact()) 
64391          composeRelatedArtifact(null, e);
64392        closeArray();
64393      };
64394      if (element.hasLibrary()) {
64395        if (anyHasValue(element.getLibrary())) {
64396          openArray("library");
64397          for (CanonicalType e : element.getLibrary()) 
64398            composeCanonicalCore(null, e, e != element.getLibrary().get(element.getLibrary().size()-1));
64399          closeArray();
64400        }
64401        if (anyHasExtras(element.getLibrary())) {
64402          openArray("_library");
64403          for (CanonicalType e : element.getLibrary()) 
64404            composeCanonicalExtras(null, e, true);
64405          closeArray();
64406        }
64407      };
64408      if (element.hasGoal()) {
64409        openArray("goal");
64410        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
64411          composePlanDefinitionGoalComponent(null, e);
64412        closeArray();
64413      };
64414      if (element.hasActor()) {
64415        openArray("actor");
64416        for (PlanDefinition.PlanDefinitionActorComponent e : element.getActor()) 
64417          composePlanDefinitionActorComponent(null, e);
64418        closeArray();
64419      };
64420      if (element.hasAction()) {
64421        openArray("action");
64422        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
64423          composePlanDefinitionActionComponent(null, e);
64424        closeArray();
64425      };
64426      if (element.hasAsNeeded()) {
64427        composeType("asNeeded", element.getAsNeeded());
64428      }
64429  }
64430
64431  protected void composePlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
64432    if (element != null) {
64433      open(name);
64434      composePlanDefinitionGoalComponentProperties(element);
64435      close();
64436    }
64437  }
64438
64439  protected void composePlanDefinitionGoalComponentProperties(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
64440    composeBackboneElementProperties(element);
64441      if (element.hasCategory()) {
64442        composeCodeableConcept("category", element.getCategory());
64443      }
64444      if (element.hasDescription()) {
64445        composeCodeableConcept("description", element.getDescription());
64446      }
64447      if (element.hasPriority()) {
64448        composeCodeableConcept("priority", element.getPriority());
64449      }
64450      if (element.hasStart()) {
64451        composeCodeableConcept("start", element.getStart());
64452      }
64453      if (element.hasAddresses()) {
64454        openArray("addresses");
64455        for (CodeableConcept e : element.getAddresses()) 
64456          composeCodeableConcept(null, e);
64457        closeArray();
64458      };
64459      if (element.hasDocumentation()) {
64460        openArray("documentation");
64461        for (RelatedArtifact e : element.getDocumentation()) 
64462          composeRelatedArtifact(null, e);
64463        closeArray();
64464      };
64465      if (element.hasTarget()) {
64466        openArray("target");
64467        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
64468          composePlanDefinitionGoalTargetComponent(null, e);
64469        closeArray();
64470      };
64471  }
64472
64473  protected void composePlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
64474    if (element != null) {
64475      open(name);
64476      composePlanDefinitionGoalTargetComponentProperties(element);
64477      close();
64478    }
64479  }
64480
64481  protected void composePlanDefinitionGoalTargetComponentProperties(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
64482    composeBackboneElementProperties(element);
64483      if (element.hasMeasure()) {
64484        composeCodeableConcept("measure", element.getMeasure());
64485      }
64486      if (element.hasDetail()) {
64487        composeType("detail", element.getDetail());
64488      }
64489      if (element.hasDue()) {
64490        composeDuration("due", element.getDue());
64491      }
64492  }
64493
64494  protected void composePlanDefinitionActorComponent(String name, PlanDefinition.PlanDefinitionActorComponent element) throws IOException {
64495    if (element != null) {
64496      open(name);
64497      composePlanDefinitionActorComponentProperties(element);
64498      close();
64499    }
64500  }
64501
64502  protected void composePlanDefinitionActorComponentProperties(PlanDefinition.PlanDefinitionActorComponent element) throws IOException {
64503    composeBackboneElementProperties(element);
64504      if (element.hasTitleElement()) {
64505        composeStringCore("title", element.getTitleElement(), false);
64506        composeStringExtras("title", element.getTitleElement(), false);
64507      }
64508      if (element.hasDescriptionElement()) {
64509        composeMarkdownCore("description", element.getDescriptionElement(), false);
64510        composeMarkdownExtras("description", element.getDescriptionElement(), false);
64511      }
64512      if (element.hasOption()) {
64513        openArray("option");
64514        for (PlanDefinition.PlanDefinitionActorOptionComponent e : element.getOption()) 
64515          composePlanDefinitionActorOptionComponent(null, e);
64516        closeArray();
64517      };
64518  }
64519
64520  protected void composePlanDefinitionActorOptionComponent(String name, PlanDefinition.PlanDefinitionActorOptionComponent element) throws IOException {
64521    if (element != null) {
64522      open(name);
64523      composePlanDefinitionActorOptionComponentProperties(element);
64524      close();
64525    }
64526  }
64527
64528  protected void composePlanDefinitionActorOptionComponentProperties(PlanDefinition.PlanDefinitionActorOptionComponent element) throws IOException {
64529    composeBackboneElementProperties(element);
64530      if (element.hasTypeElement()) {
64531        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64532        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64533      }
64534      if (element.hasTypeCanonicalElement()) {
64535        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
64536        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
64537      }
64538      if (element.hasTypeReference()) {
64539        composeReference("typeReference", element.getTypeReference());
64540      }
64541      if (element.hasRole()) {
64542        composeCodeableConcept("role", element.getRole());
64543      }
64544  }
64545
64546  protected void composePlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
64547    if (element != null) {
64548      open(name);
64549      composePlanDefinitionActionComponentProperties(element);
64550      close();
64551    }
64552  }
64553
64554  protected void composePlanDefinitionActionComponentProperties(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
64555    composeBackboneElementProperties(element);
64556      if (element.hasLinkIdElement()) {
64557        composeStringCore("linkId", element.getLinkIdElement(), false);
64558        composeStringExtras("linkId", element.getLinkIdElement(), false);
64559      }
64560      if (element.hasPrefixElement()) {
64561        composeStringCore("prefix", element.getPrefixElement(), false);
64562        composeStringExtras("prefix", element.getPrefixElement(), false);
64563      }
64564      if (element.hasTitleElement()) {
64565        composeStringCore("title", element.getTitleElement(), false);
64566        composeStringExtras("title", element.getTitleElement(), false);
64567      }
64568      if (element.hasDescriptionElement()) {
64569        composeMarkdownCore("description", element.getDescriptionElement(), false);
64570        composeMarkdownExtras("description", element.getDescriptionElement(), false);
64571      }
64572      if (element.hasTextEquivalentElement()) {
64573        composeMarkdownCore("textEquivalent", element.getTextEquivalentElement(), false);
64574        composeMarkdownExtras("textEquivalent", element.getTextEquivalentElement(), false);
64575      }
64576      if (element.hasPriorityElement()) {
64577        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
64578        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
64579      }
64580      if (element.hasCode()) {
64581        composeCodeableConcept("code", element.getCode());
64582      }
64583      if (element.hasReason()) {
64584        openArray("reason");
64585        for (CodeableConcept e : element.getReason()) 
64586          composeCodeableConcept(null, e);
64587        closeArray();
64588      };
64589      if (element.hasDocumentation()) {
64590        openArray("documentation");
64591        for (RelatedArtifact e : element.getDocumentation()) 
64592          composeRelatedArtifact(null, e);
64593        closeArray();
64594      };
64595      if (element.hasGoalId()) {
64596        if (anyHasValue(element.getGoalId())) {
64597          openArray("goalId");
64598          for (IdType e : element.getGoalId()) 
64599            composeIdCore(null, e, e != element.getGoalId().get(element.getGoalId().size()-1));
64600          closeArray();
64601        }
64602        if (anyHasExtras(element.getGoalId())) {
64603          openArray("_goalId");
64604          for (IdType e : element.getGoalId()) 
64605            composeIdExtras(null, e, true);
64606          closeArray();
64607        }
64608      };
64609      if (element.hasSubject()) {
64610        composeType("subject", element.getSubject());
64611      }
64612      if (element.hasTrigger()) {
64613        openArray("trigger");
64614        for (TriggerDefinition e : element.getTrigger()) 
64615          composeTriggerDefinition(null, e);
64616        closeArray();
64617      };
64618      if (element.hasCondition()) {
64619        openArray("condition");
64620        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
64621          composePlanDefinitionActionConditionComponent(null, e);
64622        closeArray();
64623      };
64624      if (element.hasInput()) {
64625        openArray("input");
64626        for (PlanDefinition.PlanDefinitionActionInputComponent e : element.getInput()) 
64627          composePlanDefinitionActionInputComponent(null, e);
64628        closeArray();
64629      };
64630      if (element.hasOutput()) {
64631        openArray("output");
64632        for (PlanDefinition.PlanDefinitionActionOutputComponent e : element.getOutput()) 
64633          composePlanDefinitionActionOutputComponent(null, e);
64634        closeArray();
64635      };
64636      if (element.hasRelatedAction()) {
64637        openArray("relatedAction");
64638        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
64639          composePlanDefinitionActionRelatedActionComponent(null, e);
64640        closeArray();
64641      };
64642      if (element.hasTiming()) {
64643        composeType("timing", element.getTiming());
64644      }
64645      if (element.hasLocation()) {
64646        composeCodeableReference("location", element.getLocation());
64647      }
64648      if (element.hasParticipant()) {
64649        openArray("participant");
64650        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
64651          composePlanDefinitionActionParticipantComponent(null, e);
64652        closeArray();
64653      };
64654      if (element.hasType()) {
64655        composeCodeableConcept("type", element.getType());
64656      }
64657      if (element.hasGroupingBehaviorElement()) {
64658        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
64659        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
64660      }
64661      if (element.hasSelectionBehaviorElement()) {
64662        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
64663        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
64664      }
64665      if (element.hasRequiredBehaviorElement()) {
64666        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
64667        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
64668      }
64669      if (element.hasPrecheckBehaviorElement()) {
64670        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
64671        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
64672      }
64673      if (element.hasCardinalityBehaviorElement()) {
64674        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
64675        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
64676      }
64677      if (element.hasDefinition()) {
64678        composeType("definition", element.getDefinition());
64679      }
64680      if (element.hasTransformElement()) {
64681        composeCanonicalCore("transform", element.getTransformElement(), false);
64682        composeCanonicalExtras("transform", element.getTransformElement(), false);
64683      }
64684      if (element.hasDynamicValue()) {
64685        openArray("dynamicValue");
64686        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
64687          composePlanDefinitionActionDynamicValueComponent(null, e);
64688        closeArray();
64689      };
64690      if (element.hasAction()) {
64691        openArray("action");
64692        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
64693          composePlanDefinitionActionComponent(null, e);
64694        closeArray();
64695      };
64696  }
64697
64698  protected void composePlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
64699    if (element != null) {
64700      open(name);
64701      composePlanDefinitionActionConditionComponentProperties(element);
64702      close();
64703    }
64704  }
64705
64706  protected void composePlanDefinitionActionConditionComponentProperties(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
64707    composeBackboneElementProperties(element);
64708      if (element.hasKindElement()) {
64709        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
64710        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
64711      }
64712      if (element.hasExpression()) {
64713        composeExpression("expression", element.getExpression());
64714      }
64715  }
64716
64717  protected void composePlanDefinitionActionInputComponent(String name, PlanDefinition.PlanDefinitionActionInputComponent element) throws IOException {
64718    if (element != null) {
64719      open(name);
64720      composePlanDefinitionActionInputComponentProperties(element);
64721      close();
64722    }
64723  }
64724
64725  protected void composePlanDefinitionActionInputComponentProperties(PlanDefinition.PlanDefinitionActionInputComponent element) throws IOException {
64726    composeBackboneElementProperties(element);
64727      if (element.hasTitleElement()) {
64728        composeStringCore("title", element.getTitleElement(), false);
64729        composeStringExtras("title", element.getTitleElement(), false);
64730      }
64731      if (element.hasRequirement()) {
64732        composeDataRequirement("requirement", element.getRequirement());
64733      }
64734      if (element.hasRelatedDataElement()) {
64735        composeIdCore("relatedData", element.getRelatedDataElement(), false);
64736        composeIdExtras("relatedData", element.getRelatedDataElement(), false);
64737      }
64738  }
64739
64740  protected void composePlanDefinitionActionOutputComponent(String name, PlanDefinition.PlanDefinitionActionOutputComponent element) throws IOException {
64741    if (element != null) {
64742      open(name);
64743      composePlanDefinitionActionOutputComponentProperties(element);
64744      close();
64745    }
64746  }
64747
64748  protected void composePlanDefinitionActionOutputComponentProperties(PlanDefinition.PlanDefinitionActionOutputComponent element) throws IOException {
64749    composeBackboneElementProperties(element);
64750      if (element.hasTitleElement()) {
64751        composeStringCore("title", element.getTitleElement(), false);
64752        composeStringExtras("title", element.getTitleElement(), false);
64753      }
64754      if (element.hasRequirement()) {
64755        composeDataRequirement("requirement", element.getRequirement());
64756      }
64757      if (element.hasRelatedDataElement()) {
64758        composeStringCore("relatedData", element.getRelatedDataElement(), false);
64759        composeStringExtras("relatedData", element.getRelatedDataElement(), false);
64760      }
64761  }
64762
64763  protected void composePlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
64764    if (element != null) {
64765      open(name);
64766      composePlanDefinitionActionRelatedActionComponentProperties(element);
64767      close();
64768    }
64769  }
64770
64771  protected void composePlanDefinitionActionRelatedActionComponentProperties(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
64772    composeBackboneElementProperties(element);
64773      if (element.hasTargetIdElement()) {
64774        composeIdCore("targetId", element.getTargetIdElement(), false);
64775        composeIdExtras("targetId", element.getTargetIdElement(), false);
64776      }
64777      if (element.hasRelationshipElement()) {
64778        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64779        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64780      }
64781      if (element.hasEndRelationshipElement()) {
64782        composeEnumerationCore("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64783        composeEnumerationExtras("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
64784      }
64785      if (element.hasOffset()) {
64786        composeType("offset", element.getOffset());
64787      }
64788  }
64789
64790  protected void composePlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
64791    if (element != null) {
64792      open(name);
64793      composePlanDefinitionActionParticipantComponentProperties(element);
64794      close();
64795    }
64796  }
64797
64798  protected void composePlanDefinitionActionParticipantComponentProperties(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
64799    composeBackboneElementProperties(element);
64800      if (element.hasActorIdElement()) {
64801        composeStringCore("actorId", element.getActorIdElement(), false);
64802        composeStringExtras("actorId", element.getActorIdElement(), false);
64803      }
64804      if (element.hasTypeElement()) {
64805        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64806        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
64807      }
64808      if (element.hasTypeCanonicalElement()) {
64809        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
64810        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
64811      }
64812      if (element.hasTypeReference()) {
64813        composeReference("typeReference", element.getTypeReference());
64814      }
64815      if (element.hasRole()) {
64816        composeCodeableConcept("role", element.getRole());
64817      }
64818      if (element.hasFunction()) {
64819        composeCodeableConcept("function", element.getFunction());
64820      }
64821  }
64822
64823  protected void composePlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
64824    if (element != null) {
64825      open(name);
64826      composePlanDefinitionActionDynamicValueComponentProperties(element);
64827      close();
64828    }
64829  }
64830
64831  protected void composePlanDefinitionActionDynamicValueComponentProperties(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
64832    composeBackboneElementProperties(element);
64833      if (element.hasPathElement()) {
64834        composeStringCore("path", element.getPathElement(), false);
64835        composeStringExtras("path", element.getPathElement(), false);
64836      }
64837      if (element.hasExpression()) {
64838        composeExpression("expression", element.getExpression());
64839      }
64840  }
64841
64842  protected void composePractitioner(String name, Practitioner element) throws IOException {
64843    if (element != null) {
64844      prop("resourceType", name);
64845      composePractitionerProperties(element);
64846    }
64847  }
64848
64849  protected void composePractitionerProperties(Practitioner element) throws IOException {
64850    composeDomainResourceProperties(element);
64851      if (element.hasIdentifier()) {
64852        openArray("identifier");
64853        for (Identifier e : element.getIdentifier()) 
64854          composeIdentifier(null, e);
64855        closeArray();
64856      };
64857      if (element.hasActiveElement()) {
64858        composeBooleanCore("active", element.getActiveElement(), false);
64859        composeBooleanExtras("active", element.getActiveElement(), false);
64860      }
64861      if (element.hasName()) {
64862        openArray("name");
64863        for (HumanName e : element.getName()) 
64864          composeHumanName(null, e);
64865        closeArray();
64866      };
64867      if (element.hasTelecom()) {
64868        openArray("telecom");
64869        for (ContactPoint e : element.getTelecom()) 
64870          composeContactPoint(null, e);
64871        closeArray();
64872      };
64873      if (element.hasGenderElement()) {
64874        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64875        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
64876      }
64877      if (element.hasBirthDateElement()) {
64878        composeDateCore("birthDate", element.getBirthDateElement(), false);
64879        composeDateExtras("birthDate", element.getBirthDateElement(), false);
64880      }
64881      if (element.hasDeceased()) {
64882        composeType("deceased", element.getDeceased());
64883      }
64884      if (element.hasAddress()) {
64885        openArray("address");
64886        for (Address e : element.getAddress()) 
64887          composeAddress(null, e);
64888        closeArray();
64889      };
64890      if (element.hasPhoto()) {
64891        openArray("photo");
64892        for (Attachment e : element.getPhoto()) 
64893          composeAttachment(null, e);
64894        closeArray();
64895      };
64896      if (element.hasQualification()) {
64897        openArray("qualification");
64898        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
64899          composePractitionerQualificationComponent(null, e);
64900        closeArray();
64901      };
64902      if (element.hasCommunication()) {
64903        openArray("communication");
64904        for (Practitioner.PractitionerCommunicationComponent e : element.getCommunication()) 
64905          composePractitionerCommunicationComponent(null, e);
64906        closeArray();
64907      };
64908  }
64909
64910  protected void composePractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
64911    if (element != null) {
64912      open(name);
64913      composePractitionerQualificationComponentProperties(element);
64914      close();
64915    }
64916  }
64917
64918  protected void composePractitionerQualificationComponentProperties(Practitioner.PractitionerQualificationComponent element) throws IOException {
64919    composeBackboneElementProperties(element);
64920      if (element.hasIdentifier()) {
64921        openArray("identifier");
64922        for (Identifier e : element.getIdentifier()) 
64923          composeIdentifier(null, e);
64924        closeArray();
64925      };
64926      if (element.hasCode()) {
64927        composeCodeableConcept("code", element.getCode());
64928      }
64929      if (element.hasPeriod()) {
64930        composePeriod("period", element.getPeriod());
64931      }
64932      if (element.hasIssuer()) {
64933        composeReference("issuer", element.getIssuer());
64934      }
64935  }
64936
64937  protected void composePractitionerCommunicationComponent(String name, Practitioner.PractitionerCommunicationComponent element) throws IOException {
64938    if (element != null) {
64939      open(name);
64940      composePractitionerCommunicationComponentProperties(element);
64941      close();
64942    }
64943  }
64944
64945  protected void composePractitionerCommunicationComponentProperties(Practitioner.PractitionerCommunicationComponent element) throws IOException {
64946    composeBackboneElementProperties(element);
64947      if (element.hasLanguage()) {
64948        composeCodeableConcept("language", element.getLanguage());
64949      }
64950      if (element.hasPreferredElement()) {
64951        composeBooleanCore("preferred", element.getPreferredElement(), false);
64952        composeBooleanExtras("preferred", element.getPreferredElement(), false);
64953      }
64954  }
64955
64956  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
64957    if (element != null) {
64958      prop("resourceType", name);
64959      composePractitionerRoleProperties(element);
64960    }
64961  }
64962
64963  protected void composePractitionerRoleProperties(PractitionerRole element) throws IOException {
64964    composeDomainResourceProperties(element);
64965      if (element.hasIdentifier()) {
64966        openArray("identifier");
64967        for (Identifier e : element.getIdentifier()) 
64968          composeIdentifier(null, e);
64969        closeArray();
64970      };
64971      if (element.hasActiveElement()) {
64972        composeBooleanCore("active", element.getActiveElement(), false);
64973        composeBooleanExtras("active", element.getActiveElement(), false);
64974      }
64975      if (element.hasPeriod()) {
64976        composePeriod("period", element.getPeriod());
64977      }
64978      if (element.hasPractitioner()) {
64979        composeReference("practitioner", element.getPractitioner());
64980      }
64981      if (element.hasOrganization()) {
64982        composeReference("organization", element.getOrganization());
64983      }
64984      if (element.hasCode()) {
64985        openArray("code");
64986        for (CodeableConcept e : element.getCode()) 
64987          composeCodeableConcept(null, e);
64988        closeArray();
64989      };
64990      if (element.hasSpecialty()) {
64991        openArray("specialty");
64992        for (CodeableConcept e : element.getSpecialty()) 
64993          composeCodeableConcept(null, e);
64994        closeArray();
64995      };
64996      if (element.hasLocation()) {
64997        openArray("location");
64998        for (Reference e : element.getLocation()) 
64999          composeReference(null, e);
65000        closeArray();
65001      };
65002      if (element.hasHealthcareService()) {
65003        openArray("healthcareService");
65004        for (Reference e : element.getHealthcareService()) 
65005          composeReference(null, e);
65006        closeArray();
65007      };
65008      if (element.hasContact()) {
65009        openArray("contact");
65010        for (ExtendedContactDetail e : element.getContact()) 
65011          composeExtendedContactDetail(null, e);
65012        closeArray();
65013      };
65014      if (element.hasCharacteristic()) {
65015        openArray("characteristic");
65016        for (CodeableConcept e : element.getCharacteristic()) 
65017          composeCodeableConcept(null, e);
65018        closeArray();
65019      };
65020      if (element.hasCommunication()) {
65021        openArray("communication");
65022        for (CodeableConcept e : element.getCommunication()) 
65023          composeCodeableConcept(null, e);
65024        closeArray();
65025      };
65026      if (element.hasAvailability()) {
65027        openArray("availability");
65028        for (Availability e : element.getAvailability()) 
65029          composeAvailability(null, e);
65030        closeArray();
65031      };
65032      if (element.hasEndpoint()) {
65033        openArray("endpoint");
65034        for (Reference e : element.getEndpoint()) 
65035          composeReference(null, e);
65036        closeArray();
65037      };
65038  }
65039
65040  protected void composeProcedure(String name, Procedure element) throws IOException {
65041    if (element != null) {
65042      prop("resourceType", name);
65043      composeProcedureProperties(element);
65044    }
65045  }
65046
65047  protected void composeProcedureProperties(Procedure element) throws IOException {
65048    composeDomainResourceProperties(element);
65049      if (element.hasIdentifier()) {
65050        openArray("identifier");
65051        for (Identifier e : element.getIdentifier()) 
65052          composeIdentifier(null, e);
65053        closeArray();
65054      };
65055      if (element.hasInstantiatesCanonical()) {
65056        if (anyHasValue(element.getInstantiatesCanonical())) {
65057          openArray("instantiatesCanonical");
65058          for (CanonicalType e : element.getInstantiatesCanonical()) 
65059            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
65060          closeArray();
65061        }
65062        if (anyHasExtras(element.getInstantiatesCanonical())) {
65063          openArray("_instantiatesCanonical");
65064          for (CanonicalType e : element.getInstantiatesCanonical()) 
65065            composeCanonicalExtras(null, e, true);
65066          closeArray();
65067        }
65068      };
65069      if (element.hasInstantiatesUri()) {
65070        if (anyHasValue(element.getInstantiatesUri())) {
65071          openArray("instantiatesUri");
65072          for (UriType e : element.getInstantiatesUri()) 
65073            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
65074          closeArray();
65075        }
65076        if (anyHasExtras(element.getInstantiatesUri())) {
65077          openArray("_instantiatesUri");
65078          for (UriType e : element.getInstantiatesUri()) 
65079            composeUriExtras(null, e, true);
65080          closeArray();
65081        }
65082      };
65083      if (element.hasBasedOn()) {
65084        openArray("basedOn");
65085        for (Reference e : element.getBasedOn()) 
65086          composeReference(null, e);
65087        closeArray();
65088      };
65089      if (element.hasPartOf()) {
65090        openArray("partOf");
65091        for (Reference e : element.getPartOf()) 
65092          composeReference(null, e);
65093        closeArray();
65094      };
65095      if (element.hasStatusElement()) {
65096        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
65097        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
65098      }
65099      if (element.hasStatusReason()) {
65100        composeCodeableConcept("statusReason", element.getStatusReason());
65101      }
65102      if (element.hasCategory()) {
65103        openArray("category");
65104        for (CodeableConcept e : element.getCategory()) 
65105          composeCodeableConcept(null, e);
65106        closeArray();
65107      };
65108      if (element.hasCode()) {
65109        composeCodeableConcept("code", element.getCode());
65110      }
65111      if (element.hasSubject()) {
65112        composeReference("subject", element.getSubject());
65113      }
65114      if (element.hasFocus()) {
65115        composeReference("focus", element.getFocus());
65116      }
65117      if (element.hasEncounter()) {
65118        composeReference("encounter", element.getEncounter());
65119      }
65120      if (element.hasOccurrence()) {
65121        composeType("occurrence", element.getOccurrence());
65122      }
65123      if (element.hasRecordedElement()) {
65124        composeDateTimeCore("recorded", element.getRecordedElement(), false);
65125        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
65126      }
65127      if (element.hasRecorder()) {
65128        composeReference("recorder", element.getRecorder());
65129      }
65130      if (element.hasReported()) {
65131        composeType("reported", element.getReported());
65132      }
65133      if (element.hasPerformer()) {
65134        openArray("performer");
65135        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
65136          composeProcedurePerformerComponent(null, e);
65137        closeArray();
65138      };
65139      if (element.hasLocation()) {
65140        composeReference("location", element.getLocation());
65141      }
65142      if (element.hasReason()) {
65143        openArray("reason");
65144        for (CodeableReference e : element.getReason()) 
65145          composeCodeableReference(null, e);
65146        closeArray();
65147      };
65148      if (element.hasBodySite()) {
65149        openArray("bodySite");
65150        for (CodeableConcept e : element.getBodySite()) 
65151          composeCodeableConcept(null, e);
65152        closeArray();
65153      };
65154      if (element.hasOutcome()) {
65155        composeCodeableConcept("outcome", element.getOutcome());
65156      }
65157      if (element.hasReport()) {
65158        openArray("report");
65159        for (Reference e : element.getReport()) 
65160          composeReference(null, e);
65161        closeArray();
65162      };
65163      if (element.hasComplication()) {
65164        openArray("complication");
65165        for (CodeableReference e : element.getComplication()) 
65166          composeCodeableReference(null, e);
65167        closeArray();
65168      };
65169      if (element.hasFollowUp()) {
65170        openArray("followUp");
65171        for (CodeableConcept e : element.getFollowUp()) 
65172          composeCodeableConcept(null, e);
65173        closeArray();
65174      };
65175      if (element.hasNote()) {
65176        openArray("note");
65177        for (Annotation e : element.getNote()) 
65178          composeAnnotation(null, e);
65179        closeArray();
65180      };
65181      if (element.hasFocalDevice()) {
65182        openArray("focalDevice");
65183        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
65184          composeProcedureFocalDeviceComponent(null, e);
65185        closeArray();
65186      };
65187      if (element.hasUsed()) {
65188        openArray("used");
65189        for (CodeableReference e : element.getUsed()) 
65190          composeCodeableReference(null, e);
65191        closeArray();
65192      };
65193      if (element.hasSupportingInfo()) {
65194        openArray("supportingInfo");
65195        for (Reference e : element.getSupportingInfo()) 
65196          composeReference(null, e);
65197        closeArray();
65198      };
65199  }
65200
65201  protected void composeProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
65202    if (element != null) {
65203      open(name);
65204      composeProcedurePerformerComponentProperties(element);
65205      close();
65206    }
65207  }
65208
65209  protected void composeProcedurePerformerComponentProperties(Procedure.ProcedurePerformerComponent element) throws IOException {
65210    composeBackboneElementProperties(element);
65211      if (element.hasFunction()) {
65212        composeCodeableConcept("function", element.getFunction());
65213      }
65214      if (element.hasActor()) {
65215        composeReference("actor", element.getActor());
65216      }
65217      if (element.hasOnBehalfOf()) {
65218        composeReference("onBehalfOf", element.getOnBehalfOf());
65219      }
65220      if (element.hasPeriod()) {
65221        composePeriod("period", element.getPeriod());
65222      }
65223  }
65224
65225  protected void composeProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
65226    if (element != null) {
65227      open(name);
65228      composeProcedureFocalDeviceComponentProperties(element);
65229      close();
65230    }
65231  }
65232
65233  protected void composeProcedureFocalDeviceComponentProperties(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
65234    composeBackboneElementProperties(element);
65235      if (element.hasAction()) {
65236        composeCodeableConcept("action", element.getAction());
65237      }
65238      if (element.hasManipulated()) {
65239        composeReference("manipulated", element.getManipulated());
65240      }
65241  }
65242
65243  protected void composeProvenance(String name, Provenance element) throws IOException {
65244    if (element != null) {
65245      prop("resourceType", name);
65246      composeProvenanceProperties(element);
65247    }
65248  }
65249
65250  protected void composeProvenanceProperties(Provenance element) throws IOException {
65251    composeDomainResourceProperties(element);
65252      if (element.hasTarget()) {
65253        openArray("target");
65254        for (Reference e : element.getTarget()) 
65255          composeReference(null, e);
65256        closeArray();
65257      };
65258      if (element.hasOccurred()) {
65259        composeType("occurred", element.getOccurred());
65260      }
65261      if (element.hasRecordedElement()) {
65262        composeInstantCore("recorded", element.getRecordedElement(), false);
65263        composeInstantExtras("recorded", element.getRecordedElement(), false);
65264      }
65265      if (element.hasPolicy()) {
65266        if (anyHasValue(element.getPolicy())) {
65267          openArray("policy");
65268          for (UriType e : element.getPolicy()) 
65269            composeUriCore(null, e, e != element.getPolicy().get(element.getPolicy().size()-1));
65270          closeArray();
65271        }
65272        if (anyHasExtras(element.getPolicy())) {
65273          openArray("_policy");
65274          for (UriType e : element.getPolicy()) 
65275            composeUriExtras(null, e, true);
65276          closeArray();
65277        }
65278      };
65279      if (element.hasLocation()) {
65280        composeReference("location", element.getLocation());
65281      }
65282      if (element.hasAuthorization()) {
65283        openArray("authorization");
65284        for (CodeableReference e : element.getAuthorization()) 
65285          composeCodeableReference(null, e);
65286        closeArray();
65287      };
65288      if (element.hasActivity()) {
65289        composeCodeableConcept("activity", element.getActivity());
65290      }
65291      if (element.hasBasedOn()) {
65292        openArray("basedOn");
65293        for (Reference e : element.getBasedOn()) 
65294          composeReference(null, e);
65295        closeArray();
65296      };
65297      if (element.hasPatient()) {
65298        composeReference("patient", element.getPatient());
65299      }
65300      if (element.hasEncounter()) {
65301        composeReference("encounter", element.getEncounter());
65302      }
65303      if (element.hasAgent()) {
65304        openArray("agent");
65305        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
65306          composeProvenanceAgentComponent(null, e);
65307        closeArray();
65308      };
65309      if (element.hasEntity()) {
65310        openArray("entity");
65311        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
65312          composeProvenanceEntityComponent(null, e);
65313        closeArray();
65314      };
65315      if (element.hasSignature()) {
65316        openArray("signature");
65317        for (Signature e : element.getSignature()) 
65318          composeSignature(null, e);
65319        closeArray();
65320      };
65321  }
65322
65323  protected void composeProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
65324    if (element != null) {
65325      open(name);
65326      composeProvenanceAgentComponentProperties(element);
65327      close();
65328    }
65329  }
65330
65331  protected void composeProvenanceAgentComponentProperties(Provenance.ProvenanceAgentComponent element) throws IOException {
65332    composeBackboneElementProperties(element);
65333      if (element.hasType()) {
65334        composeCodeableConcept("type", element.getType());
65335      }
65336      if (element.hasRole()) {
65337        openArray("role");
65338        for (CodeableConcept e : element.getRole()) 
65339          composeCodeableConcept(null, e);
65340        closeArray();
65341      };
65342      if (element.hasWho()) {
65343        composeReference("who", element.getWho());
65344      }
65345      if (element.hasOnBehalfOf()) {
65346        composeReference("onBehalfOf", element.getOnBehalfOf());
65347      }
65348  }
65349
65350  protected void composeProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
65351    if (element != null) {
65352      open(name);
65353      composeProvenanceEntityComponentProperties(element);
65354      close();
65355    }
65356  }
65357
65358  protected void composeProvenanceEntityComponentProperties(Provenance.ProvenanceEntityComponent element) throws IOException {
65359    composeBackboneElementProperties(element);
65360      if (element.hasRoleElement()) {
65361        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
65362        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
65363      }
65364      if (element.hasWhat()) {
65365        composeReference("what", element.getWhat());
65366      }
65367      if (element.hasAgent()) {
65368        openArray("agent");
65369        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
65370          composeProvenanceAgentComponent(null, e);
65371        closeArray();
65372      };
65373  }
65374
65375  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
65376    if (element != null) {
65377      prop("resourceType", name);
65378      composeQuestionnaireProperties(element);
65379    }
65380  }
65381
65382  protected void composeQuestionnaireProperties(Questionnaire element) throws IOException {
65383    composeMetadataResourceProperties(element);
65384      if (element.hasUrlElement()) {
65385        composeUriCore("url", element.getUrlElement(), false);
65386        composeUriExtras("url", element.getUrlElement(), false);
65387      }
65388      if (element.hasIdentifier()) {
65389        openArray("identifier");
65390        for (Identifier e : element.getIdentifier()) 
65391          composeIdentifier(null, e);
65392        closeArray();
65393      };
65394      if (element.hasVersionElement()) {
65395        composeStringCore("version", element.getVersionElement(), false);
65396        composeStringExtras("version", element.getVersionElement(), false);
65397      }
65398      if (element.hasVersionAlgorithm()) {
65399        composeType("versionAlgorithm", element.getVersionAlgorithm());
65400      }
65401      if (element.hasNameElement()) {
65402        composeStringCore("name", element.getNameElement(), false);
65403        composeStringExtras("name", element.getNameElement(), false);
65404      }
65405      if (element.hasTitleElement()) {
65406        composeStringCore("title", element.getTitleElement(), false);
65407        composeStringExtras("title", element.getTitleElement(), false);
65408      }
65409      if (element.hasDerivedFrom()) {
65410        if (anyHasValue(element.getDerivedFrom())) {
65411          openArray("derivedFrom");
65412          for (CanonicalType e : element.getDerivedFrom()) 
65413            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
65414          closeArray();
65415        }
65416        if (anyHasExtras(element.getDerivedFrom())) {
65417          openArray("_derivedFrom");
65418          for (CanonicalType e : element.getDerivedFrom()) 
65419            composeCanonicalExtras(null, e, true);
65420          closeArray();
65421        }
65422      };
65423      if (element.hasStatusElement()) {
65424        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
65425        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
65426      }
65427      if (element.hasExperimentalElement()) {
65428        composeBooleanCore("experimental", element.getExperimentalElement(), false);
65429        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
65430      }
65431      if (element.hasSubjectType()) {
65432        if (anyHasValue(element.getSubjectType())) {
65433          openArray("subjectType");
65434          for (CodeType e : element.getSubjectType()) 
65435            composeCodeCore(null, e, e != element.getSubjectType().get(element.getSubjectType().size()-1));
65436          closeArray();
65437        }
65438        if (anyHasExtras(element.getSubjectType())) {
65439          openArray("_subjectType");
65440          for (CodeType e : element.getSubjectType()) 
65441            composeCodeExtras(null, e, true);
65442          closeArray();
65443        }
65444      };
65445      if (element.hasDateElement()) {
65446        composeDateTimeCore("date", element.getDateElement(), false);
65447        composeDateTimeExtras("date", element.getDateElement(), false);
65448      }
65449      if (element.hasPublisherElement()) {
65450        composeStringCore("publisher", element.getPublisherElement(), false);
65451        composeStringExtras("publisher", element.getPublisherElement(), false);
65452      }
65453      if (element.hasContact()) {
65454        openArray("contact");
65455        for (ContactDetail e : element.getContact()) 
65456          composeContactDetail(null, e);
65457        closeArray();
65458      };
65459      if (element.hasDescriptionElement()) {
65460        composeMarkdownCore("description", element.getDescriptionElement(), false);
65461        composeMarkdownExtras("description", element.getDescriptionElement(), false);
65462      }
65463      if (element.hasUseContext()) {
65464        openArray("useContext");
65465        for (UsageContext e : element.getUseContext()) 
65466          composeUsageContext(null, e);
65467        closeArray();
65468      };
65469      if (element.hasJurisdiction()) {
65470        openArray("jurisdiction");
65471        for (CodeableConcept e : element.getJurisdiction()) 
65472          composeCodeableConcept(null, e);
65473        closeArray();
65474      };
65475      if (element.hasPurposeElement()) {
65476        composeMarkdownCore("purpose", element.getPurposeElement(), false);
65477        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
65478      }
65479      if (element.hasCopyrightElement()) {
65480        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
65481        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
65482      }
65483      if (element.hasCopyrightLabelElement()) {
65484        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
65485        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
65486      }
65487      if (element.hasApprovalDateElement()) {
65488        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
65489        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
65490      }
65491      if (element.hasLastReviewDateElement()) {
65492        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
65493        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
65494      }
65495      if (element.hasEffectivePeriod()) {
65496        composePeriod("effectivePeriod", element.getEffectivePeriod());
65497      }
65498      if (element.hasCode()) {
65499        openArray("code");
65500        for (Coding e : element.getCode()) 
65501          composeCoding(null, e);
65502        closeArray();
65503      };
65504      if (element.hasItem()) {
65505        openArray("item");
65506        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
65507          composeQuestionnaireItemComponent(null, e);
65508        closeArray();
65509      };
65510  }
65511
65512  protected void composeQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
65513    if (element != null) {
65514      open(name);
65515      composeQuestionnaireItemComponentProperties(element);
65516      close();
65517    }
65518  }
65519
65520  protected void composeQuestionnaireItemComponentProperties(Questionnaire.QuestionnaireItemComponent element) throws IOException {
65521    composeBackboneElementProperties(element);
65522      if (element.hasLinkIdElement()) {
65523        composeStringCore("linkId", element.getLinkIdElement(), false);
65524        composeStringExtras("linkId", element.getLinkIdElement(), false);
65525      }
65526      if (element.hasDefinitionElement()) {
65527        composeUriCore("definition", element.getDefinitionElement(), false);
65528        composeUriExtras("definition", element.getDefinitionElement(), false);
65529      }
65530      if (element.hasCode()) {
65531        openArray("code");
65532        for (Coding e : element.getCode()) 
65533          composeCoding(null, e);
65534        closeArray();
65535      };
65536      if (element.hasPrefixElement()) {
65537        composeStringCore("prefix", element.getPrefixElement(), false);
65538        composeStringExtras("prefix", element.getPrefixElement(), false);
65539      }
65540      if (element.hasTextElement()) {
65541        composeStringCore("text", element.getTextElement(), false);
65542        composeStringExtras("text", element.getTextElement(), false);
65543      }
65544      if (element.hasTypeElement()) {
65545        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
65546        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
65547      }
65548      if (element.hasEnableWhen()) {
65549        openArray("enableWhen");
65550        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
65551          composeQuestionnaireItemEnableWhenComponent(null, e);
65552        closeArray();
65553      };
65554      if (element.hasEnableBehaviorElement()) {
65555        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
65556        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
65557      }
65558      if (element.hasDisabledDisplayElement()) {
65559        composeEnumerationCore("disabledDisplay", element.getDisabledDisplayElement(), new Questionnaire.QuestionnaireItemDisabledDisplayEnumFactory(), false);
65560        composeEnumerationExtras("disabledDisplay", element.getDisabledDisplayElement(), new Questionnaire.QuestionnaireItemDisabledDisplayEnumFactory(), false);
65561      }
65562      if (element.hasRequiredElement()) {
65563        composeBooleanCore("required", element.getRequiredElement(), false);
65564        composeBooleanExtras("required", element.getRequiredElement(), false);
65565      }
65566      if (element.hasRepeatsElement()) {
65567        composeBooleanCore("repeats", element.getRepeatsElement(), false);
65568        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
65569      }
65570      if (element.hasReadOnlyElement()) {
65571        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
65572        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
65573      }
65574      if (element.hasMaxLengthElement()) {
65575        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
65576        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
65577      }
65578      if (element.hasAnswerConstraintElement()) {
65579        composeEnumerationCore("answerConstraint", element.getAnswerConstraintElement(), new Questionnaire.QuestionnaireAnswerConstraintEnumFactory(), false);
65580        composeEnumerationExtras("answerConstraint", element.getAnswerConstraintElement(), new Questionnaire.QuestionnaireAnswerConstraintEnumFactory(), false);
65581      }
65582      if (element.hasAnswerValueSetElement()) {
65583        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
65584        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
65585      }
65586      if (element.hasAnswerOption()) {
65587        openArray("answerOption");
65588        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
65589          composeQuestionnaireItemAnswerOptionComponent(null, e);
65590        closeArray();
65591      };
65592      if (element.hasInitial()) {
65593        openArray("initial");
65594        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
65595          composeQuestionnaireItemInitialComponent(null, e);
65596        closeArray();
65597      };
65598      if (element.hasItem()) {
65599        openArray("item");
65600        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
65601          composeQuestionnaireItemComponent(null, e);
65602        closeArray();
65603      };
65604  }
65605
65606  protected void composeQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
65607    if (element != null) {
65608      open(name);
65609      composeQuestionnaireItemEnableWhenComponentProperties(element);
65610      close();
65611    }
65612  }
65613
65614  protected void composeQuestionnaireItemEnableWhenComponentProperties(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
65615    composeBackboneElementProperties(element);
65616      if (element.hasQuestionElement()) {
65617        composeStringCore("question", element.getQuestionElement(), false);
65618        composeStringExtras("question", element.getQuestionElement(), false);
65619      }
65620      if (element.hasOperatorElement()) {
65621        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
65622        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
65623      }
65624      if (element.hasAnswer()) {
65625        composeType("answer", element.getAnswer());
65626      }
65627  }
65628
65629  protected void composeQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
65630    if (element != null) {
65631      open(name);
65632      composeQuestionnaireItemAnswerOptionComponentProperties(element);
65633      close();
65634    }
65635  }
65636
65637  protected void composeQuestionnaireItemAnswerOptionComponentProperties(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
65638    composeBackboneElementProperties(element);
65639      if (element.hasValue()) {
65640        composeType("value", element.getValue());
65641      }
65642      if (element.hasInitialSelectedElement()) {
65643        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
65644        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
65645      }
65646  }
65647
65648  protected void composeQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
65649    if (element != null) {
65650      open(name);
65651      composeQuestionnaireItemInitialComponentProperties(element);
65652      close();
65653    }
65654  }
65655
65656  protected void composeQuestionnaireItemInitialComponentProperties(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
65657    composeBackboneElementProperties(element);
65658      if (element.hasValue()) {
65659        composeType("value", element.getValue());
65660      }
65661  }
65662
65663  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
65664    if (element != null) {
65665      prop("resourceType", name);
65666      composeQuestionnaireResponseProperties(element);
65667    }
65668  }
65669
65670  protected void composeQuestionnaireResponseProperties(QuestionnaireResponse element) throws IOException {
65671    composeDomainResourceProperties(element);
65672      if (element.hasIdentifier()) {
65673        openArray("identifier");
65674        for (Identifier e : element.getIdentifier()) 
65675          composeIdentifier(null, e);
65676        closeArray();
65677      };
65678      if (element.hasBasedOn()) {
65679        openArray("basedOn");
65680        for (Reference e : element.getBasedOn()) 
65681          composeReference(null, e);
65682        closeArray();
65683      };
65684      if (element.hasPartOf()) {
65685        openArray("partOf");
65686        for (Reference e : element.getPartOf()) 
65687          composeReference(null, e);
65688        closeArray();
65689      };
65690      if (element.hasQuestionnaireElement()) {
65691        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
65692        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
65693      }
65694      if (element.hasStatusElement()) {
65695        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
65696        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
65697      }
65698      if (element.hasSubject()) {
65699        composeReference("subject", element.getSubject());
65700      }
65701      if (element.hasEncounter()) {
65702        composeReference("encounter", element.getEncounter());
65703      }
65704      if (element.hasAuthoredElement()) {
65705        composeDateTimeCore("authored", element.getAuthoredElement(), false);
65706        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
65707      }
65708      if (element.hasAuthor()) {
65709        composeReference("author", element.getAuthor());
65710      }
65711      if (element.hasSource()) {
65712        composeReference("source", element.getSource());
65713      }
65714      if (element.hasItem()) {
65715        openArray("item");
65716        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
65717          composeQuestionnaireResponseItemComponent(null, e);
65718        closeArray();
65719      };
65720  }
65721
65722  protected void composeQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
65723    if (element != null) {
65724      open(name);
65725      composeQuestionnaireResponseItemComponentProperties(element);
65726      close();
65727    }
65728  }
65729
65730  protected void composeQuestionnaireResponseItemComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
65731    composeBackboneElementProperties(element);
65732      if (element.hasLinkIdElement()) {
65733        composeStringCore("linkId", element.getLinkIdElement(), false);
65734        composeStringExtras("linkId", element.getLinkIdElement(), false);
65735      }
65736      if (element.hasDefinitionElement()) {
65737        composeUriCore("definition", element.getDefinitionElement(), false);
65738        composeUriExtras("definition", element.getDefinitionElement(), false);
65739      }
65740      if (element.hasTextElement()) {
65741        composeStringCore("text", element.getTextElement(), false);
65742        composeStringExtras("text", element.getTextElement(), false);
65743      }
65744      if (element.hasAnswer()) {
65745        openArray("answer");
65746        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
65747          composeQuestionnaireResponseItemAnswerComponent(null, e);
65748        closeArray();
65749      };
65750      if (element.hasItem()) {
65751        openArray("item");
65752        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
65753          composeQuestionnaireResponseItemComponent(null, e);
65754        closeArray();
65755      };
65756  }
65757
65758  protected void composeQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
65759    if (element != null) {
65760      open(name);
65761      composeQuestionnaireResponseItemAnswerComponentProperties(element);
65762      close();
65763    }
65764  }
65765
65766  protected void composeQuestionnaireResponseItemAnswerComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
65767    composeBackboneElementProperties(element);
65768      if (element.hasValue()) {
65769        composeType("value", element.getValue());
65770      }
65771      if (element.hasItem()) {
65772        openArray("item");
65773        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
65774          composeQuestionnaireResponseItemComponent(null, e);
65775        closeArray();
65776      };
65777  }
65778
65779  protected void composeRegulatedAuthorization(String name, RegulatedAuthorization element) throws IOException {
65780    if (element != null) {
65781      prop("resourceType", name);
65782      composeRegulatedAuthorizationProperties(element);
65783    }
65784  }
65785
65786  protected void composeRegulatedAuthorizationProperties(RegulatedAuthorization element) throws IOException {
65787    composeDomainResourceProperties(element);
65788      if (element.hasIdentifier()) {
65789        openArray("identifier");
65790        for (Identifier e : element.getIdentifier()) 
65791          composeIdentifier(null, e);
65792        closeArray();
65793      };
65794      if (element.hasSubject()) {
65795        openArray("subject");
65796        for (Reference e : element.getSubject()) 
65797          composeReference(null, e);
65798        closeArray();
65799      };
65800      if (element.hasType()) {
65801        composeCodeableConcept("type", element.getType());
65802      }
65803      if (element.hasDescriptionElement()) {
65804        composeMarkdownCore("description", element.getDescriptionElement(), false);
65805        composeMarkdownExtras("description", element.getDescriptionElement(), false);
65806      }
65807      if (element.hasRegion()) {
65808        openArray("region");
65809        for (CodeableConcept e : element.getRegion()) 
65810          composeCodeableConcept(null, e);
65811        closeArray();
65812      };
65813      if (element.hasStatus()) {
65814        composeCodeableConcept("status", element.getStatus());
65815      }
65816      if (element.hasStatusDateElement()) {
65817        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
65818        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
65819      }
65820      if (element.hasValidityPeriod()) {
65821        composePeriod("validityPeriod", element.getValidityPeriod());
65822      }
65823      if (element.hasIndication()) {
65824        openArray("indication");
65825        for (CodeableReference e : element.getIndication()) 
65826          composeCodeableReference(null, e);
65827        closeArray();
65828      };
65829      if (element.hasIntendedUse()) {
65830        composeCodeableConcept("intendedUse", element.getIntendedUse());
65831      }
65832      if (element.hasBasis()) {
65833        openArray("basis");
65834        for (CodeableConcept e : element.getBasis()) 
65835          composeCodeableConcept(null, e);
65836        closeArray();
65837      };
65838      if (element.hasHolder()) {
65839        composeReference("holder", element.getHolder());
65840      }
65841      if (element.hasRegulator()) {
65842        composeReference("regulator", element.getRegulator());
65843      }
65844      if (element.hasAttachedDocument()) {
65845        openArray("attachedDocument");
65846        for (Reference e : element.getAttachedDocument()) 
65847          composeReference(null, e);
65848        closeArray();
65849      };
65850      if (element.hasCase()) {
65851        composeRegulatedAuthorizationCaseComponent("case", element.getCase());
65852      }
65853  }
65854
65855  protected void composeRegulatedAuthorizationCaseComponent(String name, RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
65856    if (element != null) {
65857      open(name);
65858      composeRegulatedAuthorizationCaseComponentProperties(element);
65859      close();
65860    }
65861  }
65862
65863  protected void composeRegulatedAuthorizationCaseComponentProperties(RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
65864    composeBackboneElementProperties(element);
65865      if (element.hasIdentifier()) {
65866        composeIdentifier("identifier", element.getIdentifier());
65867      }
65868      if (element.hasType()) {
65869        composeCodeableConcept("type", element.getType());
65870      }
65871      if (element.hasStatus()) {
65872        composeCodeableConcept("status", element.getStatus());
65873      }
65874      if (element.hasDate()) {
65875        composeType("date", element.getDate());
65876      }
65877      if (element.hasApplication()) {
65878        openArray("application");
65879        for (RegulatedAuthorization.RegulatedAuthorizationCaseComponent e : element.getApplication()) 
65880          composeRegulatedAuthorizationCaseComponent(null, e);
65881        closeArray();
65882      };
65883  }
65884
65885  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
65886    if (element != null) {
65887      prop("resourceType", name);
65888      composeRelatedPersonProperties(element);
65889    }
65890  }
65891
65892  protected void composeRelatedPersonProperties(RelatedPerson element) throws IOException {
65893    composeDomainResourceProperties(element);
65894      if (element.hasIdentifier()) {
65895        openArray("identifier");
65896        for (Identifier e : element.getIdentifier()) 
65897          composeIdentifier(null, e);
65898        closeArray();
65899      };
65900      if (element.hasActiveElement()) {
65901        composeBooleanCore("active", element.getActiveElement(), false);
65902        composeBooleanExtras("active", element.getActiveElement(), false);
65903      }
65904      if (element.hasPatient()) {
65905        composeReference("patient", element.getPatient());
65906      }
65907      if (element.hasRelationship()) {
65908        openArray("relationship");
65909        for (CodeableConcept e : element.getRelationship()) 
65910          composeCodeableConcept(null, e);
65911        closeArray();
65912      };
65913      if (element.hasName()) {
65914        openArray("name");
65915        for (HumanName e : element.getName()) 
65916          composeHumanName(null, e);
65917        closeArray();
65918      };
65919      if (element.hasTelecom()) {
65920        openArray("telecom");
65921        for (ContactPoint e : element.getTelecom()) 
65922          composeContactPoint(null, e);
65923        closeArray();
65924      };
65925      if (element.hasGenderElement()) {
65926        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
65927        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
65928      }
65929      if (element.hasBirthDateElement()) {
65930        composeDateCore("birthDate", element.getBirthDateElement(), false);
65931        composeDateExtras("birthDate", element.getBirthDateElement(), false);
65932      }
65933      if (element.hasAddress()) {
65934        openArray("address");
65935        for (Address e : element.getAddress()) 
65936          composeAddress(null, e);
65937        closeArray();
65938      };
65939      if (element.hasPhoto()) {
65940        openArray("photo");
65941        for (Attachment e : element.getPhoto()) 
65942          composeAttachment(null, e);
65943        closeArray();
65944      };
65945      if (element.hasPeriod()) {
65946        composePeriod("period", element.getPeriod());
65947      }
65948      if (element.hasCommunication()) {
65949        openArray("communication");
65950        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
65951          composeRelatedPersonCommunicationComponent(null, e);
65952        closeArray();
65953      };
65954  }
65955
65956  protected void composeRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
65957    if (element != null) {
65958      open(name);
65959      composeRelatedPersonCommunicationComponentProperties(element);
65960      close();
65961    }
65962  }
65963
65964  protected void composeRelatedPersonCommunicationComponentProperties(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
65965    composeBackboneElementProperties(element);
65966      if (element.hasLanguage()) {
65967        composeCodeableConcept("language", element.getLanguage());
65968      }
65969      if (element.hasPreferredElement()) {
65970        composeBooleanCore("preferred", element.getPreferredElement(), false);
65971        composeBooleanExtras("preferred", element.getPreferredElement(), false);
65972      }
65973  }
65974
65975  protected void composeRequestOrchestration(String name, RequestOrchestration element) throws IOException {
65976    if (element != null) {
65977      prop("resourceType", name);
65978      composeRequestOrchestrationProperties(element);
65979    }
65980  }
65981
65982  protected void composeRequestOrchestrationProperties(RequestOrchestration element) throws IOException {
65983    composeDomainResourceProperties(element);
65984      if (element.hasIdentifier()) {
65985        openArray("identifier");
65986        for (Identifier e : element.getIdentifier()) 
65987          composeIdentifier(null, e);
65988        closeArray();
65989      };
65990      if (element.hasInstantiatesCanonical()) {
65991        if (anyHasValue(element.getInstantiatesCanonical())) {
65992          openArray("instantiatesCanonical");
65993          for (CanonicalType e : element.getInstantiatesCanonical()) 
65994            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
65995          closeArray();
65996        }
65997        if (anyHasExtras(element.getInstantiatesCanonical())) {
65998          openArray("_instantiatesCanonical");
65999          for (CanonicalType e : element.getInstantiatesCanonical()) 
66000            composeCanonicalExtras(null, e, true);
66001          closeArray();
66002        }
66003      };
66004      if (element.hasInstantiatesUri()) {
66005        if (anyHasValue(element.getInstantiatesUri())) {
66006          openArray("instantiatesUri");
66007          for (UriType e : element.getInstantiatesUri()) 
66008            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
66009          closeArray();
66010        }
66011        if (anyHasExtras(element.getInstantiatesUri())) {
66012          openArray("_instantiatesUri");
66013          for (UriType e : element.getInstantiatesUri()) 
66014            composeUriExtras(null, e, true);
66015          closeArray();
66016        }
66017      };
66018      if (element.hasBasedOn()) {
66019        openArray("basedOn");
66020        for (Reference e : element.getBasedOn()) 
66021          composeReference(null, e);
66022        closeArray();
66023      };
66024      if (element.hasReplaces()) {
66025        openArray("replaces");
66026        for (Reference e : element.getReplaces()) 
66027          composeReference(null, e);
66028        closeArray();
66029      };
66030      if (element.hasGroupIdentifier()) {
66031        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
66032      }
66033      if (element.hasStatusElement()) {
66034        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
66035        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
66036      }
66037      if (element.hasIntentElement()) {
66038        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
66039        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
66040      }
66041      if (element.hasPriorityElement()) {
66042        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66043        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66044      }
66045      if (element.hasCode()) {
66046        composeCodeableConcept("code", element.getCode());
66047      }
66048      if (element.hasSubject()) {
66049        composeReference("subject", element.getSubject());
66050      }
66051      if (element.hasEncounter()) {
66052        composeReference("encounter", element.getEncounter());
66053      }
66054      if (element.hasAuthoredOnElement()) {
66055        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
66056        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
66057      }
66058      if (element.hasAuthor()) {
66059        composeReference("author", element.getAuthor());
66060      }
66061      if (element.hasReason()) {
66062        openArray("reason");
66063        for (CodeableReference e : element.getReason()) 
66064          composeCodeableReference(null, e);
66065        closeArray();
66066      };
66067      if (element.hasGoal()) {
66068        openArray("goal");
66069        for (Reference e : element.getGoal()) 
66070          composeReference(null, e);
66071        closeArray();
66072      };
66073      if (element.hasNote()) {
66074        openArray("note");
66075        for (Annotation e : element.getNote()) 
66076          composeAnnotation(null, e);
66077        closeArray();
66078      };
66079      if (element.hasAction()) {
66080        openArray("action");
66081        for (RequestOrchestration.RequestOrchestrationActionComponent e : element.getAction()) 
66082          composeRequestOrchestrationActionComponent(null, e);
66083        closeArray();
66084      };
66085  }
66086
66087  protected void composeRequestOrchestrationActionComponent(String name, RequestOrchestration.RequestOrchestrationActionComponent element) throws IOException {
66088    if (element != null) {
66089      open(name);
66090      composeRequestOrchestrationActionComponentProperties(element);
66091      close();
66092    }
66093  }
66094
66095  protected void composeRequestOrchestrationActionComponentProperties(RequestOrchestration.RequestOrchestrationActionComponent element) throws IOException {
66096    composeBackboneElementProperties(element);
66097      if (element.hasLinkIdElement()) {
66098        composeStringCore("linkId", element.getLinkIdElement(), false);
66099        composeStringExtras("linkId", element.getLinkIdElement(), false);
66100      }
66101      if (element.hasPrefixElement()) {
66102        composeStringCore("prefix", element.getPrefixElement(), false);
66103        composeStringExtras("prefix", element.getPrefixElement(), false);
66104      }
66105      if (element.hasTitleElement()) {
66106        composeStringCore("title", element.getTitleElement(), false);
66107        composeStringExtras("title", element.getTitleElement(), false);
66108      }
66109      if (element.hasDescriptionElement()) {
66110        composeMarkdownCore("description", element.getDescriptionElement(), false);
66111        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66112      }
66113      if (element.hasTextEquivalentElement()) {
66114        composeMarkdownCore("textEquivalent", element.getTextEquivalentElement(), false);
66115        composeMarkdownExtras("textEquivalent", element.getTextEquivalentElement(), false);
66116      }
66117      if (element.hasPriorityElement()) {
66118        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66119        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
66120      }
66121      if (element.hasCode()) {
66122        openArray("code");
66123        for (CodeableConcept e : element.getCode()) 
66124          composeCodeableConcept(null, e);
66125        closeArray();
66126      };
66127      if (element.hasDocumentation()) {
66128        openArray("documentation");
66129        for (RelatedArtifact e : element.getDocumentation()) 
66130          composeRelatedArtifact(null, e);
66131        closeArray();
66132      };
66133      if (element.hasGoal()) {
66134        openArray("goal");
66135        for (Reference e : element.getGoal()) 
66136          composeReference(null, e);
66137        closeArray();
66138      };
66139      if (element.hasCondition()) {
66140        openArray("condition");
66141        for (RequestOrchestration.RequestOrchestrationActionConditionComponent e : element.getCondition()) 
66142          composeRequestOrchestrationActionConditionComponent(null, e);
66143        closeArray();
66144      };
66145      if (element.hasInput()) {
66146        openArray("input");
66147        for (RequestOrchestration.RequestOrchestrationActionInputComponent e : element.getInput()) 
66148          composeRequestOrchestrationActionInputComponent(null, e);
66149        closeArray();
66150      };
66151      if (element.hasOutput()) {
66152        openArray("output");
66153        for (RequestOrchestration.RequestOrchestrationActionOutputComponent e : element.getOutput()) 
66154          composeRequestOrchestrationActionOutputComponent(null, e);
66155        closeArray();
66156      };
66157      if (element.hasRelatedAction()) {
66158        openArray("relatedAction");
66159        for (RequestOrchestration.RequestOrchestrationActionRelatedActionComponent e : element.getRelatedAction()) 
66160          composeRequestOrchestrationActionRelatedActionComponent(null, e);
66161        closeArray();
66162      };
66163      if (element.hasTiming()) {
66164        composeType("timing", element.getTiming());
66165      }
66166      if (element.hasLocation()) {
66167        composeCodeableReference("location", element.getLocation());
66168      }
66169      if (element.hasParticipant()) {
66170        openArray("participant");
66171        for (RequestOrchestration.RequestOrchestrationActionParticipantComponent e : element.getParticipant()) 
66172          composeRequestOrchestrationActionParticipantComponent(null, e);
66173        closeArray();
66174      };
66175      if (element.hasType()) {
66176        composeCodeableConcept("type", element.getType());
66177      }
66178      if (element.hasGroupingBehaviorElement()) {
66179        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
66180        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
66181      }
66182      if (element.hasSelectionBehaviorElement()) {
66183        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
66184        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
66185      }
66186      if (element.hasRequiredBehaviorElement()) {
66187        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
66188        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
66189      }
66190      if (element.hasPrecheckBehaviorElement()) {
66191        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
66192        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
66193      }
66194      if (element.hasCardinalityBehaviorElement()) {
66195        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
66196        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
66197      }
66198      if (element.hasResource()) {
66199        composeReference("resource", element.getResource());
66200      }
66201      if (element.hasDefinition()) {
66202        composeType("definition", element.getDefinition());
66203      }
66204      if (element.hasTransformElement()) {
66205        composeCanonicalCore("transform", element.getTransformElement(), false);
66206        composeCanonicalExtras("transform", element.getTransformElement(), false);
66207      }
66208      if (element.hasDynamicValue()) {
66209        openArray("dynamicValue");
66210        for (RequestOrchestration.RequestOrchestrationActionDynamicValueComponent e : element.getDynamicValue()) 
66211          composeRequestOrchestrationActionDynamicValueComponent(null, e);
66212        closeArray();
66213      };
66214      if (element.hasAction()) {
66215        openArray("action");
66216        for (RequestOrchestration.RequestOrchestrationActionComponent e : element.getAction()) 
66217          composeRequestOrchestrationActionComponent(null, e);
66218        closeArray();
66219      };
66220  }
66221
66222  protected void composeRequestOrchestrationActionConditionComponent(String name, RequestOrchestration.RequestOrchestrationActionConditionComponent element) throws IOException {
66223    if (element != null) {
66224      open(name);
66225      composeRequestOrchestrationActionConditionComponentProperties(element);
66226      close();
66227    }
66228  }
66229
66230  protected void composeRequestOrchestrationActionConditionComponentProperties(RequestOrchestration.RequestOrchestrationActionConditionComponent element) throws IOException {
66231    composeBackboneElementProperties(element);
66232      if (element.hasKindElement()) {
66233        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
66234        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
66235      }
66236      if (element.hasExpression()) {
66237        composeExpression("expression", element.getExpression());
66238      }
66239  }
66240
66241  protected void composeRequestOrchestrationActionInputComponent(String name, RequestOrchestration.RequestOrchestrationActionInputComponent element) throws IOException {
66242    if (element != null) {
66243      open(name);
66244      composeRequestOrchestrationActionInputComponentProperties(element);
66245      close();
66246    }
66247  }
66248
66249  protected void composeRequestOrchestrationActionInputComponentProperties(RequestOrchestration.RequestOrchestrationActionInputComponent element) throws IOException {
66250    composeBackboneElementProperties(element);
66251      if (element.hasTitleElement()) {
66252        composeStringCore("title", element.getTitleElement(), false);
66253        composeStringExtras("title", element.getTitleElement(), false);
66254      }
66255      if (element.hasRequirement()) {
66256        composeDataRequirement("requirement", element.getRequirement());
66257      }
66258      if (element.hasRelatedDataElement()) {
66259        composeIdCore("relatedData", element.getRelatedDataElement(), false);
66260        composeIdExtras("relatedData", element.getRelatedDataElement(), false);
66261      }
66262  }
66263
66264  protected void composeRequestOrchestrationActionOutputComponent(String name, RequestOrchestration.RequestOrchestrationActionOutputComponent element) throws IOException {
66265    if (element != null) {
66266      open(name);
66267      composeRequestOrchestrationActionOutputComponentProperties(element);
66268      close();
66269    }
66270  }
66271
66272  protected void composeRequestOrchestrationActionOutputComponentProperties(RequestOrchestration.RequestOrchestrationActionOutputComponent element) throws IOException {
66273    composeBackboneElementProperties(element);
66274      if (element.hasTitleElement()) {
66275        composeStringCore("title", element.getTitleElement(), false);
66276        composeStringExtras("title", element.getTitleElement(), false);
66277      }
66278      if (element.hasRequirement()) {
66279        composeDataRequirement("requirement", element.getRequirement());
66280      }
66281      if (element.hasRelatedDataElement()) {
66282        composeStringCore("relatedData", element.getRelatedDataElement(), false);
66283        composeStringExtras("relatedData", element.getRelatedDataElement(), false);
66284      }
66285  }
66286
66287  protected void composeRequestOrchestrationActionRelatedActionComponent(String name, RequestOrchestration.RequestOrchestrationActionRelatedActionComponent element) throws IOException {
66288    if (element != null) {
66289      open(name);
66290      composeRequestOrchestrationActionRelatedActionComponentProperties(element);
66291      close();
66292    }
66293  }
66294
66295  protected void composeRequestOrchestrationActionRelatedActionComponentProperties(RequestOrchestration.RequestOrchestrationActionRelatedActionComponent element) throws IOException {
66296    composeBackboneElementProperties(element);
66297      if (element.hasTargetIdElement()) {
66298        composeIdCore("targetId", element.getTargetIdElement(), false);
66299        composeIdExtras("targetId", element.getTargetIdElement(), false);
66300      }
66301      if (element.hasRelationshipElement()) {
66302        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66303        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66304      }
66305      if (element.hasEndRelationshipElement()) {
66306        composeEnumerationCore("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66307        composeEnumerationExtras("endRelationship", element.getEndRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
66308      }
66309      if (element.hasOffset()) {
66310        composeType("offset", element.getOffset());
66311      }
66312  }
66313
66314  protected void composeRequestOrchestrationActionParticipantComponent(String name, RequestOrchestration.RequestOrchestrationActionParticipantComponent element) throws IOException {
66315    if (element != null) {
66316      open(name);
66317      composeRequestOrchestrationActionParticipantComponentProperties(element);
66318      close();
66319    }
66320  }
66321
66322  protected void composeRequestOrchestrationActionParticipantComponentProperties(RequestOrchestration.RequestOrchestrationActionParticipantComponent element) throws IOException {
66323    composeBackboneElementProperties(element);
66324      if (element.hasTypeElement()) {
66325        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
66326        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
66327      }
66328      if (element.hasTypeCanonicalElement()) {
66329        composeCanonicalCore("typeCanonical", element.getTypeCanonicalElement(), false);
66330        composeCanonicalExtras("typeCanonical", element.getTypeCanonicalElement(), false);
66331      }
66332      if (element.hasTypeReference()) {
66333        composeReference("typeReference", element.getTypeReference());
66334      }
66335      if (element.hasRole()) {
66336        composeCodeableConcept("role", element.getRole());
66337      }
66338      if (element.hasFunction()) {
66339        composeCodeableConcept("function", element.getFunction());
66340      }
66341      if (element.hasActor()) {
66342        composeType("actor", element.getActor());
66343      }
66344  }
66345
66346  protected void composeRequestOrchestrationActionDynamicValueComponent(String name, RequestOrchestration.RequestOrchestrationActionDynamicValueComponent element) throws IOException {
66347    if (element != null) {
66348      open(name);
66349      composeRequestOrchestrationActionDynamicValueComponentProperties(element);
66350      close();
66351    }
66352  }
66353
66354  protected void composeRequestOrchestrationActionDynamicValueComponentProperties(RequestOrchestration.RequestOrchestrationActionDynamicValueComponent element) throws IOException {
66355    composeBackboneElementProperties(element);
66356      if (element.hasPathElement()) {
66357        composeStringCore("path", element.getPathElement(), false);
66358        composeStringExtras("path", element.getPathElement(), false);
66359      }
66360      if (element.hasExpression()) {
66361        composeExpression("expression", element.getExpression());
66362      }
66363  }
66364
66365  protected void composeRequirements(String name, Requirements element) throws IOException {
66366    if (element != null) {
66367      prop("resourceType", name);
66368      composeRequirementsProperties(element);
66369    }
66370  }
66371
66372  protected void composeRequirementsProperties(Requirements element) throws IOException {
66373    composeCanonicalResourceProperties(element);
66374      if (element.hasUrlElement()) {
66375        composeUriCore("url", element.getUrlElement(), false);
66376        composeUriExtras("url", element.getUrlElement(), false);
66377      }
66378      if (element.hasIdentifier()) {
66379        openArray("identifier");
66380        for (Identifier e : element.getIdentifier()) 
66381          composeIdentifier(null, e);
66382        closeArray();
66383      };
66384      if (element.hasVersionElement()) {
66385        composeStringCore("version", element.getVersionElement(), false);
66386        composeStringExtras("version", element.getVersionElement(), false);
66387      }
66388      if (element.hasVersionAlgorithm()) {
66389        composeType("versionAlgorithm", element.getVersionAlgorithm());
66390      }
66391      if (element.hasNameElement()) {
66392        composeStringCore("name", element.getNameElement(), false);
66393        composeStringExtras("name", element.getNameElement(), false);
66394      }
66395      if (element.hasTitleElement()) {
66396        composeStringCore("title", element.getTitleElement(), false);
66397        composeStringExtras("title", element.getTitleElement(), false);
66398      }
66399      if (element.hasStatusElement()) {
66400        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66401        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66402      }
66403      if (element.hasExperimentalElement()) {
66404        composeBooleanCore("experimental", element.getExperimentalElement(), false);
66405        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
66406      }
66407      if (element.hasDateElement()) {
66408        composeDateTimeCore("date", element.getDateElement(), false);
66409        composeDateTimeExtras("date", element.getDateElement(), false);
66410      }
66411      if (element.hasPublisherElement()) {
66412        composeStringCore("publisher", element.getPublisherElement(), false);
66413        composeStringExtras("publisher", element.getPublisherElement(), false);
66414      }
66415      if (element.hasContact()) {
66416        openArray("contact");
66417        for (ContactDetail e : element.getContact()) 
66418          composeContactDetail(null, e);
66419        closeArray();
66420      };
66421      if (element.hasDescriptionElement()) {
66422        composeMarkdownCore("description", element.getDescriptionElement(), false);
66423        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66424      }
66425      if (element.hasUseContext()) {
66426        openArray("useContext");
66427        for (UsageContext e : element.getUseContext()) 
66428          composeUsageContext(null, e);
66429        closeArray();
66430      };
66431      if (element.hasJurisdiction()) {
66432        openArray("jurisdiction");
66433        for (CodeableConcept e : element.getJurisdiction()) 
66434          composeCodeableConcept(null, e);
66435        closeArray();
66436      };
66437      if (element.hasPurposeElement()) {
66438        composeMarkdownCore("purpose", element.getPurposeElement(), false);
66439        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
66440      }
66441      if (element.hasCopyrightElement()) {
66442        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
66443        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
66444      }
66445      if (element.hasCopyrightLabelElement()) {
66446        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
66447        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
66448      }
66449      if (element.hasDerivedFrom()) {
66450        if (anyHasValue(element.getDerivedFrom())) {
66451          openArray("derivedFrom");
66452          for (CanonicalType e : element.getDerivedFrom()) 
66453            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
66454          closeArray();
66455        }
66456        if (anyHasExtras(element.getDerivedFrom())) {
66457          openArray("_derivedFrom");
66458          for (CanonicalType e : element.getDerivedFrom()) 
66459            composeCanonicalExtras(null, e, true);
66460          closeArray();
66461        }
66462      };
66463      if (element.hasReference()) {
66464        if (anyHasValue(element.getReference())) {
66465          openArray("reference");
66466          for (UrlType e : element.getReference()) 
66467            composeUrlCore(null, e, e != element.getReference().get(element.getReference().size()-1));
66468          closeArray();
66469        }
66470        if (anyHasExtras(element.getReference())) {
66471          openArray("_reference");
66472          for (UrlType e : element.getReference()) 
66473            composeUrlExtras(null, e, true);
66474          closeArray();
66475        }
66476      };
66477      if (element.hasActor()) {
66478        if (anyHasValue(element.getActor())) {
66479          openArray("actor");
66480          for (CanonicalType e : element.getActor()) 
66481            composeCanonicalCore(null, e, e != element.getActor().get(element.getActor().size()-1));
66482          closeArray();
66483        }
66484        if (anyHasExtras(element.getActor())) {
66485          openArray("_actor");
66486          for (CanonicalType e : element.getActor()) 
66487            composeCanonicalExtras(null, e, true);
66488          closeArray();
66489        }
66490      };
66491      if (element.hasStatement()) {
66492        openArray("statement");
66493        for (Requirements.RequirementsStatementComponent e : element.getStatement()) 
66494          composeRequirementsStatementComponent(null, e);
66495        closeArray();
66496      };
66497  }
66498
66499  protected void composeRequirementsStatementComponent(String name, Requirements.RequirementsStatementComponent element) throws IOException {
66500    if (element != null) {
66501      open(name);
66502      composeRequirementsStatementComponentProperties(element);
66503      close();
66504    }
66505  }
66506
66507  protected void composeRequirementsStatementComponentProperties(Requirements.RequirementsStatementComponent element) throws IOException {
66508    composeBackboneElementProperties(element);
66509      if (element.hasKeyElement()) {
66510        composeIdCore("key", element.getKeyElement(), false);
66511        composeIdExtras("key", element.getKeyElement(), false);
66512      }
66513      if (element.hasLabelElement()) {
66514        composeStringCore("label", element.getLabelElement(), false);
66515        composeStringExtras("label", element.getLabelElement(), false);
66516      }
66517      if (element.hasConformance()) {
66518        openArray("conformance");
66519        for (Enumeration<Requirements.ConformanceExpectation> e : element.getConformance()) 
66520          composeEnumerationCore(null, e, new Requirements.ConformanceExpectationEnumFactory(), true);
66521        closeArray();
66522        if (anyHasExtras(element.getConformance())) {
66523          openArray("_conformance");
66524          for (Enumeration<Requirements.ConformanceExpectation> e : element.getConformance()) 
66525            composeEnumerationExtras(null, e, new Requirements.ConformanceExpectationEnumFactory(), true);
66526          closeArray();
66527        }
66528      };
66529      if (element.hasConditionalityElement()) {
66530        composeBooleanCore("conditionality", element.getConditionalityElement(), false);
66531        composeBooleanExtras("conditionality", element.getConditionalityElement(), false);
66532      }
66533      if (element.hasRequirementElement()) {
66534        composeMarkdownCore("requirement", element.getRequirementElement(), false);
66535        composeMarkdownExtras("requirement", element.getRequirementElement(), false);
66536      }
66537      if (element.hasDerivedFromElement()) {
66538        composeStringCore("derivedFrom", element.getDerivedFromElement(), false);
66539        composeStringExtras("derivedFrom", element.getDerivedFromElement(), false);
66540      }
66541      if (element.hasParentElement()) {
66542        composeStringCore("parent", element.getParentElement(), false);
66543        composeStringExtras("parent", element.getParentElement(), false);
66544      }
66545      if (element.hasSatisfiedBy()) {
66546        if (anyHasValue(element.getSatisfiedBy())) {
66547          openArray("satisfiedBy");
66548          for (UrlType e : element.getSatisfiedBy()) 
66549            composeUrlCore(null, e, e != element.getSatisfiedBy().get(element.getSatisfiedBy().size()-1));
66550          closeArray();
66551        }
66552        if (anyHasExtras(element.getSatisfiedBy())) {
66553          openArray("_satisfiedBy");
66554          for (UrlType e : element.getSatisfiedBy()) 
66555            composeUrlExtras(null, e, true);
66556          closeArray();
66557        }
66558      };
66559      if (element.hasReference()) {
66560        if (anyHasValue(element.getReference())) {
66561          openArray("reference");
66562          for (UrlType e : element.getReference()) 
66563            composeUrlCore(null, e, e != element.getReference().get(element.getReference().size()-1));
66564          closeArray();
66565        }
66566        if (anyHasExtras(element.getReference())) {
66567          openArray("_reference");
66568          for (UrlType e : element.getReference()) 
66569            composeUrlExtras(null, e, true);
66570          closeArray();
66571        }
66572      };
66573      if (element.hasSource()) {
66574        openArray("source");
66575        for (Reference e : element.getSource()) 
66576          composeReference(null, e);
66577        closeArray();
66578      };
66579  }
66580
66581  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
66582    if (element != null) {
66583      prop("resourceType", name);
66584      composeResearchStudyProperties(element);
66585    }
66586  }
66587
66588  protected void composeResearchStudyProperties(ResearchStudy element) throws IOException {
66589    composeDomainResourceProperties(element);
66590      if (element.hasUrlElement()) {
66591        composeUriCore("url", element.getUrlElement(), false);
66592        composeUriExtras("url", element.getUrlElement(), false);
66593      }
66594      if (element.hasIdentifier()) {
66595        openArray("identifier");
66596        for (Identifier e : element.getIdentifier()) 
66597          composeIdentifier(null, e);
66598        closeArray();
66599      };
66600      if (element.hasVersionElement()) {
66601        composeStringCore("version", element.getVersionElement(), false);
66602        composeStringExtras("version", element.getVersionElement(), false);
66603      }
66604      if (element.hasNameElement()) {
66605        composeStringCore("name", element.getNameElement(), false);
66606        composeStringExtras("name", element.getNameElement(), false);
66607      }
66608      if (element.hasTitleElement()) {
66609        composeStringCore("title", element.getTitleElement(), false);
66610        composeStringExtras("title", element.getTitleElement(), false);
66611      }
66612      if (element.hasLabel()) {
66613        openArray("label");
66614        for (ResearchStudy.ResearchStudyLabelComponent e : element.getLabel()) 
66615          composeResearchStudyLabelComponent(null, e);
66616        closeArray();
66617      };
66618      if (element.hasProtocol()) {
66619        openArray("protocol");
66620        for (Reference e : element.getProtocol()) 
66621          composeReference(null, e);
66622        closeArray();
66623      };
66624      if (element.hasPartOf()) {
66625        openArray("partOf");
66626        for (Reference e : element.getPartOf()) 
66627          composeReference(null, e);
66628        closeArray();
66629      };
66630      if (element.hasRelatedArtifact()) {
66631        openArray("relatedArtifact");
66632        for (RelatedArtifact e : element.getRelatedArtifact()) 
66633          composeRelatedArtifact(null, e);
66634        closeArray();
66635      };
66636      if (element.hasDateElement()) {
66637        composeDateTimeCore("date", element.getDateElement(), false);
66638        composeDateTimeExtras("date", element.getDateElement(), false);
66639      }
66640      if (element.hasStatusElement()) {
66641        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66642        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66643      }
66644      if (element.hasPrimaryPurposeType()) {
66645        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
66646      }
66647      if (element.hasPhase()) {
66648        composeCodeableConcept("phase", element.getPhase());
66649      }
66650      if (element.hasStudyDesign()) {
66651        openArray("studyDesign");
66652        for (CodeableConcept e : element.getStudyDesign()) 
66653          composeCodeableConcept(null, e);
66654        closeArray();
66655      };
66656      if (element.hasFocus()) {
66657        openArray("focus");
66658        for (CodeableReference e : element.getFocus()) 
66659          composeCodeableReference(null, e);
66660        closeArray();
66661      };
66662      if (element.hasCondition()) {
66663        openArray("condition");
66664        for (CodeableConcept e : element.getCondition()) 
66665          composeCodeableConcept(null, e);
66666        closeArray();
66667      };
66668      if (element.hasKeyword()) {
66669        openArray("keyword");
66670        for (CodeableConcept e : element.getKeyword()) 
66671          composeCodeableConcept(null, e);
66672        closeArray();
66673      };
66674      if (element.hasRegion()) {
66675        openArray("region");
66676        for (CodeableConcept e : element.getRegion()) 
66677          composeCodeableConcept(null, e);
66678        closeArray();
66679      };
66680      if (element.hasDescriptionSummaryElement()) {
66681        composeMarkdownCore("descriptionSummary", element.getDescriptionSummaryElement(), false);
66682        composeMarkdownExtras("descriptionSummary", element.getDescriptionSummaryElement(), false);
66683      }
66684      if (element.hasDescriptionElement()) {
66685        composeMarkdownCore("description", element.getDescriptionElement(), false);
66686        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66687      }
66688      if (element.hasPeriod()) {
66689        composePeriod("period", element.getPeriod());
66690      }
66691      if (element.hasSite()) {
66692        openArray("site");
66693        for (Reference e : element.getSite()) 
66694          composeReference(null, e);
66695        closeArray();
66696      };
66697      if (element.hasNote()) {
66698        openArray("note");
66699        for (Annotation e : element.getNote()) 
66700          composeAnnotation(null, e);
66701        closeArray();
66702      };
66703      if (element.hasClassifier()) {
66704        openArray("classifier");
66705        for (CodeableConcept e : element.getClassifier()) 
66706          composeCodeableConcept(null, e);
66707        closeArray();
66708      };
66709      if (element.hasAssociatedParty()) {
66710        openArray("associatedParty");
66711        for (ResearchStudy.ResearchStudyAssociatedPartyComponent e : element.getAssociatedParty()) 
66712          composeResearchStudyAssociatedPartyComponent(null, e);
66713        closeArray();
66714      };
66715      if (element.hasProgressStatus()) {
66716        openArray("progressStatus");
66717        for (ResearchStudy.ResearchStudyProgressStatusComponent e : element.getProgressStatus()) 
66718          composeResearchStudyProgressStatusComponent(null, e);
66719        closeArray();
66720      };
66721      if (element.hasWhyStopped()) {
66722        composeCodeableConcept("whyStopped", element.getWhyStopped());
66723      }
66724      if (element.hasRecruitment()) {
66725        composeResearchStudyRecruitmentComponent("recruitment", element.getRecruitment());
66726      }
66727      if (element.hasComparisonGroup()) {
66728        openArray("comparisonGroup");
66729        for (ResearchStudy.ResearchStudyComparisonGroupComponent e : element.getComparisonGroup()) 
66730          composeResearchStudyComparisonGroupComponent(null, e);
66731        closeArray();
66732      };
66733      if (element.hasObjective()) {
66734        openArray("objective");
66735        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
66736          composeResearchStudyObjectiveComponent(null, e);
66737        closeArray();
66738      };
66739      if (element.hasOutcomeMeasure()) {
66740        openArray("outcomeMeasure");
66741        for (ResearchStudy.ResearchStudyOutcomeMeasureComponent e : element.getOutcomeMeasure()) 
66742          composeResearchStudyOutcomeMeasureComponent(null, e);
66743        closeArray();
66744      };
66745      if (element.hasResult()) {
66746        openArray("result");
66747        for (Reference e : element.getResult()) 
66748          composeReference(null, e);
66749        closeArray();
66750      };
66751  }
66752
66753  protected void composeResearchStudyLabelComponent(String name, ResearchStudy.ResearchStudyLabelComponent element) throws IOException {
66754    if (element != null) {
66755      open(name);
66756      composeResearchStudyLabelComponentProperties(element);
66757      close();
66758    }
66759  }
66760
66761  protected void composeResearchStudyLabelComponentProperties(ResearchStudy.ResearchStudyLabelComponent element) throws IOException {
66762    composeBackboneElementProperties(element);
66763      if (element.hasType()) {
66764        composeCodeableConcept("type", element.getType());
66765      }
66766      if (element.hasValueElement()) {
66767        composeStringCore("value", element.getValueElement(), false);
66768        composeStringExtras("value", element.getValueElement(), false);
66769      }
66770  }
66771
66772  protected void composeResearchStudyAssociatedPartyComponent(String name, ResearchStudy.ResearchStudyAssociatedPartyComponent element) throws IOException {
66773    if (element != null) {
66774      open(name);
66775      composeResearchStudyAssociatedPartyComponentProperties(element);
66776      close();
66777    }
66778  }
66779
66780  protected void composeResearchStudyAssociatedPartyComponentProperties(ResearchStudy.ResearchStudyAssociatedPartyComponent element) throws IOException {
66781    composeBackboneElementProperties(element);
66782      if (element.hasNameElement()) {
66783        composeStringCore("name", element.getNameElement(), false);
66784        composeStringExtras("name", element.getNameElement(), false);
66785      }
66786      if (element.hasRole()) {
66787        composeCodeableConcept("role", element.getRole());
66788      }
66789      if (element.hasPeriod()) {
66790        openArray("period");
66791        for (Period e : element.getPeriod()) 
66792          composePeriod(null, e);
66793        closeArray();
66794      };
66795      if (element.hasClassifier()) {
66796        openArray("classifier");
66797        for (CodeableConcept e : element.getClassifier()) 
66798          composeCodeableConcept(null, e);
66799        closeArray();
66800      };
66801      if (element.hasParty()) {
66802        composeReference("party", element.getParty());
66803      }
66804  }
66805
66806  protected void composeResearchStudyProgressStatusComponent(String name, ResearchStudy.ResearchStudyProgressStatusComponent element) throws IOException {
66807    if (element != null) {
66808      open(name);
66809      composeResearchStudyProgressStatusComponentProperties(element);
66810      close();
66811    }
66812  }
66813
66814  protected void composeResearchStudyProgressStatusComponentProperties(ResearchStudy.ResearchStudyProgressStatusComponent element) throws IOException {
66815    composeBackboneElementProperties(element);
66816      if (element.hasState()) {
66817        composeCodeableConcept("state", element.getState());
66818      }
66819      if (element.hasActualElement()) {
66820        composeBooleanCore("actual", element.getActualElement(), false);
66821        composeBooleanExtras("actual", element.getActualElement(), false);
66822      }
66823      if (element.hasPeriod()) {
66824        composePeriod("period", element.getPeriod());
66825      }
66826  }
66827
66828  protected void composeResearchStudyRecruitmentComponent(String name, ResearchStudy.ResearchStudyRecruitmentComponent element) throws IOException {
66829    if (element != null) {
66830      open(name);
66831      composeResearchStudyRecruitmentComponentProperties(element);
66832      close();
66833    }
66834  }
66835
66836  protected void composeResearchStudyRecruitmentComponentProperties(ResearchStudy.ResearchStudyRecruitmentComponent element) throws IOException {
66837    composeBackboneElementProperties(element);
66838      if (element.hasTargetNumberElement()) {
66839        composeUnsignedIntCore("targetNumber", element.getTargetNumberElement(), false);
66840        composeUnsignedIntExtras("targetNumber", element.getTargetNumberElement(), false);
66841      }
66842      if (element.hasActualNumberElement()) {
66843        composeUnsignedIntCore("actualNumber", element.getActualNumberElement(), false);
66844        composeUnsignedIntExtras("actualNumber", element.getActualNumberElement(), false);
66845      }
66846      if (element.hasEligibility()) {
66847        composeReference("eligibility", element.getEligibility());
66848      }
66849      if (element.hasActualGroup()) {
66850        composeReference("actualGroup", element.getActualGroup());
66851      }
66852  }
66853
66854  protected void composeResearchStudyComparisonGroupComponent(String name, ResearchStudy.ResearchStudyComparisonGroupComponent element) throws IOException {
66855    if (element != null) {
66856      open(name);
66857      composeResearchStudyComparisonGroupComponentProperties(element);
66858      close();
66859    }
66860  }
66861
66862  protected void composeResearchStudyComparisonGroupComponentProperties(ResearchStudy.ResearchStudyComparisonGroupComponent element) throws IOException {
66863    composeBackboneElementProperties(element);
66864      if (element.hasLinkIdElement()) {
66865        composeIdCore("linkId", element.getLinkIdElement(), false);
66866        composeIdExtras("linkId", element.getLinkIdElement(), false);
66867      }
66868      if (element.hasNameElement()) {
66869        composeStringCore("name", element.getNameElement(), false);
66870        composeStringExtras("name", element.getNameElement(), false);
66871      }
66872      if (element.hasType()) {
66873        composeCodeableConcept("type", element.getType());
66874      }
66875      if (element.hasDescriptionElement()) {
66876        composeMarkdownCore("description", element.getDescriptionElement(), false);
66877        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66878      }
66879      if (element.hasIntendedExposure()) {
66880        openArray("intendedExposure");
66881        for (Reference e : element.getIntendedExposure()) 
66882          composeReference(null, e);
66883        closeArray();
66884      };
66885      if (element.hasObservedGroup()) {
66886        composeReference("observedGroup", element.getObservedGroup());
66887      }
66888  }
66889
66890  protected void composeResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
66891    if (element != null) {
66892      open(name);
66893      composeResearchStudyObjectiveComponentProperties(element);
66894      close();
66895    }
66896  }
66897
66898  protected void composeResearchStudyObjectiveComponentProperties(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
66899    composeBackboneElementProperties(element);
66900      if (element.hasNameElement()) {
66901        composeStringCore("name", element.getNameElement(), false);
66902        composeStringExtras("name", element.getNameElement(), false);
66903      }
66904      if (element.hasType()) {
66905        composeCodeableConcept("type", element.getType());
66906      }
66907      if (element.hasDescriptionElement()) {
66908        composeMarkdownCore("description", element.getDescriptionElement(), false);
66909        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66910      }
66911  }
66912
66913  protected void composeResearchStudyOutcomeMeasureComponent(String name, ResearchStudy.ResearchStudyOutcomeMeasureComponent element) throws IOException {
66914    if (element != null) {
66915      open(name);
66916      composeResearchStudyOutcomeMeasureComponentProperties(element);
66917      close();
66918    }
66919  }
66920
66921  protected void composeResearchStudyOutcomeMeasureComponentProperties(ResearchStudy.ResearchStudyOutcomeMeasureComponent element) throws IOException {
66922    composeBackboneElementProperties(element);
66923      if (element.hasNameElement()) {
66924        composeStringCore("name", element.getNameElement(), false);
66925        composeStringExtras("name", element.getNameElement(), false);
66926      }
66927      if (element.hasType()) {
66928        openArray("type");
66929        for (CodeableConcept e : element.getType()) 
66930          composeCodeableConcept(null, e);
66931        closeArray();
66932      };
66933      if (element.hasDescriptionElement()) {
66934        composeMarkdownCore("description", element.getDescriptionElement(), false);
66935        composeMarkdownExtras("description", element.getDescriptionElement(), false);
66936      }
66937      if (element.hasReference()) {
66938        composeReference("reference", element.getReference());
66939      }
66940  }
66941
66942  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
66943    if (element != null) {
66944      prop("resourceType", name);
66945      composeResearchSubjectProperties(element);
66946    }
66947  }
66948
66949  protected void composeResearchSubjectProperties(ResearchSubject element) throws IOException {
66950    composeDomainResourceProperties(element);
66951      if (element.hasIdentifier()) {
66952        openArray("identifier");
66953        for (Identifier e : element.getIdentifier()) 
66954          composeIdentifier(null, e);
66955        closeArray();
66956      };
66957      if (element.hasStatusElement()) {
66958        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66959        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
66960      }
66961      if (element.hasProgress()) {
66962        openArray("progress");
66963        for (ResearchSubject.ResearchSubjectProgressComponent e : element.getProgress()) 
66964          composeResearchSubjectProgressComponent(null, e);
66965        closeArray();
66966      };
66967      if (element.hasPeriod()) {
66968        composePeriod("period", element.getPeriod());
66969      }
66970      if (element.hasStudy()) {
66971        composeReference("study", element.getStudy());
66972      }
66973      if (element.hasSubject()) {
66974        composeReference("subject", element.getSubject());
66975      }
66976      if (element.hasAssignedComparisonGroupElement()) {
66977        composeIdCore("assignedComparisonGroup", element.getAssignedComparisonGroupElement(), false);
66978        composeIdExtras("assignedComparisonGroup", element.getAssignedComparisonGroupElement(), false);
66979      }
66980      if (element.hasActualComparisonGroupElement()) {
66981        composeIdCore("actualComparisonGroup", element.getActualComparisonGroupElement(), false);
66982        composeIdExtras("actualComparisonGroup", element.getActualComparisonGroupElement(), false);
66983      }
66984      if (element.hasConsent()) {
66985        openArray("consent");
66986        for (Reference e : element.getConsent()) 
66987          composeReference(null, e);
66988        closeArray();
66989      };
66990  }
66991
66992  protected void composeResearchSubjectProgressComponent(String name, ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
66993    if (element != null) {
66994      open(name);
66995      composeResearchSubjectProgressComponentProperties(element);
66996      close();
66997    }
66998  }
66999
67000  protected void composeResearchSubjectProgressComponentProperties(ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
67001    composeBackboneElementProperties(element);
67002      if (element.hasType()) {
67003        composeCodeableConcept("type", element.getType());
67004      }
67005      if (element.hasSubjectState()) {
67006        composeCodeableConcept("subjectState", element.getSubjectState());
67007      }
67008      if (element.hasMilestone()) {
67009        composeCodeableConcept("milestone", element.getMilestone());
67010      }
67011      if (element.hasReason()) {
67012        composeCodeableConcept("reason", element.getReason());
67013      }
67014      if (element.hasStartDateElement()) {
67015        composeDateTimeCore("startDate", element.getStartDateElement(), false);
67016        composeDateTimeExtras("startDate", element.getStartDateElement(), false);
67017      }
67018      if (element.hasEndDateElement()) {
67019        composeDateTimeCore("endDate", element.getEndDateElement(), false);
67020        composeDateTimeExtras("endDate", element.getEndDateElement(), false);
67021      }
67022  }
67023
67024  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
67025    if (element != null) {
67026      prop("resourceType", name);
67027      composeRiskAssessmentProperties(element);
67028    }
67029  }
67030
67031  protected void composeRiskAssessmentProperties(RiskAssessment element) throws IOException {
67032    composeDomainResourceProperties(element);
67033      if (element.hasIdentifier()) {
67034        openArray("identifier");
67035        for (Identifier e : element.getIdentifier()) 
67036          composeIdentifier(null, e);
67037        closeArray();
67038      };
67039      if (element.hasBasedOn()) {
67040        composeReference("basedOn", element.getBasedOn());
67041      }
67042      if (element.hasParent()) {
67043        composeReference("parent", element.getParent());
67044      }
67045      if (element.hasStatusElement()) {
67046        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
67047        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
67048      }
67049      if (element.hasMethod()) {
67050        composeCodeableConcept("method", element.getMethod());
67051      }
67052      if (element.hasCode()) {
67053        composeCodeableConcept("code", element.getCode());
67054      }
67055      if (element.hasSubject()) {
67056        composeReference("subject", element.getSubject());
67057      }
67058      if (element.hasEncounter()) {
67059        composeReference("encounter", element.getEncounter());
67060      }
67061      if (element.hasOccurrence()) {
67062        composeType("occurrence", element.getOccurrence());
67063      }
67064      if (element.hasCondition()) {
67065        composeReference("condition", element.getCondition());
67066      }
67067      if (element.hasPerformer()) {
67068        composeReference("performer", element.getPerformer());
67069      }
67070      if (element.hasReason()) {
67071        openArray("reason");
67072        for (CodeableReference e : element.getReason()) 
67073          composeCodeableReference(null, e);
67074        closeArray();
67075      };
67076      if (element.hasBasis()) {
67077        openArray("basis");
67078        for (Reference e : element.getBasis()) 
67079          composeReference(null, e);
67080        closeArray();
67081      };
67082      if (element.hasPrediction()) {
67083        openArray("prediction");
67084        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
67085          composeRiskAssessmentPredictionComponent(null, e);
67086        closeArray();
67087      };
67088      if (element.hasMitigationElement()) {
67089        composeStringCore("mitigation", element.getMitigationElement(), false);
67090        composeStringExtras("mitigation", element.getMitigationElement(), false);
67091      }
67092      if (element.hasNote()) {
67093        openArray("note");
67094        for (Annotation e : element.getNote()) 
67095          composeAnnotation(null, e);
67096        closeArray();
67097      };
67098  }
67099
67100  protected void composeRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
67101    if (element != null) {
67102      open(name);
67103      composeRiskAssessmentPredictionComponentProperties(element);
67104      close();
67105    }
67106  }
67107
67108  protected void composeRiskAssessmentPredictionComponentProperties(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
67109    composeBackboneElementProperties(element);
67110      if (element.hasOutcome()) {
67111        composeCodeableConcept("outcome", element.getOutcome());
67112      }
67113      if (element.hasProbability()) {
67114        composeType("probability", element.getProbability());
67115      }
67116      if (element.hasQualitativeRisk()) {
67117        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
67118      }
67119      if (element.hasRelativeRiskElement()) {
67120        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
67121        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
67122      }
67123      if (element.hasWhen()) {
67124        composeType("when", element.getWhen());
67125      }
67126      if (element.hasRationaleElement()) {
67127        composeStringCore("rationale", element.getRationaleElement(), false);
67128        composeStringExtras("rationale", element.getRationaleElement(), false);
67129      }
67130  }
67131
67132  protected void composeSchedule(String name, Schedule element) throws IOException {
67133    if (element != null) {
67134      prop("resourceType", name);
67135      composeScheduleProperties(element);
67136    }
67137  }
67138
67139  protected void composeScheduleProperties(Schedule element) throws IOException {
67140    composeDomainResourceProperties(element);
67141      if (element.hasIdentifier()) {
67142        openArray("identifier");
67143        for (Identifier e : element.getIdentifier()) 
67144          composeIdentifier(null, e);
67145        closeArray();
67146      };
67147      if (element.hasActiveElement()) {
67148        composeBooleanCore("active", element.getActiveElement(), false);
67149        composeBooleanExtras("active", element.getActiveElement(), false);
67150      }
67151      if (element.hasServiceCategory()) {
67152        openArray("serviceCategory");
67153        for (CodeableConcept e : element.getServiceCategory()) 
67154          composeCodeableConcept(null, e);
67155        closeArray();
67156      };
67157      if (element.hasServiceType()) {
67158        openArray("serviceType");
67159        for (CodeableReference e : element.getServiceType()) 
67160          composeCodeableReference(null, e);
67161        closeArray();
67162      };
67163      if (element.hasSpecialty()) {
67164        openArray("specialty");
67165        for (CodeableConcept e : element.getSpecialty()) 
67166          composeCodeableConcept(null, e);
67167        closeArray();
67168      };
67169      if (element.hasNameElement()) {
67170        composeStringCore("name", element.getNameElement(), false);
67171        composeStringExtras("name", element.getNameElement(), false);
67172      }
67173      if (element.hasActor()) {
67174        openArray("actor");
67175        for (Reference e : element.getActor()) 
67176          composeReference(null, e);
67177        closeArray();
67178      };
67179      if (element.hasPlanningHorizon()) {
67180        composePeriod("planningHorizon", element.getPlanningHorizon());
67181      }
67182      if (element.hasCommentElement()) {
67183        composeMarkdownCore("comment", element.getCommentElement(), false);
67184        composeMarkdownExtras("comment", element.getCommentElement(), false);
67185      }
67186  }
67187
67188  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
67189    if (element != null) {
67190      prop("resourceType", name);
67191      composeSearchParameterProperties(element);
67192    }
67193  }
67194
67195  protected void composeSearchParameterProperties(SearchParameter element) throws IOException {
67196    composeCanonicalResourceProperties(element);
67197      if (element.hasUrlElement()) {
67198        composeUriCore("url", element.getUrlElement(), false);
67199        composeUriExtras("url", element.getUrlElement(), false);
67200      }
67201      if (element.hasIdentifier()) {
67202        openArray("identifier");
67203        for (Identifier e : element.getIdentifier()) 
67204          composeIdentifier(null, e);
67205        closeArray();
67206      };
67207      if (element.hasVersionElement()) {
67208        composeStringCore("version", element.getVersionElement(), false);
67209        composeStringExtras("version", element.getVersionElement(), false);
67210      }
67211      if (element.hasVersionAlgorithm()) {
67212        composeType("versionAlgorithm", element.getVersionAlgorithm());
67213      }
67214      if (element.hasNameElement()) {
67215        composeStringCore("name", element.getNameElement(), false);
67216        composeStringExtras("name", element.getNameElement(), false);
67217      }
67218      if (element.hasTitleElement()) {
67219        composeStringCore("title", element.getTitleElement(), false);
67220        composeStringExtras("title", element.getTitleElement(), false);
67221      }
67222      if (element.hasDerivedFromElement()) {
67223        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
67224        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
67225      }
67226      if (element.hasStatusElement()) {
67227        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67228        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67229      }
67230      if (element.hasExperimentalElement()) {
67231        composeBooleanCore("experimental", element.getExperimentalElement(), false);
67232        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
67233      }
67234      if (element.hasDateElement()) {
67235        composeDateTimeCore("date", element.getDateElement(), false);
67236        composeDateTimeExtras("date", element.getDateElement(), false);
67237      }
67238      if (element.hasPublisherElement()) {
67239        composeStringCore("publisher", element.getPublisherElement(), false);
67240        composeStringExtras("publisher", element.getPublisherElement(), false);
67241      }
67242      if (element.hasContact()) {
67243        openArray("contact");
67244        for (ContactDetail e : element.getContact()) 
67245          composeContactDetail(null, e);
67246        closeArray();
67247      };
67248      if (element.hasDescriptionElement()) {
67249        composeMarkdownCore("description", element.getDescriptionElement(), false);
67250        composeMarkdownExtras("description", element.getDescriptionElement(), false);
67251      }
67252      if (element.hasUseContext()) {
67253        openArray("useContext");
67254        for (UsageContext e : element.getUseContext()) 
67255          composeUsageContext(null, e);
67256        closeArray();
67257      };
67258      if (element.hasJurisdiction()) {
67259        openArray("jurisdiction");
67260        for (CodeableConcept e : element.getJurisdiction()) 
67261          composeCodeableConcept(null, e);
67262        closeArray();
67263      };
67264      if (element.hasPurposeElement()) {
67265        composeMarkdownCore("purpose", element.getPurposeElement(), false);
67266        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
67267      }
67268      if (element.hasCopyrightElement()) {
67269        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
67270        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
67271      }
67272      if (element.hasCopyrightLabelElement()) {
67273        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
67274        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
67275      }
67276      if (element.hasCodeElement()) {
67277        composeCodeCore("code", element.getCodeElement(), false);
67278        composeCodeExtras("code", element.getCodeElement(), false);
67279      }
67280      if (element.hasBase()) {
67281        openArray("base");
67282        for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getBase()) 
67283          composeEnumerationCore(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67284        closeArray();
67285        if (anyHasExtras(element.getBase())) {
67286          openArray("_base");
67287          for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getBase()) 
67288            composeEnumerationExtras(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67289          closeArray();
67290        }
67291      };
67292      if (element.hasTypeElement()) {
67293        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
67294        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
67295      }
67296      if (element.hasExpressionElement()) {
67297        composeStringCore("expression", element.getExpressionElement(), false);
67298        composeStringExtras("expression", element.getExpressionElement(), false);
67299      }
67300      if (element.hasProcessingModeElement()) {
67301        composeEnumerationCore("processingMode", element.getProcessingModeElement(), new SearchParameter.SearchProcessingModeTypeEnumFactory(), false);
67302        composeEnumerationExtras("processingMode", element.getProcessingModeElement(), new SearchParameter.SearchProcessingModeTypeEnumFactory(), false);
67303      }
67304      if (element.hasConstraintElement()) {
67305        composeStringCore("constraint", element.getConstraintElement(), false);
67306        composeStringExtras("constraint", element.getConstraintElement(), false);
67307      }
67308      if (element.hasTarget()) {
67309        openArray("target");
67310        for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getTarget()) 
67311          composeEnumerationCore(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67312        closeArray();
67313        if (anyHasExtras(element.getTarget())) {
67314          openArray("_target");
67315          for (Enumeration<Enumerations.VersionIndependentResourceTypesAll> e : element.getTarget()) 
67316            composeEnumerationExtras(null, e, new Enumerations.VersionIndependentResourceTypesAllEnumFactory(), true);
67317          closeArray();
67318        }
67319      };
67320      if (element.hasMultipleOrElement()) {
67321        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
67322        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
67323      }
67324      if (element.hasMultipleAndElement()) {
67325        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
67326        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
67327      }
67328      if (element.hasComparator()) {
67329        openArray("comparator");
67330        for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
67331          composeEnumerationCore(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
67332        closeArray();
67333        if (anyHasExtras(element.getComparator())) {
67334          openArray("_comparator");
67335          for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
67336            composeEnumerationExtras(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
67337          closeArray();
67338        }
67339      };
67340      if (element.hasModifier()) {
67341        openArray("modifier");
67342        for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
67343          composeEnumerationCore(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
67344        closeArray();
67345        if (anyHasExtras(element.getModifier())) {
67346          openArray("_modifier");
67347          for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
67348            composeEnumerationExtras(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
67349          closeArray();
67350        }
67351      };
67352      if (element.hasChain()) {
67353        if (anyHasValue(element.getChain())) {
67354          openArray("chain");
67355          for (StringType e : element.getChain()) 
67356            composeStringCore(null, e, e != element.getChain().get(element.getChain().size()-1));
67357          closeArray();
67358        }
67359        if (anyHasExtras(element.getChain())) {
67360          openArray("_chain");
67361          for (StringType e : element.getChain()) 
67362            composeStringExtras(null, e, true);
67363          closeArray();
67364        }
67365      };
67366      if (element.hasComponent()) {
67367        openArray("component");
67368        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
67369          composeSearchParameterComponentComponent(null, e);
67370        closeArray();
67371      };
67372  }
67373
67374  protected void composeSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
67375    if (element != null) {
67376      open(name);
67377      composeSearchParameterComponentComponentProperties(element);
67378      close();
67379    }
67380  }
67381
67382  protected void composeSearchParameterComponentComponentProperties(SearchParameter.SearchParameterComponentComponent element) throws IOException {
67383    composeBackboneElementProperties(element);
67384      if (element.hasDefinitionElement()) {
67385        composeCanonicalCore("definition", element.getDefinitionElement(), false);
67386        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
67387      }
67388      if (element.hasExpressionElement()) {
67389        composeStringCore("expression", element.getExpressionElement(), false);
67390        composeStringExtras("expression", element.getExpressionElement(), false);
67391      }
67392  }
67393
67394  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
67395    if (element != null) {
67396      prop("resourceType", name);
67397      composeServiceRequestProperties(element);
67398    }
67399  }
67400
67401  protected void composeServiceRequestProperties(ServiceRequest element) throws IOException {
67402    composeDomainResourceProperties(element);
67403      if (element.hasIdentifier()) {
67404        openArray("identifier");
67405        for (Identifier e : element.getIdentifier()) 
67406          composeIdentifier(null, e);
67407        closeArray();
67408      };
67409      if (element.hasInstantiatesCanonical()) {
67410        if (anyHasValue(element.getInstantiatesCanonical())) {
67411          openArray("instantiatesCanonical");
67412          for (CanonicalType e : element.getInstantiatesCanonical()) 
67413            composeCanonicalCore(null, e, e != element.getInstantiatesCanonical().get(element.getInstantiatesCanonical().size()-1));
67414          closeArray();
67415        }
67416        if (anyHasExtras(element.getInstantiatesCanonical())) {
67417          openArray("_instantiatesCanonical");
67418          for (CanonicalType e : element.getInstantiatesCanonical()) 
67419            composeCanonicalExtras(null, e, true);
67420          closeArray();
67421        }
67422      };
67423      if (element.hasInstantiatesUri()) {
67424        if (anyHasValue(element.getInstantiatesUri())) {
67425          openArray("instantiatesUri");
67426          for (UriType e : element.getInstantiatesUri()) 
67427            composeUriCore(null, e, e != element.getInstantiatesUri().get(element.getInstantiatesUri().size()-1));
67428          closeArray();
67429        }
67430        if (anyHasExtras(element.getInstantiatesUri())) {
67431          openArray("_instantiatesUri");
67432          for (UriType e : element.getInstantiatesUri()) 
67433            composeUriExtras(null, e, true);
67434          closeArray();
67435        }
67436      };
67437      if (element.hasBasedOn()) {
67438        openArray("basedOn");
67439        for (Reference e : element.getBasedOn()) 
67440          composeReference(null, e);
67441        closeArray();
67442      };
67443      if (element.hasReplaces()) {
67444        openArray("replaces");
67445        for (Reference e : element.getReplaces()) 
67446          composeReference(null, e);
67447        closeArray();
67448      };
67449      if (element.hasRequisition()) {
67450        composeIdentifier("requisition", element.getRequisition());
67451      }
67452      if (element.hasStatusElement()) {
67453        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
67454        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
67455      }
67456      if (element.hasIntentElement()) {
67457        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
67458        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
67459      }
67460      if (element.hasCategory()) {
67461        openArray("category");
67462        for (CodeableConcept e : element.getCategory()) 
67463          composeCodeableConcept(null, e);
67464        closeArray();
67465      };
67466      if (element.hasPriorityElement()) {
67467        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
67468        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
67469      }
67470      if (element.hasDoNotPerformElement()) {
67471        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
67472        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
67473      }
67474      if (element.hasCode()) {
67475        composeCodeableReference("code", element.getCode());
67476      }
67477      if (element.hasOrderDetail()) {
67478        openArray("orderDetail");
67479        for (ServiceRequest.ServiceRequestOrderDetailComponent e : element.getOrderDetail()) 
67480          composeServiceRequestOrderDetailComponent(null, e);
67481        closeArray();
67482      };
67483      if (element.hasQuantity()) {
67484        composeType("quantity", element.getQuantity());
67485      }
67486      if (element.hasSubject()) {
67487        composeReference("subject", element.getSubject());
67488      }
67489      if (element.hasFocus()) {
67490        openArray("focus");
67491        for (Reference e : element.getFocus()) 
67492          composeReference(null, e);
67493        closeArray();
67494      };
67495      if (element.hasEncounter()) {
67496        composeReference("encounter", element.getEncounter());
67497      }
67498      if (element.hasOccurrence()) {
67499        composeType("occurrence", element.getOccurrence());
67500      }
67501      if (element.hasAsNeeded()) {
67502        composeType("asNeeded", element.getAsNeeded());
67503      }
67504      if (element.hasAuthoredOnElement()) {
67505        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
67506        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
67507      }
67508      if (element.hasRequester()) {
67509        composeReference("requester", element.getRequester());
67510      }
67511      if (element.hasPerformerType()) {
67512        composeCodeableConcept("performerType", element.getPerformerType());
67513      }
67514      if (element.hasPerformer()) {
67515        openArray("performer");
67516        for (Reference e : element.getPerformer()) 
67517          composeReference(null, e);
67518        closeArray();
67519      };
67520      if (element.hasLocation()) {
67521        openArray("location");
67522        for (CodeableReference e : element.getLocation()) 
67523          composeCodeableReference(null, e);
67524        closeArray();
67525      };
67526      if (element.hasReason()) {
67527        openArray("reason");
67528        for (CodeableReference e : element.getReason()) 
67529          composeCodeableReference(null, e);
67530        closeArray();
67531      };
67532      if (element.hasInsurance()) {
67533        openArray("insurance");
67534        for (Reference e : element.getInsurance()) 
67535          composeReference(null, e);
67536        closeArray();
67537      };
67538      if (element.hasSupportingInfo()) {
67539        openArray("supportingInfo");
67540        for (CodeableReference e : element.getSupportingInfo()) 
67541          composeCodeableReference(null, e);
67542        closeArray();
67543      };
67544      if (element.hasSpecimen()) {
67545        openArray("specimen");
67546        for (Reference e : element.getSpecimen()) 
67547          composeReference(null, e);
67548        closeArray();
67549      };
67550      if (element.hasBodySite()) {
67551        openArray("bodySite");
67552        for (CodeableConcept e : element.getBodySite()) 
67553          composeCodeableConcept(null, e);
67554        closeArray();
67555      };
67556      if (element.hasBodyStructure()) {
67557        composeReference("bodyStructure", element.getBodyStructure());
67558      }
67559      if (element.hasNote()) {
67560        openArray("note");
67561        for (Annotation e : element.getNote()) 
67562          composeAnnotation(null, e);
67563        closeArray();
67564      };
67565      if (element.hasPatientInstruction()) {
67566        openArray("patientInstruction");
67567        for (ServiceRequest.ServiceRequestPatientInstructionComponent e : element.getPatientInstruction()) 
67568          composeServiceRequestPatientInstructionComponent(null, e);
67569        closeArray();
67570      };
67571      if (element.hasRelevantHistory()) {
67572        openArray("relevantHistory");
67573        for (Reference e : element.getRelevantHistory()) 
67574          composeReference(null, e);
67575        closeArray();
67576      };
67577  }
67578
67579  protected void composeServiceRequestOrderDetailComponent(String name, ServiceRequest.ServiceRequestOrderDetailComponent element) throws IOException {
67580    if (element != null) {
67581      open(name);
67582      composeServiceRequestOrderDetailComponentProperties(element);
67583      close();
67584    }
67585  }
67586
67587  protected void composeServiceRequestOrderDetailComponentProperties(ServiceRequest.ServiceRequestOrderDetailComponent element) throws IOException {
67588    composeBackboneElementProperties(element);
67589      if (element.hasParameterFocus()) {
67590        composeCodeableReference("parameterFocus", element.getParameterFocus());
67591      }
67592      if (element.hasParameter()) {
67593        openArray("parameter");
67594        for (ServiceRequest.ServiceRequestOrderDetailParameterComponent e : element.getParameter()) 
67595          composeServiceRequestOrderDetailParameterComponent(null, e);
67596        closeArray();
67597      };
67598  }
67599
67600  protected void composeServiceRequestOrderDetailParameterComponent(String name, ServiceRequest.ServiceRequestOrderDetailParameterComponent element) throws IOException {
67601    if (element != null) {
67602      open(name);
67603      composeServiceRequestOrderDetailParameterComponentProperties(element);
67604      close();
67605    }
67606  }
67607
67608  protected void composeServiceRequestOrderDetailParameterComponentProperties(ServiceRequest.ServiceRequestOrderDetailParameterComponent element) throws IOException {
67609    composeBackboneElementProperties(element);
67610      if (element.hasCode()) {
67611        composeCodeableConcept("code", element.getCode());
67612      }
67613      if (element.hasValue()) {
67614        composeType("value", element.getValue());
67615      }
67616  }
67617
67618  protected void composeServiceRequestPatientInstructionComponent(String name, ServiceRequest.ServiceRequestPatientInstructionComponent element) throws IOException {
67619    if (element != null) {
67620      open(name);
67621      composeServiceRequestPatientInstructionComponentProperties(element);
67622      close();
67623    }
67624  }
67625
67626  protected void composeServiceRequestPatientInstructionComponentProperties(ServiceRequest.ServiceRequestPatientInstructionComponent element) throws IOException {
67627    composeBackboneElementProperties(element);
67628      if (element.hasInstruction()) {
67629        composeType("instruction", element.getInstruction());
67630      }
67631  }
67632
67633  protected void composeSlot(String name, Slot element) throws IOException {
67634    if (element != null) {
67635      prop("resourceType", name);
67636      composeSlotProperties(element);
67637    }
67638  }
67639
67640  protected void composeSlotProperties(Slot element) throws IOException {
67641    composeDomainResourceProperties(element);
67642      if (element.hasIdentifier()) {
67643        openArray("identifier");
67644        for (Identifier e : element.getIdentifier()) 
67645          composeIdentifier(null, e);
67646        closeArray();
67647      };
67648      if (element.hasServiceCategory()) {
67649        openArray("serviceCategory");
67650        for (CodeableConcept e : element.getServiceCategory()) 
67651          composeCodeableConcept(null, e);
67652        closeArray();
67653      };
67654      if (element.hasServiceType()) {
67655        openArray("serviceType");
67656        for (CodeableReference e : element.getServiceType()) 
67657          composeCodeableReference(null, e);
67658        closeArray();
67659      };
67660      if (element.hasSpecialty()) {
67661        openArray("specialty");
67662        for (CodeableConcept e : element.getSpecialty()) 
67663          composeCodeableConcept(null, e);
67664        closeArray();
67665      };
67666      if (element.hasAppointmentType()) {
67667        openArray("appointmentType");
67668        for (CodeableConcept e : element.getAppointmentType()) 
67669          composeCodeableConcept(null, e);
67670        closeArray();
67671      };
67672      if (element.hasSchedule()) {
67673        composeReference("schedule", element.getSchedule());
67674      }
67675      if (element.hasStatusElement()) {
67676        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
67677        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
67678      }
67679      if (element.hasStartElement()) {
67680        composeInstantCore("start", element.getStartElement(), false);
67681        composeInstantExtras("start", element.getStartElement(), false);
67682      }
67683      if (element.hasEndElement()) {
67684        composeInstantCore("end", element.getEndElement(), false);
67685        composeInstantExtras("end", element.getEndElement(), false);
67686      }
67687      if (element.hasOverbookedElement()) {
67688        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
67689        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
67690      }
67691      if (element.hasCommentElement()) {
67692        composeStringCore("comment", element.getCommentElement(), false);
67693        composeStringExtras("comment", element.getCommentElement(), false);
67694      }
67695  }
67696
67697  protected void composeSpecimen(String name, Specimen element) throws IOException {
67698    if (element != null) {
67699      prop("resourceType", name);
67700      composeSpecimenProperties(element);
67701    }
67702  }
67703
67704  protected void composeSpecimenProperties(Specimen element) throws IOException {
67705    composeDomainResourceProperties(element);
67706      if (element.hasIdentifier()) {
67707        openArray("identifier");
67708        for (Identifier e : element.getIdentifier()) 
67709          composeIdentifier(null, e);
67710        closeArray();
67711      };
67712      if (element.hasAccessionIdentifier()) {
67713        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
67714      }
67715      if (element.hasStatusElement()) {
67716        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
67717        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
67718      }
67719      if (element.hasType()) {
67720        composeCodeableConcept("type", element.getType());
67721      }
67722      if (element.hasSubject()) {
67723        composeReference("subject", element.getSubject());
67724      }
67725      if (element.hasReceivedTimeElement()) {
67726        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
67727        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
67728      }
67729      if (element.hasParent()) {
67730        openArray("parent");
67731        for (Reference e : element.getParent()) 
67732          composeReference(null, e);
67733        closeArray();
67734      };
67735      if (element.hasRequest()) {
67736        openArray("request");
67737        for (Reference e : element.getRequest()) 
67738          composeReference(null, e);
67739        closeArray();
67740      };
67741      if (element.hasCombinedElement()) {
67742        composeEnumerationCore("combined", element.getCombinedElement(), new Specimen.SpecimenCombinedEnumFactory(), false);
67743        composeEnumerationExtras("combined", element.getCombinedElement(), new Specimen.SpecimenCombinedEnumFactory(), false);
67744      }
67745      if (element.hasRole()) {
67746        openArray("role");
67747        for (CodeableConcept e : element.getRole()) 
67748          composeCodeableConcept(null, e);
67749        closeArray();
67750      };
67751      if (element.hasFeature()) {
67752        openArray("feature");
67753        for (Specimen.SpecimenFeatureComponent e : element.getFeature()) 
67754          composeSpecimenFeatureComponent(null, e);
67755        closeArray();
67756      };
67757      if (element.hasCollection()) {
67758        composeSpecimenCollectionComponent("collection", element.getCollection());
67759      }
67760      if (element.hasProcessing()) {
67761        openArray("processing");
67762        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
67763          composeSpecimenProcessingComponent(null, e);
67764        closeArray();
67765      };
67766      if (element.hasContainer()) {
67767        openArray("container");
67768        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
67769          composeSpecimenContainerComponent(null, e);
67770        closeArray();
67771      };
67772      if (element.hasCondition()) {
67773        openArray("condition");
67774        for (CodeableConcept e : element.getCondition()) 
67775          composeCodeableConcept(null, e);
67776        closeArray();
67777      };
67778      if (element.hasNote()) {
67779        openArray("note");
67780        for (Annotation e : element.getNote()) 
67781          composeAnnotation(null, e);
67782        closeArray();
67783      };
67784  }
67785
67786  protected void composeSpecimenFeatureComponent(String name, Specimen.SpecimenFeatureComponent element) throws IOException {
67787    if (element != null) {
67788      open(name);
67789      composeSpecimenFeatureComponentProperties(element);
67790      close();
67791    }
67792  }
67793
67794  protected void composeSpecimenFeatureComponentProperties(Specimen.SpecimenFeatureComponent element) throws IOException {
67795    composeBackboneElementProperties(element);
67796      if (element.hasType()) {
67797        composeCodeableConcept("type", element.getType());
67798      }
67799      if (element.hasDescriptionElement()) {
67800        composeStringCore("description", element.getDescriptionElement(), false);
67801        composeStringExtras("description", element.getDescriptionElement(), false);
67802      }
67803  }
67804
67805  protected void composeSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
67806    if (element != null) {
67807      open(name);
67808      composeSpecimenCollectionComponentProperties(element);
67809      close();
67810    }
67811  }
67812
67813  protected void composeSpecimenCollectionComponentProperties(Specimen.SpecimenCollectionComponent element) throws IOException {
67814    composeBackboneElementProperties(element);
67815      if (element.hasCollector()) {
67816        composeReference("collector", element.getCollector());
67817      }
67818      if (element.hasCollected()) {
67819        composeType("collected", element.getCollected());
67820      }
67821      if (element.hasDuration()) {
67822        composeDuration("duration", element.getDuration());
67823      }
67824      if (element.hasQuantity()) {
67825        composeQuantity("quantity", element.getQuantity());
67826      }
67827      if (element.hasMethod()) {
67828        composeCodeableConcept("method", element.getMethod());
67829      }
67830      if (element.hasDevice()) {
67831        composeCodeableReference("device", element.getDevice());
67832      }
67833      if (element.hasProcedure()) {
67834        composeReference("procedure", element.getProcedure());
67835      }
67836      if (element.hasBodySite()) {
67837        composeCodeableReference("bodySite", element.getBodySite());
67838      }
67839      if (element.hasFastingStatus()) {
67840        composeType("fastingStatus", element.getFastingStatus());
67841      }
67842  }
67843
67844  protected void composeSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
67845    if (element != null) {
67846      open(name);
67847      composeSpecimenProcessingComponentProperties(element);
67848      close();
67849    }
67850  }
67851
67852  protected void composeSpecimenProcessingComponentProperties(Specimen.SpecimenProcessingComponent element) throws IOException {
67853    composeBackboneElementProperties(element);
67854      if (element.hasDescriptionElement()) {
67855        composeStringCore("description", element.getDescriptionElement(), false);
67856        composeStringExtras("description", element.getDescriptionElement(), false);
67857      }
67858      if (element.hasMethod()) {
67859        composeCodeableConcept("method", element.getMethod());
67860      }
67861      if (element.hasAdditive()) {
67862        openArray("additive");
67863        for (Reference e : element.getAdditive()) 
67864          composeReference(null, e);
67865        closeArray();
67866      };
67867      if (element.hasTime()) {
67868        composeType("time", element.getTime());
67869      }
67870  }
67871
67872  protected void composeSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
67873    if (element != null) {
67874      open(name);
67875      composeSpecimenContainerComponentProperties(element);
67876      close();
67877    }
67878  }
67879
67880  protected void composeSpecimenContainerComponentProperties(Specimen.SpecimenContainerComponent element) throws IOException {
67881    composeBackboneElementProperties(element);
67882      if (element.hasDevice()) {
67883        composeReference("device", element.getDevice());
67884      }
67885      if (element.hasLocation()) {
67886        composeReference("location", element.getLocation());
67887      }
67888      if (element.hasSpecimenQuantity()) {
67889        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
67890      }
67891  }
67892
67893  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
67894    if (element != null) {
67895      prop("resourceType", name);
67896      composeSpecimenDefinitionProperties(element);
67897    }
67898  }
67899
67900  protected void composeSpecimenDefinitionProperties(SpecimenDefinition element) throws IOException {
67901    composeDomainResourceProperties(element);
67902      if (element.hasUrlElement()) {
67903        composeUriCore("url", element.getUrlElement(), false);
67904        composeUriExtras("url", element.getUrlElement(), false);
67905      }
67906      if (element.hasIdentifier()) {
67907        composeIdentifier("identifier", element.getIdentifier());
67908      }
67909      if (element.hasVersionElement()) {
67910        composeStringCore("version", element.getVersionElement(), false);
67911        composeStringExtras("version", element.getVersionElement(), false);
67912      }
67913      if (element.hasVersionAlgorithm()) {
67914        composeType("versionAlgorithm", element.getVersionAlgorithm());
67915      }
67916      if (element.hasNameElement()) {
67917        composeStringCore("name", element.getNameElement(), false);
67918        composeStringExtras("name", element.getNameElement(), false);
67919      }
67920      if (element.hasTitleElement()) {
67921        composeStringCore("title", element.getTitleElement(), false);
67922        composeStringExtras("title", element.getTitleElement(), false);
67923      }
67924      if (element.hasDerivedFromCanonical()) {
67925        if (anyHasValue(element.getDerivedFromCanonical())) {
67926          openArray("derivedFromCanonical");
67927          for (CanonicalType e : element.getDerivedFromCanonical()) 
67928            composeCanonicalCore(null, e, e != element.getDerivedFromCanonical().get(element.getDerivedFromCanonical().size()-1));
67929          closeArray();
67930        }
67931        if (anyHasExtras(element.getDerivedFromCanonical())) {
67932          openArray("_derivedFromCanonical");
67933          for (CanonicalType e : element.getDerivedFromCanonical()) 
67934            composeCanonicalExtras(null, e, true);
67935          closeArray();
67936        }
67937      };
67938      if (element.hasDerivedFromUri()) {
67939        if (anyHasValue(element.getDerivedFromUri())) {
67940          openArray("derivedFromUri");
67941          for (UriType e : element.getDerivedFromUri()) 
67942            composeUriCore(null, e, e != element.getDerivedFromUri().get(element.getDerivedFromUri().size()-1));
67943          closeArray();
67944        }
67945        if (anyHasExtras(element.getDerivedFromUri())) {
67946          openArray("_derivedFromUri");
67947          for (UriType e : element.getDerivedFromUri()) 
67948            composeUriExtras(null, e, true);
67949          closeArray();
67950        }
67951      };
67952      if (element.hasStatusElement()) {
67953        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67954        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
67955      }
67956      if (element.hasExperimentalElement()) {
67957        composeBooleanCore("experimental", element.getExperimentalElement(), false);
67958        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
67959      }
67960      if (element.hasSubject()) {
67961        composeType("subject", element.getSubject());
67962      }
67963      if (element.hasDateElement()) {
67964        composeDateTimeCore("date", element.getDateElement(), false);
67965        composeDateTimeExtras("date", element.getDateElement(), false);
67966      }
67967      if (element.hasPublisherElement()) {
67968        composeStringCore("publisher", element.getPublisherElement(), false);
67969        composeStringExtras("publisher", element.getPublisherElement(), false);
67970      }
67971      if (element.hasContact()) {
67972        openArray("contact");
67973        for (ContactDetail e : element.getContact()) 
67974          composeContactDetail(null, e);
67975        closeArray();
67976      };
67977      if (element.hasDescriptionElement()) {
67978        composeMarkdownCore("description", element.getDescriptionElement(), false);
67979        composeMarkdownExtras("description", element.getDescriptionElement(), false);
67980      }
67981      if (element.hasUseContext()) {
67982        openArray("useContext");
67983        for (UsageContext e : element.getUseContext()) 
67984          composeUsageContext(null, e);
67985        closeArray();
67986      };
67987      if (element.hasJurisdiction()) {
67988        openArray("jurisdiction");
67989        for (CodeableConcept e : element.getJurisdiction()) 
67990          composeCodeableConcept(null, e);
67991        closeArray();
67992      };
67993      if (element.hasPurposeElement()) {
67994        composeMarkdownCore("purpose", element.getPurposeElement(), false);
67995        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
67996      }
67997      if (element.hasCopyrightElement()) {
67998        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
67999        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
68000      }
68001      if (element.hasCopyrightLabelElement()) {
68002        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
68003        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
68004      }
68005      if (element.hasApprovalDateElement()) {
68006        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
68007        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
68008      }
68009      if (element.hasLastReviewDateElement()) {
68010        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
68011        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
68012      }
68013      if (element.hasEffectivePeriod()) {
68014        composePeriod("effectivePeriod", element.getEffectivePeriod());
68015      }
68016      if (element.hasTypeCollected()) {
68017        composeCodeableConcept("typeCollected", element.getTypeCollected());
68018      }
68019      if (element.hasPatientPreparation()) {
68020        openArray("patientPreparation");
68021        for (CodeableConcept e : element.getPatientPreparation()) 
68022          composeCodeableConcept(null, e);
68023        closeArray();
68024      };
68025      if (element.hasTimeAspectElement()) {
68026        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
68027        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
68028      }
68029      if (element.hasCollection()) {
68030        openArray("collection");
68031        for (CodeableConcept e : element.getCollection()) 
68032          composeCodeableConcept(null, e);
68033        closeArray();
68034      };
68035      if (element.hasTypeTested()) {
68036        openArray("typeTested");
68037        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
68038          composeSpecimenDefinitionTypeTestedComponent(null, e);
68039        closeArray();
68040      };
68041  }
68042
68043  protected void composeSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
68044    if (element != null) {
68045      open(name);
68046      composeSpecimenDefinitionTypeTestedComponentProperties(element);
68047      close();
68048    }
68049  }
68050
68051  protected void composeSpecimenDefinitionTypeTestedComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
68052    composeBackboneElementProperties(element);
68053      if (element.hasIsDerivedElement()) {
68054        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
68055        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
68056      }
68057      if (element.hasType()) {
68058        composeCodeableConcept("type", element.getType());
68059      }
68060      if (element.hasPreferenceElement()) {
68061        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
68062        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
68063      }
68064      if (element.hasContainer()) {
68065        composeSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
68066      }
68067      if (element.hasRequirementElement()) {
68068        composeMarkdownCore("requirement", element.getRequirementElement(), false);
68069        composeMarkdownExtras("requirement", element.getRequirementElement(), false);
68070      }
68071      if (element.hasRetentionTime()) {
68072        composeDuration("retentionTime", element.getRetentionTime());
68073      }
68074      if (element.hasSingleUseElement()) {
68075        composeBooleanCore("singleUse", element.getSingleUseElement(), false);
68076        composeBooleanExtras("singleUse", element.getSingleUseElement(), false);
68077      }
68078      if (element.hasRejectionCriterion()) {
68079        openArray("rejectionCriterion");
68080        for (CodeableConcept e : element.getRejectionCriterion()) 
68081          composeCodeableConcept(null, e);
68082        closeArray();
68083      };
68084      if (element.hasHandling()) {
68085        openArray("handling");
68086        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
68087          composeSpecimenDefinitionTypeTestedHandlingComponent(null, e);
68088        closeArray();
68089      };
68090      if (element.hasTestingDestination()) {
68091        openArray("testingDestination");
68092        for (CodeableConcept e : element.getTestingDestination()) 
68093          composeCodeableConcept(null, e);
68094        closeArray();
68095      };
68096  }
68097
68098  protected void composeSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
68099    if (element != null) {
68100      open(name);
68101      composeSpecimenDefinitionTypeTestedContainerComponentProperties(element);
68102      close();
68103    }
68104  }
68105
68106  protected void composeSpecimenDefinitionTypeTestedContainerComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
68107    composeBackboneElementProperties(element);
68108      if (element.hasMaterial()) {
68109        composeCodeableConcept("material", element.getMaterial());
68110      }
68111      if (element.hasType()) {
68112        composeCodeableConcept("type", element.getType());
68113      }
68114      if (element.hasCap()) {
68115        composeCodeableConcept("cap", element.getCap());
68116      }
68117      if (element.hasDescriptionElement()) {
68118        composeMarkdownCore("description", element.getDescriptionElement(), false);
68119        composeMarkdownExtras("description", element.getDescriptionElement(), false);
68120      }
68121      if (element.hasCapacity()) {
68122        composeQuantity("capacity", element.getCapacity());
68123      }
68124      if (element.hasMinimumVolume()) {
68125        composeType("minimumVolume", element.getMinimumVolume());
68126      }
68127      if (element.hasAdditive()) {
68128        openArray("additive");
68129        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
68130          composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
68131        closeArray();
68132      };
68133      if (element.hasPreparationElement()) {
68134        composeMarkdownCore("preparation", element.getPreparationElement(), false);
68135        composeMarkdownExtras("preparation", element.getPreparationElement(), false);
68136      }
68137  }
68138
68139  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
68140    if (element != null) {
68141      open(name);
68142      composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(element);
68143      close();
68144    }
68145  }
68146
68147  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
68148    composeBackboneElementProperties(element);
68149      if (element.hasAdditive()) {
68150        composeType("additive", element.getAdditive());
68151      }
68152  }
68153
68154  protected void composeSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
68155    if (element != null) {
68156      open(name);
68157      composeSpecimenDefinitionTypeTestedHandlingComponentProperties(element);
68158      close();
68159    }
68160  }
68161
68162  protected void composeSpecimenDefinitionTypeTestedHandlingComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
68163    composeBackboneElementProperties(element);
68164      if (element.hasTemperatureQualifier()) {
68165        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
68166      }
68167      if (element.hasTemperatureRange()) {
68168        composeRange("temperatureRange", element.getTemperatureRange());
68169      }
68170      if (element.hasMaxDuration()) {
68171        composeDuration("maxDuration", element.getMaxDuration());
68172      }
68173      if (element.hasInstructionElement()) {
68174        composeMarkdownCore("instruction", element.getInstructionElement(), false);
68175        composeMarkdownExtras("instruction", element.getInstructionElement(), false);
68176      }
68177  }
68178
68179  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
68180    if (element != null) {
68181      prop("resourceType", name);
68182      composeStructureDefinitionProperties(element);
68183    }
68184  }
68185
68186  protected void composeStructureDefinitionProperties(StructureDefinition element) throws IOException {
68187    composeCanonicalResourceProperties(element);
68188      if (element.hasUrlElement()) {
68189        composeUriCore("url", element.getUrlElement(), false);
68190        composeUriExtras("url", element.getUrlElement(), false);
68191      }
68192      if (element.hasIdentifier()) {
68193        openArray("identifier");
68194        for (Identifier e : element.getIdentifier()) 
68195          composeIdentifier(null, e);
68196        closeArray();
68197      };
68198      if (element.hasVersionElement()) {
68199        composeStringCore("version", element.getVersionElement(), false);
68200        composeStringExtras("version", element.getVersionElement(), false);
68201      }
68202      if (element.hasVersionAlgorithm()) {
68203        composeType("versionAlgorithm", element.getVersionAlgorithm());
68204      }
68205      if (element.hasNameElement()) {
68206        composeStringCore("name", element.getNameElement(), false);
68207        composeStringExtras("name", element.getNameElement(), false);
68208      }
68209      if (element.hasTitleElement()) {
68210        composeStringCore("title", element.getTitleElement(), false);
68211        composeStringExtras("title", element.getTitleElement(), false);
68212      }
68213      if (element.hasStatusElement()) {
68214        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68215        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68216      }
68217      if (element.hasExperimentalElement()) {
68218        composeBooleanCore("experimental", element.getExperimentalElement(), false);
68219        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
68220      }
68221      if (element.hasDateElement()) {
68222        composeDateTimeCore("date", element.getDateElement(), false);
68223        composeDateTimeExtras("date", element.getDateElement(), false);
68224      }
68225      if (element.hasPublisherElement()) {
68226        composeStringCore("publisher", element.getPublisherElement(), false);
68227        composeStringExtras("publisher", element.getPublisherElement(), false);
68228      }
68229      if (element.hasContact()) {
68230        openArray("contact");
68231        for (ContactDetail e : element.getContact()) 
68232          composeContactDetail(null, e);
68233        closeArray();
68234      };
68235      if (element.hasDescriptionElement()) {
68236        composeMarkdownCore("description", element.getDescriptionElement(), false);
68237        composeMarkdownExtras("description", element.getDescriptionElement(), false);
68238      }
68239      if (element.hasUseContext()) {
68240        openArray("useContext");
68241        for (UsageContext e : element.getUseContext()) 
68242          composeUsageContext(null, e);
68243        closeArray();
68244      };
68245      if (element.hasJurisdiction()) {
68246        openArray("jurisdiction");
68247        for (CodeableConcept e : element.getJurisdiction()) 
68248          composeCodeableConcept(null, e);
68249        closeArray();
68250      };
68251      if (element.hasPurposeElement()) {
68252        composeMarkdownCore("purpose", element.getPurposeElement(), false);
68253        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
68254      }
68255      if (element.hasCopyrightElement()) {
68256        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
68257        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
68258      }
68259      if (element.hasCopyrightLabelElement()) {
68260        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
68261        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
68262      }
68263      if (element.hasKeyword()) {
68264        openArray("keyword");
68265        for (Coding e : element.getKeyword()) 
68266          composeCoding(null, e);
68267        closeArray();
68268      };
68269      if (element.hasFhirVersionElement()) {
68270        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
68271        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
68272      }
68273      if (element.hasMapping()) {
68274        openArray("mapping");
68275        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
68276          composeStructureDefinitionMappingComponent(null, e);
68277        closeArray();
68278      };
68279      if (element.hasKindElement()) {
68280        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
68281        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
68282      }
68283      if (element.hasAbstractElement()) {
68284        composeBooleanCore("abstract", element.getAbstractElement(), false);
68285        composeBooleanExtras("abstract", element.getAbstractElement(), false);
68286      }
68287      if (element.hasContext()) {
68288        openArray("context");
68289        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
68290          composeStructureDefinitionContextComponent(null, e);
68291        closeArray();
68292      };
68293      if (element.hasContextInvariant()) {
68294        if (anyHasValue(element.getContextInvariant())) {
68295          openArray("contextInvariant");
68296          for (StringType e : element.getContextInvariant()) 
68297            composeStringCore(null, e, e != element.getContextInvariant().get(element.getContextInvariant().size()-1));
68298          closeArray();
68299        }
68300        if (anyHasExtras(element.getContextInvariant())) {
68301          openArray("_contextInvariant");
68302          for (StringType e : element.getContextInvariant()) 
68303            composeStringExtras(null, e, true);
68304          closeArray();
68305        }
68306      };
68307      if (element.hasTypeElement()) {
68308        composeUriCore("type", element.getTypeElement(), false);
68309        composeUriExtras("type", element.getTypeElement(), false);
68310      }
68311      if (element.hasBaseDefinitionElement()) {
68312        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
68313        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
68314      }
68315      if (element.hasDerivationElement()) {
68316        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
68317        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
68318      }
68319      if (element.hasSnapshot()) {
68320        composeStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
68321      }
68322      if (element.hasDifferential()) {
68323        composeStructureDefinitionDifferentialComponent("differential", element.getDifferential());
68324      }
68325  }
68326
68327  protected void composeStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
68328    if (element != null) {
68329      open(name);
68330      composeStructureDefinitionMappingComponentProperties(element);
68331      close();
68332    }
68333  }
68334
68335  protected void composeStructureDefinitionMappingComponentProperties(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
68336    composeBackboneElementProperties(element);
68337      if (element.hasIdentityElement()) {
68338        composeIdCore("identity", element.getIdentityElement(), false);
68339        composeIdExtras("identity", element.getIdentityElement(), false);
68340      }
68341      if (element.hasUriElement()) {
68342        composeUriCore("uri", element.getUriElement(), false);
68343        composeUriExtras("uri", element.getUriElement(), false);
68344      }
68345      if (element.hasNameElement()) {
68346        composeStringCore("name", element.getNameElement(), false);
68347        composeStringExtras("name", element.getNameElement(), false);
68348      }
68349      if (element.hasCommentElement()) {
68350        composeStringCore("comment", element.getCommentElement(), false);
68351        composeStringExtras("comment", element.getCommentElement(), false);
68352      }
68353  }
68354
68355  protected void composeStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
68356    if (element != null) {
68357      open(name);
68358      composeStructureDefinitionContextComponentProperties(element);
68359      close();
68360    }
68361  }
68362
68363  protected void composeStructureDefinitionContextComponentProperties(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
68364    composeBackboneElementProperties(element);
68365      if (element.hasTypeElement()) {
68366        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
68367        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
68368      }
68369      if (element.hasExpressionElement()) {
68370        composeStringCore("expression", element.getExpressionElement(), false);
68371        composeStringExtras("expression", element.getExpressionElement(), false);
68372      }
68373  }
68374
68375  protected void composeStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
68376    if (element != null) {
68377      open(name);
68378      composeStructureDefinitionSnapshotComponentProperties(element);
68379      close();
68380    }
68381  }
68382
68383  protected void composeStructureDefinitionSnapshotComponentProperties(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
68384    composeBackboneElementProperties(element);
68385      if (element.hasElement()) {
68386        openArray("element");
68387        for (ElementDefinition e : element.getElement()) 
68388          composeElementDefinition(null, e);
68389        closeArray();
68390      };
68391  }
68392
68393  protected void composeStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
68394    if (element != null) {
68395      open(name);
68396      composeStructureDefinitionDifferentialComponentProperties(element);
68397      close();
68398    }
68399  }
68400
68401  protected void composeStructureDefinitionDifferentialComponentProperties(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
68402    composeBackboneElementProperties(element);
68403      if (element.hasElement()) {
68404        openArray("element");
68405        for (ElementDefinition e : element.getElement()) 
68406          composeElementDefinition(null, e);
68407        closeArray();
68408      };
68409  }
68410
68411  protected void composeStructureMap(String name, StructureMap element) throws IOException {
68412    if (element != null) {
68413      prop("resourceType", name);
68414      composeStructureMapProperties(element);
68415    }
68416  }
68417
68418  protected void composeStructureMapProperties(StructureMap element) throws IOException {
68419    composeCanonicalResourceProperties(element);
68420      if (element.hasUrlElement()) {
68421        composeUriCore("url", element.getUrlElement(), false);
68422        composeUriExtras("url", element.getUrlElement(), false);
68423      }
68424      if (element.hasIdentifier()) {
68425        openArray("identifier");
68426        for (Identifier e : element.getIdentifier()) 
68427          composeIdentifier(null, e);
68428        closeArray();
68429      };
68430      if (element.hasVersionElement()) {
68431        composeStringCore("version", element.getVersionElement(), false);
68432        composeStringExtras("version", element.getVersionElement(), false);
68433      }
68434      if (element.hasVersionAlgorithm()) {
68435        composeType("versionAlgorithm", element.getVersionAlgorithm());
68436      }
68437      if (element.hasNameElement()) {
68438        composeStringCore("name", element.getNameElement(), false);
68439        composeStringExtras("name", element.getNameElement(), false);
68440      }
68441      if (element.hasTitleElement()) {
68442        composeStringCore("title", element.getTitleElement(), false);
68443        composeStringExtras("title", element.getTitleElement(), false);
68444      }
68445      if (element.hasStatusElement()) {
68446        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68447        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
68448      }
68449      if (element.hasExperimentalElement()) {
68450        composeBooleanCore("experimental", element.getExperimentalElement(), false);
68451        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
68452      }
68453      if (element.hasDateElement()) {
68454        composeDateTimeCore("date", element.getDateElement(), false);
68455        composeDateTimeExtras("date", element.getDateElement(), false);
68456      }
68457      if (element.hasPublisherElement()) {
68458        composeStringCore("publisher", element.getPublisherElement(), false);
68459        composeStringExtras("publisher", element.getPublisherElement(), false);
68460      }
68461      if (element.hasContact()) {
68462        openArray("contact");
68463        for (ContactDetail e : element.getContact()) 
68464          composeContactDetail(null, e);
68465        closeArray();
68466      };
68467      if (element.hasDescriptionElement()) {
68468        composeMarkdownCore("description", element.getDescriptionElement(), false);
68469        composeMarkdownExtras("description", element.getDescriptionElement(), false);
68470      }
68471      if (element.hasUseContext()) {
68472        openArray("useContext");
68473        for (UsageContext e : element.getUseContext()) 
68474          composeUsageContext(null, e);
68475        closeArray();
68476      };
68477      if (element.hasJurisdiction()) {
68478        openArray("jurisdiction");
68479        for (CodeableConcept e : element.getJurisdiction()) 
68480          composeCodeableConcept(null, e);
68481        closeArray();
68482      };
68483      if (element.hasPurposeElement()) {
68484        composeMarkdownCore("purpose", element.getPurposeElement(), false);
68485        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
68486      }
68487      if (element.hasCopyrightElement()) {
68488        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
68489        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
68490      }
68491      if (element.hasCopyrightLabelElement()) {
68492        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
68493        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
68494      }
68495      if (element.hasStructure()) {
68496        openArray("structure");
68497        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
68498          composeStructureMapStructureComponent(null, e);
68499        closeArray();
68500      };
68501      if (element.hasImport()) {
68502        if (anyHasValue(element.getImport())) {
68503          openArray("import");
68504          for (CanonicalType e : element.getImport()) 
68505            composeCanonicalCore(null, e, e != element.getImport().get(element.getImport().size()-1));
68506          closeArray();
68507        }
68508        if (anyHasExtras(element.getImport())) {
68509          openArray("_import");
68510          for (CanonicalType e : element.getImport()) 
68511            composeCanonicalExtras(null, e, true);
68512          closeArray();
68513        }
68514      };
68515      if (element.hasConst()) {
68516        openArray("const");
68517        for (StructureMap.StructureMapConstComponent e : element.getConst()) 
68518          composeStructureMapConstComponent(null, e);
68519        closeArray();
68520      };
68521      if (element.hasGroup()) {
68522        openArray("group");
68523        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
68524          composeStructureMapGroupComponent(null, e);
68525        closeArray();
68526      };
68527  }
68528
68529  protected void composeStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
68530    if (element != null) {
68531      open(name);
68532      composeStructureMapStructureComponentProperties(element);
68533      close();
68534    }
68535  }
68536
68537  protected void composeStructureMapStructureComponentProperties(StructureMap.StructureMapStructureComponent element) throws IOException {
68538    composeBackboneElementProperties(element);
68539      if (element.hasUrlElement()) {
68540        composeCanonicalCore("url", element.getUrlElement(), false);
68541        composeCanonicalExtras("url", element.getUrlElement(), false);
68542      }
68543      if (element.hasModeElement()) {
68544        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
68545        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
68546      }
68547      if (element.hasAliasElement()) {
68548        composeStringCore("alias", element.getAliasElement(), false);
68549        composeStringExtras("alias", element.getAliasElement(), false);
68550      }
68551      if (element.hasDocumentationElement()) {
68552        composeStringCore("documentation", element.getDocumentationElement(), false);
68553        composeStringExtras("documentation", element.getDocumentationElement(), false);
68554      }
68555  }
68556
68557  protected void composeStructureMapConstComponent(String name, StructureMap.StructureMapConstComponent element) throws IOException {
68558    if (element != null) {
68559      open(name);
68560      composeStructureMapConstComponentProperties(element);
68561      close();
68562    }
68563  }
68564
68565  protected void composeStructureMapConstComponentProperties(StructureMap.StructureMapConstComponent element) throws IOException {
68566    composeBackboneElementProperties(element);
68567      if (element.hasNameElement()) {
68568        composeIdCore("name", element.getNameElement(), false);
68569        composeIdExtras("name", element.getNameElement(), false);
68570      }
68571      if (element.hasValueElement()) {
68572        composeStringCore("value", element.getValueElement(), false);
68573        composeStringExtras("value", element.getValueElement(), false);
68574      }
68575  }
68576
68577  protected void composeStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
68578    if (element != null) {
68579      open(name);
68580      composeStructureMapGroupComponentProperties(element);
68581      close();
68582    }
68583  }
68584
68585  protected void composeStructureMapGroupComponentProperties(StructureMap.StructureMapGroupComponent element) throws IOException {
68586    composeBackboneElementProperties(element);
68587      if (element.hasNameElement()) {
68588        composeIdCore("name", element.getNameElement(), false);
68589        composeIdExtras("name", element.getNameElement(), false);
68590      }
68591      if (element.hasExtendsElement()) {
68592        composeIdCore("extends", element.getExtendsElement(), false);
68593        composeIdExtras("extends", element.getExtendsElement(), false);
68594      }
68595      if (element.hasTypeModeElement()) {
68596        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
68597        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
68598      }
68599      if (element.hasDocumentationElement()) {
68600        composeStringCore("documentation", element.getDocumentationElement(), false);
68601        composeStringExtras("documentation", element.getDocumentationElement(), false);
68602      }
68603      if (element.hasInput()) {
68604        openArray("input");
68605        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
68606          composeStructureMapGroupInputComponent(null, e);
68607        closeArray();
68608      };
68609      if (element.hasRule()) {
68610        openArray("rule");
68611        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
68612          composeStructureMapGroupRuleComponent(null, e);
68613        closeArray();
68614      };
68615  }
68616
68617  protected void composeStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
68618    if (element != null) {
68619      open(name);
68620      composeStructureMapGroupInputComponentProperties(element);
68621      close();
68622    }
68623  }
68624
68625  protected void composeStructureMapGroupInputComponentProperties(StructureMap.StructureMapGroupInputComponent element) throws IOException {
68626    composeBackboneElementProperties(element);
68627      if (element.hasNameElement()) {
68628        composeIdCore("name", element.getNameElement(), false);
68629        composeIdExtras("name", element.getNameElement(), false);
68630      }
68631      if (element.hasTypeElement()) {
68632        composeStringCore("type", element.getTypeElement(), false);
68633        composeStringExtras("type", element.getTypeElement(), false);
68634      }
68635      if (element.hasModeElement()) {
68636        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
68637        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
68638      }
68639      if (element.hasDocumentationElement()) {
68640        composeStringCore("documentation", element.getDocumentationElement(), false);
68641        composeStringExtras("documentation", element.getDocumentationElement(), false);
68642      }
68643  }
68644
68645  protected void composeStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
68646    if (element != null) {
68647      open(name);
68648      composeStructureMapGroupRuleComponentProperties(element);
68649      close();
68650    }
68651  }
68652
68653  protected void composeStructureMapGroupRuleComponentProperties(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
68654    composeBackboneElementProperties(element);
68655      if (element.hasNameElement()) {
68656        composeIdCore("name", element.getNameElement(), false);
68657        composeIdExtras("name", element.getNameElement(), false);
68658      }
68659      if (element.hasSource()) {
68660        openArray("source");
68661        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
68662          composeStructureMapGroupRuleSourceComponent(null, e);
68663        closeArray();
68664      };
68665      if (element.hasTarget()) {
68666        openArray("target");
68667        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
68668          composeStructureMapGroupRuleTargetComponent(null, e);
68669        closeArray();
68670      };
68671      if (element.hasRule()) {
68672        openArray("rule");
68673        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
68674          composeStructureMapGroupRuleComponent(null, e);
68675        closeArray();
68676      };
68677      if (element.hasDependent()) {
68678        openArray("dependent");
68679        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
68680          composeStructureMapGroupRuleDependentComponent(null, e);
68681        closeArray();
68682      };
68683      if (element.hasDocumentationElement()) {
68684        composeStringCore("documentation", element.getDocumentationElement(), false);
68685        composeStringExtras("documentation", element.getDocumentationElement(), false);
68686      }
68687  }
68688
68689  protected void composeStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
68690    if (element != null) {
68691      open(name);
68692      composeStructureMapGroupRuleSourceComponentProperties(element);
68693      close();
68694    }
68695  }
68696
68697  protected void composeStructureMapGroupRuleSourceComponentProperties(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
68698    composeBackboneElementProperties(element);
68699      if (element.hasContextElement()) {
68700        composeIdCore("context", element.getContextElement(), false);
68701        composeIdExtras("context", element.getContextElement(), false);
68702      }
68703      if (element.hasMinElement()) {
68704        composeIntegerCore("min", element.getMinElement(), false);
68705        composeIntegerExtras("min", element.getMinElement(), false);
68706      }
68707      if (element.hasMaxElement()) {
68708        composeStringCore("max", element.getMaxElement(), false);
68709        composeStringExtras("max", element.getMaxElement(), false);
68710      }
68711      if (element.hasTypeElement()) {
68712        composeStringCore("type", element.getTypeElement(), false);
68713        composeStringExtras("type", element.getTypeElement(), false);
68714      }
68715      if (element.hasDefaultValueElement()) {
68716        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
68717        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
68718      }
68719      if (element.hasElementElement()) {
68720        composeStringCore("element", element.getElementElement(), false);
68721        composeStringExtras("element", element.getElementElement(), false);
68722      }
68723      if (element.hasListModeElement()) {
68724        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
68725        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
68726      }
68727      if (element.hasVariableElement()) {
68728        composeIdCore("variable", element.getVariableElement(), false);
68729        composeIdExtras("variable", element.getVariableElement(), false);
68730      }
68731      if (element.hasConditionElement()) {
68732        composeStringCore("condition", element.getConditionElement(), false);
68733        composeStringExtras("condition", element.getConditionElement(), false);
68734      }
68735      if (element.hasCheckElement()) {
68736        composeStringCore("check", element.getCheckElement(), false);
68737        composeStringExtras("check", element.getCheckElement(), false);
68738      }
68739      if (element.hasLogMessageElement()) {
68740        composeStringCore("logMessage", element.getLogMessageElement(), false);
68741        composeStringExtras("logMessage", element.getLogMessageElement(), false);
68742      }
68743  }
68744
68745  protected void composeStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
68746    if (element != null) {
68747      open(name);
68748      composeStructureMapGroupRuleTargetComponentProperties(element);
68749      close();
68750    }
68751  }
68752
68753  protected void composeStructureMapGroupRuleTargetComponentProperties(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
68754    composeBackboneElementProperties(element);
68755      if (element.hasContextElement()) {
68756        composeStringCore("context", element.getContextElement(), false);
68757        composeStringExtras("context", element.getContextElement(), false);
68758      }
68759      if (element.hasElementElement()) {
68760        composeStringCore("element", element.getElementElement(), false);
68761        composeStringExtras("element", element.getElementElement(), false);
68762      }
68763      if (element.hasVariableElement()) {
68764        composeIdCore("variable", element.getVariableElement(), false);
68765        composeIdExtras("variable", element.getVariableElement(), false);
68766      }
68767      if (element.hasListMode()) {
68768        openArray("listMode");
68769        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
68770          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
68771        closeArray();
68772        if (anyHasExtras(element.getListMode())) {
68773          openArray("_listMode");
68774          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
68775            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
68776          closeArray();
68777        }
68778      };
68779      if (element.hasListRuleIdElement()) {
68780        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
68781        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
68782      }
68783      if (element.hasTransformElement()) {
68784        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
68785        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
68786      }
68787      if (element.hasParameter()) {
68788        openArray("parameter");
68789        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
68790          composeStructureMapGroupRuleTargetParameterComponent(null, e);
68791        closeArray();
68792      };
68793  }
68794
68795  protected void composeStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
68796    if (element != null) {
68797      open(name);
68798      composeStructureMapGroupRuleTargetParameterComponentProperties(element);
68799      close();
68800    }
68801  }
68802
68803  protected void composeStructureMapGroupRuleTargetParameterComponentProperties(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
68804    composeBackboneElementProperties(element);
68805      if (element.hasValue()) {
68806        composeType("value", element.getValue());
68807      }
68808  }
68809
68810  protected void composeStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
68811    if (element != null) {
68812      open(name);
68813      composeStructureMapGroupRuleDependentComponentProperties(element);
68814      close();
68815    }
68816  }
68817
68818  protected void composeStructureMapGroupRuleDependentComponentProperties(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
68819    composeBackboneElementProperties(element);
68820      if (element.hasNameElement()) {
68821        composeIdCore("name", element.getNameElement(), false);
68822        composeIdExtras("name", element.getNameElement(), false);
68823      }
68824      if (element.hasParameter()) {
68825        openArray("parameter");
68826        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
68827          composeStructureMapGroupRuleTargetParameterComponent(null, e);
68828        closeArray();
68829      };
68830  }
68831
68832  protected void composeSubscription(String name, Subscription element) throws IOException {
68833    if (element != null) {
68834      prop("resourceType", name);
68835      composeSubscriptionProperties(element);
68836    }
68837  }
68838
68839  protected void composeSubscriptionProperties(Subscription element) throws IOException {
68840    composeDomainResourceProperties(element);
68841      if (element.hasIdentifier()) {
68842        openArray("identifier");
68843        for (Identifier e : element.getIdentifier()) 
68844          composeIdentifier(null, e);
68845        closeArray();
68846      };
68847      if (element.hasNameElement()) {
68848        composeStringCore("name", element.getNameElement(), false);
68849        composeStringExtras("name", element.getNameElement(), false);
68850      }
68851      if (element.hasStatusElement()) {
68852        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68853        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68854      }
68855      if (element.hasTopicElement()) {
68856        composeCanonicalCore("topic", element.getTopicElement(), false);
68857        composeCanonicalExtras("topic", element.getTopicElement(), false);
68858      }
68859      if (element.hasContact()) {
68860        openArray("contact");
68861        for (ContactPoint e : element.getContact()) 
68862          composeContactPoint(null, e);
68863        closeArray();
68864      };
68865      if (element.hasEndElement()) {
68866        composeInstantCore("end", element.getEndElement(), false);
68867        composeInstantExtras("end", element.getEndElement(), false);
68868      }
68869      if (element.hasManagingEntity()) {
68870        composeReference("managingEntity", element.getManagingEntity());
68871      }
68872      if (element.hasReasonElement()) {
68873        composeStringCore("reason", element.getReasonElement(), false);
68874        composeStringExtras("reason", element.getReasonElement(), false);
68875      }
68876      if (element.hasFilterBy()) {
68877        openArray("filterBy");
68878        for (Subscription.SubscriptionFilterByComponent e : element.getFilterBy()) 
68879          composeSubscriptionFilterByComponent(null, e);
68880        closeArray();
68881      };
68882      if (element.hasChannelType()) {
68883        composeCoding("channelType", element.getChannelType());
68884      }
68885      if (element.hasEndpointElement()) {
68886        composeUrlCore("endpoint", element.getEndpointElement(), false);
68887        composeUrlExtras("endpoint", element.getEndpointElement(), false);
68888      }
68889      if (element.hasParameter()) {
68890        openArray("parameter");
68891        for (Subscription.SubscriptionParameterComponent e : element.getParameter()) 
68892          composeSubscriptionParameterComponent(null, e);
68893        closeArray();
68894      };
68895      if (element.hasHeartbeatPeriodElement()) {
68896        composeUnsignedIntCore("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
68897        composeUnsignedIntExtras("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
68898      }
68899      if (element.hasTimeoutElement()) {
68900        composeUnsignedIntCore("timeout", element.getTimeoutElement(), false);
68901        composeUnsignedIntExtras("timeout", element.getTimeoutElement(), false);
68902      }
68903      if (element.hasContentTypeElement()) {
68904        composeCodeCore("contentType", element.getContentTypeElement(), false);
68905        composeCodeExtras("contentType", element.getContentTypeElement(), false);
68906      }
68907      if (element.hasContentElement()) {
68908        composeEnumerationCore("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
68909        composeEnumerationExtras("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
68910      }
68911      if (element.hasMaxCountElement()) {
68912        composePositiveIntCore("maxCount", element.getMaxCountElement(), false);
68913        composePositiveIntExtras("maxCount", element.getMaxCountElement(), false);
68914      }
68915  }
68916
68917  protected void composeSubscriptionFilterByComponent(String name, Subscription.SubscriptionFilterByComponent element) throws IOException {
68918    if (element != null) {
68919      open(name);
68920      composeSubscriptionFilterByComponentProperties(element);
68921      close();
68922    }
68923  }
68924
68925  protected void composeSubscriptionFilterByComponentProperties(Subscription.SubscriptionFilterByComponent element) throws IOException {
68926    composeBackboneElementProperties(element);
68927      if (element.hasResourceTypeElement()) {
68928        composeUriCore("resourceType", element.getResourceTypeElement(), false);
68929        composeUriExtras("resourceType", element.getResourceTypeElement(), false);
68930      }
68931      if (element.hasFilterParameterElement()) {
68932        composeStringCore("filterParameter", element.getFilterParameterElement(), false);
68933        composeStringExtras("filterParameter", element.getFilterParameterElement(), false);
68934      }
68935      if (element.hasComparatorElement()) {
68936        composeEnumerationCore("comparator", element.getComparatorElement(), new Enumerations.SearchComparatorEnumFactory(), false);
68937        composeEnumerationExtras("comparator", element.getComparatorElement(), new Enumerations.SearchComparatorEnumFactory(), false);
68938      }
68939      if (element.hasModifierElement()) {
68940        composeEnumerationCore("modifier", element.getModifierElement(), new Enumerations.SearchModifierCodeEnumFactory(), false);
68941        composeEnumerationExtras("modifier", element.getModifierElement(), new Enumerations.SearchModifierCodeEnumFactory(), false);
68942      }
68943      if (element.hasValueElement()) {
68944        composeStringCore("value", element.getValueElement(), false);
68945        composeStringExtras("value", element.getValueElement(), false);
68946      }
68947  }
68948
68949  protected void composeSubscriptionParameterComponent(String name, Subscription.SubscriptionParameterComponent element) throws IOException {
68950    if (element != null) {
68951      open(name);
68952      composeSubscriptionParameterComponentProperties(element);
68953      close();
68954    }
68955  }
68956
68957  protected void composeSubscriptionParameterComponentProperties(Subscription.SubscriptionParameterComponent element) throws IOException {
68958    composeBackboneElementProperties(element);
68959      if (element.hasNameElement()) {
68960        composeStringCore("name", element.getNameElement(), false);
68961        composeStringExtras("name", element.getNameElement(), false);
68962      }
68963      if (element.hasValueElement()) {
68964        composeStringCore("value", element.getValueElement(), false);
68965        composeStringExtras("value", element.getValueElement(), false);
68966      }
68967  }
68968
68969  protected void composeSubscriptionStatus(String name, SubscriptionStatus element) throws IOException {
68970    if (element != null) {
68971      prop("resourceType", name);
68972      composeSubscriptionStatusProperties(element);
68973    }
68974  }
68975
68976  protected void composeSubscriptionStatusProperties(SubscriptionStatus element) throws IOException {
68977    composeDomainResourceProperties(element);
68978      if (element.hasStatusElement()) {
68979        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68980        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.SubscriptionStatusCodesEnumFactory(), false);
68981      }
68982      if (element.hasTypeElement()) {
68983        composeEnumerationCore("type", element.getTypeElement(), new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory(), false);
68984        composeEnumerationExtras("type", element.getTypeElement(), new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory(), false);
68985      }
68986      if (element.hasEventsSinceSubscriptionStartElement()) {
68987        composeInteger64Core("eventsSinceSubscriptionStart", element.getEventsSinceSubscriptionStartElement(), false);
68988        composeInteger64Extras("eventsSinceSubscriptionStart", element.getEventsSinceSubscriptionStartElement(), false);
68989      }
68990      if (element.hasNotificationEvent()) {
68991        openArray("notificationEvent");
68992        for (SubscriptionStatus.SubscriptionStatusNotificationEventComponent e : element.getNotificationEvent()) 
68993          composeSubscriptionStatusNotificationEventComponent(null, e);
68994        closeArray();
68995      };
68996      if (element.hasSubscription()) {
68997        composeReference("subscription", element.getSubscription());
68998      }
68999      if (element.hasTopicElement()) {
69000        composeCanonicalCore("topic", element.getTopicElement(), false);
69001        composeCanonicalExtras("topic", element.getTopicElement(), false);
69002      }
69003      if (element.hasError()) {
69004        openArray("error");
69005        for (CodeableConcept e : element.getError()) 
69006          composeCodeableConcept(null, e);
69007        closeArray();
69008      };
69009  }
69010
69011  protected void composeSubscriptionStatusNotificationEventComponent(String name, SubscriptionStatus.SubscriptionStatusNotificationEventComponent element) throws IOException {
69012    if (element != null) {
69013      open(name);
69014      composeSubscriptionStatusNotificationEventComponentProperties(element);
69015      close();
69016    }
69017  }
69018
69019  protected void composeSubscriptionStatusNotificationEventComponentProperties(SubscriptionStatus.SubscriptionStatusNotificationEventComponent element) throws IOException {
69020    composeBackboneElementProperties(element);
69021      if (element.hasEventNumberElement()) {
69022        composeInteger64Core("eventNumber", element.getEventNumberElement(), false);
69023        composeInteger64Extras("eventNumber", element.getEventNumberElement(), false);
69024      }
69025      if (element.hasTimestampElement()) {
69026        composeInstantCore("timestamp", element.getTimestampElement(), false);
69027        composeInstantExtras("timestamp", element.getTimestampElement(), false);
69028      }
69029      if (element.hasFocus()) {
69030        composeReference("focus", element.getFocus());
69031      }
69032      if (element.hasAdditionalContext()) {
69033        openArray("additionalContext");
69034        for (Reference e : element.getAdditionalContext()) 
69035          composeReference(null, e);
69036        closeArray();
69037      };
69038  }
69039
69040  protected void composeSubscriptionTopic(String name, SubscriptionTopic element) throws IOException {
69041    if (element != null) {
69042      prop("resourceType", name);
69043      composeSubscriptionTopicProperties(element);
69044    }
69045  }
69046
69047  protected void composeSubscriptionTopicProperties(SubscriptionTopic element) throws IOException {
69048    composeCanonicalResourceProperties(element);
69049      if (element.hasUrlElement()) {
69050        composeUriCore("url", element.getUrlElement(), false);
69051        composeUriExtras("url", element.getUrlElement(), false);
69052      }
69053      if (element.hasIdentifier()) {
69054        openArray("identifier");
69055        for (Identifier e : element.getIdentifier()) 
69056          composeIdentifier(null, e);
69057        closeArray();
69058      };
69059      if (element.hasVersionElement()) {
69060        composeStringCore("version", element.getVersionElement(), false);
69061        composeStringExtras("version", element.getVersionElement(), false);
69062      }
69063      if (element.hasVersionAlgorithm()) {
69064        composeType("versionAlgorithm", element.getVersionAlgorithm());
69065      }
69066      if (element.hasNameElement()) {
69067        composeStringCore("name", element.getNameElement(), false);
69068        composeStringExtras("name", element.getNameElement(), false);
69069      }
69070      if (element.hasTitleElement()) {
69071        composeStringCore("title", element.getTitleElement(), false);
69072        composeStringExtras("title", element.getTitleElement(), false);
69073      }
69074      if (element.hasDerivedFrom()) {
69075        if (anyHasValue(element.getDerivedFrom())) {
69076          openArray("derivedFrom");
69077          for (CanonicalType e : element.getDerivedFrom()) 
69078            composeCanonicalCore(null, e, e != element.getDerivedFrom().get(element.getDerivedFrom().size()-1));
69079          closeArray();
69080        }
69081        if (anyHasExtras(element.getDerivedFrom())) {
69082          openArray("_derivedFrom");
69083          for (CanonicalType e : element.getDerivedFrom()) 
69084            composeCanonicalExtras(null, e, true);
69085          closeArray();
69086        }
69087      };
69088      if (element.hasStatusElement()) {
69089        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
69090        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
69091      }
69092      if (element.hasExperimentalElement()) {
69093        composeBooleanCore("experimental", element.getExperimentalElement(), false);
69094        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
69095      }
69096      if (element.hasDateElement()) {
69097        composeDateTimeCore("date", element.getDateElement(), false);
69098        composeDateTimeExtras("date", element.getDateElement(), false);
69099      }
69100      if (element.hasPublisherElement()) {
69101        composeStringCore("publisher", element.getPublisherElement(), false);
69102        composeStringExtras("publisher", element.getPublisherElement(), false);
69103      }
69104      if (element.hasContact()) {
69105        openArray("contact");
69106        for (ContactDetail e : element.getContact()) 
69107          composeContactDetail(null, e);
69108        closeArray();
69109      };
69110      if (element.hasDescriptionElement()) {
69111        composeMarkdownCore("description", element.getDescriptionElement(), false);
69112        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69113      }
69114      if (element.hasUseContext()) {
69115        openArray("useContext");
69116        for (UsageContext e : element.getUseContext()) 
69117          composeUsageContext(null, e);
69118        closeArray();
69119      };
69120      if (element.hasJurisdiction()) {
69121        openArray("jurisdiction");
69122        for (CodeableConcept e : element.getJurisdiction()) 
69123          composeCodeableConcept(null, e);
69124        closeArray();
69125      };
69126      if (element.hasPurposeElement()) {
69127        composeMarkdownCore("purpose", element.getPurposeElement(), false);
69128        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
69129      }
69130      if (element.hasCopyrightElement()) {
69131        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
69132        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
69133      }
69134      if (element.hasCopyrightLabelElement()) {
69135        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
69136        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
69137      }
69138      if (element.hasApprovalDateElement()) {
69139        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
69140        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
69141      }
69142      if (element.hasLastReviewDateElement()) {
69143        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
69144        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
69145      }
69146      if (element.hasEffectivePeriod()) {
69147        composePeriod("effectivePeriod", element.getEffectivePeriod());
69148      }
69149      if (element.hasResourceTrigger()) {
69150        openArray("resourceTrigger");
69151        for (SubscriptionTopic.SubscriptionTopicResourceTriggerComponent e : element.getResourceTrigger()) 
69152          composeSubscriptionTopicResourceTriggerComponent(null, e);
69153        closeArray();
69154      };
69155      if (element.hasEventTrigger()) {
69156        openArray("eventTrigger");
69157        for (SubscriptionTopic.SubscriptionTopicEventTriggerComponent e : element.getEventTrigger()) 
69158          composeSubscriptionTopicEventTriggerComponent(null, e);
69159        closeArray();
69160      };
69161      if (element.hasCanFilterBy()) {
69162        openArray("canFilterBy");
69163        for (SubscriptionTopic.SubscriptionTopicCanFilterByComponent e : element.getCanFilterBy()) 
69164          composeSubscriptionTopicCanFilterByComponent(null, e);
69165        closeArray();
69166      };
69167      if (element.hasNotificationShape()) {
69168        openArray("notificationShape");
69169        for (SubscriptionTopic.SubscriptionTopicNotificationShapeComponent e : element.getNotificationShape()) 
69170          composeSubscriptionTopicNotificationShapeComponent(null, e);
69171        closeArray();
69172      };
69173  }
69174
69175  protected void composeSubscriptionTopicResourceTriggerComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
69176    if (element != null) {
69177      open(name);
69178      composeSubscriptionTopicResourceTriggerComponentProperties(element);
69179      close();
69180    }
69181  }
69182
69183  protected void composeSubscriptionTopicResourceTriggerComponentProperties(SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
69184    composeBackboneElementProperties(element);
69185      if (element.hasDescriptionElement()) {
69186        composeMarkdownCore("description", element.getDescriptionElement(), false);
69187        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69188      }
69189      if (element.hasResourceElement()) {
69190        composeUriCore("resource", element.getResourceElement(), false);
69191        composeUriExtras("resource", element.getResourceElement(), false);
69192      }
69193      if (element.hasSupportedInteraction()) {
69194        openArray("supportedInteraction");
69195        for (Enumeration<SubscriptionTopic.InteractionTrigger> e : element.getSupportedInteraction()) 
69196          composeEnumerationCore(null, e, new SubscriptionTopic.InteractionTriggerEnumFactory(), true);
69197        closeArray();
69198        if (anyHasExtras(element.getSupportedInteraction())) {
69199          openArray("_supportedInteraction");
69200          for (Enumeration<SubscriptionTopic.InteractionTrigger> e : element.getSupportedInteraction()) 
69201            composeEnumerationExtras(null, e, new SubscriptionTopic.InteractionTriggerEnumFactory(), true);
69202          closeArray();
69203        }
69204      };
69205      if (element.hasQueryCriteria()) {
69206        composeSubscriptionTopicResourceTriggerQueryCriteriaComponent("queryCriteria", element.getQueryCriteria());
69207      }
69208      if (element.hasFhirPathCriteriaElement()) {
69209        composeStringCore("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
69210        composeStringExtras("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
69211      }
69212  }
69213
69214  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
69215    if (element != null) {
69216      open(name);
69217      composeSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(element);
69218      close();
69219    }
69220  }
69221
69222  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponentProperties(SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
69223    composeBackboneElementProperties(element);
69224      if (element.hasPreviousElement()) {
69225        composeStringCore("previous", element.getPreviousElement(), false);
69226        composeStringExtras("previous", element.getPreviousElement(), false);
69227      }
69228      if (element.hasResultForCreateElement()) {
69229        composeEnumerationCore("resultForCreate", element.getResultForCreateElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69230        composeEnumerationExtras("resultForCreate", element.getResultForCreateElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69231      }
69232      if (element.hasCurrentElement()) {
69233        composeStringCore("current", element.getCurrentElement(), false);
69234        composeStringExtras("current", element.getCurrentElement(), false);
69235      }
69236      if (element.hasResultForDeleteElement()) {
69237        composeEnumerationCore("resultForDelete", element.getResultForDeleteElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69238        composeEnumerationExtras("resultForDelete", element.getResultForDeleteElement(), new SubscriptionTopic.CriteriaNotExistsBehaviorEnumFactory(), false);
69239      }
69240      if (element.hasRequireBothElement()) {
69241        composeBooleanCore("requireBoth", element.getRequireBothElement(), false);
69242        composeBooleanExtras("requireBoth", element.getRequireBothElement(), false);
69243      }
69244  }
69245
69246  protected void composeSubscriptionTopicEventTriggerComponent(String name, SubscriptionTopic.SubscriptionTopicEventTriggerComponent element) throws IOException {
69247    if (element != null) {
69248      open(name);
69249      composeSubscriptionTopicEventTriggerComponentProperties(element);
69250      close();
69251    }
69252  }
69253
69254  protected void composeSubscriptionTopicEventTriggerComponentProperties(SubscriptionTopic.SubscriptionTopicEventTriggerComponent element) throws IOException {
69255    composeBackboneElementProperties(element);
69256      if (element.hasDescriptionElement()) {
69257        composeMarkdownCore("description", element.getDescriptionElement(), false);
69258        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69259      }
69260      if (element.hasEvent()) {
69261        composeCodeableConcept("event", element.getEvent());
69262      }
69263      if (element.hasResourceElement()) {
69264        composeUriCore("resource", element.getResourceElement(), false);
69265        composeUriExtras("resource", element.getResourceElement(), false);
69266      }
69267  }
69268
69269  protected void composeSubscriptionTopicCanFilterByComponent(String name, SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
69270    if (element != null) {
69271      open(name);
69272      composeSubscriptionTopicCanFilterByComponentProperties(element);
69273      close();
69274    }
69275  }
69276
69277  protected void composeSubscriptionTopicCanFilterByComponentProperties(SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
69278    composeBackboneElementProperties(element);
69279      if (element.hasDescriptionElement()) {
69280        composeMarkdownCore("description", element.getDescriptionElement(), false);
69281        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69282      }
69283      if (element.hasResourceElement()) {
69284        composeUriCore("resource", element.getResourceElement(), false);
69285        composeUriExtras("resource", element.getResourceElement(), false);
69286      }
69287      if (element.hasFilterParameterElement()) {
69288        composeStringCore("filterParameter", element.getFilterParameterElement(), false);
69289        composeStringExtras("filterParameter", element.getFilterParameterElement(), false);
69290      }
69291      if (element.hasFilterDefinitionElement()) {
69292        composeUriCore("filterDefinition", element.getFilterDefinitionElement(), false);
69293        composeUriExtras("filterDefinition", element.getFilterDefinitionElement(), false);
69294      }
69295      if (element.hasComparator()) {
69296        openArray("comparator");
69297        for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
69298          composeEnumerationCore(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
69299        closeArray();
69300        if (anyHasExtras(element.getComparator())) {
69301          openArray("_comparator");
69302          for (Enumeration<Enumerations.SearchComparator> e : element.getComparator()) 
69303            composeEnumerationExtras(null, e, new Enumerations.SearchComparatorEnumFactory(), true);
69304          closeArray();
69305        }
69306      };
69307      if (element.hasModifier()) {
69308        openArray("modifier");
69309        for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
69310          composeEnumerationCore(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
69311        closeArray();
69312        if (anyHasExtras(element.getModifier())) {
69313          openArray("_modifier");
69314          for (Enumeration<Enumerations.SearchModifierCode> e : element.getModifier()) 
69315            composeEnumerationExtras(null, e, new Enumerations.SearchModifierCodeEnumFactory(), true);
69316          closeArray();
69317        }
69318      };
69319  }
69320
69321  protected void composeSubscriptionTopicNotificationShapeComponent(String name, SubscriptionTopic.SubscriptionTopicNotificationShapeComponent element) throws IOException {
69322    if (element != null) {
69323      open(name);
69324      composeSubscriptionTopicNotificationShapeComponentProperties(element);
69325      close();
69326    }
69327  }
69328
69329  protected void composeSubscriptionTopicNotificationShapeComponentProperties(SubscriptionTopic.SubscriptionTopicNotificationShapeComponent element) throws IOException {
69330    composeBackboneElementProperties(element);
69331      if (element.hasResourceElement()) {
69332        composeUriCore("resource", element.getResourceElement(), false);
69333        composeUriExtras("resource", element.getResourceElement(), false);
69334      }
69335      if (element.hasInclude()) {
69336        if (anyHasValue(element.getInclude())) {
69337          openArray("include");
69338          for (StringType e : element.getInclude()) 
69339            composeStringCore(null, e, e != element.getInclude().get(element.getInclude().size()-1));
69340          closeArray();
69341        }
69342        if (anyHasExtras(element.getInclude())) {
69343          openArray("_include");
69344          for (StringType e : element.getInclude()) 
69345            composeStringExtras(null, e, true);
69346          closeArray();
69347        }
69348      };
69349      if (element.hasRevInclude()) {
69350        if (anyHasValue(element.getRevInclude())) {
69351          openArray("revInclude");
69352          for (StringType e : element.getRevInclude()) 
69353            composeStringCore(null, e, e != element.getRevInclude().get(element.getRevInclude().size()-1));
69354          closeArray();
69355        }
69356        if (anyHasExtras(element.getRevInclude())) {
69357          openArray("_revInclude");
69358          for (StringType e : element.getRevInclude()) 
69359            composeStringExtras(null, e, true);
69360          closeArray();
69361        }
69362      };
69363  }
69364
69365  protected void composeSubstance(String name, Substance element) throws IOException {
69366    if (element != null) {
69367      prop("resourceType", name);
69368      composeSubstanceProperties(element);
69369    }
69370  }
69371
69372  protected void composeSubstanceProperties(Substance element) throws IOException {
69373    composeDomainResourceProperties(element);
69374      if (element.hasIdentifier()) {
69375        openArray("identifier");
69376        for (Identifier e : element.getIdentifier()) 
69377          composeIdentifier(null, e);
69378        closeArray();
69379      };
69380      if (element.hasInstanceElement()) {
69381        composeBooleanCore("instance", element.getInstanceElement(), false);
69382        composeBooleanExtras("instance", element.getInstanceElement(), false);
69383      }
69384      if (element.hasStatusElement()) {
69385        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
69386        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
69387      }
69388      if (element.hasCategory()) {
69389        openArray("category");
69390        for (CodeableConcept e : element.getCategory()) 
69391          composeCodeableConcept(null, e);
69392        closeArray();
69393      };
69394      if (element.hasCode()) {
69395        composeCodeableReference("code", element.getCode());
69396      }
69397      if (element.hasDescriptionElement()) {
69398        composeMarkdownCore("description", element.getDescriptionElement(), false);
69399        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69400      }
69401      if (element.hasExpiryElement()) {
69402        composeDateTimeCore("expiry", element.getExpiryElement(), false);
69403        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
69404      }
69405      if (element.hasQuantity()) {
69406        composeQuantity("quantity", element.getQuantity());
69407      }
69408      if (element.hasIngredient()) {
69409        openArray("ingredient");
69410        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
69411          composeSubstanceIngredientComponent(null, e);
69412        closeArray();
69413      };
69414  }
69415
69416  protected void composeSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
69417    if (element != null) {
69418      open(name);
69419      composeSubstanceIngredientComponentProperties(element);
69420      close();
69421    }
69422  }
69423
69424  protected void composeSubstanceIngredientComponentProperties(Substance.SubstanceIngredientComponent element) throws IOException {
69425    composeBackboneElementProperties(element);
69426      if (element.hasQuantity()) {
69427        composeRatio("quantity", element.getQuantity());
69428      }
69429      if (element.hasSubstance()) {
69430        composeType("substance", element.getSubstance());
69431      }
69432  }
69433
69434  protected void composeSubstanceDefinition(String name, SubstanceDefinition element) throws IOException {
69435    if (element != null) {
69436      prop("resourceType", name);
69437      composeSubstanceDefinitionProperties(element);
69438    }
69439  }
69440
69441  protected void composeSubstanceDefinitionProperties(SubstanceDefinition element) throws IOException {
69442    composeDomainResourceProperties(element);
69443      if (element.hasIdentifier()) {
69444        openArray("identifier");
69445        for (Identifier e : element.getIdentifier()) 
69446          composeIdentifier(null, e);
69447        closeArray();
69448      };
69449      if (element.hasVersionElement()) {
69450        composeStringCore("version", element.getVersionElement(), false);
69451        composeStringExtras("version", element.getVersionElement(), false);
69452      }
69453      if (element.hasStatus()) {
69454        composeCodeableConcept("status", element.getStatus());
69455      }
69456      if (element.hasClassification()) {
69457        openArray("classification");
69458        for (CodeableConcept e : element.getClassification()) 
69459          composeCodeableConcept(null, e);
69460        closeArray();
69461      };
69462      if (element.hasDomain()) {
69463        composeCodeableConcept("domain", element.getDomain());
69464      }
69465      if (element.hasGrade()) {
69466        openArray("grade");
69467        for (CodeableConcept e : element.getGrade()) 
69468          composeCodeableConcept(null, e);
69469        closeArray();
69470      };
69471      if (element.hasDescriptionElement()) {
69472        composeMarkdownCore("description", element.getDescriptionElement(), false);
69473        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69474      }
69475      if (element.hasInformationSource()) {
69476        openArray("informationSource");
69477        for (Reference e : element.getInformationSource()) 
69478          composeReference(null, e);
69479        closeArray();
69480      };
69481      if (element.hasNote()) {
69482        openArray("note");
69483        for (Annotation e : element.getNote()) 
69484          composeAnnotation(null, e);
69485        closeArray();
69486      };
69487      if (element.hasManufacturer()) {
69488        openArray("manufacturer");
69489        for (Reference e : element.getManufacturer()) 
69490          composeReference(null, e);
69491        closeArray();
69492      };
69493      if (element.hasSupplier()) {
69494        openArray("supplier");
69495        for (Reference e : element.getSupplier()) 
69496          composeReference(null, e);
69497        closeArray();
69498      };
69499      if (element.hasMoiety()) {
69500        openArray("moiety");
69501        for (SubstanceDefinition.SubstanceDefinitionMoietyComponent e : element.getMoiety()) 
69502          composeSubstanceDefinitionMoietyComponent(null, e);
69503        closeArray();
69504      };
69505      if (element.hasCharacterization()) {
69506        openArray("characterization");
69507        for (SubstanceDefinition.SubstanceDefinitionCharacterizationComponent e : element.getCharacterization()) 
69508          composeSubstanceDefinitionCharacterizationComponent(null, e);
69509        closeArray();
69510      };
69511      if (element.hasProperty()) {
69512        openArray("property");
69513        for (SubstanceDefinition.SubstanceDefinitionPropertyComponent e : element.getProperty()) 
69514          composeSubstanceDefinitionPropertyComponent(null, e);
69515        closeArray();
69516      };
69517      if (element.hasReferenceInformation()) {
69518        composeReference("referenceInformation", element.getReferenceInformation());
69519      }
69520      if (element.hasMolecularWeight()) {
69521        openArray("molecularWeight");
69522        for (SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent e : element.getMolecularWeight()) 
69523          composeSubstanceDefinitionMolecularWeightComponent(null, e);
69524        closeArray();
69525      };
69526      if (element.hasStructure()) {
69527        composeSubstanceDefinitionStructureComponent("structure", element.getStructure());
69528      }
69529      if (element.hasCode()) {
69530        openArray("code");
69531        for (SubstanceDefinition.SubstanceDefinitionCodeComponent e : element.getCode()) 
69532          composeSubstanceDefinitionCodeComponent(null, e);
69533        closeArray();
69534      };
69535      if (element.hasName()) {
69536        openArray("name");
69537        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getName()) 
69538          composeSubstanceDefinitionNameComponent(null, e);
69539        closeArray();
69540      };
69541      if (element.hasRelationship()) {
69542        openArray("relationship");
69543        for (SubstanceDefinition.SubstanceDefinitionRelationshipComponent e : element.getRelationship()) 
69544          composeSubstanceDefinitionRelationshipComponent(null, e);
69545        closeArray();
69546      };
69547      if (element.hasNucleicAcid()) {
69548        composeReference("nucleicAcid", element.getNucleicAcid());
69549      }
69550      if (element.hasPolymer()) {
69551        composeReference("polymer", element.getPolymer());
69552      }
69553      if (element.hasProtein()) {
69554        composeReference("protein", element.getProtein());
69555      }
69556      if (element.hasSourceMaterial()) {
69557        composeSubstanceDefinitionSourceMaterialComponent("sourceMaterial", element.getSourceMaterial());
69558      }
69559  }
69560
69561  protected void composeSubstanceDefinitionMoietyComponent(String name, SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
69562    if (element != null) {
69563      open(name);
69564      composeSubstanceDefinitionMoietyComponentProperties(element);
69565      close();
69566    }
69567  }
69568
69569  protected void composeSubstanceDefinitionMoietyComponentProperties(SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
69570    composeBackboneElementProperties(element);
69571      if (element.hasRole()) {
69572        composeCodeableConcept("role", element.getRole());
69573      }
69574      if (element.hasIdentifier()) {
69575        composeIdentifier("identifier", element.getIdentifier());
69576      }
69577      if (element.hasNameElement()) {
69578        composeStringCore("name", element.getNameElement(), false);
69579        composeStringExtras("name", element.getNameElement(), false);
69580      }
69581      if (element.hasStereochemistry()) {
69582        composeCodeableConcept("stereochemistry", element.getStereochemistry());
69583      }
69584      if (element.hasOpticalActivity()) {
69585        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
69586      }
69587      if (element.hasMolecularFormulaElement()) {
69588        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
69589        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
69590      }
69591      if (element.hasAmount()) {
69592        composeType("amount", element.getAmount());
69593      }
69594      if (element.hasMeasurementType()) {
69595        composeCodeableConcept("measurementType", element.getMeasurementType());
69596      }
69597  }
69598
69599  protected void composeSubstanceDefinitionCharacterizationComponent(String name, SubstanceDefinition.SubstanceDefinitionCharacterizationComponent element) throws IOException {
69600    if (element != null) {
69601      open(name);
69602      composeSubstanceDefinitionCharacterizationComponentProperties(element);
69603      close();
69604    }
69605  }
69606
69607  protected void composeSubstanceDefinitionCharacterizationComponentProperties(SubstanceDefinition.SubstanceDefinitionCharacterizationComponent element) throws IOException {
69608    composeBackboneElementProperties(element);
69609      if (element.hasTechnique()) {
69610        composeCodeableConcept("technique", element.getTechnique());
69611      }
69612      if (element.hasForm()) {
69613        composeCodeableConcept("form", element.getForm());
69614      }
69615      if (element.hasDescriptionElement()) {
69616        composeMarkdownCore("description", element.getDescriptionElement(), false);
69617        composeMarkdownExtras("description", element.getDescriptionElement(), false);
69618      }
69619      if (element.hasFile()) {
69620        openArray("file");
69621        for (Attachment e : element.getFile()) 
69622          composeAttachment(null, e);
69623        closeArray();
69624      };
69625  }
69626
69627  protected void composeSubstanceDefinitionPropertyComponent(String name, SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
69628    if (element != null) {
69629      open(name);
69630      composeSubstanceDefinitionPropertyComponentProperties(element);
69631      close();
69632    }
69633  }
69634
69635  protected void composeSubstanceDefinitionPropertyComponentProperties(SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
69636    composeBackboneElementProperties(element);
69637      if (element.hasType()) {
69638        composeCodeableConcept("type", element.getType());
69639      }
69640      if (element.hasValue()) {
69641        composeType("value", element.getValue());
69642      }
69643  }
69644
69645  protected void composeSubstanceDefinitionMolecularWeightComponent(String name, SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent element) throws IOException {
69646    if (element != null) {
69647      open(name);
69648      composeSubstanceDefinitionMolecularWeightComponentProperties(element);
69649      close();
69650    }
69651  }
69652
69653  protected void composeSubstanceDefinitionMolecularWeightComponentProperties(SubstanceDefinition.SubstanceDefinitionMolecularWeightComponent element) throws IOException {
69654    composeBackboneElementProperties(element);
69655      if (element.hasMethod()) {
69656        composeCodeableConcept("method", element.getMethod());
69657      }
69658      if (element.hasType()) {
69659        composeCodeableConcept("type", element.getType());
69660      }
69661      if (element.hasAmount()) {
69662        composeQuantity("amount", element.getAmount());
69663      }
69664  }
69665
69666  protected void composeSubstanceDefinitionStructureComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
69667    if (element != null) {
69668      open(name);
69669      composeSubstanceDefinitionStructureComponentProperties(element);
69670      close();
69671    }
69672  }
69673
69674  protected void composeSubstanceDefinitionStructureComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
69675    composeBackboneElementProperties(element);
69676      if (element.hasStereochemistry()) {
69677        composeCodeableConcept("stereochemistry", element.getStereochemistry());
69678      }
69679      if (element.hasOpticalActivity()) {
69680        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
69681      }
69682      if (element.hasMolecularFormulaElement()) {
69683        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
69684        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
69685      }
69686      if (element.hasMolecularFormulaByMoietyElement()) {
69687        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
69688        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
69689      }
69690      if (element.hasMolecularWeight()) {
69691        composeSubstanceDefinitionMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
69692      }
69693      if (element.hasTechnique()) {
69694        openArray("technique");
69695        for (CodeableConcept e : element.getTechnique()) 
69696          composeCodeableConcept(null, e);
69697        closeArray();
69698      };
69699      if (element.hasSourceDocument()) {
69700        openArray("sourceDocument");
69701        for (Reference e : element.getSourceDocument()) 
69702          composeReference(null, e);
69703        closeArray();
69704      };
69705      if (element.hasRepresentation()) {
69706        openArray("representation");
69707        for (SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent e : element.getRepresentation()) 
69708          composeSubstanceDefinitionStructureRepresentationComponent(null, e);
69709        closeArray();
69710      };
69711  }
69712
69713  protected void composeSubstanceDefinitionStructureRepresentationComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
69714    if (element != null) {
69715      open(name);
69716      composeSubstanceDefinitionStructureRepresentationComponentProperties(element);
69717      close();
69718    }
69719  }
69720
69721  protected void composeSubstanceDefinitionStructureRepresentationComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
69722    composeBackboneElementProperties(element);
69723      if (element.hasType()) {
69724        composeCodeableConcept("type", element.getType());
69725      }
69726      if (element.hasRepresentationElement()) {
69727        composeStringCore("representation", element.getRepresentationElement(), false);
69728        composeStringExtras("representation", element.getRepresentationElement(), false);
69729      }
69730      if (element.hasFormat()) {
69731        composeCodeableConcept("format", element.getFormat());
69732      }
69733      if (element.hasDocument()) {
69734        composeReference("document", element.getDocument());
69735      }
69736  }
69737
69738  protected void composeSubstanceDefinitionCodeComponent(String name, SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
69739    if (element != null) {
69740      open(name);
69741      composeSubstanceDefinitionCodeComponentProperties(element);
69742      close();
69743    }
69744  }
69745
69746  protected void composeSubstanceDefinitionCodeComponentProperties(SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
69747    composeBackboneElementProperties(element);
69748      if (element.hasCode()) {
69749        composeCodeableConcept("code", element.getCode());
69750      }
69751      if (element.hasStatus()) {
69752        composeCodeableConcept("status", element.getStatus());
69753      }
69754      if (element.hasStatusDateElement()) {
69755        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
69756        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
69757      }
69758      if (element.hasNote()) {
69759        openArray("note");
69760        for (Annotation e : element.getNote()) 
69761          composeAnnotation(null, e);
69762        closeArray();
69763      };
69764      if (element.hasSource()) {
69765        openArray("source");
69766        for (Reference e : element.getSource()) 
69767          composeReference(null, e);
69768        closeArray();
69769      };
69770  }
69771
69772  protected void composeSubstanceDefinitionNameComponent(String name, SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
69773    if (element != null) {
69774      open(name);
69775      composeSubstanceDefinitionNameComponentProperties(element);
69776      close();
69777    }
69778  }
69779
69780  protected void composeSubstanceDefinitionNameComponentProperties(SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
69781    composeBackboneElementProperties(element);
69782      if (element.hasNameElement()) {
69783        composeStringCore("name", element.getNameElement(), false);
69784        composeStringExtras("name", element.getNameElement(), false);
69785      }
69786      if (element.hasType()) {
69787        composeCodeableConcept("type", element.getType());
69788      }
69789      if (element.hasStatus()) {
69790        composeCodeableConcept("status", element.getStatus());
69791      }
69792      if (element.hasPreferredElement()) {
69793        composeBooleanCore("preferred", element.getPreferredElement(), false);
69794        composeBooleanExtras("preferred", element.getPreferredElement(), false);
69795      }
69796      if (element.hasLanguage()) {
69797        openArray("language");
69798        for (CodeableConcept e : element.getLanguage()) 
69799          composeCodeableConcept(null, e);
69800        closeArray();
69801      };
69802      if (element.hasDomain()) {
69803        openArray("domain");
69804        for (CodeableConcept e : element.getDomain()) 
69805          composeCodeableConcept(null, e);
69806        closeArray();
69807      };
69808      if (element.hasJurisdiction()) {
69809        openArray("jurisdiction");
69810        for (CodeableConcept e : element.getJurisdiction()) 
69811          composeCodeableConcept(null, e);
69812        closeArray();
69813      };
69814      if (element.hasSynonym()) {
69815        openArray("synonym");
69816        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getSynonym()) 
69817          composeSubstanceDefinitionNameComponent(null, e);
69818        closeArray();
69819      };
69820      if (element.hasTranslation()) {
69821        openArray("translation");
69822        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getTranslation()) 
69823          composeSubstanceDefinitionNameComponent(null, e);
69824        closeArray();
69825      };
69826      if (element.hasOfficial()) {
69827        openArray("official");
69828        for (SubstanceDefinition.SubstanceDefinitionNameOfficialComponent e : element.getOfficial()) 
69829          composeSubstanceDefinitionNameOfficialComponent(null, e);
69830        closeArray();
69831      };
69832      if (element.hasSource()) {
69833        openArray("source");
69834        for (Reference e : element.getSource()) 
69835          composeReference(null, e);
69836        closeArray();
69837      };
69838  }
69839
69840  protected void composeSubstanceDefinitionNameOfficialComponent(String name, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
69841    if (element != null) {
69842      open(name);
69843      composeSubstanceDefinitionNameOfficialComponentProperties(element);
69844      close();
69845    }
69846  }
69847
69848  protected void composeSubstanceDefinitionNameOfficialComponentProperties(SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
69849    composeBackboneElementProperties(element);
69850      if (element.hasAuthority()) {
69851        composeCodeableConcept("authority", element.getAuthority());
69852      }
69853      if (element.hasStatus()) {
69854        composeCodeableConcept("status", element.getStatus());
69855      }
69856      if (element.hasDateElement()) {
69857        composeDateTimeCore("date", element.getDateElement(), false);
69858        composeDateTimeExtras("date", element.getDateElement(), false);
69859      }
69860  }
69861
69862  protected void composeSubstanceDefinitionRelationshipComponent(String name, SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
69863    if (element != null) {
69864      open(name);
69865      composeSubstanceDefinitionRelationshipComponentProperties(element);
69866      close();
69867    }
69868  }
69869
69870  protected void composeSubstanceDefinitionRelationshipComponentProperties(SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
69871    composeBackboneElementProperties(element);
69872      if (element.hasSubstanceDefinition()) {
69873        composeType("substanceDefinition", element.getSubstanceDefinition());
69874      }
69875      if (element.hasType()) {
69876        composeCodeableConcept("type", element.getType());
69877      }
69878      if (element.hasIsDefiningElement()) {
69879        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
69880        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
69881      }
69882      if (element.hasAmount()) {
69883        composeType("amount", element.getAmount());
69884      }
69885      if (element.hasRatioHighLimitAmount()) {
69886        composeRatio("ratioHighLimitAmount", element.getRatioHighLimitAmount());
69887      }
69888      if (element.hasComparator()) {
69889        composeCodeableConcept("comparator", element.getComparator());
69890      }
69891      if (element.hasSource()) {
69892        openArray("source");
69893        for (Reference e : element.getSource()) 
69894          composeReference(null, e);
69895        closeArray();
69896      };
69897  }
69898
69899  protected void composeSubstanceDefinitionSourceMaterialComponent(String name, SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent element) throws IOException {
69900    if (element != null) {
69901      open(name);
69902      composeSubstanceDefinitionSourceMaterialComponentProperties(element);
69903      close();
69904    }
69905  }
69906
69907  protected void composeSubstanceDefinitionSourceMaterialComponentProperties(SubstanceDefinition.SubstanceDefinitionSourceMaterialComponent element) throws IOException {
69908    composeBackboneElementProperties(element);
69909      if (element.hasType()) {
69910        composeCodeableConcept("type", element.getType());
69911      }
69912      if (element.hasGenus()) {
69913        composeCodeableConcept("genus", element.getGenus());
69914      }
69915      if (element.hasSpecies()) {
69916        composeCodeableConcept("species", element.getSpecies());
69917      }
69918      if (element.hasPart()) {
69919        composeCodeableConcept("part", element.getPart());
69920      }
69921      if (element.hasCountryOfOrigin()) {
69922        openArray("countryOfOrigin");
69923        for (CodeableConcept e : element.getCountryOfOrigin()) 
69924          composeCodeableConcept(null, e);
69925        closeArray();
69926      };
69927  }
69928
69929  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
69930    if (element != null) {
69931      prop("resourceType", name);
69932      composeSubstanceNucleicAcidProperties(element);
69933    }
69934  }
69935
69936  protected void composeSubstanceNucleicAcidProperties(SubstanceNucleicAcid element) throws IOException {
69937    composeDomainResourceProperties(element);
69938      if (element.hasSequenceType()) {
69939        composeCodeableConcept("sequenceType", element.getSequenceType());
69940      }
69941      if (element.hasNumberOfSubunitsElement()) {
69942        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
69943        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
69944      }
69945      if (element.hasAreaOfHybridisationElement()) {
69946        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
69947        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
69948      }
69949      if (element.hasOligoNucleotideType()) {
69950        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
69951      }
69952      if (element.hasSubunit()) {
69953        openArray("subunit");
69954        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
69955          composeSubstanceNucleicAcidSubunitComponent(null, e);
69956        closeArray();
69957      };
69958  }
69959
69960  protected void composeSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
69961    if (element != null) {
69962      open(name);
69963      composeSubstanceNucleicAcidSubunitComponentProperties(element);
69964      close();
69965    }
69966  }
69967
69968  protected void composeSubstanceNucleicAcidSubunitComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
69969    composeBackboneElementProperties(element);
69970      if (element.hasSubunitElement()) {
69971        composeIntegerCore("subunit", element.getSubunitElement(), false);
69972        composeIntegerExtras("subunit", element.getSubunitElement(), false);
69973      }
69974      if (element.hasSequenceElement()) {
69975        composeStringCore("sequence", element.getSequenceElement(), false);
69976        composeStringExtras("sequence", element.getSequenceElement(), false);
69977      }
69978      if (element.hasLengthElement()) {
69979        composeIntegerCore("length", element.getLengthElement(), false);
69980        composeIntegerExtras("length", element.getLengthElement(), false);
69981      }
69982      if (element.hasSequenceAttachment()) {
69983        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
69984      }
69985      if (element.hasFivePrime()) {
69986        composeCodeableConcept("fivePrime", element.getFivePrime());
69987      }
69988      if (element.hasThreePrime()) {
69989        composeCodeableConcept("threePrime", element.getThreePrime());
69990      }
69991      if (element.hasLinkage()) {
69992        openArray("linkage");
69993        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
69994          composeSubstanceNucleicAcidSubunitLinkageComponent(null, e);
69995        closeArray();
69996      };
69997      if (element.hasSugar()) {
69998        openArray("sugar");
69999        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
70000          composeSubstanceNucleicAcidSubunitSugarComponent(null, e);
70001        closeArray();
70002      };
70003  }
70004
70005  protected void composeSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
70006    if (element != null) {
70007      open(name);
70008      composeSubstanceNucleicAcidSubunitLinkageComponentProperties(element);
70009      close();
70010    }
70011  }
70012
70013  protected void composeSubstanceNucleicAcidSubunitLinkageComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
70014    composeBackboneElementProperties(element);
70015      if (element.hasConnectivityElement()) {
70016        composeStringCore("connectivity", element.getConnectivityElement(), false);
70017        composeStringExtras("connectivity", element.getConnectivityElement(), false);
70018      }
70019      if (element.hasIdentifier()) {
70020        composeIdentifier("identifier", element.getIdentifier());
70021      }
70022      if (element.hasNameElement()) {
70023        composeStringCore("name", element.getNameElement(), false);
70024        composeStringExtras("name", element.getNameElement(), false);
70025      }
70026      if (element.hasResidueSiteElement()) {
70027        composeStringCore("residueSite", element.getResidueSiteElement(), false);
70028        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
70029      }
70030  }
70031
70032  protected void composeSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
70033    if (element != null) {
70034      open(name);
70035      composeSubstanceNucleicAcidSubunitSugarComponentProperties(element);
70036      close();
70037    }
70038  }
70039
70040  protected void composeSubstanceNucleicAcidSubunitSugarComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
70041    composeBackboneElementProperties(element);
70042      if (element.hasIdentifier()) {
70043        composeIdentifier("identifier", element.getIdentifier());
70044      }
70045      if (element.hasNameElement()) {
70046        composeStringCore("name", element.getNameElement(), false);
70047        composeStringExtras("name", element.getNameElement(), false);
70048      }
70049      if (element.hasResidueSiteElement()) {
70050        composeStringCore("residueSite", element.getResidueSiteElement(), false);
70051        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
70052      }
70053  }
70054
70055  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
70056    if (element != null) {
70057      prop("resourceType", name);
70058      composeSubstancePolymerProperties(element);
70059    }
70060  }
70061
70062  protected void composeSubstancePolymerProperties(SubstancePolymer element) throws IOException {
70063    composeDomainResourceProperties(element);
70064      if (element.hasIdentifier()) {
70065        composeIdentifier("identifier", element.getIdentifier());
70066      }
70067      if (element.hasClass_()) {
70068        composeCodeableConcept("class", element.getClass_());
70069      }
70070      if (element.hasGeometry()) {
70071        composeCodeableConcept("geometry", element.getGeometry());
70072      }
70073      if (element.hasCopolymerConnectivity()) {
70074        openArray("copolymerConnectivity");
70075        for (CodeableConcept e : element.getCopolymerConnectivity()) 
70076          composeCodeableConcept(null, e);
70077        closeArray();
70078      };
70079      if (element.hasModificationElement()) {
70080        composeStringCore("modification", element.getModificationElement(), false);
70081        composeStringExtras("modification", element.getModificationElement(), false);
70082      }
70083      if (element.hasMonomerSet()) {
70084        openArray("monomerSet");
70085        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
70086          composeSubstancePolymerMonomerSetComponent(null, e);
70087        closeArray();
70088      };
70089      if (element.hasRepeat()) {
70090        openArray("repeat");
70091        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
70092          composeSubstancePolymerRepeatComponent(null, e);
70093        closeArray();
70094      };
70095  }
70096
70097  protected void composeSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
70098    if (element != null) {
70099      open(name);
70100      composeSubstancePolymerMonomerSetComponentProperties(element);
70101      close();
70102    }
70103  }
70104
70105  protected void composeSubstancePolymerMonomerSetComponentProperties(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
70106    composeBackboneElementProperties(element);
70107      if (element.hasRatioType()) {
70108        composeCodeableConcept("ratioType", element.getRatioType());
70109      }
70110      if (element.hasStartingMaterial()) {
70111        openArray("startingMaterial");
70112        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
70113          composeSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
70114        closeArray();
70115      };
70116  }
70117
70118  protected void composeSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
70119    if (element != null) {
70120      open(name);
70121      composeSubstancePolymerMonomerSetStartingMaterialComponentProperties(element);
70122      close();
70123    }
70124  }
70125
70126  protected void composeSubstancePolymerMonomerSetStartingMaterialComponentProperties(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
70127    composeBackboneElementProperties(element);
70128      if (element.hasCode()) {
70129        composeCodeableConcept("code", element.getCode());
70130      }
70131      if (element.hasCategory()) {
70132        composeCodeableConcept("category", element.getCategory());
70133      }
70134      if (element.hasIsDefiningElement()) {
70135        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
70136        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
70137      }
70138      if (element.hasAmount()) {
70139        composeQuantity("amount", element.getAmount());
70140      }
70141  }
70142
70143  protected void composeSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
70144    if (element != null) {
70145      open(name);
70146      composeSubstancePolymerRepeatComponentProperties(element);
70147      close();
70148    }
70149  }
70150
70151  protected void composeSubstancePolymerRepeatComponentProperties(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
70152    composeBackboneElementProperties(element);
70153      if (element.hasAverageMolecularFormulaElement()) {
70154        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
70155        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
70156      }
70157      if (element.hasRepeatUnitAmountType()) {
70158        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
70159      }
70160      if (element.hasRepeatUnit()) {
70161        openArray("repeatUnit");
70162        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
70163          composeSubstancePolymerRepeatRepeatUnitComponent(null, e);
70164        closeArray();
70165      };
70166  }
70167
70168  protected void composeSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
70169    if (element != null) {
70170      open(name);
70171      composeSubstancePolymerRepeatRepeatUnitComponentProperties(element);
70172      close();
70173    }
70174  }
70175
70176  protected void composeSubstancePolymerRepeatRepeatUnitComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
70177    composeBackboneElementProperties(element);
70178      if (element.hasUnitElement()) {
70179        composeStringCore("unit", element.getUnitElement(), false);
70180        composeStringExtras("unit", element.getUnitElement(), false);
70181      }
70182      if (element.hasOrientation()) {
70183        composeCodeableConcept("orientation", element.getOrientation());
70184      }
70185      if (element.hasAmountElement()) {
70186        composeIntegerCore("amount", element.getAmountElement(), false);
70187        composeIntegerExtras("amount", element.getAmountElement(), false);
70188      }
70189      if (element.hasDegreeOfPolymerisation()) {
70190        openArray("degreeOfPolymerisation");
70191        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
70192          composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
70193        closeArray();
70194      };
70195      if (element.hasStructuralRepresentation()) {
70196        openArray("structuralRepresentation");
70197        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
70198          composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
70199        closeArray();
70200      };
70201  }
70202
70203  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
70204    if (element != null) {
70205      open(name);
70206      composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(element);
70207      close();
70208    }
70209  }
70210
70211  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
70212    composeBackboneElementProperties(element);
70213      if (element.hasType()) {
70214        composeCodeableConcept("type", element.getType());
70215      }
70216      if (element.hasAverageElement()) {
70217        composeIntegerCore("average", element.getAverageElement(), false);
70218        composeIntegerExtras("average", element.getAverageElement(), false);
70219      }
70220      if (element.hasLowElement()) {
70221        composeIntegerCore("low", element.getLowElement(), false);
70222        composeIntegerExtras("low", element.getLowElement(), false);
70223      }
70224      if (element.hasHighElement()) {
70225        composeIntegerCore("high", element.getHighElement(), false);
70226        composeIntegerExtras("high", element.getHighElement(), false);
70227      }
70228  }
70229
70230  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
70231    if (element != null) {
70232      open(name);
70233      composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(element);
70234      close();
70235    }
70236  }
70237
70238  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
70239    composeBackboneElementProperties(element);
70240      if (element.hasType()) {
70241        composeCodeableConcept("type", element.getType());
70242      }
70243      if (element.hasRepresentationElement()) {
70244        composeStringCore("representation", element.getRepresentationElement(), false);
70245        composeStringExtras("representation", element.getRepresentationElement(), false);
70246      }
70247      if (element.hasFormat()) {
70248        composeCodeableConcept("format", element.getFormat());
70249      }
70250      if (element.hasAttachment()) {
70251        composeAttachment("attachment", element.getAttachment());
70252      }
70253  }
70254
70255  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
70256    if (element != null) {
70257      prop("resourceType", name);
70258      composeSubstanceProteinProperties(element);
70259    }
70260  }
70261
70262  protected void composeSubstanceProteinProperties(SubstanceProtein element) throws IOException {
70263    composeDomainResourceProperties(element);
70264      if (element.hasSequenceType()) {
70265        composeCodeableConcept("sequenceType", element.getSequenceType());
70266      }
70267      if (element.hasNumberOfSubunitsElement()) {
70268        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
70269        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
70270      }
70271      if (element.hasDisulfideLinkage()) {
70272        if (anyHasValue(element.getDisulfideLinkage())) {
70273          openArray("disulfideLinkage");
70274          for (StringType e : element.getDisulfideLinkage()) 
70275            composeStringCore(null, e, e != element.getDisulfideLinkage().get(element.getDisulfideLinkage().size()-1));
70276          closeArray();
70277        }
70278        if (anyHasExtras(element.getDisulfideLinkage())) {
70279          openArray("_disulfideLinkage");
70280          for (StringType e : element.getDisulfideLinkage()) 
70281            composeStringExtras(null, e, true);
70282          closeArray();
70283        }
70284      };
70285      if (element.hasSubunit()) {
70286        openArray("subunit");
70287        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
70288          composeSubstanceProteinSubunitComponent(null, e);
70289        closeArray();
70290      };
70291  }
70292
70293  protected void composeSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
70294    if (element != null) {
70295      open(name);
70296      composeSubstanceProteinSubunitComponentProperties(element);
70297      close();
70298    }
70299  }
70300
70301  protected void composeSubstanceProteinSubunitComponentProperties(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
70302    composeBackboneElementProperties(element);
70303      if (element.hasSubunitElement()) {
70304        composeIntegerCore("subunit", element.getSubunitElement(), false);
70305        composeIntegerExtras("subunit", element.getSubunitElement(), false);
70306      }
70307      if (element.hasSequenceElement()) {
70308        composeStringCore("sequence", element.getSequenceElement(), false);
70309        composeStringExtras("sequence", element.getSequenceElement(), false);
70310      }
70311      if (element.hasLengthElement()) {
70312        composeIntegerCore("length", element.getLengthElement(), false);
70313        composeIntegerExtras("length", element.getLengthElement(), false);
70314      }
70315      if (element.hasSequenceAttachment()) {
70316        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
70317      }
70318      if (element.hasNTerminalModificationId()) {
70319        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
70320      }
70321      if (element.hasNTerminalModificationElement()) {
70322        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
70323        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
70324      }
70325      if (element.hasCTerminalModificationId()) {
70326        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
70327      }
70328      if (element.hasCTerminalModificationElement()) {
70329        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
70330        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
70331      }
70332  }
70333
70334  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
70335    if (element != null) {
70336      prop("resourceType", name);
70337      composeSubstanceReferenceInformationProperties(element);
70338    }
70339  }
70340
70341  protected void composeSubstanceReferenceInformationProperties(SubstanceReferenceInformation element) throws IOException {
70342    composeDomainResourceProperties(element);
70343      if (element.hasCommentElement()) {
70344        composeStringCore("comment", element.getCommentElement(), false);
70345        composeStringExtras("comment", element.getCommentElement(), false);
70346      }
70347      if (element.hasGene()) {
70348        openArray("gene");
70349        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
70350          composeSubstanceReferenceInformationGeneComponent(null, e);
70351        closeArray();
70352      };
70353      if (element.hasGeneElement()) {
70354        openArray("geneElement");
70355        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
70356          composeSubstanceReferenceInformationGeneElementComponent(null, e);
70357        closeArray();
70358      };
70359      if (element.hasTarget()) {
70360        openArray("target");
70361        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
70362          composeSubstanceReferenceInformationTargetComponent(null, e);
70363        closeArray();
70364      };
70365  }
70366
70367  protected void composeSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
70368    if (element != null) {
70369      open(name);
70370      composeSubstanceReferenceInformationGeneComponentProperties(element);
70371      close();
70372    }
70373  }
70374
70375  protected void composeSubstanceReferenceInformationGeneComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
70376    composeBackboneElementProperties(element);
70377      if (element.hasGeneSequenceOrigin()) {
70378        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
70379      }
70380      if (element.hasGene()) {
70381        composeCodeableConcept("gene", element.getGene());
70382      }
70383      if (element.hasSource()) {
70384        openArray("source");
70385        for (Reference e : element.getSource()) 
70386          composeReference(null, e);
70387        closeArray();
70388      };
70389  }
70390
70391  protected void composeSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
70392    if (element != null) {
70393      open(name);
70394      composeSubstanceReferenceInformationGeneElementComponentProperties(element);
70395      close();
70396    }
70397  }
70398
70399  protected void composeSubstanceReferenceInformationGeneElementComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
70400    composeBackboneElementProperties(element);
70401      if (element.hasType()) {
70402        composeCodeableConcept("type", element.getType());
70403      }
70404      if (element.hasElement()) {
70405        composeIdentifier("element", element.getElement());
70406      }
70407      if (element.hasSource()) {
70408        openArray("source");
70409        for (Reference e : element.getSource()) 
70410          composeReference(null, e);
70411        closeArray();
70412      };
70413  }
70414
70415  protected void composeSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
70416    if (element != null) {
70417      open(name);
70418      composeSubstanceReferenceInformationTargetComponentProperties(element);
70419      close();
70420    }
70421  }
70422
70423  protected void composeSubstanceReferenceInformationTargetComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
70424    composeBackboneElementProperties(element);
70425      if (element.hasTarget()) {
70426        composeIdentifier("target", element.getTarget());
70427      }
70428      if (element.hasType()) {
70429        composeCodeableConcept("type", element.getType());
70430      }
70431      if (element.hasInteraction()) {
70432        composeCodeableConcept("interaction", element.getInteraction());
70433      }
70434      if (element.hasOrganism()) {
70435        composeCodeableConcept("organism", element.getOrganism());
70436      }
70437      if (element.hasOrganismType()) {
70438        composeCodeableConcept("organismType", element.getOrganismType());
70439      }
70440      if (element.hasAmount()) {
70441        composeType("amount", element.getAmount());
70442      }
70443      if (element.hasAmountType()) {
70444        composeCodeableConcept("amountType", element.getAmountType());
70445      }
70446      if (element.hasSource()) {
70447        openArray("source");
70448        for (Reference e : element.getSource()) 
70449          composeReference(null, e);
70450        closeArray();
70451      };
70452  }
70453
70454  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
70455    if (element != null) {
70456      prop("resourceType", name);
70457      composeSubstanceSourceMaterialProperties(element);
70458    }
70459  }
70460
70461  protected void composeSubstanceSourceMaterialProperties(SubstanceSourceMaterial element) throws IOException {
70462    composeDomainResourceProperties(element);
70463      if (element.hasSourceMaterialClass()) {
70464        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
70465      }
70466      if (element.hasSourceMaterialType()) {
70467        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
70468      }
70469      if (element.hasSourceMaterialState()) {
70470        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
70471      }
70472      if (element.hasOrganismId()) {
70473        composeIdentifier("organismId", element.getOrganismId());
70474      }
70475      if (element.hasOrganismNameElement()) {
70476        composeStringCore("organismName", element.getOrganismNameElement(), false);
70477        composeStringExtras("organismName", element.getOrganismNameElement(), false);
70478      }
70479      if (element.hasParentSubstanceId()) {
70480        openArray("parentSubstanceId");
70481        for (Identifier e : element.getParentSubstanceId()) 
70482          composeIdentifier(null, e);
70483        closeArray();
70484      };
70485      if (element.hasParentSubstanceName()) {
70486        if (anyHasValue(element.getParentSubstanceName())) {
70487          openArray("parentSubstanceName");
70488          for (StringType e : element.getParentSubstanceName()) 
70489            composeStringCore(null, e, e != element.getParentSubstanceName().get(element.getParentSubstanceName().size()-1));
70490          closeArray();
70491        }
70492        if (anyHasExtras(element.getParentSubstanceName())) {
70493          openArray("_parentSubstanceName");
70494          for (StringType e : element.getParentSubstanceName()) 
70495            composeStringExtras(null, e, true);
70496          closeArray();
70497        }
70498      };
70499      if (element.hasCountryOfOrigin()) {
70500        openArray("countryOfOrigin");
70501        for (CodeableConcept e : element.getCountryOfOrigin()) 
70502          composeCodeableConcept(null, e);
70503        closeArray();
70504      };
70505      if (element.hasGeographicalLocation()) {
70506        if (anyHasValue(element.getGeographicalLocation())) {
70507          openArray("geographicalLocation");
70508          for (StringType e : element.getGeographicalLocation()) 
70509            composeStringCore(null, e, e != element.getGeographicalLocation().get(element.getGeographicalLocation().size()-1));
70510          closeArray();
70511        }
70512        if (anyHasExtras(element.getGeographicalLocation())) {
70513          openArray("_geographicalLocation");
70514          for (StringType e : element.getGeographicalLocation()) 
70515            composeStringExtras(null, e, true);
70516          closeArray();
70517        }
70518      };
70519      if (element.hasDevelopmentStage()) {
70520        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
70521      }
70522      if (element.hasFractionDescription()) {
70523        openArray("fractionDescription");
70524        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
70525          composeSubstanceSourceMaterialFractionDescriptionComponent(null, e);
70526        closeArray();
70527      };
70528      if (element.hasOrganism()) {
70529        composeSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
70530      }
70531      if (element.hasPartDescription()) {
70532        openArray("partDescription");
70533        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
70534          composeSubstanceSourceMaterialPartDescriptionComponent(null, e);
70535        closeArray();
70536      };
70537  }
70538
70539  protected void composeSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
70540    if (element != null) {
70541      open(name);
70542      composeSubstanceSourceMaterialFractionDescriptionComponentProperties(element);
70543      close();
70544    }
70545  }
70546
70547  protected void composeSubstanceSourceMaterialFractionDescriptionComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
70548    composeBackboneElementProperties(element);
70549      if (element.hasFractionElement()) {
70550        composeStringCore("fraction", element.getFractionElement(), false);
70551        composeStringExtras("fraction", element.getFractionElement(), false);
70552      }
70553      if (element.hasMaterialType()) {
70554        composeCodeableConcept("materialType", element.getMaterialType());
70555      }
70556  }
70557
70558  protected void composeSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
70559    if (element != null) {
70560      open(name);
70561      composeSubstanceSourceMaterialOrganismComponentProperties(element);
70562      close();
70563    }
70564  }
70565
70566  protected void composeSubstanceSourceMaterialOrganismComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
70567    composeBackboneElementProperties(element);
70568      if (element.hasFamily()) {
70569        composeCodeableConcept("family", element.getFamily());
70570      }
70571      if (element.hasGenus()) {
70572        composeCodeableConcept("genus", element.getGenus());
70573      }
70574      if (element.hasSpecies()) {
70575        composeCodeableConcept("species", element.getSpecies());
70576      }
70577      if (element.hasIntraspecificType()) {
70578        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
70579      }
70580      if (element.hasIntraspecificDescriptionElement()) {
70581        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
70582        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
70583      }
70584      if (element.hasAuthor()) {
70585        openArray("author");
70586        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
70587          composeSubstanceSourceMaterialOrganismAuthorComponent(null, e);
70588        closeArray();
70589      };
70590      if (element.hasHybrid()) {
70591        composeSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
70592      }
70593      if (element.hasOrganismGeneral()) {
70594        composeSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
70595      }
70596  }
70597
70598  protected void composeSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
70599    if (element != null) {
70600      open(name);
70601      composeSubstanceSourceMaterialOrganismAuthorComponentProperties(element);
70602      close();
70603    }
70604  }
70605
70606  protected void composeSubstanceSourceMaterialOrganismAuthorComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
70607    composeBackboneElementProperties(element);
70608      if (element.hasAuthorType()) {
70609        composeCodeableConcept("authorType", element.getAuthorType());
70610      }
70611      if (element.hasAuthorDescriptionElement()) {
70612        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
70613        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
70614      }
70615  }
70616
70617  protected void composeSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
70618    if (element != null) {
70619      open(name);
70620      composeSubstanceSourceMaterialOrganismHybridComponentProperties(element);
70621      close();
70622    }
70623  }
70624
70625  protected void composeSubstanceSourceMaterialOrganismHybridComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
70626    composeBackboneElementProperties(element);
70627      if (element.hasMaternalOrganismIdElement()) {
70628        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
70629        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
70630      }
70631      if (element.hasMaternalOrganismNameElement()) {
70632        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
70633        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
70634      }
70635      if (element.hasPaternalOrganismIdElement()) {
70636        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
70637        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
70638      }
70639      if (element.hasPaternalOrganismNameElement()) {
70640        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
70641        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
70642      }
70643      if (element.hasHybridType()) {
70644        composeCodeableConcept("hybridType", element.getHybridType());
70645      }
70646  }
70647
70648  protected void composeSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
70649    if (element != null) {
70650      open(name);
70651      composeSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(element);
70652      close();
70653    }
70654  }
70655
70656  protected void composeSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
70657    composeBackboneElementProperties(element);
70658      if (element.hasKingdom()) {
70659        composeCodeableConcept("kingdom", element.getKingdom());
70660      }
70661      if (element.hasPhylum()) {
70662        composeCodeableConcept("phylum", element.getPhylum());
70663      }
70664      if (element.hasClass_()) {
70665        composeCodeableConcept("class", element.getClass_());
70666      }
70667      if (element.hasOrder()) {
70668        composeCodeableConcept("order", element.getOrder());
70669      }
70670  }
70671
70672  protected void composeSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
70673    if (element != null) {
70674      open(name);
70675      composeSubstanceSourceMaterialPartDescriptionComponentProperties(element);
70676      close();
70677    }
70678  }
70679
70680  protected void composeSubstanceSourceMaterialPartDescriptionComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
70681    composeBackboneElementProperties(element);
70682      if (element.hasPart()) {
70683        composeCodeableConcept("part", element.getPart());
70684      }
70685      if (element.hasPartLocation()) {
70686        composeCodeableConcept("partLocation", element.getPartLocation());
70687      }
70688  }
70689
70690  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
70691    if (element != null) {
70692      prop("resourceType", name);
70693      composeSupplyDeliveryProperties(element);
70694    }
70695  }
70696
70697  protected void composeSupplyDeliveryProperties(SupplyDelivery element) throws IOException {
70698    composeDomainResourceProperties(element);
70699      if (element.hasIdentifier()) {
70700        openArray("identifier");
70701        for (Identifier e : element.getIdentifier()) 
70702          composeIdentifier(null, e);
70703        closeArray();
70704      };
70705      if (element.hasBasedOn()) {
70706        openArray("basedOn");
70707        for (Reference e : element.getBasedOn()) 
70708          composeReference(null, e);
70709        closeArray();
70710      };
70711      if (element.hasPartOf()) {
70712        openArray("partOf");
70713        for (Reference e : element.getPartOf()) 
70714          composeReference(null, e);
70715        closeArray();
70716      };
70717      if (element.hasStatusElement()) {
70718        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
70719        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
70720      }
70721      if (element.hasPatient()) {
70722        composeReference("patient", element.getPatient());
70723      }
70724      if (element.hasType()) {
70725        composeCodeableConcept("type", element.getType());
70726      }
70727      if (element.hasSuppliedItem()) {
70728        openArray("suppliedItem");
70729        for (SupplyDelivery.SupplyDeliverySuppliedItemComponent e : element.getSuppliedItem()) 
70730          composeSupplyDeliverySuppliedItemComponent(null, e);
70731        closeArray();
70732      };
70733      if (element.hasOccurrence()) {
70734        composeType("occurrence", element.getOccurrence());
70735      }
70736      if (element.hasSupplier()) {
70737        composeReference("supplier", element.getSupplier());
70738      }
70739      if (element.hasDestination()) {
70740        composeReference("destination", element.getDestination());
70741      }
70742      if (element.hasReceiver()) {
70743        openArray("receiver");
70744        for (Reference e : element.getReceiver()) 
70745          composeReference(null, e);
70746        closeArray();
70747      };
70748  }
70749
70750  protected void composeSupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
70751    if (element != null) {
70752      open(name);
70753      composeSupplyDeliverySuppliedItemComponentProperties(element);
70754      close();
70755    }
70756  }
70757
70758  protected void composeSupplyDeliverySuppliedItemComponentProperties(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
70759    composeBackboneElementProperties(element);
70760      if (element.hasQuantity()) {
70761        composeQuantity("quantity", element.getQuantity());
70762      }
70763      if (element.hasItem()) {
70764        composeType("item", element.getItem());
70765      }
70766  }
70767
70768  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
70769    if (element != null) {
70770      prop("resourceType", name);
70771      composeSupplyRequestProperties(element);
70772    }
70773  }
70774
70775  protected void composeSupplyRequestProperties(SupplyRequest element) throws IOException {
70776    composeDomainResourceProperties(element);
70777      if (element.hasIdentifier()) {
70778        openArray("identifier");
70779        for (Identifier e : element.getIdentifier()) 
70780          composeIdentifier(null, e);
70781        closeArray();
70782      };
70783      if (element.hasStatusElement()) {
70784        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
70785        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
70786      }
70787      if (element.hasBasedOn()) {
70788        openArray("basedOn");
70789        for (Reference e : element.getBasedOn()) 
70790          composeReference(null, e);
70791        closeArray();
70792      };
70793      if (element.hasCategory()) {
70794        composeCodeableConcept("category", element.getCategory());
70795      }
70796      if (element.hasPriorityElement()) {
70797        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70798        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70799      }
70800      if (element.hasDeliverFor()) {
70801        composeReference("deliverFor", element.getDeliverFor());
70802      }
70803      if (element.hasItem()) {
70804        composeCodeableReference("item", element.getItem());
70805      }
70806      if (element.hasQuantity()) {
70807        composeQuantity("quantity", element.getQuantity());
70808      }
70809      if (element.hasParameter()) {
70810        openArray("parameter");
70811        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
70812          composeSupplyRequestParameterComponent(null, e);
70813        closeArray();
70814      };
70815      if (element.hasOccurrence()) {
70816        composeType("occurrence", element.getOccurrence());
70817      }
70818      if (element.hasAuthoredOnElement()) {
70819        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
70820        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
70821      }
70822      if (element.hasRequester()) {
70823        composeReference("requester", element.getRequester());
70824      }
70825      if (element.hasSupplier()) {
70826        openArray("supplier");
70827        for (Reference e : element.getSupplier()) 
70828          composeReference(null, e);
70829        closeArray();
70830      };
70831      if (element.hasReason()) {
70832        openArray("reason");
70833        for (CodeableReference e : element.getReason()) 
70834          composeCodeableReference(null, e);
70835        closeArray();
70836      };
70837      if (element.hasDeliverFrom()) {
70838        composeReference("deliverFrom", element.getDeliverFrom());
70839      }
70840      if (element.hasDeliverTo()) {
70841        composeReference("deliverTo", element.getDeliverTo());
70842      }
70843  }
70844
70845  protected void composeSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
70846    if (element != null) {
70847      open(name);
70848      composeSupplyRequestParameterComponentProperties(element);
70849      close();
70850    }
70851  }
70852
70853  protected void composeSupplyRequestParameterComponentProperties(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
70854    composeBackboneElementProperties(element);
70855      if (element.hasCode()) {
70856        composeCodeableConcept("code", element.getCode());
70857      }
70858      if (element.hasValue()) {
70859        composeType("value", element.getValue());
70860      }
70861  }
70862
70863  protected void composeTask(String name, Task element) throws IOException {
70864    if (element != null) {
70865      prop("resourceType", name);
70866      composeTaskProperties(element);
70867    }
70868  }
70869
70870  protected void composeTaskProperties(Task element) throws IOException {
70871    composeDomainResourceProperties(element);
70872      if (element.hasIdentifier()) {
70873        openArray("identifier");
70874        for (Identifier e : element.getIdentifier()) 
70875          composeIdentifier(null, e);
70876        closeArray();
70877      };
70878      if (element.hasInstantiatesCanonicalElement()) {
70879        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
70880        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
70881      }
70882      if (element.hasInstantiatesUriElement()) {
70883        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
70884        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
70885      }
70886      if (element.hasBasedOn()) {
70887        openArray("basedOn");
70888        for (Reference e : element.getBasedOn()) 
70889          composeReference(null, e);
70890        closeArray();
70891      };
70892      if (element.hasGroupIdentifier()) {
70893        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
70894      }
70895      if (element.hasPartOf()) {
70896        openArray("partOf");
70897        for (Reference e : element.getPartOf()) 
70898          composeReference(null, e);
70899        closeArray();
70900      };
70901      if (element.hasStatusElement()) {
70902        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
70903        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
70904      }
70905      if (element.hasStatusReason()) {
70906        composeCodeableReference("statusReason", element.getStatusReason());
70907      }
70908      if (element.hasBusinessStatus()) {
70909        composeCodeableConcept("businessStatus", element.getBusinessStatus());
70910      }
70911      if (element.hasIntentElement()) {
70912        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
70913        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
70914      }
70915      if (element.hasPriorityElement()) {
70916        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70917        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
70918      }
70919      if (element.hasDoNotPerformElement()) {
70920        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
70921        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
70922      }
70923      if (element.hasCode()) {
70924        composeCodeableConcept("code", element.getCode());
70925      }
70926      if (element.hasDescriptionElement()) {
70927        composeStringCore("description", element.getDescriptionElement(), false);
70928        composeStringExtras("description", element.getDescriptionElement(), false);
70929      }
70930      if (element.hasFocus()) {
70931        composeReference("focus", element.getFocus());
70932      }
70933      if (element.hasFor()) {
70934        composeReference("for", element.getFor());
70935      }
70936      if (element.hasEncounter()) {
70937        composeReference("encounter", element.getEncounter());
70938      }
70939      if (element.hasRequestedPeriod()) {
70940        composePeriod("requestedPeriod", element.getRequestedPeriod());
70941      }
70942      if (element.hasExecutionPeriod()) {
70943        composePeriod("executionPeriod", element.getExecutionPeriod());
70944      }
70945      if (element.hasAuthoredOnElement()) {
70946        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
70947        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
70948      }
70949      if (element.hasLastModifiedElement()) {
70950        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
70951        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
70952      }
70953      if (element.hasRequester()) {
70954        composeReference("requester", element.getRequester());
70955      }
70956      if (element.hasRequestedPerformer()) {
70957        openArray("requestedPerformer");
70958        for (CodeableReference e : element.getRequestedPerformer()) 
70959          composeCodeableReference(null, e);
70960        closeArray();
70961      };
70962      if (element.hasOwner()) {
70963        composeReference("owner", element.getOwner());
70964      }
70965      if (element.hasPerformer()) {
70966        openArray("performer");
70967        for (Task.TaskPerformerComponent e : element.getPerformer()) 
70968          composeTaskPerformerComponent(null, e);
70969        closeArray();
70970      };
70971      if (element.hasLocation()) {
70972        composeReference("location", element.getLocation());
70973      }
70974      if (element.hasReason()) {
70975        openArray("reason");
70976        for (CodeableReference e : element.getReason()) 
70977          composeCodeableReference(null, e);
70978        closeArray();
70979      };
70980      if (element.hasInsurance()) {
70981        openArray("insurance");
70982        for (Reference e : element.getInsurance()) 
70983          composeReference(null, e);
70984        closeArray();
70985      };
70986      if (element.hasNote()) {
70987        openArray("note");
70988        for (Annotation e : element.getNote()) 
70989          composeAnnotation(null, e);
70990        closeArray();
70991      };
70992      if (element.hasRelevantHistory()) {
70993        openArray("relevantHistory");
70994        for (Reference e : element.getRelevantHistory()) 
70995          composeReference(null, e);
70996        closeArray();
70997      };
70998      if (element.hasRestriction()) {
70999        composeTaskRestrictionComponent("restriction", element.getRestriction());
71000      }
71001      if (element.hasInput()) {
71002        openArray("input");
71003        for (Task.TaskInputComponent e : element.getInput()) 
71004          composeTaskInputComponent(null, e);
71005        closeArray();
71006      };
71007      if (element.hasOutput()) {
71008        openArray("output");
71009        for (Task.TaskOutputComponent e : element.getOutput()) 
71010          composeTaskOutputComponent(null, e);
71011        closeArray();
71012      };
71013  }
71014
71015  protected void composeTaskPerformerComponent(String name, Task.TaskPerformerComponent element) throws IOException {
71016    if (element != null) {
71017      open(name);
71018      composeTaskPerformerComponentProperties(element);
71019      close();
71020    }
71021  }
71022
71023  protected void composeTaskPerformerComponentProperties(Task.TaskPerformerComponent element) throws IOException {
71024    composeBackboneElementProperties(element);
71025      if (element.hasFunction()) {
71026        composeCodeableConcept("function", element.getFunction());
71027      }
71028      if (element.hasActor()) {
71029        composeReference("actor", element.getActor());
71030      }
71031  }
71032
71033  protected void composeTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
71034    if (element != null) {
71035      open(name);
71036      composeTaskRestrictionComponentProperties(element);
71037      close();
71038    }
71039  }
71040
71041  protected void composeTaskRestrictionComponentProperties(Task.TaskRestrictionComponent element) throws IOException {
71042    composeBackboneElementProperties(element);
71043      if (element.hasRepetitionsElement()) {
71044        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
71045        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
71046      }
71047      if (element.hasPeriod()) {
71048        composePeriod("period", element.getPeriod());
71049      }
71050      if (element.hasRecipient()) {
71051        openArray("recipient");
71052        for (Reference e : element.getRecipient()) 
71053          composeReference(null, e);
71054        closeArray();
71055      };
71056  }
71057
71058  protected void composeTaskInputComponent(String name, Task.TaskInputComponent element) throws IOException {
71059    if (element != null) {
71060      open(name);
71061      composeTaskInputComponentProperties(element);
71062      close();
71063    }
71064  }
71065
71066  protected void composeTaskInputComponentProperties(Task.TaskInputComponent element) throws IOException {
71067    composeBackboneElementProperties(element);
71068      if (element.hasType()) {
71069        composeCodeableConcept("type", element.getType());
71070      }
71071      if (element.hasValue()) {
71072        composeType("value", element.getValue());
71073      }
71074  }
71075
71076  protected void composeTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
71077    if (element != null) {
71078      open(name);
71079      composeTaskOutputComponentProperties(element);
71080      close();
71081    }
71082  }
71083
71084  protected void composeTaskOutputComponentProperties(Task.TaskOutputComponent element) throws IOException {
71085    composeBackboneElementProperties(element);
71086      if (element.hasType()) {
71087        composeCodeableConcept("type", element.getType());
71088      }
71089      if (element.hasValue()) {
71090        composeType("value", element.getValue());
71091      }
71092  }
71093
71094  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
71095    if (element != null) {
71096      prop("resourceType", name);
71097      composeTerminologyCapabilitiesProperties(element);
71098    }
71099  }
71100
71101  protected void composeTerminologyCapabilitiesProperties(TerminologyCapabilities element) throws IOException {
71102    composeCanonicalResourceProperties(element);
71103      if (element.hasUrlElement()) {
71104        composeUriCore("url", element.getUrlElement(), false);
71105        composeUriExtras("url", element.getUrlElement(), false);
71106      }
71107      if (element.hasIdentifier()) {
71108        openArray("identifier");
71109        for (Identifier e : element.getIdentifier()) 
71110          composeIdentifier(null, e);
71111        closeArray();
71112      };
71113      if (element.hasVersionElement()) {
71114        composeStringCore("version", element.getVersionElement(), false);
71115        composeStringExtras("version", element.getVersionElement(), false);
71116      }
71117      if (element.hasVersionAlgorithm()) {
71118        composeType("versionAlgorithm", element.getVersionAlgorithm());
71119      }
71120      if (element.hasNameElement()) {
71121        composeStringCore("name", element.getNameElement(), false);
71122        composeStringExtras("name", element.getNameElement(), false);
71123      }
71124      if (element.hasTitleElement()) {
71125        composeStringCore("title", element.getTitleElement(), false);
71126        composeStringExtras("title", element.getTitleElement(), false);
71127      }
71128      if (element.hasStatusElement()) {
71129        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71130        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71131      }
71132      if (element.hasExperimentalElement()) {
71133        composeBooleanCore("experimental", element.getExperimentalElement(), false);
71134        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
71135      }
71136      if (element.hasDateElement()) {
71137        composeDateTimeCore("date", element.getDateElement(), false);
71138        composeDateTimeExtras("date", element.getDateElement(), false);
71139      }
71140      if (element.hasPublisherElement()) {
71141        composeStringCore("publisher", element.getPublisherElement(), false);
71142        composeStringExtras("publisher", element.getPublisherElement(), false);
71143      }
71144      if (element.hasContact()) {
71145        openArray("contact");
71146        for (ContactDetail e : element.getContact()) 
71147          composeContactDetail(null, e);
71148        closeArray();
71149      };
71150      if (element.hasDescriptionElement()) {
71151        composeMarkdownCore("description", element.getDescriptionElement(), false);
71152        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71153      }
71154      if (element.hasUseContext()) {
71155        openArray("useContext");
71156        for (UsageContext e : element.getUseContext()) 
71157          composeUsageContext(null, e);
71158        closeArray();
71159      };
71160      if (element.hasJurisdiction()) {
71161        openArray("jurisdiction");
71162        for (CodeableConcept e : element.getJurisdiction()) 
71163          composeCodeableConcept(null, e);
71164        closeArray();
71165      };
71166      if (element.hasPurposeElement()) {
71167        composeMarkdownCore("purpose", element.getPurposeElement(), false);
71168        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
71169      }
71170      if (element.hasCopyrightElement()) {
71171        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
71172        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
71173      }
71174      if (element.hasCopyrightLabelElement()) {
71175        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
71176        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
71177      }
71178      if (element.hasKindElement()) {
71179        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
71180        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
71181      }
71182      if (element.hasSoftware()) {
71183        composeTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
71184      }
71185      if (element.hasImplementation()) {
71186        composeTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
71187      }
71188      if (element.hasLockedDateElement()) {
71189        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
71190        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
71191      }
71192      if (element.hasCodeSystem()) {
71193        openArray("codeSystem");
71194        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
71195          composeTerminologyCapabilitiesCodeSystemComponent(null, e);
71196        closeArray();
71197      };
71198      if (element.hasExpansion()) {
71199        composeTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
71200      }
71201      if (element.hasCodeSearchElement()) {
71202        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
71203        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
71204      }
71205      if (element.hasValidateCode()) {
71206        composeTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
71207      }
71208      if (element.hasTranslation()) {
71209        composeTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
71210      }
71211      if (element.hasClosure()) {
71212        composeTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
71213      }
71214  }
71215
71216  protected void composeTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
71217    if (element != null) {
71218      open(name);
71219      composeTerminologyCapabilitiesSoftwareComponentProperties(element);
71220      close();
71221    }
71222  }
71223
71224  protected void composeTerminologyCapabilitiesSoftwareComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
71225    composeBackboneElementProperties(element);
71226      if (element.hasNameElement()) {
71227        composeStringCore("name", element.getNameElement(), false);
71228        composeStringExtras("name", element.getNameElement(), false);
71229      }
71230      if (element.hasVersionElement()) {
71231        composeStringCore("version", element.getVersionElement(), false);
71232        composeStringExtras("version", element.getVersionElement(), false);
71233      }
71234  }
71235
71236  protected void composeTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
71237    if (element != null) {
71238      open(name);
71239      composeTerminologyCapabilitiesImplementationComponentProperties(element);
71240      close();
71241    }
71242  }
71243
71244  protected void composeTerminologyCapabilitiesImplementationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
71245    composeBackboneElementProperties(element);
71246      if (element.hasDescriptionElement()) {
71247        composeStringCore("description", element.getDescriptionElement(), false);
71248        composeStringExtras("description", element.getDescriptionElement(), false);
71249      }
71250      if (element.hasUrlElement()) {
71251        composeUrlCore("url", element.getUrlElement(), false);
71252        composeUrlExtras("url", element.getUrlElement(), false);
71253      }
71254  }
71255
71256  protected void composeTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
71257    if (element != null) {
71258      open(name);
71259      composeTerminologyCapabilitiesCodeSystemComponentProperties(element);
71260      close();
71261    }
71262  }
71263
71264  protected void composeTerminologyCapabilitiesCodeSystemComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
71265    composeBackboneElementProperties(element);
71266      if (element.hasUriElement()) {
71267        composeCanonicalCore("uri", element.getUriElement(), false);
71268        composeCanonicalExtras("uri", element.getUriElement(), false);
71269      }
71270      if (element.hasVersion()) {
71271        openArray("version");
71272        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
71273          composeTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
71274        closeArray();
71275      };
71276      if (element.hasContentElement()) {
71277        composeEnumerationCore("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
71278        composeEnumerationExtras("content", element.getContentElement(), new Enumerations.CodeSystemContentModeEnumFactory(), false);
71279      }
71280      if (element.hasSubsumptionElement()) {
71281        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
71282        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
71283      }
71284  }
71285
71286  protected void composeTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
71287    if (element != null) {
71288      open(name);
71289      composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(element);
71290      close();
71291    }
71292  }
71293
71294  protected void composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
71295    composeBackboneElementProperties(element);
71296      if (element.hasCodeElement()) {
71297        composeStringCore("code", element.getCodeElement(), false);
71298        composeStringExtras("code", element.getCodeElement(), false);
71299      }
71300      if (element.hasIsDefaultElement()) {
71301        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
71302        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
71303      }
71304      if (element.hasCompositionalElement()) {
71305        composeBooleanCore("compositional", element.getCompositionalElement(), false);
71306        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
71307      }
71308      if (element.hasLanguage()) {
71309        openArray("language");
71310        for (Enumeration<Enumerations.CommonLanguages> e : element.getLanguage()) 
71311          composeEnumerationCore(null, e, new Enumerations.CommonLanguagesEnumFactory(), true);
71312        closeArray();
71313        if (anyHasExtras(element.getLanguage())) {
71314          openArray("_language");
71315          for (Enumeration<Enumerations.CommonLanguages> e : element.getLanguage()) 
71316            composeEnumerationExtras(null, e, new Enumerations.CommonLanguagesEnumFactory(), true);
71317          closeArray();
71318        }
71319      };
71320      if (element.hasFilter()) {
71321        openArray("filter");
71322        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
71323          composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
71324        closeArray();
71325      };
71326      if (element.hasProperty()) {
71327        if (anyHasValue(element.getProperty())) {
71328          openArray("property");
71329          for (CodeType e : element.getProperty()) 
71330            composeCodeCore(null, e, e != element.getProperty().get(element.getProperty().size()-1));
71331          closeArray();
71332        }
71333        if (anyHasExtras(element.getProperty())) {
71334          openArray("_property");
71335          for (CodeType e : element.getProperty()) 
71336            composeCodeExtras(null, e, true);
71337          closeArray();
71338        }
71339      };
71340  }
71341
71342  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
71343    if (element != null) {
71344      open(name);
71345      composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(element);
71346      close();
71347    }
71348  }
71349
71350  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
71351    composeBackboneElementProperties(element);
71352      if (element.hasCodeElement()) {
71353        composeCodeCore("code", element.getCodeElement(), false);
71354        composeCodeExtras("code", element.getCodeElement(), false);
71355      }
71356      if (element.hasOp()) {
71357        if (anyHasValue(element.getOp())) {
71358          openArray("op");
71359          for (CodeType e : element.getOp()) 
71360            composeCodeCore(null, e, e != element.getOp().get(element.getOp().size()-1));
71361          closeArray();
71362        }
71363        if (anyHasExtras(element.getOp())) {
71364          openArray("_op");
71365          for (CodeType e : element.getOp()) 
71366            composeCodeExtras(null, e, true);
71367          closeArray();
71368        }
71369      };
71370  }
71371
71372  protected void composeTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
71373    if (element != null) {
71374      open(name);
71375      composeTerminologyCapabilitiesExpansionComponentProperties(element);
71376      close();
71377    }
71378  }
71379
71380  protected void composeTerminologyCapabilitiesExpansionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
71381    composeBackboneElementProperties(element);
71382      if (element.hasHierarchicalElement()) {
71383        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
71384        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
71385      }
71386      if (element.hasPagingElement()) {
71387        composeBooleanCore("paging", element.getPagingElement(), false);
71388        composeBooleanExtras("paging", element.getPagingElement(), false);
71389      }
71390      if (element.hasIncompleteElement()) {
71391        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
71392        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
71393      }
71394      if (element.hasParameter()) {
71395        openArray("parameter");
71396        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
71397          composeTerminologyCapabilitiesExpansionParameterComponent(null, e);
71398        closeArray();
71399      };
71400      if (element.hasTextFilterElement()) {
71401        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
71402        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
71403      }
71404  }
71405
71406  protected void composeTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
71407    if (element != null) {
71408      open(name);
71409      composeTerminologyCapabilitiesExpansionParameterComponentProperties(element);
71410      close();
71411    }
71412  }
71413
71414  protected void composeTerminologyCapabilitiesExpansionParameterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
71415    composeBackboneElementProperties(element);
71416      if (element.hasNameElement()) {
71417        composeCodeCore("name", element.getNameElement(), false);
71418        composeCodeExtras("name", element.getNameElement(), false);
71419      }
71420      if (element.hasDocumentationElement()) {
71421        composeStringCore("documentation", element.getDocumentationElement(), false);
71422        composeStringExtras("documentation", element.getDocumentationElement(), false);
71423      }
71424  }
71425
71426  protected void composeTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
71427    if (element != null) {
71428      open(name);
71429      composeTerminologyCapabilitiesValidateCodeComponentProperties(element);
71430      close();
71431    }
71432  }
71433
71434  protected void composeTerminologyCapabilitiesValidateCodeComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
71435    composeBackboneElementProperties(element);
71436      if (element.hasTranslationsElement()) {
71437        composeBooleanCore("translations", element.getTranslationsElement(), false);
71438        composeBooleanExtras("translations", element.getTranslationsElement(), false);
71439      }
71440  }
71441
71442  protected void composeTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
71443    if (element != null) {
71444      open(name);
71445      composeTerminologyCapabilitiesTranslationComponentProperties(element);
71446      close();
71447    }
71448  }
71449
71450  protected void composeTerminologyCapabilitiesTranslationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
71451    composeBackboneElementProperties(element);
71452      if (element.hasNeedsMapElement()) {
71453        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
71454        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
71455      }
71456  }
71457
71458  protected void composeTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
71459    if (element != null) {
71460      open(name);
71461      composeTerminologyCapabilitiesClosureComponentProperties(element);
71462      close();
71463    }
71464  }
71465
71466  protected void composeTerminologyCapabilitiesClosureComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
71467    composeBackboneElementProperties(element);
71468      if (element.hasTranslationElement()) {
71469        composeBooleanCore("translation", element.getTranslationElement(), false);
71470        composeBooleanExtras("translation", element.getTranslationElement(), false);
71471      }
71472  }
71473
71474  protected void composeTestPlan(String name, TestPlan element) throws IOException {
71475    if (element != null) {
71476      prop("resourceType", name);
71477      composeTestPlanProperties(element);
71478    }
71479  }
71480
71481  protected void composeTestPlanProperties(TestPlan element) throws IOException {
71482    composeCanonicalResourceProperties(element);
71483      if (element.hasUrlElement()) {
71484        composeUriCore("url", element.getUrlElement(), false);
71485        composeUriExtras("url", element.getUrlElement(), false);
71486      }
71487      if (element.hasIdentifier()) {
71488        openArray("identifier");
71489        for (Identifier e : element.getIdentifier()) 
71490          composeIdentifier(null, e);
71491        closeArray();
71492      };
71493      if (element.hasVersionElement()) {
71494        composeStringCore("version", element.getVersionElement(), false);
71495        composeStringExtras("version", element.getVersionElement(), false);
71496        }
71497      if (element.hasVersionAlgorithm()) {
71498        composeType("versionAlgorithm", element.getVersionAlgorithm());
71499      }
71500      if (element.hasNameElement()) {
71501        composeStringCore("name", element.getNameElement(), false);
71502        composeStringExtras("name", element.getNameElement(), false);
71503        }
71504      if (element.hasTitleElement()) {
71505        composeStringCore("title", element.getTitleElement(), false);
71506        composeStringExtras("title", element.getTitleElement(), false);
71507      }
71508      if (element.hasStatusElement()) {
71509        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71510        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
71511      }
71512      if (element.hasExperimentalElement()) {
71513        composeBooleanCore("experimental", element.getExperimentalElement(), false);
71514        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
71515      }
71516      if (element.hasDateElement()) {
71517        composeDateTimeCore("date", element.getDateElement(), false);
71518        composeDateTimeExtras("date", element.getDateElement(), false);
71519      }
71520      if (element.hasPublisherElement()) {
71521        composeStringCore("publisher", element.getPublisherElement(), false);
71522        composeStringExtras("publisher", element.getPublisherElement(), false);
71523        }
71524      if (element.hasContact()) {
71525        openArray("contact");
71526        for (ContactDetail e : element.getContact()) 
71527          composeContactDetail(null, e);
71528        closeArray();
71529      };
71530      if (element.hasDescriptionElement()) {
71531        composeMarkdownCore("description", element.getDescriptionElement(), false);
71532        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71533      }
71534      if (element.hasUseContext()) {
71535        openArray("useContext");
71536        for (UsageContext e : element.getUseContext()) 
71537          composeUsageContext(null, e);
71538        closeArray();
71539      };
71540      if (element.hasJurisdiction()) {
71541        openArray("jurisdiction");
71542        for (CodeableConcept e : element.getJurisdiction()) 
71543          composeCodeableConcept(null, e);
71544        closeArray();
71545      };
71546      if (element.hasPurposeElement()) {
71547        composeMarkdownCore("purpose", element.getPurposeElement(), false);
71548        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
71549      }
71550      if (element.hasCopyrightElement()) {
71551        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
71552        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
71553      }
71554      if (element.hasCopyrightLabelElement()) {
71555        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
71556        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
71557      }
71558      if (element.hasCategory()) {
71559        openArray("category");
71560        for (CodeableConcept e : element.getCategory()) 
71561          composeCodeableConcept(null, e);
71562        closeArray();
71563      };
71564      if (element.hasScope()) {
71565        openArray("scope");
71566        for (Reference e : element.getScope()) 
71567          composeReference(null, e);
71568        closeArray();
71569      };
71570      if (element.hasTestToolsElement()) {
71571        composeMarkdownCore("testTools", element.getTestToolsElement(), false);
71572        composeMarkdownExtras("testTools", element.getTestToolsElement(), false);
71573      }
71574      if (element.hasDependency()) {
71575        openArray("dependency");
71576        for (TestPlan.TestPlanDependencyComponent e : element.getDependency()) 
71577          composeTestPlanDependencyComponent(null, e);
71578        closeArray();
71579      };
71580      if (element.hasExitCriteriaElement()) {
71581        composeMarkdownCore("exitCriteria", element.getExitCriteriaElement(), false);
71582        composeMarkdownExtras("exitCriteria", element.getExitCriteriaElement(), false);
71583      }
71584      if (element.hasTestCase()) {
71585        openArray("testCase");
71586        for (TestPlan.TestPlanTestCaseComponent e : element.getTestCase()) 
71587          composeTestPlanTestCaseComponent(null, e);
71588        closeArray();
71589      };
71590  }
71591
71592  protected void composeTestPlanDependencyComponent(String name, TestPlan.TestPlanDependencyComponent element) throws IOException {
71593    if (element != null) {
71594      open(name);
71595      composeTestPlanDependencyComponentProperties(element);
71596      close();
71597    }
71598  }
71599
71600  protected void composeTestPlanDependencyComponentProperties(TestPlan.TestPlanDependencyComponent element) throws IOException {
71601    composeBackboneElementProperties(element);
71602      if (element.hasDescriptionElement()) {
71603        composeMarkdownCore("description", element.getDescriptionElement(), false);
71604        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71605      }
71606      if (element.hasPredecessor()) {
71607        composeReference("predecessor", element.getPredecessor());
71608      }
71609  }
71610
71611  protected void composeTestPlanTestCaseComponent(String name, TestPlan.TestPlanTestCaseComponent element) throws IOException {
71612    if (element != null) {
71613      open(name);
71614      composeTestPlanTestCaseComponentProperties(element);
71615      close();
71616    }
71617  }
71618
71619  protected void composeTestPlanTestCaseComponentProperties(TestPlan.TestPlanTestCaseComponent element) throws IOException {
71620    composeBackboneElementProperties(element);
71621      if (element.hasSequenceElement()) {
71622        composeIntegerCore("sequence", element.getSequenceElement(), false);
71623        composeIntegerExtras("sequence", element.getSequenceElement(), false);
71624      }
71625      if (element.hasScope()) {
71626        openArray("scope");
71627        for (Reference e : element.getScope()) 
71628          composeReference(null, e);
71629        closeArray();
71630      };
71631      if (element.hasDependency()) {
71632        openArray("dependency");
71633        for (TestPlan.TestCaseDependencyComponent e : element.getDependency()) 
71634          composeTestCaseDependencyComponent(null, e);
71635        closeArray();
71636      };
71637      if (element.hasTestRun()) {
71638        openArray("testRun");
71639        for (TestPlan.TestPlanTestCaseTestRunComponent e : element.getTestRun()) 
71640          composeTestPlanTestCaseTestRunComponent(null, e);
71641        closeArray();
71642      };
71643      if (element.hasTestData()) {
71644        openArray("testData");
71645        for (TestPlan.TestPlanTestCaseTestDataComponent e : element.getTestData()) 
71646          composeTestPlanTestCaseTestDataComponent(null, e);
71647        closeArray();
71648      };
71649      if (element.hasAssertion()) {
71650        openArray("assertion");
71651        for (TestPlan.TestPlanTestCaseAssertionComponent e : element.getAssertion()) 
71652          composeTestPlanTestCaseAssertionComponent(null, e);
71653        closeArray();
71654      };
71655  }
71656
71657  protected void composeTestCaseDependencyComponent(String name, TestPlan.TestCaseDependencyComponent element) throws IOException {
71658    if (element != null) {
71659      open(name);
71660      composeTestCaseDependencyComponentProperties(element);
71661      close();
71662    }
71663  }
71664
71665  protected void composeTestCaseDependencyComponentProperties(TestPlan.TestCaseDependencyComponent element) throws IOException {
71666    composeBackboneElementProperties(element);
71667      if (element.hasDescriptionElement()) {
71668        composeMarkdownCore("description", element.getDescriptionElement(), false);
71669        composeMarkdownExtras("description", element.getDescriptionElement(), false);
71670      }
71671      if (element.hasPredecessor()) {
71672        composeReference("predecessor", element.getPredecessor());
71673      }
71674  }
71675
71676  protected void composeTestPlanTestCaseTestRunComponent(String name, TestPlan.TestPlanTestCaseTestRunComponent element) throws IOException {
71677    if (element != null) {
71678      open(name);
71679      composeTestPlanTestCaseTestRunComponentProperties(element);
71680      close();
71681    }
71682  }
71683
71684  protected void composeTestPlanTestCaseTestRunComponentProperties(TestPlan.TestPlanTestCaseTestRunComponent element) throws IOException {
71685    composeBackboneElementProperties(element);
71686      if (element.hasNarrativeElement()) {
71687        composeMarkdownCore("narrative", element.getNarrativeElement(), false);
71688        composeMarkdownExtras("narrative", element.getNarrativeElement(), false);
71689      }
71690      if (element.hasScript()) {
71691        composeTestPlanTestCaseTestRunScriptComponent("script", element.getScript());
71692      }
71693  }
71694
71695  protected void composeTestPlanTestCaseTestRunScriptComponent(String name, TestPlan.TestPlanTestCaseTestRunScriptComponent element) throws IOException {
71696    if (element != null) {
71697      open(name);
71698      composeTestPlanTestCaseTestRunScriptComponentProperties(element);
71699      close();
71700    }
71701  }
71702
71703  protected void composeTestPlanTestCaseTestRunScriptComponentProperties(TestPlan.TestPlanTestCaseTestRunScriptComponent element) throws IOException {
71704    composeBackboneElementProperties(element);
71705      if (element.hasLanguage()) {
71706        composeCodeableConcept("language", element.getLanguage());
71707      }
71708      if (element.hasSource()) {
71709        composeType("source", element.getSource());
71710      }
71711  }
71712
71713  protected void composeTestPlanTestCaseTestDataComponent(String name, TestPlan.TestPlanTestCaseTestDataComponent element) throws IOException {
71714    if (element != null) {
71715      open(name);
71716      composeTestPlanTestCaseTestDataComponentProperties(element);
71717      close();
71718    }
71719  }
71720
71721  protected void composeTestPlanTestCaseTestDataComponentProperties(TestPlan.TestPlanTestCaseTestDataComponent element) throws IOException {
71722    composeBackboneElementProperties(element);
71723      if (element.hasType()) {
71724        composeCoding("type", element.getType());
71725      }
71726      if (element.hasContent()) {
71727        composeReference("content", element.getContent());
71728      }
71729      if (element.hasSource()) {
71730        composeType("source", element.getSource());
71731      }
71732  }
71733
71734  protected void composeTestPlanTestCaseAssertionComponent(String name, TestPlan.TestPlanTestCaseAssertionComponent element) throws IOException {
71735    if (element != null) {
71736      open(name);
71737      composeTestPlanTestCaseAssertionComponentProperties(element);
71738      close();
71739    }
71740  }
71741
71742  protected void composeTestPlanTestCaseAssertionComponentProperties(TestPlan.TestPlanTestCaseAssertionComponent element) throws IOException {
71743    composeBackboneElementProperties(element);
71744      if (element.hasType()) {
71745        openArray("type");
71746        for (CodeableConcept e : element.getType()) 
71747          composeCodeableConcept(null, e);
71748        closeArray();
71749      };
71750      if (element.hasObject()) {
71751        openArray("object");
71752        for (CodeableReference e : element.getObject()) 
71753          composeCodeableReference(null, e);
71754        closeArray();
71755      };
71756      if (element.hasResult()) {
71757        openArray("result");
71758        for (CodeableReference e : element.getResult()) 
71759          composeCodeableReference(null, e);
71760        closeArray();
71761      };
71762  }
71763
71764  protected void composeTestReport(String name, TestReport element) throws IOException {
71765    if (element != null) {
71766      prop("resourceType", name);
71767      composeTestReportProperties(element);
71768    }
71769  }
71770
71771  protected void composeTestReportProperties(TestReport element) throws IOException {
71772    composeDomainResourceProperties(element);
71773      if (element.hasIdentifier()) {
71774        composeIdentifier("identifier", element.getIdentifier());
71775      }
71776      if (element.hasNameElement()) {
71777        composeStringCore("name", element.getNameElement(), false);
71778        composeStringExtras("name", element.getNameElement(), false);
71779      }
71780      if (element.hasStatusElement()) {
71781        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
71782        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
71783      }
71784      if (element.hasTestScriptElement()) {
71785        composeCanonicalCore("testScript", element.getTestScriptElement(), false);
71786        composeCanonicalExtras("testScript", element.getTestScriptElement(), false);
71787      }
71788      if (element.hasResultElement()) {
71789        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
71790        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
71791      }
71792      if (element.hasScoreElement()) {
71793        composeDecimalCore("score", element.getScoreElement(), false);
71794        composeDecimalExtras("score", element.getScoreElement(), false);
71795      }
71796      if (element.hasTesterElement()) {
71797        composeStringCore("tester", element.getTesterElement(), false);
71798        composeStringExtras("tester", element.getTesterElement(), false);
71799      }
71800      if (element.hasIssuedElement()) {
71801        composeDateTimeCore("issued", element.getIssuedElement(), false);
71802        composeDateTimeExtras("issued", element.getIssuedElement(), false);
71803      }
71804      if (element.hasParticipant()) {
71805        openArray("participant");
71806        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
71807          composeTestReportParticipantComponent(null, e);
71808        closeArray();
71809      };
71810      if (element.hasSetup()) {
71811        composeTestReportSetupComponent("setup", element.getSetup());
71812      }
71813      if (element.hasTest()) {
71814        openArray("test");
71815        for (TestReport.TestReportTestComponent e : element.getTest()) 
71816          composeTestReportTestComponent(null, e);
71817        closeArray();
71818      };
71819      if (element.hasTeardown()) {
71820        composeTestReportTeardownComponent("teardown", element.getTeardown());
71821      }
71822  }
71823
71824  protected void composeTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
71825    if (element != null) {
71826      open(name);
71827      composeTestReportParticipantComponentProperties(element);
71828      close();
71829    }
71830  }
71831
71832  protected void composeTestReportParticipantComponentProperties(TestReport.TestReportParticipantComponent element) throws IOException {
71833    composeBackboneElementProperties(element);
71834      if (element.hasTypeElement()) {
71835        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
71836        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
71837      }
71838      if (element.hasUriElement()) {
71839        composeUriCore("uri", element.getUriElement(), false);
71840        composeUriExtras("uri", element.getUriElement(), false);
71841      }
71842      if (element.hasDisplayElement()) {
71843        composeStringCore("display", element.getDisplayElement(), false);
71844        composeStringExtras("display", element.getDisplayElement(), false);
71845      }
71846  }
71847
71848  protected void composeTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
71849    if (element != null) {
71850      open(name);
71851      composeTestReportSetupComponentProperties(element);
71852      close();
71853    }
71854  }
71855
71856  protected void composeTestReportSetupComponentProperties(TestReport.TestReportSetupComponent element) throws IOException {
71857    composeBackboneElementProperties(element);
71858      if (element.hasAction()) {
71859        openArray("action");
71860        for (TestReport.SetupActionComponent e : element.getAction()) 
71861          composeSetupActionComponent(null, e);
71862        closeArray();
71863      };
71864  }
71865
71866  protected void composeSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
71867    if (element != null) {
71868      open(name);
71869      composeSetupActionComponentProperties(element);
71870      close();
71871    }
71872  }
71873
71874  protected void composeSetupActionComponentProperties(TestReport.SetupActionComponent element) throws IOException {
71875    composeBackboneElementProperties(element);
71876      if (element.hasOperation()) {
71877        composeSetupActionOperationComponent("operation", element.getOperation());
71878      }
71879      if (element.hasAssert()) {
71880        composeSetupActionAssertComponent("assert", element.getAssert());
71881      }
71882  }
71883
71884  protected void composeSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
71885    if (element != null) {
71886      open(name);
71887      composeSetupActionOperationComponentProperties(element);
71888      close();
71889    }
71890  }
71891
71892  protected void composeSetupActionOperationComponentProperties(TestReport.SetupActionOperationComponent element) throws IOException {
71893    composeBackboneElementProperties(element);
71894      if (element.hasResultElement()) {
71895        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71896        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71897      }
71898      if (element.hasMessageElement()) {
71899        composeMarkdownCore("message", element.getMessageElement(), false);
71900        composeMarkdownExtras("message", element.getMessageElement(), false);
71901      }
71902      if (element.hasDetailElement()) {
71903        composeUriCore("detail", element.getDetailElement(), false);
71904        composeUriExtras("detail", element.getDetailElement(), false);
71905      }
71906  }
71907
71908  protected void composeSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
71909    if (element != null) {
71910      open(name);
71911      composeSetupActionAssertComponentProperties(element);
71912      close();
71913    }
71914  }
71915
71916  protected void composeSetupActionAssertComponentProperties(TestReport.SetupActionAssertComponent element) throws IOException {
71917    composeBackboneElementProperties(element);
71918      if (element.hasResultElement()) {
71919        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71920        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
71921      }
71922      if (element.hasMessageElement()) {
71923        composeMarkdownCore("message", element.getMessageElement(), false);
71924        composeMarkdownExtras("message", element.getMessageElement(), false);
71925      }
71926      if (element.hasDetailElement()) {
71927        composeStringCore("detail", element.getDetailElement(), false);
71928        composeStringExtras("detail", element.getDetailElement(), false);
71929      }
71930      if (element.hasRequirement()) {
71931        openArray("requirement");
71932        for (TestReport.SetupActionAssertRequirementComponent e : element.getRequirement()) 
71933          composeSetupActionAssertRequirementComponent(null, e);
71934        closeArray();
71935      };
71936  }
71937
71938  protected void composeSetupActionAssertRequirementComponent(String name, TestReport.SetupActionAssertRequirementComponent element) throws IOException {
71939    if (element != null) {
71940      open(name);
71941      composeSetupActionAssertRequirementComponentProperties(element);
71942      close();
71943    }
71944  }
71945
71946  protected void composeSetupActionAssertRequirementComponentProperties(TestReport.SetupActionAssertRequirementComponent element) throws IOException {
71947    composeBackboneElementProperties(element);
71948      if (element.hasLink()) {
71949        composeType("link", element.getLink());
71950      }
71951  }
71952
71953  protected void composeTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
71954    if (element != null) {
71955      open(name);
71956      composeTestReportTestComponentProperties(element);
71957      close();
71958    }
71959  }
71960
71961  protected void composeTestReportTestComponentProperties(TestReport.TestReportTestComponent element) throws IOException {
71962    composeBackboneElementProperties(element);
71963      if (element.hasNameElement()) {
71964        composeStringCore("name", element.getNameElement(), false);
71965        composeStringExtras("name", element.getNameElement(), false);
71966      }
71967      if (element.hasDescriptionElement()) {
71968        composeStringCore("description", element.getDescriptionElement(), false);
71969        composeStringExtras("description", element.getDescriptionElement(), false);
71970      }
71971      if (element.hasAction()) {
71972        openArray("action");
71973        for (TestReport.TestActionComponent e : element.getAction()) 
71974          composeTestActionComponent(null, e);
71975        closeArray();
71976      };
71977  }
71978
71979  protected void composeTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
71980    if (element != null) {
71981      open(name);
71982      composeTestActionComponentProperties(element);
71983      close();
71984    }
71985  }
71986
71987  protected void composeTestActionComponentProperties(TestReport.TestActionComponent element) throws IOException {
71988    composeBackboneElementProperties(element);
71989      if (element.hasOperation()) {
71990        composeSetupActionOperationComponent("operation", element.getOperation());
71991      }
71992      if (element.hasAssert()) {
71993        composeSetupActionAssertComponent("assert", element.getAssert());
71994      }
71995  }
71996
71997  protected void composeTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
71998    if (element != null) {
71999      open(name);
72000      composeTestReportTeardownComponentProperties(element);
72001      close();
72002    }
72003  }
72004
72005  protected void composeTestReportTeardownComponentProperties(TestReport.TestReportTeardownComponent element) throws IOException {
72006    composeBackboneElementProperties(element);
72007      if (element.hasAction()) {
72008        openArray("action");
72009        for (TestReport.TeardownActionComponent e : element.getAction()) 
72010          composeTeardownActionComponent(null, e);
72011        closeArray();
72012      };
72013  }
72014
72015  protected void composeTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
72016    if (element != null) {
72017      open(name);
72018      composeTeardownActionComponentProperties(element);
72019      close();
72020    }
72021  }
72022
72023  protected void composeTeardownActionComponentProperties(TestReport.TeardownActionComponent element) throws IOException {
72024    composeBackboneElementProperties(element);
72025      if (element.hasOperation()) {
72026        composeSetupActionOperationComponent("operation", element.getOperation());
72027      }
72028  }
72029
72030  protected void composeTestScript(String name, TestScript element) throws IOException {
72031    if (element != null) {
72032      prop("resourceType", name);
72033      composeTestScriptProperties(element);
72034    }
72035  }
72036
72037  protected void composeTestScriptProperties(TestScript element) throws IOException {
72038    composeCanonicalResourceProperties(element);
72039      if (element.hasUrlElement()) {
72040        composeUriCore("url", element.getUrlElement(), false);
72041        composeUriExtras("url", element.getUrlElement(), false);
72042      }
72043      if (element.hasIdentifier()) {
72044        openArray("identifier");
72045        for (Identifier e : element.getIdentifier()) 
72046          composeIdentifier(null, e);
72047        closeArray();
72048      };
72049      if (element.hasVersionElement()) {
72050        composeStringCore("version", element.getVersionElement(), false);
72051        composeStringExtras("version", element.getVersionElement(), false);
72052      }
72053      if (element.hasVersionAlgorithm()) {
72054        composeType("versionAlgorithm", element.getVersionAlgorithm());
72055      }
72056      if (element.hasNameElement()) {
72057        composeStringCore("name", element.getNameElement(), false);
72058        composeStringExtras("name", element.getNameElement(), false);
72059      }
72060      if (element.hasTitleElement()) {
72061        composeStringCore("title", element.getTitleElement(), false);
72062        composeStringExtras("title", element.getTitleElement(), false);
72063      }
72064      if (element.hasStatusElement()) {
72065        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72066        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72067      }
72068      if (element.hasExperimentalElement()) {
72069        composeBooleanCore("experimental", element.getExperimentalElement(), false);
72070        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
72071      }
72072      if (element.hasDateElement()) {
72073        composeDateTimeCore("date", element.getDateElement(), false);
72074        composeDateTimeExtras("date", element.getDateElement(), false);
72075      }
72076      if (element.hasPublisherElement()) {
72077        composeStringCore("publisher", element.getPublisherElement(), false);
72078        composeStringExtras("publisher", element.getPublisherElement(), false);
72079      }
72080      if (element.hasContact()) {
72081        openArray("contact");
72082        for (ContactDetail e : element.getContact()) 
72083          composeContactDetail(null, e);
72084        closeArray();
72085      };
72086      if (element.hasDescriptionElement()) {
72087        composeMarkdownCore("description", element.getDescriptionElement(), false);
72088        composeMarkdownExtras("description", element.getDescriptionElement(), false);
72089      }
72090      if (element.hasUseContext()) {
72091        openArray("useContext");
72092        for (UsageContext e : element.getUseContext()) 
72093          composeUsageContext(null, e);
72094        closeArray();
72095      };
72096      if (element.hasJurisdiction()) {
72097        openArray("jurisdiction");
72098        for (CodeableConcept e : element.getJurisdiction()) 
72099          composeCodeableConcept(null, e);
72100        closeArray();
72101      };
72102      if (element.hasPurposeElement()) {
72103        composeMarkdownCore("purpose", element.getPurposeElement(), false);
72104        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
72105      }
72106      if (element.hasCopyrightElement()) {
72107        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
72108        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
72109      }
72110      if (element.hasCopyrightLabelElement()) {
72111        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
72112        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
72113      }
72114      if (element.hasOrigin()) {
72115        openArray("origin");
72116        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
72117          composeTestScriptOriginComponent(null, e);
72118        closeArray();
72119      };
72120      if (element.hasDestination()) {
72121        openArray("destination");
72122        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
72123          composeTestScriptDestinationComponent(null, e);
72124        closeArray();
72125      };
72126      if (element.hasMetadata()) {
72127        composeTestScriptMetadataComponent("metadata", element.getMetadata());
72128      }
72129      if (element.hasScope()) {
72130        openArray("scope");
72131        for (TestScript.TestScriptScopeComponent e : element.getScope()) 
72132          composeTestScriptScopeComponent(null, e);
72133        closeArray();
72134      };
72135      if (element.hasFixture()) {
72136        openArray("fixture");
72137        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
72138          composeTestScriptFixtureComponent(null, e);
72139        closeArray();
72140      };
72141      if (element.hasProfile()) {
72142        if (anyHasValue(element.getProfile())) {
72143          openArray("profile");
72144          for (CanonicalType e : element.getProfile()) 
72145            composeCanonicalCore(null, e, e != element.getProfile().get(element.getProfile().size()-1));
72146          closeArray();
72147        }
72148        if (anyHasExtras(element.getProfile())) {
72149          openArray("_profile");
72150          for (CanonicalType e : element.getProfile()) 
72151            composeCanonicalExtras(null, e, true);
72152          closeArray();
72153        }
72154      };
72155      if (element.hasVariable()) {
72156        openArray("variable");
72157        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
72158          composeTestScriptVariableComponent(null, e);
72159        closeArray();
72160      };
72161      if (element.hasSetup()) {
72162        composeTestScriptSetupComponent("setup", element.getSetup());
72163      }
72164      if (element.hasTest()) {
72165        openArray("test");
72166        for (TestScript.TestScriptTestComponent e : element.getTest()) 
72167          composeTestScriptTestComponent(null, e);
72168        closeArray();
72169      };
72170      if (element.hasTeardown()) {
72171        composeTestScriptTeardownComponent("teardown", element.getTeardown());
72172      }
72173  }
72174
72175  protected void composeTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
72176    if (element != null) {
72177      open(name);
72178      composeTestScriptOriginComponentProperties(element);
72179      close();
72180    }
72181  }
72182
72183  protected void composeTestScriptOriginComponentProperties(TestScript.TestScriptOriginComponent element) throws IOException {
72184    composeBackboneElementProperties(element);
72185      if (element.hasIndexElement()) {
72186        composeIntegerCore("index", element.getIndexElement(), false);
72187        composeIntegerExtras("index", element.getIndexElement(), false);
72188      }
72189      if (element.hasProfile()) {
72190        composeCoding("profile", element.getProfile());
72191      }
72192      if (element.hasUrlElement()) {
72193        composeUrlCore("url", element.getUrlElement(), false);
72194        composeUrlExtras("url", element.getUrlElement(), false);
72195      }
72196  }
72197
72198  protected void composeTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
72199    if (element != null) {
72200      open(name);
72201      composeTestScriptDestinationComponentProperties(element);
72202      close();
72203    }
72204  }
72205
72206  protected void composeTestScriptDestinationComponentProperties(TestScript.TestScriptDestinationComponent element) throws IOException {
72207    composeBackboneElementProperties(element);
72208      if (element.hasIndexElement()) {
72209        composeIntegerCore("index", element.getIndexElement(), false);
72210        composeIntegerExtras("index", element.getIndexElement(), false);
72211      }
72212      if (element.hasProfile()) {
72213        composeCoding("profile", element.getProfile());
72214      }
72215      if (element.hasUrlElement()) {
72216        composeUrlCore("url", element.getUrlElement(), false);
72217        composeUrlExtras("url", element.getUrlElement(), false);
72218      }
72219  }
72220
72221  protected void composeTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
72222    if (element != null) {
72223      open(name);
72224      composeTestScriptMetadataComponentProperties(element);
72225      close();
72226    }
72227  }
72228
72229  protected void composeTestScriptMetadataComponentProperties(TestScript.TestScriptMetadataComponent element) throws IOException {
72230    composeBackboneElementProperties(element);
72231      if (element.hasLink()) {
72232        openArray("link");
72233        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
72234          composeTestScriptMetadataLinkComponent(null, e);
72235        closeArray();
72236      };
72237      if (element.hasCapability()) {
72238        openArray("capability");
72239        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
72240          composeTestScriptMetadataCapabilityComponent(null, e);
72241        closeArray();
72242      };
72243  }
72244
72245  protected void composeTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
72246    if (element != null) {
72247      open(name);
72248      composeTestScriptMetadataLinkComponentProperties(element);
72249      close();
72250    }
72251  }
72252
72253  protected void composeTestScriptMetadataLinkComponentProperties(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
72254    composeBackboneElementProperties(element);
72255      if (element.hasUrlElement()) {
72256        composeUriCore("url", element.getUrlElement(), false);
72257        composeUriExtras("url", element.getUrlElement(), false);
72258      }
72259      if (element.hasDescriptionElement()) {
72260        composeStringCore("description", element.getDescriptionElement(), false);
72261        composeStringExtras("description", element.getDescriptionElement(), false);
72262      }
72263  }
72264
72265  protected void composeTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
72266    if (element != null) {
72267      open(name);
72268      composeTestScriptMetadataCapabilityComponentProperties(element);
72269      close();
72270    }
72271  }
72272
72273  protected void composeTestScriptMetadataCapabilityComponentProperties(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
72274    composeBackboneElementProperties(element);
72275      if (element.hasRequiredElement()) {
72276        composeBooleanCore("required", element.getRequiredElement(), false);
72277        composeBooleanExtras("required", element.getRequiredElement(), false);
72278      }
72279      if (element.hasValidatedElement()) {
72280        composeBooleanCore("validated", element.getValidatedElement(), false);
72281        composeBooleanExtras("validated", element.getValidatedElement(), false);
72282      }
72283      if (element.hasDescriptionElement()) {
72284        composeStringCore("description", element.getDescriptionElement(), false);
72285        composeStringExtras("description", element.getDescriptionElement(), false);
72286      }
72287      if (element.hasOrigin()) {
72288        if (anyHasValue(element.getOrigin())) {
72289          openArray("origin");
72290          for (IntegerType e : element.getOrigin()) 
72291            composeIntegerCore(null, e, e != element.getOrigin().get(element.getOrigin().size()-1));
72292          closeArray();
72293        }
72294        if (anyHasExtras(element.getOrigin())) {
72295          openArray("_origin");
72296          for (IntegerType e : element.getOrigin()) 
72297            composeIntegerExtras(null, e, true);
72298          closeArray();
72299        }
72300      };
72301      if (element.hasDestinationElement()) {
72302        composeIntegerCore("destination", element.getDestinationElement(), false);
72303        composeIntegerExtras("destination", element.getDestinationElement(), false);
72304      }
72305      if (element.hasLink()) {
72306        if (anyHasValue(element.getLink())) {
72307          openArray("link");
72308          for (UriType e : element.getLink()) 
72309            composeUriCore(null, e, e != element.getLink().get(element.getLink().size()-1));
72310          closeArray();
72311        }
72312        if (anyHasExtras(element.getLink())) {
72313          openArray("_link");
72314          for (UriType e : element.getLink()) 
72315            composeUriExtras(null, e, true);
72316          closeArray();
72317        }
72318      };
72319      if (element.hasCapabilitiesElement()) {
72320        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
72321        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
72322      }
72323  }
72324
72325  protected void composeTestScriptScopeComponent(String name, TestScript.TestScriptScopeComponent element) throws IOException {
72326    if (element != null) {
72327      open(name);
72328      composeTestScriptScopeComponentProperties(element);
72329      close();
72330    }
72331  }
72332
72333  protected void composeTestScriptScopeComponentProperties(TestScript.TestScriptScopeComponent element) throws IOException {
72334    composeBackboneElementProperties(element);
72335      if (element.hasArtifactElement()) {
72336        composeCanonicalCore("artifact", element.getArtifactElement(), false);
72337        composeCanonicalExtras("artifact", element.getArtifactElement(), false);
72338      }
72339      if (element.hasConformance()) {
72340        composeCodeableConcept("conformance", element.getConformance());
72341      }
72342      if (element.hasPhase()) {
72343        composeCodeableConcept("phase", element.getPhase());
72344      }
72345  }
72346
72347  protected void composeTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
72348    if (element != null) {
72349      open(name);
72350      composeTestScriptFixtureComponentProperties(element);
72351      close();
72352    }
72353  }
72354
72355  protected void composeTestScriptFixtureComponentProperties(TestScript.TestScriptFixtureComponent element) throws IOException {
72356    composeBackboneElementProperties(element);
72357      if (element.hasAutocreateElement()) {
72358        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
72359        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
72360      }
72361      if (element.hasAutodeleteElement()) {
72362        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
72363        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
72364      }
72365      if (element.hasResource()) {
72366        composeReference("resource", element.getResource());
72367      }
72368  }
72369
72370  protected void composeTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
72371    if (element != null) {
72372      open(name);
72373      composeTestScriptVariableComponentProperties(element);
72374      close();
72375    }
72376  }
72377
72378  protected void composeTestScriptVariableComponentProperties(TestScript.TestScriptVariableComponent element) throws IOException {
72379    composeBackboneElementProperties(element);
72380      if (element.hasNameElement()) {
72381        composeStringCore("name", element.getNameElement(), false);
72382        composeStringExtras("name", element.getNameElement(), false);
72383      }
72384      if (element.hasDefaultValueElement()) {
72385        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
72386        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
72387      }
72388      if (element.hasDescriptionElement()) {
72389        composeStringCore("description", element.getDescriptionElement(), false);
72390        composeStringExtras("description", element.getDescriptionElement(), false);
72391      }
72392      if (element.hasExpressionElement()) {
72393        composeStringCore("expression", element.getExpressionElement(), false);
72394        composeStringExtras("expression", element.getExpressionElement(), false);
72395      }
72396      if (element.hasHeaderFieldElement()) {
72397        composeStringCore("headerField", element.getHeaderFieldElement(), false);
72398        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
72399      }
72400      if (element.hasHintElement()) {
72401        composeStringCore("hint", element.getHintElement(), false);
72402        composeStringExtras("hint", element.getHintElement(), false);
72403      }
72404      if (element.hasPathElement()) {
72405        composeStringCore("path", element.getPathElement(), false);
72406        composeStringExtras("path", element.getPathElement(), false);
72407      }
72408      if (element.hasSourceIdElement()) {
72409        composeIdCore("sourceId", element.getSourceIdElement(), false);
72410        composeIdExtras("sourceId", element.getSourceIdElement(), false);
72411      }
72412  }
72413
72414  protected void composeTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
72415    if (element != null) {
72416      open(name);
72417      composeTestScriptSetupComponentProperties(element);
72418      close();
72419    }
72420  }
72421
72422  protected void composeTestScriptSetupComponentProperties(TestScript.TestScriptSetupComponent element) throws IOException {
72423    composeBackboneElementProperties(element);
72424      if (element.hasAction()) {
72425        openArray("action");
72426        for (TestScript.SetupActionComponent e : element.getAction()) 
72427          composeSetupActionComponent(null, e);
72428        closeArray();
72429      };
72430  }
72431
72432  protected void composeSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
72433    if (element != null) {
72434      open(name);
72435      composeSetupActionComponentProperties(element);
72436      close();
72437    }
72438  }
72439
72440  protected void composeSetupActionComponentProperties(TestScript.SetupActionComponent element) throws IOException {
72441    composeBackboneElementProperties(element);
72442      if (element.hasOperation()) {
72443        composeSetupActionOperationComponent("operation", element.getOperation());
72444      }
72445      if (element.hasAssert()) {
72446        composeSetupActionAssertComponent("assert", element.getAssert());
72447      }
72448  }
72449
72450  protected void composeSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
72451    if (element != null) {
72452      open(name);
72453      composeSetupActionOperationComponentProperties(element);
72454      close();
72455    }
72456  }
72457
72458  protected void composeSetupActionOperationComponentProperties(TestScript.SetupActionOperationComponent element) throws IOException {
72459    composeBackboneElementProperties(element);
72460      if (element.hasType()) {
72461        composeCoding("type", element.getType());
72462      }
72463      if (element.hasResourceElement()) {
72464        composeUriCore("resource", element.getResourceElement(), false);
72465        composeUriExtras("resource", element.getResourceElement(), false);
72466      }
72467      if (element.hasLabelElement()) {
72468        composeStringCore("label", element.getLabelElement(), false);
72469        composeStringExtras("label", element.getLabelElement(), false);
72470      }
72471      if (element.hasDescriptionElement()) {
72472        composeStringCore("description", element.getDescriptionElement(), false);
72473        composeStringExtras("description", element.getDescriptionElement(), false);
72474      }
72475      if (element.hasAcceptElement()) {
72476        composeCodeCore("accept", element.getAcceptElement(), false);
72477        composeCodeExtras("accept", element.getAcceptElement(), false);
72478      }
72479      if (element.hasContentTypeElement()) {
72480        composeCodeCore("contentType", element.getContentTypeElement(), false);
72481        composeCodeExtras("contentType", element.getContentTypeElement(), false);
72482      }
72483      if (element.hasDestinationElement()) {
72484        composeIntegerCore("destination", element.getDestinationElement(), false);
72485        composeIntegerExtras("destination", element.getDestinationElement(), false);
72486      }
72487      if (element.hasEncodeRequestUrlElement()) {
72488        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
72489        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
72490      }
72491      if (element.hasMethodElement()) {
72492        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72493        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72494      }
72495      if (element.hasOriginElement()) {
72496        composeIntegerCore("origin", element.getOriginElement(), false);
72497        composeIntegerExtras("origin", element.getOriginElement(), false);
72498      }
72499      if (element.hasParamsElement()) {
72500        composeStringCore("params", element.getParamsElement(), false);
72501        composeStringExtras("params", element.getParamsElement(), false);
72502      }
72503      if (element.hasRequestHeader()) {
72504        openArray("requestHeader");
72505        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
72506          composeSetupActionOperationRequestHeaderComponent(null, e);
72507        closeArray();
72508      };
72509      if (element.hasRequestIdElement()) {
72510        composeIdCore("requestId", element.getRequestIdElement(), false);
72511        composeIdExtras("requestId", element.getRequestIdElement(), false);
72512      }
72513      if (element.hasResponseIdElement()) {
72514        composeIdCore("responseId", element.getResponseIdElement(), false);
72515        composeIdExtras("responseId", element.getResponseIdElement(), false);
72516      }
72517      if (element.hasSourceIdElement()) {
72518        composeIdCore("sourceId", element.getSourceIdElement(), false);
72519        composeIdExtras("sourceId", element.getSourceIdElement(), false);
72520      }
72521      if (element.hasTargetIdElement()) {
72522        composeIdCore("targetId", element.getTargetIdElement(), false);
72523        composeIdExtras("targetId", element.getTargetIdElement(), false);
72524      }
72525      if (element.hasUrlElement()) {
72526        composeStringCore("url", element.getUrlElement(), false);
72527        composeStringExtras("url", element.getUrlElement(), false);
72528      }
72529  }
72530
72531  protected void composeSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
72532    if (element != null) {
72533      open(name);
72534      composeSetupActionOperationRequestHeaderComponentProperties(element);
72535      close();
72536    }
72537  }
72538
72539  protected void composeSetupActionOperationRequestHeaderComponentProperties(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
72540    composeBackboneElementProperties(element);
72541      if (element.hasFieldElement()) {
72542        composeStringCore("field", element.getFieldElement(), false);
72543        composeStringExtras("field", element.getFieldElement(), false);
72544      }
72545      if (element.hasValueElement()) {
72546        composeStringCore("value", element.getValueElement(), false);
72547        composeStringExtras("value", element.getValueElement(), false);
72548      }
72549  }
72550
72551  protected void composeSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
72552    if (element != null) {
72553      open(name);
72554      composeSetupActionAssertComponentProperties(element);
72555      close();
72556    }
72557  }
72558
72559  protected void composeSetupActionAssertComponentProperties(TestScript.SetupActionAssertComponent element) throws IOException {
72560    composeBackboneElementProperties(element);
72561      if (element.hasLabelElement()) {
72562        composeStringCore("label", element.getLabelElement(), false);
72563        composeStringExtras("label", element.getLabelElement(), false);
72564      }
72565      if (element.hasDescriptionElement()) {
72566        composeStringCore("description", element.getDescriptionElement(), false);
72567        composeStringExtras("description", element.getDescriptionElement(), false);
72568      }
72569      if (element.hasDirectionElement()) {
72570        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
72571        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
72572      }
72573      if (element.hasCompareToSourceIdElement()) {
72574        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
72575        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
72576      }
72577      if (element.hasCompareToSourceExpressionElement()) {
72578        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
72579        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
72580      }
72581      if (element.hasCompareToSourcePathElement()) {
72582        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
72583        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
72584      }
72585      if (element.hasContentTypeElement()) {
72586        composeCodeCore("contentType", element.getContentTypeElement(), false);
72587        composeCodeExtras("contentType", element.getContentTypeElement(), false);
72588      }
72589      if (element.hasDefaultManualCompletionElement()) {
72590        composeEnumerationCore("defaultManualCompletion", element.getDefaultManualCompletionElement(), new TestScript.AssertionManualCompletionTypeEnumFactory(), false);
72591        composeEnumerationExtras("defaultManualCompletion", element.getDefaultManualCompletionElement(), new TestScript.AssertionManualCompletionTypeEnumFactory(), false);
72592      }
72593      if (element.hasExpressionElement()) {
72594        composeStringCore("expression", element.getExpressionElement(), false);
72595        composeStringExtras("expression", element.getExpressionElement(), false);
72596      }
72597      if (element.hasHeaderFieldElement()) {
72598        composeStringCore("headerField", element.getHeaderFieldElement(), false);
72599        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
72600      }
72601      if (element.hasMinimumIdElement()) {
72602        composeStringCore("minimumId", element.getMinimumIdElement(), false);
72603        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
72604      }
72605      if (element.hasNavigationLinksElement()) {
72606        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
72607        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
72608      }
72609      if (element.hasOperatorElement()) {
72610        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
72611        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
72612      }
72613      if (element.hasPathElement()) {
72614        composeStringCore("path", element.getPathElement(), false);
72615        composeStringExtras("path", element.getPathElement(), false);
72616      }
72617      if (element.hasRequestMethodElement()) {
72618        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72619        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
72620      }
72621      if (element.hasRequestURLElement()) {
72622        composeStringCore("requestURL", element.getRequestURLElement(), false);
72623        composeStringExtras("requestURL", element.getRequestURLElement(), false);
72624      }
72625      if (element.hasResourceElement()) {
72626        composeUriCore("resource", element.getResourceElement(), false);
72627        composeUriExtras("resource", element.getResourceElement(), false);
72628      }
72629      if (element.hasResponseElement()) {
72630        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
72631        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
72632      }
72633      if (element.hasResponseCodeElement()) {
72634        composeStringCore("responseCode", element.getResponseCodeElement(), false);
72635        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
72636      }
72637      if (element.hasSourceIdElement()) {
72638        composeIdCore("sourceId", element.getSourceIdElement(), false);
72639        composeIdExtras("sourceId", element.getSourceIdElement(), false);
72640      }
72641      if (element.hasStopTestOnFailElement()) {
72642        composeBooleanCore("stopTestOnFail", element.getStopTestOnFailElement(), false);
72643        composeBooleanExtras("stopTestOnFail", element.getStopTestOnFailElement(), false);
72644      }
72645      if (element.hasValidateProfileIdElement()) {
72646        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
72647        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
72648      }
72649      if (element.hasValueElement()) {
72650        composeStringCore("value", element.getValueElement(), false);
72651        composeStringExtras("value", element.getValueElement(), false);
72652      }
72653      if (element.hasWarningOnlyElement()) {
72654        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
72655        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
72656      }
72657      if (element.hasRequirement()) {
72658        openArray("requirement");
72659        for (TestScript.SetupActionAssertRequirementComponent e : element.getRequirement()) 
72660          composeSetupActionAssertRequirementComponent(null, e);
72661        closeArray();
72662      };
72663  }
72664
72665  protected void composeSetupActionAssertRequirementComponent(String name, TestScript.SetupActionAssertRequirementComponent element) throws IOException {
72666    if (element != null) {
72667      open(name);
72668      composeSetupActionAssertRequirementComponentProperties(element);
72669      close();
72670    }
72671  }
72672
72673  protected void composeSetupActionAssertRequirementComponentProperties(TestScript.SetupActionAssertRequirementComponent element) throws IOException {
72674    composeBackboneElementProperties(element);
72675      if (element.hasLink()) {
72676        composeType("link", element.getLink());
72677      }
72678  }
72679
72680  protected void composeTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
72681    if (element != null) {
72682      open(name);
72683      composeTestScriptTestComponentProperties(element);
72684      close();
72685    }
72686  }
72687
72688  protected void composeTestScriptTestComponentProperties(TestScript.TestScriptTestComponent element) throws IOException {
72689    composeBackboneElementProperties(element);
72690      if (element.hasNameElement()) {
72691        composeStringCore("name", element.getNameElement(), false);
72692        composeStringExtras("name", element.getNameElement(), false);
72693      }
72694      if (element.hasDescriptionElement()) {
72695        composeStringCore("description", element.getDescriptionElement(), false);
72696        composeStringExtras("description", element.getDescriptionElement(), false);
72697      }
72698      if (element.hasAction()) {
72699        openArray("action");
72700        for (TestScript.TestActionComponent e : element.getAction()) 
72701          composeTestActionComponent(null, e);
72702        closeArray();
72703      };
72704  }
72705
72706  protected void composeTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
72707    if (element != null) {
72708      open(name);
72709      composeTestActionComponentProperties(element);
72710      close();
72711    }
72712  }
72713
72714  protected void composeTestActionComponentProperties(TestScript.TestActionComponent element) throws IOException {
72715    composeBackboneElementProperties(element);
72716      if (element.hasOperation()) {
72717        composeSetupActionOperationComponent("operation", element.getOperation());
72718      }
72719      if (element.hasAssert()) {
72720        composeSetupActionAssertComponent("assert", element.getAssert());
72721      }
72722  }
72723
72724  protected void composeTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
72725    if (element != null) {
72726      open(name);
72727      composeTestScriptTeardownComponentProperties(element);
72728      close();
72729    }
72730  }
72731
72732  protected void composeTestScriptTeardownComponentProperties(TestScript.TestScriptTeardownComponent element) throws IOException {
72733    composeBackboneElementProperties(element);
72734      if (element.hasAction()) {
72735        openArray("action");
72736        for (TestScript.TeardownActionComponent e : element.getAction()) 
72737          composeTeardownActionComponent(null, e);
72738        closeArray();
72739      };
72740  }
72741
72742  protected void composeTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
72743    if (element != null) {
72744      open(name);
72745      composeTeardownActionComponentProperties(element);
72746      close();
72747    }
72748  }
72749
72750  protected void composeTeardownActionComponentProperties(TestScript.TeardownActionComponent element) throws IOException {
72751    composeBackboneElementProperties(element);
72752      if (element.hasOperation()) {
72753        composeSetupActionOperationComponent("operation", element.getOperation());
72754      }
72755  }
72756
72757  protected void composeTransport(String name, Transport element) throws IOException {
72758    if (element != null) {
72759      prop("resourceType", name);
72760      composeTransportProperties(element);
72761    }
72762  }
72763
72764  protected void composeTransportProperties(Transport element) throws IOException {
72765    composeDomainResourceProperties(element);
72766      if (element.hasIdentifier()) {
72767        openArray("identifier");
72768        for (Identifier e : element.getIdentifier()) 
72769          composeIdentifier(null, e);
72770        closeArray();
72771      };
72772      if (element.hasInstantiatesCanonicalElement()) {
72773        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
72774        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
72775      }
72776      if (element.hasInstantiatesUriElement()) {
72777        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
72778        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
72779      }
72780      if (element.hasBasedOn()) {
72781        openArray("basedOn");
72782        for (Reference e : element.getBasedOn()) 
72783          composeReference(null, e);
72784        closeArray();
72785      };
72786      if (element.hasGroupIdentifier()) {
72787        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
72788      }
72789      if (element.hasPartOf()) {
72790        openArray("partOf");
72791        for (Reference e : element.getPartOf()) 
72792          composeReference(null, e);
72793        closeArray();
72794      };
72795      if (element.hasStatusElement()) {
72796        composeEnumerationCore("status", element.getStatusElement(), new Transport.TransportStatusEnumFactory(), false);
72797        composeEnumerationExtras("status", element.getStatusElement(), new Transport.TransportStatusEnumFactory(), false);
72798      }
72799      if (element.hasStatusReason()) {
72800        composeCodeableConcept("statusReason", element.getStatusReason());
72801      }
72802      if (element.hasIntentElement()) {
72803        composeEnumerationCore("intent", element.getIntentElement(), new Transport.TransportIntentEnumFactory(), false);
72804        composeEnumerationExtras("intent", element.getIntentElement(), new Transport.TransportIntentEnumFactory(), false);
72805      }
72806      if (element.hasPriorityElement()) {
72807        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
72808        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
72809      }
72810      if (element.hasCode()) {
72811        composeCodeableConcept("code", element.getCode());
72812      }
72813      if (element.hasDescriptionElement()) {
72814        composeStringCore("description", element.getDescriptionElement(), false);
72815        composeStringExtras("description", element.getDescriptionElement(), false);
72816      }
72817      if (element.hasFocus()) {
72818        composeReference("focus", element.getFocus());
72819      }
72820      if (element.hasFor()) {
72821        composeReference("for", element.getFor());
72822      }
72823      if (element.hasEncounter()) {
72824        composeReference("encounter", element.getEncounter());
72825      }
72826      if (element.hasCompletionTimeElement()) {
72827        composeDateTimeCore("completionTime", element.getCompletionTimeElement(), false);
72828        composeDateTimeExtras("completionTime", element.getCompletionTimeElement(), false);
72829      }
72830      if (element.hasAuthoredOnElement()) {
72831        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
72832        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
72833      }
72834      if (element.hasLastModifiedElement()) {
72835        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
72836        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
72837      }
72838      if (element.hasRequester()) {
72839        composeReference("requester", element.getRequester());
72840      }
72841      if (element.hasPerformerType()) {
72842        openArray("performerType");
72843        for (CodeableConcept e : element.getPerformerType()) 
72844          composeCodeableConcept(null, e);
72845        closeArray();
72846      };
72847      if (element.hasOwner()) {
72848        composeReference("owner", element.getOwner());
72849      }
72850      if (element.hasLocation()) {
72851        composeReference("location", element.getLocation());
72852      }
72853      if (element.hasInsurance()) {
72854        openArray("insurance");
72855        for (Reference e : element.getInsurance()) 
72856          composeReference(null, e);
72857        closeArray();
72858      };
72859      if (element.hasNote()) {
72860        openArray("note");
72861        for (Annotation e : element.getNote()) 
72862          composeAnnotation(null, e);
72863        closeArray();
72864      };
72865      if (element.hasRelevantHistory()) {
72866        openArray("relevantHistory");
72867        for (Reference e : element.getRelevantHistory()) 
72868          composeReference(null, e);
72869        closeArray();
72870      };
72871      if (element.hasRestriction()) {
72872        composeTransportRestrictionComponent("restriction", element.getRestriction());
72873      }
72874      if (element.hasInput()) {
72875        openArray("input");
72876        for (Transport.ParameterComponent e : element.getInput()) 
72877          composeParameterComponent(null, e);
72878        closeArray();
72879      };
72880      if (element.hasOutput()) {
72881        openArray("output");
72882        for (Transport.TransportOutputComponent e : element.getOutput()) 
72883          composeTransportOutputComponent(null, e);
72884        closeArray();
72885      };
72886      if (element.hasRequestedLocation()) {
72887        composeReference("requestedLocation", element.getRequestedLocation());
72888      }
72889      if (element.hasCurrentLocation()) {
72890        composeReference("currentLocation", element.getCurrentLocation());
72891      }
72892      if (element.hasReason()) {
72893        composeCodeableReference("reason", element.getReason());
72894      }
72895      if (element.hasHistory()) {
72896        composeReference("history", element.getHistory());
72897      }
72898  }
72899
72900  protected void composeTransportRestrictionComponent(String name, Transport.TransportRestrictionComponent element) throws IOException {
72901    if (element != null) {
72902      open(name);
72903      composeTransportRestrictionComponentProperties(element);
72904      close();
72905    }
72906  }
72907
72908  protected void composeTransportRestrictionComponentProperties(Transport.TransportRestrictionComponent element) throws IOException {
72909    composeBackboneElementProperties(element);
72910      if (element.hasRepetitionsElement()) {
72911        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
72912        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
72913      }
72914      if (element.hasPeriod()) {
72915        composePeriod("period", element.getPeriod());
72916      }
72917      if (element.hasRecipient()) {
72918        openArray("recipient");
72919        for (Reference e : element.getRecipient()) 
72920          composeReference(null, e);
72921        closeArray();
72922      };
72923  }
72924
72925  protected void composeParameterComponent(String name, Transport.ParameterComponent element) throws IOException {
72926    if (element != null) {
72927      open(name);
72928      composeParameterComponentProperties(element);
72929      close();
72930    }
72931  }
72932
72933  protected void composeParameterComponentProperties(Transport.ParameterComponent element) throws IOException {
72934    composeBackboneElementProperties(element);
72935      if (element.hasType()) {
72936        composeCodeableConcept("type", element.getType());
72937      }
72938      if (element.hasValue()) {
72939        composeType("value", element.getValue());
72940      }
72941  }
72942
72943  protected void composeTransportOutputComponent(String name, Transport.TransportOutputComponent element) throws IOException {
72944    if (element != null) {
72945      open(name);
72946      composeTransportOutputComponentProperties(element);
72947      close();
72948    }
72949  }
72950
72951  protected void composeTransportOutputComponentProperties(Transport.TransportOutputComponent element) throws IOException {
72952    composeBackboneElementProperties(element);
72953      if (element.hasType()) {
72954        composeCodeableConcept("type", element.getType());
72955      }
72956      if (element.hasValue()) {
72957        composeType("value", element.getValue());
72958      }
72959  }
72960
72961  protected void composeValueSet(String name, ValueSet element) throws IOException {
72962    if (element != null) {
72963      prop("resourceType", name);
72964      composeValueSetProperties(element);
72965    }
72966  }
72967
72968  protected void composeValueSetProperties(ValueSet element) throws IOException {
72969    composeMetadataResourceProperties(element);
72970      if (element.hasUrlElement()) {
72971        composeUriCore("url", element.getUrlElement(), false);
72972        composeUriExtras("url", element.getUrlElement(), false);
72973      }
72974      if (element.hasIdentifier()) {
72975        openArray("identifier");
72976        for (Identifier e : element.getIdentifier()) 
72977          composeIdentifier(null, e);
72978        closeArray();
72979      };
72980      if (element.hasVersionElement()) {
72981        composeStringCore("version", element.getVersionElement(), false);
72982        composeStringExtras("version", element.getVersionElement(), false);
72983      }
72984      if (element.hasVersionAlgorithm()) {
72985        composeType("versionAlgorithm", element.getVersionAlgorithm());
72986      }
72987      if (element.hasNameElement()) {
72988        composeStringCore("name", element.getNameElement(), false);
72989        composeStringExtras("name", element.getNameElement(), false);
72990      }
72991      if (element.hasTitleElement()) {
72992        composeStringCore("title", element.getTitleElement(), false);
72993        composeStringExtras("title", element.getTitleElement(), false);
72994      }
72995      if (element.hasStatusElement()) {
72996        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72997        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
72998      }
72999      if (element.hasExperimentalElement()) {
73000        composeBooleanCore("experimental", element.getExperimentalElement(), false);
73001        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
73002      }
73003      if (element.hasDateElement()) {
73004        composeDateTimeCore("date", element.getDateElement(), false);
73005        composeDateTimeExtras("date", element.getDateElement(), false);
73006      }
73007      if (element.hasPublisherElement()) {
73008        composeStringCore("publisher", element.getPublisherElement(), false);
73009        composeStringExtras("publisher", element.getPublisherElement(), false);
73010      }
73011      if (element.hasContact()) {
73012        openArray("contact");
73013        for (ContactDetail e : element.getContact()) 
73014          composeContactDetail(null, e);
73015        closeArray();
73016      };
73017      if (element.hasDescriptionElement()) {
73018        composeMarkdownCore("description", element.getDescriptionElement(), false);
73019        composeMarkdownExtras("description", element.getDescriptionElement(), false);
73020      }
73021      if (element.hasUseContext()) {
73022        openArray("useContext");
73023        for (UsageContext e : element.getUseContext()) 
73024          composeUsageContext(null, e);
73025        closeArray();
73026      };
73027      if (element.hasJurisdiction()) {
73028        openArray("jurisdiction");
73029        for (CodeableConcept e : element.getJurisdiction()) 
73030          composeCodeableConcept(null, e);
73031        closeArray();
73032      };
73033      if (element.hasImmutableElement()) {
73034        composeBooleanCore("immutable", element.getImmutableElement(), false);
73035        composeBooleanExtras("immutable", element.getImmutableElement(), false);
73036      }
73037      if (element.hasPurposeElement()) {
73038        composeMarkdownCore("purpose", element.getPurposeElement(), false);
73039        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
73040      }
73041      if (element.hasCopyrightElement()) {
73042        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
73043        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
73044      }
73045      if (element.hasCopyrightLabelElement()) {
73046        composeStringCore("copyrightLabel", element.getCopyrightLabelElement(), false);
73047        composeStringExtras("copyrightLabel", element.getCopyrightLabelElement(), false);
73048      }
73049      if (element.hasApprovalDateElement()) {
73050        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
73051        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
73052      }
73053      if (element.hasLastReviewDateElement()) {
73054        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
73055        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
73056      }
73057      if (element.hasEffectivePeriod()) {
73058        composePeriod("effectivePeriod", element.getEffectivePeriod());
73059      }
73060      if (element.hasTopic()) {
73061        openArray("topic");
73062        for (CodeableConcept e : element.getTopic()) 
73063          composeCodeableConcept(null, e);
73064        closeArray();
73065      };
73066      if (element.hasAuthor()) {
73067        openArray("author");
73068        for (ContactDetail e : element.getAuthor()) 
73069          composeContactDetail(null, e);
73070        closeArray();
73071      };
73072      if (element.hasEditor()) {
73073        openArray("editor");
73074        for (ContactDetail e : element.getEditor()) 
73075          composeContactDetail(null, e);
73076        closeArray();
73077      };
73078      if (element.hasReviewer()) {
73079        openArray("reviewer");
73080        for (ContactDetail e : element.getReviewer()) 
73081          composeContactDetail(null, e);
73082        closeArray();
73083      };
73084      if (element.hasEndorser()) {
73085        openArray("endorser");
73086        for (ContactDetail e : element.getEndorser()) 
73087          composeContactDetail(null, e);
73088        closeArray();
73089      };
73090      if (element.hasRelatedArtifact()) {
73091        openArray("relatedArtifact");
73092        for (RelatedArtifact e : element.getRelatedArtifact()) 
73093          composeRelatedArtifact(null, e);
73094        closeArray();
73095      };
73096      if (element.hasCompose()) {
73097        composeValueSetComposeComponent("compose", element.getCompose());
73098      }
73099      if (element.hasExpansion()) {
73100        composeValueSetExpansionComponent("expansion", element.getExpansion());
73101      }
73102      if (element.hasScope()) {
73103        composeValueSetScopeComponent("scope", element.getScope());
73104      }
73105  }
73106
73107  protected void composeValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
73108    if (element != null) {
73109      open(name);
73110      composeValueSetComposeComponentProperties(element);
73111      close();
73112    }
73113  }
73114
73115  protected void composeValueSetComposeComponentProperties(ValueSet.ValueSetComposeComponent element) throws IOException {
73116    composeBackboneElementProperties(element);
73117      if (element.hasLockedDateElement()) {
73118        composeDateCore("lockedDate", element.getLockedDateElement(), false);
73119        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
73120      }
73121      if (element.hasInactiveElement()) {
73122        composeBooleanCore("inactive", element.getInactiveElement(), false);
73123        composeBooleanExtras("inactive", element.getInactiveElement(), false);
73124      }
73125      if (element.hasInclude()) {
73126        openArray("include");
73127        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
73128          composeConceptSetComponent(null, e);
73129        closeArray();
73130      };
73131      if (element.hasExclude()) {
73132        openArray("exclude");
73133        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
73134          composeConceptSetComponent(null, e);
73135        closeArray();
73136      };
73137      if (element.hasProperty()) {
73138        if (anyHasValue(element.getProperty())) {
73139          openArray("property");
73140          for (StringType e : element.getProperty()) 
73141            composeStringCore(null, e, e != element.getProperty().get(element.getProperty().size()-1));
73142          closeArray();
73143        }
73144        if (anyHasExtras(element.getProperty())) {
73145          openArray("_property");
73146          for (StringType e : element.getProperty()) 
73147            composeStringExtras(null, e, true);
73148          closeArray();
73149        }
73150      };
73151  }
73152
73153  protected void composeConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
73154    if (element != null) {
73155      open(name);
73156      composeConceptSetComponentProperties(element);
73157      close();
73158    }
73159  }
73160
73161  protected void composeConceptSetComponentProperties(ValueSet.ConceptSetComponent element) throws IOException {
73162    composeBackboneElementProperties(element);
73163      if (element.hasSystemElement()) {
73164        composeUriCore("system", element.getSystemElement(), false);
73165        composeUriExtras("system", element.getSystemElement(), false);
73166      }
73167      if (element.hasVersionElement()) {
73168        composeStringCore("version", element.getVersionElement(), false);
73169        composeStringExtras("version", element.getVersionElement(), false);
73170      }
73171      if (element.hasConcept()) {
73172        openArray("concept");
73173        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
73174          composeConceptReferenceComponent(null, e);
73175        closeArray();
73176      };
73177      if (element.hasFilter()) {
73178        openArray("filter");
73179        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
73180          composeConceptSetFilterComponent(null, e);
73181        closeArray();
73182      };
73183      if (element.hasValueSet()) {
73184        if (anyHasValue(element.getValueSet())) {
73185          openArray("valueSet");
73186          for (CanonicalType e : element.getValueSet()) 
73187            composeCanonicalCore(null, e, e != element.getValueSet().get(element.getValueSet().size()-1));
73188          closeArray();
73189        }
73190        if (anyHasExtras(element.getValueSet())) {
73191          openArray("_valueSet");
73192          for (CanonicalType e : element.getValueSet()) 
73193            composeCanonicalExtras(null, e, true);
73194          closeArray();
73195        }
73196      };
73197      if (element.hasCopyrightElement()) {
73198        composeStringCore("copyright", element.getCopyrightElement(), false);
73199        composeStringExtras("copyright", element.getCopyrightElement(), false);
73200      }
73201  }
73202
73203  protected void composeConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
73204    if (element != null) {
73205      open(name);
73206      composeConceptReferenceComponentProperties(element);
73207      close();
73208    }
73209  }
73210
73211  protected void composeConceptReferenceComponentProperties(ValueSet.ConceptReferenceComponent element) throws IOException {
73212    composeBackboneElementProperties(element);
73213      if (element.hasCodeElement()) {
73214        composeCodeCore("code", element.getCodeElement(), false);
73215        composeCodeExtras("code", element.getCodeElement(), false);
73216      }
73217      if (element.hasDisplayElement()) {
73218        composeStringCore("display", element.getDisplayElement(), false);
73219        composeStringExtras("display", element.getDisplayElement(), false);
73220      }
73221      if (element.hasDesignation()) {
73222        openArray("designation");
73223        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
73224          composeConceptReferenceDesignationComponent(null, e);
73225        closeArray();
73226      };
73227  }
73228
73229  protected void composeConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
73230    if (element != null) {
73231      open(name);
73232      composeConceptReferenceDesignationComponentProperties(element);
73233      close();
73234    }
73235  }
73236
73237  protected void composeConceptReferenceDesignationComponentProperties(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
73238    composeBackboneElementProperties(element);
73239      if (element.hasLanguageElement()) {
73240        composeCodeCore("language", element.getLanguageElement(), false);
73241        composeCodeExtras("language", element.getLanguageElement(), false);
73242      }
73243      if (element.hasUse()) {
73244        composeCoding("use", element.getUse());
73245      }
73246      if (element.hasAdditionalUse()) {
73247        openArray("additionalUse");
73248        for (Coding e : element.getAdditionalUse()) 
73249          composeCoding(null, e);
73250        closeArray();
73251      };
73252      if (element.hasValueElement()) {
73253        composeStringCore("value", element.getValueElement(), false);
73254        composeStringExtras("value", element.getValueElement(), false);
73255      }
73256  }
73257
73258  protected void composeConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
73259    if (element != null) {
73260      open(name);
73261      composeConceptSetFilterComponentProperties(element);
73262      close();
73263    }
73264  }
73265
73266  protected void composeConceptSetFilterComponentProperties(ValueSet.ConceptSetFilterComponent element) throws IOException {
73267    composeBackboneElementProperties(element);
73268      if (element.hasPropertyElement()) {
73269        composeCodeCore("property", element.getPropertyElement(), false);
73270        composeCodeExtras("property", element.getPropertyElement(), false);
73271      }
73272      if (element.hasOpElement()) {
73273        composeEnumerationCore("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
73274        composeEnumerationExtras("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
73275      }
73276      if (element.hasValueElement()) {
73277        composeStringCore("value", element.getValueElement(), false);
73278        composeStringExtras("value", element.getValueElement(), false);
73279      }
73280  }
73281
73282  protected void composeValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
73283    if (element != null) {
73284      open(name);
73285      composeValueSetExpansionComponentProperties(element);
73286      close();
73287    }
73288  }
73289
73290  protected void composeValueSetExpansionComponentProperties(ValueSet.ValueSetExpansionComponent element) throws IOException {
73291    composeBackboneElementProperties(element);
73292      if (element.hasIdentifierElement()) {
73293        composeUriCore("identifier", element.getIdentifierElement(), false);
73294        composeUriExtras("identifier", element.getIdentifierElement(), false);
73295      }
73296      if (element.hasNextElement()) {
73297        composeUriCore("next", element.getNextElement(), false);
73298        composeUriExtras("next", element.getNextElement(), false);
73299      }
73300      if (element.hasTimestampElement()) {
73301        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
73302        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
73303      }
73304      if (element.hasTotalElement()) {
73305        composeIntegerCore("total", element.getTotalElement(), false);
73306        composeIntegerExtras("total", element.getTotalElement(), false);
73307      }
73308      if (element.hasOffsetElement()) {
73309        composeIntegerCore("offset", element.getOffsetElement(), false);
73310        composeIntegerExtras("offset", element.getOffsetElement(), false);
73311      }
73312      if (element.hasParameter()) {
73313        openArray("parameter");
73314        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
73315          composeValueSetExpansionParameterComponent(null, e);
73316        closeArray();
73317      };
73318      if (element.hasProperty()) {
73319        openArray("property");
73320        for (ValueSet.ValueSetExpansionPropertyComponent e : element.getProperty()) 
73321          composeValueSetExpansionPropertyComponent(null, e);
73322        closeArray();
73323      };
73324      if (element.hasContains()) {
73325        openArray("contains");
73326        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
73327          composeValueSetExpansionContainsComponent(null, e);
73328        closeArray();
73329      };
73330  }
73331
73332  protected void composeValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
73333    if (element != null) {
73334      open(name);
73335      composeValueSetExpansionParameterComponentProperties(element);
73336      close();
73337    }
73338  }
73339
73340  protected void composeValueSetExpansionParameterComponentProperties(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
73341    composeBackboneElementProperties(element);
73342      if (element.hasNameElement()) {
73343        composeStringCore("name", element.getNameElement(), false);
73344        composeStringExtras("name", element.getNameElement(), false);
73345      }
73346      if (element.hasValue()) {
73347        composeType("value", element.getValue());
73348      }
73349  }
73350
73351  protected void composeValueSetExpansionPropertyComponent(String name, ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
73352    if (element != null) {
73353      open(name);
73354      composeValueSetExpansionPropertyComponentProperties(element);
73355      close();
73356    }
73357  }
73358
73359  protected void composeValueSetExpansionPropertyComponentProperties(ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
73360    composeBackboneElementProperties(element);
73361      if (element.hasCodeElement()) {
73362        composeCodeCore("code", element.getCodeElement(), false);
73363        composeCodeExtras("code", element.getCodeElement(), false);
73364      }
73365      if (element.hasUriElement()) {
73366        composeUriCore("uri", element.getUriElement(), false);
73367        composeUriExtras("uri", element.getUriElement(), false);
73368      }
73369  }
73370
73371  protected void composeValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
73372    if (element != null) {
73373      open(name);
73374      composeValueSetExpansionContainsComponentProperties(element);
73375      close();
73376    }
73377  }
73378
73379  protected void composeValueSetExpansionContainsComponentProperties(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
73380    composeBackboneElementProperties(element);
73381      if (element.hasSystemElement()) {
73382        composeUriCore("system", element.getSystemElement(), false);
73383        composeUriExtras("system", element.getSystemElement(), false);
73384      }
73385      if (element.hasAbstractElement()) {
73386        composeBooleanCore("abstract", element.getAbstractElement(), false);
73387        composeBooleanExtras("abstract", element.getAbstractElement(), false);
73388      }
73389      if (element.hasInactiveElement()) {
73390        composeBooleanCore("inactive", element.getInactiveElement(), false);
73391        composeBooleanExtras("inactive", element.getInactiveElement(), false);
73392      }
73393      if (element.hasVersionElement()) {
73394        composeStringCore("version", element.getVersionElement(), false);
73395        composeStringExtras("version", element.getVersionElement(), false);
73396      }
73397      if (element.hasCodeElement()) {
73398        composeCodeCore("code", element.getCodeElement(), false);
73399        composeCodeExtras("code", element.getCodeElement(), false);
73400      }
73401      if (element.hasDisplayElement()) {
73402        composeStringCore("display", element.getDisplayElement(), false);
73403        composeStringExtras("display", element.getDisplayElement(), false);
73404      }
73405      if (element.hasDesignation()) {
73406        openArray("designation");
73407        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
73408          composeConceptReferenceDesignationComponent(null, e);
73409        closeArray();
73410      };
73411      if (element.hasProperty()) {
73412        openArray("property");
73413        for (ValueSet.ConceptPropertyComponent e : element.getProperty()) 
73414          composeConceptPropertyComponent(null, e);
73415        closeArray();
73416      };
73417      if (element.hasContains()) {
73418        openArray("contains");
73419        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
73420          composeValueSetExpansionContainsComponent(null, e);
73421        closeArray();
73422      };
73423  }
73424
73425  protected void composeConceptPropertyComponent(String name, ValueSet.ConceptPropertyComponent element) throws IOException {
73426    if (element != null) {
73427      open(name);
73428      composeConceptPropertyComponentProperties(element);
73429      close();
73430    }
73431  }
73432
73433  protected void composeConceptPropertyComponentProperties(ValueSet.ConceptPropertyComponent element) throws IOException {
73434    composeBackboneElementProperties(element);
73435      if (element.hasCodeElement()) {
73436        composeCodeCore("code", element.getCodeElement(), false);
73437        composeCodeExtras("code", element.getCodeElement(), false);
73438      }
73439      if (element.hasValue()) {
73440        composeType("value", element.getValue());
73441      }
73442      if (element.hasSubProperty()) {
73443        openArray("subProperty");
73444        for (ValueSet.ConceptSubPropertyComponent e : element.getSubProperty()) 
73445          composeConceptSubPropertyComponent(null, e);
73446        closeArray();
73447      };
73448  }
73449
73450  protected void composeConceptSubPropertyComponent(String name, ValueSet.ConceptSubPropertyComponent element) throws IOException {
73451    if (element != null) {
73452      open(name);
73453      composeConceptSubPropertyComponentProperties(element);
73454      close();
73455    }
73456  }
73457
73458  protected void composeConceptSubPropertyComponentProperties(ValueSet.ConceptSubPropertyComponent element) throws IOException {
73459    composeBackboneElementProperties(element);
73460      if (element.hasCodeElement()) {
73461        composeCodeCore("code", element.getCodeElement(), false);
73462        composeCodeExtras("code", element.getCodeElement(), false);
73463      }
73464      if (element.hasValue()) {
73465        composeType("value", element.getValue());
73466      }
73467  }
73468
73469  protected void composeValueSetScopeComponent(String name, ValueSet.ValueSetScopeComponent element) throws IOException {
73470    if (element != null) {
73471      open(name);
73472      composeValueSetScopeComponentProperties(element);
73473      close();
73474    }
73475  }
73476
73477  protected void composeValueSetScopeComponentProperties(ValueSet.ValueSetScopeComponent element) throws IOException {
73478    composeBackboneElementProperties(element);
73479      if (element.hasInclusionCriteriaElement()) {
73480        composeStringCore("inclusionCriteria", element.getInclusionCriteriaElement(), false);
73481        composeStringExtras("inclusionCriteria", element.getInclusionCriteriaElement(), false);
73482      }
73483      if (element.hasExclusionCriteriaElement()) {
73484        composeStringCore("exclusionCriteria", element.getExclusionCriteriaElement(), false);
73485        composeStringExtras("exclusionCriteria", element.getExclusionCriteriaElement(), false);
73486      }
73487  }
73488
73489  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
73490    if (element != null) {
73491      prop("resourceType", name);
73492      composeVerificationResultProperties(element);
73493    }
73494  }
73495
73496  protected void composeVerificationResultProperties(VerificationResult element) throws IOException {
73497    composeDomainResourceProperties(element);
73498      if (element.hasTarget()) {
73499        openArray("target");
73500        for (Reference e : element.getTarget()) 
73501          composeReference(null, e);
73502        closeArray();
73503      };
73504      if (element.hasTargetLocation()) {
73505        if (anyHasValue(element.getTargetLocation())) {
73506          openArray("targetLocation");
73507          for (StringType e : element.getTargetLocation()) 
73508            composeStringCore(null, e, e != element.getTargetLocation().get(element.getTargetLocation().size()-1));
73509          closeArray();
73510        }
73511        if (anyHasExtras(element.getTargetLocation())) {
73512          openArray("_targetLocation");
73513          for (StringType e : element.getTargetLocation()) 
73514            composeStringExtras(null, e, true);
73515          closeArray();
73516        }
73517      };
73518      if (element.hasNeed()) {
73519        composeCodeableConcept("need", element.getNeed());
73520      }
73521      if (element.hasStatusElement()) {
73522        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.VerificationResultStatusEnumFactory(), false);
73523        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.VerificationResultStatusEnumFactory(), false);
73524      }
73525      if (element.hasStatusDateElement()) {
73526        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
73527        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
73528      }
73529      if (element.hasValidationType()) {
73530        composeCodeableConcept("validationType", element.getValidationType());
73531      }
73532      if (element.hasValidationProcess()) {
73533        openArray("validationProcess");
73534        for (CodeableConcept e : element.getValidationProcess()) 
73535          composeCodeableConcept(null, e);
73536        closeArray();
73537      };
73538      if (element.hasFrequency()) {
73539        composeTiming("frequency", element.getFrequency());
73540      }
73541      if (element.hasLastPerformedElement()) {
73542        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
73543        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
73544      }
73545      if (element.hasNextScheduledElement()) {
73546        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
73547        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
73548      }
73549      if (element.hasFailureAction()) {
73550        composeCodeableConcept("failureAction", element.getFailureAction());
73551      }
73552      if (element.hasPrimarySource()) {
73553        openArray("primarySource");
73554        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
73555          composeVerificationResultPrimarySourceComponent(null, e);
73556        closeArray();
73557      };
73558      if (element.hasAttestation()) {
73559        composeVerificationResultAttestationComponent("attestation", element.getAttestation());
73560      }
73561      if (element.hasValidator()) {
73562        openArray("validator");
73563        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
73564          composeVerificationResultValidatorComponent(null, e);
73565        closeArray();
73566      };
73567  }
73568
73569  protected void composeVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
73570    if (element != null) {
73571      open(name);
73572      composeVerificationResultPrimarySourceComponentProperties(element);
73573      close();
73574    }
73575  }
73576
73577  protected void composeVerificationResultPrimarySourceComponentProperties(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
73578    composeBackboneElementProperties(element);
73579      if (element.hasWho()) {
73580        composeReference("who", element.getWho());
73581      }
73582      if (element.hasType()) {
73583        openArray("type");
73584        for (CodeableConcept e : element.getType()) 
73585          composeCodeableConcept(null, e);
73586        closeArray();
73587      };
73588      if (element.hasCommunicationMethod()) {
73589        openArray("communicationMethod");
73590        for (CodeableConcept e : element.getCommunicationMethod()) 
73591          composeCodeableConcept(null, e);
73592        closeArray();
73593      };
73594      if (element.hasValidationStatus()) {
73595        composeCodeableConcept("validationStatus", element.getValidationStatus());
73596      }
73597      if (element.hasValidationDateElement()) {
73598        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
73599        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
73600      }
73601      if (element.hasCanPushUpdates()) {
73602        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
73603      }
73604      if (element.hasPushTypeAvailable()) {
73605        openArray("pushTypeAvailable");
73606        for (CodeableConcept e : element.getPushTypeAvailable()) 
73607          composeCodeableConcept(null, e);
73608        closeArray();
73609      };
73610  }
73611
73612  protected void composeVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
73613    if (element != null) {
73614      open(name);
73615      composeVerificationResultAttestationComponentProperties(element);
73616      close();
73617    }
73618  }
73619
73620  protected void composeVerificationResultAttestationComponentProperties(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
73621    composeBackboneElementProperties(element);
73622      if (element.hasWho()) {
73623        composeReference("who", element.getWho());
73624      }
73625      if (element.hasOnBehalfOf()) {
73626        composeReference("onBehalfOf", element.getOnBehalfOf());
73627      }
73628      if (element.hasCommunicationMethod()) {
73629        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
73630      }
73631      if (element.hasDateElement()) {
73632        composeDateCore("date", element.getDateElement(), false);
73633        composeDateExtras("date", element.getDateElement(), false);
73634      }
73635      if (element.hasSourceIdentityCertificateElement()) {
73636        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
73637        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
73638      }
73639      if (element.hasProxyIdentityCertificateElement()) {
73640        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
73641        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
73642      }
73643      if (element.hasProxySignature()) {
73644        composeSignature("proxySignature", element.getProxySignature());
73645      }
73646      if (element.hasSourceSignature()) {
73647        composeSignature("sourceSignature", element.getSourceSignature());
73648      }
73649  }
73650
73651  protected void composeVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
73652    if (element != null) {
73653      open(name);
73654      composeVerificationResultValidatorComponentProperties(element);
73655      close();
73656    }
73657  }
73658
73659  protected void composeVerificationResultValidatorComponentProperties(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
73660    composeBackboneElementProperties(element);
73661      if (element.hasOrganization()) {
73662        composeReference("organization", element.getOrganization());
73663      }
73664      if (element.hasIdentityCertificateElement()) {
73665        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
73666        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
73667      }
73668      if (element.hasAttestationSignature()) {
73669        composeSignature("attestationSignature", element.getAttestationSignature());
73670      }
73671  }
73672
73673  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
73674    if (element != null) {
73675      prop("resourceType", name);
73676      composeVisionPrescriptionProperties(element);
73677    }
73678  }
73679
73680  protected void composeVisionPrescriptionProperties(VisionPrescription element) throws IOException {
73681    composeDomainResourceProperties(element);
73682      if (element.hasIdentifier()) {
73683        openArray("identifier");
73684        for (Identifier e : element.getIdentifier()) 
73685          composeIdentifier(null, e);
73686        closeArray();
73687      };
73688      if (element.hasStatusElement()) {
73689        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
73690        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
73691      }
73692      if (element.hasCreatedElement()) {
73693        composeDateTimeCore("created", element.getCreatedElement(), false);
73694        composeDateTimeExtras("created", element.getCreatedElement(), false);
73695      }
73696      if (element.hasPatient()) {
73697        composeReference("patient", element.getPatient());
73698      }
73699      if (element.hasEncounter()) {
73700        composeReference("encounter", element.getEncounter());
73701      }
73702      if (element.hasDateWrittenElement()) {
73703        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
73704        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
73705      }
73706      if (element.hasPrescriber()) {
73707        composeReference("prescriber", element.getPrescriber());
73708      }
73709      if (element.hasLensSpecification()) {
73710        openArray("lensSpecification");
73711        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
73712          composeVisionPrescriptionLensSpecificationComponent(null, e);
73713        closeArray();
73714      };
73715  }
73716
73717  protected void composeVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
73718    if (element != null) {
73719      open(name);
73720      composeVisionPrescriptionLensSpecificationComponentProperties(element);
73721      close();
73722    }
73723  }
73724
73725  protected void composeVisionPrescriptionLensSpecificationComponentProperties(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
73726    composeBackboneElementProperties(element);
73727      if (element.hasProduct()) {
73728        composeCodeableConcept("product", element.getProduct());
73729      }
73730      if (element.hasEyeElement()) {
73731        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
73732        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
73733      }
73734      if (element.hasSphereElement()) {
73735        composeDecimalCore("sphere", element.getSphereElement(), false);
73736        composeDecimalExtras("sphere", element.getSphereElement(), false);
73737      }
73738      if (element.hasCylinderElement()) {
73739        composeDecimalCore("cylinder", element.getCylinderElement(), false);
73740        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
73741      }
73742      if (element.hasAxisElement()) {
73743        composeIntegerCore("axis", element.getAxisElement(), false);
73744        composeIntegerExtras("axis", element.getAxisElement(), false);
73745      }
73746      if (element.hasPrism()) {
73747        openArray("prism");
73748        for (VisionPrescription.PrismComponent e : element.getPrism()) 
73749          composePrismComponent(null, e);
73750        closeArray();
73751      };
73752      if (element.hasAddElement()) {
73753        composeDecimalCore("add", element.getAddElement(), false);
73754        composeDecimalExtras("add", element.getAddElement(), false);
73755      }
73756      if (element.hasPowerElement()) {
73757        composeDecimalCore("power", element.getPowerElement(), false);
73758        composeDecimalExtras("power", element.getPowerElement(), false);
73759      }
73760      if (element.hasBackCurveElement()) {
73761        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
73762        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
73763      }
73764      if (element.hasDiameterElement()) {
73765        composeDecimalCore("diameter", element.getDiameterElement(), false);
73766        composeDecimalExtras("diameter", element.getDiameterElement(), false);
73767      }
73768      if (element.hasDuration()) {
73769        composeQuantity("duration", element.getDuration());
73770      }
73771      if (element.hasColorElement()) {
73772        composeStringCore("color", element.getColorElement(), false);
73773        composeStringExtras("color", element.getColorElement(), false);
73774      }
73775      if (element.hasBrandElement()) {
73776        composeStringCore("brand", element.getBrandElement(), false);
73777        composeStringExtras("brand", element.getBrandElement(), false);
73778      }
73779      if (element.hasNote()) {
73780        openArray("note");
73781        for (Annotation e : element.getNote()) 
73782          composeAnnotation(null, e);
73783        closeArray();
73784      };
73785  }
73786
73787  protected void composePrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
73788    if (element != null) {
73789      open(name);
73790      composePrismComponentProperties(element);
73791      close();
73792    }
73793  }
73794
73795  protected void composePrismComponentProperties(VisionPrescription.PrismComponent element) throws IOException {
73796    composeBackboneElementProperties(element);
73797      if (element.hasAmountElement()) {
73798        composeDecimalCore("amount", element.getAmountElement(), false);
73799        composeDecimalExtras("amount", element.getAmountElement(), false);
73800      }
73801      if (element.hasBaseElement()) {
73802        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
73803        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
73804      }
73805  }
73806
73807
73808
73809  @Override
73810  protected void composeResource(Resource resource) throws IOException {
73811    if (resource == null) {
73812      throw new Error("Resource is null - can't produce JSON");
73813    } else if (resource instanceof Account) {
73814      composeAccount("Account", (Account)resource);
73815    } else if (resource instanceof ActivityDefinition) {
73816      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
73817    } else if (resource instanceof ActorDefinition) {
73818      composeActorDefinition("ActorDefinition", (ActorDefinition)resource);
73819    } else if (resource instanceof AdministrableProductDefinition) {
73820      composeAdministrableProductDefinition("AdministrableProductDefinition", (AdministrableProductDefinition)resource);
73821    } else if (resource instanceof AdverseEvent) {
73822      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
73823    } else if (resource instanceof AllergyIntolerance) {
73824      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
73825    } else if (resource instanceof Appointment) {
73826      composeAppointment("Appointment", (Appointment)resource);
73827    } else if (resource instanceof AppointmentResponse) {
73828      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
73829    } else if (resource instanceof ArtifactAssessment) {
73830      composeArtifactAssessment("ArtifactAssessment", (ArtifactAssessment)resource);
73831    } else if (resource instanceof AuditEvent) {
73832      composeAuditEvent("AuditEvent", (AuditEvent)resource);
73833    } else if (resource instanceof Basic) {
73834      composeBasic("Basic", (Basic)resource);
73835    } else if (resource instanceof Binary) {
73836      composeBinary("Binary", (Binary)resource);
73837    } else if (resource instanceof BiologicallyDerivedProduct) {
73838      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
73839    } else if (resource instanceof BiologicallyDerivedProductDispense) {
73840      composeBiologicallyDerivedProductDispense("BiologicallyDerivedProductDispense", (BiologicallyDerivedProductDispense)resource);
73841    } else if (resource instanceof BodyStructure) {
73842      composeBodyStructure("BodyStructure", (BodyStructure)resource);
73843    } else if (resource instanceof Bundle) {
73844      composeBundle("Bundle", (Bundle)resource);
73845    } else if (resource instanceof CapabilityStatement) {
73846      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
73847    } else if (resource instanceof CarePlan) {
73848      composeCarePlan("CarePlan", (CarePlan)resource);
73849    } else if (resource instanceof CareTeam) {
73850      composeCareTeam("CareTeam", (CareTeam)resource);
73851    } else if (resource instanceof ChargeItem) {
73852      composeChargeItem("ChargeItem", (ChargeItem)resource);
73853    } else if (resource instanceof ChargeItemDefinition) {
73854      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
73855    } else if (resource instanceof Citation) {
73856      composeCitation("Citation", (Citation)resource);
73857    } else if (resource instanceof Claim) {
73858      composeClaim("Claim", (Claim)resource);
73859    } else if (resource instanceof ClaimResponse) {
73860      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
73861    } else if (resource instanceof ClinicalImpression) {
73862      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
73863    } else if (resource instanceof ClinicalUseDefinition) {
73864      composeClinicalUseDefinition("ClinicalUseDefinition", (ClinicalUseDefinition)resource);
73865    } else if (resource instanceof CodeSystem) {
73866      composeCodeSystem("CodeSystem", (CodeSystem)resource);
73867    } else if (resource instanceof Communication) {
73868      composeCommunication("Communication", (Communication)resource);
73869    } else if (resource instanceof CommunicationRequest) {
73870      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
73871    } else if (resource instanceof CompartmentDefinition) {
73872      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
73873    } else if (resource instanceof Composition) {
73874      composeComposition("Composition", (Composition)resource);
73875    } else if (resource instanceof ConceptMap) {
73876      composeConceptMap("ConceptMap", (ConceptMap)resource);
73877    } else if (resource instanceof Condition) {
73878      composeCondition("Condition", (Condition)resource);
73879    } else if (resource instanceof ConditionDefinition) {
73880      composeConditionDefinition("ConditionDefinition", (ConditionDefinition)resource);
73881    } else if (resource instanceof Consent) {
73882      composeConsent("Consent", (Consent)resource);
73883    } else if (resource instanceof Contract) {
73884      composeContract("Contract", (Contract)resource);
73885    } else if (resource instanceof Coverage) {
73886      composeCoverage("Coverage", (Coverage)resource);
73887    } else if (resource instanceof CoverageEligibilityRequest) {
73888      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
73889    } else if (resource instanceof CoverageEligibilityResponse) {
73890      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
73891    } else if (resource instanceof DetectedIssue) {
73892      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
73893    } else if (resource instanceof Device) {
73894      composeDevice("Device", (Device)resource);
73895    } else if (resource instanceof DeviceAssociation) {
73896      composeDeviceAssociation("DeviceAssociation", (DeviceAssociation)resource);
73897    } else if (resource instanceof DeviceDefinition) {
73898      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
73899    } else if (resource instanceof DeviceDispense) {
73900      composeDeviceDispense("DeviceDispense", (DeviceDispense)resource);
73901    } else if (resource instanceof DeviceMetric) {
73902      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
73903    } else if (resource instanceof DeviceRequest) {
73904      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
73905    } else if (resource instanceof DeviceUsage) {
73906      composeDeviceUsage("DeviceUsage", (DeviceUsage)resource);
73907    } else if (resource instanceof DiagnosticReport) {
73908      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
73909    } else if (resource instanceof DocumentReference) {
73910      composeDocumentReference("DocumentReference", (DocumentReference)resource);
73911    } else if (resource instanceof Encounter) {
73912      composeEncounter("Encounter", (Encounter)resource);
73913    } else if (resource instanceof EncounterHistory) {
73914      composeEncounterHistory("EncounterHistory", (EncounterHistory)resource);
73915    } else if (resource instanceof Endpoint) {
73916      composeEndpoint("Endpoint", (Endpoint)resource);
73917    } else if (resource instanceof EnrollmentRequest) {
73918      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
73919    } else if (resource instanceof EnrollmentResponse) {
73920      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
73921    } else if (resource instanceof EpisodeOfCare) {
73922      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
73923    } else if (resource instanceof EventDefinition) {
73924      composeEventDefinition("EventDefinition", (EventDefinition)resource);
73925    } else if (resource instanceof Evidence) {
73926      composeEvidence("Evidence", (Evidence)resource);
73927    } else if (resource instanceof EvidenceReport) {
73928      composeEvidenceReport("EvidenceReport", (EvidenceReport)resource);
73929    } else if (resource instanceof EvidenceVariable) {
73930      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
73931    } else if (resource instanceof ExampleScenario) {
73932      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
73933    } else if (resource instanceof ExplanationOfBenefit) {
73934      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
73935    } else if (resource instanceof FamilyMemberHistory) {
73936      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
73937    } else if (resource instanceof Flag) {
73938      composeFlag("Flag", (Flag)resource);
73939    } else if (resource instanceof FormularyItem) {
73940      composeFormularyItem("FormularyItem", (FormularyItem)resource);
73941    } else if (resource instanceof GenomicStudy) {
73942      composeGenomicStudy("GenomicStudy", (GenomicStudy)resource);
73943    } else if (resource instanceof Goal) {
73944      composeGoal("Goal", (Goal)resource);
73945    } else if (resource instanceof GraphDefinition) {
73946      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
73947    } else if (resource instanceof Group) {
73948      composeGroup("Group", (Group)resource);
73949    } else if (resource instanceof GuidanceResponse) {
73950      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
73951    } else if (resource instanceof HealthcareService) {
73952      composeHealthcareService("HealthcareService", (HealthcareService)resource);
73953    } else if (resource instanceof ImagingSelection) {
73954      composeImagingSelection("ImagingSelection", (ImagingSelection)resource);
73955    } else if (resource instanceof ImagingStudy) {
73956      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
73957    } else if (resource instanceof Immunization) {
73958      composeImmunization("Immunization", (Immunization)resource);
73959    } else if (resource instanceof ImmunizationEvaluation) {
73960      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
73961    } else if (resource instanceof ImmunizationRecommendation) {
73962      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
73963    } else if (resource instanceof ImplementationGuide) {
73964      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
73965    } else if (resource instanceof Ingredient) {
73966      composeIngredient("Ingredient", (Ingredient)resource);
73967    } else if (resource instanceof InsurancePlan) {
73968      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
73969    } else if (resource instanceof InventoryItem) {
73970      composeInventoryItem("InventoryItem", (InventoryItem)resource);
73971    } else if (resource instanceof InventoryReport) {
73972      composeInventoryReport("InventoryReport", (InventoryReport)resource);
73973    } else if (resource instanceof Invoice) {
73974      composeInvoice("Invoice", (Invoice)resource);
73975    } else if (resource instanceof Library) {
73976      composeLibrary("Library", (Library)resource);
73977    } else if (resource instanceof Linkage) {
73978      composeLinkage("Linkage", (Linkage)resource);
73979    } else if (resource instanceof ListResource) {
73980      composeListResource("List", (ListResource)resource);
73981    } else if (resource instanceof Location) {
73982      composeLocation("Location", (Location)resource);
73983    } else if (resource instanceof ManufacturedItemDefinition) {
73984      composeManufacturedItemDefinition("ManufacturedItemDefinition", (ManufacturedItemDefinition)resource);
73985    } else if (resource instanceof Measure) {
73986      composeMeasure("Measure", (Measure)resource);
73987    } else if (resource instanceof MeasureReport) {
73988      composeMeasureReport("MeasureReport", (MeasureReport)resource);
73989    } else if (resource instanceof Medication) {
73990      composeMedication("Medication", (Medication)resource);
73991    } else if (resource instanceof MedicationAdministration) {
73992      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
73993    } else if (resource instanceof MedicationDispense) {
73994      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
73995    } else if (resource instanceof MedicationKnowledge) {
73996      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
73997    } else if (resource instanceof MedicationRequest) {
73998      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
73999    } else if (resource instanceof MedicationStatement) {
74000      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
74001    } else if (resource instanceof MedicinalProductDefinition) {
74002      composeMedicinalProductDefinition("MedicinalProductDefinition", (MedicinalProductDefinition)resource);
74003    } else if (resource instanceof MessageDefinition) {
74004      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
74005    } else if (resource instanceof MessageHeader) {
74006      composeMessageHeader("MessageHeader", (MessageHeader)resource);
74007    } else if (resource instanceof MolecularSequence) {
74008      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
74009    } else if (resource instanceof NamingSystem) {
74010      composeNamingSystem("NamingSystem", (NamingSystem)resource);
74011    } else if (resource instanceof NutritionIntake) {
74012      composeNutritionIntake("NutritionIntake", (NutritionIntake)resource);
74013    } else if (resource instanceof NutritionOrder) {
74014      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
74015    } else if (resource instanceof NutritionProduct) {
74016      composeNutritionProduct("NutritionProduct", (NutritionProduct)resource);
74017    } else if (resource instanceof Observation) {
74018      composeObservation("Observation", (Observation)resource);
74019    } else if (resource instanceof ObservationDefinition) {
74020      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
74021    } else if (resource instanceof OperationDefinition) {
74022      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
74023    } else if (resource instanceof OperationOutcome) {
74024      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
74025    } else if (resource instanceof Organization) {
74026      composeOrganization("Organization", (Organization)resource);
74027    } else if (resource instanceof OrganizationAffiliation) {
74028      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
74029    } else if (resource instanceof PackagedProductDefinition) {
74030      composePackagedProductDefinition("PackagedProductDefinition", (PackagedProductDefinition)resource);
74031    } else if (resource instanceof Parameters) {
74032      composeParameters("Parameters", (Parameters)resource);
74033    } else if (resource instanceof Patient) {
74034      composePatient("Patient", (Patient)resource);
74035    } else if (resource instanceof PaymentNotice) {
74036      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
74037    } else if (resource instanceof PaymentReconciliation) {
74038      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
74039    } else if (resource instanceof Permission) {
74040      composePermission("Permission", (Permission)resource);
74041    } else if (resource instanceof Person) {
74042      composePerson("Person", (Person)resource);
74043    } else if (resource instanceof PlanDefinition) {
74044      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
74045    } else if (resource instanceof Practitioner) {
74046      composePractitioner("Practitioner", (Practitioner)resource);
74047    } else if (resource instanceof PractitionerRole) {
74048      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
74049    } else if (resource instanceof Procedure) {
74050      composeProcedure("Procedure", (Procedure)resource);
74051    } else if (resource instanceof Provenance) {
74052      composeProvenance("Provenance", (Provenance)resource);
74053    } else if (resource instanceof Questionnaire) {
74054      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
74055    } else if (resource instanceof QuestionnaireResponse) {
74056      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
74057    } else if (resource instanceof RegulatedAuthorization) {
74058      composeRegulatedAuthorization("RegulatedAuthorization", (RegulatedAuthorization)resource);
74059    } else if (resource instanceof RelatedPerson) {
74060      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
74061    } else if (resource instanceof RequestOrchestration) {
74062      composeRequestOrchestration("RequestOrchestration", (RequestOrchestration)resource);
74063    } else if (resource instanceof Requirements) {
74064      composeRequirements("Requirements", (Requirements)resource);
74065    } else if (resource instanceof ResearchStudy) {
74066      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
74067    } else if (resource instanceof ResearchSubject) {
74068      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
74069    } else if (resource instanceof RiskAssessment) {
74070      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
74071    } else if (resource instanceof Schedule) {
74072      composeSchedule("Schedule", (Schedule)resource);
74073    } else if (resource instanceof SearchParameter) {
74074      composeSearchParameter("SearchParameter", (SearchParameter)resource);
74075    } else if (resource instanceof ServiceRequest) {
74076      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
74077    } else if (resource instanceof Slot) {
74078      composeSlot("Slot", (Slot)resource);
74079    } else if (resource instanceof Specimen) {
74080      composeSpecimen("Specimen", (Specimen)resource);
74081    } else if (resource instanceof SpecimenDefinition) {
74082      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
74083    } else if (resource instanceof StructureDefinition) {
74084      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
74085    } else if (resource instanceof StructureMap) {
74086      composeStructureMap("StructureMap", (StructureMap)resource);
74087    } else if (resource instanceof Subscription) {
74088      composeSubscription("Subscription", (Subscription)resource);
74089    } else if (resource instanceof SubscriptionStatus) {
74090      composeSubscriptionStatus("SubscriptionStatus", (SubscriptionStatus)resource);
74091    } else if (resource instanceof SubscriptionTopic) {
74092      composeSubscriptionTopic("SubscriptionTopic", (SubscriptionTopic)resource);
74093    } else if (resource instanceof Substance) {
74094      composeSubstance("Substance", (Substance)resource);
74095    } else if (resource instanceof SubstanceDefinition) {
74096      composeSubstanceDefinition("SubstanceDefinition", (SubstanceDefinition)resource);
74097    } else if (resource instanceof SubstanceNucleicAcid) {
74098      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
74099    } else if (resource instanceof SubstancePolymer) {
74100      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
74101    } else if (resource instanceof SubstanceProtein) {
74102      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
74103    } else if (resource instanceof SubstanceReferenceInformation) {
74104      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
74105    } else if (resource instanceof SubstanceSourceMaterial) {
74106      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
74107    } else if (resource instanceof SupplyDelivery) {
74108      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
74109    } else if (resource instanceof SupplyRequest) {
74110      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
74111    } else if (resource instanceof Task) {
74112      composeTask("Task", (Task)resource);
74113    } else if (resource instanceof TerminologyCapabilities) {
74114      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
74115    } else if (resource instanceof TestPlan) {
74116      composeTestPlan("TestPlan", (TestPlan)resource);
74117    } else if (resource instanceof TestReport) {
74118      composeTestReport("TestReport", (TestReport)resource);
74119    } else if (resource instanceof TestScript) {
74120      composeTestScript("TestScript", (TestScript)resource);
74121    } else if (resource instanceof Transport) {
74122      composeTransport("Transport", (Transport)resource);
74123    } else if (resource instanceof ValueSet) {
74124      composeValueSet("ValueSet", (ValueSet)resource);
74125    } else if (resource instanceof VerificationResult) {
74126      composeVerificationResult("VerificationResult", (VerificationResult)resource);
74127    } else if (resource instanceof VisionPrescription) {
74128      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
74129    } else if (!customCompose(resource)) {
74130      throw new Error("Unhandled resource type: "+resource.getClass().getName());
74131    }
74132  }
74133
74134  protected void composeNamedReference(String name, Resource resource) throws IOException {
74135    if (resource == null) {
74136      throw new Error("Resource is null - can't produce JSON");
74137    } else if (resource instanceof Account) {
74138      composeAccount(name, (Account)resource);
74139    } else if (resource instanceof ActivityDefinition) {
74140      composeActivityDefinition(name, (ActivityDefinition)resource);
74141    } else if (resource instanceof ActorDefinition) {
74142      composeActorDefinition(name, (ActorDefinition)resource);
74143    } else if (resource instanceof AdministrableProductDefinition) {
74144      composeAdministrableProductDefinition(name, (AdministrableProductDefinition)resource);
74145    } else if (resource instanceof AdverseEvent) {
74146      composeAdverseEvent(name, (AdverseEvent)resource);
74147    } else if (resource instanceof AllergyIntolerance) {
74148      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
74149    } else if (resource instanceof Appointment) {
74150      composeAppointment(name, (Appointment)resource);
74151    } else if (resource instanceof AppointmentResponse) {
74152      composeAppointmentResponse(name, (AppointmentResponse)resource);
74153    } else if (resource instanceof ArtifactAssessment) {
74154      composeArtifactAssessment(name, (ArtifactAssessment)resource);
74155    } else if (resource instanceof AuditEvent) {
74156      composeAuditEvent(name, (AuditEvent)resource);
74157    } else if (resource instanceof Basic) {
74158      composeBasic(name, (Basic)resource);
74159    } else if (resource instanceof Binary) {
74160      composeBinary(name, (Binary)resource);
74161    } else if (resource instanceof BiologicallyDerivedProduct) {
74162      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
74163    } else if (resource instanceof BiologicallyDerivedProductDispense) {
74164      composeBiologicallyDerivedProductDispense(name, (BiologicallyDerivedProductDispense)resource);
74165    } else if (resource instanceof BodyStructure) {
74166      composeBodyStructure(name, (BodyStructure)resource);
74167    } else if (resource instanceof Bundle) {
74168      composeBundle(name, (Bundle)resource);
74169    } else if (resource instanceof CapabilityStatement) {
74170      composeCapabilityStatement(name, (CapabilityStatement)resource);
74171    } else if (resource instanceof CarePlan) {
74172      composeCarePlan(name, (CarePlan)resource);
74173    } else if (resource instanceof CareTeam) {
74174      composeCareTeam(name, (CareTeam)resource);
74175    } else if (resource instanceof ChargeItem) {
74176      composeChargeItem(name, (ChargeItem)resource);
74177    } else if (resource instanceof ChargeItemDefinition) {
74178      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
74179    } else if (resource instanceof Citation) {
74180      composeCitation(name, (Citation)resource);
74181    } else if (resource instanceof Claim) {
74182      composeClaim(name, (Claim)resource);
74183    } else if (resource instanceof ClaimResponse) {
74184      composeClaimResponse(name, (ClaimResponse)resource);
74185    } else if (resource instanceof ClinicalImpression) {
74186      composeClinicalImpression(name, (ClinicalImpression)resource);
74187    } else if (resource instanceof ClinicalUseDefinition) {
74188      composeClinicalUseDefinition(name, (ClinicalUseDefinition)resource);
74189    } else if (resource instanceof CodeSystem) {
74190      composeCodeSystem(name, (CodeSystem)resource);
74191    } else if (resource instanceof Communication) {
74192      composeCommunication(name, (Communication)resource);
74193    } else if (resource instanceof CommunicationRequest) {
74194      composeCommunicationRequest(name, (CommunicationRequest)resource);
74195    } else if (resource instanceof CompartmentDefinition) {
74196      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
74197    } else if (resource instanceof Composition) {
74198      composeComposition(name, (Composition)resource);
74199    } else if (resource instanceof ConceptMap) {
74200      composeConceptMap(name, (ConceptMap)resource);
74201    } else if (resource instanceof Condition) {
74202      composeCondition(name, (Condition)resource);
74203    } else if (resource instanceof ConditionDefinition) {
74204      composeConditionDefinition(name, (ConditionDefinition)resource);
74205    } else if (resource instanceof Consent) {
74206      composeConsent(name, (Consent)resource);
74207    } else if (resource instanceof Contract) {
74208      composeContract(name, (Contract)resource);
74209    } else if (resource instanceof Coverage) {
74210      composeCoverage(name, (Coverage)resource);
74211    } else if (resource instanceof CoverageEligibilityRequest) {
74212      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
74213    } else if (resource instanceof CoverageEligibilityResponse) {
74214      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
74215    } else if (resource instanceof DetectedIssue) {
74216      composeDetectedIssue(name, (DetectedIssue)resource);
74217    } else if (resource instanceof Device) {
74218      composeDevice(name, (Device)resource);
74219    } else if (resource instanceof DeviceAssociation) {
74220      composeDeviceAssociation(name, (DeviceAssociation)resource);
74221    } else if (resource instanceof DeviceDefinition) {
74222      composeDeviceDefinition(name, (DeviceDefinition)resource);
74223    } else if (resource instanceof DeviceDispense) {
74224      composeDeviceDispense(name, (DeviceDispense)resource);
74225    } else if (resource instanceof DeviceMetric) {
74226      composeDeviceMetric(name, (DeviceMetric)resource);
74227    } else if (resource instanceof DeviceRequest) {
74228      composeDeviceRequest(name, (DeviceRequest)resource);
74229    } else if (resource instanceof DeviceUsage) {
74230      composeDeviceUsage(name, (DeviceUsage)resource);
74231    } else if (resource instanceof DiagnosticReport) {
74232      composeDiagnosticReport(name, (DiagnosticReport)resource);
74233    } else if (resource instanceof DocumentReference) {
74234      composeDocumentReference(name, (DocumentReference)resource);
74235    } else if (resource instanceof Encounter) {
74236      composeEncounter(name, (Encounter)resource);
74237    } else if (resource instanceof EncounterHistory) {
74238      composeEncounterHistory(name, (EncounterHistory)resource);
74239    } else if (resource instanceof Endpoint) {
74240      composeEndpoint(name, (Endpoint)resource);
74241    } else if (resource instanceof EnrollmentRequest) {
74242      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
74243    } else if (resource instanceof EnrollmentResponse) {
74244      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
74245    } else if (resource instanceof EpisodeOfCare) {
74246      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
74247    } else if (resource instanceof EventDefinition) {
74248      composeEventDefinition(name, (EventDefinition)resource);
74249    } else if (resource instanceof Evidence) {
74250      composeEvidence(name, (Evidence)resource);
74251    } else if (resource instanceof EvidenceReport) {
74252      composeEvidenceReport(name, (EvidenceReport)resource);
74253    } else if (resource instanceof EvidenceVariable) {
74254      composeEvidenceVariable(name, (EvidenceVariable)resource);
74255    } else if (resource instanceof ExampleScenario) {
74256      composeExampleScenario(name, (ExampleScenario)resource);
74257    } else if (resource instanceof ExplanationOfBenefit) {
74258      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
74259    } else if (resource instanceof FamilyMemberHistory) {
74260      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
74261    } else if (resource instanceof Flag) {
74262      composeFlag(name, (Flag)resource);
74263    } else if (resource instanceof FormularyItem) {
74264      composeFormularyItem(name, (FormularyItem)resource);
74265    } else if (resource instanceof GenomicStudy) {
74266      composeGenomicStudy(name, (GenomicStudy)resource);
74267    } else if (resource instanceof Goal) {
74268      composeGoal(name, (Goal)resource);
74269    } else if (resource instanceof GraphDefinition) {
74270      composeGraphDefinition(name, (GraphDefinition)resource);
74271    } else if (resource instanceof Group) {
74272      composeGroup(name, (Group)resource);
74273    } else if (resource instanceof GuidanceResponse) {
74274      composeGuidanceResponse(name, (GuidanceResponse)resource);
74275    } else if (resource instanceof HealthcareService) {
74276      composeHealthcareService(name, (HealthcareService)resource);
74277    } else if (resource instanceof ImagingSelection) {
74278      composeImagingSelection(name, (ImagingSelection)resource);
74279    } else if (resource instanceof ImagingStudy) {
74280      composeImagingStudy(name, (ImagingStudy)resource);
74281    } else if (resource instanceof Immunization) {
74282      composeImmunization(name, (Immunization)resource);
74283    } else if (resource instanceof ImmunizationEvaluation) {
74284      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
74285    } else if (resource instanceof ImmunizationRecommendation) {
74286      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
74287    } else if (resource instanceof ImplementationGuide) {
74288      composeImplementationGuide(name, (ImplementationGuide)resource);
74289    } else if (resource instanceof Ingredient) {
74290      composeIngredient(name, (Ingredient)resource);
74291    } else if (resource instanceof InsurancePlan) {
74292      composeInsurancePlan(name, (InsurancePlan)resource);
74293    } else if (resource instanceof InventoryItem) {
74294      composeInventoryItem(name, (InventoryItem)resource);
74295    } else if (resource instanceof InventoryReport) {
74296      composeInventoryReport(name, (InventoryReport)resource);
74297    } else if (resource instanceof Invoice) {
74298      composeInvoice(name, (Invoice)resource);
74299    } else if (resource instanceof Library) {
74300      composeLibrary(name, (Library)resource);
74301    } else if (resource instanceof Linkage) {
74302      composeLinkage(name, (Linkage)resource);
74303    } else if (resource instanceof ListResource) {
74304      composeListResource(name, (ListResource)resource);
74305    } else if (resource instanceof Location) {
74306      composeLocation(name, (Location)resource);
74307    } else if (resource instanceof ManufacturedItemDefinition) {
74308      composeManufacturedItemDefinition(name, (ManufacturedItemDefinition)resource);
74309    } else if (resource instanceof Measure) {
74310      composeMeasure(name, (Measure)resource);
74311    } else if (resource instanceof MeasureReport) {
74312      composeMeasureReport(name, (MeasureReport)resource);
74313    } else if (resource instanceof Medication) {
74314      composeMedication(name, (Medication)resource);
74315    } else if (resource instanceof MedicationAdministration) {
74316      composeMedicationAdministration(name, (MedicationAdministration)resource);
74317    } else if (resource instanceof MedicationDispense) {
74318      composeMedicationDispense(name, (MedicationDispense)resource);
74319    } else if (resource instanceof MedicationKnowledge) {
74320      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
74321    } else if (resource instanceof MedicationRequest) {
74322      composeMedicationRequest(name, (MedicationRequest)resource);
74323    } else if (resource instanceof MedicationStatement) {
74324      composeMedicationStatement(name, (MedicationStatement)resource);
74325    } else if (resource instanceof MedicinalProductDefinition) {
74326      composeMedicinalProductDefinition(name, (MedicinalProductDefinition)resource);
74327    } else if (resource instanceof MessageDefinition) {
74328      composeMessageDefinition(name, (MessageDefinition)resource);
74329    } else if (resource instanceof MessageHeader) {
74330      composeMessageHeader(name, (MessageHeader)resource);
74331    } else if (resource instanceof MolecularSequence) {
74332      composeMolecularSequence(name, (MolecularSequence)resource);
74333    } else if (resource instanceof NamingSystem) {
74334      composeNamingSystem(name, (NamingSystem)resource);
74335    } else if (resource instanceof NutritionIntake) {
74336      composeNutritionIntake(name, (NutritionIntake)resource);
74337    } else if (resource instanceof NutritionOrder) {
74338      composeNutritionOrder(name, (NutritionOrder)resource);
74339    } else if (resource instanceof NutritionProduct) {
74340      composeNutritionProduct(name, (NutritionProduct)resource);
74341    } else if (resource instanceof Observation) {
74342      composeObservation(name, (Observation)resource);
74343    } else if (resource instanceof ObservationDefinition) {
74344      composeObservationDefinition(name, (ObservationDefinition)resource);
74345    } else if (resource instanceof OperationDefinition) {
74346      composeOperationDefinition(name, (OperationDefinition)resource);
74347    } else if (resource instanceof OperationOutcome) {
74348      composeOperationOutcome(name, (OperationOutcome)resource);
74349    } else if (resource instanceof Organization) {
74350      composeOrganization(name, (Organization)resource);
74351    } else if (resource instanceof OrganizationAffiliation) {
74352      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
74353    } else if (resource instanceof PackagedProductDefinition) {
74354      composePackagedProductDefinition(name, (PackagedProductDefinition)resource);
74355    } else if (resource instanceof Parameters) {
74356      composeParameters(name, (Parameters)resource);
74357    } else if (resource instanceof Patient) {
74358      composePatient(name, (Patient)resource);
74359    } else if (resource instanceof PaymentNotice) {
74360      composePaymentNotice(name, (PaymentNotice)resource);
74361    } else if (resource instanceof PaymentReconciliation) {
74362      composePaymentReconciliation(name, (PaymentReconciliation)resource);
74363    } else if (resource instanceof Permission) {
74364      composePermission(name, (Permission)resource);
74365    } else if (resource instanceof Person) {
74366      composePerson(name, (Person)resource);
74367    } else if (resource instanceof PlanDefinition) {
74368      composePlanDefinition(name, (PlanDefinition)resource);
74369    } else if (resource instanceof Practitioner) {
74370      composePractitioner(name, (Practitioner)resource);
74371    } else if (resource instanceof PractitionerRole) {
74372      composePractitionerRole(name, (PractitionerRole)resource);
74373    } else if (resource instanceof Procedure) {
74374      composeProcedure(name, (Procedure)resource);
74375    } else if (resource instanceof Provenance) {
74376      composeProvenance(name, (Provenance)resource);
74377    } else if (resource instanceof Questionnaire) {
74378      composeQuestionnaire(name, (Questionnaire)resource);
74379    } else if (resource instanceof QuestionnaireResponse) {
74380      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
74381    } else if (resource instanceof RegulatedAuthorization) {
74382      composeRegulatedAuthorization(name, (RegulatedAuthorization)resource);
74383    } else if (resource instanceof RelatedPerson) {
74384      composeRelatedPerson(name, (RelatedPerson)resource);
74385    } else if (resource instanceof RequestOrchestration) {
74386      composeRequestOrchestration(name, (RequestOrchestration)resource);
74387    } else if (resource instanceof Requirements) {
74388      composeRequirements(name, (Requirements)resource);
74389    } else if (resource instanceof ResearchStudy) {
74390      composeResearchStudy(name, (ResearchStudy)resource);
74391    } else if (resource instanceof ResearchSubject) {
74392      composeResearchSubject(name, (ResearchSubject)resource);
74393    } else if (resource instanceof RiskAssessment) {
74394      composeRiskAssessment(name, (RiskAssessment)resource);
74395    } else if (resource instanceof Schedule) {
74396      composeSchedule(name, (Schedule)resource);
74397    } else if (resource instanceof SearchParameter) {
74398      composeSearchParameter(name, (SearchParameter)resource);
74399    } else if (resource instanceof ServiceRequest) {
74400      composeServiceRequest(name, (ServiceRequest)resource);
74401    } else if (resource instanceof Slot) {
74402      composeSlot(name, (Slot)resource);
74403    } else if (resource instanceof Specimen) {
74404      composeSpecimen(name, (Specimen)resource);
74405    } else if (resource instanceof SpecimenDefinition) {
74406      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
74407    } else if (resource instanceof StructureDefinition) {
74408      composeStructureDefinition(name, (StructureDefinition)resource);
74409    } else if (resource instanceof StructureMap) {
74410      composeStructureMap(name, (StructureMap)resource);
74411    } else if (resource instanceof Subscription) {
74412      composeSubscription(name, (Subscription)resource);
74413    } else if (resource instanceof SubscriptionStatus) {
74414      composeSubscriptionStatus(name, (SubscriptionStatus)resource);
74415    } else if (resource instanceof SubscriptionTopic) {
74416      composeSubscriptionTopic(name, (SubscriptionTopic)resource);
74417    } else if (resource instanceof Substance) {
74418      composeSubstance(name, (Substance)resource);
74419    } else if (resource instanceof SubstanceDefinition) {
74420      composeSubstanceDefinition(name, (SubstanceDefinition)resource);
74421    } else if (resource instanceof SubstanceNucleicAcid) {
74422      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
74423    } else if (resource instanceof SubstancePolymer) {
74424      composeSubstancePolymer(name, (SubstancePolymer)resource);
74425    } else if (resource instanceof SubstanceProtein) {
74426      composeSubstanceProtein(name, (SubstanceProtein)resource);
74427    } else if (resource instanceof SubstanceReferenceInformation) {
74428      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
74429    } else if (resource instanceof SubstanceSourceMaterial) {
74430      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
74431    } else if (resource instanceof SupplyDelivery) {
74432      composeSupplyDelivery(name, (SupplyDelivery)resource);
74433    } else if (resource instanceof SupplyRequest) {
74434      composeSupplyRequest(name, (SupplyRequest)resource);
74435    } else if (resource instanceof Task) {
74436      composeTask(name, (Task)resource);
74437    } else if (resource instanceof TerminologyCapabilities) {
74438      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
74439    } else if (resource instanceof TestPlan) {
74440      composeTestPlan(name, (TestPlan)resource);
74441    } else if (resource instanceof TestReport) {
74442      composeTestReport(name, (TestReport)resource);
74443    } else if (resource instanceof TestScript) {
74444      composeTestScript(name, (TestScript)resource);
74445    } else if (resource instanceof Transport) {
74446      composeTransport(name, (Transport)resource);
74447    } else if (resource instanceof ValueSet) {
74448      composeValueSet(name, (ValueSet)resource);
74449    } else if (resource instanceof VerificationResult) {
74450      composeVerificationResult(name, (VerificationResult)resource);
74451    } else if (resource instanceof VisionPrescription) {
74452      composeVisionPrescription(name, (VisionPrescription)resource);
74453    } else if (!customCompose(name, resource)) {
74454       throw new Error("Unhandled resource type : "+resource.getClass().getName());
74455    }
74456  }
74457
74458
74459  protected void composeType(String prefix, DataType type) throws IOException {
74460    if (type == null) {
74461      ;
74462    } else if (type instanceof Address) {
74463       composeAddress(prefix+"Address", (Address) type);
74464    } else if (type instanceof Age) {
74465       composeAge(prefix+"Age", (Age) type);
74466    } else if (type instanceof Annotation) {
74467       composeAnnotation(prefix+"Annotation", (Annotation) type);
74468    } else if (type instanceof Attachment) {
74469       composeAttachment(prefix+"Attachment", (Attachment) type);
74470    } else if (type instanceof Availability) {
74471       composeAvailability(prefix+"Availability", (Availability) type);
74472    } else if (type instanceof CodeableConcept) {
74473       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
74474    } else if (type instanceof CodeableReference) {
74475       composeCodeableReference(prefix+"CodeableReference", (CodeableReference) type);
74476    } else if (type instanceof Coding) {
74477       composeCoding(prefix+"Coding", (Coding) type);
74478    } else if (type instanceof ContactDetail) {
74479       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
74480    } else if (type instanceof ContactPoint) {
74481       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
74482    } else if (type instanceof Contributor) {
74483       composeContributor(prefix+"Contributor", (Contributor) type);
74484    } else if (type instanceof Count) {
74485       composeCount(prefix+"Count", (Count) type);
74486    } else if (type instanceof DataRequirement) {
74487       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
74488    } else if (type instanceof Distance) {
74489       composeDistance(prefix+"Distance", (Distance) type);
74490    } else if (type instanceof Dosage) {
74491       composeDosage(prefix+"Dosage", (Dosage) type);
74492    } else if (type instanceof Duration) {
74493       composeDuration(prefix+"Duration", (Duration) type);
74494    } else if (type instanceof ElementDefinition) {
74495       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
74496    } else if (type instanceof Expression) {
74497       composeExpression(prefix+"Expression", (Expression) type);
74498    } else if (type instanceof ExtendedContactDetail) {
74499       composeExtendedContactDetail(prefix+"ExtendedContactDetail", (ExtendedContactDetail) type);
74500    } else if (type instanceof Extension) {
74501       composeExtension(prefix+"Extension", (Extension) type);
74502    } else if (type instanceof HumanName) {
74503       composeHumanName(prefix+"HumanName", (HumanName) type);
74504    } else if (type instanceof Identifier) {
74505       composeIdentifier(prefix+"Identifier", (Identifier) type);
74506    } else if (type instanceof MarketingStatus) {
74507       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
74508    } else if (type instanceof Meta) {
74509       composeMeta(prefix+"Meta", (Meta) type);
74510    } else if (type instanceof MonetaryComponent) {
74511       composeMonetaryComponent(prefix+"MonetaryComponent", (MonetaryComponent) type);
74512    } else if (type instanceof Money) {
74513       composeMoney(prefix+"Money", (Money) type);
74514    } else if (type instanceof Narrative) {
74515       composeNarrative(prefix+"Narrative", (Narrative) type);
74516    } else if (type instanceof ParameterDefinition) {
74517       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
74518    } else if (type instanceof Period) {
74519       composePeriod(prefix+"Period", (Period) type);
74520    } else if (type instanceof ProductShelfLife) {
74521       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
74522    } else if (type instanceof Quantity) {
74523       composeQuantity(prefix+"Quantity", (Quantity) type);
74524    } else if (type instanceof Range) {
74525       composeRange(prefix+"Range", (Range) type);
74526    } else if (type instanceof Ratio) {
74527       composeRatio(prefix+"Ratio", (Ratio) type);
74528    } else if (type instanceof RatioRange) {
74529       composeRatioRange(prefix+"RatioRange", (RatioRange) type);
74530    } else if (type instanceof Reference) {
74531       composeReference(prefix+"Reference", (Reference) type);
74532    } else if (type instanceof RelatedArtifact) {
74533       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
74534    } else if (type instanceof SampledData) {
74535       composeSampledData(prefix+"SampledData", (SampledData) type);
74536    } else if (type instanceof Signature) {
74537       composeSignature(prefix+"Signature", (Signature) type);
74538    } else if (type instanceof Timing) {
74539       composeTiming(prefix+"Timing", (Timing) type);
74540    } else if (type instanceof TriggerDefinition) {
74541       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
74542    } else if (type instanceof UsageContext) {
74543       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
74544    } else if (type instanceof VirtualServiceDetail) {
74545       composeVirtualServiceDetail(prefix+"VirtualServiceDetail", (VirtualServiceDetail) type);
74546 
74547    } else if (type instanceof CodeType) {
74548      composeCodeCore(prefix+"Code", (CodeType) type, false);
74549      composeCodeExtras(prefix+"Code", (CodeType) type, false);
74550    }
74551    else if (type instanceof OidType) {
74552      composeOidCore(prefix+"Oid", (OidType) type, false);
74553      composeOidExtras(prefix+"Oid", (OidType) type, false);
74554    }
74555    else if (type instanceof CanonicalType) {
74556      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
74557      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
74558    }
74559    else if (type instanceof UuidType) {
74560      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
74561      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
74562    }
74563    else if (type instanceof UrlType) {
74564      composeUrlCore(prefix+"Url", (UrlType) type, false);
74565      composeUrlExtras(prefix+"Url", (UrlType) type, false);
74566    }
74567    else if (type instanceof UnsignedIntType) {
74568      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
74569      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
74570    }
74571    else if (type instanceof MarkdownType) {
74572      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
74573      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
74574    }
74575    else if (type instanceof IdType) {
74576      composeIdCore(prefix+"Id", (IdType) type, false);
74577      composeIdExtras(prefix+"Id", (IdType) type, false);
74578    }
74579    else if (type instanceof PositiveIntType) {
74580      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
74581      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
74582    }
74583    else if (type instanceof DateType) {
74584      composeDateCore(prefix+"Date", (DateType) type, false);
74585      composeDateExtras(prefix+"Date", (DateType) type, false);
74586    }
74587    else if (type instanceof DateTimeType) {
74588      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
74589      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
74590    }
74591    else if (type instanceof StringType) {
74592      composeStringCore(prefix+"String", (StringType) type, false);
74593      composeStringExtras(prefix+"String", (StringType) type, false);
74594    }
74595    else if (type instanceof IntegerType) {
74596      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
74597      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
74598    }
74599    else if (type instanceof Integer64Type) {
74600      composeInteger64Core(prefix+"Integer64", (Integer64Type) type, false);
74601      composeInteger64Extras(prefix+"Integer64", (Integer64Type) type, false);
74602    }
74603    else if (type instanceof UriType) {
74604      composeUriCore(prefix+"Uri", (UriType) type, false);
74605      composeUriExtras(prefix+"Uri", (UriType) type, false);
74606    }
74607    else if (type instanceof InstantType) {
74608      composeInstantCore(prefix+"Instant", (InstantType) type, false);
74609      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
74610    }
74611    else if (type instanceof BooleanType) {
74612      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
74613      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
74614    }
74615    else if (type instanceof Base64BinaryType) {
74616      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
74617      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
74618    }
74619    else if (type instanceof TimeType) {
74620      composeTimeCore(prefix+"Time", (TimeType) type, false);
74621      composeTimeExtras(prefix+"Time", (TimeType) type, false);
74622    }
74623    else if (type instanceof DecimalType) {
74624      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
74625      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
74626    } else
74627      throw new Error("Unhandled type");
74628  }
74629
74630  protected void composeTypeInner(DataType type) throws IOException {
74631    if (type == null) {
74632      ;
74633    } else if (type instanceof Address) {
74634       composeAddressProperties((Address) type);
74635    } else if (type instanceof Age) {
74636       composeAgeProperties((Age) type);
74637    } else if (type instanceof Annotation) {
74638       composeAnnotationProperties((Annotation) type);
74639    } else if (type instanceof Attachment) {
74640       composeAttachmentProperties((Attachment) type);
74641    } else if (type instanceof Availability) {
74642       composeAvailabilityProperties((Availability) type);
74643    } else if (type instanceof CodeableConcept) {
74644       composeCodeableConceptProperties((CodeableConcept) type);
74645    } else if (type instanceof CodeableReference) {
74646       composeCodeableReferenceProperties((CodeableReference) type);
74647    } else if (type instanceof Coding) {
74648       composeCodingProperties((Coding) type);
74649    } else if (type instanceof ContactDetail) {
74650       composeContactDetailProperties((ContactDetail) type);
74651    } else if (type instanceof ContactPoint) {
74652       composeContactPointProperties((ContactPoint) type);
74653    } else if (type instanceof Contributor) {
74654       composeContributorProperties((Contributor) type);
74655    } else if (type instanceof Count) {
74656       composeCountProperties((Count) type);
74657    } else if (type instanceof DataRequirement) {
74658       composeDataRequirementProperties((DataRequirement) type);
74659    } else if (type instanceof Distance) {
74660       composeDistanceProperties((Distance) type);
74661    } else if (type instanceof Dosage) {
74662       composeDosageProperties((Dosage) type);
74663    } else if (type instanceof Duration) {
74664       composeDurationProperties((Duration) type);
74665    } else if (type instanceof ElementDefinition) {
74666       composeElementDefinitionProperties((ElementDefinition) type);
74667    } else if (type instanceof Expression) {
74668       composeExpressionProperties((Expression) type);
74669    } else if (type instanceof ExtendedContactDetail) {
74670       composeExtendedContactDetailProperties((ExtendedContactDetail) type);
74671    } else if (type instanceof Extension) {
74672       composeExtensionProperties((Extension) type);
74673    } else if (type instanceof HumanName) {
74674       composeHumanNameProperties((HumanName) type);
74675    } else if (type instanceof Identifier) {
74676       composeIdentifierProperties((Identifier) type);
74677    } else if (type instanceof MarketingStatus) {
74678       composeMarketingStatusProperties((MarketingStatus) type);
74679    } else if (type instanceof Meta) {
74680       composeMetaProperties((Meta) type);
74681    } else if (type instanceof MonetaryComponent) {
74682       composeMonetaryComponentProperties((MonetaryComponent) type);
74683    } else if (type instanceof Money) {
74684       composeMoneyProperties((Money) type);
74685    } else if (type instanceof Narrative) {
74686       composeNarrativeProperties((Narrative) type);
74687    } else if (type instanceof ParameterDefinition) {
74688       composeParameterDefinitionProperties((ParameterDefinition) type);
74689    } else if (type instanceof Period) {
74690       composePeriodProperties((Period) type);
74691    } else if (type instanceof ProductShelfLife) {
74692       composeProductShelfLifeProperties((ProductShelfLife) type);
74693    } else if (type instanceof Quantity) {
74694       composeQuantityProperties((Quantity) type);
74695    } else if (type instanceof Range) {
74696       composeRangeProperties((Range) type);
74697    } else if (type instanceof Ratio) {
74698       composeRatioProperties((Ratio) type);
74699    } else if (type instanceof RatioRange) {
74700       composeRatioRangeProperties((RatioRange) type);
74701    } else if (type instanceof Reference) {
74702       composeReferenceProperties((Reference) type);
74703    } else if (type instanceof RelatedArtifact) {
74704       composeRelatedArtifactProperties((RelatedArtifact) type);
74705    } else if (type instanceof SampledData) {
74706       composeSampledDataProperties((SampledData) type);
74707    } else if (type instanceof Signature) {
74708       composeSignatureProperties((Signature) type);
74709    } else if (type instanceof Timing) {
74710       composeTimingProperties((Timing) type);
74711    } else if (type instanceof TriggerDefinition) {
74712       composeTriggerDefinitionProperties((TriggerDefinition) type);
74713    } else if (type instanceof UsageContext) {
74714       composeUsageContextProperties((UsageContext) type);
74715    } else if (type instanceof VirtualServiceDetail) {
74716       composeVirtualServiceDetailProperties((VirtualServiceDetail) type);
74717    } else
74718      throw new Error("Unhandled type: "+type.fhirType());
74719  }
74720
74721}