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++) {