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 Sat, Nov 5, 2022 10:47+1100 for FHIR v5.0.0-ballot
034
035
036
037import org.hl7.fhir.r5.model.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.utilities.xhtml.XhtmlNode;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
043import com.google.gson.JsonObject;
044import com.google.gson.JsonArray;
045import com.google.gson.JsonElement;
046import java.io.IOException;
047
048public class JsonParser extends JsonParserBase {
049
050  public JsonParser() {
051    super();
052  }
053
054  public JsonParser(boolean allowUnknownContent) {
055    super();
056    setAllowUnknownContent(allowUnknownContent);
057  }
058
059  public JsonParser(boolean allowUnknownContent, boolean allowComments) {
060    super();
061    setAllowUnknownContent(allowUnknownContent);
062    setAllowComments(allowComments);
063  }
064
065  protected void parseBaseProperties(JsonObject json, Base res) throws IOException, FHIRFormatError {
066    // nothing
067  }
068
069  @SuppressWarnings("unchecked")
070  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
071    Enumeration<E> res = new Enumeration<E>(e);
072    if (s != null)
073      res.setValue((E) e.fromCode(s));
074    return res;
075  }
076
077  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
078    DateType res = new DateType(v);
079    return res;
080  }
081
082  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
083    DateTimeType res = new DateTimeType(v);
084    return res;
085  }
086
087  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
088    CodeType res = new CodeType(v);
089    return res;
090  }
091
092  protected StringType parseString(String v) throws IOException, FHIRFormatError {
093    StringType res = new StringType(v);
094    return res;
095  }
096
097  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
098    IntegerType res = new IntegerType(v);
099    return res;
100  }
101
102  protected Integer64Type parseInteger64(java.lang.Long v) throws IOException, FHIRFormatError {
103    Integer64Type res = new Integer64Type(v);
104    return res;
105  }
106
107  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
108    OidType res = new OidType(v);
109    return res;
110  }
111
112  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
113    CanonicalType res = new CanonicalType(v);
114    return res;
115  }
116
117  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
118    UriType res = new UriType(v);
119    return res;
120  }
121
122  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
123    UuidType res = new UuidType(v);
124    return res;
125  }
126
127  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
128    UrlType res = new UrlType(v);
129    return res;
130  }
131
132  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
133    InstantType res = new InstantType(v);
134    return res;
135  }
136
137  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
138    BooleanType res = new BooleanType(v);
139    return res;
140  }
141
142  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
143    Base64BinaryType res = new Base64BinaryType(v);
144    return res;
145  }
146
147  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
148    UnsignedIntType res = new UnsignedIntType(v);
149    return res;
150  }
151
152  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
153    MarkdownType res = new MarkdownType(v);
154    return res;
155  }
156
157  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
158    TimeType res = new TimeType(v);
159    return res;
160  }
161
162  protected IdType parseId(String v) throws IOException, FHIRFormatError {
163    IdType res = new IdType(v);
164    return res;
165  }
166
167  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
168    PositiveIntType res = new PositiveIntType(v);
169    return res;
170  }
171
172  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
173    DecimalType res = new DecimalType(v);
174    if (v instanceof PresentedBigDecimal)
175      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
176    return res;
177  }
178
179
180
181  protected void parseBackboneElementProperties(JsonObject json, BackboneElement res) throws IOException, FHIRFormatError {
182    parseElementProperties(json, res);
183    if (json.has("modifierExtension")) {
184      JsonArray array = getJArray(json, "modifierExtension");
185      for (int i = 0; i < array.size(); i++) {
186        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
187      }
188    };
189  }
190
191  protected void parseBackboneTypeProperties(JsonObject json, BackboneType res) throws IOException, FHIRFormatError {
192    parseDataTypeProperties(json, res);
193    if (json.has("modifierExtension")) {
194      JsonArray array = getJArray(json, "modifierExtension");
195      for (int i = 0; i < array.size(); i++) {
196        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
197      }
198    };
199  }
200
201  protected void parseDataTypeProperties(JsonObject json, DataType res) throws IOException, FHIRFormatError {
202    parseElementProperties(json, res);
203  }
204
205  protected void parseElementProperties(JsonObject json, Element res) throws IOException, FHIRFormatError {
206    if (json.has("id"))
207      res.setIdElement(parseString(json.get("id").getAsString()));
208    if (json.has("_id"))
209      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
210    if (json.has("extension")) {
211      JsonArray array = getJArray(json, "extension");
212      for (int i = 0; i < array.size(); i++) {
213        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
214      }
215    };
216  }
217
218  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
219    Address res = new Address();
220    parseAddressProperties(json, res);
221    return res;
222  }
223
224  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
225    parseDataTypeProperties(json, res);
226    if (json.has("use"))
227      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
228    if (json.has("_use"))
229      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
230    if (json.has("type"))
231      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
232    if (json.has("_type"))
233      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
234    if (json.has("text"))
235      res.setTextElement(parseString(json.get("text").getAsString()));
236    if (json.has("_text"))
237      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
238    if (json.has("line")) {
239      JsonArray array = getJArray(json, "line");
240      for (int i = 0; i < array.size(); i++) {
241        if (array.get(i).isJsonNull()) {
242          res.getLine().add(new StringType());
243        } else {;
244          res.getLine().add(parseString(array.get(i).getAsString()));
245        }
246      }
247    };
248    if (json.has("_line")) {
249      JsonArray array = getJArray(json, "_line");
250      for (int i = 0; i < array.size(); i++) {
251        if (i == res.getLine().size())
252          res.getLine().add(parseString(null));
253        if (array.get(i) instanceof JsonObject) 
254          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
255      }
256    };
257    if (json.has("city"))
258      res.setCityElement(parseString(json.get("city").getAsString()));
259    if (json.has("_city"))
260      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
261    if (json.has("district"))
262      res.setDistrictElement(parseString(json.get("district").getAsString()));
263    if (json.has("_district"))
264      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
265    if (json.has("state"))
266      res.setStateElement(parseString(json.get("state").getAsString()));
267    if (json.has("_state"))
268      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
269    if (json.has("postalCode"))
270      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
271    if (json.has("_postalCode"))
272      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
273    if (json.has("country"))
274      res.setCountryElement(parseString(json.get("country").getAsString()));
275    if (json.has("_country"))
276      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
277    if (json.has("period"))
278      res.setPeriod(parsePeriod(getJObject(json, "period")));
279  }
280
281  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
282    Age res = new Age();
283    parseAgeProperties(json, res);
284    return res;
285  }
286
287  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
288    parseQuantityProperties(json, res);
289  }
290
291  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
292    Annotation res = new Annotation();
293    parseAnnotationProperties(json, res);
294    return res;
295  }
296
297  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
298    parseDataTypeProperties(json, res);
299    DataType author = parseType("author", json);
300    if (author != null)
301      res.setAuthor(author);
302    if (json.has("time"))
303      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
304    if (json.has("_time"))
305      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
306    if (json.has("text"))
307      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
308    if (json.has("_text"))
309      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
310  }
311
312  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
313    Attachment res = new Attachment();
314    parseAttachmentProperties(json, res);
315    return res;
316  }
317
318  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
319    parseDataTypeProperties(json, res);
320    if (json.has("contentType"))
321      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
322    if (json.has("_contentType"))
323      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
324    if (json.has("language"))
325      res.setLanguageElement(parseCode(json.get("language").getAsString()));
326    if (json.has("_language"))
327      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
328    if (json.has("data"))
329      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
330    if (json.has("_data"))
331      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
332    if (json.has("url"))
333      res.setUrlElement(parseUrl(json.get("url").getAsString()));
334    if (json.has("_url"))
335      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
336    if (json.has("size"))
337      res.setSizeElement(parseInteger64(json.get("size").getAsLong()));
338    if (json.has("_size"))
339      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
340    if (json.has("hash"))
341      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
342    if (json.has("_hash"))
343      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
344    if (json.has("title"))
345      res.setTitleElement(parseString(json.get("title").getAsString()));
346    if (json.has("_title"))
347      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
348    if (json.has("creation"))
349      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
350    if (json.has("_creation"))
351      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
352    if (json.has("height"))
353      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
354    if (json.has("_height"))
355      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
356    if (json.has("width"))
357      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
358    if (json.has("_width"))
359      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
360    if (json.has("frames"))
361      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
362    if (json.has("_frames"))
363      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
364    if (json.has("duration"))
365      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
366    if (json.has("_duration"))
367      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
368    if (json.has("pages"))
369      res.setPagesElement(parsePositiveInt(json.get("pages").getAsString()));
370    if (json.has("_pages"))
371      parseElementProperties(getJObject(json, "_pages"), res.getPagesElement());
372  }
373
374  protected Availability parseAvailability(JsonObject json) throws IOException, FHIRFormatError {
375    Availability res = new Availability();
376    parseAvailabilityProperties(json, res);
377    return res;
378  }
379
380  protected void parseAvailabilityProperties(JsonObject json, Availability res) throws IOException, FHIRFormatError {
381    parseDataTypeProperties(json, res);
382    if (json.has("availableTime")) {
383      JsonArray array = getJArray(json, "availableTime");
384      for (int i = 0; i < array.size(); i++) {
385        res.getAvailableTime().add(parseAvailabilityAvailableTimeComponent(array.get(i).getAsJsonObject()));
386      }
387    };
388    if (json.has("notAvailableTime")) {
389      JsonArray array = getJArray(json, "notAvailableTime");
390      for (int i = 0; i < array.size(); i++) {
391        res.getNotAvailableTime().add(parseAvailabilityNotAvailableTimeComponent(array.get(i).getAsJsonObject()));
392      }
393    };
394  }
395
396  protected Availability.AvailabilityAvailableTimeComponent parseAvailabilityAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
397    Availability.AvailabilityAvailableTimeComponent res = new Availability.AvailabilityAvailableTimeComponent();
398    parseAvailabilityAvailableTimeComponentProperties(json, res);
399    return res;
400  }
401
402  protected void parseAvailabilityAvailableTimeComponentProperties(JsonObject json, Availability.AvailabilityAvailableTimeComponent res) throws IOException, FHIRFormatError {
403    parseElementProperties(json, res);
404    if (json.has("daysOfWeek")) {
405      JsonArray array = getJArray(json, "daysOfWeek");
406      for (int i = 0; i < array.size(); i++) {
407        if (array.get(i).isJsonNull()) {
408          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
409        } else {;
410          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
411        }
412      }
413    };
414    if (json.has("_daysOfWeek")) {
415      JsonArray array = getJArray(json, "_daysOfWeek");
416      for (int i = 0; i < array.size(); i++) {
417        if (i == res.getDaysOfWeek().size())
418          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
419        if (array.get(i) instanceof JsonObject) 
420          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
421      }
422    };
423    if (json.has("allDay"))
424      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
425    if (json.has("_allDay"))
426      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
427    if (json.has("availableStartTime"))
428      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
429    if (json.has("_availableStartTime"))
430      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
431    if (json.has("availableEndTime"))
432      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
433    if (json.has("_availableEndTime"))
434      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
435  }
436
437  protected Availability.AvailabilityNotAvailableTimeComponent parseAvailabilityNotAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
438    Availability.AvailabilityNotAvailableTimeComponent res = new Availability.AvailabilityNotAvailableTimeComponent();
439    parseAvailabilityNotAvailableTimeComponentProperties(json, res);
440    return res;
441  }
442
443  protected void parseAvailabilityNotAvailableTimeComponentProperties(JsonObject json, Availability.AvailabilityNotAvailableTimeComponent res) throws IOException, FHIRFormatError {
444    parseElementProperties(json, res);
445    if (json.has("description"))
446      res.setDescriptionElement(parseString(json.get("description").getAsString()));
447    if (json.has("_description"))
448      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
449    if (json.has("during"))
450      res.setDuring(parsePeriod(getJObject(json, "during")));
451  }
452
453  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
454    CodeableConcept res = new CodeableConcept();
455    parseCodeableConceptProperties(json, res);
456    return res;
457  }
458
459  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
460    parseDataTypeProperties(json, res);
461    if (json.has("coding")) {
462      JsonArray array = getJArray(json, "coding");
463      for (int i = 0; i < array.size(); i++) {
464        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
465      }
466    };
467    if (json.has("text"))
468      res.setTextElement(parseString(json.get("text").getAsString()));
469    if (json.has("_text"))
470      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
471  }
472
473  protected CodeableReference parseCodeableReference(JsonObject json) throws IOException, FHIRFormatError {
474    CodeableReference res = new CodeableReference();
475    parseCodeableReferenceProperties(json, res);
476    return res;
477  }
478
479  protected void parseCodeableReferenceProperties(JsonObject json, CodeableReference res) throws IOException, FHIRFormatError {
480    parseDataTypeProperties(json, res);
481    if (json.has("concept"))
482      res.setConcept(parseCodeableConcept(getJObject(json, "concept")));
483    if (json.has("reference"))
484      res.setReference(parseReference(getJObject(json, "reference")));
485  }
486
487  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
488    Coding res = new Coding();
489    parseCodingProperties(json, res);
490    return res;
491  }
492
493  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
494    parseDataTypeProperties(json, res);
495    if (json.has("system"))
496      res.setSystemElement(parseUri(json.get("system").getAsString()));
497    if (json.has("_system"))
498      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
499    if (json.has("version"))
500      res.setVersionElement(parseString(json.get("version").getAsString()));
501    if (json.has("_version"))
502      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
503    if (json.has("code"))
504      res.setCodeElement(parseCode(json.get("code").getAsString()));
505    if (json.has("_code"))
506      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
507    if (json.has("display"))
508      res.setDisplayElement(parseString(json.get("display").getAsString()));
509    if (json.has("_display"))
510      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
511    if (json.has("userSelected"))
512      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
513    if (json.has("_userSelected"))
514      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
515  }
516
517  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
518    ContactDetail res = new ContactDetail();
519    parseContactDetailProperties(json, res);
520    return res;
521  }
522
523  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
524    parseDataTypeProperties(json, res);
525    if (json.has("name"))
526      res.setNameElement(parseString(json.get("name").getAsString()));
527    if (json.has("_name"))
528      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
529    if (json.has("telecom")) {
530      JsonArray array = getJArray(json, "telecom");
531      for (int i = 0; i < array.size(); i++) {
532        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
533      }
534    };
535  }
536
537  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
538    ContactPoint res = new ContactPoint();
539    parseContactPointProperties(json, res);
540    return res;
541  }
542
543  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
544    parseDataTypeProperties(json, res);
545    if (json.has("system"))
546      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
547    if (json.has("_system"))
548      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
549    if (json.has("value"))
550      res.setValueElement(parseString(json.get("value").getAsString()));
551    if (json.has("_value"))
552      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
553    if (json.has("use"))
554      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
555    if (json.has("_use"))
556      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
557    if (json.has("rank"))
558      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
559    if (json.has("_rank"))
560      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
561    if (json.has("period"))
562      res.setPeriod(parsePeriod(getJObject(json, "period")));
563  }
564
565  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
566    Contributor res = new Contributor();
567    parseContributorProperties(json, res);
568    return res;
569  }
570
571  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
572    parseDataTypeProperties(json, res);
573    if (json.has("type"))
574      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
575    if (json.has("_type"))
576      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
577    if (json.has("name"))
578      res.setNameElement(parseString(json.get("name").getAsString()));
579    if (json.has("_name"))
580      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
581    if (json.has("contact")) {
582      JsonArray array = getJArray(json, "contact");
583      for (int i = 0; i < array.size(); i++) {
584        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
585      }
586    };
587  }
588
589  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
590    Count res = new Count();
591    parseCountProperties(json, res);
592    return res;
593  }
594
595  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
596    parseQuantityProperties(json, res);
597  }
598
599  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
600    DataRequirement res = new DataRequirement();
601    parseDataRequirementProperties(json, res);
602    return res;
603  }
604
605  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
606    parseDataTypeProperties(json, res);
607    if (json.has("type"))
608      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
609    if (json.has("_type"))
610      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
611    if (json.has("profile")) {
612      JsonArray array = getJArray(json, "profile");
613      for (int i = 0; i < array.size(); i++) {
614        if (array.get(i).isJsonNull()) {
615          res.getProfile().add(new CanonicalType());
616        } else {;
617          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
618        }
619      }
620    };
621    if (json.has("_profile")) {
622      JsonArray array = getJArray(json, "_profile");
623      for (int i = 0; i < array.size(); i++) {
624        if (i == res.getProfile().size())
625          res.getProfile().add(parseCanonical(null));
626        if (array.get(i) instanceof JsonObject) 
627          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
628      }
629    };
630    DataType subject = parseType("subject", json);
631    if (subject != null)
632      res.setSubject(subject);
633    if (json.has("mustSupport")) {
634      JsonArray array = getJArray(json, "mustSupport");
635      for (int i = 0; i < array.size(); i++) {
636        if (array.get(i).isJsonNull()) {
637          res.getMustSupport().add(new StringType());
638        } else {;
639          res.getMustSupport().add(parseString(array.get(i).getAsString()));
640        }
641      }
642    };
643    if (json.has("_mustSupport")) {
644      JsonArray array = getJArray(json, "_mustSupport");
645      for (int i = 0; i < array.size(); i++) {
646        if (i == res.getMustSupport().size())
647          res.getMustSupport().add(parseString(null));
648        if (array.get(i) instanceof JsonObject) 
649          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
650      }
651    };
652    if (json.has("codeFilter")) {
653      JsonArray array = getJArray(json, "codeFilter");
654      for (int i = 0; i < array.size(); i++) {
655        res.getCodeFilter().add(parseDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject()));
656      }
657    };
658    if (json.has("dateFilter")) {
659      JsonArray array = getJArray(json, "dateFilter");
660      for (int i = 0; i < array.size(); i++) {
661        res.getDateFilter().add(parseDataRequirementDateFilterComponent(array.get(i).getAsJsonObject()));
662      }
663    };
664    if (json.has("valueFilter")) {
665      JsonArray array = getJArray(json, "valueFilter");
666      for (int i = 0; i < array.size(); i++) {
667        res.getValueFilter().add(parseDataRequirementValueFilterComponent(array.get(i).getAsJsonObject()));
668      }
669    };
670    if (json.has("limit"))
671      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
672    if (json.has("_limit"))
673      parseElementProperties(getJObject(json, "_limit"), res.getLimitElement());
674    if (json.has("sort")) {
675      JsonArray array = getJArray(json, "sort");
676      for (int i = 0; i < array.size(); i++) {
677        res.getSort().add(parseDataRequirementSortComponent(array.get(i).getAsJsonObject()));
678      }
679    };
680  }
681
682  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementCodeFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
683    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
684    parseDataRequirementCodeFilterComponentProperties(json, res);
685    return res;
686  }
687
688  protected void parseDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
689    parseElementProperties(json, res);
690    if (json.has("path"))
691      res.setPathElement(parseString(json.get("path").getAsString()));
692    if (json.has("_path"))
693      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
694    if (json.has("searchParam"))
695      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
696    if (json.has("_searchParam"))
697      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
698    if (json.has("valueSet"))
699      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
700    if (json.has("_valueSet"))
701      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
702    if (json.has("code")) {
703      JsonArray array = getJArray(json, "code");
704      for (int i = 0; i < array.size(); i++) {
705        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
706      }
707    };
708  }
709
710  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDateFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
711    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
712    parseDataRequirementDateFilterComponentProperties(json, res);
713    return res;
714  }
715
716  protected void parseDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
717    parseElementProperties(json, res);
718    if (json.has("path"))
719      res.setPathElement(parseString(json.get("path").getAsString()));
720    if (json.has("_path"))
721      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
722    if (json.has("searchParam"))
723      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
724    if (json.has("_searchParam"))
725      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
726    DataType value = parseType("value", json);
727    if (value != null)
728      res.setValue(value);
729  }
730
731  protected DataRequirement.DataRequirementValueFilterComponent parseDataRequirementValueFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
732    DataRequirement.DataRequirementValueFilterComponent res = new DataRequirement.DataRequirementValueFilterComponent();
733    parseDataRequirementValueFilterComponentProperties(json, res);
734    return res;
735  }
736
737  protected void parseDataRequirementValueFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementValueFilterComponent res) throws IOException, FHIRFormatError {
738    parseElementProperties(json, res);
739    if (json.has("path"))
740      res.setPathElement(parseString(json.get("path").getAsString()));
741    if (json.has("_path"))
742      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
743    if (json.has("searchParam"))
744      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
745    if (json.has("_searchParam"))
746      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
747    if (json.has("comparator"))
748      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), DataRequirement.ValueFilterComparator.NULL, new DataRequirement.ValueFilterComparatorEnumFactory()));
749    if (json.has("_comparator"))
750      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
751    DataType value = parseType("value", json);
752    if (value != null)
753      res.setValue(value);
754  }
755
756  protected DataRequirement.DataRequirementSortComponent parseDataRequirementSortComponent(JsonObject json) throws IOException, FHIRFormatError {
757    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
758    parseDataRequirementSortComponentProperties(json, res);
759    return res;
760  }
761
762  protected void parseDataRequirementSortComponentProperties(JsonObject json, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
763    parseElementProperties(json, res);
764    if (json.has("path"))
765      res.setPathElement(parseString(json.get("path").getAsString()));
766    if (json.has("_path"))
767      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
768    if (json.has("direction"))
769      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
770    if (json.has("_direction"))
771      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
772  }
773
774  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
775    Distance res = new Distance();
776    parseDistanceProperties(json, res);
777    return res;
778  }
779
780  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
781    parseQuantityProperties(json, res);
782  }
783
784  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
785    Dosage res = new Dosage();
786    parseDosageProperties(json, res);
787    return res;
788  }
789
790  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
791    parseBackboneTypeProperties(json, res);
792    if (json.has("sequence"))
793      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
794    if (json.has("_sequence"))
795      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
796    if (json.has("text"))
797      res.setTextElement(parseString(json.get("text").getAsString()));
798    if (json.has("_text"))
799      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
800    if (json.has("additionalInstruction")) {
801      JsonArray array = getJArray(json, "additionalInstruction");
802      for (int i = 0; i < array.size(); i++) {
803        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
804      }
805    };
806    if (json.has("patientInstruction"))
807      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
808    if (json.has("_patientInstruction"))
809      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
810    if (json.has("timing"))
811      res.setTiming(parseTiming(getJObject(json, "timing")));
812    if (json.has("asNeeded"))
813      res.setAsNeededElement(parseBoolean(json.get("asNeeded").getAsBoolean()));
814    if (json.has("_asNeeded"))
815      parseElementProperties(getJObject(json, "_asNeeded"), res.getAsNeededElement());
816    if (json.has("asNeededFor")) {
817      JsonArray array = getJArray(json, "asNeededFor");
818      for (int i = 0; i < array.size(); i++) {
819        res.getAsNeededFor().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
820      }
821    };
822    if (json.has("site"))
823      res.setSite(parseCodeableConcept(getJObject(json, "site")));
824    if (json.has("route"))
825      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
826    if (json.has("method"))
827      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
828    if (json.has("doseAndRate")) {
829      JsonArray array = getJArray(json, "doseAndRate");
830      for (int i = 0; i < array.size(); i++) {
831        res.getDoseAndRate().add(parseDosageDoseAndRateComponent(array.get(i).getAsJsonObject()));
832      }
833    };
834    if (json.has("maxDosePerPeriod")) {
835      JsonArray array = getJArray(json, "maxDosePerPeriod");
836      for (int i = 0; i < array.size(); i++) {
837        res.getMaxDosePerPeriod().add(parseRatio(array.get(i).getAsJsonObject()));
838      }
839    };
840    if (json.has("maxDosePerAdministration"))
841      res.setMaxDosePerAdministration(parseQuantity(getJObject(json, "maxDosePerAdministration")));
842    if (json.has("maxDosePerLifetime"))
843      res.setMaxDosePerLifetime(parseQuantity(getJObject(json, "maxDosePerLifetime")));
844  }
845
846  protected Dosage.DosageDoseAndRateComponent parseDosageDoseAndRateComponent(JsonObject json) throws IOException, FHIRFormatError {
847    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
848    parseDosageDoseAndRateComponentProperties(json, res);
849    return res;
850  }
851
852  protected void parseDosageDoseAndRateComponentProperties(JsonObject json, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
853    parseElementProperties(json, res);
854    if (json.has("type"))
855      res.setType(parseCodeableConcept(getJObject(json, "type")));
856    DataType dose = parseType("dose", json);
857    if (dose != null)
858      res.setDose(dose);
859    DataType rate = parseType("rate", json);
860    if (rate != null)
861      res.setRate(rate);
862  }
863
864  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
865    Duration res = new Duration();
866    parseDurationProperties(json, res);
867    return res;
868  }
869
870  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
871    parseQuantityProperties(json, res);
872  }
873
874  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
875    ElementDefinition res = new ElementDefinition();
876    parseElementDefinitionProperties(json, res);
877    return res;
878  }
879
880  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
881    parseBackboneTypeProperties(json, res);
882    if (json.has("path"))
883      res.setPathElement(parseString(json.get("path").getAsString()));
884    if (json.has("_path"))
885      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
886    if (json.has("representation")) {
887      JsonArray array = getJArray(json, "representation");
888      for (int i = 0; i < array.size(); i++) {
889        if (array.get(i).isJsonNull()) {
890          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>(new ElementDefinition.PropertyRepresentationEnumFactory(), ElementDefinition.PropertyRepresentation.NULL));
891        } else {;
892          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
893        }
894      }
895    };
896    if (json.has("_representation")) {
897      JsonArray array = getJArray(json, "_representation");
898      for (int i = 0; i < array.size(); i++) {
899        if (i == res.getRepresentation().size())
900          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
901        if (array.get(i) instanceof JsonObject) 
902          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
903      }
904    };
905    if (json.has("sliceName"))
906      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
907    if (json.has("_sliceName"))
908      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
909    if (json.has("sliceIsConstraining"))
910      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
911    if (json.has("_sliceIsConstraining"))
912      parseElementProperties(getJObject(json, "_sliceIsConstraining"), res.getSliceIsConstrainingElement());
913    if (json.has("label"))
914      res.setLabelElement(parseString(json.get("label").getAsString()));
915    if (json.has("_label"))
916      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
917    if (json.has("code")) {
918      JsonArray array = getJArray(json, "code");
919      for (int i = 0; i < array.size(); i++) {
920        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
921      }
922    };
923    if (json.has("slicing"))
924      res.setSlicing(parseElementDefinitionSlicingComponent(getJObject(json, "slicing")));
925    if (json.has("short"))
926      res.setShortElement(parseString(json.get("short").getAsString()));
927    if (json.has("_short"))
928      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
929    if (json.has("definition"))
930      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
931    if (json.has("_definition"))
932      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
933    if (json.has("comment"))
934      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
935    if (json.has("_comment"))
936      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
937    if (json.has("requirements"))
938      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
939    if (json.has("_requirements"))
940      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
941    if (json.has("alias")) {
942      JsonArray array = getJArray(json, "alias");
943      for (int i = 0; i < array.size(); i++) {
944        if (array.get(i).isJsonNull()) {
945          res.getAlias().add(new StringType());
946        } else {;
947          res.getAlias().add(parseString(array.get(i).getAsString()));
948        }
949      }
950    };
951    if (json.has("_alias")) {
952      JsonArray array = getJArray(json, "_alias");
953      for (int i = 0; i < array.size(); i++) {
954        if (i == res.getAlias().size())
955          res.getAlias().add(parseString(null));
956        if (array.get(i) instanceof JsonObject) 
957          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
958      }
959    };
960    if (json.has("min"))
961      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
962    if (json.has("_min"))
963      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
964    if (json.has("max"))
965      res.setMaxElement(parseString(json.get("max").getAsString()));
966    if (json.has("_max"))
967      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
968    if (json.has("base"))
969      res.setBase(parseElementDefinitionBaseComponent(getJObject(json, "base")));
970    if (json.has("contentReference"))
971      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
972    if (json.has("_contentReference"))
973      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
974    if (json.has("type")) {
975      JsonArray array = getJArray(json, "type");
976      for (int i = 0; i < array.size(); i++) {
977        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject()));
978      }
979    };
980    DataType defaultValue = parseType("defaultValue", json);
981    if (defaultValue != null)
982      res.setDefaultValue(defaultValue);
983    if (json.has("meaningWhenMissing"))
984      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
985    if (json.has("_meaningWhenMissing"))
986      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
987    if (json.has("orderMeaning"))
988      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
989    if (json.has("_orderMeaning"))
990      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
991    DataType fixed = parseType("fixed", json);
992    if (fixed != null)
993      res.setFixed(fixed);
994    DataType pattern = parseType("pattern", json);
995    if (pattern != null)
996      res.setPattern(pattern);
997    if (json.has("example")) {
998      JsonArray array = getJArray(json, "example");
999      for (int i = 0; i < array.size(); i++) {
1000        res.getExample().add(parseElementDefinitionExampleComponent(array.get(i).getAsJsonObject()));
1001      }
1002    };
1003    DataType minValue = parseType("minValue", json);
1004    if (minValue != null)
1005      res.setMinValue(minValue);
1006    DataType maxValue = parseType("maxValue", json);
1007    if (maxValue != null)
1008      res.setMaxValue(maxValue);
1009    if (json.has("maxLength"))
1010      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1011    if (json.has("_maxLength"))
1012      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
1013    if (json.has("condition")) {
1014      JsonArray array = getJArray(json, "condition");
1015      for (int i = 0; i < array.size(); i++) {
1016        if (array.get(i).isJsonNull()) {
1017          res.getCondition().add(new IdType());
1018        } else {;
1019          res.getCondition().add(parseId(array.get(i).getAsString()));
1020        }
1021      }
1022    };
1023    if (json.has("_condition")) {
1024      JsonArray array = getJArray(json, "_condition");
1025      for (int i = 0; i < array.size(); i++) {
1026        if (i == res.getCondition().size())
1027          res.getCondition().add(parseId(null));
1028        if (array.get(i) instanceof JsonObject) 
1029          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1030      }
1031    };
1032    if (json.has("constraint")) {
1033      JsonArray array = getJArray(json, "constraint");
1034      for (int i = 0; i < array.size(); i++) {
1035        res.getConstraint().add(parseElementDefinitionConstraintComponent(array.get(i).getAsJsonObject()));
1036      }
1037    };
1038    if (json.has("mustSupport"))
1039      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1040    if (json.has("_mustSupport"))
1041      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
1042    if (json.has("isModifier"))
1043      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1044    if (json.has("_isModifier"))
1045      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
1046    if (json.has("isModifierReason"))
1047      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1048    if (json.has("_isModifierReason"))
1049      parseElementProperties(getJObject(json, "_isModifierReason"), res.getIsModifierReasonElement());
1050    if (json.has("isSummary"))
1051      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1052    if (json.has("_isSummary"))
1053      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
1054    if (json.has("binding"))
1055      res.setBinding(parseElementDefinitionBindingComponent(getJObject(json, "binding")));
1056    if (json.has("mapping")) {
1057      JsonArray array = getJArray(json, "mapping");
1058      for (int i = 0; i < array.size(); i++) {
1059        res.getMapping().add(parseElementDefinitionMappingComponent(array.get(i).getAsJsonObject()));
1060      }
1061    };
1062  }
1063
1064  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionSlicingComponent(JsonObject json) throws IOException, FHIRFormatError {
1065    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1066    parseElementDefinitionSlicingComponentProperties(json, res);
1067    return res;
1068  }
1069
1070  protected void parseElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1071    parseElementProperties(json, res);
1072    if (json.has("discriminator")) {
1073      JsonArray array = getJArray(json, "discriminator");
1074      for (int i = 0; i < array.size(); i++) {
1075        res.getDiscriminator().add(parseElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject()));
1076      }
1077    };
1078    if (json.has("description"))
1079      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1080    if (json.has("_description"))
1081      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1082    if (json.has("ordered"))
1083      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1084    if (json.has("_ordered"))
1085      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
1086    if (json.has("rules"))
1087      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1088    if (json.has("_rules"))
1089      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
1090  }
1091
1092  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionSlicingDiscriminatorComponent(JsonObject json) throws IOException, FHIRFormatError {
1093    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1094    parseElementDefinitionSlicingDiscriminatorComponentProperties(json, res);
1095    return res;
1096  }
1097
1098  protected void parseElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1099    parseElementProperties(json, res);
1100    if (json.has("type"))
1101      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1102    if (json.has("_type"))
1103      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1104    if (json.has("path"))
1105      res.setPathElement(parseString(json.get("path").getAsString()));
1106    if (json.has("_path"))
1107      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1108  }
1109
1110  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionBaseComponent(JsonObject json) throws IOException, FHIRFormatError {
1111    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1112    parseElementDefinitionBaseComponentProperties(json, res);
1113    return res;
1114  }
1115
1116  protected void parseElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1117    parseElementProperties(json, res);
1118    if (json.has("path"))
1119      res.setPathElement(parseString(json.get("path").getAsString()));
1120    if (json.has("_path"))
1121      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1122    if (json.has("min"))
1123      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1124    if (json.has("_min"))
1125      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1126    if (json.has("max"))
1127      res.setMaxElement(parseString(json.get("max").getAsString()));
1128    if (json.has("_max"))
1129      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1130  }
1131
1132  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json) throws IOException, FHIRFormatError {
1133    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1134    parseElementDefinitionTypeRefComponentProperties(json, res);
1135    return res;
1136  }
1137
1138  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1139    parseElementProperties(json, res);
1140    if (json.has("code"))
1141      res.setCodeElement(parseUri(json.get("code").getAsString()));
1142    if (json.has("_code"))
1143      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1144    if (json.has("profile")) {
1145      JsonArray array = getJArray(json, "profile");
1146      for (int i = 0; i < array.size(); i++) {
1147        if (array.get(i).isJsonNull()) {
1148          res.getProfile().add(new CanonicalType());
1149        } else {;
1150          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1151        }
1152      }
1153    };
1154    if (json.has("_profile")) {
1155      JsonArray array = getJArray(json, "_profile");
1156      for (int i = 0; i < array.size(); i++) {
1157        if (i == res.getProfile().size())
1158          res.getProfile().add(parseCanonical(null));
1159        if (array.get(i) instanceof JsonObject) 
1160          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1161      }
1162    };
1163    if (json.has("targetProfile")) {
1164      JsonArray array = getJArray(json, "targetProfile");
1165      for (int i = 0; i < array.size(); i++) {
1166        if (array.get(i).isJsonNull()) {
1167          res.getTargetProfile().add(new CanonicalType());
1168        } else {;
1169          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1170        }
1171      }
1172    };
1173    if (json.has("_targetProfile")) {
1174      JsonArray array = getJArray(json, "_targetProfile");
1175      for (int i = 0; i < array.size(); i++) {
1176        if (i == res.getTargetProfile().size())
1177          res.getTargetProfile().add(parseCanonical(null));
1178        if (array.get(i) instanceof JsonObject) 
1179          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1180      }
1181    };
1182    if (json.has("aggregation")) {
1183      JsonArray array = getJArray(json, "aggregation");
1184      for (int i = 0; i < array.size(); i++) {
1185        if (array.get(i).isJsonNull()) {
1186          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>(new ElementDefinition.AggregationModeEnumFactory(), ElementDefinition.AggregationMode.NULL));
1187        } else {;
1188          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1189        }
1190      }
1191    };
1192    if (json.has("_aggregation")) {
1193      JsonArray array = getJArray(json, "_aggregation");
1194      for (int i = 0; i < array.size(); i++) {
1195        if (i == res.getAggregation().size())
1196          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1197        if (array.get(i) instanceof JsonObject) 
1198          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1199      }
1200    };
1201    if (json.has("versioning"))
1202      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1203    if (json.has("_versioning"))
1204      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1205  }
1206
1207  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionExampleComponent(JsonObject json) throws IOException, FHIRFormatError {
1208    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1209    parseElementDefinitionExampleComponentProperties(json, res);
1210    return res;
1211  }
1212
1213  protected void parseElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1214    parseElementProperties(json, res);
1215    if (json.has("label"))
1216      res.setLabelElement(parseString(json.get("label").getAsString()));
1217    if (json.has("_label"))
1218      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1219    DataType value = parseType("value", json);
1220    if (value != null)
1221      res.setValue(value);
1222  }
1223
1224  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionConstraintComponent(JsonObject json) throws IOException, FHIRFormatError {
1225    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1226    parseElementDefinitionConstraintComponentProperties(json, res);
1227    return res;
1228  }
1229
1230  protected void parseElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1231    parseElementProperties(json, res);
1232    if (json.has("key"))
1233      res.setKeyElement(parseId(json.get("key").getAsString()));
1234    if (json.has("_key"))
1235      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1236    if (json.has("requirements"))
1237      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1238    if (json.has("_requirements"))
1239      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1240    if (json.has("severity"))
1241      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1242    if (json.has("_severity"))
1243      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1244    if (json.has("suppress"))
1245      res.setSuppressElement(parseBoolean(json.get("suppress").getAsBoolean()));
1246    if (json.has("_suppress"))
1247      parseElementProperties(getJObject(json, "_suppress"), res.getSuppressElement());
1248    if (json.has("human"))
1249      res.setHumanElement(parseString(json.get("human").getAsString()));
1250    if (json.has("_human"))
1251      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1252    if (json.has("expression"))
1253      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1254    if (json.has("_expression"))
1255      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1256    if (json.has("xpath"))
1257      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1258    if (json.has("_xpath"))
1259      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
1260    if (json.has("source"))
1261      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1262    if (json.has("_source"))
1263      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1264  }
1265
1266  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
1267    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1268    parseElementDefinitionBindingComponentProperties(json, res);
1269    return res;
1270  }
1271
1272  protected void parseElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1273    parseElementProperties(json, res);
1274    if (json.has("strength"))
1275      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1276    if (json.has("_strength"))
1277      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1278    if (json.has("description"))
1279      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
1280    if (json.has("_description"))
1281      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1282    if (json.has("valueSet"))
1283      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1284    if (json.has("_valueSet"))
1285      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
1286  }
1287
1288  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
1289    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1290    parseElementDefinitionMappingComponentProperties(json, res);
1291    return res;
1292  }
1293
1294  protected void parseElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1295    parseElementProperties(json, res);
1296    if (json.has("identity"))
1297      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1298    if (json.has("_identity"))
1299      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1300    if (json.has("language"))
1301      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1302    if (json.has("_language"))
1303      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1304    if (json.has("map"))
1305      res.setMapElement(parseString(json.get("map").getAsString()));
1306    if (json.has("_map"))
1307      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1308    if (json.has("comment"))
1309      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1310    if (json.has("_comment"))
1311      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1312  }
1313
1314  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1315    Expression res = new Expression();
1316    parseExpressionProperties(json, res);
1317    return res;
1318  }
1319
1320  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1321    parseDataTypeProperties(json, res);
1322    if (json.has("description"))
1323      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1324    if (json.has("_description"))
1325      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1326    if (json.has("name"))
1327      res.setNameElement(parseId(json.get("name").getAsString()));
1328    if (json.has("_name"))
1329      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1330    if (json.has("language"))
1331      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1332    if (json.has("_language"))
1333      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1334    if (json.has("expression"))
1335      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1336    if (json.has("_expression"))
1337      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1338    if (json.has("reference"))
1339      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1340    if (json.has("_reference"))
1341      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1342  }
1343
1344  protected ExtendedContactDetail parseExtendedContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1345    ExtendedContactDetail res = new ExtendedContactDetail();
1346    parseExtendedContactDetailProperties(json, res);
1347    return res;
1348  }
1349
1350  protected void parseExtendedContactDetailProperties(JsonObject json, ExtendedContactDetail res) throws IOException, FHIRFormatError {
1351    parseDataTypeProperties(json, res);
1352    if (json.has("purpose"))
1353      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
1354    if (json.has("name")) {
1355      JsonArray array = getJArray(json, "name");
1356      for (int i = 0; i < array.size(); i++) {
1357        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
1358      }
1359    };
1360    if (json.has("telecom")) {
1361      JsonArray array = getJArray(json, "telecom");
1362      for (int i = 0; i < array.size(); i++) {
1363        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1364      }
1365    };
1366    if (json.has("address"))
1367      res.setAddress(parseAddress(getJObject(json, "address")));
1368    if (json.has("organization"))
1369      res.setOrganization(parseReference(getJObject(json, "organization")));
1370    if (json.has("period"))
1371      res.setPeriod(parsePeriod(getJObject(json, "period")));
1372  }
1373
1374  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
1375    Extension res = new Extension();
1376    parseExtensionProperties(json, res);
1377    return res;
1378  }
1379
1380  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
1381    parseDataTypeProperties(json, res);
1382    if (json.has("url"))
1383      res.setUrlElement(parseUri(json.get("url").getAsString()));
1384    if (json.has("_url"))
1385      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1386    DataType value = parseType("value", json);
1387    if (value != null)
1388      res.setValue(value);
1389  }
1390
1391  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
1392    HumanName res = new HumanName();
1393    parseHumanNameProperties(json, res);
1394    return res;
1395  }
1396
1397  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
1398    parseDataTypeProperties(json, res);
1399    if (json.has("use"))
1400      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
1401    if (json.has("_use"))
1402      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1403    if (json.has("text"))
1404      res.setTextElement(parseString(json.get("text").getAsString()));
1405    if (json.has("_text"))
1406      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1407    if (json.has("family"))
1408      res.setFamilyElement(parseString(json.get("family").getAsString()));
1409    if (json.has("_family"))
1410      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
1411    if (json.has("given")) {
1412      JsonArray array = getJArray(json, "given");
1413      for (int i = 0; i < array.size(); i++) {
1414        if (array.get(i).isJsonNull()) {
1415          res.getGiven().add(new StringType());
1416        } else {;
1417          res.getGiven().add(parseString(array.get(i).getAsString()));
1418        }
1419      }
1420    };
1421    if (json.has("_given")) {
1422      JsonArray array = getJArray(json, "_given");
1423      for (int i = 0; i < array.size(); i++) {
1424        if (i == res.getGiven().size())
1425          res.getGiven().add(parseString(null));
1426        if (array.get(i) instanceof JsonObject) 
1427          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1428      }
1429    };
1430    if (json.has("prefix")) {
1431      JsonArray array = getJArray(json, "prefix");
1432      for (int i = 0; i < array.size(); i++) {
1433        if (array.get(i).isJsonNull()) {
1434          res.getPrefix().add(new StringType());
1435        } else {;
1436          res.getPrefix().add(parseString(array.get(i).getAsString()));
1437        }
1438      }
1439    };
1440    if (json.has("_prefix")) {
1441      JsonArray array = getJArray(json, "_prefix");
1442      for (int i = 0; i < array.size(); i++) {
1443        if (i == res.getPrefix().size())
1444          res.getPrefix().add(parseString(null));
1445        if (array.get(i) instanceof JsonObject) 
1446          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1447      }
1448    };
1449    if (json.has("suffix")) {
1450      JsonArray array = getJArray(json, "suffix");
1451      for (int i = 0; i < array.size(); i++) {
1452        if (array.get(i).isJsonNull()) {
1453          res.getSuffix().add(new StringType());
1454        } else {;
1455          res.getSuffix().add(parseString(array.get(i).getAsString()));
1456        }
1457      }
1458    };
1459    if (json.has("_suffix")) {
1460      JsonArray array = getJArray(json, "_suffix");
1461      for (int i = 0; i < array.size(); i++) {
1462        if (i == res.getSuffix().size())
1463          res.getSuffix().add(parseString(null));
1464        if (array.get(i) instanceof JsonObject) 
1465          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1466      }
1467    };
1468    if (json.has("period"))
1469      res.setPeriod(parsePeriod(getJObject(json, "period")));
1470  }
1471
1472  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
1473    Identifier res = new Identifier();
1474    parseIdentifierProperties(json, res);
1475    return res;
1476  }
1477
1478  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
1479    parseDataTypeProperties(json, res);
1480    if (json.has("use"))
1481      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
1482    if (json.has("_use"))
1483      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1484    if (json.has("type"))
1485      res.setType(parseCodeableConcept(getJObject(json, "type")));
1486    if (json.has("system"))
1487      res.setSystemElement(parseUri(json.get("system").getAsString()));
1488    if (json.has("_system"))
1489      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1490    if (json.has("value"))
1491      res.setValueElement(parseString(json.get("value").getAsString()));
1492    if (json.has("_value"))
1493      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1494    if (json.has("period"))
1495      res.setPeriod(parsePeriod(getJObject(json, "period")));
1496    if (json.has("assigner"))
1497      res.setAssigner(parseReference(getJObject(json, "assigner")));
1498  }
1499
1500  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
1501    MarketingStatus res = new MarketingStatus();
1502    parseMarketingStatusProperties(json, res);
1503    return res;
1504  }
1505
1506  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
1507    parseBackboneTypeProperties(json, res);
1508    if (json.has("country"))
1509      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
1510    if (json.has("jurisdiction"))
1511      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
1512    if (json.has("status"))
1513      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
1514    if (json.has("dateRange"))
1515      res.setDateRange(parsePeriod(getJObject(json, "dateRange")));
1516    if (json.has("restoreDate"))
1517      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
1518    if (json.has("_restoreDate"))
1519      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
1520  }
1521
1522  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
1523    Meta res = new Meta();
1524    parseMetaProperties(json, res);
1525    return res;
1526  }
1527
1528  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
1529    parseDataTypeProperties(json, res);
1530    if (json.has("versionId"))
1531      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
1532    if (json.has("_versionId"))
1533      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
1534    if (json.has("lastUpdated"))
1535      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
1536    if (json.has("_lastUpdated"))
1537      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
1538    if (json.has("source"))
1539      res.setSourceElement(parseUri(json.get("source").getAsString()));
1540    if (json.has("_source"))
1541      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1542    if (json.has("profile")) {
1543      JsonArray array = getJArray(json, "profile");
1544      for (int i = 0; i < array.size(); i++) {
1545        if (array.get(i).isJsonNull()) {
1546          res.getProfile().add(new CanonicalType());
1547        } else {;
1548          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1549        }
1550      }
1551    };
1552    if (json.has("_profile")) {
1553      JsonArray array = getJArray(json, "_profile");
1554      for (int i = 0; i < array.size(); i++) {
1555        if (i == res.getProfile().size())
1556          res.getProfile().add(parseCanonical(null));
1557        if (array.get(i) instanceof JsonObject) 
1558          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1559      }
1560    };
1561    if (json.has("security")) {
1562      JsonArray array = getJArray(json, "security");
1563      for (int i = 0; i < array.size(); i++) {
1564        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
1565      }
1566    };
1567    if (json.has("tag")) {
1568      JsonArray array = getJArray(json, "tag");
1569      for (int i = 0; i < array.size(); i++) {
1570        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
1571      }
1572    };
1573  }
1574
1575  protected MonetaryComponent parseMonetaryComponent(JsonObject json) throws IOException, FHIRFormatError {
1576    MonetaryComponent res = new MonetaryComponent();
1577    parseMonetaryComponentProperties(json, res);
1578    return res;
1579  }
1580
1581  protected void parseMonetaryComponentProperties(JsonObject json, MonetaryComponent res) throws IOException, FHIRFormatError {
1582    parseDataTypeProperties(json, res);
1583    if (json.has("type"))
1584      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MonetaryComponent.PriceComponentType.NULL, new MonetaryComponent.PriceComponentTypeEnumFactory()));
1585    if (json.has("_type"))
1586      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1587    if (json.has("code"))
1588      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1589    if (json.has("factor"))
1590      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1591    if (json.has("_factor"))
1592      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
1593    if (json.has("amount"))
1594      res.setAmount(parseMoney(getJObject(json, "amount")));
1595  }
1596
1597  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
1598    Money res = new Money();
1599    parseMoneyProperties(json, res);
1600    return res;
1601  }
1602
1603  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
1604    parseDataTypeProperties(json, res);
1605    if (json.has("value"))
1606      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1607    if (json.has("_value"))
1608      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1609    if (json.has("currency"))
1610      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
1611    if (json.has("_currency"))
1612      parseElementProperties(getJObject(json, "_currency"), res.getCurrencyElement());
1613  }
1614
1615  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
1616    Narrative res = new Narrative();
1617    parseNarrativeProperties(json, res);
1618    return res;
1619  }
1620
1621  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
1622    parseDataTypeProperties(json, res);
1623    if (json.has("status"))
1624      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
1625    if (json.has("_status"))
1626      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1627    if (json.has("div"))
1628      res.setDiv(parseXhtml(json.get("div").getAsString()));
1629  }
1630
1631  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1632    ParameterDefinition res = new ParameterDefinition();
1633    parseParameterDefinitionProperties(json, res);
1634    return res;
1635  }
1636
1637  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1638    parseDataTypeProperties(json, res);
1639    if (json.has("name"))
1640      res.setNameElement(parseCode(json.get("name").getAsString()));
1641    if (json.has("_name"))
1642      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1643    if (json.has("use"))
1644      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
1645    if (json.has("_use"))
1646      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1647    if (json.has("min"))
1648      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1649    if (json.has("_min"))
1650      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1651    if (json.has("max"))
1652      res.setMaxElement(parseString(json.get("max").getAsString()));
1653    if (json.has("_max"))
1654      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1655    if (json.has("documentation"))
1656      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1657    if (json.has("_documentation"))
1658      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1659    if (json.has("type"))
1660      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
1661    if (json.has("_type"))
1662      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1663    if (json.has("profile"))
1664      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1665    if (json.has("_profile"))
1666      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1667  }
1668
1669  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1670    Period res = new Period();
1671    parsePeriodProperties(json, res);
1672    return res;
1673  }
1674
1675  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1676    parseDataTypeProperties(json, res);
1677    if (json.has("start"))
1678      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1679    if (json.has("_start"))
1680      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
1681    if (json.has("end"))
1682      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1683    if (json.has("_end"))
1684      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
1685  }
1686
1687  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
1688    Population res = new Population();
1689    parsePopulationProperties(json, res);
1690    return res;
1691  }
1692
1693  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
1694    parseBackboneTypeProperties(json, res);
1695    DataType age = parseType("age", json);
1696    if (age != null)
1697      res.setAge(age);
1698    if (json.has("gender"))
1699      res.setGender(parseCodeableConcept(getJObject(json, "gender")));
1700    if (json.has("race"))
1701      res.setRace(parseCodeableConcept(getJObject(json, "race")));
1702    if (json.has("physiologicalCondition"))
1703      res.setPhysiologicalCondition(parseCodeableConcept(getJObject(json, "physiologicalCondition")));
1704  }
1705
1706  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1707    ProductShelfLife res = new ProductShelfLife();
1708    parseProductShelfLifeProperties(json, res);
1709    return res;
1710  }
1711
1712  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1713    parseBackboneTypeProperties(json, res);
1714    if (json.has("type"))
1715      res.setType(parseCodeableConcept(getJObject(json, "type")));
1716    DataType period = parseType("period", json);
1717    if (period != null)
1718      res.setPeriod(period);
1719    if (json.has("specialPrecautionsForStorage")) {
1720      JsonArray array = getJArray(json, "specialPrecautionsForStorage");
1721      for (int i = 0; i < array.size(); i++) {
1722        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1723      }
1724    };
1725  }
1726
1727  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1728    Quantity res = new Quantity();
1729    parseQuantityProperties(json, res);
1730    return res;
1731  }
1732
1733  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1734    parseDataTypeProperties(json, res);
1735    if (json.has("value"))
1736      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1737    if (json.has("_value"))
1738      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1739    if (json.has("comparator"))
1740      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Enumerations.QuantityComparator.NULL, new Enumerations.QuantityComparatorEnumFactory()));
1741    if (json.has("_comparator"))
1742      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
1743    if (json.has("unit"))
1744      res.setUnitElement(parseString(json.get("unit").getAsString()));
1745    if (json.has("_unit"))
1746      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
1747    if (json.has("system"))
1748      res.setSystemElement(parseUri(json.get("system").getAsString()));
1749    if (json.has("_system"))
1750      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1751    if (json.has("code"))
1752      res.setCodeElement(parseCode(json.get("code").getAsString()));
1753    if (json.has("_code"))
1754      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1755  }
1756
1757  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1758    Range res = new Range();
1759    parseRangeProperties(json, res);
1760    return res;
1761  }
1762
1763  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1764    parseDataTypeProperties(json, res);
1765    if (json.has("low"))
1766      res.setLow(parseQuantity(getJObject(json, "low")));
1767    if (json.has("high"))
1768      res.setHigh(parseQuantity(getJObject(json, "high")));
1769  }
1770
1771  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
1772    Ratio res = new Ratio();
1773    parseRatioProperties(json, res);
1774    return res;
1775  }
1776
1777  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
1778    parseDataTypeProperties(json, res);
1779    if (json.has("numerator"))
1780      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
1781    if (json.has("denominator"))
1782      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1783  }
1784
1785  protected RatioRange parseRatioRange(JsonObject json) throws IOException, FHIRFormatError {
1786    RatioRange res = new RatioRange();
1787    parseRatioRangeProperties(json, res);
1788    return res;
1789  }
1790
1791  protected void parseRatioRangeProperties(JsonObject json, RatioRange res) throws IOException, FHIRFormatError {
1792    parseDataTypeProperties(json, res);
1793    if (json.has("lowNumerator"))
1794      res.setLowNumerator(parseQuantity(getJObject(json, "lowNumerator")));
1795    if (json.has("highNumerator"))
1796      res.setHighNumerator(parseQuantity(getJObject(json, "highNumerator")));
1797    if (json.has("denominator"))
1798      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1799  }
1800
1801  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
1802    Reference res = new Reference();
1803    parseReferenceProperties(json, res);
1804    return res;
1805  }
1806
1807  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
1808    parseDataTypeProperties(json, res);
1809    if (json.has("reference"))
1810      res.setReferenceElement(parseString(json.get("reference").getAsString()));
1811    if (json.has("_reference"))
1812      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1813    if (json.has("type"))
1814      res.setTypeElement(parseUri(json.get("type").getAsString()));
1815    if (json.has("_type"))
1816      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1817    if (json.has("identifier"))
1818      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1819    if (json.has("display"))
1820      res.setDisplayElement(parseString(json.get("display").getAsString()));
1821    if (json.has("_display"))
1822      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1823  }
1824
1825  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1826    RelatedArtifact res = new RelatedArtifact();
1827    parseRelatedArtifactProperties(json, res);
1828    return res;
1829  }
1830
1831  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1832    parseDataTypeProperties(json, res);
1833    if (json.has("type"))
1834      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1835    if (json.has("_type"))
1836      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1837    if (json.has("classifier")) {
1838      JsonArray array = getJArray(json, "classifier");
1839      for (int i = 0; i < array.size(); i++) {
1840        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1841      }
1842    };
1843    if (json.has("label"))
1844      res.setLabelElement(parseString(json.get("label").getAsString()));
1845    if (json.has("_label"))
1846      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1847    if (json.has("display"))
1848      res.setDisplayElement(parseString(json.get("display").getAsString()));
1849    if (json.has("_display"))
1850      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1851    if (json.has("citation"))
1852      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1853    if (json.has("_citation"))
1854      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
1855    if (json.has("document"))
1856      res.setDocument(parseAttachment(getJObject(json, "document")));
1857    if (json.has("resource"))
1858      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1859    if (json.has("_resource"))
1860      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
1861    if (json.has("resourceReference"))
1862      res.setResourceReference(parseReference(getJObject(json, "resourceReference")));
1863    if (json.has("publicationStatus"))
1864      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
1865    if (json.has("_publicationStatus"))
1866      parseElementProperties(getJObject(json, "_publicationStatus"), res.getPublicationStatusElement());
1867    if (json.has("publicationDate"))
1868      res.setPublicationDateElement(parseDate(json.get("publicationDate").getAsString()));
1869    if (json.has("_publicationDate"))
1870      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
1871  }
1872
1873  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
1874    SampledData res = new SampledData();
1875    parseSampledDataProperties(json, res);
1876    return res;
1877  }
1878
1879  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
1880    parseDataTypeProperties(json, res);
1881    if (json.has("origin"))
1882      res.setOrigin(parseQuantity(getJObject(json, "origin")));
1883    if (json.has("interval"))
1884      res.setIntervalElement(parseDecimal(json.get("interval").getAsBigDecimal()));
1885    if (json.has("_interval"))
1886      parseElementProperties(getJObject(json, "_interval"), res.getIntervalElement());
1887    if (json.has("intervalUnit"))
1888      res.setIntervalUnitElement(parseCode(json.get("intervalUnit").getAsString()));
1889    if (json.has("_intervalUnit"))
1890      parseElementProperties(getJObject(json, "_intervalUnit"), res.getIntervalUnitElement());
1891    if (json.has("factor"))
1892      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1893    if (json.has("_factor"))
1894      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
1895    if (json.has("lowerLimit"))
1896      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
1897    if (json.has("_lowerLimit"))
1898      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
1899    if (json.has("upperLimit"))
1900      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
1901    if (json.has("_upperLimit"))
1902      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
1903    if (json.has("dimensions"))
1904      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
1905    if (json.has("_dimensions"))
1906      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
1907    if (json.has("data"))
1908      res.setDataElement(parseString(json.get("data").getAsString()));
1909    if (json.has("_data"))
1910      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1911  }
1912
1913  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1914    Signature res = new Signature();
1915    parseSignatureProperties(json, res);
1916    return res;
1917  }
1918
1919  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1920    parseDataTypeProperties(json, res);
1921    if (json.has("type")) {
1922      JsonArray array = getJArray(json, "type");
1923      for (int i = 0; i < array.size(); i++) {
1924        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1925      }
1926    };
1927    if (json.has("when"))
1928      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1929    if (json.has("_when"))
1930      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
1931    if (json.has("who"))
1932      res.setWho(parseReference(getJObject(json, "who")));
1933    if (json.has("onBehalfOf"))
1934      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
1935    if (json.has("targetFormat"))
1936      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1937    if (json.has("_targetFormat"))
1938      parseElementProperties(getJObject(json, "_targetFormat"), res.getTargetFormatElement());
1939    if (json.has("sigFormat"))
1940      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1941    if (json.has("_sigFormat"))
1942      parseElementProperties(getJObject(json, "_sigFormat"), res.getSigFormatElement());
1943    if (json.has("data"))
1944      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1945    if (json.has("_data"))
1946      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1947  }
1948
1949  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1950    Timing res = new Timing();
1951    parseTimingProperties(json, res);
1952    return res;
1953  }
1954
1955  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1956    parseBackboneTypeProperties(json, res);
1957    if (json.has("event")) {
1958      JsonArray array = getJArray(json, "event");
1959      for (int i = 0; i < array.size(); i++) {
1960        if (array.get(i).isJsonNull()) {
1961          res.getEvent().add(new DateTimeType());
1962        } else {;
1963          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1964        }
1965      }
1966    };
1967    if (json.has("_event")) {
1968      JsonArray array = getJArray(json, "_event");
1969      for (int i = 0; i < array.size(); i++) {
1970        if (i == res.getEvent().size())
1971          res.getEvent().add(parseDateTime(null));
1972        if (array.get(i) instanceof JsonObject) 
1973          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1974      }
1975    };
1976    if (json.has("repeat"))
1977      res.setRepeat(parseTimingRepeatComponent(getJObject(json, "repeat")));
1978    if (json.has("code"))
1979      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1980  }
1981
1982  protected Timing.TimingRepeatComponent parseTimingRepeatComponent(JsonObject json) throws IOException, FHIRFormatError {
1983    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1984    parseTimingRepeatComponentProperties(json, res);
1985    return res;
1986  }
1987
1988  protected void parseTimingRepeatComponentProperties(JsonObject json, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1989    parseElementProperties(json, res);
1990    DataType bounds = parseType("bounds", json);
1991    if (bounds != null)
1992      res.setBounds(bounds);
1993    if (json.has("count"))
1994      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1995    if (json.has("_count"))
1996      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1997    if (json.has("countMax"))
1998      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1999    if (json.has("_countMax"))
2000      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
2001    if (json.has("duration"))
2002      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
2003    if (json.has("_duration"))
2004      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
2005    if (json.has("durationMax"))
2006      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
2007    if (json.has("_durationMax"))
2008      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
2009    if (json.has("durationUnit"))
2010      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2011    if (json.has("_durationUnit"))
2012      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
2013    if (json.has("frequency"))
2014      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
2015    if (json.has("_frequency"))
2016      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
2017    if (json.has("frequencyMax"))
2018      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
2019    if (json.has("_frequencyMax"))
2020      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
2021    if (json.has("period"))
2022      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
2023    if (json.has("_period"))
2024      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
2025    if (json.has("periodMax"))
2026      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
2027    if (json.has("_periodMax"))
2028      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
2029    if (json.has("periodUnit"))
2030      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2031    if (json.has("_periodUnit"))
2032      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
2033    if (json.has("dayOfWeek")) {
2034      JsonArray array = getJArray(json, "dayOfWeek");
2035      for (int i = 0; i < array.size(); i++) {
2036        if (array.get(i).isJsonNull()) {
2037          res.getDayOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
2038        } else {;
2039          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
2040        }
2041      }
2042    };
2043    if (json.has("_dayOfWeek")) {
2044      JsonArray array = getJArray(json, "_dayOfWeek");
2045      for (int i = 0; i < array.size(); i++) {
2046        if (i == res.getDayOfWeek().size())
2047          res.getDayOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
2048        if (array.get(i) instanceof JsonObject) 
2049          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
2050      }
2051    };
2052    if (json.has("timeOfDay")) {
2053      JsonArray array = getJArray(json, "timeOfDay");
2054      for (int i = 0; i < array.size(); i++) {
2055        if (array.get(i).isJsonNull()) {
2056          res.getTimeOfDay().add(new TimeType());
2057        } else {;
2058          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
2059        }
2060      }
2061    };
2062    if (json.has("_timeOfDay")) {
2063      JsonArray array = getJArray(json, "_timeOfDay");
2064      for (int i = 0; i < array.size(); i++) {
2065        if (i == res.getTimeOfDay().size())
2066          res.getTimeOfDay().add(parseTime(null));
2067        if (array.get(i) instanceof JsonObject) 
2068          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
2069      }
2070    };
2071    if (json.has("when")) {
2072      JsonArray array = getJArray(json, "when");
2073      for (int i = 0; i < array.size(); i++) {
2074        if (array.get(i).isJsonNull()) {
2075          res.getWhen().add(new Enumeration<Timing.EventTiming>(new Timing.EventTimingEnumFactory(), Timing.EventTiming.NULL));
2076        } else {;
2077          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
2078        }
2079      }
2080    };
2081    if (json.has("_when")) {
2082      JsonArray array = getJArray(json, "_when");
2083      for (int i = 0; i < array.size(); i++) {
2084        if (i == res.getWhen().size())
2085          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
2086        if (array.get(i) instanceof JsonObject) 
2087          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
2088      }
2089    };
2090    if (json.has("offset"))
2091      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
2092    if (json.has("_offset"))
2093      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
2094  }
2095
2096  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
2097    TriggerDefinition res = new TriggerDefinition();
2098    parseTriggerDefinitionProperties(json, res);
2099    return res;
2100  }
2101
2102  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
2103    parseDataTypeProperties(json, res);
2104    if (json.has("type"))
2105      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
2106    if (json.has("_type"))
2107      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2108    if (json.has("name"))
2109      res.setNameElement(parseString(json.get("name").getAsString()));
2110    if (json.has("_name"))
2111      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2112    if (json.has("code"))
2113      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2114    if (json.has("subscriptionTopic"))
2115      res.setSubscriptionTopicElement(parseCanonical(json.get("subscriptionTopic").getAsString()));
2116    if (json.has("_subscriptionTopic"))
2117      parseElementProperties(getJObject(json, "_subscriptionTopic"), res.getSubscriptionTopicElement());
2118    DataType timing = parseType("timing", json);
2119    if (timing != null)
2120      res.setTiming(timing);
2121    if (json.has("data")) {
2122      JsonArray array = getJArray(json, "data");
2123      for (int i = 0; i < array.size(); i++) {
2124        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
2125      }
2126    };
2127    if (json.has("condition"))
2128      res.setCondition(parseExpression(getJObject(json, "condition")));
2129  }
2130
2131  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
2132    UsageContext res = new UsageContext();
2133    parseUsageContextProperties(json, res);
2134    return res;
2135  }
2136
2137  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
2138    parseDataTypeProperties(json, res);
2139    if (json.has("code"))
2140      res.setCode(parseCoding(getJObject(json, "code")));
2141    DataType value = parseType("value", json);
2142    if (value != null)
2143      res.setValue(value);
2144  }
2145
2146  protected VirtualServiceDetail parseVirtualServiceDetail(JsonObject json) throws IOException, FHIRFormatError {
2147    VirtualServiceDetail res = new VirtualServiceDetail();
2148    parseVirtualServiceDetailProperties(json, res);
2149    return res;
2150  }
2151
2152  protected void parseVirtualServiceDetailProperties(JsonObject json, VirtualServiceDetail res) throws IOException, FHIRFormatError {
2153    parseDataTypeProperties(json, res);
2154    if (json.has("channelType"))
2155      res.setChannelType(parseCoding(getJObject(json, "channelType")));
2156    DataType address = parseType("address", json);
2157    if (address != null)
2158      res.setAddress(address);
2159    if (json.has("additionalInfo")) {
2160      JsonArray array = getJArray(json, "additionalInfo");
2161      for (int i = 0; i < array.size(); i++) {
2162        if (array.get(i).isJsonNull()) {
2163          res.getAdditionalInfo().add(new UrlType());
2164        } else {;
2165          res.getAdditionalInfo().add(parseUrl(array.get(i).getAsString()));
2166        }
2167      }
2168    };
2169    if (json.has("_additionalInfo")) {
2170      JsonArray array = getJArray(json, "_additionalInfo");
2171      for (int i = 0; i < array.size(); i++) {
2172        if (i == res.getAdditionalInfo().size())
2173          res.getAdditionalInfo().add(parseUrl(null));
2174        if (array.get(i) instanceof JsonObject) 
2175          parseElementProperties(array.get(i).getAsJsonObject(), res.getAdditionalInfo().get(i));
2176      }
2177    };
2178    if (json.has("maxParticipants"))
2179      res.setMaxParticipantsElement(parsePositiveInt(json.get("maxParticipants").getAsString()));
2180    if (json.has("_maxParticipants"))
2181      parseElementProperties(getJObject(json, "_maxParticipants"), res.getMaxParticipantsElement());
2182    if (json.has("sessionKey"))
2183      res.setSessionKeyElement(parseString(json.get("sessionKey").getAsString()));
2184    if (json.has("_sessionKey"))
2185      parseElementProperties(getJObject(json, "_sessionKey"), res.getSessionKeyElement());
2186  }
2187
2188  protected void parseCanonicalResourceProperties(JsonObject json, CanonicalResource res) throws IOException, FHIRFormatError {
2189    parseDomainResourceProperties(json, res);
2190  }
2191
2192  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
2193    parseResourceProperties(json, res);
2194    if (json.has("text"))
2195      res.setText(parseNarrative(getJObject(json, "text")));
2196    if (json.has("contained")) {
2197      JsonArray array = getJArray(json, "contained");
2198      for (int i = 0; i < array.size(); i++) {
2199        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
2200      }
2201    };
2202    if (json.has("extension")) {
2203      JsonArray array = getJArray(json, "extension");
2204      for (int i = 0; i < array.size(); i++) {
2205        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2206      }
2207    };
2208    if (json.has("modifierExtension")) {
2209      JsonArray array = getJArray(json, "modifierExtension");
2210      for (int i = 0; i < array.size(); i++) {
2211        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2212      }
2213    };
2214  }
2215
2216  protected void parseMetadataResourceProperties(JsonObject json, MetadataResource res) throws IOException, FHIRFormatError {
2217    parseCanonicalResourceProperties(json, res);
2218  }
2219
2220  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
2221    parseBaseProperties(json, res);
2222    if (json.has("id"))
2223      res.setIdElement(parseId(json.get("id").getAsString()));
2224    if (json.has("_id"))
2225      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
2226    if (json.has("meta"))
2227      res.setMeta(parseMeta(getJObject(json, "meta")));
2228    if (json.has("implicitRules"))
2229      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2230    if (json.has("_implicitRules"))
2231      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
2232    if (json.has("language"))
2233      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2234    if (json.has("_language"))
2235      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2236  }
2237
2238  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2239    Account res = new Account();
2240    parseAccountProperties(json, res);
2241    return res;
2242  }
2243
2244  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2245    parseDomainResourceProperties(json, res);
2246    if (json.has("identifier")) {
2247      JsonArray array = getJArray(json, "identifier");
2248      for (int i = 0; i < array.size(); i++) {
2249        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2250      }
2251    };
2252    if (json.has("status"))
2253      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2254    if (json.has("_status"))
2255      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2256    if (json.has("billingStatus"))
2257      res.setBillingStatus(parseCodeableConcept(getJObject(json, "billingStatus")));
2258    if (json.has("type"))
2259      res.setType(parseCodeableConcept(getJObject(json, "type")));
2260    if (json.has("name"))
2261      res.setNameElement(parseString(json.get("name").getAsString()));
2262    if (json.has("_name"))
2263      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2264    if (json.has("subject")) {
2265      JsonArray array = getJArray(json, "subject");
2266      for (int i = 0; i < array.size(); i++) {
2267        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2268      }
2269    };
2270    if (json.has("servicePeriod"))
2271      res.setServicePeriod(parsePeriod(getJObject(json, "servicePeriod")));
2272    if (json.has("coverage")) {
2273      JsonArray array = getJArray(json, "coverage");
2274      for (int i = 0; i < array.size(); i++) {
2275        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject()));
2276      }
2277    };
2278    if (json.has("owner"))
2279      res.setOwner(parseReference(getJObject(json, "owner")));
2280    if (json.has("description"))
2281      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2282    if (json.has("_description"))
2283      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2284    if (json.has("guarantor")) {
2285      JsonArray array = getJArray(json, "guarantor");
2286      for (int i = 0; i < array.size(); i++) {
2287        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject()));
2288      }
2289    };
2290    if (json.has("relatedAccount")) {
2291      JsonArray array = getJArray(json, "relatedAccount");
2292      for (int i = 0; i < array.size(); i++) {
2293        res.getRelatedAccount().add(parseAccountRelatedAccountComponent(array.get(i).getAsJsonObject()));
2294      }
2295    };
2296    if (json.has("currency"))
2297      res.setCurrency(parseCodeableConcept(getJObject(json, "currency")));
2298    if (json.has("balance")) {
2299      JsonArray array = getJArray(json, "balance");
2300      for (int i = 0; i < array.size(); i++) {
2301        res.getBalance().add(parseAccountBalanceComponent(array.get(i).getAsJsonObject()));
2302      }
2303    };
2304    if (json.has("calculatedAt"))
2305      res.setCalculatedAtElement(parseInstant(json.get("calculatedAt").getAsString()));
2306    if (json.has("_calculatedAt"))
2307      parseElementProperties(getJObject(json, "_calculatedAt"), res.getCalculatedAtElement());
2308  }
2309
2310  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
2311    Account.CoverageComponent res = new Account.CoverageComponent();
2312    parseAccountCoverageComponentProperties(json, res);
2313    return res;
2314  }
2315
2316  protected void parseAccountCoverageComponentProperties(JsonObject json, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2317    parseBackboneElementProperties(json, res);
2318    if (json.has("coverage"))
2319      res.setCoverage(parseReference(getJObject(json, "coverage")));
2320    if (json.has("priority"))
2321      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2322    if (json.has("_priority"))
2323      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2324  }
2325
2326  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json) throws IOException, FHIRFormatError {
2327    Account.GuarantorComponent res = new Account.GuarantorComponent();
2328    parseAccountGuarantorComponentProperties(json, res);
2329    return res;
2330  }
2331
2332  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2333    parseBackboneElementProperties(json, res);
2334    if (json.has("party"))
2335      res.setParty(parseReference(getJObject(json, "party")));
2336    if (json.has("onHold"))
2337      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2338    if (json.has("_onHold"))
2339      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
2340    if (json.has("period"))
2341      res.setPeriod(parsePeriod(getJObject(json, "period")));
2342  }
2343
2344  protected Account.AccountRelatedAccountComponent parseAccountRelatedAccountComponent(JsonObject json) throws IOException, FHIRFormatError {
2345    Account.AccountRelatedAccountComponent res = new Account.AccountRelatedAccountComponent();
2346    parseAccountRelatedAccountComponentProperties(json, res);
2347    return res;
2348  }
2349
2350  protected void parseAccountRelatedAccountComponentProperties(JsonObject json, Account.AccountRelatedAccountComponent res) throws IOException, FHIRFormatError {
2351    parseBackboneElementProperties(json, res);
2352    if (json.has("relationship"))
2353      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
2354    if (json.has("account"))
2355      res.setAccount(parseReference(getJObject(json, "account")));
2356  }
2357
2358  protected Account.AccountBalanceComponent parseAccountBalanceComponent(JsonObject json) throws IOException, FHIRFormatError {
2359    Account.AccountBalanceComponent res = new Account.AccountBalanceComponent();
2360    parseAccountBalanceComponentProperties(json, res);
2361    return res;
2362  }
2363
2364  protected void parseAccountBalanceComponentProperties(JsonObject json, Account.AccountBalanceComponent res) throws IOException, FHIRFormatError {
2365    parseBackboneElementProperties(json, res);
2366    if (json.has("aggregate"))
2367      res.setAggregate(parseCodeableConcept(getJObject(json, "aggregate")));
2368    if (json.has("term"))
2369      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
2370    if (json.has("estimate"))
2371      res.setEstimateElement(parseBoolean(json.get("estimate").getAsBoolean()));
2372    if (json.has("_estimate"))
2373      parseElementProperties(getJObject(json, "_estimate"), res.getEstimateElement());
2374    if (json.has("amount"))
2375      res.setAmount(parseMoney(getJObject(json, "amount")));
2376  }
2377
2378  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2379    ActivityDefinition res = new ActivityDefinition();
2380    parseActivityDefinitionProperties(json, res);
2381    return res;
2382  }
2383
2384  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2385    parseMetadataResourceProperties(json, res);
2386    if (json.has("url"))
2387      res.setUrlElement(parseUri(json.get("url").getAsString()));
2388    if (json.has("_url"))
2389      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2390    if (json.has("identifier")) {
2391      JsonArray array = getJArray(json, "identifier");
2392      for (int i = 0; i < array.size(); i++) {
2393        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2394      }
2395    };
2396    if (json.has("version"))
2397      res.setVersionElement(parseString(json.get("version").getAsString()));
2398    if (json.has("_version"))
2399      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2400    if (json.has("name"))
2401      res.setNameElement(parseString(json.get("name").getAsString()));
2402    if (json.has("_name"))
2403      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2404    if (json.has("title"))
2405      res.setTitleElement(parseString(json.get("title").getAsString()));
2406    if (json.has("_title"))
2407      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2408    if (json.has("subtitle"))
2409      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2410    if (json.has("_subtitle"))
2411      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
2412    if (json.has("status"))
2413      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2414    if (json.has("_status"))
2415      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2416    if (json.has("experimental"))
2417      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2418    if (json.has("_experimental"))
2419      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2420    DataType subject = parseType("subject", json);
2421    if (subject != null)
2422      res.setSubject(subject);
2423    if (json.has("date"))
2424      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2425    if (json.has("_date"))
2426      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2427    if (json.has("publisher"))
2428      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2429    if (json.has("_publisher"))
2430      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2431    if (json.has("contact")) {
2432      JsonArray array = getJArray(json, "contact");
2433      for (int i = 0; i < array.size(); i++) {
2434        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2435      }
2436    };
2437    if (json.has("description"))
2438      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2439    if (json.has("_description"))
2440      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2441    if (json.has("useContext")) {
2442      JsonArray array = getJArray(json, "useContext");
2443      for (int i = 0; i < array.size(); i++) {
2444        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2445      }
2446    };
2447    if (json.has("jurisdiction")) {
2448      JsonArray array = getJArray(json, "jurisdiction");
2449      for (int i = 0; i < array.size(); i++) {
2450        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2451      }
2452    };
2453    if (json.has("purpose"))
2454      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2455    if (json.has("_purpose"))
2456      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2457    if (json.has("usage"))
2458      res.setUsageElement(parseString(json.get("usage").getAsString()));
2459    if (json.has("_usage"))
2460      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
2461    if (json.has("copyright"))
2462      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2463    if (json.has("_copyright"))
2464      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2465    if (json.has("approvalDate"))
2466      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2467    if (json.has("_approvalDate"))
2468      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
2469    if (json.has("lastReviewDate"))
2470      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2471    if (json.has("_lastReviewDate"))
2472      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
2473    if (json.has("effectivePeriod"))
2474      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
2475    if (json.has("topic")) {
2476      JsonArray array = getJArray(json, "topic");
2477      for (int i = 0; i < array.size(); i++) {
2478        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2479      }
2480    };
2481    if (json.has("author")) {
2482      JsonArray array = getJArray(json, "author");
2483      for (int i = 0; i < array.size(); i++) {
2484        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2485      }
2486    };
2487    if (json.has("editor")) {
2488      JsonArray array = getJArray(json, "editor");
2489      for (int i = 0; i < array.size(); i++) {
2490        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2491      }
2492    };
2493    if (json.has("reviewer")) {
2494      JsonArray array = getJArray(json, "reviewer");
2495      for (int i = 0; i < array.size(); i++) {
2496        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2497      }
2498    };
2499    if (json.has("endorser")) {
2500      JsonArray array = getJArray(json, "endorser");
2501      for (int i = 0; i < array.size(); i++) {
2502        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2503      }
2504    };
2505    if (json.has("relatedArtifact")) {
2506      JsonArray array = getJArray(json, "relatedArtifact");
2507      for (int i = 0; i < array.size(); i++) {
2508        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2509      }
2510    };
2511    if (json.has("library")) {
2512      JsonArray array = getJArray(json, "library");
2513      for (int i = 0; i < array.size(); i++) {
2514        if (array.get(i).isJsonNull()) {
2515          res.getLibrary().add(new CanonicalType());
2516        } else {;
2517          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2518        }
2519      }
2520    };
2521    if (json.has("_library")) {
2522      JsonArray array = getJArray(json, "_library");
2523      for (int i = 0; i < array.size(); i++) {
2524        if (i == res.getLibrary().size())
2525          res.getLibrary().add(parseCanonical(null));
2526        if (array.get(i) instanceof JsonObject) 
2527          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2528      }
2529    };
2530    if (json.has("kind"))
2531      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.RequestResourceTypes.NULL, new ActivityDefinition.RequestResourceTypesEnumFactory()));
2532    if (json.has("_kind"))
2533      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2534    if (json.has("profile"))
2535      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2536    if (json.has("_profile"))
2537      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
2538    if (json.has("code"))
2539      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2540    if (json.has("intent"))
2541      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
2542    if (json.has("_intent"))
2543      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
2544    if (json.has("priority"))
2545      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
2546    if (json.has("_priority"))
2547      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2548    if (json.has("doNotPerform"))
2549      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2550    if (json.has("_doNotPerform"))
2551      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
2552    DataType timing = parseType("timing", json);
2553    if (timing != null)
2554      res.setTiming(timing);
2555    DataType asNeeded = parseType("asNeeded", json);
2556    if (asNeeded != null)
2557      res.setAsNeeded(asNeeded);
2558    if (json.has("location"))
2559      res.setLocation(parseCodeableReference(getJObject(json, "location")));
2560    if (json.has("participant")) {
2561      JsonArray array = getJArray(json, "participant");
2562      for (int i = 0; i < array.size(); i++) {
2563        res.getParticipant().add(parseActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject()));
2564      }
2565    };
2566    DataType product = parseType("product", json);
2567    if (product != null)
2568      res.setProduct(product);
2569    if (json.has("quantity"))
2570      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
2571    if (json.has("dosage")) {
2572      JsonArray array = getJArray(json, "dosage");
2573      for (int i = 0; i < array.size(); i++) {
2574        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2575      }
2576    };
2577    if (json.has("bodySite")) {
2578      JsonArray array = getJArray(json, "bodySite");
2579      for (int i = 0; i < array.size(); i++) {
2580        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2581      }
2582    };
2583    if (json.has("specimenRequirement")) {
2584      JsonArray array = getJArray(json, "specimenRequirement");
2585      for (int i = 0; i < array.size(); i++) {
2586        if (array.get(i).isJsonNull()) {
2587          res.getSpecimenRequirement().add(new CanonicalType());
2588        } else {;
2589          res.getSpecimenRequirement().add(parseCanonical(array.get(i).getAsString()));
2590        }
2591      }
2592    };
2593    if (json.has("_specimenRequirement")) {
2594      JsonArray array = getJArray(json, "_specimenRequirement");
2595      for (int i = 0; i < array.size(); i++) {
2596        if (i == res.getSpecimenRequirement().size())
2597          res.getSpecimenRequirement().add(parseCanonical(null));
2598        if (array.get(i) instanceof JsonObject) 
2599          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecimenRequirement().get(i));
2600      }
2601    };
2602    if (json.has("observationRequirement")) {
2603      JsonArray array = getJArray(json, "observationRequirement");
2604      for (int i = 0; i < array.size(); i++) {
2605        if (array.get(i).isJsonNull()) {
2606          res.getObservationRequirement().add(new CanonicalType());
2607        } else {;
2608          res.getObservationRequirement().add(parseCanonical(array.get(i).getAsString()));
2609        }
2610      }
2611    };
2612    if (json.has("_observationRequirement")) {
2613      JsonArray array = getJArray(json, "_observationRequirement");
2614      for (int i = 0; i < array.size(); i++) {
2615        if (i == res.getObservationRequirement().size())
2616          res.getObservationRequirement().add(parseCanonical(null));
2617        if (array.get(i) instanceof JsonObject) 
2618          parseElementProperties(array.get(i).getAsJsonObject(), res.getObservationRequirement().get(i));
2619      }
2620    };
2621    if (json.has("observationResultRequirement")) {
2622      JsonArray array = getJArray(json, "observationResultRequirement");
2623      for (int i = 0; i < array.size(); i++) {
2624        if (array.get(i).isJsonNull()) {
2625          res.getObservationResultRequirement().add(new CanonicalType());
2626        } else {;
2627          res.getObservationResultRequirement().add(parseCanonical(array.get(i).getAsString()));
2628        }
2629      }
2630    };
2631    if (json.has("_observationResultRequirement")) {
2632      JsonArray array = getJArray(json, "_observationResultRequirement");
2633      for (int i = 0; i < array.size(); i++) {
2634        if (i == res.getObservationResultRequirement().size())
2635          res.getObservationResultRequirement().add(parseCanonical(null));
2636        if (array.get(i) instanceof JsonObject) 
2637          parseElementProperties(array.get(i).getAsJsonObject(), res.getObservationResultRequirement().get(i));
2638      }
2639    };
2640    if (json.has("transform"))
2641      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2642    if (json.has("_transform"))
2643      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
2644    if (json.has("dynamicValue")) {
2645      JsonArray array = getJArray(json, "dynamicValue");
2646      for (int i = 0; i < array.size(); i++) {
2647        res.getDynamicValue().add(parseActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject()));
2648      }
2649    };
2650  }
2651
2652  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2653    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2654    parseActivityDefinitionParticipantComponentProperties(json, res);
2655    return res;
2656  }
2657
2658  protected void parseActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2659    parseBackboneElementProperties(json, res);
2660    if (json.has("type"))
2661      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
2662    if (json.has("_type"))
2663      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2664    if (json.has("typeCanonical"))
2665      res.setTypeCanonicalElement(parseCanonical(json.get("typeCanonical").getAsString()));
2666    if (json.has("_typeCanonical"))
2667      parseElementProperties(getJObject(json, "_typeCanonical"), res.getTypeCanonicalElement());
2668    if (json.has("typeReference"))
2669      res.setTypeReference(parseReference(getJObject(json, "typeReference")));
2670    if (json.has("role"))
2671      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2672    if (json.has("function"))
2673      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
2674  }
2675
2676  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
2677    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2678    parseActivityDefinitionDynamicValueComponentProperties(json, res);
2679    return res;
2680  }
2681
2682  protected void parseActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2683    parseBackboneElementProperties(json, res);
2684    if (json.has("path"))
2685      res.setPathElement(parseString(json.get("path").getAsString()));
2686    if (json.has("_path"))
2687      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2688    if (json.has("expression"))
2689      res.setExpression(parseExpression(getJObject(json, "expression")));
2690  }
2691
2692  protected ActorDefinition parseActorDefinition(JsonObject json) throws IOException, FHIRFormatError {
2693    ActorDefinition res = new ActorDefinition();
2694    parseActorDefinitionProperties(json, res);
2695    return res;
2696  }
2697
2698  protected void parseActorDefinitionProperties(JsonObject json, ActorDefinition res) throws IOException, FHIRFormatError {
2699    parseCanonicalResourceProperties(json, res);
2700    if (json.has("url"))
2701      res.setUrlElement(parseUri(json.get("url").getAsString()));
2702    if (json.has("_url"))
2703      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2704    if (json.has("identifier")) {
2705      JsonArray array = getJArray(json, "identifier");
2706      for (int i = 0; i < array.size(); i++) {
2707        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2708      }
2709    };
2710    if (json.has("version"))
2711      res.setVersionElement(parseString(json.get("version").getAsString()));
2712    if (json.has("_version"))
2713      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2714    if (json.has("name"))
2715      res.setNameElement(parseString(json.get("name").getAsString()));
2716    if (json.has("_name"))
2717      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2718    if (json.has("title"))
2719      res.setTitleElement(parseString(json.get("title").getAsString()));
2720    if (json.has("_title"))
2721      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2722    if (json.has("status"))
2723      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2724    if (json.has("_status"))
2725      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2726    if (json.has("experimental"))
2727      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2728    if (json.has("_experimental"))
2729      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2730    if (json.has("date"))
2731      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2732    if (json.has("_date"))
2733      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2734    if (json.has("publisher"))
2735      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2736    if (json.has("_publisher"))
2737      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2738    if (json.has("contact")) {
2739      JsonArray array = getJArray(json, "contact");
2740      for (int i = 0; i < array.size(); i++) {
2741        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2742      }
2743    };
2744    if (json.has("description"))
2745      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2746    if (json.has("_description"))
2747      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2748    if (json.has("useContext")) {
2749      JsonArray array = getJArray(json, "useContext");
2750      for (int i = 0; i < array.size(); i++) {
2751        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2752      }
2753    };
2754    if (json.has("jurisdiction")) {
2755      JsonArray array = getJArray(json, "jurisdiction");
2756      for (int i = 0; i < array.size(); i++) {
2757        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2758      }
2759    };
2760    if (json.has("purpose"))
2761      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2762    if (json.has("_purpose"))
2763      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2764    if (json.has("copyright"))
2765      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2766    if (json.has("_copyright"))
2767      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2768    if (json.has("copyrightLabel"))
2769      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
2770    if (json.has("_copyrightLabel"))
2771      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
2772    if (json.has("type"))
2773      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ExampleScenarioActorType.NULL, new Enumerations.ExampleScenarioActorTypeEnumFactory()));
2774    if (json.has("_type"))
2775      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2776    if (json.has("documentation"))
2777      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
2778    if (json.has("_documentation"))
2779      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
2780    if (json.has("reference")) {
2781      JsonArray array = getJArray(json, "reference");
2782      for (int i = 0; i < array.size(); i++) {
2783        if (array.get(i).isJsonNull()) {
2784          res.getReference().add(new UrlType());
2785        } else {;
2786          res.getReference().add(parseUrl(array.get(i).getAsString()));
2787        }
2788      }
2789    };
2790    if (json.has("_reference")) {
2791      JsonArray array = getJArray(json, "_reference");
2792      for (int i = 0; i < array.size(); i++) {
2793        if (i == res.getReference().size())
2794          res.getReference().add(parseUrl(null));
2795        if (array.get(i) instanceof JsonObject) 
2796          parseElementProperties(array.get(i).getAsJsonObject(), res.getReference().get(i));
2797      }
2798    };
2799    if (json.has("capabilities"))
2800      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
2801    if (json.has("_capabilities"))
2802      parseElementProperties(getJObject(json, "_capabilities"), res.getCapabilitiesElement());
2803    if (json.has("derivedFrom")) {
2804      JsonArray array = getJArray(json, "derivedFrom");
2805      for (int i = 0; i < array.size(); i++) {
2806        if (array.get(i).isJsonNull()) {
2807          res.getDerivedFrom().add(new CanonicalType());
2808        } else {;
2809          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
2810        }
2811      }
2812    };
2813    if (json.has("_derivedFrom")) {
2814      JsonArray array = getJArray(json, "_derivedFrom");
2815      for (int i = 0; i < array.size(); i++) {
2816        if (i == res.getDerivedFrom().size())
2817          res.getDerivedFrom().add(parseCanonical(null));
2818        if (array.get(i) instanceof JsonObject) 
2819          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
2820      }
2821    };
2822  }
2823
2824  protected AdministrableProductDefinition parseAdministrableProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
2825    AdministrableProductDefinition res = new AdministrableProductDefinition();
2826    parseAdministrableProductDefinitionProperties(json, res);
2827    return res;
2828  }
2829
2830  protected void parseAdministrableProductDefinitionProperties(JsonObject json, AdministrableProductDefinition res) throws IOException, FHIRFormatError {
2831    parseDomainResourceProperties(json, res);
2832    if (json.has("identifier")) {
2833      JsonArray array = getJArray(json, "identifier");
2834      for (int i = 0; i < array.size(); i++) {
2835        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2836      }
2837    };
2838    if (json.has("status"))
2839      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2840    if (json.has("_status"))
2841      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2842    if (json.has("formOf")) {
2843      JsonArray array = getJArray(json, "formOf");
2844      for (int i = 0; i < array.size(); i++) {
2845        res.getFormOf().add(parseReference(array.get(i).getAsJsonObject()));
2846      }
2847    };
2848    if (json.has("administrableDoseForm"))
2849      res.setAdministrableDoseForm(parseCodeableConcept(getJObject(json, "administrableDoseForm")));
2850    if (json.has("unitOfPresentation"))
2851      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
2852    if (json.has("producedFrom")) {
2853      JsonArray array = getJArray(json, "producedFrom");
2854      for (int i = 0; i < array.size(); i++) {
2855        res.getProducedFrom().add(parseReference(array.get(i).getAsJsonObject()));
2856      }
2857    };
2858    if (json.has("ingredient")) {
2859      JsonArray array = getJArray(json, "ingredient");
2860      for (int i = 0; i < array.size(); i++) {
2861        res.getIngredient().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2862      }
2863    };
2864    if (json.has("device"))
2865      res.setDevice(parseReference(getJObject(json, "device")));
2866    if (json.has("property")) {
2867      JsonArray array = getJArray(json, "property");
2868      for (int i = 0; i < array.size(); i++) {
2869        res.getProperty().add(parseAdministrableProductDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
2870      }
2871    };
2872    if (json.has("routeOfAdministration")) {
2873      JsonArray array = getJArray(json, "routeOfAdministration");
2874      for (int i = 0; i < array.size(); i++) {
2875        res.getRouteOfAdministration().add(parseAdministrableProductDefinitionRouteOfAdministrationComponent(array.get(i).getAsJsonObject()));
2876      }
2877    };
2878  }
2879
2880  protected AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent parseAdministrableProductDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
2881    AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent();
2882    parseAdministrableProductDefinitionPropertyComponentProperties(json, res);
2883    return res;
2884  }
2885
2886  protected void parseAdministrableProductDefinitionPropertyComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
2887    parseBackboneElementProperties(json, res);
2888    if (json.has("type"))
2889      res.setType(parseCodeableConcept(getJObject(json, "type")));
2890    DataType value = parseType("value", json);
2891    if (value != null)
2892      res.setValue(value);
2893    if (json.has("status"))
2894      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
2895  }
2896
2897  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent parseAdministrableProductDefinitionRouteOfAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
2898    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent();
2899    parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(json, res);
2900    return res;
2901  }
2902
2903  protected void parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
2904    parseBackboneElementProperties(json, res);
2905    if (json.has("code"))
2906      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2907    if (json.has("firstDose"))
2908      res.setFirstDose(parseQuantity(getJObject(json, "firstDose")));
2909    if (json.has("maxSingleDose"))
2910      res.setMaxSingleDose(parseQuantity(getJObject(json, "maxSingleDose")));
2911    if (json.has("maxDosePerDay"))
2912      res.setMaxDosePerDay(parseQuantity(getJObject(json, "maxDosePerDay")));
2913    if (json.has("maxDosePerTreatmentPeriod"))
2914      res.setMaxDosePerTreatmentPeriod(parseRatio(getJObject(json, "maxDosePerTreatmentPeriod")));
2915    if (json.has("maxTreatmentPeriod"))
2916      res.setMaxTreatmentPeriod(parseDuration(getJObject(json, "maxTreatmentPeriod")));
2917    if (json.has("targetSpecies")) {
2918      JsonArray array = getJArray(json, "targetSpecies");
2919      for (int i = 0; i < array.size(); i++) {
2920        res.getTargetSpecies().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject()));
2921      }
2922    };
2923  }
2924
2925  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(JsonObject json) throws IOException, FHIRFormatError {
2926    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
2927    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(json, res);
2928    return res;
2929  }
2930
2931  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
2932    parseBackboneElementProperties(json, res);
2933    if (json.has("code"))
2934      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2935    if (json.has("withdrawalPeriod")) {
2936      JsonArray array = getJArray(json, "withdrawalPeriod");
2937      for (int i = 0; i < array.size(); i++) {
2938        res.getWithdrawalPeriod().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject()));
2939      }
2940    };
2941  }
2942
2943  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json) throws IOException, FHIRFormatError {
2944    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
2945    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, res);
2946    return res;
2947  }
2948
2949  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
2950    parseBackboneElementProperties(json, res);
2951    if (json.has("tissue"))
2952      res.setTissue(parseCodeableConcept(getJObject(json, "tissue")));
2953    if (json.has("value"))
2954      res.setValue(parseQuantity(getJObject(json, "value")));
2955    if (json.has("supportingInformation"))
2956      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
2957    if (json.has("_supportingInformation"))
2958      parseElementProperties(getJObject(json, "_supportingInformation"), res.getSupportingInformationElement());
2959  }
2960
2961  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2962    AdverseEvent res = new AdverseEvent();
2963    parseAdverseEventProperties(json, res);
2964    return res;
2965  }
2966
2967  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2968    parseDomainResourceProperties(json, res);
2969    if (json.has("identifier")) {
2970      JsonArray array = getJArray(json, "identifier");
2971      for (int i = 0; i < array.size(); i++) {
2972        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2973      }
2974    };
2975    if (json.has("status"))
2976      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AdverseEvent.AdverseEventStatus.NULL, new AdverseEvent.AdverseEventStatusEnumFactory()));
2977    if (json.has("_status"))
2978      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2979    if (json.has("actuality"))
2980      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2981    if (json.has("_actuality"))
2982      parseElementProperties(getJObject(json, "_actuality"), res.getActualityElement());
2983    if (json.has("category")) {
2984      JsonArray array = getJArray(json, "category");
2985      for (int i = 0; i < array.size(); i++) {
2986        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2987      }
2988    };
2989    if (json.has("code"))
2990      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2991    if (json.has("subject"))
2992      res.setSubject(parseReference(getJObject(json, "subject")));
2993    if (json.has("encounter"))
2994      res.setEncounter(parseReference(getJObject(json, "encounter")));
2995    DataType occurrence = parseType("occurrence", json);
2996    if (occurrence != null)
2997      res.setOccurrence(occurrence);
2998    if (json.has("detected"))
2999      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
3000    if (json.has("_detected"))
3001      parseElementProperties(getJObject(json, "_detected"), res.getDetectedElement());
3002    if (json.has("recordedDate"))
3003      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
3004    if (json.has("_recordedDate"))
3005      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
3006    if (json.has("resultingCondition")) {
3007      JsonArray array = getJArray(json, "resultingCondition");
3008      for (int i = 0; i < array.size(); i++) {
3009        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
3010      }
3011    };
3012    if (json.has("location"))
3013      res.setLocation(parseReference(getJObject(json, "location")));
3014    if (json.has("seriousness"))
3015      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
3016    if (json.has("outcome")) {
3017      JsonArray array = getJArray(json, "outcome");
3018      for (int i = 0; i < array.size(); i++) {
3019        res.getOutcome().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3020      }
3021    };
3022    if (json.has("recorder"))
3023      res.setRecorder(parseReference(getJObject(json, "recorder")));
3024    if (json.has("participant")) {
3025      JsonArray array = getJArray(json, "participant");
3026      for (int i = 0; i < array.size(); i++) {
3027        res.getParticipant().add(parseAdverseEventParticipantComponent(array.get(i).getAsJsonObject()));
3028      }
3029    };
3030    if (json.has("study")) {
3031      JsonArray array = getJArray(json, "study");
3032      for (int i = 0; i < array.size(); i++) {
3033        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
3034      }
3035    };
3036    if (json.has("expectedInResearchStudy"))
3037      res.setExpectedInResearchStudyElement(parseBoolean(json.get("expectedInResearchStudy").getAsBoolean()));
3038    if (json.has("_expectedInResearchStudy"))
3039      parseElementProperties(getJObject(json, "_expectedInResearchStudy"), res.getExpectedInResearchStudyElement());
3040    if (json.has("suspectEntity")) {
3041      JsonArray array = getJArray(json, "suspectEntity");
3042      for (int i = 0; i < array.size(); i++) {
3043        res.getSuspectEntity().add(parseAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject()));
3044      }
3045    };
3046    if (json.has("contributingFactor")) {
3047      JsonArray array = getJArray(json, "contributingFactor");
3048      for (int i = 0; i < array.size(); i++) {
3049        res.getContributingFactor().add(parseAdverseEventContributingFactorComponent(array.get(i).getAsJsonObject()));
3050      }
3051    };
3052    if (json.has("preventiveAction")) {
3053      JsonArray array = getJArray(json, "preventiveAction");
3054      for (int i = 0; i < array.size(); i++) {
3055        res.getPreventiveAction().add(parseAdverseEventPreventiveActionComponent(array.get(i).getAsJsonObject()));
3056      }
3057    };
3058    if (json.has("mitigatingAction")) {
3059      JsonArray array = getJArray(json, "mitigatingAction");
3060      for (int i = 0; i < array.size(); i++) {
3061        res.getMitigatingAction().add(parseAdverseEventMitigatingActionComponent(array.get(i).getAsJsonObject()));
3062      }
3063    };
3064    if (json.has("supportingInfo")) {
3065      JsonArray array = getJArray(json, "supportingInfo");
3066      for (int i = 0; i < array.size(); i++) {
3067        res.getSupportingInfo().add(parseAdverseEventSupportingInfoComponent(array.get(i).getAsJsonObject()));
3068      }
3069    };
3070    if (json.has("note")) {
3071      JsonArray array = getJArray(json, "note");
3072      for (int i = 0; i < array.size(); i++) {
3073        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3074      }
3075    };
3076  }
3077
3078  protected AdverseEvent.AdverseEventParticipantComponent parseAdverseEventParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3079    AdverseEvent.AdverseEventParticipantComponent res = new AdverseEvent.AdverseEventParticipantComponent();
3080    parseAdverseEventParticipantComponentProperties(json, res);
3081    return res;
3082  }
3083
3084  protected void parseAdverseEventParticipantComponentProperties(JsonObject json, AdverseEvent.AdverseEventParticipantComponent res) throws IOException, FHIRFormatError {
3085    parseBackboneElementProperties(json, res);
3086    if (json.has("function"))
3087      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
3088    if (json.has("actor"))
3089      res.setActor(parseReference(getJObject(json, "actor")));
3090  }
3091
3092  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventSuspectEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
3093    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
3094    parseAdverseEventSuspectEntityComponentProperties(json, res);
3095    return res;
3096  }
3097
3098  protected void parseAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
3099    parseBackboneElementProperties(json, res);
3100    DataType instance = parseType("instance", json);
3101    if (instance != null)
3102      res.setInstance(instance);
3103    if (json.has("causality"))
3104      res.setCausality(parseAdverseEventSuspectEntityCausalityComponent(getJObject(json, "causality")));
3105  }
3106
3107  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventSuspectEntityCausalityComponent(JsonObject json) throws IOException, FHIRFormatError {
3108    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
3109    parseAdverseEventSuspectEntityCausalityComponentProperties(json, res);
3110    return res;
3111  }
3112
3113  protected void parseAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
3114    parseBackboneElementProperties(json, res);
3115    if (json.has("assessmentMethod"))
3116      res.setAssessmentMethod(parseCodeableConcept(getJObject(json, "assessmentMethod")));
3117    if (json.has("entityRelatedness"))
3118      res.setEntityRelatedness(parseCodeableConcept(getJObject(json, "entityRelatedness")));
3119    if (json.has("author"))
3120      res.setAuthor(parseReference(getJObject(json, "author")));
3121  }
3122
3123  protected AdverseEvent.AdverseEventContributingFactorComponent parseAdverseEventContributingFactorComponent(JsonObject json) throws IOException, FHIRFormatError {
3124    AdverseEvent.AdverseEventContributingFactorComponent res = new AdverseEvent.AdverseEventContributingFactorComponent();
3125    parseAdverseEventContributingFactorComponentProperties(json, res);
3126    return res;
3127  }
3128
3129  protected void parseAdverseEventContributingFactorComponentProperties(JsonObject json, AdverseEvent.AdverseEventContributingFactorComponent res) throws IOException, FHIRFormatError {
3130    parseBackboneElementProperties(json, res);
3131    DataType item = parseType("item", json);
3132    if (item != null)
3133      res.setItem(item);
3134  }
3135
3136  protected AdverseEvent.AdverseEventPreventiveActionComponent parseAdverseEventPreventiveActionComponent(JsonObject json) throws IOException, FHIRFormatError {
3137    AdverseEvent.AdverseEventPreventiveActionComponent res = new AdverseEvent.AdverseEventPreventiveActionComponent();
3138    parseAdverseEventPreventiveActionComponentProperties(json, res);
3139    return res;
3140  }
3141
3142  protected void parseAdverseEventPreventiveActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventPreventiveActionComponent res) throws IOException, FHIRFormatError {
3143    parseBackboneElementProperties(json, res);
3144    DataType item = parseType("item", json);
3145    if (item != null)
3146      res.setItem(item);
3147  }
3148
3149  protected AdverseEvent.AdverseEventMitigatingActionComponent parseAdverseEventMitigatingActionComponent(JsonObject json) throws IOException, FHIRFormatError {
3150    AdverseEvent.AdverseEventMitigatingActionComponent res = new AdverseEvent.AdverseEventMitigatingActionComponent();
3151    parseAdverseEventMitigatingActionComponentProperties(json, res);
3152    return res;
3153  }
3154
3155  protected void parseAdverseEventMitigatingActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventMitigatingActionComponent res) throws IOException, FHIRFormatError {
3156    parseBackboneElementProperties(json, res);
3157    DataType item = parseType("item", json);
3158    if (item != null)
3159      res.setItem(item);
3160  }
3161
3162  protected AdverseEvent.AdverseEventSupportingInfoComponent parseAdverseEventSupportingInfoComponent(JsonObject json) throws IOException, FHIRFormatError {
3163    AdverseEvent.AdverseEventSupportingInfoComponent res = new AdverseEvent.AdverseEventSupportingInfoComponent();
3164    parseAdverseEventSupportingInfoComponentProperties(json, res);
3165    return res;
3166  }
3167
3168  protected void parseAdverseEventSupportingInfoComponentProperties(JsonObject json, AdverseEvent.AdverseEventSupportingInfoComponent res) throws IOException, FHIRFormatError {
3169    parseBackboneElementProperties(json, res);
3170    DataType item = parseType("item", json);
3171    if (item != null)
3172      res.setItem(item);
3173  }
3174
3175  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
3176    AllergyIntolerance res = new AllergyIntolerance();
3177    parseAllergyIntoleranceProperties(json, res);
3178    return res;
3179  }
3180
3181  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
3182    parseDomainResourceProperties(json, res);
3183    if (json.has("identifier")) {
3184      JsonArray array = getJArray(json, "identifier");
3185      for (int i = 0; i < array.size(); i++) {
3186        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3187      }
3188    };
3189    if (json.has("clinicalStatus"))
3190      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
3191    if (json.has("verificationStatus"))
3192      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
3193    if (json.has("type"))
3194      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
3195    if (json.has("_type"))
3196      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3197    if (json.has("category")) {
3198      JsonArray array = getJArray(json, "category");
3199      for (int i = 0; i < array.size(); i++) {
3200        if (array.get(i).isJsonNull()) {
3201          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>(new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), AllergyIntolerance.AllergyIntoleranceCategory.NULL));
3202        } else {;
3203          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
3204        }
3205      }
3206    };
3207    if (json.has("_category")) {
3208      JsonArray array = getJArray(json, "_category");
3209      for (int i = 0; i < array.size(); i++) {
3210        if (i == res.getCategory().size())
3211          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
3212        if (array.get(i) instanceof JsonObject) 
3213          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
3214      }
3215    };
3216    if (json.has("criticality"))
3217      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
3218    if (json.has("_criticality"))
3219      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
3220    if (json.has("code"))
3221      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3222    if (json.has("patient"))
3223      res.setPatient(parseReference(getJObject(json, "patient")));
3224    if (json.has("encounter"))
3225      res.setEncounter(parseReference(getJObject(json, "encounter")));
3226    DataType onset = parseType("onset", json);
3227    if (onset != null)
3228      res.setOnset(onset);
3229    if (json.has("recordedDate"))
3230      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
3231    if (json.has("_recordedDate"))
3232      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
3233    if (json.has("participant")) {
3234      JsonArray array = getJArray(json, "participant");
3235      for (int i = 0; i < array.size(); i++) {
3236        res.getParticipant().add(parseAllergyIntoleranceParticipantComponent(array.get(i).getAsJsonObject()));
3237      }
3238    };
3239    if (json.has("lastOccurrence"))
3240      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
3241    if (json.has("_lastOccurrence"))
3242      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
3243    if (json.has("note")) {
3244      JsonArray array = getJArray(json, "note");
3245      for (int i = 0; i < array.size(); i++) {
3246        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3247      }
3248    };
3249    if (json.has("reaction")) {
3250      JsonArray array = getJArray(json, "reaction");
3251      for (int i = 0; i < array.size(); i++) {
3252        res.getReaction().add(parseAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject()));
3253      }
3254    };
3255  }
3256
3257  protected AllergyIntolerance.AllergyIntoleranceParticipantComponent parseAllergyIntoleranceParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3258    AllergyIntolerance.AllergyIntoleranceParticipantComponent res = new AllergyIntolerance.AllergyIntoleranceParticipantComponent();
3259    parseAllergyIntoleranceParticipantComponentProperties(json, res);
3260    return res;
3261  }
3262
3263  protected void parseAllergyIntoleranceParticipantComponentProperties(JsonObject json, AllergyIntolerance.AllergyIntoleranceParticipantComponent res) throws IOException, FHIRFormatError {
3264    parseBackboneElementProperties(json, res);
3265    if (json.has("function"))
3266      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
3267    if (json.has("actor"))
3268      res.setActor(parseReference(getJObject(json, "actor")));
3269  }
3270
3271  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
3272    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
3273    parseAllergyIntoleranceReactionComponentProperties(json, res);
3274    return res;
3275  }
3276
3277  protected void parseAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
3278    parseBackboneElementProperties(json, res);
3279    if (json.has("substance"))
3280      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
3281    if (json.has("manifestation")) {
3282      JsonArray array = getJArray(json, "manifestation");
3283      for (int i = 0; i < array.size(); i++) {
3284        res.getManifestation().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3285      }
3286    };
3287    if (json.has("description"))
3288      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3289    if (json.has("_description"))
3290      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3291    if (json.has("onset"))
3292      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
3293    if (json.has("_onset"))
3294      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
3295    if (json.has("severity"))
3296      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
3297    if (json.has("_severity"))
3298      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
3299    if (json.has("exposureRoute"))
3300      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
3301    if (json.has("note")) {
3302      JsonArray array = getJArray(json, "note");
3303      for (int i = 0; i < array.size(); i++) {
3304        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3305      }
3306    };
3307  }
3308
3309  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
3310    Appointment res = new Appointment();
3311    parseAppointmentProperties(json, res);
3312    return res;
3313  }
3314
3315  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
3316    parseDomainResourceProperties(json, res);
3317    if (json.has("identifier")) {
3318      JsonArray array = getJArray(json, "identifier");
3319      for (int i = 0; i < array.size(); i++) {
3320        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3321      }
3322    };
3323    if (json.has("status"))
3324      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
3325    if (json.has("_status"))
3326      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3327    if (json.has("cancellationReason"))
3328      res.setCancellationReason(parseCodeableConcept(getJObject(json, "cancellationReason")));
3329    if (json.has("class")) {
3330      JsonArray array = getJArray(json, "class");
3331      for (int i = 0; i < array.size(); i++) {
3332        res.getClass_().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3333      }
3334    };
3335    if (json.has("serviceCategory")) {
3336      JsonArray array = getJArray(json, "serviceCategory");
3337      for (int i = 0; i < array.size(); i++) {
3338        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3339      }
3340    };
3341    if (json.has("serviceType")) {
3342      JsonArray array = getJArray(json, "serviceType");
3343      for (int i = 0; i < array.size(); i++) {
3344        res.getServiceType().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3345      }
3346    };
3347    if (json.has("specialty")) {
3348      JsonArray array = getJArray(json, "specialty");
3349      for (int i = 0; i < array.size(); i++) {
3350        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3351      }
3352    };
3353    if (json.has("appointmentType"))
3354      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
3355    if (json.has("reason")) {
3356      JsonArray array = getJArray(json, "reason");
3357      for (int i = 0; i < array.size(); i++) {
3358        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3359      }
3360    };
3361    if (json.has("priority"))
3362      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
3363    if (json.has("description"))
3364      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3365    if (json.has("_description"))
3366      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3367    if (json.has("replaces")) {
3368      JsonArray array = getJArray(json, "replaces");
3369      for (int i = 0; i < array.size(); i++) {
3370        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
3371      }
3372    };
3373    if (json.has("virtualService")) {
3374      JsonArray array = getJArray(json, "virtualService");
3375      for (int i = 0; i < array.size(); i++) {
3376        res.getVirtualService().add(parseVirtualServiceDetail(array.get(i).getAsJsonObject()));
3377      }
3378    };
3379    if (json.has("supportingInformation")) {
3380      JsonArray array = getJArray(json, "supportingInformation");
3381      for (int i = 0; i < array.size(); i++) {
3382        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3383      }
3384    };
3385    if (json.has("previousAppointment"))
3386      res.setPreviousAppointment(parseReference(getJObject(json, "previousAppointment")));
3387    if (json.has("originatingAppointment"))
3388      res.setOriginatingAppointment(parseReference(getJObject(json, "originatingAppointment")));
3389    if (json.has("start"))
3390      res.setStartElement(parseInstant(json.get("start").getAsString()));
3391    if (json.has("_start"))
3392      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
3393    if (json.has("end"))
3394      res.setEndElement(parseInstant(json.get("end").getAsString()));
3395    if (json.has("_end"))
3396      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
3397    if (json.has("minutesDuration"))
3398      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
3399    if (json.has("_minutesDuration"))
3400      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
3401    if (json.has("slot")) {
3402      JsonArray array = getJArray(json, "slot");
3403      for (int i = 0; i < array.size(); i++) {
3404        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
3405      }
3406    };
3407    if (json.has("account")) {
3408      JsonArray array = getJArray(json, "account");
3409      for (int i = 0; i < array.size(); i++) {
3410        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
3411      }
3412    };
3413    if (json.has("created"))
3414      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
3415    if (json.has("_created"))
3416      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
3417    if (json.has("note")) {
3418      JsonArray array = getJArray(json, "note");
3419      for (int i = 0; i < array.size(); i++) {
3420        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3421      }
3422    };
3423    if (json.has("patientInstruction")) {
3424      JsonArray array = getJArray(json, "patientInstruction");
3425      for (int i = 0; i < array.size(); i++) {
3426        res.getPatientInstruction().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3427      }
3428    };
3429    if (json.has("basedOn")) {
3430      JsonArray array = getJArray(json, "basedOn");
3431      for (int i = 0; i < array.size(); i++) {
3432        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3433      }
3434    };
3435    if (json.has("subject"))
3436      res.setSubject(parseReference(getJObject(json, "subject")));
3437    if (json.has("participant")) {
3438      JsonArray array = getJArray(json, "participant");
3439      for (int i = 0; i < array.size(); i++) {
3440        res.getParticipant().add(parseAppointmentParticipantComponent(array.get(i).getAsJsonObject()));
3441      }
3442    };
3443    if (json.has("requestedPeriod")) {
3444      JsonArray array = getJArray(json, "requestedPeriod");
3445      for (int i = 0; i < array.size(); i++) {
3446        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
3447      }
3448    };
3449    if (json.has("recurrenceId"))
3450      res.setRecurrenceIdElement(parsePositiveInt(json.get("recurrenceId").getAsString()));
3451    if (json.has("_recurrenceId"))
3452      parseElementProperties(getJObject(json, "_recurrenceId"), res.getRecurrenceIdElement());
3453    if (json.has("occurrenceChanged"))
3454      res.setOccurrenceChangedElement(parseBoolean(json.get("occurrenceChanged").getAsBoolean()));
3455    if (json.has("_occurrenceChanged"))
3456      parseElementProperties(getJObject(json, "_occurrenceChanged"), res.getOccurrenceChangedElement());
3457    if (json.has("recurrenceTemplate")) {
3458      JsonArray array = getJArray(json, "recurrenceTemplate");
3459      for (int i = 0; i < array.size(); i++) {
3460        res.getRecurrenceTemplate().add(parseAppointmentRecurrenceTemplateComponent(array.get(i).getAsJsonObject()));
3461      }
3462    };
3463  }
3464
3465  protected Appointment.AppointmentParticipantComponent parseAppointmentParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3466    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
3467    parseAppointmentParticipantComponentProperties(json, res);
3468    return res;
3469  }
3470
3471  protected void parseAppointmentParticipantComponentProperties(JsonObject json, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
3472    parseBackboneElementProperties(json, res);
3473    if (json.has("type")) {
3474      JsonArray array = getJArray(json, "type");
3475      for (int i = 0; i < array.size(); i++) {
3476        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3477      }
3478    };
3479    if (json.has("period"))
3480      res.setPeriod(parsePeriod(getJObject(json, "period")));
3481    if (json.has("actor"))
3482      res.setActor(parseReference(getJObject(json, "actor")));
3483    if (json.has("required"))
3484      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
3485    if (json.has("_required"))
3486      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
3487    if (json.has("status"))
3488      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3489    if (json.has("_status"))
3490      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3491  }
3492
3493  protected Appointment.AppointmentRecurrenceTemplateComponent parseAppointmentRecurrenceTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3494    Appointment.AppointmentRecurrenceTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateComponent();
3495    parseAppointmentRecurrenceTemplateComponentProperties(json, res);
3496    return res;
3497  }
3498
3499  protected void parseAppointmentRecurrenceTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateComponent res) throws IOException, FHIRFormatError {
3500    parseBackboneElementProperties(json, res);
3501    if (json.has("timezone"))
3502      res.setTimezone(parseCodeableConcept(getJObject(json, "timezone")));
3503    if (json.has("recurrenceType"))
3504      res.setRecurrenceType(parseCodeableConcept(getJObject(json, "recurrenceType")));
3505    if (json.has("lastOccurrenceDate"))
3506      res.setLastOccurrenceDateElement(parseDate(json.get("lastOccurrenceDate").getAsString()));
3507    if (json.has("_lastOccurrenceDate"))
3508      parseElementProperties(getJObject(json, "_lastOccurrenceDate"), res.getLastOccurrenceDateElement());
3509    if (json.has("occurrenceCount"))
3510      res.setOccurrenceCountElement(parsePositiveInt(json.get("occurrenceCount").getAsString()));
3511    if (json.has("_occurrenceCount"))
3512      parseElementProperties(getJObject(json, "_occurrenceCount"), res.getOccurrenceCountElement());
3513    if (json.has("occurrenceDate")) {
3514      JsonArray array = getJArray(json, "occurrenceDate");
3515      for (int i = 0; i < array.size(); i++) {
3516        if (array.get(i).isJsonNull()) {
3517          res.getOccurrenceDate().add(new DateType());
3518        } else {;
3519          res.getOccurrenceDate().add(parseDate(array.get(i).getAsString()));
3520        }
3521      }
3522    };
3523    if (json.has("_occurrenceDate")) {
3524      JsonArray array = getJArray(json, "_occurrenceDate");
3525      for (int i = 0; i < array.size(); i++) {
3526        if (i == res.getOccurrenceDate().size())
3527          res.getOccurrenceDate().add(parseDate(null));
3528        if (array.get(i) instanceof JsonObject) 
3529          parseElementProperties(array.get(i).getAsJsonObject(), res.getOccurrenceDate().get(i));
3530      }
3531    };
3532    if (json.has("weeklyTemplate"))
3533      res.setWeeklyTemplate(parseAppointmentRecurrenceTemplateWeeklyTemplateComponent(getJObject(json, "weeklyTemplate")));
3534    if (json.has("monthlyTemplate"))
3535      res.setMonthlyTemplate(parseAppointmentRecurrenceTemplateMonthlyTemplateComponent(getJObject(json, "monthlyTemplate")));
3536    if (json.has("yearlyTemplate"))
3537      res.setYearlyTemplate(parseAppointmentRecurrenceTemplateYearlyTemplateComponent(getJObject(json, "yearlyTemplate")));
3538    if (json.has("excludingDate")) {
3539      JsonArray array = getJArray(json, "excludingDate");
3540      for (int i = 0; i < array.size(); i++) {
3541        if (array.get(i).isJsonNull()) {
3542          res.getExcludingDate().add(new DateType());
3543        } else {;
3544          res.getExcludingDate().add(parseDate(array.get(i).getAsString()));
3545        }
3546      }
3547    };
3548    if (json.has("_excludingDate")) {
3549      JsonArray array = getJArray(json, "_excludingDate");
3550      for (int i = 0; i < array.size(); i++) {
3551        if (i == res.getExcludingDate().size())
3552          res.getExcludingDate().add(parseDate(null));
3553        if (array.get(i) instanceof JsonObject) 
3554          parseElementProperties(array.get(i).getAsJsonObject(), res.getExcludingDate().get(i));
3555      }
3556    };
3557    if (json.has("excludingRecurrenceId")) {
3558      JsonArray array = getJArray(json, "excludingRecurrenceId");
3559      for (int i = 0; i < array.size(); i++) {
3560        if (array.get(i).isJsonNull()) {
3561          res.getExcludingRecurrenceId().add(new PositiveIntType());
3562        } else {;
3563          res.getExcludingRecurrenceId().add(parsePositiveInt(array.get(i).getAsString()));
3564        }
3565      }
3566    };
3567    if (json.has("_excludingRecurrenceId")) {
3568      JsonArray array = getJArray(json, "_excludingRecurrenceId");
3569      for (int i = 0; i < array.size(); i++) {
3570        if (i == res.getExcludingRecurrenceId().size())
3571          res.getExcludingRecurrenceId().add(parsePositiveInt(null));
3572        if (array.get(i) instanceof JsonObject) 
3573          parseElementProperties(array.get(i).getAsJsonObject(), res.getExcludingRecurrenceId().get(i));
3574      }
3575    };
3576  }
3577
3578  protected Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent parseAppointmentRecurrenceTemplateWeeklyTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3579    Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent();
3580    parseAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(json, res);
3581    return res;
3582  }
3583
3584  protected void parseAppointmentRecurrenceTemplateWeeklyTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent res) throws IOException, FHIRFormatError {
3585    parseBackboneElementProperties(json, res);
3586    if (json.has("monday"))
3587      res.setMondayElement(parseBoolean(json.get("monday").getAsBoolean()));
3588    if (json.has("_monday"))
3589      parseElementProperties(getJObject(json, "_monday"), res.getMondayElement());
3590    if (json.has("tuesday"))
3591      res.setTuesdayElement(parseBoolean(json.get("tuesday").getAsBoolean()));
3592    if (json.has("_tuesday"))
3593      parseElementProperties(getJObject(json, "_tuesday"), res.getTuesdayElement());
3594    if (json.has("wednesday"))
3595      res.setWednesdayElement(parseBoolean(json.get("wednesday").getAsBoolean()));
3596    if (json.has("_wednesday"))
3597      parseElementProperties(getJObject(json, "_wednesday"), res.getWednesdayElement());
3598    if (json.has("thursday"))
3599      res.setThursdayElement(parseBoolean(json.get("thursday").getAsBoolean()));
3600    if (json.has("_thursday"))
3601      parseElementProperties(getJObject(json, "_thursday"), res.getThursdayElement());
3602    if (json.has("friday"))
3603      res.setFridayElement(parseBoolean(json.get("friday").getAsBoolean()));
3604    if (json.has("_friday"))
3605      parseElementProperties(getJObject(json, "_friday"), res.getFridayElement());
3606    if (json.has("saturday"))
3607      res.setSaturdayElement(parseBoolean(json.get("saturday").getAsBoolean()));
3608    if (json.has("_saturday"))
3609      parseElementProperties(getJObject(json, "_saturday"), res.getSaturdayElement());
3610    if (json.has("sunday"))
3611      res.setSundayElement(parseBoolean(json.get("sunday").getAsBoolean()));
3612    if (json.has("_sunday"))
3613      parseElementProperties(getJObject(json, "_sunday"), res.getSundayElement());
3614    if (json.has("weekInterval"))
3615      res.setWeekIntervalElement(parsePositiveInt(json.get("weekInterval").getAsString()));
3616    if (json.has("_weekInterval"))
3617      parseElementProperties(getJObject(json, "_weekInterval"), res.getWeekIntervalElement());
3618  }
3619
3620  protected Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent parseAppointmentRecurrenceTemplateMonthlyTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3621    Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent();
3622    parseAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(json, res);
3623    return res;
3624  }
3625
3626  protected void parseAppointmentRecurrenceTemplateMonthlyTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent res) throws IOException, FHIRFormatError {
3627    parseBackboneElementProperties(json, res);
3628    if (json.has("dayOfMonth"))
3629      res.setDayOfMonthElement(parsePositiveInt(json.get("dayOfMonth").getAsString()));
3630    if (json.has("_dayOfMonth"))
3631      parseElementProperties(getJObject(json, "_dayOfMonth"), res.getDayOfMonthElement());
3632    if (json.has("nthWeekOfMonth"))
3633      res.setNthWeekOfMonth(parseCoding(getJObject(json, "nthWeekOfMonth")));
3634    if (json.has("dayOfWeek"))
3635      res.setDayOfWeek(parseCoding(getJObject(json, "dayOfWeek")));
3636    if (json.has("monthInterval"))
3637      res.setMonthIntervalElement(parsePositiveInt(json.get("monthInterval").getAsString()));
3638    if (json.has("_monthInterval"))
3639      parseElementProperties(getJObject(json, "_monthInterval"), res.getMonthIntervalElement());
3640  }
3641
3642  protected Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent parseAppointmentRecurrenceTemplateYearlyTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
3643    Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent();
3644    parseAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(json, res);
3645    return res;
3646  }
3647
3648  protected void parseAppointmentRecurrenceTemplateYearlyTemplateComponentProperties(JsonObject json, Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent res) throws IOException, FHIRFormatError {
3649    parseBackboneElementProperties(json, res);
3650    if (json.has("yearInterval"))
3651      res.setYearIntervalElement(parsePositiveInt(json.get("yearInterval").getAsString()));
3652    if (json.has("_yearInterval"))
3653      parseElementProperties(getJObject(json, "_yearInterval"), res.getYearIntervalElement());
3654  }
3655
3656  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
3657    AppointmentResponse res = new AppointmentResponse();
3658    parseAppointmentResponseProperties(json, res);
3659    return res;
3660  }
3661
3662  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
3663    parseDomainResourceProperties(json, res);
3664    if (json.has("identifier")) {
3665      JsonArray array = getJArray(json, "identifier");
3666      for (int i = 0; i < array.size(); i++) {
3667        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3668      }
3669    };
3670    if (json.has("appointment"))
3671      res.setAppointment(parseReference(getJObject(json, "appointment")));
3672    if (json.has("proposedNewTime"))
3673      res.setProposedNewTimeElement(parseBoolean(json.get("proposedNewTime").getAsBoolean()));
3674    if (json.has("_proposedNewTime"))
3675      parseElementProperties(getJObject(json, "_proposedNewTime"), res.getProposedNewTimeElement());
3676    if (json.has("start"))
3677      res.setStartElement(parseInstant(json.get("start").getAsString()));
3678    if (json.has("_start"))
3679      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
3680    if (json.has("end"))
3681      res.setEndElement(parseInstant(json.get("end").getAsString()));
3682    if (json.has("_end"))
3683      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
3684    if (json.has("participantType")) {
3685      JsonArray array = getJArray(json, "participantType");
3686      for (int i = 0; i < array.size(); i++) {
3687        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3688      }
3689    };
3690    if (json.has("actor"))
3691      res.setActor(parseReference(getJObject(json, "actor")));
3692    if (json.has("participantStatus"))
3693      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3694    if (json.has("_participantStatus"))
3695      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
3696    if (json.has("comment"))
3697      res.setCommentElement(parseString(json.get("comment").getAsString()));
3698    if (json.has("_comment"))
3699      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
3700    if (json.has("recurring"))
3701      res.setRecurringElement(parseBoolean(json.get("recurring").getAsBoolean()));
3702    if (json.has("_recurring"))
3703      parseElementProperties(getJObject(json, "_recurring"), res.getRecurringElement());
3704    if (json.has("occurrenceDate"))
3705      res.setOccurrenceDateElement(parseDate(json.get("occurrenceDate").getAsString()));
3706    if (json.has("_occurrenceDate"))
3707      parseElementProperties(getJObject(json, "_occurrenceDate"), res.getOccurrenceDateElement());
3708    if (json.has("recurrenceId"))
3709      res.setRecurrenceIdElement(parsePositiveInt(json.get("recurrenceId").getAsString()));
3710    if (json.has("_recurrenceId"))
3711      parseElementProperties(getJObject(json, "_recurrenceId"), res.getRecurrenceIdElement());
3712  }
3713
3714  protected ArtifactAssessment parseArtifactAssessment(JsonObject json) throws IOException, FHIRFormatError {
3715    ArtifactAssessment res = new ArtifactAssessment();
3716    parseArtifactAssessmentProperties(json, res);
3717    return res;
3718  }
3719
3720  protected void parseArtifactAssessmentProperties(JsonObject json, ArtifactAssessment res) throws IOException, FHIRFormatError {
3721    parseDomainResourceProperties(json, res);
3722    if (json.has("identifier")) {
3723      JsonArray array = getJArray(json, "identifier");
3724      for (int i = 0; i < array.size(); i++) {
3725        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3726      }
3727    };
3728    DataType citeAs = parseType("citeAs", json);
3729    if (citeAs != null)
3730      res.setCiteAs(citeAs);
3731    if (json.has("date"))
3732      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3733    if (json.has("_date"))
3734      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3735    if (json.has("copyright"))
3736      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3737    if (json.has("_copyright"))
3738      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3739    if (json.has("approvalDate"))
3740      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
3741    if (json.has("_approvalDate"))
3742      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
3743    if (json.has("lastReviewDate"))
3744      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
3745    if (json.has("_lastReviewDate"))
3746      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
3747    DataType artifact = parseType("artifact", json);
3748    if (artifact != null)
3749      res.setArtifact(artifact);
3750    if (json.has("content")) {
3751      JsonArray array = getJArray(json, "content");
3752      for (int i = 0; i < array.size(); i++) {
3753        res.getContent().add(parseArtifactAssessmentContentComponent(array.get(i).getAsJsonObject()));
3754      }
3755    };
3756    if (json.has("workflowStatus"))
3757      res.setWorkflowStatusElement(parseEnumeration(json.get("workflowStatus").getAsString(), ArtifactAssessment.ArtifactAssessmentWorkflowStatus.NULL, new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory()));
3758    if (json.has("_workflowStatus"))
3759      parseElementProperties(getJObject(json, "_workflowStatus"), res.getWorkflowStatusElement());
3760    if (json.has("disposition"))
3761      res.setDispositionElement(parseEnumeration(json.get("disposition").getAsString(), ArtifactAssessment.ArtifactAssessmentDisposition.NULL, new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory()));
3762    if (json.has("_disposition"))
3763      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
3764  }
3765
3766  protected ArtifactAssessment.ArtifactAssessmentContentComponent parseArtifactAssessmentContentComponent(JsonObject json) throws IOException, FHIRFormatError {
3767    ArtifactAssessment.ArtifactAssessmentContentComponent res = new ArtifactAssessment.ArtifactAssessmentContentComponent();
3768    parseArtifactAssessmentContentComponentProperties(json, res);
3769    return res;
3770  }
3771
3772  protected void parseArtifactAssessmentContentComponentProperties(JsonObject json, ArtifactAssessment.ArtifactAssessmentContentComponent res) throws IOException, FHIRFormatError {
3773    parseBackboneElementProperties(json, res);
3774    if (json.has("informationType"))
3775      res.setInformationTypeElement(parseEnumeration(json.get("informationType").getAsString(), ArtifactAssessment.ArtifactAssessmentInformationType.NULL, new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory()));
3776    if (json.has("_informationType"))
3777      parseElementProperties(getJObject(json, "_informationType"), res.getInformationTypeElement());
3778    if (json.has("summary"))
3779      res.setSummaryElement(parseMarkdown(json.get("summary").getAsString()));
3780    if (json.has("_summary"))
3781      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
3782    if (json.has("type"))
3783      res.setType(parseCodeableConcept(getJObject(json, "type")));
3784    if (json.has("classifier")) {
3785      JsonArray array = getJArray(json, "classifier");
3786      for (int i = 0; i < array.size(); i++) {
3787        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3788      }
3789    };
3790    if (json.has("author"))
3791      res.setAuthor(parseReference(getJObject(json, "author")));
3792    if (json.has("path")) {
3793      JsonArray array = getJArray(json, "path");
3794      for (int i = 0; i < array.size(); i++) {
3795        if (array.get(i).isJsonNull()) {
3796          res.getPath().add(new UriType());
3797        } else {;
3798          res.getPath().add(parseUri(array.get(i).getAsString()));
3799        }
3800      }
3801    };
3802    if (json.has("_path")) {
3803      JsonArray array = getJArray(json, "_path");
3804      for (int i = 0; i < array.size(); i++) {
3805        if (i == res.getPath().size())
3806          res.getPath().add(parseUri(null));
3807        if (array.get(i) instanceof JsonObject) 
3808          parseElementProperties(array.get(i).getAsJsonObject(), res.getPath().get(i));
3809      }
3810    };
3811    if (json.has("relatedArtifact")) {
3812      JsonArray array = getJArray(json, "relatedArtifact");
3813      for (int i = 0; i < array.size(); i++) {
3814        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
3815      }
3816    };
3817    if (json.has("freeToShare"))
3818      res.setFreeToShareElement(parseBoolean(json.get("freeToShare").getAsBoolean()));
3819    if (json.has("_freeToShare"))
3820      parseElementProperties(getJObject(json, "_freeToShare"), res.getFreeToShareElement());
3821    if (json.has("component")) {
3822      JsonArray array = getJArray(json, "component");
3823      for (int i = 0; i < array.size(); i++) {
3824        res.getComponent().add(parseArtifactAssessmentContentComponent(array.get(i).getAsJsonObject()));
3825      }
3826    };
3827  }
3828
3829  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
3830    AuditEvent res = new AuditEvent();
3831    parseAuditEventProperties(json, res);
3832    return res;
3833  }
3834
3835  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
3836    parseDomainResourceProperties(json, res);
3837    if (json.has("category")) {
3838      JsonArray array = getJArray(json, "category");
3839      for (int i = 0; i < array.size(); i++) {
3840        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3841      }
3842    };
3843    if (json.has("code"))
3844      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3845    if (json.has("action"))
3846      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
3847    if (json.has("_action"))
3848      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
3849    if (json.has("severity"))
3850      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AuditEvent.AuditEventSeverity.NULL, new AuditEvent.AuditEventSeverityEnumFactory()));
3851    if (json.has("_severity"))
3852      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
3853    DataType occurred = parseType("occurred", json);
3854    if (occurred != null)
3855      res.setOccurred(occurred);
3856    if (json.has("recorded"))
3857      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
3858    if (json.has("_recorded"))
3859      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
3860    if (json.has("outcome"))
3861      res.setOutcome(parseAuditEventOutcomeComponent(getJObject(json, "outcome")));
3862    if (json.has("authorization")) {
3863      JsonArray array = getJArray(json, "authorization");
3864      for (int i = 0; i < array.size(); i++) {
3865        res.getAuthorization().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3866      }
3867    };
3868    if (json.has("basedOn")) {
3869      JsonArray array = getJArray(json, "basedOn");
3870      for (int i = 0; i < array.size(); i++) {
3871        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3872      }
3873    };
3874    if (json.has("patient"))
3875      res.setPatient(parseReference(getJObject(json, "patient")));
3876    if (json.has("encounter"))
3877      res.setEncounter(parseReference(getJObject(json, "encounter")));
3878    if (json.has("agent")) {
3879      JsonArray array = getJArray(json, "agent");
3880      for (int i = 0; i < array.size(); i++) {
3881        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
3882      }
3883    };
3884    if (json.has("source"))
3885      res.setSource(parseAuditEventSourceComponent(getJObject(json, "source")));
3886    if (json.has("entity")) {
3887      JsonArray array = getJArray(json, "entity");
3888      for (int i = 0; i < array.size(); i++) {
3889        res.getEntity().add(parseAuditEventEntityComponent(array.get(i).getAsJsonObject()));
3890      }
3891    };
3892  }
3893
3894  protected AuditEvent.AuditEventOutcomeComponent parseAuditEventOutcomeComponent(JsonObject json) throws IOException, FHIRFormatError {
3895    AuditEvent.AuditEventOutcomeComponent res = new AuditEvent.AuditEventOutcomeComponent();
3896    parseAuditEventOutcomeComponentProperties(json, res);
3897    return res;
3898  }
3899
3900  protected void parseAuditEventOutcomeComponentProperties(JsonObject json, AuditEvent.AuditEventOutcomeComponent res) throws IOException, FHIRFormatError {
3901    parseBackboneElementProperties(json, res);
3902    if (json.has("code"))
3903      res.setCode(parseCoding(getJObject(json, "code")));
3904    if (json.has("detail")) {
3905      JsonArray array = getJArray(json, "detail");
3906      for (int i = 0; i < array.size(); i++) {
3907        res.getDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3908      }
3909    };
3910  }
3911
3912  protected AuditEvent.AuditEventAgentComponent parseAuditEventAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
3913    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
3914    parseAuditEventAgentComponentProperties(json, res);
3915    return res;
3916  }
3917
3918  protected void parseAuditEventAgentComponentProperties(JsonObject json, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
3919    parseBackboneElementProperties(json, res);
3920    if (json.has("type"))
3921      res.setType(parseCodeableConcept(getJObject(json, "type")));
3922    if (json.has("role")) {
3923      JsonArray array = getJArray(json, "role");
3924      for (int i = 0; i < array.size(); i++) {
3925        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3926      }
3927    };
3928    if (json.has("who"))
3929      res.setWho(parseReference(getJObject(json, "who")));
3930    if (json.has("requestor"))
3931      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
3932    if (json.has("_requestor"))
3933      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
3934    if (json.has("location"))
3935      res.setLocation(parseReference(getJObject(json, "location")));
3936    if (json.has("policy")) {
3937      JsonArray array = getJArray(json, "policy");
3938      for (int i = 0; i < array.size(); i++) {
3939        if (array.get(i).isJsonNull()) {
3940          res.getPolicy().add(new UriType());
3941        } else {;
3942          res.getPolicy().add(parseUri(array.get(i).getAsString()));
3943        }
3944      }
3945    };
3946    if (json.has("_policy")) {
3947      JsonArray array = getJArray(json, "_policy");
3948      for (int i = 0; i < array.size(); i++) {
3949        if (i == res.getPolicy().size())
3950          res.getPolicy().add(parseUri(null));
3951        if (array.get(i) instanceof JsonObject) 
3952          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
3953      }
3954    };
3955    DataType network = parseType("network", json);
3956    if (network != null)
3957      res.setNetwork(network);
3958    if (json.has("authorization")) {
3959      JsonArray array = getJArray(json, "authorization");
3960      for (int i = 0; i < array.size(); i++) {
3961        res.getAuthorization().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3962      }
3963    };
3964  }
3965
3966  protected AuditEvent.AuditEventSourceComponent parseAuditEventSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
3967    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
3968    parseAuditEventSourceComponentProperties(json, res);
3969    return res;
3970  }
3971
3972  protected void parseAuditEventSourceComponentProperties(JsonObject json, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
3973    parseBackboneElementProperties(json, res);
3974    if (json.has("site"))
3975      res.setSite(parseReference(getJObject(json, "site")));
3976    if (json.has("observer"))
3977      res.setObserver(parseReference(getJObject(json, "observer")));
3978    if (json.has("type")) {
3979      JsonArray array = getJArray(json, "type");
3980      for (int i = 0; i < array.size(); i++) {
3981        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3982      }
3983    };
3984  }
3985
3986  protected AuditEvent.AuditEventEntityComponent parseAuditEventEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
3987    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3988    parseAuditEventEntityComponentProperties(json, res);
3989    return res;
3990  }
3991
3992  protected void parseAuditEventEntityComponentProperties(JsonObject json, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
3993    parseBackboneElementProperties(json, res);
3994    if (json.has("what"))
3995      res.setWhat(parseReference(getJObject(json, "what")));
3996    if (json.has("role"))
3997      res.setRole(parseCodeableConcept(getJObject(json, "role")));
3998    if (json.has("securityLabel")) {
3999      JsonArray array = getJArray(json, "securityLabel");
4000      for (int i = 0; i < array.size(); i++) {
4001        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4002      }
4003    };
4004    if (json.has("query"))
4005      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
4006    if (json.has("_query"))
4007      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
4008    if (json.has("detail")) {
4009      JsonArray array = getJArray(json, "detail");
4010      for (int i = 0; i < array.size(); i++) {
4011        res.getDetail().add(parseAuditEventEntityDetailComponent(array.get(i).getAsJsonObject()));
4012      }
4013    };
4014    if (json.has("agent")) {
4015      JsonArray array = getJArray(json, "agent");
4016      for (int i = 0; i < array.size(); i++) {
4017        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
4018      }
4019    };
4020  }
4021
4022  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventEntityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
4023    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
4024    parseAuditEventEntityDetailComponentProperties(json, res);
4025    return res;
4026  }
4027
4028  protected void parseAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
4029    parseBackboneElementProperties(json, res);
4030    if (json.has("type"))
4031      res.setType(parseCodeableConcept(getJObject(json, "type")));
4032    DataType value = parseType("value", json);
4033    if (value != null)
4034      res.setValue(value);
4035  }
4036
4037  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
4038    Basic res = new Basic();
4039    parseBasicProperties(json, res);
4040    return res;
4041  }
4042
4043  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
4044    parseDomainResourceProperties(json, res);
4045    if (json.has("identifier")) {
4046      JsonArray array = getJArray(json, "identifier");
4047      for (int i = 0; i < array.size(); i++) {
4048        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4049      }
4050    };
4051    if (json.has("code"))
4052      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4053    if (json.has("subject"))
4054      res.setSubject(parseReference(getJObject(json, "subject")));
4055    if (json.has("created"))
4056      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4057    if (json.has("_created"))
4058      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4059    if (json.has("author"))
4060      res.setAuthor(parseReference(getJObject(json, "author")));
4061  }
4062
4063  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
4064    Binary res = new Binary();
4065    parseBinaryProperties(json, res);
4066    return res;
4067  }
4068
4069  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
4070    parseResourceProperties(json, res);
4071    if (json.has("contentType"))
4072      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
4073    if (json.has("_contentType"))
4074      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
4075    if (json.has("securityContext"))
4076      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
4077    if (json.has("data"))
4078      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
4079    if (json.has("_data"))
4080      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
4081  }
4082
4083  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
4084    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
4085    parseBiologicallyDerivedProductProperties(json, res);
4086    return res;
4087  }
4088
4089  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
4090    parseDomainResourceProperties(json, res);
4091    if (json.has("productCategory"))
4092      res.setProductCategory(parseCoding(getJObject(json, "productCategory")));
4093    if (json.has("productCode"))
4094      res.setProductCode(parseCodeableConcept(getJObject(json, "productCode")));
4095    if (json.has("parent")) {
4096      JsonArray array = getJArray(json, "parent");
4097      for (int i = 0; i < array.size(); i++) {
4098        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
4099      }
4100    };
4101    if (json.has("request")) {
4102      JsonArray array = getJArray(json, "request");
4103      for (int i = 0; i < array.size(); i++) {
4104        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
4105      }
4106    };
4107    if (json.has("identifier")) {
4108      JsonArray array = getJArray(json, "identifier");
4109      for (int i = 0; i < array.size(); i++) {
4110        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4111      }
4112    };
4113    if (json.has("biologicalSourceEvent"))
4114      res.setBiologicalSourceEvent(parseIdentifier(getJObject(json, "biologicalSourceEvent")));
4115    if (json.has("processingFacility")) {
4116      JsonArray array = getJArray(json, "processingFacility");
4117      for (int i = 0; i < array.size(); i++) {
4118        res.getProcessingFacility().add(parseReference(array.get(i).getAsJsonObject()));
4119      }
4120    };
4121    if (json.has("division"))
4122      res.setDivisionElement(parseString(json.get("division").getAsString()));
4123    if (json.has("_division"))
4124      parseElementProperties(getJObject(json, "_division"), res.getDivisionElement());
4125    if (json.has("productStatus"))
4126      res.setProductStatus(parseCoding(getJObject(json, "productStatus")));
4127    if (json.has("expirationDate"))
4128      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
4129    if (json.has("_expirationDate"))
4130      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
4131    if (json.has("collection"))
4132      res.setCollection(parseBiologicallyDerivedProductCollectionComponent(getJObject(json, "collection")));
4133    if (json.has("storageTempRequirements"))
4134      res.setStorageTempRequirements(parseRange(getJObject(json, "storageTempRequirements")));
4135    if (json.has("property")) {
4136      JsonArray array = getJArray(json, "property");
4137      for (int i = 0; i < array.size(); i++) {
4138        res.getProperty().add(parseBiologicallyDerivedProductPropertyComponent(array.get(i).getAsJsonObject()));
4139      }
4140    };
4141  }
4142
4143  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
4144    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
4145    parseBiologicallyDerivedProductCollectionComponentProperties(json, res);
4146    return res;
4147  }
4148
4149  protected void parseBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
4150    parseBackboneElementProperties(json, res);
4151    if (json.has("collector"))
4152      res.setCollector(parseReference(getJObject(json, "collector")));
4153    if (json.has("source"))
4154      res.setSource(parseReference(getJObject(json, "source")));
4155    DataType collected = parseType("collected", json);
4156    if (collected != null)
4157      res.setCollected(collected);
4158  }
4159
4160  protected BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent parseBiologicallyDerivedProductPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
4161    BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent();
4162    parseBiologicallyDerivedProductPropertyComponentProperties(json, res);
4163    return res;
4164  }
4165
4166  protected void parseBiologicallyDerivedProductPropertyComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res) throws IOException, FHIRFormatError {
4167    parseBackboneElementProperties(json, res);
4168    if (json.has("type"))
4169      res.setType(parseCoding(getJObject(json, "type")));
4170    DataType value = parseType("value", json);
4171    if (value != null)
4172      res.setValue(value);
4173  }
4174
4175  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
4176    BodyStructure res = new BodyStructure();
4177    parseBodyStructureProperties(json, res);
4178    return res;
4179  }
4180
4181  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
4182    parseDomainResourceProperties(json, res);
4183    if (json.has("identifier")) {
4184      JsonArray array = getJArray(json, "identifier");
4185      for (int i = 0; i < array.size(); i++) {
4186        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4187      }
4188    };
4189    if (json.has("active"))
4190      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
4191    if (json.has("_active"))
4192      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
4193    if (json.has("morphology"))
4194      res.setMorphology(parseCodeableConcept(getJObject(json, "morphology")));
4195    if (json.has("includedStructure")) {
4196      JsonArray array = getJArray(json, "includedStructure");
4197      for (int i = 0; i < array.size(); i++) {
4198        res.getIncludedStructure().add(parseBodyStructureIncludedStructureComponent(array.get(i).getAsJsonObject()));
4199      }
4200    };
4201    if (json.has("excludedStructure")) {
4202      JsonArray array = getJArray(json, "excludedStructure");
4203      for (int i = 0; i < array.size(); i++) {
4204        res.getExcludedStructure().add(parseBodyStructureExcludedStructureComponent(array.get(i).getAsJsonObject()));
4205      }
4206    };
4207    if (json.has("description"))
4208      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4209    if (json.has("_description"))
4210      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4211    if (json.has("image")) {
4212      JsonArray array = getJArray(json, "image");
4213      for (int i = 0; i < array.size(); i++) {
4214        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
4215      }
4216    };
4217    if (json.has("patient"))
4218      res.setPatient(parseReference(getJObject(json, "patient")));
4219  }
4220
4221  protected BodyStructure.BodyStructureIncludedStructureComponent parseBodyStructureIncludedStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
4222    BodyStructure.BodyStructureIncludedStructureComponent res = new BodyStructure.BodyStructureIncludedStructureComponent();
4223    parseBodyStructureIncludedStructureComponentProperties(json, res);
4224    return res;
4225  }
4226
4227  protected void parseBodyStructureIncludedStructureComponentProperties(JsonObject json, BodyStructure.BodyStructureIncludedStructureComponent res) throws IOException, FHIRFormatError {
4228    parseBackboneElementProperties(json, res);
4229    if (json.has("structure"))
4230      res.setStructure(parseCodeableConcept(getJObject(json, "structure")));
4231    if (json.has("laterality"))
4232      res.setLaterality(parseCodeableConcept(getJObject(json, "laterality")));
4233    if (json.has("qualifier")) {
4234      JsonArray array = getJArray(json, "qualifier");
4235      for (int i = 0; i < array.size(); i++) {
4236        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4237      }
4238    };
4239  }
4240
4241  protected BodyStructure.BodyStructureExcludedStructureComponent parseBodyStructureExcludedStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
4242    BodyStructure.BodyStructureExcludedStructureComponent res = new BodyStructure.BodyStructureExcludedStructureComponent();
4243    parseBodyStructureExcludedStructureComponentProperties(json, res);
4244    return res;
4245  }
4246
4247  protected void parseBodyStructureExcludedStructureComponentProperties(JsonObject json, BodyStructure.BodyStructureExcludedStructureComponent res) throws IOException, FHIRFormatError {
4248    parseBackboneElementProperties(json, res);
4249    if (json.has("structure"))
4250      res.setStructure(parseCodeableConcept(getJObject(json, "structure")));
4251    if (json.has("laterality"))
4252      res.setLaterality(parseCodeableConcept(getJObject(json, "laterality")));
4253    if (json.has("qualifier")) {
4254      JsonArray array = getJArray(json, "qualifier");
4255      for (int i = 0; i < array.size(); i++) {
4256        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4257      }
4258    };
4259  }
4260
4261  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
4262    Bundle res = new Bundle();
4263    parseBundleProperties(json, res);
4264    return res;
4265  }
4266
4267  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
4268    parseResourceProperties(json, res);
4269    if (json.has("identifier"))
4270      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
4271    if (json.has("type"))
4272      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
4273    if (json.has("_type"))
4274      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4275    if (json.has("timestamp"))
4276      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
4277    if (json.has("_timestamp"))
4278      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
4279    if (json.has("total"))
4280      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
4281    if (json.has("_total"))
4282      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
4283    if (json.has("link")) {
4284      JsonArray array = getJArray(json, "link");
4285      for (int i = 0; i < array.size(); i++) {
4286        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
4287      }
4288    };
4289    if (json.has("entry")) {
4290      JsonArray array = getJArray(json, "entry");
4291      for (int i = 0; i < array.size(); i++) {
4292        res.getEntry().add(parseBundleEntryComponent(array.get(i).getAsJsonObject()));
4293      }
4294    };
4295    if (json.has("signature"))
4296      res.setSignature(parseSignature(getJObject(json, "signature")));
4297    if (json.has("issues"))
4298      res.setIssues(parseResource(getJObject(json, "issues")));
4299  }
4300
4301  protected Bundle.BundleLinkComponent parseBundleLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
4302    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
4303    parseBundleLinkComponentProperties(json, res);
4304    return res;
4305  }
4306
4307  protected void parseBundleLinkComponentProperties(JsonObject json, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
4308    parseBackboneElementProperties(json, res);
4309    if (json.has("relation"))
4310      res.setRelationElement(parseEnumeration(json.get("relation").getAsString(), Bundle.LinkRelationTypes.NULL, new Bundle.LinkRelationTypesEnumFactory()));
4311    if (json.has("_relation"))
4312      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
4313    if (json.has("url"))
4314      res.setUrlElement(parseUri(json.get("url").getAsString()));
4315    if (json.has("_url"))
4316      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4317  }
4318
4319  protected Bundle.BundleEntryComponent parseBundleEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
4320    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
4321    parseBundleEntryComponentProperties(json, res);
4322    return res;
4323  }
4324
4325  protected void parseBundleEntryComponentProperties(JsonObject json, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
4326    parseBackboneElementProperties(json, res);
4327    if (json.has("link")) {
4328      JsonArray array = getJArray(json, "link");
4329      for (int i = 0; i < array.size(); i++) {
4330        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
4331      }
4332    };
4333    if (json.has("fullUrl"))
4334      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
4335    if (json.has("_fullUrl"))
4336      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
4337    if (json.has("resource"))
4338      res.setResource(parseResource(getJObject(json, "resource")));
4339    if (json.has("search"))
4340      res.setSearch(parseBundleEntrySearchComponent(getJObject(json, "search")));
4341    if (json.has("request"))
4342      res.setRequest(parseBundleEntryRequestComponent(getJObject(json, "request")));
4343    if (json.has("response"))
4344      res.setResponse(parseBundleEntryResponseComponent(getJObject(json, "response")));
4345  }
4346
4347  protected Bundle.BundleEntrySearchComponent parseBundleEntrySearchComponent(JsonObject json) throws IOException, FHIRFormatError {
4348    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
4349    parseBundleEntrySearchComponentProperties(json, res);
4350    return res;
4351  }
4352
4353  protected void parseBundleEntrySearchComponentProperties(JsonObject json, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
4354    parseBackboneElementProperties(json, res);
4355    if (json.has("mode"))
4356      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
4357    if (json.has("_mode"))
4358      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4359    if (json.has("score"))
4360      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
4361    if (json.has("_score"))
4362      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
4363  }
4364
4365  protected Bundle.BundleEntryRequestComponent parseBundleEntryRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
4366    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
4367    parseBundleEntryRequestComponentProperties(json, res);
4368    return res;
4369  }
4370
4371  protected void parseBundleEntryRequestComponentProperties(JsonObject json, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
4372    parseBackboneElementProperties(json, res);
4373    if (json.has("method"))
4374      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
4375    if (json.has("_method"))
4376      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
4377    if (json.has("url"))
4378      res.setUrlElement(parseUri(json.get("url").getAsString()));
4379    if (json.has("_url"))
4380      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4381    if (json.has("ifNoneMatch"))
4382      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
4383    if (json.has("_ifNoneMatch"))
4384      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
4385    if (json.has("ifModifiedSince"))
4386      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
4387    if (json.has("_ifModifiedSince"))
4388      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
4389    if (json.has("ifMatch"))
4390      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
4391    if (json.has("_ifMatch"))
4392      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
4393    if (json.has("ifNoneExist"))
4394      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
4395    if (json.has("_ifNoneExist"))
4396      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
4397  }
4398
4399  protected Bundle.BundleEntryResponseComponent parseBundleEntryResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
4400    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
4401    parseBundleEntryResponseComponentProperties(json, res);
4402    return res;
4403  }
4404
4405  protected void parseBundleEntryResponseComponentProperties(JsonObject json, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
4406    parseBackboneElementProperties(json, res);
4407    if (json.has("status"))
4408      res.setStatusElement(parseString(json.get("status").getAsString()));
4409    if (json.has("_status"))
4410      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4411    if (json.has("location"))
4412      res.setLocationElement(parseUri(json.get("location").getAsString()));
4413    if (json.has("_location"))
4414      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
4415    if (json.has("etag"))
4416      res.setEtagElement(parseString(json.get("etag").getAsString()));
4417    if (json.has("_etag"))
4418      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
4419    if (json.has("lastModified"))
4420      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
4421    if (json.has("_lastModified"))
4422      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
4423    if (json.has("outcome"))
4424      res.setOutcome(parseResource(getJObject(json, "outcome")));
4425  }
4426
4427  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
4428    CapabilityStatement res = new CapabilityStatement();
4429    parseCapabilityStatementProperties(json, res);
4430    return res;
4431  }
4432
4433  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
4434    parseCanonicalResourceProperties(json, res);
4435    if (json.has("url"))
4436      res.setUrlElement(parseUri(json.get("url").getAsString()));
4437    if (json.has("_url"))
4438      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4439    if (json.has("version"))
4440      res.setVersionElement(parseString(json.get("version").getAsString()));
4441    if (json.has("_version"))
4442      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4443    DataType versionAlgorithm = parseType("versionAlgorithm", json);
4444    if (versionAlgorithm != null)
4445      res.setVersionAlgorithm(versionAlgorithm);
4446    if (json.has("name"))
4447      res.setNameElement(parseString(json.get("name").getAsString()));
4448    if (json.has("_name"))
4449      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4450    if (json.has("title"))
4451      res.setTitleElement(parseString(json.get("title").getAsString()));
4452    if (json.has("_title"))
4453      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4454    if (json.has("status"))
4455      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4456    if (json.has("_status"))
4457      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4458    if (json.has("experimental"))
4459      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4460    if (json.has("_experimental"))
4461      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
4462    if (json.has("date"))
4463      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4464    if (json.has("_date"))
4465      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4466    if (json.has("publisher"))
4467      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4468    if (json.has("_publisher"))
4469      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
4470    if (json.has("contact")) {
4471      JsonArray array = getJArray(json, "contact");
4472      for (int i = 0; i < array.size(); i++) {
4473        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4474      }
4475    };
4476    if (json.has("description"))
4477      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4478    if (json.has("_description"))
4479      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4480    if (json.has("useContext")) {
4481      JsonArray array = getJArray(json, "useContext");
4482      for (int i = 0; i < array.size(); i++) {
4483        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4484      }
4485    };
4486    if (json.has("jurisdiction")) {
4487      JsonArray array = getJArray(json, "jurisdiction");
4488      for (int i = 0; i < array.size(); i++) {
4489        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4490      }
4491    };
4492    if (json.has("purpose"))
4493      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
4494    if (json.has("_purpose"))
4495      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
4496    if (json.has("copyright"))
4497      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4498    if (json.has("_copyright"))
4499      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
4500    if (json.has("copyrightLabel"))
4501      res.setCopyrightLabelElement(parseString(json.get("copyrightLabel").getAsString()));
4502    if (json.has("_copyrightLabel"))
4503      parseElementProperties(getJObject(json, "_copyrightLabel"), res.getCopyrightLabelElement());
4504    if (json.has("kind"))
4505      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
4506    if (json.has("_kind"))
4507      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
4508    if (json.has("instantiates")) {
4509      JsonArray array = getJArray(json, "instantiates");
4510      for (int i = 0; i < array.size(); i++) {
4511        if (array.get(i).isJsonNull()) {
4512          res.getInstantiates().add(new CanonicalType());
4513        } else {;
4514          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
4515        }
4516      }
4517    };
4518    if (json.has("_instantiates")) {
4519      JsonArray array = getJArray(json, "_instantiates");
4520      for (int i = 0; i < array.size(); i++) {
4521        if (i == res.getInstantiates().size())
4522          res.getInstantiates().add(parseCanonical(null));
4523        if (array.get(i) instanceof JsonObject) 
4524          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
4525      }
4526    };
4527    if (json.has("imports")) {
4528      JsonArray array = getJArray(json, "imports");
4529      for (int i = 0; i < array.size(); i++) {
4530        if (array.get(i).isJsonNull()) {
4531          res.getImports().add(new CanonicalType());
4532        } else {;
4533          res.getImports().add(parseCanonical(array.get(i).getAsString()));
4534        }
4535      }
4536    };
4537    if (json.has("_imports")) {
4538      JsonArray array = getJArray(json, "_imports");
4539      for (int i = 0; i < array.size(); i++) {
4540        if (i == res.getImports().size())
4541          res.getImports().add(parseCanonical(null));
4542        if (array.get(i) instanceof JsonObject) 
4543          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
4544      }
4545    };
4546    if (json.has("software"))
4547      res.setSoftware(parseCapabilityStatementSoftwareComponent(getJObject(json, "software")));
4548    if (json.has("implementation"))
4549      res.setImplementation(parseCapabilityStatementImplementationComponent(getJObject(json, "implementation")));
4550    if (json.has("fhirVersion"))
4551      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
4552    if (json.has("_fhirVersion"))
4553      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
4554    if (json.has("format")) {
4555      JsonArray array = getJArray(json, "format");
4556      for (int i = 0; i < array.size(); i++) {
4557        if (array.get(i).isJsonNull()) {
4558          res.getFormat().add(new CodeType());
4559        } else {;
4560          res.getFormat().add(parseCode(array.get(i).getAsString()));
4561        }
4562      }
4563    };
4564    if (json.has("_format")) {
4565      JsonArray array = getJArray(json, "_format");
4566      for (int i = 0; i < array.size(); i++) {
4567        if (i == res.getFormat().size())
4568          res.getFormat().add(parseCode(null));
4569        if (array.get(i) instanceof JsonObject) 
4570          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
4571      }
4572    };
4573    if (json.has("patchFormat")) {
4574      JsonArray array = getJArray(json, "patchFormat");
4575      for (int i = 0; i < array.size(); i++) {
4576        if (array.get(i).isJsonNull()) {
4577          res.getPatchFormat().add(new CodeType());
4578        } else {;
4579          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
4580        }
4581      }
4582    };
4583    if (json.has("_patchFormat")) {
4584      JsonArray array = getJArray(json, "_patchFormat");
4585      for (int i = 0; i < array.size(); i++) {
4586        if (i == res.getPatchFormat().size())
4587          res.getPatchFormat().add(parseCode(null));
4588        if (array.get(i) instanceof JsonObject) 
4589          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
4590      }
4591    };
4592    if (json.has("acceptLanguage")) {
4593      JsonArray array = getJArray(json, "acceptLanguage");
4594      for (int i = 0; i < array.size(); i++) {
4595        if (array.get(i).isJsonNull()) {
4596          res.getAcceptLanguage().add(new CodeType());
4597        } else {;
4598          res.getAcceptLanguage().add(parseCode(array.get(i).getAsString()));
4599        }
4600      }
4601    };
4602    if (json.has("_acceptLanguage")) {
4603      JsonArray array = getJArray(json, "_acceptLanguage");
4604      for (int i = 0; i < array.size(); i++) {
4605        if (i == res.getAcceptLanguage().size())
4606          res.getAcceptLanguage().add(parseCode(null));
4607        if (array.get(i) instanceof JsonObject) 
4608          parseElementProperties(array.get(i).getAsJsonObject(), res.getAcceptLanguage().get(i));
4609      }
4610    };
4611    if (json.has("implementationGuide")) {
4612      JsonArray array = getJArray(json, "implementationGuide");
4613      for (int i = 0; i < array.size(); i++) {
4614        if (array.get(i).isJsonNull()) {
4615          res.getImplementationGuide().add(new CanonicalType());
4616        } else {;
4617          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
4618        }
4619      }
4620    };
4621    if (json.has("_implementationGuide")) {
4622      JsonArray array = getJArray(json, "_implementationGuide");
4623      for (int i = 0; i < array.size(); i++) {
4624        if (i == res.getImplementationGuide().size())
4625          res.getImplementationGuide().add(parseCanonical(null));
4626        if (array.get(i) instanceof JsonObject) 
4627          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
4628      }
4629    };
4630    if (json.has("rest")) {
4631      JsonArray array = getJArray(json, "rest");
4632      for (int i = 0; i < array.size(); i++) {
4633        res.getRest().add(parseCapabilityStatementRestComponent(array.get(i).getAsJsonObject()));
4634      }
4635    };
4636    if (json.has("messaging")) {
4637      JsonArray array = getJArray(json, "messaging");
4638      for (int i = 0; i < array.size(); i++) {
4639        res.getMessaging().add(parseCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject()));
4640      }
4641    };
4642    if (json.has("document")) {
4643      JsonArray array = getJArray(json, "document");
4644      for (int i = 0; i < array.size(); i++) {
4645        res.getDocument().add(parseCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject()));
4646      }
4647    };
4648  }
4649
4650  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
4651    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
4652    parseCapabilityStatementSoftwareComponentProperties(json, res);
4653    return res;
4654  }
4655
4656  protected void parseCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
4657    parseBackboneElementProperties(json, res);
4658    if (json.has("name"))
4659      res.setNameElement(parseString(json.get("name").getAsString()));
4660    if (json.has("_name"))
4661      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4662    if (json.has("version"))
4663      res.setVersionElement(parseString(json.get("version").getAsString()));
4664    if (json.has("_version"))
4665      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4666    if (json.has("releaseDate"))
4667      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4668    if (json.has("_releaseDate"))
4669      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
4670  }
4671
4672  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
4673    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
4674    parseCapabilityStatementImplementationComponentProperties(json, res);
4675    return res;
4676  }
4677
4678  protected void parseCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
4679    parseBackboneElementProperties(json, res);
4680    if (json.has("description"))
4681      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4682    if (json.has("_description"))
4683      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4684    if (json.has("url"))
4685      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4686    if (json.has("_url"))
4687      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4688    if (json.has("custodian"))
4689      res.setCustodian(parseReference(getJObject(json, "custodian")));
4690  }
4691
4692  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementRestComponent(JsonObject json) throws IOException, FHIRFormatError {
4693    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
4694    parseCapabilityStatementRestComponentProperties(json, res);
4695    return res;
4696  }
4697
4698  protected void parseCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
4699    parseBackboneElementProperties(json, res);
4700    if (json.has("mode"))
4701      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
4702    if (json.has("_mode"))
4703      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4704    if (json.has("documentation"))
4705      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4706    if (json.has("_documentation"))
4707      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4708    if (json.has("security"))
4709      res.setSecurity(parseCapabilityStatementRestSecurityComponent(getJObject(json, "security")));
4710    if (json.has("resource")) {
4711      JsonArray array = getJArray(json, "resource");
4712      for (int i = 0; i < array.size(); i++) {
4713        res.getResource().add(parseCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject()));
4714      }
4715    };
4716    if (json.has("interaction")) {
4717      JsonArray array = getJArray(json, "interaction");
4718      for (int i = 0; i < array.size(); i++) {
4719        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject()));
4720      }
4721    };
4722    if (json.has("searchParam")) {
4723      JsonArray array = getJArray(json, "searchParam");
4724      for (int i = 0; i < array.size(); i++) {
4725        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4726      }
4727    };
4728    if (json.has("operation")) {
4729      JsonArray array = getJArray(json, "operation");
4730      for (int i = 0; i < array.size(); i++) {
4731        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
4732      }
4733    };
4734    if (json.has("compartment")) {
4735      JsonArray array = getJArray(json, "compartment");
4736      for (int i = 0; i < array.size(); i++) {
4737        if (array.get(i).isJsonNull()) {
4738          res.getCompartment().add(new CanonicalType());
4739        } else {;
4740          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4741        }
4742      }
4743    };
4744    if (json.has("_compartment")) {
4745      JsonArray array = getJArray(json, "_compartment");
4746      for (int i = 0; i < array.size(); i++) {
4747        if (i == res.getCompartment().size())
4748          res.getCompartment().add(parseCanonical(null));
4749        if (array.get(i) instanceof JsonObject) 
4750          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4751      }
4752    };
4753  }
4754
4755  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementRestSecurityComponent(JsonObject json) throws IOException, FHIRFormatError {
4756    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
4757    parseCapabilityStatementRestSecurityComponentProperties(json, res);
4758    return res;
4759  }
4760
4761  protected void parseCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
4762    parseBackboneElementProperties(json, res);
4763    if (json.has("cors"))
4764      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
4765    if (json.has("_cors"))
4766      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
4767    if (json.has("service")) {
4768      JsonArray array = getJArray(json, "service");
4769      for (int i = 0; i < array.size(); i++) {
4770        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4771      }
4772    };
4773    if (json.has("description"))
4774      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4775    if (json.has("_description"))
4776      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4777  }
4778
4779  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementRestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
4780    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
4781    parseCapabilityStatementRestResourceComponentProperties(json, res);
4782    return res;
4783  }
4784
4785  protected void parseCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
4786    parseBackboneElementProperties(json, res);
4787    if (json.has("type"))
4788      res.setTypeElement(parseCode(json.get("type").getAsString()));
4789    if (json.has("_type"))
4790      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4791    if (json.has("profile"))
4792      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4793    if (json.has("_profile"))
4794      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4795    if (json.has("supportedProfile")) {
4796      JsonArray array = getJArray(json, "supportedProfile");
4797      for (int i = 0; i < array.size(); i++) {
4798        if (array.get(i).isJsonNull()) {
4799          res.getSupportedProfile().add(new CanonicalType());
4800        } else {;
4801          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4802        }
4803      }
4804    };
4805    if (json.has("_supportedProfile")) {
4806      JsonArray array = getJArray(json, "_supportedProfile");
4807      for (int i = 0; i < array.size(); i++) {
4808        if (i == res.getSupportedProfile().size())
4809          res.getSupportedProfile().add(parseCanonical(null));
4810        if (array.get(i) instanceof JsonObject) 
4811          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4812      }
4813    };
4814    if (json.has("documentation"))
4815      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4816    if (json.has("_documentation"))
4817      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4818    if (json.has("interaction")) {
4819      JsonArray array = getJArray(json, "interaction");
4820      for (int i = 0; i < array.size(); i++) {
4821        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject()));
4822      }
4823    };
4824    if (json.has("versioning"))
4825      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
4826    if (json.has("_versioning"))
4827      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
4828    if (json.has("readHistory"))
4829      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
4830    if (json.has("_readHistory"))
4831      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
4832    if (json.has("updateCreate"))
4833      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
4834    if (json.has("_updateCreate"))
4835      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
4836    if (json.has("conditionalCreate"))
4837      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
4838    if (json.has("_conditionalCreate"))
4839      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
4840    if (json.has("conditionalRead"))
4841      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
4842    if (json.has("_conditionalRead"))
4843      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
4844    if (json.has("conditionalUpdate"))
4845      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
4846    if (json.has("_conditionalUpdate"))
4847      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
4848    if (json.has("conditionalPatch"))
4849      res.setConditionalPatchElement(parseBoolean(json.get("conditionalPatch").getAsBoolean()));
4850    if (json.has("_conditionalPatch"))
4851      parseElementProperties(getJObject(json, "_conditionalPatch"), res.getConditionalPatchElement());
4852    if (json.has("conditionalDelete"))
4853      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
4854    if (json.has("_conditionalDelete"))
4855      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
4856    if (json.has("referencePolicy")) {
4857      JsonArray array = getJArray(json, "referencePolicy");
4858      for (int i = 0; i < array.size(); i++) {
4859        if (array.get(i).isJsonNull()) {
4860          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>(new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), CapabilityStatement.ReferenceHandlingPolicy.NULL));
4861        } else {;
4862          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4863        }
4864      }
4865    };
4866    if (json.has("_referencePolicy")) {
4867      JsonArray array = getJArray(json, "_referencePolicy");
4868      for (int i = 0; i < array.size(); i++) {
4869        if (i == res.getReferencePolicy().size())
4870          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4871        if (array.get(i) instanceof JsonObject) 
4872          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
4873      }
4874    };
4875    if (json.has("searchInclude")) {
4876      JsonArray array = getJArray(json, "searchInclude");
4877      for (int i = 0; i < array.size(); i++) {
4878        if (array.get(i).isJsonNull()) {
4879          res.getSearchInclude().add(new StringType());
4880        } else {;
4881          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
4882        }
4883      }
4884    };
4885    if (json.has("_searchInclude")) {
4886      JsonArray array = getJArray(json, "_searchInclude");
4887      for (int i = 0; i < array.size(); i++) {
4888        if (i == res.getSearchInclude().size())
4889          res.getSearchInclude().add(parseString(null));
4890        if (array.get(i) instanceof JsonObject) 
4891          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
4892      }
4893    };
4894    if (json.has("searchRevInclude")) {
4895      JsonArray array = getJArray(json, "searchRevInclude");
4896      for (int i = 0; i < array.size(); i++) {
4897        if (array.get(i).isJsonNull()) {
4898          res.getSearchRevInclude().add(new StringType());
4899        } else {;
4900          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
4901        }
4902      }
4903    };
4904    if (json.has("_searchRevInclude")) {
4905      JsonArray array = getJArray(json, "_searchRevInclude");
4906      for (int i = 0; i < array.size(); i++) {
4907        if (i == res.getSearchRevInclude().size())
4908          res.getSearchRevInclude().add(parseString(null));
4909        if (array.get(i) instanceof JsonObject) 
4910          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
4911      }
4912    };
4913    if (json.has("searchParam")) {
4914      JsonArray array = getJArray(json, "searchParam");
4915      for (int i = 0; i < array.size(); i++) {
4916        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4917      }
4918    };
4919    if (json.has("operation")) {
4920      JsonArray array = getJArray(json, "operation");
4921      for (int i = 0; i < array.size(); i++) {
4922        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
4923      }
4924    };
4925  }
4926
4927  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4928    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
4929    parseCapabilityStatementResourceInteractionComponentProperties(json, res);
4930    return res;
4931  }
4932
4933  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4934    parseBackboneElementProperties(json, res);
4935    if (json.has("code"))
4936      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
4937    if (json.has("_code"))
4938      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4939    if (json.has("documentation"))
4940      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4941    if (json.has("_documentation"))
4942      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4943  }
4944
4945  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementRestResourceSearchParamComponent(JsonObject json) throws IOException, FHIRFormatError {
4946    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
4947    parseCapabilityStatementRestResourceSearchParamComponentProperties(json, res);
4948    return res;
4949  }
4950
4951  protected void parseCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4952    parseBackboneElementProperties(json, res);
4953    if (json.has("name"))
4954      res.setNameElement(parseString(json.get("name").getAsString()));
4955    if (json.has("_name"))
4956      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4957    if (json.has("definition"))
4958      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4959    if (json.has("_definition"))
4960      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4961    if (json.has("type"))
4962      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4963    if (json.has("_type"))
4964      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4965    if (json.has("documentation"))
4966      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4967    if (json.has("_documentation"))
4968      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4969  }
4970
4971  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementRestResourceOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
4972    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
4973    parseCapabilityStatementRestResourceOperationComponentProperties(json, res);
4974    return res;
4975  }
4976
4977  protected void parseCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
4978    parseBackboneElementProperties(json, res);
4979    if (json.has("name"))
4980      res.setNameElement(parseString(json.get("name").getAsString()));
4981    if (json.has("_name"))
4982      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4983    if (json.has("definition"))
4984      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4985    if (json.has("_definition"))
4986      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4987    if (json.has("documentation"))
4988      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4989    if (json.has("_documentation"))
4990      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4991  }
4992
4993  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4994    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
4995    parseCapabilityStatementSystemInteractionComponentProperties(json, res);
4996    return res;
4997  }
4998
4999  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
5000    parseBackboneElementProperties(json, res);
5001    if (json.has("code"))
5002      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
5003    if (json.has("_code"))
5004      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5005    if (json.has("documentation"))
5006      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5007    if (json.has("_documentation"))
5008      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5009  }
5010
5011  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementMessagingComponent(JsonObject json) throws IOException, FHIRFormatError {
5012    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
5013    parseCapabilityStatementMessagingComponentProperties(json, res);
5014    return res;
5015  }
5016
5017  protected void parseCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
5018    parseBackboneElementProperties(json, res);
5019    if (json.has("endpoint")) {
5020      JsonArray array = getJArray(json, "endpoint");
5021      for (int i = 0; i < array.size(); i++) {
5022        res.getEndpoint().add(parseCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject()));
5023      }
5024    };
5025    if (json.has("reliableCache"))
5026      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
5027    if (json.has("_reliableCache"))
5028      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
5029    if (json.has("documentation"))
5030      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5031    if (json.has("_documentation"))
5032      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5033    if (json.has("supportedMessage")) {
5034      JsonArray array = getJArray(json, "supportedMessage");
5035      for (int i = 0; i < array.size(); i++) {
5036        res.getSupportedMessage().add(parseCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject()));
5037      }
5038    };
5039  }
5040
5041  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementMessagingEndpointComponent(JsonObject json) throws IOException, FHIRFormatError {
5042    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
5043    parseCapabilityStatementMessagingEndpointComponentProperties(json, res);
5044    return res;
5045  }
5046
5047  protected void parseCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
5048    parseBackboneElementProperties(json, res);
5049    if (json.has("protocol"))
5050      res.setProtocol(parseCoding(getJObject(json, "protocol")));
5051    if (json.has("address"))
5052      res.setAddressElement(parseUrl(json.get("address").getAsString()));
5053    if (json.has("_address"))
5054      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
5055  }
5056
5057  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementMessagingSupportedMessageComponent(JsonObject json) throws IOException, FHIRFormatError {
5058    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
5059    parseCapabilityStatementMessagingSupportedMessageComponentProperties(json, res);
5060    return res;
5061  }
5062
5063  protected void parseCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
5064    parseBackboneElementProperties(json, res);
5065    if (json.has("mode"))
5066      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
5067    if (json.has("_mode"))
5068      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
5069    if (json.has("definition"))
5070      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
5071    if (json.has("_definition"))
5072      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
5073  }
5074
5075  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementDocumentComponent(JsonObject json) throws IOException, FHIRFormatError {
5076    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
5077    parseCapabilityStatementDocumentComponentProperties(json, res);
5078    return res;
5079  }
5080
5081  protected void parseCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
5082    parseBackboneElementProperties(json, res);
5083    if (json.has("mode"))
5084      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
5085    if (json.has("_mode"))
5086      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
5087    if (json.has("documentation"))
5088      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
5089    if (json.has("_documentation"))
5090      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5091    if (json.has("profile"))
5092      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
5093    if (json.has("_profile"))
5094      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
5095  }
5096
5097  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
5098    CarePlan res = new CarePlan();
5099    parseCarePlanProperties(json, res);
5100    return res;
5101  }
5102
5103  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
5104    parseDomainResourceProperties(json, res);
5105    if (json.has("identifier")) {
5106      JsonArray array = getJArray(json, "identifier");
5107      for (int i = 0; i < array.size(); i++) {
5108        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5109      }
5110    };
5111    if (json.has("instantiatesCanonical")) {
5112      JsonArray array = getJArray(json, "instantiatesCanonical");
5113      for (int i = 0; i < array.size(); i++) {
5114        if (array.get(i).isJsonNull()) {
5115          res.getInstantiatesCanonical().add(new CanonicalType());
5116        } else {;
5117          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
5118        }
5119      }
5120    };
5121    if (json.has("_instantiatesCanonical")) {
5122      JsonArray array = getJArray(json, "_instantiatesCanonical");
5123      for (int i = 0; i < array.size(); i++) {
5124        if (i == res.getInstantiatesCanonical().size())
5125          res.getInstantiatesCanonical().add(parseCanonical(null));
5126        if (array.get(i) instanceof JsonObject) 
5127          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
5128      }
5129    };
5130    if (json.has("instantiatesUri")) {
5131      JsonArray array = getJArray(json, "instantiatesUri");
5132      for (int i = 0; i < array.size(); i++) {
5133        if (array.get(i).isJsonNull()) {
5134          res.getInstantiatesUri().add(new UriType());
5135        } else {;
5136          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
5137        }
5138      }
5139    };
5140    if (json.has("_instantiatesUri")) {
5141      JsonArray array = getJArray(json, "_instantiatesUri");
5142      for (int i = 0; i < array.size(); i++) {
5143        if (i == res.getInstantiatesUri().size())
5144          res.getInstantiatesUri().add(parseUri(null));
5145        if (array.get(i) instanceof JsonObject) 
5146          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
5147      }
5148    };
5149    if (json.has("basedOn")) {
5150      JsonArray array = getJArray(json, "basedOn");
5151      for (int i = 0; i < array.size(); i++) {
5152        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5153      }
5154    };
5155    if (json.has("replaces")) {
5156      JsonArray array = getJArray(json, "replaces");
5157      for (int i = 0; i < array.size(); i++) {
5158        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5159      }
5160    };
5161    if (json.has("partOf")) {
5162      JsonArray array = getJArray(json, "partOf");
5163      for (int i = 0; i < array.size(); i++) {
5164        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5165      }
5166    };
5167    if (json.has("status"))
5168      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
5169    if (json.has("_status"))
5170      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5171    if (json.has("intent"))
5172      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
5173    if (json.has("_intent"))
5174      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
5175    if (json.has("category")) {
5176      JsonArray array = getJArray(json, "category");
5177      for (int i = 0; i < array.size(); i++) {
5178        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5179      }
5180    };
5181    if (json.has("title"))
5182      res.setTitleElement(parseString(json.get("title").getAsString()));
5183    if (json.has("_title"))
5184      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5185    if (json.has("description"))
5186      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5187    if (json.has("_description"))
5188      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5189    if (json.has("subject"))
5190      res.setSubject(parseReference(getJObject(json, "subject")));
5191    if (json.has("encounter"))
5192      res.setEncounter(parseReference(getJObject(json, "encounter")));
5193    if (json.has("period"))
5194      res.setPeriod(parsePeriod(getJObject(json, "period")));
5195    if (json.has("created"))
5196      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5197    if (json.has("_created"))
5198      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
5199    if (json.has("custodian"))
5200      res.setCustodian(parseReference(getJObject(json, "custodian")));
5201    if (json.has("contributor")) {
5202      JsonArray array = getJArray(json, "contributor");
5203      for (int i = 0; i < array.size(); i++) {
5204        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
5205      }
5206    };
5207    if (json.has("careTeam")) {
5208      JsonArray array = getJArray(json, "careTeam");
5209      for (int i = 0; i < array.size(); i++) {
5210        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
5211      }
5212    };
5213    if (json.has("addresses")) {
5214      JsonArray array = getJArray(json, "addresses");
5215      for (int i = 0; i < array.size(); i++) {
5216        res.getAddresses().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5217      }
5218    };
5219    if (json.has("supportingInfo")) {
5220      JsonArray array = getJArray(json, "supportingInfo");
5221      for (int i = 0; i < array.size(); i++) {
5222        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
5223      }
5224    };
5225    if (json.has("goal")) {
5226      JsonArray array = getJArray(json, "goal");
5227      for (int i = 0; i < array.size(); i++) {
5228        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
5229      }
5230    };
5231    if (json.has("activity")) {
5232      JsonArray array = getJArray(json, "activity");
5233      for (int i = 0; i < array.size(); i++) {
5234        res.getActivity().add(parseCarePlanActivityComponent(array.get(i).getAsJsonObject()));
5235      }
5236    };
5237    if (json.has("note")) {
5238      JsonArray array = getJArray(json, "note");
5239      for (int i = 0; i < array.size(); i++) {
5240        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5241      }
5242    };
5243  }
5244
5245  protected CarePlan.CarePlanActivityComponent parseCarePlanActivityComponent(JsonObject json) throws IOException, FHIRFormatError {
5246    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
5247    parseCarePlanActivityComponentProperties(json, res);
5248    return res;
5249  }
5250
5251  protected void parseCarePlanActivityComponentProperties(JsonObject json, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
5252    parseBackboneElementProperties(json, res);
5253    if (json.has("performedActivity")) {
5254      JsonArray array = getJArray(json, "performedActivity");
5255      for (int i = 0; i < array.size(); i++) {
5256        res.getPerformedActivity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5257      }
5258    };
5259    if (json.has("progress")) {
5260      JsonArray array = getJArray(json, "progress");
5261      for (int i = 0; i < array.size(); i++) {
5262        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
5263      }
5264    };
5265    if (json.has("plannedActivityReference"))
5266      res.setPlannedActivityReference(parseReference(getJObject(json, "plannedActivityReference")));
5267    if (json.has("plannedActivityDetail"))
5268      res.setPlannedActivityDetail(parseCarePlanActivityPlannedActivityDetailComponent(getJObject(json, "plannedActivityDetail")));
5269  }
5270
5271  protected CarePlan.CarePlanActivityPlannedActivityDetailComponent parseCarePlanActivityPlannedActivityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
5272    CarePlan.CarePlanActivityPlannedActivityDetailComponent res = new CarePlan.CarePlanActivityPlannedActivityDetailComponent();
5273    parseCarePlanActivityPlannedActivityDetailComponentProperties(json, res);
5274    return res;
5275  }
5276
5277  protected void parseCarePlanActivityPlannedActivityDetailComponentProperties(JsonObject json, CarePlan.CarePlanActivityPlannedActivityDetailComponent res) throws IOException, FHIRFormatError {
5278    parseBackboneElementProperties(json, res);
5279    if (json.has("kind"))
5280      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
5281    if (json.has("_kind"))
5282      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
5283    if (json.has("instantiatesCanonical")) {
5284      JsonArray array = getJArray(json, "instantiatesCanonical");
5285      for (int i = 0; i < array.size(); i++) {
5286        if (array.get(i).isJsonNull()) {
5287          res.getInstantiatesCanonical().add(new CanonicalType());
5288        } else {;
5289          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
5290        }
5291      }
5292    };
5293    if (json.has("_instantiatesCanonical")) {
5294      JsonArray array = getJArray(json, "_instantiatesCanonical");
5295      for (int i = 0; i < array.size(); i++) {
5296        if (i == res.getInstantiatesCanonical().size())
5297          res.getInstantiatesCanonical().add(parseCanonical(null));
5298        if (array.get(i) instanceof JsonObject) 
5299          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
5300      }
5301    };
5302    if (json.has("instantiatesUri")) {
5303      JsonArray array = getJArray(json, "instantiatesUri");
5304      for (int i = 0; i < array.size(); i++) {
5305        if (array.get(i).isJsonNull()) {
5306          res.getInstantiatesUri().add(new UriType());
5307        } else {;
5308          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
5309        }
5310      }
5311    };
5312    if (json.has("_instantiatesUri")) {
5313      JsonArray array = getJArray(json, "_instantiatesUri");
5314      for (int i = 0; i < array.size(); i++) {
5315        if (i == res.getInstantiatesUri().size())
5316          res.getInstantiatesUri().add(parseUri(null));
5317        if (array.get(i) instanceof JsonObject) 
5318          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
5319      }
5320    };
5321    if (json.has("code"))
5322      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5323    if (json.has("reason")) {
5324      JsonArray array = getJArray(json, "reason");
5325      for (int i = 0; i < array.size(); i++) {
5326        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5327      }
5328    };
5329    if (json.has("goal")) {
5330      JsonArray array = getJArray(json, "goal");
5331      for (int i = 0; i < array.size(); i++) {
5332        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
5333      }
5334    };
5335    if (json.has("status"))
5336      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
5337    if (json.has("_status"))
5338      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5339    if (json.has("statusReason"))
5340      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
5341    if (json.has("doNotPerform"))
5342      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
5343    if (json.has("_doNotPerform"))
5344      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
5345    DataType scheduled = parseType("scheduled", json);
5346    if (scheduled != null)
5347      res.setScheduled(scheduled);
5348    if (json.has("location"))
5349      res.setLocation(parseCodeableReference(getJObject(json, "location")));
5350    DataType reported = parseType("reported", json);
5351    if (reported != null)
5352      res.setReported(reported);
5353    if (json.has("performer")) {
5354      JsonArray array = getJArray(json, "performer");
5355      for (int i = 0; i < array.size(); i++) {
5356        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
5357      }
5358    };
5359    DataType product = parseType("product", json);
5360    if (product != null)
5361      res.setProduct(product);
5362    if (json.has("dailyAmount"))
5363      res.setDailyAmount(parseQuantity(getJObject(json, "dailyAmount")));
5364    if (json.has("quantity"))
5365      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5366    if (json.has("description"))
5367      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5368    if (json.has("_description"))
5369      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5370  }
5371
5372  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
5373    CareTeam res = new CareTeam();
5374    parseCareTeamProperties(json, res);
5375    return res;
5376  }
5377
5378  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
5379    parseDomainResourceProperties(json, res);
5380    if (json.has("identifier")) {
5381      JsonArray array = getJArray(json, "identifier");
5382      for (int i = 0; i < array.size(); i++) {
5383        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5384      }
5385    };
5386    if (json.has("status"))
5387      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
5388    if (json.has("_status"))
5389      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5390    if (json.has("category")) {
5391      JsonArray array = getJArray(json, "category");
5392      for (int i = 0; i < array.size(); i++) {
5393        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5394      }
5395    };
5396    if (json.has("name"))
5397      res.setNameElement(parseString(json.get("name").getAsString()));
5398    if (json.has("_name"))
5399      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5400    if (json.has("subject"))
5401      res.setSubject(parseReference(getJObject(json, "subject")));
5402    if (json.has("period"))
5403      res.setPeriod(parsePeriod(getJObject(json, "period")));
5404    if (json.has("participant")) {
5405      JsonArray array = getJArray(json, "participant");
5406      for (int i = 0; i < array.size(); i++) {
5407        res.getParticipant().add(parseCareTeamParticipantComponent(array.get(i).getAsJsonObject()));
5408      }
5409    };
5410    if (json.has("reason")) {
5411      JsonArray array = getJArray(json, "reason");
5412      for (int i = 0; i < array.size(); i++) {
5413        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5414      }
5415    };
5416    if (json.has("managingOrganization")) {
5417      JsonArray array = getJArray(json, "managingOrganization");
5418      for (int i = 0; i < array.size(); i++) {
5419        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
5420      }
5421    };
5422    if (json.has("telecom")) {
5423      JsonArray array = getJArray(json, "telecom");
5424      for (int i = 0; i < array.size(); i++) {
5425        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5426      }
5427    };
5428    if (json.has("note")) {
5429      JsonArray array = getJArray(json, "note");
5430      for (int i = 0; i < array.size(); i++) {
5431        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5432      }
5433    };
5434  }
5435
5436  protected CareTeam.CareTeamParticipantComponent parseCareTeamParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
5437    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
5438    parseCareTeamParticipantComponentProperties(json, res);
5439    return res;
5440  }
5441
5442  protected void parseCareTeamParticipantComponentProperties(JsonObject json, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
5443    parseBackboneElementProperties(json, res);
5444    if (json.has("role"))
5445      res.setRole(parseCodeableConcept(getJObject(json, "role")));
5446    if (json.has("member"))
5447      res.setMember(parseReference(getJObject(json, "member")));
5448    if (json.has("onBehalfOf"))
5449      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
5450    DataType coverage = parseType("coverage", json);
5451    if (coverage != null)
5452      res.setCoverage(coverage);
5453  }
5454
5455  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
5456    ChargeItem res = new ChargeItem();
5457    parseChargeItemProperties(json, res);
5458    return res;
5459  }
5460
5461  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
5462    parseDomainResourceProperties(json, res);
5463    if (json.has("identifier")) {
5464      JsonArray array = getJArray(json, "identifier");
5465      for (int i = 0; i < array.size(); i++) {
5466        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5467      }
5468    };
5469    if (json.has("definitionUri")) {
5470      JsonArray array = getJArray(json, "definitionUri");
5471      for (int i = 0; i < array.size(); i++) {
5472        if (array.get(i).isJsonNull()) {
5473          res.getDefinitionUri().add(new UriType());
5474        } else {;
5475          res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
5476        }
5477      }
5478    };
5479    if (json.has("_definitionUri")) {
5480      JsonArray array = getJArray(json, "_definitionUri");
5481      for (int i = 0; i < array.size(); i++) {
5482        if (i == res.getDefinitionUri().size())
5483          res.getDefinitionUri().add(parseUri(null));
5484        if (array.get(i) instanceof JsonObject) 
5485          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
5486      }
5487    };
5488    if (json.has("definitionCanonical")) {
5489      JsonArray array = getJArray(json, "definitionCanonical");
5490      for (int i = 0; i < array.size(); i++) {
5491        if (array.get(i).isJsonNull()) {
5492          res.getDefinitionCanonical().add(new CanonicalType());
5493        } else {;
5494          res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
5495        }
5496      }
5497    };
5498    if (json.has("_definitionCanonical")) {
5499      JsonArray array = getJArray(json, "_definitionCanonical");
5500      for (int i = 0; i < array.size(); i++) {
5501        if (i == res.getDefinitionCanonical().size())
5502          res.getDefinitionCanonical().add(parseCanonical(null));
5503        if (array.get(i) instanceof JsonObject) 
5504          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
5505      }
5506    };
5507    if (json.has("status"))
5508      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
5509    if (json.has("_status"))
5510      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5511    if (json.has("partOf")) {
5512      JsonArray array = getJArray(json, "partOf");
5513      for (int i = 0; i < array.size(); i++) {
5514        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5515      }
5516    };
5517    if (json.has("code"))
5518      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5519    if (json.has("subject"))
5520      res.setSubject(parseReference(getJObject(json, "subject")));
5521    if (json.has("encounter"))
5522      res.setEncounter(parseReference(getJObject(json, "encounter")));
5523    DataType occurrence = parseType("occurrence", json);
5524    if (occurrence != null)
5525      res.setOccurrence(occurrence);
5526    if (json.has("performer")) {
5527      JsonArray array = getJArray(json, "performer");
5528      for (int i = 0; i < array.size(); i++) {
5529        res.getPerformer().add(parseChargeItemPerformerComponent(array.get(i).getAsJsonObject()));
5530      }
5531    };
5532    if (json.has("performingOrganization"))
5533      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
5534    if (json.has("requestingOrganization"))
5535      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
5536    if (json.has("costCenter"))
5537      res.setCostCenter(parseReference(getJObject(json, "costCenter")));
5538    if (json.has("quantity"))
5539      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5540    if (json.has("bodysite")) {
5541      JsonArray array = getJArray(json, "bodysite");
5542      for (int i = 0; i < array.size(); i++) {
5543        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5544      }
5545    };
5546    if (json.has("unitPriceComponent"))
5547      res.setUnitPriceComponent(parseMonetaryComponent(getJObject(json, "unitPriceComponent")));
5548    if (json.has("totalPriceComponent"))
5549      res.setTotalPriceComponent(parseMonetaryComponent(getJObject(json, "totalPriceComponent")));
5550    if (json.has("overrideReason"))
5551      res.setOverrideReason(parseCodeableConcept(getJObject(json, "overrideReason")));
5552    if (json.has("enterer"))
5553      res.setEnterer(parseReference(getJObject(json, "enterer")));
5554    if (json.has("enteredDate"))
5555      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
5556    if (json.has("_enteredDate"))
5557      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
5558    if (json.has("reason")) {
5559      JsonArray array = getJArray(json, "reason");
5560      for (int i = 0; i < array.size(); i++) {
5561        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5562      }
5563    };
5564    if (json.has("service")) {
5565      JsonArray array = getJArray(json, "service");
5566      for (int i = 0; i < array.size(); i++) {
5567        res.getService().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5568      }
5569    };
5570    if (json.has("product")) {
5571      JsonArray array = getJArray(json, "product");
5572      for (int i = 0; i < array.size(); i++) {
5573        res.getProduct().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5574      }
5575    };
5576    if (json.has("account")) {
5577      JsonArray array = getJArray(json, "account");
5578      for (int i = 0; i < array.size(); i++) {
5579        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
5580      }
5581    };
5582    if (json.has("note")) {
5583      JsonArray array = getJArray(json, "note");
5584      for (int i = 0; i < array.size(); i++) {
5585        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5586      }
5587    };
5588    if (json.has("supportingInformation")) {
5589      JsonArray array = getJArray(json, "supportingInformation");
5590      for (int i = 0; i < array.size(); i++) {
5591        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
5592      }
5593    };
5594  }
5595
5596  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
5597    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
5598    parseChargeItemPerformerComponentProperties(json, res);
5599    return res;
5600  }
5601
5602  protected void parseChargeItemPerformerComponentProperties(JsonObject json, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
5603    parseBackboneElementProperties(json, res);
5604    if (json.has("function"))
5605      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
5606    if (json.has("actor"))
5607      res.setActor(parseReference(getJObject(json, "actor")));
5608  }
5609
5610  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
5611    ChargeItemDefinition res = new ChargeItemDefinition();
5612    parseChargeItemDefinitionProperties(json, res);
5613    return res;
5614  }
5615
5616  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
5617    parseMetadataResourceProperties(json, res);
5618    if (json.has("url"))
5619      res.setUrlElement(parseUri(json.get("url").getAsString()));
5620    if (json.has("_url"))
5621      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5622    if (json.has("identifier")) {
5623      JsonArray array = getJArray(json, "identifier");
5624      for (int i = 0; i < array.size(); i++) {
5625        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5626      }
5627    };
5628    if (json.has("version"))
5629      res.setVersionElement(parseString(json.get("version").getAsString()));
5630    if (json.has("_version"))
5631      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5632    if (json.has("name"))
5633      res.setNameElement(parseString(json.get("name").getAsString()));
5634    if (json.has("_name"))
5635      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5636    if (json.has("title"))
5637      res.setTitleElement(parseString(json.get("title").getAsString()));
5638    if (json.has("_title"))
5639      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5640    if (json.has("derivedFromUri")) {
5641      JsonArray array = getJArray(json, "derivedFromUri");
5642      for (int i = 0; i < array.size(); i++) {
5643        if (array.get(i).isJsonNull()) {
5644          res.getDerivedFromUri().add(new UriType());
5645        } else {;
5646          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
5647        }
5648      }
5649    };
5650    if (json.has("_derivedFromUri")) {
5651      JsonArray array = getJArray(json, "_derivedFromUri");
5652      for (int i = 0; i < array.size(); i++) {
5653        if (i == res.getDerivedFromUri().size())
5654          res.getDerivedFromUri().add(parseUri(null));
5655        if (array.get(i) instanceof JsonObject) 
5656          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
5657      }
5658    };
5659    if (json.has("partOf")) {
5660      JsonArray array = getJArray(json, "partOf");
5661      for (int i = 0; i < array.size(); i++) {
5662        if (array.get(i).isJsonNull()) {
5663          res.getPartOf().add(new CanonicalType());
5664        } else {;
5665          res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
5666        }
5667      }
5668    };
5669    if (json.has("_partOf")) {
5670      JsonArray array = getJArray(json, "_partOf");
5671      for (int i = 0; i < array.size(); i++) {
5672        if (i == res.getPartOf().size())
5673          res.getPartOf().add(parseCanonical(null));
5674        if (array.get(i) instanceof JsonObject) 
5675          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
5676      }
5677    };
5678    if (json.has("replaces")) {
5679      JsonArray array = getJArray(json, "replaces");
5680      for (int i = 0; i < array.size(); i++) {
5681        if (array.get(i).isJsonNull()) {
5682          res.getReplaces().add(new CanonicalType());
5683        } else {;
5684          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
5685        }
5686      }
5687    };
5688    if (json.has("_replaces")) {
5689      JsonArray array = getJArray(json, "_replaces");
5690      for (int i = 0; i < array.size(); i++) {
5691        if (i == res.getReplaces().size())
5692          res.getReplaces().add(parseCanonical(null));
5693        if (array.get(i) instanceof JsonObject) 
5694          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
5695      }
5696    };
5697    if (json.has("status"))
5698      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5699    if (json.has("_status"))
5700      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5701    if (json.has("experimental"))
5702      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5703    if (json.has("_experimental"))
5704      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5705    if (json.has("date"))
5706      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5707    if (json.has("_date"))
5708      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5709    if (json.has("publisher"))
5710      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5711    if (json.has("_publisher"))
5712      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5713    if (json.has("contact")) {
5714      JsonArray array = getJArray(json, "contact");
5715      for (int i = 0; i < array.size(); i++) {
5716        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5717      }
5718    };
5719    if (json.has("description"))
5720      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5721    if (json.has("_description"))
5722      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5723    if (json.has("useContext")) {
5724      JsonArray array = getJArray(json, "useContext");
5725      for (int i = 0; i < array.size(); i++) {
5726        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5727      }
5728    };
5729    if (json.has("jurisdiction")) {
5730      JsonArray array = getJArray(json, "jurisdiction");
5731      for (int i = 0; i < array.size(); i++) {
5732        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5733      }
5734    };
5735    if (json.has("purpose"))
5736      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5737    if (json.has("_purpose"))
5738      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5739    if (json.has("copyright"))
5740      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5741    if (json.has("_copyright"))
5742      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5743    if (json.has("approvalDate"))
5744      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5745    if (json.has("_approvalDate"))
5746      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
5747    if (json.has("lastReviewDate"))
5748      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5749    if (json.has("_lastReviewDate"))
5750      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
5751    if (json.has("code"))
5752      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5753    if (json.has("instance")) {
5754      JsonArray array = getJArray(json, "instance");
5755      for (int i = 0; i < array.size(); i++) {
5756        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
5757      }
5758    };
5759    if (json.has("applicability")) {
5760      JsonArray array = getJArray(json, "applicability");
5761      for (int i = 0; i < array.size(); i++) {
5762        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5763      }
5764    };
5765    if (json.has("propertyGroup")) {
5766      JsonArray array = getJArray(json, "propertyGroup");
5767      for (int i = 0; i < array.size(); i++) {
5768        res.getPropertyGroup().add(parseChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject()));
5769      }
5770    };
5771  }
5772
5773  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionApplicabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
5774    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
5775    parseChargeItemDefinitionApplicabilityComponentProperties(json, res);
5776    return res;
5777  }
5778
5779  protected void parseChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
5780    parseBackboneElementProperties(json, res);
5781    if (json.has("condition"))
5782      res.setCondition(parseExpression(getJObject(json, "condition")));
5783    if (json.has("effectivePeriod"))
5784      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
5785    if (json.has("relatedArtifact"))
5786      res.setRelatedArtifact(parseRelatedArtifact(getJObject(json, "relatedArtifact")));
5787  }
5788
5789  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionPropertyGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
5790    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
5791    parseChargeItemDefinitionPropertyGroupComponentProperties(json, res);
5792    return res;
5793  }
5794
5795  protected void parseChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
5796    parseBackboneElementProperties(json, res);
5797    if (json.has("applicability")) {
5798      JsonArray array = getJArray(json, "applicability");
5799      for (int i = 0; i < array.size(); i++) {
5800        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5801      }
5802    };
5803    if (json.has("priceComponent")) {
5804      JsonArray array = getJArray(json, "priceComponent");
5805      for (int i = 0; i < array.size(); i++) {
5806        res.getPriceComponent().add(parseMonetaryComponent(array.get(i).getAsJsonObject()));
5807      }
5808    };
5809  }
5810
5811  protected Citation parseCitation(JsonObject json) throws IOException, FHIRFormatError {
5812    Citation res = new Citation();
5813    parseCitationProperties(json, res);
5814    return res;
5815  }
5816
5817  protected void parseCitationProperties(JsonObject json, Citation res) throws IOException, FHIRFormatError {
5818    parseMetadataResourceProperties(json, res);
5819    if (json.has("url"))
5820      res.setUrlElement(parseUri(json.get("url").getAsString()));
5821    if (json.has("_url"))
5822      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5823    if (json.has("identifier")) {
5824      JsonArray array = getJArray(json, "identifier");
5825      for (int i = 0; i < array.size(); i++) {
5826        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5827      }
5828    };
5829    if (json.has("version"))
5830      res.setVersionElement(parseString(json.get("version").getAsString()));
5831    if (json.has("_version"))
5832      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5833    if (json.has("name"))
5834      res.setNameElement(parseString(json.get("name").getAsString()));
5835    if (json.has("_name"))
5836      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5837    if (json.has("title"))
5838      res.setTitleElement(parseString(json.get("title").getAsString()));
5839    if (json.has("_title"))
5840      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5841    if (json.has("status"))
5842      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5843    if (json.has("_status"))
5844      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5845    if (json.has("experimental"))
5846      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5847    if (json.has("_experimental"))
5848      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5849    if (json.has("date"))
5850      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5851    if (json.has("_date"))
5852      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5853    if (json.has("publisher"))
5854      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5855    if (json.has("_publisher"))
5856      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5857    if (json.has("contact")) {
5858      JsonArray array = getJArray(json, "contact");
5859      for (int i = 0; i < array.size(); i++) {
5860        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5861      }
5862    };
5863    if (json.has("description"))
5864      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5865    if (json.has("_description"))
5866      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5867    if (json.has("useContext")) {
5868      JsonArray array = getJArray(json, "useContext");
5869      for (int i = 0; i < array.size(); i++) {
5870        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5871      }
5872    };
5873    if (json.has("jurisdiction")) {
5874      JsonArray array = getJArray(json, "jurisdiction");
5875      for (int i = 0; i < array.size(); i++) {
5876        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5877      }
5878    };
5879    if (json.has("purpose"))
5880      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5881    if (json.has("_purpose"))
5882      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5883    if (json.has("copyright"))
5884      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5885    if (json.has("_copyright"))
5886      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5887    if (json.has("approvalDate"))
5888      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5889    if (json.has("_approvalDate"))
5890      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
5891    if (json.has("lastReviewDate"))
5892      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5893    if (json.has("_lastReviewDate"))
5894      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
5895    if (json.has("effectivePeriod"))
5896      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
5897    if (json.has("author")) {
5898      JsonArray array = getJArray(json, "author");
5899      for (int i = 0; i < array.size(); i++) {
5900        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
5901      }
5902    };
5903    if (json.has("editor")) {
5904      JsonArray array = getJArray(json, "editor");
5905      for (int i = 0; i < array.size(); i++) {
5906        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
5907      }
5908    };
5909    if (json.has("reviewer")) {
5910      JsonArray array = getJArray(json, "reviewer");
5911      for (int i = 0; i < array.size(); i++) {
5912        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
5913      }
5914    };
5915    if (json.has("endorser")) {
5916      JsonArray array = getJArray(json, "endorser");
5917      for (int i = 0; i < array.size(); i++) {
5918        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
5919      }
5920    };
5921    if (json.has("summary")) {
5922      JsonArray array = getJArray(json, "summary");
5923      for (int i = 0; i < array.size(); i++) {
5924        res.getSummary().add(parseCitationSummaryComponent(array.get(i).getAsJsonObject()));
5925      }
5926    };
5927    if (json.has("classification")) {
5928      JsonArray array = getJArray(json, "classification");
5929      for (int i = 0; i < array.size(); i++) {
5930        res.getClassification().add(parseCitationClassificationComponent(array.get(i).getAsJsonObject()));
5931      }
5932    };
5933    if (json.has("note")) {
5934      JsonArray array = getJArray(json, "note");
5935      for (int i = 0; i < array.size(); i++) {
5936        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5937      }
5938    };
5939    if (json.has("currentState")) {
5940      JsonArray array = getJArray(json, "currentState");
5941      for (int i = 0; i < array.size(); i++) {
5942        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5943      }
5944    };
5945    if (json.has("statusDate")) {
5946      JsonArray array = getJArray(json, "statusDate");
5947      for (int i = 0; i < array.size(); i++) {
5948        res.getStatusDate().add(parseCitationStatusDateComponent(array.get(i).getAsJsonObject()));
5949      }
5950    };
5951    if (json.has("relatedArtifact")) {
5952      JsonArray array = getJArray(json, "relatedArtifact");
5953      for (int i = 0; i < array.size(); i++) {
5954        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
5955      }
5956    };
5957    if (json.has("citedArtifact"))
5958      res.setCitedArtifact(parseCitationCitedArtifactComponent(getJObject(json, "citedArtifact")));
5959  }
5960
5961  protected Citation.CitationSummaryComponent parseCitationSummaryComponent(JsonObject json) throws IOException, FHIRFormatError {
5962    Citation.CitationSummaryComponent res = new Citation.CitationSummaryComponent();
5963    parseCitationSummaryComponentProperties(json, res);
5964    return res;
5965  }
5966
5967  protected void parseCitationSummaryComponentProperties(JsonObject json, Citation.CitationSummaryComponent res) throws IOException, FHIRFormatError {
5968    parseBackboneElementProperties(json, res);
5969    if (json.has("style"))
5970      res.setStyle(parseCodeableConcept(getJObject(json, "style")));
5971    if (json.has("text"))
5972      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
5973    if (json.has("_text"))
5974      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
5975  }
5976
5977  protected Citation.CitationClassificationComponent parseCitationClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
5978    Citation.CitationClassificationComponent res = new Citation.CitationClassificationComponent();
5979    parseCitationClassificationComponentProperties(json, res);
5980    return res;
5981  }
5982
5983  protected void parseCitationClassificationComponentProperties(JsonObject json, Citation.CitationClassificationComponent res) throws IOException, FHIRFormatError {
5984    parseBackboneElementProperties(json, res);
5985    if (json.has("type"))
5986      res.setType(parseCodeableConcept(getJObject(json, "type")));
5987    if (json.has("classifier")) {
5988      JsonArray array = getJArray(json, "classifier");
5989      for (int i = 0; i < array.size(); i++) {
5990        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5991      }
5992    };
5993  }
5994
5995  protected Citation.CitationStatusDateComponent parseCitationStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
5996    Citation.CitationStatusDateComponent res = new Citation.CitationStatusDateComponent();
5997    parseCitationStatusDateComponentProperties(json, res);
5998    return res;
5999  }
6000
6001  protected void parseCitationStatusDateComponentProperties(JsonObject json, Citation.CitationStatusDateComponent res) throws IOException, FHIRFormatError {
6002    parseBackboneElementProperties(json, res);
6003    if (json.has("activity"))
6004      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
6005    if (json.has("actual"))
6006      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
6007    if (json.has("_actual"))
6008      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
6009    if (json.has("period"))
6010      res.setPeriod(parsePeriod(getJObject(json, "period")));
6011  }
6012
6013  protected Citation.CitationCitedArtifactComponent parseCitationCitedArtifactComponent(JsonObject json) throws IOException, FHIRFormatError {
6014    Citation.CitationCitedArtifactComponent res = new Citation.CitationCitedArtifactComponent();
6015    parseCitationCitedArtifactComponentProperties(json, res);
6016    return res;
6017  }
6018
6019  protected void parseCitationCitedArtifactComponentProperties(JsonObject json, Citation.CitationCitedArtifactComponent res) throws IOException, FHIRFormatError {
6020    parseBackboneElementProperties(json, res);
6021    if (json.has("identifier")) {
6022      JsonArray array = getJArray(json, "identifier");
6023      for (int i = 0; i < array.size(); i++) {
6024        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6025      }
6026    };
6027    if (json.has("relatedIdentifier")) {
6028      JsonArray array = getJArray(json, "relatedIdentifier");
6029      for (int i = 0; i < array.size(); i++) {
6030        res.getRelatedIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6031      }
6032    };
6033    if (json.has("dateAccessed"))
6034      res.setDateAccessedElement(parseDateTime(json.get("dateAccessed").getAsString()));
6035    if (json.has("_dateAccessed"))
6036      parseElementProperties(getJObject(json, "_dateAccessed"), res.getDateAccessedElement());
6037    if (json.has("version"))
6038      res.setVersion(parseCitationCitedArtifactVersionComponent(getJObject(json, "version")));
6039    if (json.has("currentState")) {
6040      JsonArray array = getJArray(json, "currentState");
6041      for (int i = 0; i < array.size(); i++) {
6042        res.getCurrentState().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6043      }
6044    };
6045    if (json.has("statusDate")) {
6046      JsonArray array = getJArray(json, "statusDate");
6047      for (int i = 0; i < array.size(); i++) {
6048        res.getStatusDate().add(parseCitationCitedArtifactStatusDateComponent(array.get(i).getAsJsonObject()));
6049      }
6050    };
6051    if (json.has("title")) {
6052      JsonArray array = getJArray(json, "title");
6053      for (int i = 0; i < array.size(); i++) {
6054        res.getTitle().add(parseCitationCitedArtifactTitleComponent(array.get(i).getAsJsonObject()));
6055      }
6056    };
6057    if (json.has("abstract")) {
6058      JsonArray array = getJArray(json, "abstract");
6059      for (int i = 0; i < array.size(); i++) {
6060        res.getAbstract().add(parseCitationCitedArtifactAbstractComponent(array.get(i).getAsJsonObject()));
6061      }
6062    };
6063    if (json.has("part"))
6064      res.setPart(parseCitationCitedArtifactPartComponent(getJObject(json, "part")));
6065    if (json.has("relatesTo")) {
6066      JsonArray array = getJArray(json, "relatesTo");
6067      for (int i = 0; i < array.size(); i++) {
6068        res.getRelatesTo().add(parseCitationCitedArtifactRelatesToComponent(array.get(i).getAsJsonObject()));
6069      }
6070    };
6071    if (json.has("publicationForm")) {
6072      JsonArray array = getJArray(json, "publicationForm");
6073      for (int i = 0; i < array.size(); i++) {
6074        res.getPublicationForm().add(parseCitationCitedArtifactPublicationFormComponent(array.get(i).getAsJsonObject()));
6075      }
6076    };
6077    if (json.has("webLocation")) {
6078      JsonArray array = getJArray(json, "webLocation");
6079      for (int i = 0; i < array.size(); i++) {
6080        res.getWebLocation().add(parseCitationCitedArtifactWebLocationComponent(array.get(i).getAsJsonObject()));
6081      }
6082    };
6083    if (json.has("classification")) {
6084      JsonArray array = getJArray(json, "classification");
6085      for (int i = 0; i < array.size(); i++) {
6086        res.getClassification().add(parseCitationCitedArtifactClassificationComponent(array.get(i).getAsJsonObject()));
6087      }
6088    };
6089    if (json.has("contributorship"))
6090      res.setContributorship(parseCitationCitedArtifactContributorshipComponent(getJObject(json, "contributorship")));
6091    if (json.has("note")) {
6092      JsonArray array = getJArray(json, "note");
6093      for (int i = 0; i < array.size(); i++) {
6094        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6095      }
6096    };
6097  }
6098
6099  protected Citation.CitationCitedArtifactVersionComponent parseCitationCitedArtifactVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
6100    Citation.CitationCitedArtifactVersionComponent res = new Citation.CitationCitedArtifactVersionComponent();
6101    parseCitationCitedArtifactVersionComponentProperties(json, res);
6102    return res;
6103  }
6104
6105  protected void parseCitationCitedArtifactVersionComponentProperties(JsonObject json, Citation.CitationCitedArtifactVersionComponent res) throws IOException, FHIRFormatError {
6106    parseBackboneElementProperties(json, res);
6107    if (json.has("value"))
6108      res.setValueElement(parseString(json.get("value").getAsString()));
6109    if (json.has("_value"))
6110      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6111    if (json.has("baseCitation"))
6112      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
6113  }
6114
6115  protected Citation.CitationCitedArtifactStatusDateComponent parseCitationCitedArtifactStatusDateComponent(JsonObject json) throws IOException, FHIRFormatError {
6116    Citation.CitationCitedArtifactStatusDateComponent res = new Citation.CitationCitedArtifactStatusDateComponent();
6117    parseCitationCitedArtifactStatusDateComponentProperties(json, res);
6118    return res;
6119  }
6120
6121  protected void parseCitationCitedArtifactStatusDateComponentProperties(JsonObject json, Citation.CitationCitedArtifactStatusDateComponent res) throws IOException, FHIRFormatError {
6122    parseBackboneElementProperties(json, res);
6123    if (json.has("activity"))
6124      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
6125    if (json.has("actual"))
6126      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
6127    if (json.has("_actual"))
6128      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
6129    if (json.has("period"))
6130      res.setPeriod(parsePeriod(getJObject(json, "period")));
6131  }
6132
6133  protected Citation.CitationCitedArtifactTitleComponent parseCitationCitedArtifactTitleComponent(JsonObject json) throws IOException, FHIRFormatError {
6134    Citation.CitationCitedArtifactTitleComponent res = new Citation.CitationCitedArtifactTitleComponent();
6135    parseCitationCitedArtifactTitleComponentProperties(json, res);
6136    return res;
6137  }
6138
6139  protected void parseCitationCitedArtifactTitleComponentProperties(JsonObject json, Citation.CitationCitedArtifactTitleComponent res) throws IOException, FHIRFormatError {
6140    parseBackboneElementProperties(json, res);
6141    if (json.has("type")) {
6142      JsonArray array = getJArray(json, "type");
6143      for (int i = 0; i < array.size(); i++) {
6144        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6145      }
6146    };
6147    if (json.has("language"))
6148      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6149    if (json.has("text"))
6150      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
6151    if (json.has("_text"))
6152      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6153  }
6154
6155  protected Citation.CitationCitedArtifactAbstractComponent parseCitationCitedArtifactAbstractComponent(JsonObject json) throws IOException, FHIRFormatError {
6156    Citation.CitationCitedArtifactAbstractComponent res = new Citation.CitationCitedArtifactAbstractComponent();
6157    parseCitationCitedArtifactAbstractComponentProperties(json, res);
6158    return res;
6159  }
6160
6161  protected void parseCitationCitedArtifactAbstractComponentProperties(JsonObject json, Citation.CitationCitedArtifactAbstractComponent res) throws IOException, FHIRFormatError {
6162    parseBackboneElementProperties(json, res);
6163    if (json.has("type"))
6164      res.setType(parseCodeableConcept(getJObject(json, "type")));
6165    if (json.has("language"))
6166      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6167    if (json.has("text"))
6168      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
6169    if (json.has("_text"))
6170      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6171    if (json.has("copyright"))
6172      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6173    if (json.has("_copyright"))
6174      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6175  }
6176
6177  protected Citation.CitationCitedArtifactPartComponent parseCitationCitedArtifactPartComponent(JsonObject json) throws IOException, FHIRFormatError {
6178    Citation.CitationCitedArtifactPartComponent res = new Citation.CitationCitedArtifactPartComponent();
6179    parseCitationCitedArtifactPartComponentProperties(json, res);
6180    return res;
6181  }
6182
6183  protected void parseCitationCitedArtifactPartComponentProperties(JsonObject json, Citation.CitationCitedArtifactPartComponent res) throws IOException, FHIRFormatError {
6184    parseBackboneElementProperties(json, res);
6185    if (json.has("type"))
6186      res.setType(parseCodeableConcept(getJObject(json, "type")));
6187    if (json.has("value"))
6188      res.setValueElement(parseString(json.get("value").getAsString()));
6189    if (json.has("_value"))
6190      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6191    if (json.has("baseCitation"))
6192      res.setBaseCitation(parseReference(getJObject(json, "baseCitation")));
6193  }
6194
6195  protected Citation.CitationCitedArtifactRelatesToComponent parseCitationCitedArtifactRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
6196    Citation.CitationCitedArtifactRelatesToComponent res = new Citation.CitationCitedArtifactRelatesToComponent();
6197    parseCitationCitedArtifactRelatesToComponentProperties(json, res);
6198    return res;
6199  }
6200
6201  protected void parseCitationCitedArtifactRelatesToComponentProperties(JsonObject json, Citation.CitationCitedArtifactRelatesToComponent res) throws IOException, FHIRFormatError {
6202    parseBackboneElementProperties(json, res);
6203    if (json.has("type"))
6204      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Citation.RelatedArtifactTypeExpanded.NULL, new Citation.RelatedArtifactTypeExpandedEnumFactory()));
6205    if (json.has("_type"))
6206      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6207    if (json.has("classifier")) {
6208      JsonArray array = getJArray(json, "classifier");
6209      for (int i = 0; i < array.size(); i++) {
6210        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6211      }
6212    };
6213    if (json.has("label"))
6214      res.setLabelElement(parseString(json.get("label").getAsString()));
6215    if (json.has("_label"))
6216      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
6217    if (json.has("display"))
6218      res.setDisplayElement(parseString(json.get("display").getAsString()));
6219    if (json.has("_display"))
6220      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6221    if (json.has("citation"))
6222      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
6223    if (json.has("_citation"))
6224      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
6225    if (json.has("document"))
6226      res.setDocument(parseAttachment(getJObject(json, "document")));
6227    if (json.has("resource"))
6228      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
6229    if (json.has("_resource"))
6230      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
6231    if (json.has("resourceReference"))
6232      res.setResourceReference(parseReference(getJObject(json, "resourceReference")));
6233  }
6234
6235  protected Citation.CitationCitedArtifactPublicationFormComponent parseCitationCitedArtifactPublicationFormComponent(JsonObject json) throws IOException, FHIRFormatError {
6236    Citation.CitationCitedArtifactPublicationFormComponent res = new Citation.CitationCitedArtifactPublicationFormComponent();
6237    parseCitationCitedArtifactPublicationFormComponentProperties(json, res);
6238    return res;
6239  }
6240
6241  protected void parseCitationCitedArtifactPublicationFormComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormComponent res) throws IOException, FHIRFormatError {
6242    parseBackboneElementProperties(json, res);
6243    if (json.has("publishedIn"))
6244      res.setPublishedIn(parseCitationCitedArtifactPublicationFormPublishedInComponent(getJObject(json, "publishedIn")));
6245    if (json.has("citedMedium"))
6246      res.setCitedMedium(parseCodeableConcept(getJObject(json, "citedMedium")));
6247    if (json.has("volume"))
6248      res.setVolumeElement(parseString(json.get("volume").getAsString()));
6249    if (json.has("_volume"))
6250      parseElementProperties(getJObject(json, "_volume"), res.getVolumeElement());
6251    if (json.has("issue"))
6252      res.setIssueElement(parseString(json.get("issue").getAsString()));
6253    if (json.has("_issue"))
6254      parseElementProperties(getJObject(json, "_issue"), res.getIssueElement());
6255    if (json.has("publicationDateYear"))
6256      res.setPublicationDateYearElement(parseString(json.get("publicationDateYear").getAsString()));
6257    if (json.has("_publicationDateYear"))
6258      parseElementProperties(getJObject(json, "_publicationDateYear"), res.getPublicationDateYearElement());
6259    if (json.has("publicationDateMonth"))
6260      res.setPublicationDateMonthElement(parseString(json.get("publicationDateMonth").getAsString()));
6261    if (json.has("_publicationDateMonth"))
6262      parseElementProperties(getJObject(json, "_publicationDateMonth"), res.getPublicationDateMonthElement());
6263    if (json.has("publicationDateDay"))
6264      res.setPublicationDateDayElement(parseString(json.get("publicationDateDay").getAsString()));
6265    if (json.has("_publicationDateDay"))
6266      parseElementProperties(getJObject(json, "_publicationDateDay"), res.getPublicationDateDayElement());
6267    if (json.has("publicationDateSeason"))
6268      res.setPublicationDateSeasonElement(parseString(json.get("publicationDateSeason").getAsString()));
6269    if (json.has("_publicationDateSeason"))
6270      parseElementProperties(getJObject(json, "_publicationDateSeason"), res.getPublicationDateSeasonElement());
6271    if (json.has("publicationDateText"))
6272      res.setPublicationDateTextElement(parseString(json.get("publicationDateText").getAsString()));
6273    if (json.has("_publicationDateText"))
6274      parseElementProperties(getJObject(json, "_publicationDateText"), res.getPublicationDateTextElement());
6275    if (json.has("articleDate"))
6276      res.setArticleDateElement(parseDateTime(json.get("articleDate").getAsString()));
6277    if (json.has("_articleDate"))
6278      parseElementProperties(getJObject(json, "_articleDate"), res.getArticleDateElement());
6279    if (json.has("lastRevisionDate"))
6280      res.setLastRevisionDateElement(parseDateTime(json.get("lastRevisionDate").getAsString()));
6281    if (json.has("_lastRevisionDate"))
6282      parseElementProperties(getJObject(json, "_lastRevisionDate"), res.getLastRevisionDateElement());
6283    if (json.has("language")) {
6284      JsonArray array = getJArray(json, "language");
6285      for (int i = 0; i < array.size(); i++) {
6286        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6287      }
6288    };
6289    if (json.has("accessionNumber"))
6290      res.setAccessionNumberElement(parseString(json.get("accessionNumber").getAsString()));
6291    if (json.has("_accessionNumber"))
6292      parseElementProperties(getJObject(json, "_accessionNumber"), res.getAccessionNumberElement());
6293    if (json.has("pageString"))
6294      res.setPageStringElement(parseString(json.get("pageString").getAsString()));
6295    if (json.has("_pageString"))
6296      parseElementProperties(getJObject(json, "_pageString"), res.getPageStringElement());
6297    if (json.has("firstPage"))
6298      res.setFirstPageElement(parseString(json.get("firstPage").getAsString()));
6299    if (json.has("_firstPage"))
6300      parseElementProperties(getJObject(json, "_firstPage"), res.getFirstPageElement());
6301    if (json.has("lastPage"))
6302      res.setLastPageElement(parseString(json.get("lastPage").getAsString()));
6303    if (json.has("_lastPage"))
6304      parseElementProperties(getJObject(json, "_lastPage"), res.getLastPageElement());
6305    if (json.has("pageCount"))
6306      res.setPageCountElement(parseString(json.get("pageCount").getAsString()));
6307    if (json.has("_pageCount"))
6308      parseElementProperties(getJObject(json, "_pageCount"), res.getPageCountElement());
6309    if (json.has("copyright"))
6310      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6311    if (json.has("_copyright"))
6312      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6313  }
6314
6315  protected Citation.CitationCitedArtifactPublicationFormPublishedInComponent parseCitationCitedArtifactPublicationFormPublishedInComponent(JsonObject json) throws IOException, FHIRFormatError {
6316    Citation.CitationCitedArtifactPublicationFormPublishedInComponent res = new Citation.CitationCitedArtifactPublicationFormPublishedInComponent();
6317    parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(json, res);
6318    return res;
6319  }
6320
6321  protected void parseCitationCitedArtifactPublicationFormPublishedInComponentProperties(JsonObject json, Citation.CitationCitedArtifactPublicationFormPublishedInComponent res) throws IOException, FHIRFormatError {
6322    parseBackboneElementProperties(json, res);
6323    if (json.has("type"))
6324      res.setType(parseCodeableConcept(getJObject(json, "type")));
6325    if (json.has("identifier")) {
6326      JsonArray array = getJArray(json, "identifier");
6327      for (int i = 0; i < array.size(); i++) {
6328        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6329      }
6330    };
6331    if (json.has("title"))
6332      res.setTitleElement(parseString(json.get("title").getAsString()));
6333    if (json.has("_title"))
6334      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6335    if (json.has("publisher"))
6336      res.setPublisher(parseReference(getJObject(json, "publisher")));
6337    if (json.has("publisherLocation"))
6338      res.setPublisherLocationElement(parseString(json.get("publisherLocation").getAsString()));
6339    if (json.has("_publisherLocation"))
6340      parseElementProperties(getJObject(json, "_publisherLocation"), res.getPublisherLocationElement());
6341  }
6342
6343  protected Citation.CitationCitedArtifactWebLocationComponent parseCitationCitedArtifactWebLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
6344    Citation.CitationCitedArtifactWebLocationComponent res = new Citation.CitationCitedArtifactWebLocationComponent();
6345    parseCitationCitedArtifactWebLocationComponentProperties(json, res);
6346    return res;
6347  }
6348
6349  protected void parseCitationCitedArtifactWebLocationComponentProperties(JsonObject json, Citation.CitationCitedArtifactWebLocationComponent res) throws IOException, FHIRFormatError {
6350    parseBackboneElementProperties(json, res);
6351    if (json.has("classifier")) {
6352      JsonArray array = getJArray(json, "classifier");
6353      for (int i = 0; i < array.size(); i++) {
6354        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6355      }
6356    };
6357    if (json.has("url"))
6358      res.setUrlElement(parseUri(json.get("url").getAsString()));
6359    if (json.has("_url"))
6360      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6361  }
6362
6363  protected Citation.CitationCitedArtifactClassificationComponent parseCitationCitedArtifactClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
6364    Citation.CitationCitedArtifactClassificationComponent res = new Citation.CitationCitedArtifactClassificationComponent();
6365    parseCitationCitedArtifactClassificationComponentProperties(json, res);
6366    return res;
6367  }
6368
6369  protected void parseCitationCitedArtifactClassificationComponentProperties(JsonObject json, Citation.CitationCitedArtifactClassificationComponent res) throws IOException, FHIRFormatError {
6370    parseBackboneElementProperties(json, res);
6371    if (json.has("type"))
6372      res.setType(parseCodeableConcept(getJObject(json, "type")));
6373    if (json.has("classifier")) {
6374      JsonArray array = getJArray(json, "classifier");
6375      for (int i = 0; i < array.size(); i++) {
6376        res.getClassifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6377      }
6378    };
6379    if (json.has("artifactAssessment")) {
6380      JsonArray array = getJArray(json, "artifactAssessment");
6381      for (int i = 0; i < array.size(); i++) {
6382        res.getArtifactAssessment().add(parseReference(array.get(i).getAsJsonObject()));
6383      }
6384    };
6385  }
6386
6387  protected Citation.CitationCitedArtifactContributorshipComponent parseCitationCitedArtifactContributorshipComponent(JsonObject json) throws IOException, FHIRFormatError {
6388    Citation.CitationCitedArtifactContributorshipComponent res = new Citation.CitationCitedArtifactContributorshipComponent();
6389    parseCitationCitedArtifactContributorshipComponentProperties(json, res);
6390    return res;
6391  }
6392
6393  protected void parseCitationCitedArtifactContributorshipComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipComponent res) throws IOException, FHIRFormatError {
6394    parseBackboneElementProperties(json, res);
6395    if (json.has("complete"))
6396      res.setCompleteElement(parseBoolean(json.get("complete").getAsBoolean()));
6397    if (json.has("_complete"))
6398      parseElementProperties(getJObject(json, "_complete"), res.getCompleteElement());
6399    if (json.has("entry")) {
6400      JsonArray array = getJArray(json, "entry");
6401      for (int i = 0; i < array.size(); i++) {
6402        res.getEntry().add(parseCitationCitedArtifactContributorshipEntryComponent(array.get(i).getAsJsonObject()));
6403      }
6404    };
6405    if (json.has("summary")) {
6406      JsonArray array = getJArray(json, "summary");
6407      for (int i = 0; i < array.size(); i++) {
6408        res.getSummary().add(parseCitationContributorshipSummaryComponent(array.get(i).getAsJsonObject()));
6409      }
6410    };
6411  }
6412
6413  protected Citation.CitationCitedArtifactContributorshipEntryComponent parseCitationCitedArtifactContributorshipEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
6414    Citation.CitationCitedArtifactContributorshipEntryComponent res = new Citation.CitationCitedArtifactContributorshipEntryComponent();
6415    parseCitationCitedArtifactContributorshipEntryComponentProperties(json, res);
6416    return res;
6417  }
6418
6419  protected void parseCitationCitedArtifactContributorshipEntryComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryComponent res) throws IOException, FHIRFormatError {
6420    parseBackboneElementProperties(json, res);
6421    if (json.has("contributor"))
6422      res.setContributor(parseReference(getJObject(json, "contributor")));
6423    if (json.has("forenameInitials"))
6424      res.setForenameInitialsElement(parseString(json.get("forenameInitials").getAsString()));
6425    if (json.has("_forenameInitials"))
6426      parseElementProperties(getJObject(json, "_forenameInitials"), res.getForenameInitialsElement());
6427    if (json.has("affiliation")) {
6428      JsonArray array = getJArray(json, "affiliation");
6429      for (int i = 0; i < array.size(); i++) {
6430        res.getAffiliation().add(parseReference(array.get(i).getAsJsonObject()));
6431      }
6432    };
6433    if (json.has("contributionType")) {
6434      JsonArray array = getJArray(json, "contributionType");
6435      for (int i = 0; i < array.size(); i++) {
6436        res.getContributionType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6437      }
6438    };
6439    if (json.has("role"))
6440      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6441    if (json.has("contributionInstance")) {
6442      JsonArray array = getJArray(json, "contributionInstance");
6443      for (int i = 0; i < array.size(); i++) {
6444        res.getContributionInstance().add(parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(array.get(i).getAsJsonObject()));
6445      }
6446    };
6447    if (json.has("correspondingContact"))
6448      res.setCorrespondingContactElement(parseBoolean(json.get("correspondingContact").getAsBoolean()));
6449    if (json.has("_correspondingContact"))
6450      parseElementProperties(getJObject(json, "_correspondingContact"), res.getCorrespondingContactElement());
6451    if (json.has("rankingOrder"))
6452      res.setRankingOrderElement(parsePositiveInt(json.get("rankingOrder").getAsString()));
6453    if (json.has("_rankingOrder"))
6454      parseElementProperties(getJObject(json, "_rankingOrder"), res.getRankingOrderElement());
6455  }
6456
6457  protected Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
6458    Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res = new Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent();
6459    parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(json, res);
6460    return res;
6461  }
6462
6463  protected void parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentProperties(JsonObject json, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res) throws IOException, FHIRFormatError {
6464    parseBackboneElementProperties(json, res);
6465    if (json.has("type"))
6466      res.setType(parseCodeableConcept(getJObject(json, "type")));
6467    if (json.has("time"))
6468      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6469    if (json.has("_time"))
6470      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
6471  }
6472
6473  protected Citation.ContributorshipSummaryComponent parseCitationContributorshipSummaryComponent(JsonObject json) throws IOException, FHIRFormatError {
6474    Citation.ContributorshipSummaryComponent res = new Citation.ContributorshipSummaryComponent();
6475    parseCitationContributorshipSummaryComponentProperties(json, res);
6476    return res;
6477  }
6478
6479  protected void parseCitationContributorshipSummaryComponentProperties(JsonObject json, Citation.ContributorshipSummaryComponent res) throws IOException, FHIRFormatError {
6480    parseBackboneElementProperties(json, res);
6481    if (json.has("type"))
6482      res.setType(parseCodeableConcept(getJObject(json, "type")));
6483    if (json.has("style"))
6484      res.setStyle(parseCodeableConcept(getJObject(json, "style")));
6485    if (json.has("source"))
6486      res.setSource(parseCodeableConcept(getJObject(json, "source")));
6487    if (json.has("value"))
6488      res.setValueElement(parseMarkdown(json.get("value").getAsString()));
6489    if (json.has("_value"))
6490      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6491  }
6492
6493  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
6494    Claim res = new Claim();
6495    parseClaimProperties(json, res);
6496    return res;
6497  }
6498
6499  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
6500    parseDomainResourceProperties(json, res);
6501    if (json.has("identifier")) {
6502      JsonArray array = getJArray(json, "identifier");
6503      for (int i = 0; i < array.size(); i++) {
6504        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6505      }
6506    };
6507    if (json.has("status"))
6508      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
6509    if (json.has("_status"))
6510      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6511    if (json.has("type"))
6512      res.setType(parseCodeableConcept(getJObject(json, "type")));
6513    if (json.has("subType"))
6514      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6515    if (json.has("use"))
6516      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
6517    if (json.has("_use"))
6518      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
6519    if (json.has("patient"))
6520      res.setPatient(parseReference(getJObject(json, "patient")));
6521    if (json.has("billablePeriod"))
6522      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
6523    if (json.has("created"))
6524      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6525    if (json.has("_created"))
6526      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
6527    if (json.has("enterer"))
6528      res.setEnterer(parseReference(getJObject(json, "enterer")));
6529    if (json.has("insurer"))
6530      res.setInsurer(parseReference(getJObject(json, "insurer")));
6531    if (json.has("provider"))
6532      res.setProvider(parseReference(getJObject(json, "provider")));
6533    if (json.has("priority"))
6534      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
6535    if (json.has("fundsReserve"))
6536      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
6537    if (json.has("related")) {
6538      JsonArray array = getJArray(json, "related");
6539      for (int i = 0; i < array.size(); i++) {
6540        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject()));
6541      }
6542    };
6543    if (json.has("prescription"))
6544      res.setPrescription(parseReference(getJObject(json, "prescription")));
6545    if (json.has("originalPrescription"))
6546      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
6547    if (json.has("payee"))
6548      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee")));
6549    if (json.has("referral"))
6550      res.setReferral(parseReference(getJObject(json, "referral")));
6551    if (json.has("encounter")) {
6552      JsonArray array = getJArray(json, "encounter");
6553      for (int i = 0; i < array.size(); i++) {
6554        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
6555      }
6556    };
6557    if (json.has("facility"))
6558      res.setFacility(parseReference(getJObject(json, "facility")));
6559    if (json.has("diagnosisRelatedGroup"))
6560      res.setDiagnosisRelatedGroup(parseCodeableConcept(getJObject(json, "diagnosisRelatedGroup")));
6561    if (json.has("careTeam")) {
6562      JsonArray array = getJArray(json, "careTeam");
6563      for (int i = 0; i < array.size(); i++) {
6564        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject()));
6565      }
6566    };
6567    if (json.has("supportingInfo")) {
6568      JsonArray array = getJArray(json, "supportingInfo");
6569      for (int i = 0; i < array.size(); i++) {
6570        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject()));
6571      }
6572    };
6573    if (json.has("diagnosis")) {
6574      JsonArray array = getJArray(json, "diagnosis");
6575      for (int i = 0; i < array.size(); i++) {
6576        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject()));
6577      }
6578    };
6579    if (json.has("procedure")) {
6580      JsonArray array = getJArray(json, "procedure");
6581      for (int i = 0; i < array.size(); i++) {
6582        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject()));
6583      }
6584    };
6585    if (json.has("insurance")) {
6586      JsonArray array = getJArray(json, "insurance");
6587      for (int i = 0; i < array.size(); i++) {
6588        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject()));
6589      }
6590    };
6591    if (json.has("accident"))
6592      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident")));
6593    if (json.has("patientPaid"))
6594      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
6595    if (json.has("item")) {
6596      JsonArray array = getJArray(json, "item");
6597      for (int i = 0; i < array.size(); i++) {
6598        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject()));
6599      }
6600    };
6601    if (json.has("total"))
6602      res.setTotal(parseMoney(getJObject(json, "total")));
6603  }
6604
6605  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
6606    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
6607    parseClaimRelatedClaimComponentProperties(json, res);
6608    return res;
6609  }
6610
6611  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
6612    parseBackboneElementProperties(json, res);
6613    if (json.has("claim"))
6614      res.setClaim(parseReference(getJObject(json, "claim")));
6615    if (json.has("relationship"))
6616      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
6617    if (json.has("reference"))
6618      res.setReference(parseIdentifier(getJObject(json, "reference")));
6619  }
6620
6621  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
6622    Claim.PayeeComponent res = new Claim.PayeeComponent();
6623    parseClaimPayeeComponentProperties(json, res);
6624    return res;
6625  }
6626
6627  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
6628    parseBackboneElementProperties(json, res);
6629    if (json.has("type"))
6630      res.setType(parseCodeableConcept(getJObject(json, "type")));
6631    if (json.has("party"))
6632      res.setParty(parseReference(getJObject(json, "party")));
6633  }
6634
6635  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
6636    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
6637    parseClaimCareTeamComponentProperties(json, res);
6638    return res;
6639  }
6640
6641  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
6642    parseBackboneElementProperties(json, res);
6643    if (json.has("sequence"))
6644      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6645    if (json.has("_sequence"))
6646      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6647    if (json.has("provider"))
6648      res.setProvider(parseReference(getJObject(json, "provider")));
6649    if (json.has("responsible"))
6650      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
6651    if (json.has("_responsible"))
6652      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
6653    if (json.has("role"))
6654      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6655    if (json.has("specialty"))
6656      res.setSpecialty(parseCodeableConcept(getJObject(json, "specialty")));
6657  }
6658
6659  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
6660    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
6661    parseClaimSupportingInformationComponentProperties(json, res);
6662    return res;
6663  }
6664
6665  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
6666    parseBackboneElementProperties(json, res);
6667    if (json.has("sequence"))
6668      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6669    if (json.has("_sequence"))
6670      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6671    if (json.has("category"))
6672      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6673    if (json.has("code"))
6674      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6675    DataType timing = parseType("timing", json);
6676    if (timing != null)
6677      res.setTiming(timing);
6678    DataType value = parseType("value", json);
6679    if (value != null)
6680      res.setValue(value);
6681    if (json.has("reason"))
6682      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
6683  }
6684
6685  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
6686    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
6687    parseClaimDiagnosisComponentProperties(json, res);
6688    return res;
6689  }
6690
6691  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
6692    parseBackboneElementProperties(json, res);
6693    if (json.has("sequence"))
6694      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6695    if (json.has("_sequence"))
6696      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6697    DataType diagnosis = parseType("diagnosis", json);
6698    if (diagnosis != null)
6699      res.setDiagnosis(diagnosis);
6700    if (json.has("type")) {
6701      JsonArray array = getJArray(json, "type");
6702      for (int i = 0; i < array.size(); i++) {
6703        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6704      }
6705    };
6706    if (json.has("onAdmission"))
6707      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
6708  }
6709
6710  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
6711    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
6712    parseClaimProcedureComponentProperties(json, res);
6713    return res;
6714  }
6715
6716  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
6717    parseBackboneElementProperties(json, res);
6718    if (json.has("sequence"))
6719      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6720    if (json.has("_sequence"))
6721      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6722    if (json.has("type")) {
6723      JsonArray array = getJArray(json, "type");
6724      for (int i = 0; i < array.size(); i++) {
6725        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6726      }
6727    };
6728    if (json.has("date"))
6729      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6730    if (json.has("_date"))
6731      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6732    DataType procedure = parseType("procedure", json);
6733    if (procedure != null)
6734      res.setProcedure(procedure);
6735    if (json.has("udi")) {
6736      JsonArray array = getJArray(json, "udi");
6737      for (int i = 0; i < array.size(); i++) {
6738        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6739      }
6740    };
6741  }
6742
6743  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
6744    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
6745    parseClaimInsuranceComponentProperties(json, res);
6746    return res;
6747  }
6748
6749  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
6750    parseBackboneElementProperties(json, res);
6751    if (json.has("sequence"))
6752      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6753    if (json.has("_sequence"))
6754      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6755    if (json.has("focal"))
6756      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6757    if (json.has("_focal"))
6758      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
6759    if (json.has("identifier"))
6760      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6761    if (json.has("coverage"))
6762      res.setCoverage(parseReference(getJObject(json, "coverage")));
6763    if (json.has("businessArrangement"))
6764      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6765    if (json.has("_businessArrangement"))
6766      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
6767    if (json.has("preAuthRef")) {
6768      JsonArray array = getJArray(json, "preAuthRef");
6769      for (int i = 0; i < array.size(); i++) {
6770        if (array.get(i).isJsonNull()) {
6771          res.getPreAuthRef().add(new StringType());
6772        } else {;
6773          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
6774        }
6775      }
6776    };
6777    if (json.has("_preAuthRef")) {
6778      JsonArray array = getJArray(json, "_preAuthRef");
6779      for (int i = 0; i < array.size(); i++) {
6780        if (i == res.getPreAuthRef().size())
6781          res.getPreAuthRef().add(parseString(null));
6782        if (array.get(i) instanceof JsonObject) 
6783          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
6784      }
6785    };
6786    if (json.has("claimResponse"))
6787      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
6788  }
6789
6790  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
6791    Claim.AccidentComponent res = new Claim.AccidentComponent();
6792    parseClaimAccidentComponentProperties(json, res);
6793    return res;
6794  }
6795
6796  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
6797    parseBackboneElementProperties(json, res);
6798    if (json.has("date"))
6799      res.setDateElement(parseDate(json.get("date").getAsString()));
6800    if (json.has("_date"))
6801      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6802    if (json.has("type"))
6803      res.setType(parseCodeableConcept(getJObject(json, "type")));
6804    DataType location = parseType("location", json);
6805    if (location != null)
6806      res.setLocation(location);
6807  }
6808
6809  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6810    Claim.ItemComponent res = new Claim.ItemComponent();
6811    parseClaimItemComponentProperties(json, res);
6812    return res;
6813  }
6814
6815  protected void parseClaimItemComponentProperties(JsonObject json, Claim.ItemComponent res) throws IOException, FHIRFormatError {
6816    parseBackboneElementProperties(json, res);
6817    if (json.has("sequence"))
6818      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6819    if (json.has("_sequence"))
6820      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6821    if (json.has("careTeamSequence")) {
6822      JsonArray array = getJArray(json, "careTeamSequence");
6823      for (int i = 0; i < array.size(); i++) {
6824        if (array.get(i).isJsonNull()) {
6825          res.getCareTeamSequence().add(new PositiveIntType());
6826        } else {;
6827          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
6828        }
6829      }
6830    };
6831    if (json.has("_careTeamSequence")) {
6832      JsonArray array = getJArray(json, "_careTeamSequence");
6833      for (int i = 0; i < array.size(); i++) {
6834        if (i == res.getCareTeamSequence().size())
6835          res.getCareTeamSequence().add(parsePositiveInt(null));
6836        if (array.get(i) instanceof JsonObject) 
6837          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
6838      }
6839    };
6840    if (json.has("diagnosisSequence")) {
6841      JsonArray array = getJArray(json, "diagnosisSequence");
6842      for (int i = 0; i < array.size(); i++) {
6843        if (array.get(i).isJsonNull()) {
6844          res.getDiagnosisSequence().add(new PositiveIntType());
6845        } else {;
6846          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
6847        }
6848      }
6849    };
6850    if (json.has("_diagnosisSequence")) {
6851      JsonArray array = getJArray(json, "_diagnosisSequence");
6852      for (int i = 0; i < array.size(); i++) {
6853        if (i == res.getDiagnosisSequence().size())
6854          res.getDiagnosisSequence().add(parsePositiveInt(null));
6855        if (array.get(i) instanceof JsonObject) 
6856          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
6857      }
6858    };
6859    if (json.has("procedureSequence")) {
6860      JsonArray array = getJArray(json, "procedureSequence");
6861      for (int i = 0; i < array.size(); i++) {
6862        if (array.get(i).isJsonNull()) {
6863          res.getProcedureSequence().add(new PositiveIntType());
6864        } else {;
6865          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
6866        }
6867      }
6868    };
6869    if (json.has("_procedureSequence")) {
6870      JsonArray array = getJArray(json, "_procedureSequence");
6871      for (int i = 0; i < array.size(); i++) {
6872        if (i == res.getProcedureSequence().size())
6873          res.getProcedureSequence().add(parsePositiveInt(null));
6874        if (array.get(i) instanceof JsonObject) 
6875          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
6876      }
6877    };
6878    if (json.has("informationSequence")) {
6879      JsonArray array = getJArray(json, "informationSequence");
6880      for (int i = 0; i < array.size(); i++) {
6881        if (array.get(i).isJsonNull()) {
6882          res.getInformationSequence().add(new PositiveIntType());
6883        } else {;
6884          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
6885        }
6886      }
6887    };
6888    if (json.has("_informationSequence")) {
6889      JsonArray array = getJArray(json, "_informationSequence");
6890      for (int i = 0; i < array.size(); i++) {
6891        if (i == res.getInformationSequence().size())
6892          res.getInformationSequence().add(parsePositiveInt(null));
6893        if (array.get(i) instanceof JsonObject) 
6894          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
6895      }
6896    };
6897    if (json.has("revenue"))
6898      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6899    if (json.has("category"))
6900      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6901    if (json.has("productOrService"))
6902      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6903    if (json.has("productOrServiceEnd"))
6904      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
6905    if (json.has("modifier")) {
6906      JsonArray array = getJArray(json, "modifier");
6907      for (int i = 0; i < array.size(); i++) {
6908        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6909      }
6910    };
6911    if (json.has("programCode")) {
6912      JsonArray array = getJArray(json, "programCode");
6913      for (int i = 0; i < array.size(); i++) {
6914        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6915      }
6916    };
6917    DataType serviced = parseType("serviced", json);
6918    if (serviced != null)
6919      res.setServiced(serviced);
6920    DataType location = parseType("location", json);
6921    if (location != null)
6922      res.setLocation(location);
6923    if (json.has("patientPaid"))
6924      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
6925    if (json.has("quantity"))
6926      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6927    if (json.has("unitPrice"))
6928      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6929    if (json.has("factor"))
6930      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6931    if (json.has("_factor"))
6932      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6933    if (json.has("tax"))
6934      res.setTax(parseMoney(getJObject(json, "tax")));
6935    if (json.has("net"))
6936      res.setNet(parseMoney(getJObject(json, "net")));
6937    if (json.has("udi")) {
6938      JsonArray array = getJArray(json, "udi");
6939      for (int i = 0; i < array.size(); i++) {
6940        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6941      }
6942    };
6943    if (json.has("bodySite")) {
6944      JsonArray array = getJArray(json, "bodySite");
6945      for (int i = 0; i < array.size(); i++) {
6946        res.getBodySite().add(parseClaimBodySiteComponent(array.get(i).getAsJsonObject()));
6947      }
6948    };
6949    if (json.has("encounter")) {
6950      JsonArray array = getJArray(json, "encounter");
6951      for (int i = 0; i < array.size(); i++) {
6952        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
6953      }
6954    };
6955    if (json.has("detail")) {
6956      JsonArray array = getJArray(json, "detail");
6957      for (int i = 0; i < array.size(); i++) {
6958        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject()));
6959      }
6960    };
6961  }
6962
6963  protected Claim.BodySiteComponent parseClaimBodySiteComponent(JsonObject json) throws IOException, FHIRFormatError {
6964    Claim.BodySiteComponent res = new Claim.BodySiteComponent();
6965    parseClaimBodySiteComponentProperties(json, res);
6966    return res;
6967  }
6968
6969  protected void parseClaimBodySiteComponentProperties(JsonObject json, Claim.BodySiteComponent res) throws IOException, FHIRFormatError {
6970    parseBackboneElementProperties(json, res);
6971    if (json.has("site")) {
6972      JsonArray array = getJArray(json, "site");
6973      for (int i = 0; i < array.size(); i++) {
6974        res.getSite().add(parseCodeableReference(array.get(i).getAsJsonObject()));
6975      }
6976    };
6977    if (json.has("subSite")) {
6978      JsonArray array = getJArray(json, "subSite");
6979      for (int i = 0; i < array.size(); i++) {
6980        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6981      }
6982    };
6983  }
6984
6985  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6986    Claim.DetailComponent res = new Claim.DetailComponent();
6987    parseClaimDetailComponentProperties(json, res);
6988    return res;
6989  }
6990
6991  protected void parseClaimDetailComponentProperties(JsonObject json, Claim.DetailComponent res) throws IOException, FHIRFormatError {
6992    parseBackboneElementProperties(json, res);
6993    if (json.has("sequence"))
6994      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6995    if (json.has("_sequence"))
6996      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6997    if (json.has("revenue"))
6998      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6999    if (json.has("category"))
7000      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7001    if (json.has("productOrService"))
7002      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7003    if (json.has("productOrServiceEnd"))
7004      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7005    if (json.has("modifier")) {
7006      JsonArray array = getJArray(json, "modifier");
7007      for (int i = 0; i < array.size(); i++) {
7008        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7009      }
7010    };
7011    if (json.has("programCode")) {
7012      JsonArray array = getJArray(json, "programCode");
7013      for (int i = 0; i < array.size(); i++) {
7014        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7015      }
7016    };
7017    if (json.has("patientPaid"))
7018      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
7019    if (json.has("quantity"))
7020      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7021    if (json.has("unitPrice"))
7022      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7023    if (json.has("factor"))
7024      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7025    if (json.has("_factor"))
7026      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7027    if (json.has("tax"))
7028      res.setTax(parseMoney(getJObject(json, "tax")));
7029    if (json.has("net"))
7030      res.setNet(parseMoney(getJObject(json, "net")));
7031    if (json.has("udi")) {
7032      JsonArray array = getJArray(json, "udi");
7033      for (int i = 0; i < array.size(); i++) {
7034        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7035      }
7036    };
7037    if (json.has("subDetail")) {
7038      JsonArray array = getJArray(json, "subDetail");
7039      for (int i = 0; i < array.size(); i++) {
7040        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject()));
7041      }
7042    };
7043  }
7044
7045  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7046    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
7047    parseClaimSubDetailComponentProperties(json, res);
7048    return res;
7049  }
7050
7051  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
7052    parseBackboneElementProperties(json, res);
7053    if (json.has("sequence"))
7054      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7055    if (json.has("_sequence"))
7056      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
7057    if (json.has("revenue"))
7058      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7059    if (json.has("category"))
7060      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7061    if (json.has("productOrService"))
7062      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7063    if (json.has("productOrServiceEnd"))
7064      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7065    if (json.has("modifier")) {
7066      JsonArray array = getJArray(json, "modifier");
7067      for (int i = 0; i < array.size(); i++) {
7068        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7069      }
7070    };
7071    if (json.has("programCode")) {
7072      JsonArray array = getJArray(json, "programCode");
7073      for (int i = 0; i < array.size(); i++) {
7074        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7075      }
7076    };
7077    if (json.has("patientPaid"))
7078      res.setPatientPaid(parseMoney(getJObject(json, "patientPaid")));
7079    if (json.has("quantity"))
7080      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7081    if (json.has("unitPrice"))
7082      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7083    if (json.has("factor"))
7084      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7085    if (json.has("_factor"))
7086      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7087    if (json.has("tax"))
7088      res.setTax(parseMoney(getJObject(json, "tax")));
7089    if (json.has("net"))
7090      res.setNet(parseMoney(getJObject(json, "net")));
7091    if (json.has("udi")) {
7092      JsonArray array = getJArray(json, "udi");
7093      for (int i = 0; i < array.size(); i++) {
7094        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
7095      }
7096    };
7097  }
7098
7099  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
7100    ClaimResponse res = new ClaimResponse();
7101    parseClaimResponseProperties(json, res);
7102    return res;
7103  }
7104
7105  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
7106    parseDomainResourceProperties(json, res);
7107    if (json.has("identifier")) {
7108      JsonArray array = getJArray(json, "identifier");
7109      for (int i = 0; i < array.size(); i++) {
7110        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7111      }
7112    };
7113    if (json.has("status"))
7114      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
7115    if (json.has("_status"))
7116      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7117    if (json.has("type"))
7118      res.setType(parseCodeableConcept(getJObject(json, "type")));
7119    if (json.has("subType"))
7120      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
7121    if (json.has("use"))
7122      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
7123    if (json.has("_use"))
7124      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
7125    if (json.has("patient"))
7126      res.setPatient(parseReference(getJObject(json, "patient")));
7127    if (json.has("created"))
7128      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7129    if (json.has("_created"))
7130      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7131    if (json.has("insurer"))
7132      res.setInsurer(parseReference(getJObject(json, "insurer")));
7133    if (json.has("requestor"))
7134      res.setRequestor(parseReference(getJObject(json, "requestor")));
7135    if (json.has("request"))
7136      res.setRequest(parseReference(getJObject(json, "request")));
7137    if (json.has("outcome"))
7138      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
7139    if (json.has("_outcome"))
7140      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
7141    if (json.has("decision"))
7142      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7143    if (json.has("disposition"))
7144      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
7145    if (json.has("_disposition"))
7146      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
7147    if (json.has("preAuthRef"))
7148      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
7149    if (json.has("_preAuthRef"))
7150      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
7151    if (json.has("preAuthPeriod"))
7152      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
7153    if (json.has("payeeType"))
7154      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
7155    if (json.has("encounter")) {
7156      JsonArray array = getJArray(json, "encounter");
7157      for (int i = 0; i < array.size(); i++) {
7158        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
7159      }
7160    };
7161    if (json.has("diagnosisRelatedGroup"))
7162      res.setDiagnosisRelatedGroup(parseCodeableConcept(getJObject(json, "diagnosisRelatedGroup")));
7163    if (json.has("item")) {
7164      JsonArray array = getJArray(json, "item");
7165      for (int i = 0; i < array.size(); i++) {
7166        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject()));
7167      }
7168    };
7169    if (json.has("addItem")) {
7170      JsonArray array = getJArray(json, "addItem");
7171      for (int i = 0; i < array.size(); i++) {
7172        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject()));
7173      }
7174    };
7175    if (json.has("adjudication")) {
7176      JsonArray array = getJArray(json, "adjudication");
7177      for (int i = 0; i < array.size(); i++) {
7178        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7179      }
7180    };
7181    if (json.has("total")) {
7182      JsonArray array = getJArray(json, "total");
7183      for (int i = 0; i < array.size(); i++) {
7184        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject()));
7185      }
7186    };
7187    if (json.has("payment"))
7188      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment")));
7189    if (json.has("fundsReserve"))
7190      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
7191    if (json.has("formCode"))
7192      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
7193    if (json.has("form"))
7194      res.setForm(parseAttachment(getJObject(json, "form")));
7195    if (json.has("processNote")) {
7196      JsonArray array = getJArray(json, "processNote");
7197      for (int i = 0; i < array.size(); i++) {
7198        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject()));
7199      }
7200    };
7201    if (json.has("communicationRequest")) {
7202      JsonArray array = getJArray(json, "communicationRequest");
7203      for (int i = 0; i < array.size(); i++) {
7204        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
7205      }
7206    };
7207    if (json.has("insurance")) {
7208      JsonArray array = getJArray(json, "insurance");
7209      for (int i = 0; i < array.size(); i++) {
7210        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject()));
7211      }
7212    };
7213    if (json.has("error")) {
7214      JsonArray array = getJArray(json, "error");
7215      for (int i = 0; i < array.size(); i++) {
7216        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject()));
7217      }
7218    };
7219  }
7220
7221  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
7222    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
7223    parseClaimResponseItemComponentProperties(json, res);
7224    return res;
7225  }
7226
7227  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
7228    parseBackboneElementProperties(json, res);
7229    if (json.has("itemSequence"))
7230      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
7231    if (json.has("_itemSequence"))
7232      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
7233    if (json.has("noteNumber")) {
7234      JsonArray array = getJArray(json, "noteNumber");
7235      for (int i = 0; i < array.size(); i++) {
7236        if (array.get(i).isJsonNull()) {
7237          res.getNoteNumber().add(new PositiveIntType());
7238        } else {;
7239          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7240        }
7241      }
7242    };
7243    if (json.has("_noteNumber")) {
7244      JsonArray array = getJArray(json, "_noteNumber");
7245      for (int i = 0; i < array.size(); i++) {
7246        if (i == res.getNoteNumber().size())
7247          res.getNoteNumber().add(parsePositiveInt(null));
7248        if (array.get(i) instanceof JsonObject) 
7249          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7250      }
7251    };
7252    if (json.has("decision"))
7253      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7254    if (json.has("adjudication")) {
7255      JsonArray array = getJArray(json, "adjudication");
7256      for (int i = 0; i < array.size(); i++) {
7257        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7258      }
7259    };
7260    if (json.has("detail")) {
7261      JsonArray array = getJArray(json, "detail");
7262      for (int i = 0; i < array.size(); i++) {
7263        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject()));
7264      }
7265    };
7266  }
7267
7268  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7269    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
7270    parseClaimResponseAdjudicationComponentProperties(json, res);
7271    return res;
7272  }
7273
7274  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
7275    parseBackboneElementProperties(json, res);
7276    if (json.has("category"))
7277      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7278    if (json.has("reason"))
7279      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
7280    if (json.has("amount"))
7281      res.setAmount(parseMoney(getJObject(json, "amount")));
7282    if (json.has("value"))
7283      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
7284    if (json.has("_value"))
7285      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7286  }
7287
7288  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7289    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
7290    parseClaimResponseItemDetailComponentProperties(json, res);
7291    return res;
7292  }
7293
7294  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
7295    parseBackboneElementProperties(json, res);
7296    if (json.has("detailSequence"))
7297      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
7298    if (json.has("_detailSequence"))
7299      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
7300    if (json.has("noteNumber")) {
7301      JsonArray array = getJArray(json, "noteNumber");
7302      for (int i = 0; i < array.size(); i++) {
7303        if (array.get(i).isJsonNull()) {
7304          res.getNoteNumber().add(new PositiveIntType());
7305        } else {;
7306          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7307        }
7308      }
7309    };
7310    if (json.has("_noteNumber")) {
7311      JsonArray array = getJArray(json, "_noteNumber");
7312      for (int i = 0; i < array.size(); i++) {
7313        if (i == res.getNoteNumber().size())
7314          res.getNoteNumber().add(parsePositiveInt(null));
7315        if (array.get(i) instanceof JsonObject) 
7316          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7317      }
7318    };
7319    if (json.has("decision"))
7320      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7321    if (json.has("adjudication")) {
7322      JsonArray array = getJArray(json, "adjudication");
7323      for (int i = 0; i < array.size(); i++) {
7324        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7325      }
7326    };
7327    if (json.has("subDetail")) {
7328      JsonArray array = getJArray(json, "subDetail");
7329      for (int i = 0; i < array.size(); i++) {
7330        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject()));
7331      }
7332    };
7333  }
7334
7335  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7336    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
7337    parseClaimResponseSubDetailComponentProperties(json, res);
7338    return res;
7339  }
7340
7341  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
7342    parseBackboneElementProperties(json, res);
7343    if (json.has("subDetailSequence"))
7344      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
7345    if (json.has("_subDetailSequence"))
7346      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
7347    if (json.has("noteNumber")) {
7348      JsonArray array = getJArray(json, "noteNumber");
7349      for (int i = 0; i < array.size(); i++) {
7350        if (array.get(i).isJsonNull()) {
7351          res.getNoteNumber().add(new PositiveIntType());
7352        } else {;
7353          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7354        }
7355      }
7356    };
7357    if (json.has("_noteNumber")) {
7358      JsonArray array = getJArray(json, "_noteNumber");
7359      for (int i = 0; i < array.size(); i++) {
7360        if (i == res.getNoteNumber().size())
7361          res.getNoteNumber().add(parsePositiveInt(null));
7362        if (array.get(i) instanceof JsonObject) 
7363          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7364      }
7365    };
7366    if (json.has("decision"))
7367      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7368    if (json.has("adjudication")) {
7369      JsonArray array = getJArray(json, "adjudication");
7370      for (int i = 0; i < array.size(); i++) {
7371        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7372      }
7373    };
7374  }
7375
7376  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
7377    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
7378    parseClaimResponseAddedItemComponentProperties(json, res);
7379    return res;
7380  }
7381
7382  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
7383    parseBackboneElementProperties(json, res);
7384    if (json.has("itemSequence")) {
7385      JsonArray array = getJArray(json, "itemSequence");
7386      for (int i = 0; i < array.size(); i++) {
7387        if (array.get(i).isJsonNull()) {
7388          res.getItemSequence().add(new PositiveIntType());
7389        } else {;
7390          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
7391        }
7392      }
7393    };
7394    if (json.has("_itemSequence")) {
7395      JsonArray array = getJArray(json, "_itemSequence");
7396      for (int i = 0; i < array.size(); i++) {
7397        if (i == res.getItemSequence().size())
7398          res.getItemSequence().add(parsePositiveInt(null));
7399        if (array.get(i) instanceof JsonObject) 
7400          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
7401      }
7402    };
7403    if (json.has("detailSequence")) {
7404      JsonArray array = getJArray(json, "detailSequence");
7405      for (int i = 0; i < array.size(); i++) {
7406        if (array.get(i).isJsonNull()) {
7407          res.getDetailSequence().add(new PositiveIntType());
7408        } else {;
7409          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
7410        }
7411      }
7412    };
7413    if (json.has("_detailSequence")) {
7414      JsonArray array = getJArray(json, "_detailSequence");
7415      for (int i = 0; i < array.size(); i++) {
7416        if (i == res.getDetailSequence().size())
7417          res.getDetailSequence().add(parsePositiveInt(null));
7418        if (array.get(i) instanceof JsonObject) 
7419          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
7420      }
7421    };
7422    if (json.has("subdetailSequence")) {
7423      JsonArray array = getJArray(json, "subdetailSequence");
7424      for (int i = 0; i < array.size(); i++) {
7425        if (array.get(i).isJsonNull()) {
7426          res.getSubdetailSequence().add(new PositiveIntType());
7427        } else {;
7428          res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
7429        }
7430      }
7431    };
7432    if (json.has("_subdetailSequence")) {
7433      JsonArray array = getJArray(json, "_subdetailSequence");
7434      for (int i = 0; i < array.size(); i++) {
7435        if (i == res.getSubdetailSequence().size())
7436          res.getSubdetailSequence().add(parsePositiveInt(null));
7437        if (array.get(i) instanceof JsonObject) 
7438          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
7439      }
7440    };
7441    if (json.has("provider")) {
7442      JsonArray array = getJArray(json, "provider");
7443      for (int i = 0; i < array.size(); i++) {
7444        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
7445      }
7446    };
7447    if (json.has("revenue"))
7448      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7449    if (json.has("productOrService"))
7450      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7451    if (json.has("productOrServiceEnd"))
7452      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7453    if (json.has("modifier")) {
7454      JsonArray array = getJArray(json, "modifier");
7455      for (int i = 0; i < array.size(); i++) {
7456        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7457      }
7458    };
7459    if (json.has("programCode")) {
7460      JsonArray array = getJArray(json, "programCode");
7461      for (int i = 0; i < array.size(); i++) {
7462        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7463      }
7464    };
7465    DataType serviced = parseType("serviced", json);
7466    if (serviced != null)
7467      res.setServiced(serviced);
7468    DataType location = parseType("location", json);
7469    if (location != null)
7470      res.setLocation(location);
7471    if (json.has("quantity"))
7472      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7473    if (json.has("unitPrice"))
7474      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7475    if (json.has("factor"))
7476      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7477    if (json.has("_factor"))
7478      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7479    if (json.has("tax"))
7480      res.setTax(parseMoney(getJObject(json, "tax")));
7481    if (json.has("net"))
7482      res.setNet(parseMoney(getJObject(json, "net")));
7483    if (json.has("bodySite")) {
7484      JsonArray array = getJArray(json, "bodySite");
7485      for (int i = 0; i < array.size(); i++) {
7486        res.getBodySite().add(parseClaimResponseBodySiteComponent(array.get(i).getAsJsonObject()));
7487      }
7488    };
7489    if (json.has("noteNumber")) {
7490      JsonArray array = getJArray(json, "noteNumber");
7491      for (int i = 0; i < array.size(); i++) {
7492        if (array.get(i).isJsonNull()) {
7493          res.getNoteNumber().add(new PositiveIntType());
7494        } else {;
7495          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7496        }
7497      }
7498    };
7499    if (json.has("_noteNumber")) {
7500      JsonArray array = getJArray(json, "_noteNumber");
7501      for (int i = 0; i < array.size(); i++) {
7502        if (i == res.getNoteNumber().size())
7503          res.getNoteNumber().add(parsePositiveInt(null));
7504        if (array.get(i) instanceof JsonObject) 
7505          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7506      }
7507    };
7508    if (json.has("decision"))
7509      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7510    if (json.has("adjudication")) {
7511      JsonArray array = getJArray(json, "adjudication");
7512      for (int i = 0; i < array.size(); i++) {
7513        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7514      }
7515    };
7516    if (json.has("detail")) {
7517      JsonArray array = getJArray(json, "detail");
7518      for (int i = 0; i < array.size(); i++) {
7519        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject()));
7520      }
7521    };
7522  }
7523
7524  protected ClaimResponse.BodySiteComponent parseClaimResponseBodySiteComponent(JsonObject json) throws IOException, FHIRFormatError {
7525    ClaimResponse.BodySiteComponent res = new ClaimResponse.BodySiteComponent();
7526    parseClaimResponseBodySiteComponentProperties(json, res);
7527    return res;
7528  }
7529
7530  protected void parseClaimResponseBodySiteComponentProperties(JsonObject json, ClaimResponse.BodySiteComponent res) throws IOException, FHIRFormatError {
7531    parseBackboneElementProperties(json, res);
7532    if (json.has("site")) {
7533      JsonArray array = getJArray(json, "site");
7534      for (int i = 0; i < array.size(); i++) {
7535        res.getSite().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7536      }
7537    };
7538    if (json.has("subSite")) {
7539      JsonArray array = getJArray(json, "subSite");
7540      for (int i = 0; i < array.size(); i++) {
7541        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7542      }
7543    };
7544  }
7545
7546  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7547    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
7548    parseClaimResponseAddedItemDetailComponentProperties(json, res);
7549    return res;
7550  }
7551
7552  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
7553    parseBackboneElementProperties(json, res);
7554    if (json.has("revenue"))
7555      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7556    if (json.has("productOrService"))
7557      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7558    if (json.has("productOrServiceEnd"))
7559      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7560    if (json.has("modifier")) {
7561      JsonArray array = getJArray(json, "modifier");
7562      for (int i = 0; i < array.size(); i++) {
7563        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7564      }
7565    };
7566    if (json.has("quantity"))
7567      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7568    if (json.has("unitPrice"))
7569      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7570    if (json.has("factor"))
7571      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7572    if (json.has("_factor"))
7573      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7574    if (json.has("tax"))
7575      res.setTax(parseMoney(getJObject(json, "tax")));
7576    if (json.has("net"))
7577      res.setNet(parseMoney(getJObject(json, "net")));
7578    if (json.has("noteNumber")) {
7579      JsonArray array = getJArray(json, "noteNumber");
7580      for (int i = 0; i < array.size(); i++) {
7581        if (array.get(i).isJsonNull()) {
7582          res.getNoteNumber().add(new PositiveIntType());
7583        } else {;
7584          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7585        }
7586      }
7587    };
7588    if (json.has("_noteNumber")) {
7589      JsonArray array = getJArray(json, "_noteNumber");
7590      for (int i = 0; i < array.size(); i++) {
7591        if (i == res.getNoteNumber().size())
7592          res.getNoteNumber().add(parsePositiveInt(null));
7593        if (array.get(i) instanceof JsonObject) 
7594          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7595      }
7596    };
7597    if (json.has("decision"))
7598      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7599    if (json.has("adjudication")) {
7600      JsonArray array = getJArray(json, "adjudication");
7601      for (int i = 0; i < array.size(); i++) {
7602        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7603      }
7604    };
7605    if (json.has("subDetail")) {
7606      JsonArray array = getJArray(json, "subDetail");
7607      for (int i = 0; i < array.size(); i++) {
7608        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject()));
7609      }
7610    };
7611  }
7612
7613  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
7614    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
7615    parseClaimResponseAddedItemSubDetailComponentProperties(json, res);
7616    return res;
7617  }
7618
7619  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
7620    parseBackboneElementProperties(json, res);
7621    if (json.has("revenue"))
7622      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
7623    if (json.has("productOrService"))
7624      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
7625    if (json.has("productOrServiceEnd"))
7626      res.setProductOrServiceEnd(parseCodeableConcept(getJObject(json, "productOrServiceEnd")));
7627    if (json.has("modifier")) {
7628      JsonArray array = getJArray(json, "modifier");
7629      for (int i = 0; i < array.size(); i++) {
7630        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7631      }
7632    };
7633    if (json.has("quantity"))
7634      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
7635    if (json.has("unitPrice"))
7636      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
7637    if (json.has("factor"))
7638      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7639    if (json.has("_factor"))
7640      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
7641    if (json.has("tax"))
7642      res.setTax(parseMoney(getJObject(json, "tax")));
7643    if (json.has("net"))
7644      res.setNet(parseMoney(getJObject(json, "net")));
7645    if (json.has("noteNumber")) {
7646      JsonArray array = getJArray(json, "noteNumber");
7647      for (int i = 0; i < array.size(); i++) {
7648        if (array.get(i).isJsonNull()) {
7649          res.getNoteNumber().add(new PositiveIntType());
7650        } else {;
7651          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
7652        }
7653      }
7654    };
7655    if (json.has("_noteNumber")) {
7656      JsonArray array = getJArray(json, "_noteNumber");
7657      for (int i = 0; i < array.size(); i++) {
7658        if (i == res.getNoteNumber().size())
7659          res.getNoteNumber().add(parsePositiveInt(null));
7660        if (array.get(i) instanceof JsonObject) 
7661          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
7662      }
7663    };
7664    if (json.has("decision"))
7665      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7666    if (json.has("adjudication")) {
7667      JsonArray array = getJArray(json, "adjudication");
7668      for (int i = 0; i < array.size(); i++) {
7669        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
7670      }
7671    };
7672  }
7673
7674  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
7675    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
7676    parseClaimResponseTotalComponentProperties(json, res);
7677    return res;
7678  }
7679
7680  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
7681    parseBackboneElementProperties(json, res);
7682    if (json.has("category"))
7683      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7684    if (json.has("amount"))
7685      res.setAmount(parseMoney(getJObject(json, "amount")));
7686  }
7687
7688  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
7689    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
7690    parseClaimResponsePaymentComponentProperties(json, res);
7691    return res;
7692  }
7693
7694  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
7695    parseBackboneElementProperties(json, res);
7696    if (json.has("type"))
7697      res.setType(parseCodeableConcept(getJObject(json, "type")));
7698    if (json.has("adjustment"))
7699      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
7700    if (json.has("adjustmentReason"))
7701      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
7702    if (json.has("date"))
7703      res.setDateElement(parseDate(json.get("date").getAsString()));
7704    if (json.has("_date"))
7705      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7706    if (json.has("amount"))
7707      res.setAmount(parseMoney(getJObject(json, "amount")));
7708    if (json.has("identifier"))
7709      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7710  }
7711
7712  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
7713    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
7714    parseClaimResponseNoteComponentProperties(json, res);
7715    return res;
7716  }
7717
7718  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
7719    parseBackboneElementProperties(json, res);
7720    if (json.has("number"))
7721      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
7722    if (json.has("_number"))
7723      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
7724    if (json.has("type"))
7725      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
7726    if (json.has("_type"))
7727      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7728    if (json.has("text"))
7729      res.setTextElement(parseString(json.get("text").getAsString()));
7730    if (json.has("_text"))
7731      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7732    if (json.has("language"))
7733      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
7734  }
7735
7736  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
7737    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
7738    parseClaimResponseInsuranceComponentProperties(json, res);
7739    return res;
7740  }
7741
7742  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
7743    parseBackboneElementProperties(json, res);
7744    if (json.has("sequence"))
7745      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
7746    if (json.has("_sequence"))
7747      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
7748    if (json.has("focal"))
7749      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
7750    if (json.has("_focal"))
7751      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
7752    if (json.has("coverage"))
7753      res.setCoverage(parseReference(getJObject(json, "coverage")));
7754    if (json.has("businessArrangement"))
7755      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
7756    if (json.has("_businessArrangement"))
7757      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
7758    if (json.has("claimResponse"))
7759      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
7760  }
7761
7762  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json) throws IOException, FHIRFormatError {
7763    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
7764    parseClaimResponseErrorComponentProperties(json, res);
7765    return res;
7766  }
7767
7768  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
7769    parseBackboneElementProperties(json, res);
7770    if (json.has("itemSequence"))
7771      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
7772    if (json.has("_itemSequence"))
7773      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
7774    if (json.has("detailSequence"))
7775      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
7776    if (json.has("_detailSequence"))
7777      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
7778    if (json.has("subDetailSequence"))
7779      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
7780    if (json.has("_subDetailSequence"))
7781      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
7782    if (json.has("code"))
7783      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7784  }
7785
7786  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
7787    ClinicalImpression res = new ClinicalImpression();
7788    parseClinicalImpressionProperties(json, res);
7789    return res;
7790  }
7791
7792  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
7793    parseDomainResourceProperties(json, res);
7794    if (json.has("identifier")) {
7795      JsonArray array = getJArray(json, "identifier");
7796      for (int i = 0; i < array.size(); i++) {
7797        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7798      }
7799    };
7800    if (json.has("status"))
7801      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
7802    if (json.has("_status"))
7803      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7804    if (json.has("statusReason"))
7805      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
7806    if (json.has("description"))
7807      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7808    if (json.has("_description"))
7809      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7810    if (json.has("subject"))
7811      res.setSubject(parseReference(getJObject(json, "subject")));
7812    if (json.has("encounter"))
7813      res.setEncounter(parseReference(getJObject(json, "encounter")));
7814    DataType effective = parseType("effective", json);
7815    if (effective != null)
7816      res.setEffective(effective);
7817    if (json.has("date"))
7818      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7819    if (json.has("_date"))
7820      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7821    if (json.has("performer"))
7822      res.setPerformer(parseReference(getJObject(json, "performer")));
7823    if (json.has("previous"))
7824      res.setPrevious(parseReference(getJObject(json, "previous")));
7825    if (json.has("problem")) {
7826      JsonArray array = getJArray(json, "problem");
7827      for (int i = 0; i < array.size(); i++) {
7828        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
7829      }
7830    };
7831    if (json.has("changePattern"))
7832      res.setChangePattern(parseCodeableConcept(getJObject(json, "changePattern")));
7833    if (json.has("protocol")) {
7834      JsonArray array = getJArray(json, "protocol");
7835      for (int i = 0; i < array.size(); i++) {
7836        if (array.get(i).isJsonNull()) {
7837          res.getProtocol().add(new UriType());
7838        } else {;
7839          res.getProtocol().add(parseUri(array.get(i).getAsString()));
7840        }
7841      }
7842    };
7843    if (json.has("_protocol")) {
7844      JsonArray array = getJArray(json, "_protocol");
7845      for (int i = 0; i < array.size(); i++) {
7846        if (i == res.getProtocol().size())
7847          res.getProtocol().add(parseUri(null));
7848        if (array.get(i) instanceof JsonObject) 
7849          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
7850      }
7851    };
7852    if (json.has("summary"))
7853      res.setSummaryElement(parseString(json.get("summary").getAsString()));
7854    if (json.has("_summary"))
7855      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
7856    if (json.has("finding")) {
7857      JsonArray array = getJArray(json, "finding");
7858      for (int i = 0; i < array.size(); i++) {
7859        res.getFinding().add(parseClinicalImpressionFindingComponent(array.get(i).getAsJsonObject()));
7860      }
7861    };
7862    if (json.has("prognosisCodeableConcept")) {
7863      JsonArray array = getJArray(json, "prognosisCodeableConcept");
7864      for (int i = 0; i < array.size(); i++) {
7865        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7866      }
7867    };
7868    if (json.has("prognosisReference")) {
7869      JsonArray array = getJArray(json, "prognosisReference");
7870      for (int i = 0; i < array.size(); i++) {
7871        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
7872      }
7873    };
7874    if (json.has("supportingInfo")) {
7875      JsonArray array = getJArray(json, "supportingInfo");
7876      for (int i = 0; i < array.size(); i++) {
7877        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7878      }
7879    };
7880    if (json.has("note")) {
7881      JsonArray array = getJArray(json, "note");
7882      for (int i = 0; i < array.size(); i++) {
7883        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7884      }
7885    };
7886  }
7887
7888  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionFindingComponent(JsonObject json) throws IOException, FHIRFormatError {
7889    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
7890    parseClinicalImpressionFindingComponentProperties(json, res);
7891    return res;
7892  }
7893
7894  protected void parseClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
7895    parseBackboneElementProperties(json, res);
7896    if (json.has("item"))
7897      res.setItem(parseCodeableReference(getJObject(json, "item")));
7898    if (json.has("basis"))
7899      res.setBasisElement(parseString(json.get("basis").getAsString()));
7900    if (json.has("_basis"))
7901      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
7902  }
7903
7904  protected ClinicalUseDefinition parseClinicalUseDefinition(JsonObject json) throws IOException, FHIRFormatError {
7905    ClinicalUseDefinition res = new ClinicalUseDefinition();
7906    parseClinicalUseDefinitionProperties(json, res);
7907    return res;
7908  }
7909
7910  protected void parseClinicalUseDefinitionProperties(JsonObject json, ClinicalUseDefinition res) throws IOException, FHIRFormatError {
7911    parseDomainResourceProperties(json, res);
7912    if (json.has("identifier")) {
7913      JsonArray array = getJArray(json, "identifier");
7914      for (int i = 0; i < array.size(); i++) {
7915        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7916      }
7917    };
7918    if (json.has("type"))
7919      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ClinicalUseDefinition.ClinicalUseDefinitionType.NULL, new ClinicalUseDefinition.ClinicalUseDefinitionTypeEnumFactory()));
7920    if (json.has("_type"))
7921      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7922    if (json.has("category")) {
7923      JsonArray array = getJArray(json, "category");
7924      for (int i = 0; i < array.size(); i++) {
7925        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7926      }
7927    };
7928    if (json.has("subject")) {
7929      JsonArray array = getJArray(json, "subject");
7930      for (int i = 0; i < array.size(); i++) {
7931        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7932      }
7933    };
7934    if (json.has("status"))
7935      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
7936    if (json.has("contraindication"))
7937      res.setContraindication(parseClinicalUseDefinitionContraindicationComponent(getJObject(json, "contraindication")));
7938    if (json.has("indication"))
7939      res.setIndication(parseClinicalUseDefinitionIndicationComponent(getJObject(json, "indication")));
7940    if (json.has("interaction"))
7941      res.setInteraction(parseClinicalUseDefinitionInteractionComponent(getJObject(json, "interaction")));
7942    if (json.has("population")) {
7943      JsonArray array = getJArray(json, "population");
7944      for (int i = 0; i < array.size(); i++) {
7945        res.getPopulation().add(parseReference(array.get(i).getAsJsonObject()));
7946      }
7947    };
7948    if (json.has("undesirableEffect"))
7949      res.setUndesirableEffect(parseClinicalUseDefinitionUndesirableEffectComponent(getJObject(json, "undesirableEffect")));
7950    if (json.has("warning"))
7951      res.setWarning(parseClinicalUseDefinitionWarningComponent(getJObject(json, "warning")));
7952  }
7953
7954  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent parseClinicalUseDefinitionContraindicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7955    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent();
7956    parseClinicalUseDefinitionContraindicationComponentProperties(json, res);
7957    return res;
7958  }
7959
7960  protected void parseClinicalUseDefinitionContraindicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res) throws IOException, FHIRFormatError {
7961    parseBackboneElementProperties(json, res);
7962    if (json.has("diseaseSymptomProcedure"))
7963      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
7964    if (json.has("diseaseStatus"))
7965      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
7966    if (json.has("comorbidity")) {
7967      JsonArray array = getJArray(json, "comorbidity");
7968      for (int i = 0; i < array.size(); i++) {
7969        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7970      }
7971    };
7972    if (json.has("indication")) {
7973      JsonArray array = getJArray(json, "indication");
7974      for (int i = 0; i < array.size(); i++) {
7975        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
7976      }
7977    };
7978    if (json.has("otherTherapy")) {
7979      JsonArray array = getJArray(json, "otherTherapy");
7980      for (int i = 0; i < array.size(); i++) {
7981        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7982      }
7983    };
7984  }
7985
7986  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent parseClinicalUseDefinitionContraindicationOtherTherapyComponent(JsonObject json) throws IOException, FHIRFormatError {
7987    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent();
7988    parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(json, res);
7989    return res;
7990  }
7991
7992  protected void parseClinicalUseDefinitionContraindicationOtherTherapyComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
7993    parseBackboneElementProperties(json, res);
7994    if (json.has("relationshipType"))
7995      res.setRelationshipType(parseCodeableConcept(getJObject(json, "relationshipType")));
7996    if (json.has("treatment"))
7997      res.setTreatment(parseCodeableReference(getJObject(json, "treatment")));
7998  }
7999
8000  protected ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent parseClinicalUseDefinitionIndicationComponent(JsonObject json) throws IOException, FHIRFormatError {
8001    ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent();
8002    parseClinicalUseDefinitionIndicationComponentProperties(json, res);
8003    return res;
8004  }
8005
8006  protected void parseClinicalUseDefinitionIndicationComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res) throws IOException, FHIRFormatError {
8007    parseBackboneElementProperties(json, res);
8008    if (json.has("diseaseSymptomProcedure"))
8009      res.setDiseaseSymptomProcedure(parseCodeableReference(getJObject(json, "diseaseSymptomProcedure")));
8010    if (json.has("diseaseStatus"))
8011      res.setDiseaseStatus(parseCodeableReference(getJObject(json, "diseaseStatus")));
8012    if (json.has("comorbidity")) {
8013      JsonArray array = getJArray(json, "comorbidity");
8014      for (int i = 0; i < array.size(); i++) {
8015        res.getComorbidity().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8016      }
8017    };
8018    if (json.has("intendedEffect"))
8019      res.setIntendedEffect(parseCodeableReference(getJObject(json, "intendedEffect")));
8020    DataType duration = parseType("duration", json);
8021    if (duration != null)
8022      res.setDuration(duration);
8023    if (json.has("undesirableEffect")) {
8024      JsonArray array = getJArray(json, "undesirableEffect");
8025      for (int i = 0; i < array.size(); i++) {
8026        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
8027      }
8028    };
8029    if (json.has("otherTherapy")) {
8030      JsonArray array = getJArray(json, "otherTherapy");
8031      for (int i = 0; i < array.size(); i++) {
8032        res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
8033      }
8034    };
8035  }
8036
8037  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent parseClinicalUseDefinitionInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
8038    ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent();
8039    parseClinicalUseDefinitionInteractionComponentProperties(json, res);
8040    return res;
8041  }
8042
8043  protected void parseClinicalUseDefinitionInteractionComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res) throws IOException, FHIRFormatError {
8044    parseBackboneElementProperties(json, res);
8045    if (json.has("interactant")) {
8046      JsonArray array = getJArray(json, "interactant");
8047      for (int i = 0; i < array.size(); i++) {
8048        res.getInteractant().add(parseClinicalUseDefinitionInteractionInteractantComponent(array.get(i).getAsJsonObject()));
8049      }
8050    };
8051    if (json.has("type"))
8052      res.setType(parseCodeableConcept(getJObject(json, "type")));
8053    if (json.has("effect"))
8054      res.setEffect(parseCodeableReference(getJObject(json, "effect")));
8055    if (json.has("incidence"))
8056      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
8057    if (json.has("management")) {
8058      JsonArray array = getJArray(json, "management");
8059      for (int i = 0; i < array.size(); i++) {
8060        res.getManagement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8061      }
8062    };
8063  }
8064
8065  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent parseClinicalUseDefinitionInteractionInteractantComponent(JsonObject json) throws IOException, FHIRFormatError {
8066    ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent();
8067    parseClinicalUseDefinitionInteractionInteractantComponentProperties(json, res);
8068    return res;
8069  }
8070
8071  protected void parseClinicalUseDefinitionInteractionInteractantComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res) throws IOException, FHIRFormatError {
8072    parseBackboneElementProperties(json, res);
8073    DataType item = parseType("item", json);
8074    if (item != null)
8075      res.setItem(item);
8076  }
8077
8078  protected ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent parseClinicalUseDefinitionUndesirableEffectComponent(JsonObject json) throws IOException, FHIRFormatError {
8079    ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent();
8080    parseClinicalUseDefinitionUndesirableEffectComponentProperties(json, res);
8081    return res;
8082  }
8083
8084  protected void parseClinicalUseDefinitionUndesirableEffectComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res) throws IOException, FHIRFormatError {
8085    parseBackboneElementProperties(json, res);
8086    if (json.has("symptomConditionEffect"))
8087      res.setSymptomConditionEffect(parseCodeableReference(getJObject(json, "symptomConditionEffect")));
8088    if (json.has("classification"))
8089      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
8090    if (json.has("frequencyOfOccurrence"))
8091      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
8092  }
8093
8094  protected ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent parseClinicalUseDefinitionWarningComponent(JsonObject json) throws IOException, FHIRFormatError {
8095    ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent();
8096    parseClinicalUseDefinitionWarningComponentProperties(json, res);
8097    return res;
8098  }
8099
8100  protected void parseClinicalUseDefinitionWarningComponentProperties(JsonObject json, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res) throws IOException, FHIRFormatError {
8101    parseBackboneElementProperties(json, res);
8102    if (json.has("description"))
8103      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8104    if (json.has("_description"))
8105      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8106    if (json.has("code"))
8107      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8108  }
8109
8110  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
8111    CodeSystem res = new CodeSystem();
8112    parseCodeSystemProperties(json, res);
8113    return res;
8114  }
8115
8116  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
8117    parseMetadataResourceProperties(json, res);
8118    if (json.has("url"))
8119      res.setUrlElement(parseUri(json.get("url").getAsString()));
8120    if (json.has("_url"))
8121      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8122    if (json.has("identifier")) {
8123      JsonArray array = getJArray(json, "identifier");
8124      for (int i = 0; i < array.size(); i++) {
8125        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8126      }
8127    };
8128    if (json.has("version"))
8129      res.setVersionElement(parseString(json.get("version").getAsString()));
8130    if (json.has("_version"))
8131      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8132    if (json.has("name"))
8133      res.setNameElement(parseString(json.get("name").getAsString()));
8134    if (json.has("_name"))
8135      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8136    if (json.has("title"))
8137      res.setTitleElement(parseString(json.get("title").getAsString()));
8138    if (json.has("_title"))
8139      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8140    if (json.has("status"))
8141      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8142    if (json.has("_status"))
8143      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8144    if (json.has("experimental"))
8145      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8146    if (json.has("_experimental"))
8147      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8148    if (json.has("date"))
8149      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8150    if (json.has("_date"))
8151      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8152    if (json.has("publisher"))
8153      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8154    if (json.has("_publisher"))
8155      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8156    if (json.has("contact")) {
8157      JsonArray array = getJArray(json, "contact");
8158      for (int i = 0; i < array.size(); i++) {
8159        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8160      }
8161    };
8162    if (json.has("description"))
8163      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8164    if (json.has("_description"))
8165      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8166    if (json.has("useContext")) {
8167      JsonArray array = getJArray(json, "useContext");
8168      for (int i = 0; i < array.size(); i++) {
8169        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8170      }
8171    };
8172    if (json.has("jurisdiction")) {
8173      JsonArray array = getJArray(json, "jurisdiction");
8174      for (int i = 0; i < array.size(); i++) {
8175        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8176      }
8177    };
8178    if (json.has("purpose"))
8179      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
8180    if (json.has("_purpose"))
8181      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
8182    if (json.has("copyright"))
8183      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8184    if (json.has("_copyright"))
8185      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
8186    if (json.has("approvalDate"))
8187      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
8188    if (json.has("_approvalDate"))
8189      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
8190    if (json.has("lastReviewDate"))
8191      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
8192    if (json.has("_lastReviewDate"))
8193      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
8194    if (json.has("effectivePeriod"))
8195      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
8196    if (json.has("topic")) {
8197      JsonArray array = getJArray(json, "topic");
8198      for (int i = 0; i < array.size(); i++) {
8199        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8200      }
8201    };
8202    if (json.has("author")) {
8203      JsonArray array = getJArray(json, "author");
8204      for (int i = 0; i < array.size(); i++) {
8205        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
8206      }
8207    };
8208    if (json.has("editor")) {
8209      JsonArray array = getJArray(json, "editor");
8210      for (int i = 0; i < array.size(); i++) {
8211        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
8212      }
8213    };
8214    if (json.has("reviewer")) {
8215      JsonArray array = getJArray(json, "reviewer");
8216      for (int i = 0; i < array.size(); i++) {
8217        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
8218      }
8219    };
8220    if (json.has("endorser")) {
8221      JsonArray array = getJArray(json, "endorser");
8222      for (int i = 0; i < array.size(); i++) {
8223        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
8224      }
8225    };
8226    if (json.has("relatedArtifact")) {
8227      JsonArray array = getJArray(json, "relatedArtifact");
8228      for (int i = 0; i < array.size(); i++) {
8229        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
8230      }
8231    };
8232    if (json.has("caseSensitive"))
8233      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
8234    if (json.has("_caseSensitive"))
8235      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
8236    if (json.has("valueSet"))
8237      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
8238    if (json.has("_valueSet"))
8239      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
8240    if (json.has("hierarchyMeaning"))
8241      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
8242    if (json.has("_hierarchyMeaning"))
8243      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
8244    if (json.has("compositional"))
8245      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
8246    if (json.has("_compositional"))
8247      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
8248    if (json.has("versionNeeded"))
8249      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
8250    if (json.has("_versionNeeded"))
8251      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
8252    if (json.has("content"))
8253      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
8254    if (json.has("_content"))
8255      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
8256    if (json.has("supplements"))
8257      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
8258    if (json.has("_supplements"))
8259      parseElementProperties(getJObject(json, "_supplements"), res.getSupplementsElement());
8260    if (json.has("count"))
8261      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
8262    if (json.has("_count"))
8263      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
8264    if (json.has("filter")) {
8265      JsonArray array = getJArray(json, "filter");
8266      for (int i = 0; i < array.size(); i++) {
8267        res.getFilter().add(parseCodeSystemFilterComponent(array.get(i).getAsJsonObject()));
8268      }
8269    };
8270    if (json.has("property")) {
8271      JsonArray array = getJArray(json, "property");
8272      for (int i = 0; i < array.size(); i++) {
8273        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject()));
8274      }
8275    };
8276    if (json.has("concept")) {
8277      JsonArray array = getJArray(json, "concept");
8278      for (int i = 0; i < array.size(); i++) {
8279        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
8280      }
8281    };
8282  }
8283
8284  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
8285    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
8286    parseCodeSystemFilterComponentProperties(json, res);
8287    return res;
8288  }
8289
8290  protected void parseCodeSystemFilterComponentProperties(JsonObject json, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
8291    parseBackboneElementProperties(json, res);
8292    if (json.has("code"))
8293      res.setCodeElement(parseCode(json.get("code").getAsString()));
8294    if (json.has("_code"))
8295      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8296    if (json.has("description"))
8297      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8298    if (json.has("_description"))
8299      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8300    if (json.has("operator")) {
8301      JsonArray array = getJArray(json, "operator");
8302      for (int i = 0; i < array.size(); i++) {
8303        if (array.get(i).isJsonNull()) {
8304          res.getOperator().add(new Enumeration<Enumerations.FilterOperator>(new Enumerations.FilterOperatorEnumFactory(), Enumerations.FilterOperator.NULL));
8305        } else {;
8306          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
8307        }
8308      }
8309    };
8310    if (json.has("_operator")) {
8311      JsonArray array = getJArray(json, "_operator");
8312      for (int i = 0; i < array.size(); i++) {
8313        if (i == res.getOperator().size())
8314          res.getOperator().add(parseEnumeration(null, Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
8315        if (array.get(i) instanceof JsonObject) 
8316          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
8317      }
8318    };
8319    if (json.has("value"))
8320      res.setValueElement(parseString(json.get("value").getAsString()));
8321    if (json.has("_value"))
8322      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8323  }
8324
8325  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
8326    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
8327    parseCodeSystemPropertyComponentProperties(json, res);
8328    return res;
8329  }
8330
8331  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
8332    parseBackboneElementProperties(json, res);
8333    if (json.has("code"))
8334      res.setCodeElement(parseCode(json.get("code").getAsString()));
8335    if (json.has("_code"))
8336      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8337    if (json.has("uri"))
8338      res.setUriElement(parseUri(json.get("uri").getAsString()));
8339    if (json.has("_uri"))
8340      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
8341    if (json.has("description"))
8342      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8343    if (json.has("_description"))
8344      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8345    if (json.has("type"))
8346      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
8347    if (json.has("_type"))
8348      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
8349  }
8350
8351  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
8352    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
8353    parseCodeSystemConceptDefinitionComponentProperties(json, res);
8354    return res;
8355  }
8356
8357  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
8358    parseBackboneElementProperties(json, res);
8359    if (json.has("code"))
8360      res.setCodeElement(parseCode(json.get("code").getAsString()));
8361    if (json.has("_code"))
8362      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8363    if (json.has("display"))
8364      res.setDisplayElement(parseString(json.get("display").getAsString()));
8365    if (json.has("_display"))
8366      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8367    if (json.has("definition"))
8368      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
8369    if (json.has("_definition"))
8370      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
8371    if (json.has("designation")) {
8372      JsonArray array = getJArray(json, "designation");
8373      for (int i = 0; i < array.size(); i++) {
8374        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject()));
8375      }
8376    };
8377    if (json.has("property")) {
8378      JsonArray array = getJArray(json, "property");
8379      for (int i = 0; i < array.size(); i++) {
8380        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject()));
8381      }
8382    };
8383    if (json.has("concept")) {
8384      JsonArray array = getJArray(json, "concept");
8385      for (int i = 0; i < array.size(); i++) {
8386        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
8387      }
8388    };
8389  }
8390
8391  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
8392    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
8393    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, res);
8394    return res;
8395  }
8396
8397  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
8398    parseBackboneElementProperties(json, res);
8399    if (json.has("language"))
8400      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8401    if (json.has("_language"))
8402      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
8403    if (json.has("use"))
8404      res.setUse(parseCoding(getJObject(json, "use")));
8405    if (json.has("additionalUse")) {
8406      JsonArray array = getJArray(json, "additionalUse");
8407      for (int i = 0; i < array.size(); i++) {
8408        res.getAdditionalUse().add(parseCoding(array.get(i).getAsJsonObject()));
8409      }
8410    };
8411    if (json.has("value"))
8412      res.setValueElement(parseString(json.get("value").getAsString()));
8413    if (json.has("_value"))
8414      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8415  }
8416
8417  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
8418    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
8419    parseCodeSystemConceptPropertyComponentProperties(json, res);
8420    return res;
8421  }
8422
8423  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
8424    parseBackboneElementProperties(json, res);
8425    if (json.has("code"))
8426      res.setCodeElement(parseCode(json.get("code").getAsString()));
8427    if (json.has("_code"))
8428      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8429    DataType value = parseType("value", json);
8430    if (value != null)
8431      res.setValue(value);
8432  }
8433
8434  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
8435    Communication res = new Communication();
8436    parseCommunicationProperties(json, res);
8437    return res;
8438  }
8439
8440  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
8441    parseDomainResourceProperties(json, res);
8442    if (json.has("identifier")) {
8443      JsonArray array = getJArray(json, "identifier");
8444      for (int i = 0; i < array.size(); i++) {
8445        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8446      }
8447    };
8448    if (json.has("instantiatesCanonical")) {
8449      JsonArray array = getJArray(json, "instantiatesCanonical");
8450      for (int i = 0; i < array.size(); i++) {
8451        if (array.get(i).isJsonNull()) {
8452          res.getInstantiatesCanonical().add(new CanonicalType());
8453        } else {;
8454          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
8455        }
8456      }
8457    };
8458    if (json.has("_instantiatesCanonical")) {
8459      JsonArray array = getJArray(json, "_instantiatesCanonical");
8460      for (int i = 0; i < array.size(); i++) {
8461        if (i == res.getInstantiatesCanonical().size())
8462          res.getInstantiatesCanonical().add(parseCanonical(null));
8463        if (array.get(i) instanceof JsonObject) 
8464          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
8465      }
8466    };
8467    if (json.has("instantiatesUri")) {
8468      JsonArray array = getJArray(json, "instantiatesUri");
8469      for (int i = 0; i < array.size(); i++) {
8470        if (array.get(i).isJsonNull()) {
8471          res.getInstantiatesUri().add(new UriType());
8472        } else {;
8473          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
8474        }
8475      }
8476    };
8477    if (json.has("_instantiatesUri")) {
8478      JsonArray array = getJArray(json, "_instantiatesUri");
8479      for (int i = 0; i < array.size(); i++) {
8480        if (i == res.getInstantiatesUri().size())
8481          res.getInstantiatesUri().add(parseUri(null));
8482        if (array.get(i) instanceof JsonObject) 
8483          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
8484      }
8485    };
8486    if (json.has("basedOn")) {
8487      JsonArray array = getJArray(json, "basedOn");
8488      for (int i = 0; i < array.size(); i++) {
8489        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
8490      }
8491    };
8492    if (json.has("partOf")) {
8493      JsonArray array = getJArray(json, "partOf");
8494      for (int i = 0; i < array.size(); i++) {
8495        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
8496      }
8497    };
8498    if (json.has("inResponseTo")) {
8499      JsonArray array = getJArray(json, "inResponseTo");
8500      for (int i = 0; i < array.size(); i++) {
8501        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
8502      }
8503    };
8504    if (json.has("status"))
8505      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
8506    if (json.has("_status"))
8507      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8508    if (json.has("statusReason"))
8509      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
8510    if (json.has("category")) {
8511      JsonArray array = getJArray(json, "category");
8512      for (int i = 0; i < array.size(); i++) {
8513        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8514      }
8515    };
8516    if (json.has("priority"))
8517      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
8518    if (json.has("_priority"))
8519      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
8520    if (json.has("medium")) {
8521      JsonArray array = getJArray(json, "medium");
8522      for (int i = 0; i < array.size(); i++) {
8523        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8524      }
8525    };
8526    if (json.has("subject"))
8527      res.setSubject(parseReference(getJObject(json, "subject")));
8528    if (json.has("topic"))
8529      res.setTopic(parseCodeableConcept(getJObject(json, "topic")));
8530    if (json.has("about")) {
8531      JsonArray array = getJArray(json, "about");
8532      for (int i = 0; i < array.size(); i++) {
8533        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
8534      }
8535    };
8536    if (json.has("encounter"))
8537      res.setEncounter(parseReference(getJObject(json, "encounter")));
8538    if (json.has("sent"))
8539      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
8540    if (json.has("_sent"))
8541      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
8542    if (json.has("received"))
8543      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
8544    if (json.has("_received"))
8545      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
8546    if (json.has("recipient")) {
8547      JsonArray array = getJArray(json, "recipient");
8548      for (int i = 0; i < array.size(); i++) {
8549        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
8550      }
8551    };
8552    if (json.has("sender"))
8553      res.setSender(parseReference(getJObject(json, "sender")));
8554    if (json.has("reason")) {
8555      JsonArray array = getJArray(json, "reason");
8556      for (int i = 0; i < array.size(); i++) {
8557        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8558      }
8559    };
8560    if (json.has("payload")) {
8561      JsonArray array = getJArray(json, "payload");
8562      for (int i = 0; i < array.size(); i++) {
8563        res.getPayload().add(parseCommunicationPayloadComponent(array.get(i).getAsJsonObject()));
8564      }
8565    };
8566    if (json.has("note")) {
8567      JsonArray array = getJArray(json, "note");
8568      for (int i = 0; i < array.size(); i++) {
8569        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8570      }
8571    };
8572  }
8573
8574  protected Communication.CommunicationPayloadComponent parseCommunicationPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
8575    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
8576    parseCommunicationPayloadComponentProperties(json, res);
8577    return res;
8578  }
8579
8580  protected void parseCommunicationPayloadComponentProperties(JsonObject json, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
8581    parseBackboneElementProperties(json, res);
8582    DataType content = parseType("content", json);
8583    if (content != null)
8584      res.setContent(content);
8585  }
8586
8587  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
8588    CommunicationRequest res = new CommunicationRequest();
8589    parseCommunicationRequestProperties(json, res);
8590    return res;
8591  }
8592
8593  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
8594    parseDomainResourceProperties(json, res);
8595    if (json.has("identifier")) {
8596      JsonArray array = getJArray(json, "identifier");
8597      for (int i = 0; i < array.size(); i++) {
8598        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8599      }
8600    };
8601    if (json.has("basedOn")) {
8602      JsonArray array = getJArray(json, "basedOn");
8603      for (int i = 0; i < array.size(); i++) {
8604        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
8605      }
8606    };
8607    if (json.has("replaces")) {
8608      JsonArray array = getJArray(json, "replaces");
8609      for (int i = 0; i < array.size(); i++) {
8610        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
8611      }
8612    };
8613    if (json.has("groupIdentifier"))
8614      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
8615    if (json.has("status"))
8616      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
8617    if (json.has("_status"))
8618      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8619    if (json.has("statusReason"))
8620      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
8621    if (json.has("intent"))
8622      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
8623    if (json.has("_intent"))
8624      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
8625    if (json.has("category")) {
8626      JsonArray array = getJArray(json, "category");
8627      for (int i = 0; i < array.size(); i++) {
8628        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8629      }
8630    };
8631    if (json.has("priority"))
8632      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
8633    if (json.has("_priority"))
8634      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
8635    if (json.has("doNotPerform"))
8636      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
8637    if (json.has("_doNotPerform"))
8638      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
8639    if (json.has("medium")) {
8640      JsonArray array = getJArray(json, "medium");
8641      for (int i = 0; i < array.size(); i++) {
8642        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8643      }
8644    };
8645    if (json.has("subject"))
8646      res.setSubject(parseReference(getJObject(json, "subject")));
8647    if (json.has("about")) {
8648      JsonArray array = getJArray(json, "about");
8649      for (int i = 0; i < array.size(); i++) {
8650        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
8651      }
8652    };
8653    if (json.has("encounter"))
8654      res.setEncounter(parseReference(getJObject(json, "encounter")));
8655    if (json.has("payload")) {
8656      JsonArray array = getJArray(json, "payload");
8657      for (int i = 0; i < array.size(); i++) {
8658        res.getPayload().add(parseCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject()));
8659      }
8660    };
8661    DataType occurrence = parseType("occurrence", json);
8662    if (occurrence != null)
8663      res.setOccurrence(occurrence);
8664    if (json.has("authoredOn"))
8665      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
8666    if (json.has("_authoredOn"))
8667      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
8668    if (json.has("requester"))
8669      res.setRequester(parseReference(getJObject(json, "requester")));
8670    if (json.has("recipient")) {
8671      JsonArray array = getJArray(json, "recipient");
8672      for (int i = 0; i < array.size(); i++) {
8673        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
8674      }
8675    };
8676    if (json.has("informationProvider")) {
8677      JsonArray array = getJArray(json, "informationProvider");
8678      for (int i = 0; i < array.size(); i++) {
8679        res.getInformationProvider().add(parseReference(array.get(i).getAsJsonObject()));
8680      }
8681    };
8682    if (json.has("reason")) {
8683      JsonArray array = getJArray(json, "reason");
8684      for (int i = 0; i < array.size(); i++) {
8685        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
8686      }
8687    };
8688    if (json.has("note")) {
8689      JsonArray array = getJArray(json, "note");
8690      for (int i = 0; i < array.size(); i++) {
8691        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8692      }
8693    };
8694  }
8695
8696  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
8697    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
8698    parseCommunicationRequestPayloadComponentProperties(json, res);
8699    return res;
8700  }
8701
8702  protected void parseCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
8703    parseBackboneElementProperties(json, res);
8704    DataType content = parseType("content", json);
8705    if (content != null)
8706      res.setContent(content);
8707  }
8708
8709  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
8710    CompartmentDefinition res = new CompartmentDefinition();
8711    parseCompartmentDefinitionProperties(json, res);
8712    return res;
8713  }
8714
8715  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
8716    parseCanonicalResourceProperties(json, res);
8717    if (json.has("url"))
8718      res.setUrlElement(parseUri(json.get("url").getAsString()));
8719    if (json.has("_url"))
8720      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8721    if (json.has("version"))
8722      res.setVersionElement(parseString(json.get("version").getAsString()));
8723    if (json.has("_version"))
8724      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8725    DataType versionAlgorithm = parseType("versionAlgorithm", json);
8726    if (versionAlgorithm != null)
8727      res.setVersionAlgorithm(versionAlgorithm);
8728    if (json.has("name"))
8729      res.setNameElement(parseString(json.get("name").getAsString()));
8730    if (json.has("_name"))
8731      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8732    if (json.has("title"))
8733      res.setTitleElement(parseString(json.get("title").getAsString()));
8734    if (json.has("_title"))
8735      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8736    if (json.has("status"))
8737      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8738    if (json.has("_status"))
8739      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8740    if (json.has("experimental"))
8741      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8742    if (json.has("_experimental"))
8743      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8744    if (json.has("date"))
8745      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8746    if (json.has("_date"))
8747      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8748    if (json.has("publisher"))
8749      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8750    if (json.has("_publisher"))
8751      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8752    if (json.has("contact")) {
8753      JsonArray array = getJArray(json, "contact");
8754      for (int i = 0; i < array.size(); i++) {
8755        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8756      }
8757    };
8758    if (json.has("description"))
8759      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8760    if (json.has("_description"))
8761      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8762    if (json.has("useContext")) {
8763      JsonArray array = getJArray(json, "useContext");
8764      for (int i = 0; i < array.size(); i++) {
8765        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8766      }
8767    };
8768    if (json.has("purpose"))
8769      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
8770    if (json.has("_purpose"))
8771      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
8772    if (json.has("code"))
8773      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
8774    if (json.has("_code"))
8775      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8776    if (json.has("search"))
8777      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
8778    if (json.has("_search"))
8779      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
8780    if (json.has("resource")) {
8781      JsonArray array = getJArray(json, "resource");
8782      for (int i = 0; i < array.size(); i++) {
8783        res.getResource().add(parseCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject()));
8784      }
8785    };
8786  }
8787
8788  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
8789    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
8790    parseCompartmentDefinitionResourceComponentProperties(json, res);
8791    return res;
8792  }
8793
8794  protected void parseCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
8795    parseBackboneElementProperties(json, res);
8796    if (json.has("code"))
8797      res.setCodeElement(parseCode(json.get("code").getAsString()));
8798    if (json.has("_code"))
8799      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8800    if (json.has("param")) {
8801      JsonArray array = getJArray(json, "param");
8802      for (int i = 0; i < array.size(); i++) {
8803        if (array.get(i).isJsonNull()) {
8804          res.getParam().add(new StringType());
8805        } else {;
8806          res.getParam().add(parseString(array.get(i).getAsString()));
8807        }
8808      }
8809    };
8810    if (json.has("_param")) {
8811      JsonArray array = getJArray(json, "_param");
8812      for (int i = 0; i < array.size(); i++) {
8813        if (i == res.getParam().size())
8814          res.getParam().add(parseString(null));
8815        if (array.get(i) instanceof JsonObject) 
8816          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
8817      }
8818    };
8819    if (json.has("documentation"))
8820      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
8821    if (json.has("_documentation"))
8822      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
8823    if (json.has("startParam"))
8824      res.setStartParamElement(parseUri(json.get("startParam").getAsString()));
8825    if (json.has("_startParam"))
8826      parseElementProperties(getJObject(json, "_startParam"), res.getStartParamElement());
8827    if (json.has("endParam"))
8828      res.setEndParamElement(parseUri(json.get("endParam").getAsString()));
8829    if (json.has("_endParam"))
8830      parseElementProperties(getJObject(json, "_endParam"), res.getEndParamElement());
8831  }
8832
8833  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
8834    Composition res = new Composition();
8835    parseCompositionProperties(json, res);
8836    return res;
8837  }
8838
8839  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
8840    parseDomainResourceProperties(json, res);
8841    if (json.has("url"))
8842      res.setUrlElement(parseUri(json.get("url").getAsString()));
8843    if (json.has("_url"))
8844      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8845    if (json.has("identifier")) {
8846      JsonArray array = getJArray(json, "identifier");
8847      for (int i = 0; i < array.size(); i++) {
8848        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8849      }
8850    };
8851    if (json.has("version"))
8852      res.setVersionElement(parseString(json.get("version").getAsString()));
8853    if (json.has("_version"))
8854      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8855    if (json.has("status"))
8856      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
8857    if (json.has("_status"))
8858      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8859    if (json.has("type"))
8860      res.setType(parseCodeableConcept(getJObject(json, "type")));
8861    if (json.has("category")) {
8862      JsonArray array = getJArray(json, "category");
8863      for (int i = 0; i < array.size(); i++) {
8864        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8865      }
8866    };
8867    if (json.has("subject")) {
8868      JsonArray array = getJArray(json, "subject");
8869      for (int i = 0; i < array.size(); i++) {
8870        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
8871      }
8872    };
8873    if (json.has("encounter"))
8874      res.setEncounter(parseReference(getJObject(json, "encounter")));
8875    if (json.has("date"))
8876      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8877    if (json.has("_date"))
8878      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8879    if (json.has("useContext")) {
8880      JsonArray array = getJArray(json, "useContext");
8881      for (int i = 0; i < array.size(); i++) {
8882        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8883      }
8884    };
8885    if (json.has("author")) {
8886      JsonArray array = getJArray(json, "author");
8887      for (int i = 0; i < array.size(); i++) {
8888        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
8889      }
8890    };
8891    if (json.has("name"))
8892      res.setNameElement(parseString(json.get("name").getAsString()));
8893    if (json.has("_name"))
8894      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8895    if (json.has("title"))
8896      res.setTitleElement(parseString(json.get("title").getAsString()));
8897    if (json.has("_title"))
8898      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8899    if (json.has("note")) {
8900      JsonArray array = getJArray(json, "note");
8901      for (int i = 0; i < array.size(); i++) {
8902        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8903      }
8904    };
8905    if (json.has("attester")) {
8906      JsonArray array = getJArray(json, "attester");
8907      for (int i = 0; i < array.size(); i++) {
8908        res.getAttester().add(parseCompositionAttesterComponent(array.get(i).getAsJsonObject()));
8909      }
8910    };
8911    if (json.has("custodian"))
8912      res.setCustodian(parseReference(getJObject(json, "custodian")));
8913    if (json.has("relatesTo")) {
8914      JsonArray array = getJArray(json, "relatesTo");
8915      for (int i = 0; i < array.size(); i++) {
8916        res.getRelatesTo().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
8917      }
8918    };
8919    if (json.has("event")) {
8920      JsonArray array = getJArray(json, "event");
8921      for (int i = 0; i < array.size(); i++) {
8922        res.getEvent().add(parseCompositionEventComponent(array.get(i).getAsJsonObject()));
8923      }
8924    };
8925    if (json.has("section")) {
8926      JsonArray array = getJArray(json, "section");
8927      for (int i = 0; i < array.size(); i++) {
8928        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
8929      }
8930    };
8931  }
8932
8933  protected Composition.CompositionAttesterComponent parseCompositionAttesterComponent(JsonObject json) throws IOException, FHIRFormatError {
8934    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
8935    parseCompositionAttesterComponentProperties(json, res);
8936    return res;
8937  }
8938
8939  protected void parseCompositionAttesterComponentProperties(JsonObject json, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
8940    parseBackboneElementProperties(json, res);
8941    if (json.has("mode"))
8942      res.setMode(parseCodeableConcept(getJObject(json, "mode")));
8943    if (json.has("time"))
8944      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
8945    if (json.has("_time"))
8946      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
8947    if (json.has("party"))
8948      res.setParty(parseReference(getJObject(json, "party")));
8949  }
8950
8951  protected Composition.CompositionEventComponent parseCompositionEventComponent(JsonObject json) throws IOException, FHIRFormatError {
8952    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
8953    parseCompositionEventComponentProperties(json, res);
8954    return res;
8955  }
8956
8957  protected void parseCompositionEventComponentProperties(JsonObject json, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
8958    parseBackboneElementProperties(json, res);
8959