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